From patchwork Wed Jul 31 19:56:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 170216 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4436422ile; Wed, 31 Jul 2019 13:02:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFNf+VbfHGYEcX1QtLDWE9DOOmbQhAe7Uz814Kom8R4pEXu0VD71HmnfT7mO6jhFMNDyHG X-Received: by 2002:a62:7990:: with SMTP id u138mr47175350pfc.191.1564603321511; Wed, 31 Jul 2019 13:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564603321; cv=none; d=google.com; s=arc-20160816; b=xBdvEsFB1vmif9Mm5k7ZTk3+/NjTgBRH80Bz0fqh9dd/9PlrpsX/hVIRbUwlUKtlJY z7/iIXDkLy8HUt4C/BwSv1twzUsta+kaPBoLdnGtyvIPXQ4H/YUcvCvxu1ngBeVP1CCS MosmVWEDLGHxe6SbN0v9kdiZwz1I+4axhgEr6frsBvpgLUdoUdKZGE3SU8RptyrV0zHG aFadJWF1PPHwYRDYDEscvths12rvNMua6XLCxeZhodPXhY3v74AlX7cS2sjfULtuev1Z mkF3x4zhjNHc/Giw5Tl+KsY2B1JVlKaaBJH8A5Q7UdX65Dxkd1Lkd6QDVRSf30F+u+km iaKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LQ3TU2cov7JZHX2YTEPetdI7QPWqDw0Z+ZZKZbyEFAw=; b=SsSpVqc2ptnQEw440GNcs1CvgqT/WGKn9Dm/fWroG3sljqC5xJiDAIm9RlnQXlmb/I dyvjGgr3u/t0NPTnAZptXGC6zQGNEVIwEuqgcDyu/obru67C4ffFy00x3DBGnDgfOadx /8MyrMNDGAzQT/j4PbkfHYUfJ7acXy+T/n7TmyTaT99ZrvZW44X/gjD3AQp43obnAJX2 HM8YmcM+FgvL2YrhYVgv06Wf+a0I6wy7zZ/lO9fIr3Gw5OL8Tzf5lHQ+kFAS9iC+uWgn lqBUR4YMZLS4WDZbldbBX8nhHqUps8r9dtgzvuvBH8ZEsXnEEnFp62q1WcVeCb12ji6w r55g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bx21si2136594pjb.21.2019.07.31.13.02.01; Wed, 31 Jul 2019 13:02:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730464AbfGaUCA (ORCPT + 5 others); Wed, 31 Jul 2019 16:02:00 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:32947 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727411AbfGaUB7 (ORCPT ); Wed, 31 Jul 2019 16:01:59 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MhWx1-1iWd3A2AUt-00eeFu; Wed, 31 Jul 2019 22:01:23 +0200 From: Arnd Bergmann To: soc@kernel.org, linux-arm-kernel@lists.infradead.org, Vladimir Zapolskiy , Sylvain Lemieux , Russell King , Gregory Clement , Linus Walleij Cc: Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , "David S. Miller" , Greg Kroah-Hartman , Alan Stern , Guenter Roeck , linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-serial@vger.kernel.org, linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH 07/14] net: lpc-enet: move phy setup into platform code Date: Wed, 31 Jul 2019 21:56:49 +0200 Message-Id: <20190731195713.3150463-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190731195713.3150463-1-arnd@arndb.de> References: <20190731195713.3150463-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:DV0nUYbe0M7LEh69rBwpnzpxoNTB5NYut5sl+C1tAwRs+femstR Rb6T5pxzGUFSlJsJr98GJFWfI00qzelp0DSmJSBm+Ss1XOrjdPC5tHy4ZIHY7Q6wBFxXTCi jscc3Pqo7B3jvlmH+w27lTB9SaeK/1nbLjChGfLrc4ixR1DkgFO4ps4co9wrutnuhPxqLiW y2YJJujXV4RZ7aFFguoGQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:4vEuAYs9ZXo=:GFoO+dSjJ1TDEX2+SUxnDx yqMghV4hxbjcUD6ijCuXiSaE3N3EEyyYw7YM+VDvmzD4V4clIdZVgbBBszYBg79h8zPiA/fi7 PuHfqfZqc+YQKoLOz+Y05GtP1lQAKrt0dQunuwjuYVj565TjXwI0ZcNaWQmSzMHSO3AYGkO1t tM3cMJRzZpJKtFWZEmnaKy2bbsC3s+GFBnbjaRLVTA3VFHzURqYoRYLLOL2ilIvgCyHhVjFj4 yeLFKXWVDO0GIQIdPorev9o1bd/H1DmbfTrvz7zfVCHzkq4s5r+z73cccXlotHP6nf7wedmXt iPeCk8sfxTrDcKlUg284A0JtFkg4URHi/sTKtsaLbno3CgnL5KdsqZXsDM8UpvjhA8905I7CI YJbJU2SP9RecnuZH+CvrVjWpjabuD6r8lfTHGhuF362RgQmSzRPuBf1Kk9yYGbKBqqQLCHZuO U0jagpJqBuZImzDYWYdne+7T8b1DpFvxzqpHXDX2P4AB4M/M7j1LBS3ZfDnXvKMFEfyyQF26w pBe2X3fJhusESwtQQuWiLhw/KlycsLnS6O5uZ20SL2VWN07a0meZDYTp15FQYWB7celFqw2cd WHnOcLv5jLsOgzWmcibU+4717eTSAv+Kn4hBKPs3pxhAP2mhxdtAlvmScDxXB/xPZ8hWJEhxJ /4n8Cmy85oczi2XHhkWw/t3JGfi2JLAtRqIK5N6g53zMPo3AaRWATfQamQ91y8XyQR8WublTd vvhb/nkpfBwQtPx27wK+aKf9DM4T9mjgAEcATg== Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Setting the phy mode requires touching a platform specific register, which prevents us from building the driver without its header files. Move it into a separate function in arch/arm/mach/lpc32xx to hide the core registers from the network driver. Signed-off-by: Arnd Bergmann --- arch/arm/mach-lpc32xx/common.c | 12 ++++++++++++ drivers/net/ethernet/nxp/lpc_eth.c | 12 +----------- include/linux/soc/nxp/lpc32xx-misc.h | 5 +++++ 3 files changed, 18 insertions(+), 11 deletions(-) -- 2.20.0 diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c index f648324d5fb4..a475339333c1 100644 --- a/arch/arm/mach-lpc32xx/common.c +++ b/arch/arm/mach-lpc32xx/common.c @@ -63,6 +63,18 @@ u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr) } EXPORT_SYMBOL_GPL(lpc32xx_return_iram); +void lpc32xx_set_phy_interface_mode(phy_interface_t mode) +{ + u32 tmp = __raw_readl(LPC32XX_CLKPWR_MACCLK_CTRL); + tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK; + if (mode == PHY_INTERFACE_MODE_MII) + tmp |= LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS; + else + tmp |= LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS; + __raw_writel(tmp, LPC32XX_CLKPWR_MACCLK_CTRL); +} +EXPORT_SYMBOL_GPL(lpc32xx_set_phy_interface_mode); + static struct map_desc lpc32xx_io_desc[] __initdata = { { .virtual = (unsigned long)IO_ADDRESS(LPC32XX_AHB0_START), diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index bcdd0adcfb0c..0893b77c385d 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c @@ -20,9 +20,6 @@ #include #include -#include -#include - #define MODNAME "lpc-eth" #define DRV_VERSION "1.00" @@ -1237,16 +1234,9 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) dma_addr_t dma_handle; struct resource *res; int irq, ret; - u32 tmp; /* Setup network interface for RMII or MII mode */ - tmp = __raw_readl(LPC32XX_CLKPWR_MACCLK_CTRL); - tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK; - if (lpc_phy_interface_mode(dev) == PHY_INTERFACE_MODE_MII) - tmp |= LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS; - else - tmp |= LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS; - __raw_writel(tmp, LPC32XX_CLKPWR_MACCLK_CTRL); + lpc32xx_set_phy_interface_mode(lpc_phy_interface_mode(dev)); /* Get platform resources */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); diff --git a/include/linux/soc/nxp/lpc32xx-misc.h b/include/linux/soc/nxp/lpc32xx-misc.h index f232e1a1bcdc..af4f82f6cf3b 100644 --- a/include/linux/soc/nxp/lpc32xx-misc.h +++ b/include/linux/soc/nxp/lpc32xx-misc.h @@ -9,9 +9,11 @@ #define __SOC_LPC32XX_MISC_H #include +#include #ifdef CONFIG_ARCH_LPC32XX extern u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr); +extern void lpc32xx_set_phy_interface_mode(phy_interface_t mode); #else static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr) { @@ -19,6 +21,9 @@ static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaadd *dmaaddr = 0; return 0; } +static inline void lpc32xx_set_phy_interface_mode(phy_interface_t mode) +{ +} #endif #endif /* __SOC_LPC32XX_MISC_H */