From patchwork Fri Apr 26 17:12:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 162929 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp991864jan; Fri, 26 Apr 2019 10:13:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmA8H528QRlj41LoRfTDXxao4hbqBoxWZw6nhiW2f7tS/RSzU3DyJG3PGtDrZJBh1YwenY X-Received: by 2002:a63:f444:: with SMTP id p4mr44844696pgk.32.1556298784827; Fri, 26 Apr 2019 10:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556298784; cv=none; d=google.com; s=arc-20160816; b=omrxXSHUSizgPh/7aatSwBjb5LfHk3cqe73laclRiqVN+zPmVG00FXuYd9s4OYh46O 6GCbHcSKfBIXCprJYD/rSkTT37RYbpyvhuYkbpOD9jh/fizu27YrmByfLO3dB728ZrGF IUZwhnk4SKnkV7rYQ0NvOeJSttx/qCfa5oY54Ad0YRog1CKpyczhaWWSd4RB03IhMFE1 vqrAK/Ip8v+G8ZF1D1/+TD6+QVtIxeFJ/dAo9FxbppiWQkLuxxEFeX/U2XoevAXpIiyf qbIuuOXVUB0bMP9I3ZUMiN4vSjSsYO6JSy+q2APweJRfI2BjceMcAkDF/ovYKsBQUaIj jYMw== 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=Tj8olacDYfKcF5PnqXI2on8sVfvgWdBZkNzjcXWmEn0=; b=P93fPiRR0ff8MuSAuI+MUavOtT+2/K9I6Gek8vpV96H8Tx01yohgAa97gte81opncx 0Wbv2vR8w/sDOVIqcgzXPiuHmD3vdPr7U3bp0EcVWg1zGf411QNd2cMBwnGXDIr/YWI4 tNczNWiU+44Q2uAk5EKsyiwYPnrszs41QyhnJACFvHGAspdMC93bZ8diijDlpONjy6+K yaNt0vvzxCqjMsi6wY3GgUOBkulXZ0ySXcWVA+PdQBPTx3NXNejzuU9iaR5esPBZF5oK ZmKb4po5lLvVvaWX/BViob5N9Wsn5B4sezMTPoF9BwYqScKKoxmgt4S3SpX3djW8DGKM hNdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dbwlt4du; 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 129si24538592pga.379.2019.04.26.10.13.04; Fri, 26 Apr 2019 10:13:04 -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=dbwlt4du; 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 S1726610AbfDZRND (ORCPT + 5 others); Fri, 26 Apr 2019 13:13:03 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:37422 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbfDZRND (ORCPT ); Fri, 26 Apr 2019 13:13:03 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3QHCwZn105167; Fri, 26 Apr 2019 12:12:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556298778; bh=Tj8olacDYfKcF5PnqXI2on8sVfvgWdBZkNzjcXWmEn0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dbwlt4du4jdx2qBZ4hOAs1r4a3RdPIF9O8ZRhM8pXtP8EE9xj/Wj36opSWUZebWO3 wh96RdMQlvxDeaZKA9VNDW348Tb2YaFe95pwsK9kYIXdsicQPTi8VIVeiE+IOCUxN6 LSvM3Tjtr+pjMiCl4OhhpxzfrD9NgRU7/LQ8cpJA= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3QHCwpr122746 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Apr 2019 12:12:58 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 26 Apr 2019 12:12:58 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE112.ent.ti.com (157.170.170.23) 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; Fri, 26 Apr 2019 12:12:58 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3QHCvQv019320; Fri, 26 Apr 2019 12:12:58 -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 v2 07/20] net: ethernet: ti: cpsw: use devm_alloc_etherdev_mqs() Date: Fri, 26 Apr 2019 20:12:29 +0300 Message-ID: <1556298762-8632-8-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556298762-8632-1-git-send-email-grygorii.strashko@ti.com> References: <1556298762-8632-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. Reviewed-by: Andrew Lunn Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/cpsw.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index e771e4269af8..ddc259c45481 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 Fri Apr 26 17:12:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 162934 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp992206jan; Fri, 26 Apr 2019 10:13:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzy9fP8qRfAbzhRpLbGyLaeLn0FYy5Bbvq1s6r70cUEybtbh5jkyJ/z1anqqAxvNOyTwgY7 X-Received: by 2002:a65:5049:: with SMTP id k9mr43302998pgo.229.1556298804416; Fri, 26 Apr 2019 10:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556298804; cv=none; d=google.com; s=arc-20160816; b=onbsr7xUfAycvBhDEThcBHG4YZvuQIkoNtYaTDgAXf96en7V9SDCFjpXbK/3q9MROd /l6Rss5imf3chscknJq03gN+RQ6CnO7HNFpgpOQ2J8THW1XXtlmgfd1LMpoSgSj5xnii 8cZsXwnuLEK6mCmDr8As0qwqjbWLQ6YFUZafS8OzIChgbT3AGA7QbihsI9EzoMt6iGhS gTxyO+JtJF4pfo0OFtpJP6sQxU3UiR67lvEia4dvkVnQ1kjj7aDPlH6GNBXZGrLKWr8T DuQ35dw9yW6n/2P+XnOiYXvpprMGWawyqwVLZO4CXZpay2YR9RwS2PjCG0JVTYTVHpf3 ow5Q== 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=FJ79FWKxjr5nMQ7yXykTBrwlda37Fmsk8w8dpKtChuA=; b=HZKWSvrSh4hzwVMY3zFTUku67FysIo/wgm9w6nVtGuZD0VVFbA57dUh+7y0Wt52zZM gPzO41LpUkQsb2Ma7iBDKHgpQGgFa4VZTXv0Kq4cIMKejyJIfS7SiA1StvPuVngGeU/A uXL987UsWFfEIrGyl5srKMvOP/iCSpkWtIB9i+zC4lQ6fw1tEf1q7kHhOtVDh0v/HKNd IvhMeEmmUbMSshWGEi8c4xTvV0ttUEEU/Z97RoEzddfG04fOcb8cguKeADxVfgnCyFJs ZHyBvdPO4O7+FkxIDS+1RIUzaw+eYo0P9rAK1g6BOqCahoNO1p5ZowGsJAbl/6jGseDT XKKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=jRrj13Yx; 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 i8si25901748pfd.275.2019.04.26.10.13.24; Fri, 26 Apr 2019 10:13:24 -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=jRrj13Yx; 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 S1726960AbfDZRNX (ORCPT + 5 others); Fri, 26 Apr 2019 13:13:23 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:47804 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726952AbfDZRNV (ORCPT ); Fri, 26 Apr 2019 13:13:21 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3QHDHYr072657; Fri, 26 Apr 2019 12:13:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556298797; bh=FJ79FWKxjr5nMQ7yXykTBrwlda37Fmsk8w8dpKtChuA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=jRrj13YxKFjy/LC/TKuOO5WLPm7pjb4NiQtUAi1tNk1LKUB5Erxttx96bdFzMO+0w 7xtF/c+bmvFz4xskepGikAfoZAOfoGu7I9X1nvg72H1wbBp2vhYqtYPU/KSQW5Iy4m 8Hh5isMR0brI57YvsCE3CAZgO8mD+f7p2zuNycO0= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3QHDHn4130283 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Apr 2019 12:13:17 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 26 Apr 2019 12:13:17 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE101.ent.ti.com (10.64.6.22) 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; Fri, 26 Apr 2019 12:13:17 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3QHDFQS119214; Fri, 26 Apr 2019 12:13:16 -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 v2 16/20] net: ethernet: ti: davinci_cpdma: use dma_addr_t for desc_mem_phys and desc_hw_addr Date: Fri, 26 Apr 2019 20:12:38 +0300 Message-ID: <1556298762-8632-17-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556298762-8632-1-git-send-email-grygorii.strashko@ti.com> References: <1556298762-8632-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 dma_addr_t for desc_mem_phys and desc_hw_addr to avoid types conversions. Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/davinci_cpdma.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/davinci_cpdma.h b/drivers/net/ethernet/ti/davinci_cpdma.h index 7d38210f3267..10376062dafa 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.h +++ b/drivers/net/ethernet/ti/davinci_cpdma.h @@ -27,8 +27,8 @@ struct cpdma_params { int num_chan; bool has_soft_reset; int min_packet_size; - u32 desc_mem_phys; - u32 desc_hw_addr; + dma_addr_t desc_mem_phys; + dma_addr_t desc_hw_addr; int desc_mem_size; int desc_align; u32 bus_freq_mhz; From patchwork Fri Apr 26 17:12:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 162936 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp992311jan; Fri, 26 Apr 2019 10:13:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJdYE4pTTkJ0y5odtuj0sr5f64BpQaeZq+vRV8sLYLwhgdiRuZoQrLZVjqzNML/WR2/k6W X-Received: by 2002:a17:902:1103:: with SMTP id d3mr9559222pla.247.1556298810635; Fri, 26 Apr 2019 10:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556298810; cv=none; d=google.com; s=arc-20160816; b=DpA5F7p92fJ5HlysULVKfBqTYDbsWDyLcwavydHnN3WUA272oJdGUvj3xFJbEE59Lw h59byKwj6Q6RaIFL+sHS80XcVRTCQURgB8IVnAsojbDe9bJrsmSEyUK26XRWpxQt7fBk 0p5UaDrF375hwtBPmJxHH1AGAY+pQ2SZuA3tdMHYrjh2qCI4+jl819YEj99MmMnCfxXS ZgLtNKfkN4jeXDCSHhTNJPKk7x2B8sowUl9HUpK1MZGisyAniyabockUWDkrQAOMie2G 4VaDfJOBpA18SkYtwJwu5yUIcrbbzu0H2Ed00iJIaJcb28uFDe+8/ReloOAGeQv6l90H 5l2A== 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=V5EPuHYNpAMp2W5wgRwvISWXYwaOcz3ULcXayIIewZ0=; b=R3k7r4lSlnA1YARqwbfiT2rPyD0T0qHb2D5zJEPCcRfYvF30IkRktT0YYn2LutLm36 h/GK+mqGCqk8exLBkEnOPfUWq92pTXAHHTFGnEf7kHw3Oec7Sf4Sc+jg9gFTHoynkXum 5kUYK09QQaaKirS7anFoSMbEl9Bhjpb75cUNt2nZ2MRrFod8hyOX4OQKNLVCy5ClewtV j/v5P1S6sTIuHuOxdY0wyscKG1Lb3Wz1HIfPa6IustfqFz4ViB9ixe0uIlIQw9G5Xwav 57lz6c6kM6ZEQQZp0lW942jok2APx26aVIo5sB6A5Edfh+8zleymeRioe7tvgLPr0JdV Xetg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=rp2HGzFp; 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 b5si8667150pgn.190.2019.04.26.10.13.30; Fri, 26 Apr 2019 10:13:30 -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=rp2HGzFp; 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 S1727077AbfDZRN2 (ORCPT + 5 others); Fri, 26 Apr 2019 13:13:28 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:37482 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727059AbfDZRN1 (ORCPT ); Fri, 26 Apr 2019 13:13:27 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3QHDN0Q105244; Fri, 26 Apr 2019 12:13:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556298803; bh=V5EPuHYNpAMp2W5wgRwvISWXYwaOcz3ULcXayIIewZ0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rp2HGzFpLzTUq/cBrHc+hDaEB0ur36JckNhwPGFvCGQU9JzaTRIAZCz3WpwxatAJQ pVGO1+zE1J6/gshrWGISKIR6t6tavWNyIZxKJwxNUBqLEElYVSI8cheY2LBa17PcsH s6kLPHJMJzbYd4PLCVk6zCVwOEzCBaHxi+pqkOYE= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3QHDNqE130480 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Apr 2019 12:13:23 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 26 Apr 2019 12:13:23 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE101.ent.ti.com (157.170.170.31) 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; Fri, 26 Apr 2019 12:13:23 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3QHDMC0021153; Fri, 26 Apr 2019 12:13:22 -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 v2 19/20] net: ethernet: ti: cpsw: switch to use mac sl api Date: Fri, 26 Apr 2019 20:12:41 +0300 Message-ID: <1556298762-8632-20-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556298762-8632-1-git-send-email-grygorii.strashko@ti.com> References: <1556298762-8632-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 4219b13e6a8e..4449f2eeac09 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" @@ -826,29 +827,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; @@ -862,12 +866,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; } @@ -1103,24 +1109,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: @@ -1146,7 +1146,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 */ @@ -1309,7 +1310,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 d4d1e0b397bc..476d050a022c 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, @@ -78,8 +79,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 53bd6e020f94..fc1a8dee391e 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)