From patchwork Fri Jan 10 08:28:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1220884 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=k8KUTo3+; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47vGP72C66z9sRK for ; Fri, 10 Jan 2020 19:29:31 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727110AbgAJI3a (ORCPT ); Fri, 10 Jan 2020 03:29:30 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39189 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727052AbgAJI3a (ORCPT ); Fri, 10 Jan 2020 03:29:30 -0500 Received: by mail-lf1-f65.google.com with SMTP id y1so805257lfb.6 for ; Fri, 10 Jan 2020 00:29:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dhuWFoLN+p/zW9CrUBh7lo8WyMSn75f3fT5RdnGMkpw=; b=k8KUTo3+/a8j1p7e1vMutnGVrS2UpyEGoz5HeZHhPmzRR8TGdo/Vw3ec/+mOl4xRWa lLNi2rEiI55sZa4w02Umxt/jvuUv+LxseviNlwjFu5eae7ry1W4P7FCOQSrRTgCenH9v f5IgrBYqv1oBEwiKPz8rOVgUvyXRycwnYob9PZxdj0biL233KqEnieKTw/YXKUGkWizZ WscDrv5iZhr/Zmgk7rC+oxvqiJdO5IPruG16akeXPnpgf/8y62fjll2OBfb8Wm6OCBhO PzWV16juKt56XQkQgKgRdZjxOJ3/9MPK+aRrJTRCVghYQAAWfInmYckQAnP0i2cUbGWX m4qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dhuWFoLN+p/zW9CrUBh7lo8WyMSn75f3fT5RdnGMkpw=; b=DdjqWI9Y9Uk2VanrXTJkQXG+/Wmf2UMb0cpyzJcsco+BZ6eXA9djkt1cFQmzMVjLDb WGvMeVR7FsQL1RRfeMN2JsD/kAHmhD4AnPQr3rRjdATclT6auyJSg8NdLD/9kxOLmPst 3AyebVuk03c7QokIhnwWYR+kVlPb7xdzkPLrzrgRHViN3J5ghD4pa4lhGwmAVUaQCOYx RENcSmINhfGu7tJwbw/FyFHeM7IO26vyac1nkvsTNa4cpvrjf/35n49K1Gnse1d9vetF iX6nsgICauHt99nXDyoO2yIGLLUKetB4epqkuWeUwyM1/Q3mQtE+9s9QsGDvE/ipihTQ g/0w== X-Gm-Message-State: APjAAAV4cwsaJ/0U3PdGI8HHIYiG9/qlzRqdJmSC+DXfp/QJtmP1YTrT STj4SJoU8S2stirmsnc4fIyR882JuPurBQ== X-Google-Smtp-Source: APXvYqwcDZ5YZlulFcUhud8askhKNoTgmO20ABf18AKXPogcog8fUA1uFY5jBhueYQikQE/DhzJEhA== X-Received: by 2002:a19:c697:: with SMTP id w145mr1445216lff.54.1578644968247; Fri, 10 Jan 2020 00:29:28 -0800 (PST) Received: from linux.local (c-5ac9225c.014-348-6c756e10.bbcust.telenor.se. [92.34.201.90]) by smtp.gmail.com with ESMTPSA id g24sm606464lfb.85.2020.01.10.00.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 00:29:27 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Jakub Kicinski , Linus Walleij Subject: [PATCH net-next 1/9 v4] wan: ixp4xx_hss: fix compile-testing on 64-bit Date: Fri, 10 Jan 2020 09:28:29 +0100 Message-Id: <20200110082837.11473-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200110082837.11473-1-linus.walleij@linaro.org> References: <20200110082837.11473-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann Change the driver to use portable integer types to avoid warnings during compile testing: drivers/net/wan/ixp4xx_hss.c:863:21: error: cast to 'u32 *' (aka 'unsigned int *') from smaller integer type 'int' [-Werror,-Wint-to-pointer-cast] memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); ^ drivers/net/wan/ixp4xx_hss.c:979:12: error: incompatible pointer types passing 'u32 *' (aka 'unsigned int *') to parameter of type 'dma_addr_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types] &port->desc_tab_phys))) ^~~~~~~~~~~~~~~~~~~~ include/linux/dmapool.h:27:20: note: passing argument to parameter 'handle' here dma_addr_t *handle); ^ Signed-off-by: Arnd Bergmann Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop a stable tag and rebubmit. ChangeLog v2->v3: - Rebased on v5.5-rc1 ChangeLog v1->v2: - Just resending with the rest --- drivers/net/wan/ixp4xx_hss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index ea6ee6a608ce..e7619cec978a 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c @@ -258,7 +258,7 @@ struct port { struct hss_plat_info *plat; buffer_t *rx_buff_tab[RX_DESCS], *tx_buff_tab[TX_DESCS]; struct desc *desc_tab; /* coherent */ - u32 desc_tab_phys; + dma_addr_t desc_tab_phys; unsigned int id; unsigned int clock_type, clock_rate, loopback; unsigned int initialized, carrier; @@ -858,7 +858,7 @@ static int hss_hdlc_xmit(struct sk_buff *skb, struct net_device *dev) dev->stats.tx_dropped++; return NETDEV_TX_OK; } - memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); + memcpy_swab32(mem, (u32 *)((uintptr_t)skb->data & ~3), bytes / 4); dev_kfree_skb(skb); #endif From patchwork Fri Jan 10 08:28:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1220885 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=U1bLDcih; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47vGPB4PFYz9sRK for ; Fri, 10 Jan 2020 19:29:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbgAJI3d (ORCPT ); Fri, 10 Jan 2020 03:29:33 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46747 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727052AbgAJI3d (ORCPT ); Fri, 10 Jan 2020 03:29:33 -0500 Received: by mail-lj1-f193.google.com with SMTP id m26so1200818ljc.13 for ; Fri, 10 Jan 2020 00:29:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K3ii0H1dfOOS7y2Yva1vZyNaTqWDG+H+ZMG2mMpQyBg=; b=U1bLDcihPwRZfGl62bh/ae6rk9QgzmW54OhXSY0TQzlcXDxs01aJfiG34x0LjwWWhs Ya6VHCFjWPu2owiHBiPUuu0noPv6vIE7uN44suB8DJQWXiLMMBr1TpyGHiCMVGSs65aK 3hXK/jFnfOi9+NxQD12k8JevJhypJ5rWNsHFtCQKqVzaDelPjDH8zT1NoM/77v0HW9nK CbIBRoC/jAB8ZASKnDoQ62vuh4PIjrlsYwuQkBKS8ahPfBS4n0tZ8Lwe+dUupTDfmmHG fvuxMZKBfUtATswphSF+Ud3DgHRMM27o23iCUQEfYDeh9WUCgBc2WqP/1thXbUpylymo 3ySA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K3ii0H1dfOOS7y2Yva1vZyNaTqWDG+H+ZMG2mMpQyBg=; b=G+VqFMYiLZtvzufKRsa5nQbzN1Lif4A9hgD1VoqK4nqkio+t9btd6mJlv/hGtIKbvM P+8Zsp5kFFVC5PGBWMP5Yso+EmSV/AFXfSx6TWSub5noNbvORy4RhhtiMDgq7aG2oOhX AD43yF3u8RzDBDt1VMiqoXJu8M0eop4gcRiy3AVZ6AhV/QM8K9X7/0AJELzgEmgNmclx 7k34gJdHvK+BQfw0RVvaaqPP6GMYdhuNUSe3VMoLU/Cqhoz9/v/BrHmWTs/1Uo8ulLFN 2pE7nDM+Q3xZKrVKk3srQcMlB6Xh2ISw5HOEvNw3XS1uFR5owQtzEJbv5YoqwgyePXE5 mzHA== X-Gm-Message-State: APjAAAXanQQN3/Y8+3tVuHrKH4E6qpK+846D6UIS2NYNJBi7ebtNkqDx RyrnJr4Sdw7NA5QOPY1YCThb1loXFLRRRQ== X-Google-Smtp-Source: APXvYqx9lNVcs/lMkjYHaDqsFy8E1tHUOUB+AGTPtpzdGQRgQ6BFRGWafE5cKpzobxeW/DAnROmrgg== X-Received: by 2002:a2e:b554:: with SMTP id a20mr1770303ljn.25.1578644970014; Fri, 10 Jan 2020 00:29:30 -0800 (PST) Received: from linux.local (c-5ac9225c.014-348-6c756e10.bbcust.telenor.se. [92.34.201.90]) by smtp.gmail.com with ESMTPSA id g24sm606464lfb.85.2020.01.10.00.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 00:29:29 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Jakub Kicinski , Linus Walleij Subject: [PATCH net-next 2/9 v4] wan: ixp4xx_hss: prepare compile testing Date: Fri, 10 Jan 2020 09:28:30 +0100 Message-Id: <20200110082837.11473-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200110082837.11473-1-linus.walleij@linaro.org> References: <20200110082837.11473-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann The ixp4xx_hss driver needs the platform data definition and the system clock rate to be compiled. Move both into a new platform_data header file. This is a prerequisite for compile testing, but turning on compile testing requires further patches to isolate the SoC headers. Signed-off-by: Arnd Bergmann Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop a stable tag and rebubmit. ChangeLog v2->v3: - Rebased on v5.5-rc1 ChangeLog v1->v2: - Drop the change actually enabling compile testing in Kconfig but keep the rest around so we are prepared. (Need the SoC include changes to actually enable it.) - Rename to "prepare" --- arch/arm/mach-ixp4xx/goramo_mlr.c | 4 +++ arch/arm/mach-ixp4xx/include/mach/platform.h | 9 ----- drivers/net/wan/Kconfig | 3 +- drivers/net/wan/ixp4xx_hss.c | 35 +++++++++++--------- include/linux/platform_data/wan_ixp4xx_hss.h | 17 ++++++++++ 5 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 include/linux/platform_data/wan_ixp4xx_hss.h diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c index a0e0b6b7dc5c..93b7afeee142 100644 --- a/arch/arm/mach-ixp4xx/goramo_mlr.c +++ b/arch/arm/mach-ixp4xx/goramo_mlr.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -405,6 +406,9 @@ static void __init gmlr_init(void) if (hw_bits & CFG_HW_HAS_HSS1) device_tab[devices++] = &device_hss_tab[1]; /* max index 5 */ + hss_plat[0].timer_freq = ixp4xx_timer_freq; + hss_plat[1].timer_freq = ixp4xx_timer_freq; + gpio_request(GPIO_SCL, "SCL/clock"); gpio_request(GPIO_SDA, "SDA/data"); gpio_request(GPIO_STR, "strobe"); diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h index 342acbe20f7c..04ef8025accc 100644 --- a/arch/arm/mach-ixp4xx/include/mach/platform.h +++ b/arch/arm/mach-ixp4xx/include/mach/platform.h @@ -104,15 +104,6 @@ struct eth_plat_info { u8 hwaddr[6]; }; -/* Information about built-in HSS (synchronous serial) interfaces */ -struct hss_plat_info { - int (*set_clock)(int port, unsigned int clock_type); - int (*open)(int port, void *pdev, - void (*set_carrier_cb)(void *pdev, int carrier)); - void (*close)(int port, void *pdev); - u8 txreadyq; -}; - /* * Frequency of clock used for primary clocksource */ diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig index dd1a147f2971..4530840e15ef 100644 --- a/drivers/net/wan/Kconfig +++ b/drivers/net/wan/Kconfig @@ -315,7 +315,8 @@ config DSCC4_PCI_RST config IXP4XX_HSS tristate "Intel IXP4xx HSS (synchronous serial port) support" - depends on HDLC && ARM && ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR + depends on HDLC && IXP4XX_NPE && IXP4XX_QMGR + depends on ARCH_IXP4XX help Say Y here if you want to use built-in HSS ports on IXP4xx processor. diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index e7619cec978a..7c5cf77e9ef1 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1182,14 +1183,14 @@ static int hss_hdlc_attach(struct net_device *dev, unsigned short encoding, } } -static u32 check_clock(u32 rate, u32 a, u32 b, u32 c, +static u32 check_clock(u32 timer_freq, u32 rate, u32 a, u32 b, u32 c, u32 *best, u32 *best_diff, u32 *reg) { /* a is 10-bit, b is 10-bit, c is 12-bit */ u64 new_rate; u32 new_diff; - new_rate = ixp4xx_timer_freq * (u64)(c + 1); + new_rate = timer_freq * (u64)(c + 1); do_div(new_rate, a * (c + 1) + b + 1); new_diff = abs((u32)new_rate - rate); @@ -1201,40 +1202,43 @@ static u32 check_clock(u32 rate, u32 a, u32 b, u32 c, return new_diff; } -static void find_best_clock(u32 rate, u32 *best, u32 *reg) +static void find_best_clock(u32 timer_freq, u32 rate, u32 *best, u32 *reg) { u32 a, b, diff = 0xFFFFFFFF; - a = ixp4xx_timer_freq / rate; + a = timer_freq / rate; if (a > 0x3FF) { /* 10-bit value - we can go as slow as ca. 65 kb/s */ - check_clock(rate, 0x3FF, 1, 1, best, &diff, reg); + check_clock(timer_freq, rate, 0x3FF, 1, 1, best, &diff, reg); return; } if (a == 0) { /* > 66.666 MHz */ a = 1; /* minimum divider is 1 (a = 0, b = 1, c = 1) */ - rate = ixp4xx_timer_freq; + rate = timer_freq; } - if (rate * a == ixp4xx_timer_freq) { /* don't divide by 0 later */ - check_clock(rate, a - 1, 1, 1, best, &diff, reg); + if (rate * a == timer_freq) { /* don't divide by 0 later */ + check_clock(timer_freq, rate, a - 1, 1, 1, best, &diff, reg); return; } for (b = 0; b < 0x400; b++) { u64 c = (b + 1) * (u64)rate; - do_div(c, ixp4xx_timer_freq - rate * a); + do_div(c, timer_freq - rate * a); c--; if (c >= 0xFFF) { /* 12-bit - no need to check more 'b's */ if (b == 0 && /* also try a bit higher rate */ - !check_clock(rate, a - 1, 1, 1, best, &diff, reg)) + !check_clock(timer_freq, rate, a - 1, 1, 1, best, + &diff, reg)) return; - check_clock(rate, a, b, 0xFFF, best, &diff, reg); + check_clock(timer_freq, rate, a, b, 0xFFF, best, + &diff, reg); return; } - if (!check_clock(rate, a, b, c, best, &diff, reg)) + if (!check_clock(timer_freq, rate, a, b, c, best, &diff, reg)) return; - if (!check_clock(rate, a, b, c + 1, best, &diff, reg)) + if (!check_clock(timer_freq, rate, a, b, c + 1, best, &diff, + reg)) return; } } @@ -1285,8 +1289,9 @@ static int hss_hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) port->clock_type = clk; /* Update settings */ if (clk == CLOCK_INT) - find_best_clock(new_line.clock_rate, &port->clock_rate, - &port->clock_reg); + find_best_clock(port->plat->timer_freq, + new_line.clock_rate, + &port->clock_rate, &port->clock_reg); else { port->clock_rate = 0; port->clock_reg = CLK42X_SPEED_2048KHZ; diff --git a/include/linux/platform_data/wan_ixp4xx_hss.h b/include/linux/platform_data/wan_ixp4xx_hss.h new file mode 100644 index 000000000000..d525a0feb9e1 --- /dev/null +++ b/include/linux/platform_data/wan_ixp4xx_hss.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __PLATFORM_DATA_WAN_IXP4XX_HSS_H +#define __PLATFORM_DATA_WAN_IXP4XX_HSS_H + +#include + +/* Information about built-in HSS (synchronous serial) interfaces */ +struct hss_plat_info { + int (*set_clock)(int port, unsigned int clock_type); + int (*open)(int port, void *pdev, + void (*set_carrier_cb)(void *pdev, int carrier)); + void (*close)(int port, void *pdev); + u8 txreadyq; + u32 timer_freq; +}; + +#endif From patchwork Fri Jan 10 08:28:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1220886 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ABsP9dBu; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47vGPC2DcBz9sRQ for ; Fri, 10 Jan 2020 19:29:35 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727134AbgAJI3e (ORCPT ); Fri, 10 Jan 2020 03:29:34 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:41745 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726666AbgAJI3d (ORCPT ); Fri, 10 Jan 2020 03:29:33 -0500 Received: by mail-lj1-f193.google.com with SMTP id h23so1219335ljc.8 for ; Fri, 10 Jan 2020 00:29:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/DyHb62mHtC09zvM8IqL1LuJPDw+xo32O1B4WTTR8E8=; b=ABsP9dBuC8l0emcuXqNBCphkSBcoO29DeAW/NeyFfZcnMzOAfsP28VZY77LUQAlbrF FX1g58XiyHI2Hf07yk7lGH22HG+tyiKbBF2s7ZWTxgCzbApvaocclZ0cNib6wphs4KQA sAybMadldd0Vju6D4ocFiKgAedeqJWuURiB56+w2HBql+deZ1VkPu5lm1kxMw1ANxzvD tbtYwdo8MTi+o7CWhbw9dC2savLuZPEoRyCZf1Da+4lkhNq+kpeTDsT93+C1wmOSIT5m BQSJsRAxpZ1M+TcufBTbsL3A4xSdewc6L8nnhSJlFShIEpsJ40oO4CUSmY4A+8tqCQ2S x5lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/DyHb62mHtC09zvM8IqL1LuJPDw+xo32O1B4WTTR8E8=; b=Lpi/KdqY8l9ukaZXBbftWq3Rm7wyuVgLfFqWUW+9VU1FksGWxXJW+sj24TQnqptVQo 7TP1bqnnQnz1xDBaghvN3spbz5axv43g+iGpeo4QMiQX/f17/e30P7/1V7/avh3v2fNp 6A48i5pN6oWkL0rIf0piFxrJcM2xlMvMPH1xT63fuzQIZBwyyAUA1O6Upmj9DI1K6Ql9 iuZLnBxyqooVIvso9Qkfz5QtMzDfgcUG0Y1PICjiGeHd5788kkNDyx0L+toRmby0vpQq +Y7b0119nEgqy6Q7OWJrDzHu5zlOehOQOjM4ypmhvJUvhsrGb3vlMWQohSoZ4n1aOcmP Y7aA== X-Gm-Message-State: APjAAAVjgB13xrXX/C0Jv9Cf7O5MrlpSx5s7oAnFNrinvpYZPvyslFsk EUnSVV4IGhp3f1nXvXju51mP2fe73UzjDA== X-Google-Smtp-Source: APXvYqxlQer3DnrfN2KWz8ReSjFZDX/dGNQFxW+7CftmPboGwl64Qtv4WDek/1X9jGIBzYsAe7ZkiA== X-Received: by 2002:a2e:b4cb:: with SMTP id r11mr1772865ljm.68.1578644971633; Fri, 10 Jan 2020 00:29:31 -0800 (PST) Received: from linux.local (c-5ac9225c.014-348-6c756e10.bbcust.telenor.se. [92.34.201.90]) by smtp.gmail.com with ESMTPSA id g24sm606464lfb.85.2020.01.10.00.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 00:29:30 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Jakub Kicinski , Linus Walleij Subject: [PATCH net-next 3/9 v4] ptp: ixp46x: move adjacent to ethernet driver Date: Fri, 10 Jan 2020 09:28:31 +0100 Message-Id: <20200110082837.11473-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200110082837.11473-1-linus.walleij@linaro.org> References: <20200110082837.11473-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann The ixp46x ptp driver has a somewhat unusual setup, where the ptp driver and the ethernet driver are in different directories but access the same registers that are defined a platform specific header file. Moving everything into drivers/net/ makes it look more like most other ptp drivers and allows compile-testing this driver on other targets. Signed-off-by: Arnd Bergmann Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop a stable tag and rebubmit. ChanegLog v2->v3: - Rebased on v5.5-rc1 ChangeLog v1->v2: - Rename patch as "move ADJACENT" which makes more sense --- drivers/net/ethernet/xscale/Kconfig | 14 ++++++++++++++ drivers/net/ethernet/xscale/Makefile | 3 ++- drivers/net/ethernet/xscale/ixp4xx_eth.c | 3 ++- drivers/{ptp => net/ethernet/xscale}/ptp_ixp46x.c | 3 ++- .../net/ethernet/xscale/ptp_ixp46x.h | 0 drivers/ptp/Kconfig | 14 -------------- drivers/ptp/Makefile | 1 - 7 files changed, 20 insertions(+), 18 deletions(-) rename drivers/{ptp => net/ethernet/xscale}/ptp_ixp46x.c (99%) rename arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h => drivers/net/ethernet/xscale/ptp_ixp46x.h (100%) diff --git a/drivers/net/ethernet/xscale/Kconfig b/drivers/net/ethernet/xscale/Kconfig index cd0a8f46e7c6..98aa7b8ddb06 100644 --- a/drivers/net/ethernet/xscale/Kconfig +++ b/drivers/net/ethernet/xscale/Kconfig @@ -27,4 +27,18 @@ config IXP4XX_ETH Say Y here if you want to use built-in Ethernet ports on IXP4xx processor. +config PTP_1588_CLOCK_IXP46X + tristate "Intel IXP46x as PTP clock" + depends on IXP4XX_ETH + depends on PTP_1588_CLOCK + default y + help + This driver adds support for using the IXP46X as a PTP + clock. This clock is only useful if your PTP programs are + getting hardware time stamps on the PTP Ethernet packets + using the SO_TIMESTAMPING API. + + To compile this driver as a module, choose M here: the module + will be called ptp_ixp46x. + endif # NET_VENDOR_XSCALE diff --git a/drivers/net/ethernet/xscale/Makefile b/drivers/net/ethernet/xscale/Makefile index 794a519d07b3..607f91b1e878 100644 --- a/drivers/net/ethernet/xscale/Makefile +++ b/drivers/net/ethernet/xscale/Makefile @@ -3,4 +3,5 @@ # Makefile for the Intel XScale IXP device drivers. # -obj-$(CONFIG_IXP4XX_ETH) += ixp4xx_eth.o +obj-$(CONFIG_IXP4XX_ETH) += ixp4xx_eth.o +obj-$(CONFIG_PTP_1588_CLOCK_IXP46X) += ptp_ixp46x.o diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 6fc04ffb22c2..0075ecdb21f4 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -33,10 +33,11 @@ #include #include #include -#include #include #include +#include "ixp46x_ts.h" + #define DEBUG_DESC 0 #define DEBUG_RX 0 #define DEBUG_TX 0 diff --git a/drivers/ptp/ptp_ixp46x.c b/drivers/net/ethernet/xscale/ptp_ixp46x.c similarity index 99% rename from drivers/ptp/ptp_ixp46x.c rename to drivers/net/ethernet/xscale/ptp_ixp46x.c index 67028484e9a0..9ecc395239e9 100644 --- a/drivers/ptp/ptp_ixp46x.c +++ b/drivers/net/ethernet/xscale/ptp_ixp46x.c @@ -15,7 +15,8 @@ #include #include -#include + +#include "ixp46x_ts.h" #define DRIVER "ptp_ixp46x" #define N_EXT_TS 2 diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h b/drivers/net/ethernet/xscale/ptp_ixp46x.h similarity index 100% rename from arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h rename to drivers/net/ethernet/xscale/ptp_ixp46x.h diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig index b45d2b86d8ca..dc3d8ecb4231 100644 --- a/drivers/ptp/Kconfig +++ b/drivers/ptp/Kconfig @@ -56,20 +56,6 @@ config PTP_1588_CLOCK_QORIQ To compile this driver as a module, choose M here: the module will be called ptp-qoriq. -config PTP_1588_CLOCK_IXP46X - tristate "Intel IXP46x as PTP clock" - depends on IXP4XX_ETH - depends on PTP_1588_CLOCK - default y - help - This driver adds support for using the IXP46X as a PTP - clock. This clock is only useful if your PTP programs are - getting hardware time stamps on the PTP Ethernet packets - using the SO_TIMESTAMPING API. - - To compile this driver as a module, choose M here: the module - will be called ptp_ixp46x. - comment "Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks." depends on PHYLIB=n || NETWORK_PHY_TIMESTAMPING=n diff --git a/drivers/ptp/Makefile b/drivers/ptp/Makefile index 69a06f86a450..74dd39f9d967 100644 --- a/drivers/ptp/Makefile +++ b/drivers/ptp/Makefile @@ -6,7 +6,6 @@ ptp-y := ptp_clock.o ptp_chardev.o ptp_sysfs.o obj-$(CONFIG_PTP_1588_CLOCK) += ptp.o obj-$(CONFIG_PTP_1588_CLOCK_DTE) += ptp_dte.o -obj-$(CONFIG_PTP_1588_CLOCK_IXP46X) += ptp_ixp46x.o obj-$(CONFIG_PTP_1588_CLOCK_PCH) += ptp_pch.o obj-$(CONFIG_PTP_1588_CLOCK_KVM) += ptp_kvm.o obj-$(CONFIG_PTP_1588_CLOCK_QORIQ) += ptp-qoriq.o From patchwork Fri Jan 10 08:28:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1220887 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=BgFId1bz; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47vGPF28g7z9sRK for ; Fri, 10 Jan 2020 19:29:37 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727145AbgAJI3g (ORCPT ); Fri, 10 Jan 2020 03:29:36 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:42196 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726666AbgAJI3g (ORCPT ); Fri, 10 Jan 2020 03:29:36 -0500 Received: by mail-lf1-f68.google.com with SMTP id y19so797980lfl.9 for ; Fri, 10 Jan 2020 00:29:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sFutGcrrh/hQJaQ4Eee8Dh8Xm/R1r/Lfh3IwOeBx/5U=; b=BgFId1bzzZBXpeJwPBZf35c0gHTUg2tLqxVI89gl7SR0CatVS8PSVMT5hQV2cyTSDh O2VnZ2KSavbSU4umG5CZoGpvVnIRNc7Yjpa2e6fTH8cZ7lFMTpzWvTmYcVzMufPfNQjP AyYN6PNPBVYhTHgnqfcvAbNLhWFkGf9DfbdepmLXVyzWJyEejs76/qq/AXHZhR/DE1Us 7auiM6cAKP8+8FMvu/yiZTUUNWoitNaNh5SbQNGwEOJZcK9jSoo6Q6Itn/yNrvL2oRxn nhjNUUuGafYJMk16IrV6hjEpZyVzUJFYjX3EKUw9Bug+ggBRv/FpnMf2avcLqtjF3Fil 4PKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sFutGcrrh/hQJaQ4Eee8Dh8Xm/R1r/Lfh3IwOeBx/5U=; b=fssWxN6+KB/GUYkf/v0hw8RhYJQsLs3f67yTjpGR+t71y3nfZJd3SNgzBVmJS6gGtP kcUrpJUZLmgzbvQpWfFUUzOAOgxEbbtBcISwdBeoF7lMyh0BimUuyzUzWPfyREzVxiRF 7lRa4S7ar6ZsrihUzBzUbqVYhwS0WKmMH/CNcCsJP7jyYCmmQ58I7hP7FDbF4FwrABhd QWe4b8Bv6CM1NUY1wjiuA/AV+hCJmgkM8JbSAaViAXxkrDo+txohxqHn5ALZERpKKVQl STFUEFYXmGCc6/caDeGQYCAIcXl7Z/B79UbQZgUv0bzMVF1M5fYY/u766JPLJcq6SFdm tgWg== X-Gm-Message-State: APjAAAU3b4QBOUY9knXJEWfqfnu10FbPXA9KYk4RAqrT+tYQia9u7AnK zPQtElHvnYiLML1kdRxxngm6CaYWjYJgAw== X-Google-Smtp-Source: APXvYqyB0IbxbV/R7dm0/cmWC9pivMAomT2C0uh9f8IpPWZ6uJtTEOYamKQS1mFGWT1ue4YaoQ3unw== X-Received: by 2002:a05:6512:40e:: with SMTP id u14mr1433265lfk.161.1578644973356; Fri, 10 Jan 2020 00:29:33 -0800 (PST) Received: from linux.local (c-5ac9225c.014-348-6c756e10.bbcust.telenor.se. [92.34.201.90]) by smtp.gmail.com with ESMTPSA id g24sm606464lfb.85.2020.01.10.00.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 00:29:32 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Jakub Kicinski , Linus Walleij Subject: [PATCH net-next 4/9 v4] ixp4xx_eth: move platform_data definition Date: Fri, 10 Jan 2020 09:28:32 +0100 Message-Id: <20200110082837.11473-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200110082837.11473-1-linus.walleij@linaro.org> References: <20200110082837.11473-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann The platform data is needed to compile the driver as standalone, so move it to a global location along with similar files. Signed-off-by: Arnd Bergmann Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop a stable tag and rebubmit. ChangeLog v2->v3: - Rebased on v5.5-rc1 ChangeLog v1->v2: - Rebased on the rest of the series. --- arch/arm/mach-ixp4xx/include/mach/platform.h | 13 +------------ .../xscale/{ptp_ixp46x.h => ixp46x_ts.h} | 0 drivers/net/ethernet/xscale/ixp4xx_eth.c | 1 + include/linux/platform_data/eth_ixp4xx.h | 19 +++++++++++++++++++ 4 files changed, 21 insertions(+), 12 deletions(-) rename drivers/net/ethernet/xscale/{ptp_ixp46x.h => ixp46x_ts.h} (100%) create mode 100644 include/linux/platform_data/eth_ixp4xx.h diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h index 04ef8025accc..6d403fe0bf52 100644 --- a/arch/arm/mach-ixp4xx/include/mach/platform.h +++ b/arch/arm/mach-ixp4xx/include/mach/platform.h @@ -15,6 +15,7 @@ #ifndef __ASSEMBLY__ #include +#include #include @@ -92,18 +93,6 @@ struct ixp4xx_pata_data { void __iomem *cs1; }; -#define IXP4XX_ETH_NPEA 0x00 -#define IXP4XX_ETH_NPEB 0x10 -#define IXP4XX_ETH_NPEC 0x20 - -/* Information about built-in Ethernet MAC interfaces */ -struct eth_plat_info { - u8 phy; /* MII PHY ID, 0 - 31 */ - u8 rxq; /* configurable, currently 0 - 31 only */ - u8 txreadyq; - u8 hwaddr[6]; -}; - /* * Frequency of clock used for primary clocksource */ diff --git a/drivers/net/ethernet/xscale/ptp_ixp46x.h b/drivers/net/ethernet/xscale/ixp46x_ts.h similarity index 100% rename from drivers/net/ethernet/xscale/ptp_ixp46x.h rename to drivers/net/ethernet/xscale/ixp46x_ts.h diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 0075ecdb21f4..e811bf0d23cb 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/include/linux/platform_data/eth_ixp4xx.h b/include/linux/platform_data/eth_ixp4xx.h new file mode 100644 index 000000000000..6f652ea0c6ae --- /dev/null +++ b/include/linux/platform_data/eth_ixp4xx.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __PLATFORM_DATA_ETH_IXP4XX +#define __PLATFORM_DATA_ETH_IXP4XX + +#include + +#define IXP4XX_ETH_NPEA 0x00 +#define IXP4XX_ETH_NPEB 0x10 +#define IXP4XX_ETH_NPEC 0x20 + +/* Information about built-in Ethernet MAC interfaces */ +struct eth_plat_info { + u8 phy; /* MII PHY ID, 0 - 31 */ + u8 rxq; /* configurable, currently 0 - 31 only */ + u8 txreadyq; + u8 hwaddr[6]; +}; + +#endif From patchwork Fri Jan 10 08:28:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1220888 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=LbHU5DOS; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47vGPH1qDYz9sRK for ; Fri, 10 Jan 2020 19:29:39 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727152AbgAJI3i (ORCPT ); Fri, 10 Jan 2020 03:29:38 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:36304 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726989AbgAJI3i (ORCPT ); Fri, 10 Jan 2020 03:29:38 -0500 Received: by mail-lj1-f195.google.com with SMTP id r19so1247446ljg.3 for ; Fri, 10 Jan 2020 00:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hyFFqYAzpck6QwlVZWmSFJ4to3/dXvhTPg6iphOXnFQ=; b=LbHU5DOS+p0UP9qVLoL3Ezh917dNF/7/fnmJExPTsiR4MERFjOS+NoLyQ3hMkgoUbJ dIILqxvHW9frplP6XQidprT3gJsr5OAjWs6H0/zPqIhE1QDAeOYARyb/nBpPhtpaWwoL JA7QmbkM+JO6IQT+mN7uFH5xKxbIGx/vrbb8WMG07OucFU+R7bf/ha7FLhZwq7aOBtkc NTDWpfnid6aKsqfVTEYWeU5/fPgw2/jvfXQE4UVxLWY4UydBHvf8bEZFHuN8iiFKnkki u86kHpKiDNmnaNPID9++6oBUMuKmGQhFkD5HRzPmlazCaXmkHA4Dd3GzWTNmwnwxIYXv tJEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hyFFqYAzpck6QwlVZWmSFJ4to3/dXvhTPg6iphOXnFQ=; b=YW0gz7Ae8+shlKK15bjPKl0nZ2YMnCFUdM62JAKJb8z9nHlMezpyGjLBw3nm5TeR/h BMreInA41qS7j8F1TAJ8wc2qZ60/nO03HgtYmeSn0vToa85EhEB+hxu9Gxy2ufPAdhz8 ymIBY5LEtBaDv2+LD+WRLAi+QgsNRvDOs8CLZff9pUURfOjXXXfCZOqJjK28RV9qUrR2 iUoDkYHV3BM3AMJMl19tGpEP8kSKNAOgRRHNAPIpFNZJ7uivqrTYG9YF6vqZMpeH34kV v1IReA4Xqb1EBW13nFYOCsRiIlut9X4DNX/lWBEebBD2m9WpoGafYQkF8ECmr7MRKKrq KCmA== X-Gm-Message-State: APjAAAV6MsuYo8RHe16kvozC1Zh50TZ9yEJPkGgbvEebIslBeZwk/yRx NR1HIQVgl7ey7DO0sqMBShVs2xFiylQGzQ== X-Google-Smtp-Source: APXvYqy6jbtHCNTTgi5hSeVAyOT8iyewS3LrssZdDL1iJC4UI3dDcD41X0ZUI4sqa+jU2kloxW9CDQ== X-Received: by 2002:a2e:b4f6:: with SMTP id s22mr1797858ljm.218.1578644975000; Fri, 10 Jan 2020 00:29:35 -0800 (PST) Received: from linux.local (c-5ac9225c.014-348-6c756e10.bbcust.telenor.se. [92.34.201.90]) by smtp.gmail.com with ESMTPSA id g24sm606464lfb.85.2020.01.10.00.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 00:29:34 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Jakub Kicinski , Linus Walleij Subject: [PATCH net-next 5/9 v4] net: ethernet: ixp4xx: Standard module init Date: Fri, 10 Jan 2020 09:28:33 +0100 Message-Id: <20200110082837.11473-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200110082837.11473-1-linus.walleij@linaro.org> References: <20200110082837.11473-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The IXP4xx driver was initializing the MDIO bus before even probing, in the callbacks supposed to be used for setting up the module itself, and with the side effect of trying to register the MDIO bus as soon as this module was loaded or compiled into the kernel whether the device was discovered or not. This does not work with multiplatform environments. To get rid of this: set up the MDIO bus from the probe() callback and remove it in the remove() callback. Rename the probe() and remove() calls to reflect the most common conventions. Since there is a bit of checking for the ethernet feature to be present in the MDIO registering function, making the whole module not even be registered if we can't find an MDIO bus, we need something similar: register the MDIO bus when the corresponding ethernet is probed, and return -EPROBE_DEFER on the other interfaces until this happens. If no MDIO bus is present on any of the registered interfaces we will eventually bail out. None of the platforms I've seen has e.g. MDIO on EthB and only uses EthC, there is always a Ethernet hardware on the NPE (B, C) that has the MDIO bus, we just might have to wait for it. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop a stable tag and rebubmit. ChangeLog v2->v3: - Rebased on v5.5-rc1 ChangeLog v1->v2: - Change the first alloc_etherdev() to devm_alloc_etherdev() and drop one leg of the errorpath so we can just return with error code in the first part of the code. --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 96 +++++++++++------------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index e811bf0d23cb..799ffebba491 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -519,25 +519,14 @@ static int ixp4xx_mdio_write(struct mii_bus *bus, int phy_id, int location, return ret; } -static int ixp4xx_mdio_register(void) +static int ixp4xx_mdio_register(struct eth_regs __iomem *regs) { int err; if (!(mdio_bus = mdiobus_alloc())) return -ENOMEM; - if (cpu_is_ixp43x()) { - /* IXP43x lacks NPE-B and uses NPE-C for MII PHY access */ - if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEC_ETH)) - return -ENODEV; - mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; - } else { - /* All MII PHY accesses use NPE-B Ethernet registers */ - if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0)) - return -ENODEV; - mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; - } - + mdio_regs = regs; __raw_writel(DEFAULT_CORE_CNTRL, &mdio_regs->core_control); spin_lock_init(&mdio_lock); mdio_bus->name = "IXP4xx MII Bus"; @@ -1376,7 +1365,7 @@ static const struct net_device_ops ixp4xx_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -static int eth_init_one(struct platform_device *pdev) +static int ixp4xx_eth_probe(struct platform_device *pdev) { struct port *port; struct net_device *dev; @@ -1386,7 +1375,7 @@ static int eth_init_one(struct platform_device *pdev) char phy_id[MII_BUS_ID_SIZE + 3]; int err; - if (!(dev = alloc_etherdev(sizeof(struct port)))) + if (!(dev = devm_alloc_etherdev(&pdev->dev, sizeof(struct port)))) return -ENOMEM; SET_NETDEV_DEV(dev, &pdev->dev); @@ -1396,20 +1385,51 @@ static int eth_init_one(struct platform_device *pdev) switch (port->id) { case IXP4XX_ETH_NPEA: + /* If the MDIO bus is not up yet, defer probe */ + if (!mdio_bus) + return -EPROBE_DEFER; port->regs = (struct eth_regs __iomem *)IXP4XX_EthA_BASE_VIRT; regs_phys = IXP4XX_EthA_BASE_PHYS; break; case IXP4XX_ETH_NPEB: + /* + * On all except IXP43x, NPE-B is used for the MDIO bus. + * If there is no NPE-B in the feature set, bail out, else + * register the MDIO bus. + */ + if (!cpu_is_ixp43x()) { + if (!(ixp4xx_read_feature_bits() & + IXP4XX_FEATURE_NPEB_ETH0)) + return -ENODEV; + /* Else register the MDIO bus on NPE-B */ + if ((err = ixp4xx_mdio_register(IXP4XX_EthC_BASE_VIRT))) + return err; + } + if (!mdio_bus) + return -EPROBE_DEFER; port->regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; regs_phys = IXP4XX_EthB_BASE_PHYS; break; case IXP4XX_ETH_NPEC: + /* + * IXP43x lacks NPE-B and uses NPE-C for the MDIO bus access, + * of there is no NPE-C, no bus, nothing works, so bail out. + */ + if (cpu_is_ixp43x()) { + if (!(ixp4xx_read_feature_bits() & + IXP4XX_FEATURE_NPEC_ETH)) + return -ENODEV; + /* Else register the MDIO bus on NPE-C */ + if ((err = ixp4xx_mdio_register(IXP4XX_EthC_BASE_VIRT))) + return err; + } + if (!mdio_bus) + return -EPROBE_DEFER; port->regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; regs_phys = IXP4XX_EthC_BASE_PHYS; break; default: - err = -ENODEV; - goto err_free; + return -ENODEV; } dev->netdev_ops = &ixp4xx_netdev_ops; @@ -1418,10 +1438,8 @@ static int eth_init_one(struct platform_device *pdev) netif_napi_add(dev, &port->napi, eth_poll, NAPI_WEIGHT); - if (!(port->npe = npe_request(NPE_ID(port->id)))) { - err = -EIO; - goto err_free; - } + if (!(port->npe = npe_request(NPE_ID(port->id)))) + return -EIO; port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name); if (!port->mem_res) { @@ -1467,12 +1485,10 @@ static int eth_init_one(struct platform_device *pdev) release_resource(port->mem_res); err_npe_rel: npe_release(port->npe); -err_free: - free_netdev(dev); return err; } -static int eth_remove_one(struct platform_device *pdev) +static int ixp4xx_eth_remove(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); struct phy_device *phydev = dev->phydev; @@ -1480,45 +1496,21 @@ static int eth_remove_one(struct platform_device *pdev) unregister_netdev(dev); phy_disconnect(phydev); + ixp4xx_mdio_remove(); npe_port_tab[NPE_ID(port->id)] = NULL; npe_release(port->npe); release_resource(port->mem_res); - free_netdev(dev); return 0; } static struct platform_driver ixp4xx_eth_driver = { .driver.name = DRV_NAME, - .probe = eth_init_one, - .remove = eth_remove_one, + .probe = ixp4xx_eth_probe, + .remove = ixp4xx_eth_remove, }; - -static int __init eth_init_module(void) -{ - int err; - - /* - * FIXME: we bail out on device tree boot but this really needs - * to be fixed in a nicer way: this registers the MDIO bus before - * even matching the driver infrastructure, we should only probe - * detected hardware. - */ - if (of_have_populated_dt()) - return -ENODEV; - if ((err = ixp4xx_mdio_register())) - return err; - return platform_driver_register(&ixp4xx_eth_driver); -} - -static void __exit eth_cleanup_module(void) -{ - platform_driver_unregister(&ixp4xx_eth_driver); - ixp4xx_mdio_remove(); -} +module_platform_driver(ixp4xx_eth_driver); MODULE_AUTHOR("Krzysztof Halasa"); MODULE_DESCRIPTION("Intel IXP4xx Ethernet driver"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:ixp4xx_eth"); -module_init(eth_init_module); -module_exit(eth_cleanup_module); From patchwork Fri Jan 10 08:28:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1220889 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Wz8okv24; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47vGPJ544cz9sRK for ; Fri, 10 Jan 2020 19:29:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727164AbgAJI3k (ORCPT ); Fri, 10 Jan 2020 03:29:40 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:36307 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbgAJI3j (ORCPT ); Fri, 10 Jan 2020 03:29:39 -0500 Received: by mail-lj1-f195.google.com with SMTP id r19so1247505ljg.3 for ; Fri, 10 Jan 2020 00:29:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/cSYgetQde+hfAbBC5qCR38LbzM+TA2qx/4CQ+Gi9OA=; b=Wz8okv24aJ23Dq94RkT7muvC56WoqQHFdMgpmMhV3N9EZduRsIZZ+dVmPYhaiXwDKK iaFLHEaE/tH9VnM9UPyT9DAeZebTMjFNPXfnr7KFi/p1RtLfoTqxXcx/tsbe0FlkVGod HxLQ1p10JVEUR7LKPei62JbRGEFSBblg2T5JXXe2MyeLGGCe2ORNjHKzpv2WxWRJl2UW FiORSam23ebSSWn7eR2ncdSyWhAGu7ozuNsA7LiVyhYzmaAiwY1XSRhDp7f+82qcJt6C qSd108geCHrcTwGGVsThUyk+EKJd55p0Xjs/2E+cpzXve/7hZ+3cJo5huXHbxs/7IlOk DADQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/cSYgetQde+hfAbBC5qCR38LbzM+TA2qx/4CQ+Gi9OA=; b=LzyNv6l0R5+X7w9A/OSZmESrVEdPnIQhNkVZM8sA/orxF8GxjSeE9dzs5NJ9z0XKO/ RZ6nNDJAjd9o6lbD2comVEDwPUzAHqECj4GmV2Z+XY2F0gUMV1NjBueL7grheQoX8EMf Bv2YpuOyQie0RveDEBnip2ouIQhhTPUwKrTUdj4eXLSPm/CCif+Ut1LW5nbjhZPK/CBF Inc3J5WINej9XpoAsWe1Ru2jxMiecY1GSq2FhdTxlUwNkWX47ZVMSAcbMhKeo1NodRjQ OjK02YGlYju8ECl7VS8DLVALTwIwLdBU7IYm3xCGfMdn/da6g9UQGC2skZEx8NsQG9RJ gnxQ== X-Gm-Message-State: APjAAAUjDoeKk18GVoFB/znVMLd4ZZZaWup6pah0zFs14VBPouE8qV5T Fn7viKRBlH/fNDlsLbUDvAEalasvdpDBcQ== X-Google-Smtp-Source: APXvYqw7acC12by9WsZiG1BkY2BZCyfMdCkCb+A8EFFEopouixMuB0VKgFbshhZ94mCjECY6r5BlaA== X-Received: by 2002:a2e:a168:: with SMTP id u8mr1750490ljl.5.1578644976441; Fri, 10 Jan 2020 00:29:36 -0800 (PST) Received: from linux.local (c-5ac9225c.014-348-6c756e10.bbcust.telenor.se. [92.34.201.90]) by smtp.gmail.com with ESMTPSA id g24sm606464lfb.85.2020.01.10.00.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 00:29:35 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Jakub Kicinski , Linus Walleij Subject: [PATCH net-next 6/9 v4] net: ethernet: ixp4xx: Use distinct local variable Date: Fri, 10 Jan 2020 09:28:34 +0100 Message-Id: <20200110082837.11473-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200110082837.11473-1-linus.walleij@linaro.org> References: <20200110082837.11473-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use "ndev" for the struct net_device and "dev" for the struct device in probe() and remove(). Add the local "dev" pointer for later use in refactoring. Take this opportunity to fix inverse christmas tree coding style. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop a stable tag and rebubmit. ChangeLog v2->v3: - Rebased on v5.5-rc1 ChangeLog v1->v2: - Rebase on the other changes. --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 47 +++++++++++++----------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 799ffebba491..05ab8426bb8d 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1367,20 +1367,23 @@ static const struct net_device_ops ixp4xx_netdev_ops = { static int ixp4xx_eth_probe(struct platform_device *pdev) { - struct port *port; - struct net_device *dev; - struct eth_plat_info *plat = dev_get_platdata(&pdev->dev); + char phy_id[MII_BUS_ID_SIZE + 3]; struct phy_device *phydev = NULL; + struct device *dev = &pdev->dev; + struct eth_plat_info *plat; + struct net_device *ndev; + struct port *port; u32 regs_phys; - char phy_id[MII_BUS_ID_SIZE + 3]; int err; - if (!(dev = devm_alloc_etherdev(&pdev->dev, sizeof(struct port)))) + plat = dev_get_platdata(dev); + + if (!(ndev = devm_alloc_etherdev(dev, sizeof(struct port)))) return -ENOMEM; - SET_NETDEV_DEV(dev, &pdev->dev); - port = netdev_priv(dev); - port->netdev = dev; + SET_NETDEV_DEV(ndev, dev); + port = netdev_priv(ndev); + port->netdev = ndev; port->id = pdev->id; switch (port->id) { @@ -1432,16 +1435,16 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) return -ENODEV; } - dev->netdev_ops = &ixp4xx_netdev_ops; - dev->ethtool_ops = &ixp4xx_ethtool_ops; - dev->tx_queue_len = 100; + ndev->netdev_ops = &ixp4xx_netdev_ops; + ndev->ethtool_ops = &ixp4xx_ethtool_ops; + ndev->tx_queue_len = 100; - netif_napi_add(dev, &port->napi, eth_poll, NAPI_WEIGHT); + netif_napi_add(ndev, &port->napi, eth_poll, NAPI_WEIGHT); if (!(port->npe = npe_request(NPE_ID(port->id)))) return -EIO; - port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name); + port->mem_res = request_mem_region(regs_phys, REGS_SIZE, ndev->name); if (!port->mem_res) { err = -EBUSY; goto err_npe_rel; @@ -1449,9 +1452,9 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) port->plat = plat; npe_port_tab[NPE_ID(port->id)] = port; - memcpy(dev->dev_addr, plat->hwaddr, ETH_ALEN); + memcpy(ndev->dev_addr, plat->hwaddr, ETH_ALEN); - platform_set_drvdata(pdev, dev); + platform_set_drvdata(pdev, ndev); __raw_writel(DEFAULT_CORE_CNTRL | CORE_RESET, &port->regs->core_control); @@ -1461,7 +1464,7 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, mdio_bus->id, plat->phy); - phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, + phydev = phy_connect(ndev, phy_id, &ixp4xx_adjust_link, PHY_INTERFACE_MODE_MII); if (IS_ERR(phydev)) { err = PTR_ERR(phydev); @@ -1470,10 +1473,10 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) phydev->irq = PHY_POLL; - if ((err = register_netdev(dev))) + if ((err = register_netdev(ndev))) goto err_phy_dis; - printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, + printk(KERN_INFO "%s: MII PHY %i on %s\n", ndev->name, plat->phy, npe_name(port->npe)); return 0; @@ -1490,11 +1493,11 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) static int ixp4xx_eth_remove(struct platform_device *pdev) { - struct net_device *dev = platform_get_drvdata(pdev); - struct phy_device *phydev = dev->phydev; - struct port *port = netdev_priv(dev); + struct net_device *ndev = platform_get_drvdata(pdev); + struct phy_device *phydev = ndev->phydev; + struct port *port = netdev_priv(ndev); - unregister_netdev(dev); + unregister_netdev(ndev); phy_disconnect(phydev); ixp4xx_mdio_remove(); npe_port_tab[NPE_ID(port->id)] = NULL; From patchwork Fri Jan 10 08:28:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1220890 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=gUjK7H8h; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47vGPK6Mlfz9sRK for ; Fri, 10 Jan 2020 19:29:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727170AbgAJI3l (ORCPT ); Fri, 10 Jan 2020 03:29:41 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41759 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726989AbgAJI3k (ORCPT ); Fri, 10 Jan 2020 03:29:40 -0500 Received: by mail-lj1-f196.google.com with SMTP id h23so1219634ljc.8 for ; Fri, 10 Jan 2020 00:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DSqK/tHtltFZ+IreiFklBVo14KSLbLtJrmoqNhaWZSA=; b=gUjK7H8hjPGUcB6EshCTLCEr8nipFx0XKy5h1lgpNcN9n0jCm6Il7UzL2BfgtQ6wxP BslVWPvDCgS1INEK3O+7A4ZS0KZOfJRMkg5B2l9LsIKvHVMV6Suh/hfd9eJ1lNJhVYCC AQiWkh2dkX/Zzx6wCgSOMakY6HRkWeWZ7H64gOm+/MDxvuFjMJsQYyWE0Z2tEnhuLuBJ ymWPOy+i2mpga8kwTV32hE5/weDjOlUM1w/+tkQYDnlbpm2cSwwQCCGutSkksZugaVoT U0+4ThNd+Qxx4MNZOWlfBGa/0z5m9nfFgNFp9UqdqAZs0FY2ezwMa0wGLTctmnJbwXYy v2ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DSqK/tHtltFZ+IreiFklBVo14KSLbLtJrmoqNhaWZSA=; b=HOwrAi3C7pvFJ+l7xd5WwM23QiLkNdQMu+WXap/XmHtbEkncA3NcJlBbp4aFuVuH71 88+e/TKt1qKVZanGavtk2bqeDpjOOY1lksnmjDKa30E/KR4B4/0bAbPYCMihm/JrvoJT vLVsNKDQuHTlvYn++2GPEp8+W3G6sAZdKb4oHwgje4g6e/CnUo7GVnsLGp6kmT1ZkvOO WT4EGEZb6YwAMlzO3S226y8MVOM8QI0tadZxWd1mjrz/9Mc13VohdaOXiA+lfHhbxPWW F5Qg1kVbrJPUbRCcNUl/nyLnIhyAysisewWyQCa4NNnpL/kmHoAfN4t9Cnl2VP1aPy2j 41dw== X-Gm-Message-State: APjAAAWiPtgBwkNApqxLrkRZHWPYgMQQVlymokKCPe6MEkqLSchjyD+6 K95AqCiPBQYWRBVVSZIQLi6YtO9mqujuxw== X-Google-Smtp-Source: APXvYqygweHs4rEW7KdLyoUvnBXYesBC30ujNicH4zm2454pjzgmdIv0k+Nm1TgGTmp0iQQK3tubRQ== X-Received: by 2002:a2e:b007:: with SMTP id y7mr1778206ljk.215.1578644977903; Fri, 10 Jan 2020 00:29:37 -0800 (PST) Received: from linux.local (c-5ac9225c.014-348-6c756e10.bbcust.telenor.se. [92.34.201.90]) by smtp.gmail.com with ESMTPSA id g24sm606464lfb.85.2020.01.10.00.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 00:29:37 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Jakub Kicinski , Linus Walleij Subject: [PATCH net-next 7/9 v4] net: ehernet: ixp4xx: Use netdev_* messages Date: Fri, 10 Jan 2020 09:28:35 +0100 Message-Id: <20200110082837.11473-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200110082837.11473-1-linus.walleij@linaro.org> References: <20200110082837.11473-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Simplify and correct a bunch of messages using printk directly to use the netdev_* macros. I have not changed all of them, just the low-hanging fruit. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop a stable tag and rebubmit. ChangeLog v2->v3: - Rebased on v5.5-rc1 ChangeLog v1->v2: - Squashed the previous devm_* changes into the patch where the simplified errorpath is needed and renamed this patch to just be about the message. - Fixed a bunch more prints. --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 52 +++++++++++------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 05ab8426bb8d..f7edf8b38dea 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -572,8 +572,8 @@ static void ixp4xx_adjust_link(struct net_device *dev) __raw_writel(DEFAULT_TX_CNTRL0 | TX_CNTRL0_HALFDUPLEX, &port->regs->tx_control[0]); - printk(KERN_INFO "%s: link up, speed %u Mb/s, %s duplex\n", - dev->name, port->speed, port->duplex ? "full" : "half"); + netdev_info(dev, "%s: link up, speed %u Mb/s, %s duplex\n", + dev->name, port->speed, port->duplex ? "full" : "half"); } @@ -583,7 +583,7 @@ static inline void debug_pkt(struct net_device *dev, const char *func, #if DEBUG_PKT_BYTES int i; - printk(KERN_DEBUG "%s: %s(%i) ", dev->name, func, len); + netdev_debug(dev, "%s(%i) ", func, len); for (i = 0; i < len; i++) { if (i >= DEBUG_PKT_BYTES) break; @@ -674,7 +674,7 @@ static int eth_poll(struct napi_struct *napi, int budget) int received = 0; #if DEBUG_RX - printk(KERN_DEBUG "%s: eth_poll\n", dev->name); + netdev_debug(dev, "eth_poll\n"); #endif while (received < budget) { @@ -688,23 +688,20 @@ static int eth_poll(struct napi_struct *napi, int budget) if ((n = queue_get_desc(rxq, port, 0)) < 0) { #if DEBUG_RX - printk(KERN_DEBUG "%s: eth_poll napi_complete\n", - dev->name); + netdev_debug(dev, "eth_poll napi_complete\n"); #endif napi_complete(napi); qmgr_enable_irq(rxq); if (!qmgr_stat_below_low_watermark(rxq) && napi_reschedule(napi)) { /* not empty again */ #if DEBUG_RX - printk(KERN_DEBUG "%s: eth_poll napi_reschedule succeeded\n", - dev->name); + netdev_debug(dev, "eth_poll napi_reschedule succeeded\n"); #endif qmgr_disable_irq(rxq); continue; } #if DEBUG_RX - printk(KERN_DEBUG "%s: eth_poll all done\n", - dev->name); + netdev_debug(dev, "eth_poll all done\n"); #endif return received; /* all work done */ } @@ -769,7 +766,7 @@ static int eth_poll(struct napi_struct *napi, int budget) } #if DEBUG_RX - printk(KERN_DEBUG "eth_poll(): end, not all work done\n"); + netdev_debug(dev, "eth_poll(): end, not all work done\n"); #endif return received; /* not all work done */ } @@ -833,7 +830,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) struct desc *desc; #if DEBUG_TX - printk(KERN_DEBUG "%s: eth_xmit\n", dev->name); + netdev_debug(dev, "eth_xmit\n"); #endif if (unlikely(skb->len > MAX_MRU)) { @@ -888,22 +885,21 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */ #if DEBUG_TX - printk(KERN_DEBUG "%s: eth_xmit queue full\n", dev->name); + netdev_debug(dev, "eth_xmit queue full\n"); #endif netif_stop_queue(dev); /* we could miss TX ready interrupt */ /* really empty in fact */ if (!qmgr_stat_below_low_watermark(txreadyq)) { #if DEBUG_TX - printk(KERN_DEBUG "%s: eth_xmit ready again\n", - dev->name); + netdev_debug(dev, "eth_xmit ready again\n"); #endif netif_wake_queue(dev); } } #if DEBUG_TX - printk(KERN_DEBUG "%s: eth_xmit end\n", dev->name); + netdev_debug(dev, "eth_xmit end\n"); #endif ixp_tx_timestamp(port, skb); @@ -1177,8 +1173,7 @@ static int eth_open(struct net_device *dev) return err; if (npe_recv_message(npe, &msg, "ETH_GET_STATUS")) { - printk(KERN_ERR "%s: %s not responding\n", dev->name, - npe_name(npe)); + netdev_err(dev, "%s not responding\n", npe_name(npe)); return -EIO; } port->firmware[0] = msg.byte4; @@ -1290,7 +1285,7 @@ static int eth_close(struct net_device *dev) msg.eth_id = port->id; msg.byte3 = 1; if (npe_send_recv_message(port->npe, &msg, "ETH_ENABLE_LOOPBACK")) - printk(KERN_CRIT "%s: unable to enable loopback\n", dev->name); + netdev_crit(dev, "unable to enable loopback\n"); i = 0; do { /* drain RX buffers */ @@ -1314,11 +1309,11 @@ static int eth_close(struct net_device *dev) } while (++i < MAX_CLOSE_WAIT); if (buffs) - printk(KERN_CRIT "%s: unable to drain RX queue, %i buffer(s)" - " left in NPE\n", dev->name, buffs); + netdev_crit(dev, "unable to drain RX queue, %i buffer(s)" + " left in NPE\n", buffs); #if DEBUG_CLOSE if (!buffs) - printk(KERN_DEBUG "Draining RX queue took %i cycles\n", i); + netdev_debug(dev, "draining RX queue took %i cycles\n", i); #endif buffs = TX_DESCS; @@ -1334,17 +1329,16 @@ static int eth_close(struct net_device *dev) } while (++i < MAX_CLOSE_WAIT); if (buffs) - printk(KERN_CRIT "%s: unable to drain TX queue, %i buffer(s) " - "left in NPE\n", dev->name, buffs); + netdev_crit(dev, "unable to drain TX queue, %i buffer(s) " + "left in NPE\n", buffs); #if DEBUG_CLOSE if (!buffs) - printk(KERN_DEBUG "Draining TX queues took %i cycles\n", i); + netdev_debug(dev, "draining TX queues took %i cycles\n", i); #endif msg.byte3 = 0; if (npe_send_recv_message(port->npe, &msg, "ETH_DISABLE_LOOPBACK")) - printk(KERN_CRIT "%s: unable to disable loopback\n", - dev->name); + netdev_crit(dev, "unable to disable loopback\n"); phy_stop(dev->phydev); @@ -1476,8 +1470,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) if ((err = register_netdev(ndev))) goto err_phy_dis; - printk(KERN_INFO "%s: MII PHY %i on %s\n", ndev->name, plat->phy, - npe_name(port->npe)); + netdev_info(ndev, "%s: MII PHY %i on %s\n", ndev->name, plat->phy, + npe_name(port->npe)); return 0; From patchwork Fri Jan 10 08:28:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1220891 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=gwEZTrp5; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47vGPM44P4z9sRK for ; Fri, 10 Jan 2020 19:29:43 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727181AbgAJI3m (ORCPT ); Fri, 10 Jan 2020 03:29:42 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:45465 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbgAJI3m (ORCPT ); Fri, 10 Jan 2020 03:29:42 -0500 Received: by mail-lf1-f67.google.com with SMTP id 203so787827lfa.12 for ; Fri, 10 Jan 2020 00:29:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XHm6Sx7hzEekY5K6W1CnSmYCWWNnJQw134Xf264/0qs=; b=gwEZTrp5wTSShUGZ/x567FjfmeNP8TIe/w9BmHfAmopDDaAGi3Lwm4JTFmYrF91fzE VP6oPhFsGXlqfI59Ac79f5ta4Dl42EEiI5NSyfMJaBKzccuIFNVIqQjcj6ys7Kk40EdY YAGnFswOS8tYqSVbXfr0292FkEHFtFYMuNlh8Wl/bX5DqgIBw+SCE5ce4Ab3bLUTXfiK iB9KVLPvujS1v7O+zEvx3tgdK3MiTl9FfoWsGBUPp4ATDUnLCZx5GJg1IOnCXjg9mbu3 K1CDogaqgCes1V3oaMbjwqpIwkl5poq3buWOCkXhf+QX9KCpCsXo1je8y0OOy0PdeLSR 5uGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XHm6Sx7hzEekY5K6W1CnSmYCWWNnJQw134Xf264/0qs=; b=pe76tC/3U9YqDup1X/vYgaS7ZkvdvAEJbPRvouGJdLWCZm2eBjCf0Z2MVVM+138MLY 9UsEHzba9knhyeWHEOWTWeZh/OZLYR5ak9lJ9bkpmxKa9zzMM2xc/X3lg3OfP5z51lbA ZOqCbIKd6Wm050p8ReP2VqL7ebcC+aDhQLXJlyo/qO+MJzhMnFb4NlYIGu60tGF9AjVt I1Y+Ddza5DbTYrsYvC6Fm9DSHy39EPPqLyJWmCb+tzulPw+FOZeYIT6JE4KROcPD83ol G/f5qaWTmMrAPL60ma+QIfrVs+JKvm5x6dmoi/uWaHPnjcQHYJqQZFrPJMAmhrJ3nPZk wYVA== X-Gm-Message-State: APjAAAUmHgJyBH1ciEUKM98wRF0doVlqHQ8uPEd1V2rTfCOm4DHHAY9l 4yiQbNg3VkCXfgu6hhyKh0BND4izseWAqg== X-Google-Smtp-Source: APXvYqw4Sr8M1E7O0+xCeZsk5tiF5Q2Wj+cihmz6femtZJuBzGbxzCOp8zFUe13LqEHyadNesc/+1g== X-Received: by 2002:ac2:5983:: with SMTP id w3mr1467077lfn.137.1578644979344; Fri, 10 Jan 2020 00:29:39 -0800 (PST) Received: from linux.local (c-5ac9225c.014-348-6c756e10.bbcust.telenor.se. [92.34.201.90]) by smtp.gmail.com with ESMTPSA id g24sm606464lfb.85.2020.01.10.00.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 00:29:38 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Jakub Kicinski , Linus Walleij Subject: [PATCH net-next 8/9 v4] ARM/net: ixp4xx: Pass ethernet physical base as resource Date: Fri, 10 Jan 2020 09:28:36 +0100 Message-Id: <20200110082837.11473-9-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200110082837.11473-1-linus.walleij@linaro.org> References: <20200110082837.11473-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In order to probe this ethernet interface from the device tree all physical MMIO regions must be passed as resources. Begin this rewrite by first passing the port base address as a resource for all platforms using this driver, remap it in the driver and avoid using any reference of the statically mapped virtual address in the driver. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop a stable tag and rebubmit. ChangeLog v2->v3: - Rebased on v5.5-rc1 ChangeLog v1->v2: - Rebased on the rest of the series. --- arch/arm/mach-ixp4xx/fsg-setup.c | 20 ++++++++++++++++++++ arch/arm/mach-ixp4xx/goramo_mlr.c | 20 ++++++++++++++++++++ arch/arm/mach-ixp4xx/ixdp425-setup.c | 20 ++++++++++++++++++++ arch/arm/mach-ixp4xx/nas100d-setup.c | 10 ++++++++++ arch/arm/mach-ixp4xx/nslu2-setup.c | 10 ++++++++++ arch/arm/mach-ixp4xx/omixp-setup.c | 20 ++++++++++++++++++++ arch/arm/mach-ixp4xx/vulcan-setup.c | 20 ++++++++++++++++++++ drivers/net/ethernet/xscale/ixp4xx_eth.c | 20 +++++++++++--------- 8 files changed, 131 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c index 648932d8d7a8..507ee3878769 100644 --- a/arch/arm/mach-ixp4xx/fsg-setup.c +++ b/arch/arm/mach-ixp4xx/fsg-setup.c @@ -132,6 +132,22 @@ static struct platform_device fsg_leds = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource fsg_eth_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource fsg_eth_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info fsg_plat_eth[] = { { .phy = 5, @@ -151,12 +167,16 @@ static struct platform_device fsg_eth[] = { .dev = { .platform_data = fsg_plat_eth, }, + .num_resources = ARRAY_SIZE(fsg_eth_npeb_resources), + .resource = fsg_eth_npeb_resources, }, { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEC, .dev = { .platform_data = fsg_plat_eth + 1, }, + .num_resources = ARRAY_SIZE(fsg_eth_npec_resources), + .resource = fsg_eth_npec_resources, } }; diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c index 93b7afeee142..07b50dfcc489 100644 --- a/arch/arm/mach-ixp4xx/goramo_mlr.c +++ b/arch/arm/mach-ixp4xx/goramo_mlr.c @@ -273,6 +273,22 @@ static struct platform_device device_uarts = { /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource eth_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource eth_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info eth_plat[] = { { .phy = 0, @@ -290,10 +306,14 @@ static struct platform_device device_eth_tab[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = eth_plat, + .num_resources = ARRAY_SIZE(eth_npeb_resources), + .resource = eth_npeb_resources, }, { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEC, .dev.platform_data = eth_plat + 1, + .num_resources = ARRAY_SIZE(eth_npec_resources), + .resource = eth_npec_resources, } }; diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index 6f0f7ed18ea8..45d5b720ded6 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c @@ -187,6 +187,22 @@ static struct platform_device ixdp425_uart = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource ixp425_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource ixp425_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info ixdp425_plat_eth[] = { { .phy = 0, @@ -204,10 +220,14 @@ static struct platform_device ixdp425_eth[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = ixdp425_plat_eth, + .num_resources = ARRAY_SIZE(ixp425_npeb_resources), + .resource = ixp425_npeb_resources, }, { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEC, .dev.platform_data = ixdp425_plat_eth + 1, + .num_resources = ARRAY_SIZE(ixp425_npec_resources), + .resource = ixp425_npec_resources, } }; diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index c142cfa8c5d6..6959ad2e3aec 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c @@ -165,6 +165,14 @@ static struct platform_device nas100d_uart = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource nas100d_eth_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info nas100d_plat_eth[] = { { .phy = 0, @@ -178,6 +186,8 @@ static struct platform_device nas100d_eth[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = nas100d_plat_eth, + .num_resources = ARRAY_SIZE(nas100d_eth_resources), + .resource = nas100d_eth_resources, } }; diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index ee1877fcfafe..a428bb918703 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c @@ -185,6 +185,14 @@ static struct platform_device nslu2_uart = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource nslu2_eth_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info nslu2_plat_eth[] = { { .phy = 1, @@ -198,6 +206,8 @@ static struct platform_device nslu2_eth[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = nslu2_plat_eth, + .num_resources = ARRAY_SIZE(nslu2_eth_resources), + .resource = nslu2_eth_resources, } }; diff --git a/arch/arm/mach-ixp4xx/omixp-setup.c b/arch/arm/mach-ixp4xx/omixp-setup.c index 6ed5a9aed600..8f2b8c473d7a 100644 --- a/arch/arm/mach-ixp4xx/omixp-setup.c +++ b/arch/arm/mach-ixp4xx/omixp-setup.c @@ -170,6 +170,22 @@ static struct platform_device mic256_leds = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource ixp425_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource ixp425_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info ixdp425_plat_eth[] = { { .phy = 0, @@ -187,10 +203,14 @@ static struct platform_device ixdp425_eth[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = ixdp425_plat_eth, + .num_resources = ARRAY_SIZE(ixp425_npeb_resources), + .resource = ixp425_npeb_resources, }, { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEC, .dev.platform_data = ixdp425_plat_eth + 1, + .num_resources = ARRAY_SIZE(ixp425_npec_resources), + .resource = ixp425_npec_resources, }, }; diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c index d2ebb7c675a8..e506d2af98ad 100644 --- a/arch/arm/mach-ixp4xx/vulcan-setup.c +++ b/arch/arm/mach-ixp4xx/vulcan-setup.c @@ -124,6 +124,22 @@ static struct platform_device vulcan_uart = { .num_resources = ARRAY_SIZE(vulcan_uart_resources), }; +static struct resource vulcan_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource vulcan_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info vulcan_plat_eth[] = { [0] = { .phy = 0, @@ -144,6 +160,8 @@ static struct platform_device vulcan_eth[] = { .dev = { .platform_data = &vulcan_plat_eth[0], }, + .num_resources = ARRAY_SIZE(vulcan_npeb_resources), + .resource = vulcan_npeb_resources, }, [1] = { .name = "ixp4xx_eth", @@ -151,6 +169,8 @@ static struct platform_device vulcan_eth[] = { .dev = { .platform_data = &vulcan_plat_eth[1], }, + .num_resources = ARRAY_SIZE(vulcan_npec_resources), + .resource = vulcan_npec_resources, }, }; diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index f7edf8b38dea..ee45215c4ba4 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1365,9 +1365,10 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) struct phy_device *phydev = NULL; struct device *dev = &pdev->dev; struct eth_plat_info *plat; + resource_size_t regs_phys; struct net_device *ndev; + struct resource *res; struct port *port; - u32 regs_phys; int err; plat = dev_get_platdata(dev); @@ -1380,13 +1381,18 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) port->netdev = ndev; port->id = pdev->id; + /* Get the port resource and remap */ + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + regs_phys = res->start; + port->regs = devm_ioremap_resource(dev, res); + switch (port->id) { case IXP4XX_ETH_NPEA: /* If the MDIO bus is not up yet, defer probe */ if (!mdio_bus) return -EPROBE_DEFER; - port->regs = (struct eth_regs __iomem *)IXP4XX_EthA_BASE_VIRT; - regs_phys = IXP4XX_EthA_BASE_PHYS; break; case IXP4XX_ETH_NPEB: /* @@ -1399,13 +1405,11 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) IXP4XX_FEATURE_NPEB_ETH0)) return -ENODEV; /* Else register the MDIO bus on NPE-B */ - if ((err = ixp4xx_mdio_register(IXP4XX_EthC_BASE_VIRT))) + if ((err = ixp4xx_mdio_register(port->regs))) return err; } if (!mdio_bus) return -EPROBE_DEFER; - port->regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; - regs_phys = IXP4XX_EthB_BASE_PHYS; break; case IXP4XX_ETH_NPEC: /* @@ -1417,13 +1421,11 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) IXP4XX_FEATURE_NPEC_ETH)) return -ENODEV; /* Else register the MDIO bus on NPE-C */ - if ((err = ixp4xx_mdio_register(IXP4XX_EthC_BASE_VIRT))) + if ((err = ixp4xx_mdio_register(port->regs))) return err; } if (!mdio_bus) return -EPROBE_DEFER; - port->regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; - regs_phys = IXP4XX_EthC_BASE_PHYS; break; default: return -ENODEV; From patchwork Fri Jan 10 08:28:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1220892 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=L7tPklH0; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47vGPN1hmhz9sRQ for ; Fri, 10 Jan 2020 19:29:44 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727189AbgAJI3n (ORCPT ); Fri, 10 Jan 2020 03:29:43 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:41807 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726989AbgAJI3n (ORCPT ); Fri, 10 Jan 2020 03:29:43 -0500 Received: by mail-lf1-f67.google.com with SMTP id m30so799983lfp.8 for ; Fri, 10 Jan 2020 00:29:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aOXdA3Cjuv3cEdllJ4Us7BJBe0usD3J7CREcnQKOEpo=; b=L7tPklH0ycJwMT8kngbXsfpxtGdyRutnNBL3sKoNqRIEC9LQIhAg+jcovfb2BipWQi kWpRC+Dp0s4+78zV8Qo9lho5EXVmntKyvOO4GFBakFMnzSQMFvastwvsZCYjfB4BevTL Ecsh++iHHnUW1cM1eFdrdrTikpBpg04Jg+xAjCMJEEdgb+h2J0GlDz0+QgP9K4+xdg3c nYK59lZ0BYFLzFEQJ2tY0ffqy6/hvv5Xm34Qgx7bKaF9Q3QedGlE8nAPaL1mLWj5XZl8 cpck0M+QfOVYUZTWnO4twQGq5l2lNZ3YqWOrfQWVcWCvsNEKU1X0MIQJTd8RbvS1z8RH 3VJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aOXdA3Cjuv3cEdllJ4Us7BJBe0usD3J7CREcnQKOEpo=; b=oSjVest5XrCeKA/dA6EWxers5PEJrPFZKB3Ny+dYXwRUBk8g2b3N1zaPgu4x3H+V3z 4zjeZy8LftlbT74j3Xgkxau3XOyVgVTILgV/rQTBC8Gia20xHHUVgkvh0Epb1cQKRsSm 17v3v9CFBDvZuCxytDNFNteczWA6F13+7vnORWQBLx2ndAJ7Mz9YpArJhznUitHAjK1K dJ6hHQzwqeXPvVlLLwCJ+OtNMaqaPVLC7p+asCKovlvVOd0s+JyLa6vQilw2CqOl8onc cVGrdTsDEkjk+fhk6DG0/DMiM0orPfaT0UZjMWWxVBgXhpfubN1BiwYb96SzttICzC/9 R4pQ== X-Gm-Message-State: APjAAAVnic8j+QWrYJDqrtJfTbe1PS+AceGtjeBHELDtRI7RTzTIuo6s 5iRzKH//P1MxfDixOQh2rDkEqrIFccUYww== X-Google-Smtp-Source: APXvYqznB2IT+w819jpdUOOmzn2mp6+PGxr1KaoA0BjBUjprMMsNvtw4+9mAeptD4j/qpgvtKIPI0A== X-Received: by 2002:a19:f716:: with SMTP id z22mr1559207lfe.14.1578644980877; Fri, 10 Jan 2020 00:29:40 -0800 (PST) Received: from linux.local (c-5ac9225c.014-348-6c756e10.bbcust.telenor.se. [92.34.201.90]) by smtp.gmail.com with ESMTPSA id g24sm606464lfb.85.2020.01.10.00.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 00:29:40 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Jakub Kicinski , Linus Walleij Subject: [PATCH net-next 9/9 v4] net: ethernet: ixp4xx: Use parent dev for DMA pool Date: Fri, 10 Jan 2020 09:28:37 +0100 Message-Id: <20200110082837.11473-10-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200110082837.11473-1-linus.walleij@linaro.org> References: <20200110082837.11473-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use the netdevice struct device .parent field when calling dma_pool_create(): the .dma_coherent_mask and .dma_mask pertains to the bus device on the hardware (platform) bus in this case, not the struct device inside the network device. This makes the pool allocation work. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop a stable tag and rebubmit. ChangeLog v2->v3: - Rebased on v5.5-rc1 ChangeLog v1->v2: - Rebase with the rest of the series. - Tag for stable, this is pretty serious. - I have no real idea when this stopped working. --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index ee45215c4ba4..269596c15133 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1086,7 +1086,7 @@ static int init_queues(struct port *port) int i; if (!ports_open) { - dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev, + dma_pool = dma_pool_create(DRV_NAME, port->netdev->dev.parent, POOL_ALLOC_SIZE, 32, 0); if (!dma_pool) return -ENOMEM;