From patchwork Tue Apr 23 13:08:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 162677 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3769876jan; Tue, 23 Apr 2019 06:09:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwQlG49EzTCK6Lm49AIC2ih/KYygzc2hYWcMta/M2lPbqDDrpK7h5Bchp+aIIzbQj6nzO1 X-Received: by 2002:a62:1815:: with SMTP id 21mr26707192pfy.107.1556024972725; Tue, 23 Apr 2019 06:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556024972; cv=none; d=google.com; s=arc-20160816; b=V4tsO7TYRbiqEoFJTB/MCo8FYrGeAZXQU734yknD+xYA3fLz/r83bRGQTpo9vvGmPo 9D85coxWmVD0ERQXTk37UxvBbzMVbq8OihfzJG69HuIxojBJfIQa9rm0I0VRawYKDghO PSpGOJXQYFK8k4WIIspEW+sulELjJpZuXEWuFkZT1RGy1JaCADU9fVLNpnQwyqmnJyMA ll2ufgRSqOmkY6bX5+QjvTUxfWtyLmEE6O+d562BZ5GOT1KSJgohFGnOngizJ7BNGmST WcBce3C6y648x1+y8j4cRSbQhY9H3xt4O1P4kzgFLHwLteCaSWC1TnWTAv6sIuv8QzIo gJ2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=C7eS500OVaMb2VSktLxrUDNDB3N2S7eX6aau3ZJA4U0=; b=kpCi7aUjZTkGNWchqCjmJB5qm4LcHvVtL4C3sMsnqPGYX7dmQYUTZeiMAvVF4oG+G+ WUu5c2WVwjXA8fsrkEIGL6je7V2ivyKbW69fgFnNAAOCuC1r7Vk6XpM2UGWwuTGnp+Pp hCbDzuYkgnUlscNg1pQb9UhZXfQx3It5Lz3nN3Bzp5isVqT7YalJyhvRirZPpr1k66ui O2W6IfHeKGhwX+ydq0/es5QunnUBGCMPX0upqQQT+X+od6CFWMbR6gM/f4LGqQhUwnyJ CiOtPQddbB86rGjkEIqVV8xgrIsRjOyrpThzmyM6JUjfG7VGPKFf4+8cMeNaypg2F0Au bLsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="Vh/0vicG"; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si15786893pls.114.2019.04.23.06.09.32; Tue, 23 Apr 2019 06:09:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="Vh/0vicG"; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727871AbfDWNJb (ORCPT + 5 others); Tue, 23 Apr 2019 09:09:31 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:58106 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727458AbfDWNJa (ORCPT ); Tue, 23 Apr 2019 09:09:30 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3ND9QuY066407; Tue, 23 Apr 2019 08:09:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556024966; bh=C7eS500OVaMb2VSktLxrUDNDB3N2S7eX6aau3ZJA4U0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Vh/0vicG+MShQ+guXN0VUf7U2bXsn99pyUP1cs1Du5BOMW4OP1agT3+nPSfnDOdNv tVzE37DanrqsicGD7f0fuSq24psF6vAbFk41e/gyixa3slV3EAubmV2RsWrYYpdtXT AlZAzvk2PcJ0giU29ABeCVPeBeZBFxx0zUeg5CA8= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3ND9QVi096635 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Apr 2019 08:09:26 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 23 Apr 2019 08:09:26 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 23 Apr 2019 08:09:25 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3ND9Pxm126123; Tue, 23 Apr 2019 08:09:25 -0500 From: Grygorii Strashko To: , Ilias Apalodimas , "David S . Miller" , Ivan Khoronzhuk CC: Florian Fainelli , Andrew Lunn , Sekhar Nori , , , Murali Karicheri , Grygorii Strashko Subject: [PATCH net-next 07/19] net: ethernet: ti: cpsw: use devm_alloc_etherdev_mqs() Date: Tue, 23 Apr 2019 16:08:58 +0300 Message-ID: <1556024950-20752-8-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556024950-20752-1-git-send-email-grygorii.strashko@ti.com> References: <1556024950-20752-1-git-send-email-grygorii.strashko@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Use devm_alloc_etherdev_mqs() and simplify code. Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/cpsw.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- 2.17.1 Reviewed-by: Andrew Lunn diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 17dd81f25f5e..e714b8f4739c 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -3399,7 +3399,8 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv) struct cpsw_priv *priv_sl2; int ret = 0; - ndev = alloc_etherdev_mq(sizeof(struct cpsw_priv), CPSW_MAX_QUEUES); + ndev = devm_alloc_etherdev_mqs(cpsw->dev, sizeof(struct cpsw_priv), + CPSW_MAX_QUEUES, CPSW_MAX_QUEUES); if (!ndev) { dev_err(cpsw->dev, "cpsw: error allocating net_device\n"); return -ENOMEM; @@ -3433,11 +3434,8 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv) /* register the network device */ SET_NETDEV_DEV(ndev, cpsw->dev); ret = register_netdev(ndev); - if (ret) { + if (ret) dev_err(cpsw->dev, "cpsw: error registering net device\n"); - free_netdev(ndev); - ret = -ENODEV; - } return ret; } @@ -3481,7 +3479,8 @@ static int cpsw_probe(struct platform_device *pdev) cpsw->dev = dev; - ndev = alloc_etherdev_mq(sizeof(struct cpsw_priv), CPSW_MAX_QUEUES); + ndev = devm_alloc_etherdev_mqs(dev, sizeof(struct cpsw_priv), + CPSW_MAX_QUEUES, CPSW_MAX_QUEUES); if (!ndev) { dev_err(dev, "error allocating net_device\n"); return -ENOMEM; @@ -3499,7 +3498,7 @@ static int cpsw_probe(struct platform_device *pdev) if (IS_ERR(mode)) { ret = PTR_ERR(mode); dev_err(dev, "gpio request failed, ret %d\n", ret); - goto clean_ndev_ret; + return ret; } /* @@ -3768,8 +3767,6 @@ static int cpsw_probe(struct platform_device *pdev) pm_runtime_put_sync(&pdev->dev); clean_runtime_disable_ret: pm_runtime_disable(&pdev->dev); -clean_ndev_ret: - free_netdev(priv->ndev); return ret; } @@ -3794,9 +3791,6 @@ static int cpsw_remove(struct platform_device *pdev) cpsw_remove_dt(pdev); pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); - if (cpsw->data.dual_emac) - free_netdev(cpsw->slaves[1].ndev); - free_netdev(ndev); return 0; } From patchwork Tue Apr 23 13:09:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 162683 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3770396jan; Tue, 23 Apr 2019 06:09:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvknGyKumVXWh3bItEoUf2vHEcjYTc3Yuv4fOiBwYkv63ByzwTimGJ6xT3+8aiO+s0TPsd X-Received: by 2002:a63:1d4f:: with SMTP id d15mr23828152pgm.347.1556024998040; Tue, 23 Apr 2019 06:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556024998; cv=none; d=google.com; s=arc-20160816; b=d0ZoImz3IEQ0l99Zoc/guiJ15ojMiai4SzMixC2o31wSVMiRhcNsqnvLtO6XA+SXgj 8mGo0Bnk0B29liMF4Y/54dSoXzePnkJ61AB6ihTFhUiXsGxcM4YS1JnIE9Z3V4XPbBSk mXcAQdEhGbYC7bPer/QrNs8HjtWZXgjNMIafPsqz9Kk6jWTIpS/qA+pLwVd/ckA6XJtf ktrlPgTvXdSThZtrliDH0wdblOoPV7aww1cQsi1MlQIJFfcNZCnvoAOznlk6QWhbLh77 5LgDpPWn0Jfc6211+wXvgO4Oq7mA2L/FvCT/nZOCNWhkP0IF4i3NbtJVPVoBTg/VyWil tc9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=qG0GDQ9fY5o7d3qhtktJTTwsrtFUwVKsItGq/S0WaZY=; b=s5tweUXrZLcMR01P5bcaWN1GO/SKbtwvgBYWej8/aV+Ci+3aKqnD/iyUQmgGrg3YRo H3Lhcj/K6G+oMpaGMXnjVjzPWwoZcA7YDsofO2cQjEknq0dyMxKJ7i59lQciO5c/ExZf HBNSrd0q155P1eJqm4/Bey1/UfjXidks9//5XiW90bqr8bAdfO3H4CUb9JBPpD9kO+f9 1/Xf5wunYIRk0aWNkYSigtxY7CYqGV30Ni55Hs3BLDn3xPqGdD9qExPxXUbo45LNid6f my2KR8uiFqYefP698X/NBkRkKH0CLoaeuM4tHe8vYhmxgSn2Nzps4qYNSCLrSk/VOPAp lB0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=SOCLxidj; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si15185173pge.187.2019.04.23.06.09.57; Tue, 23 Apr 2019 06:09:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=SOCLxidj; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728051AbfDWNJ4 (ORCPT + 5 others); Tue, 23 Apr 2019 09:09:56 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:45572 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728010AbfDWNJs (ORCPT ); Tue, 23 Apr 2019 09:09:48 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3ND9iKB085827; Tue, 23 Apr 2019 08:09:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556024984; bh=qG0GDQ9fY5o7d3qhtktJTTwsrtFUwVKsItGq/S0WaZY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=SOCLxidjtWigJz3DQQ3yUgLljZNjcZtkb2ZOuxSpkbjwNB/MOg4TrIDJZ7+cy+2Cb kytZzdJFQNqGOO7/jGsclLjMBvQ5YpK/jp3eh6Qd8cGlhyrdEzHqPH8Y6sN1BVQV/M iEfqR7QcUZpDz+YZ0avR1XmYv4bJZYKvXb/xiQLc= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3ND9i99045862 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Apr 2019 08:09:44 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 23 Apr 2019 08:09:43 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 23 Apr 2019 08:09:43 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3ND9gkA126430; Tue, 23 Apr 2019 08:09:43 -0500 From: Grygorii Strashko To: , Ilias Apalodimas , "David S . Miller" , Ivan Khoronzhuk CC: Florian Fainelli , Andrew Lunn , Sekhar Nori , , , Murali Karicheri , Grygorii Strashko Subject: [PATCH net-next 18/19] net: ethernet: ti: cpsw: switch to use mac sl api Date: Tue, 23 Apr 2019 16:09:09 +0300 Message-ID: <1556024950-20752-19-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556024950-20752-1-git-send-email-grygorii.strashko@ti.com> References: <1556024950-20752-1-git-send-email-grygorii.strashko@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Switch CPSW driver to use the new MAC SL API. Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/Makefile | 2 +- drivers/net/ethernet/ti/cpsw.c | 54 +++++++++++++++-------------- drivers/net/ethernet/ti/cpsw_priv.c | 5 ++- drivers/net/ethernet/ti/cpsw_priv.h | 15 +------- 4 files changed, 34 insertions(+), 42 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile index de1561596646..0a75c1957626 100644 --- a/drivers/net/ethernet/ti/Makefile +++ b/drivers/net/ethernet/ti/Makefile @@ -14,7 +14,7 @@ obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o obj-$(CONFIG_TI_CPTS_MOD) += cpts.o obj-$(CONFIG_TI_CPSW) += ti_cpsw.o -ti_cpsw-y := cpsw.o davinci_cpdma.o cpsw_ale.o cpsw_priv.o +ti_cpsw-y := cpsw.o davinci_cpdma.o cpsw_ale.o cpsw_priv.o cpsw_sl.o obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o keystone_netcp-y := netcp_core.o cpsw_ale.o diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index a6c3d8be1649..ba1fb8578e8d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -38,6 +38,7 @@ #include "cpsw.h" #include "cpsw_ale.h" #include "cpsw_priv.h" +#include "cpsw_sl.h" #include "cpts.h" #include "davinci_cpdma.h" @@ -813,29 +814,32 @@ static void _cpsw_adjust_link(struct cpsw_slave *slave, slave_port = cpsw_get_slave_port(slave->slave_num); if (phy->link) { - mac_control = cpsw->data.mac_control; - - /* enable forwarding */ - cpsw_ale_control_set(cpsw->ale, slave_port, - ALE_PORT_STATE, ALE_PORT_STATE_FORWARD); + mac_control = CPSW_SL_CTL_GMII_EN; if (phy->speed == 1000) - mac_control |= BIT(7); /* GIGABITEN */ + mac_control |= CPSW_SL_CTL_GIG; if (phy->duplex) - mac_control |= BIT(0); /* FULLDUPLEXEN */ + mac_control |= CPSW_SL_CTL_FULLDUPLEX; /* set speed_in input in case RMII mode is used in 100Mbps */ if (phy->speed == 100) - mac_control |= BIT(15); + mac_control |= CPSW_SL_CTL_IFCTL_A; /* in band mode only works in 10Mbps RGMII mode */ else if ((phy->speed == 10) && phy_interface_is_rgmii(phy)) - mac_control |= BIT(18); /* In Band mode */ + mac_control |= CPSW_SL_CTL_EXT_EN; /* In Band mode */ if (priv->rx_pause) - mac_control |= BIT(3); + mac_control |= CPSW_SL_CTL_RX_FLOW_EN; if (priv->tx_pause) - mac_control |= BIT(4); + mac_control |= CPSW_SL_CTL_TX_FLOW_EN; + + if (mac_control != slave->mac_control) + cpsw_sl_ctl_set(slave->mac_sl, mac_control); + + /* enable forwarding */ + cpsw_ale_control_set(cpsw->ale, slave_port, + ALE_PORT_STATE, ALE_PORT_STATE_FORWARD); *link = true; @@ -849,12 +853,14 @@ static void _cpsw_adjust_link(struct cpsw_slave *slave, /* disable forwarding */ cpsw_ale_control_set(cpsw->ale, slave_port, ALE_PORT_STATE, ALE_PORT_STATE_DISABLE); + + cpsw_sl_wait_for_idle(slave->mac_sl, 100); + + cpsw_sl_ctl_reset(slave->mac_sl); } - if (mac_control != slave->mac_control) { + if (mac_control != slave->mac_control) phy_print_status(phy); - writel_relaxed(mac_control, &slave->sliver->mac_control); - } slave->mac_control = mac_control; } @@ -1090,24 +1096,18 @@ static inline void cpsw_add_dual_emac_def_ale_entries( ALE_PORT_DROP_UNKNOWN_VLAN, 1); } -static void soft_reset_slave(struct cpsw_slave *slave) -{ - char name[32]; - - snprintf(name, sizeof(name), "slave-%d", slave->slave_num); - soft_reset(name, &slave->sliver->soft_reset); -} - static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) { u32 slave_port; struct phy_device *phy; struct cpsw_common *cpsw = priv->cpsw; - soft_reset_slave(slave); + cpsw_sl_reset(slave->mac_sl, 100); + cpsw_sl_ctl_reset(slave->mac_sl); /* setup priority mapping */ - writel_relaxed(RX_PRIORITY_MAPPING, &slave->sliver->rx_pri_map); + cpsw_sl_reg_write(slave->mac_sl, CPSW_SL_RX_PRI_MAP, + RX_PRIORITY_MAPPING); switch (cpsw->version) { case CPSW_VERSION_1: @@ -1133,7 +1133,8 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) } /* setup max packet size, and mac address */ - writel_relaxed(cpsw->rx_packet_max, &slave->sliver->rx_maxlen); + cpsw_sl_reg_write(slave->mac_sl, CPSW_SL_RX_MAXLEN, + cpsw->rx_packet_max); cpsw_set_slave_mac(slave, priv); slave->mac_control = 0; /* no link yet */ @@ -1296,7 +1297,8 @@ static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_common *cpsw) slave->phy = NULL; cpsw_ale_control_set(cpsw->ale, slave_port, ALE_PORT_STATE, ALE_PORT_STATE_DISABLE); - soft_reset_slave(slave); + cpsw_sl_reset(slave->mac_sl, 100); + cpsw_sl_ctl_reset(slave->mac_sl); } static int cpsw_tc_to_fifo(int tc, int num_tc) diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c index 208c544d0b80..468746a7593e 100644 --- a/drivers/net/ethernet/ti/cpsw_priv.c +++ b/drivers/net/ethernet/ti/cpsw_priv.c @@ -16,6 +16,7 @@ #include "cpts.h" #include "cpsw_ale.h" #include "cpsw_priv.h" +#include "cpsw_sl.h" #include "davinci_cpdma.h" int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs, @@ -77,8 +78,10 @@ int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs, slave->slave_num = i; slave->data = &cpsw->data.slave_data[i]; slave->regs = regs + slave_offset; - slave->sliver = regs + sliver_offset; slave->port_vlan = slave->data->dual_emac_res_vlan; + slave->mac_sl = cpsw_sl_get("cpsw", dev, regs + sliver_offset); + if (IS_ERR(slave->mac_sl)) + return PTR_ERR(slave->mac_sl); slave_offset += slave_size; sliver_offset += SLIVER_SIZE; diff --git a/drivers/net/ethernet/ti/cpsw_priv.h b/drivers/net/ethernet/ti/cpsw_priv.h index 4004140fc4d0..74622a50af96 100644 --- a/drivers/net/ethernet/ti/cpsw_priv.h +++ b/drivers/net/ethernet/ti/cpsw_priv.h @@ -269,19 +269,6 @@ struct cpsw_host_regs { u32 cpdma_rx_chan_map; }; -struct cpsw_sliver_regs { - u32 id_ver; - u32 mac_control; - u32 mac_status; - u32 soft_reset; - u32 rx_maxlen; - u32 __reserved_0; - u32 rx_pause; - u32 tx_pause; - u32 __reserved_1; - u32 rx_pri_map; -}; - struct cpsw_hw_stats { u32 rxgoodframes; u32 rxbroadcastframes; @@ -344,13 +331,13 @@ struct cpsw_platform_data { struct cpsw_slave { void __iomem *regs; - struct cpsw_sliver_regs __iomem *sliver; int slave_num; u32 mac_control; struct cpsw_slave_data *data; struct phy_device *phy; struct net_device *ndev; u32 port_vlan; + struct cpsw_sl *mac_sl; }; static inline u32 slave_read(struct cpsw_slave *slave, u32 offset)