From patchwork Wed Jul 31 19:56:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 170215 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4435779ile; Wed, 31 Jul 2019 13:01:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMsWs+ENQ6KtAoRUWQSNLIA4wXxbU4lhBs9Im6p+/ppqOxHwJQNTIGYpyynEeLMPOa74Wq X-Received: by 2002:a63:d315:: with SMTP id b21mr92303330pgg.326.1564603293559; Wed, 31 Jul 2019 13:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564603293; cv=none; d=google.com; s=arc-20160816; b=XN2DXW8mYZWfIQ+UFu+RO7Jm5A5RZXM4smeL+OcJZ5OsU+rdHqcYFhzM0XECOjRkaS b4F0HXoQH+ieiAbPLYZVdKeRPlL+oawJpqGw1ApcegcDMNx3UfIrG7vZMFNazNPX7/Yn ZwXnp34Pc+Nls6cRp6d3/cjeyJkI84DmWqDbg6S6wNmso8JkElqOSme06KuVdx4J5zZ+ pfAgOfAla/of7tkeXeGCgWrJxAHm+P+QEmf+iq+lKMd2KvYpUqBxf0r6XJ4mn1Z0RYuc P71vaLOnMhQ/MjR5jmh36O8Xx5nKSfNX/mg672CjpGPYlUJP3aggFwmrTYDVFaxpMpik 5stQ== 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=NYz6kLcbwBwFgXgwbw9LmCwkvNW4fMznlddtEwyJ/Bk=; b=aVb9ekFUQjXrnHgSNSgQrzQROrwmts0M3A0Jy2bLoOFKfHjHdVIFXMjlSv8B6K8v4P Fa7LDBOtjTY9VFi9uxm+TZpugeYQvC5oPtx71t/+b/oBN+TpZGvfQRZ65Q4e+xlFo04c NnLEegkr1mz2euNmHFmscJSsUqEbL0Nylribda3aQaKKj4mh0lWMfshX4+0UnX2gB6m3 DYj3m8hU6niFkGQ+uXU3fUXL0zEDBuusqhPVViL5hgzMqG3kUyErg+KKY4NUGHQuBanJ sGNOz4TBmsL0RDvnEX1YRxTaBk/p7Fux53f7+4Y2qDkEYAwFFaVp9cIGjhBTrf+3nlrw le5A== 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 y15si2247675pjp.90.2019.07.31.13.01.33; Wed, 31 Jul 2019 13:01:33 -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 S1729389AbfGaUBd (ORCPT + 5 others); Wed, 31 Jul 2019 16:01:33 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:51513 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727411AbfGaUBc (ORCPT ); Wed, 31 Jul 2019 16:01:32 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MElhb-1i8Xgp2Pet-00GM78; Wed, 31 Jul 2019 22:00:56 +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 06/14] net: lpc-enet: factor out iram access Date: Wed, 31 Jul 2019 21:56:48 +0200 Message-Id: <20190731195713.3150463-7-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:SIR+StTg1yfrJOk+RcwJDCCTVUYEqRYGtvhttUvKUj31xjabS6n 0LjT+qb3UAb0wMRK253nbzu3yZ3hPz+pIxmA9ovy6x6yoAvgMjctqBTKYeNdbeO3ryTQq28 p/9wr3WFSy9q6FjN5nQAi3ktBtB0uKTJHmeIssaTO4h7KjjpJ9grdl8muSebBIPnDH93laV 3vxDTuWhUy1AUE1bdegow== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:oRuu35Z+Gjo=:s5+pnERwtAQyP8VJgqAt49 l0k5KqbH9+SS96l4h+t7GvVd1LVAAALILTBfI4FIqIlR10dLieS9fbqrdjL2AQ8WyRaRqOD6W epTKa71yW0dKFbxFd7fzUBx9uvpSW/aLQdPEZDpGrgeJO7mi5B3Wwed3PIXDydKimGUhVRqU2 r/pe2z4V0WzBxz/E4hpeXgbTLft2IESnaRgLyIj1MGF62B8RdKPY2Ww4LvX6oHBj93pLER+Ne T8gmc/dSSkveTkm4kODVLzeWW9wQ5fme4TpyOnYibFO09p4n4OjViFaHBr69bv3YUYhtitzNv vB+MdT8votc29osLornsNrAUeWjVj8hN7O/Pq0vGo41TILFk/9fWyYnJqgT51E0/tWnfKIDVk FI+iwbCPxaA8Mp4gNKH5YZG+O0vQJld5RQZfh+UqvEpFObW/z7qP2ZvOqM2DLR18ZcOM6hQHb 4gegkDsNTebUejDsUoTub4JH4mDFCADIQV5ksAXprlZIcylvj1aLVgpsYcfY8eumW5O10CZmJ 1sw0dflgSdQQ1vHUczcQtEeuULSE9v+Ut+scmAwoNWZduHiN988x4HYFI7g7PHnMoTbf1FCqY yCmsKnSFvA0Vlw6LqowlAAEtPRZDIC3z1pMhGV+yW40QH0mkRF7qhig45pytv3oUneJF56cFi EiybDCqbeBLnSQfInzg22sf8KSPgsVL/8YCanPEE35FDEm8RF+5Y/EpIruCWZ1wrrd2VQtEKX ALqUR6CJ8FkCg3jSiJqjqpftcnb7idgRTWcyIw== Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The lpc_eth driver uses a platform specific method to find the internal sram. This prevents building it on other machines. Rework to only use one function call and keep the other platform internals where they belong. Ideally this would look up the sram location from DT, but as this is a rarely used driver, I want to keep the modifications to a minimum. Signed-off-by: Arnd Bergmann --- arch/arm/mach-lpc32xx/common.c | 9 ++++++-- arch/arm/mach-lpc32xx/common.h | 1 - arch/arm/mach-lpc32xx/include/mach/board.h | 15 -------------- drivers/net/ethernet/nxp/lpc_eth.c | 17 ++++++++------- include/linux/soc/nxp/lpc32xx-misc.h | 24 ++++++++++++++++++++++ 5 files changed, 39 insertions(+), 27 deletions(-) delete mode 100644 arch/arm/mach-lpc32xx/include/mach/board.h create mode 100644 include/linux/soc/nxp/lpc32xx-misc.h -- 2.20.0 diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c index 5b71b4fab2cd..f648324d5fb4 100644 --- a/arch/arm/mach-lpc32xx/common.c +++ b/arch/arm/mach-lpc32xx/common.c @@ -8,6 +8,7 @@ */ #include +#include #include #include @@ -32,7 +33,7 @@ void lpc32xx_get_uid(u32 devid[4]) */ #define LPC32XX_IRAM_BANK_SIZE SZ_128K static u32 iram_size; -u32 lpc32xx_return_iram_size(void) +u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr) { if (iram_size == 0) { u32 savedval1, savedval2; @@ -53,10 +54,14 @@ u32 lpc32xx_return_iram_size(void) } else iram_size = LPC32XX_IRAM_BANK_SIZE * 2; } + if (dmaaddr) + *dmaaddr = LPC32XX_IRAM_BASE; + if (mapbase) + *mapbase = io_p2v(LPC32XX_IRAM_BASE); return iram_size; } -EXPORT_SYMBOL_GPL(lpc32xx_return_iram_size); +EXPORT_SYMBOL_GPL(lpc32xx_return_iram); static struct map_desc lpc32xx_io_desc[] __initdata = { { diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h index 8e597ce48a73..32f0ad217807 100644 --- a/arch/arm/mach-lpc32xx/common.h +++ b/arch/arm/mach-lpc32xx/common.h @@ -23,7 +23,6 @@ extern void __init lpc32xx_serial_init(void); */ extern void lpc32xx_get_uid(u32 devid[4]); -extern u32 lpc32xx_return_iram_size(void); /* * Pointers used for sizing and copying suspend function data */ diff --git a/arch/arm/mach-lpc32xx/include/mach/board.h b/arch/arm/mach-lpc32xx/include/mach/board.h deleted file mode 100644 index 476513d970a4..000000000000 --- a/arch/arm/mach-lpc32xx/include/mach/board.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * arm/arch/mach-lpc32xx/include/mach/board.h - * - * Author: Kevin Wells - * - * Copyright (C) 2010 NXP Semiconductors - */ - -#ifndef __ASM_ARCH_BOARD_H -#define __ASM_ARCH_BOARD_H - -extern u32 lpc32xx_return_iram_size(void); - -#endif /* __ASM_ARCH_BOARD_H */ diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index f7e11f1b0426..bcdd0adcfb0c 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c @@ -18,8 +18,8 @@ #include #include #include +#include -#include #include #include @@ -1311,16 +1311,15 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) /* Get size of DMA buffers/descriptors region */ pldat->dma_buff_size = (ENET_TX_DESC + ENET_RX_DESC) * (ENET_MAXF_SIZE + sizeof(struct txrx_desc_t) + sizeof(struct rx_status_t)); - pldat->dma_buff_base_v = 0; if (use_iram_for_net(dev)) { - dma_handle = LPC32XX_IRAM_BASE; - if (pldat->dma_buff_size <= lpc32xx_return_iram_size()) - pldat->dma_buff_base_v = - io_p2v(LPC32XX_IRAM_BASE); - else + if (pldat->dma_buff_size > + lpc32xx_return_iram(&pldat->dma_buff_base_v, &dma_handle)) { + pldat->dma_buff_base_v = NULL; + pldat->dma_buff_size = 0; netdev_err(ndev, "IRAM not big enough for net buffers, using SDRAM instead.\n"); + } } if (pldat->dma_buff_base_v == 0) { @@ -1409,7 +1408,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) unregister_netdev(ndev); err_out_dma_unmap: if (!use_iram_for_net(dev) || - pldat->dma_buff_size > lpc32xx_return_iram_size()) + pldat->dma_buff_size > lpc32xx_return_iram(NULL, NULL)) dma_free_coherent(dev, pldat->dma_buff_size, pldat->dma_buff_base_v, pldat->dma_buff_base_p); @@ -1436,7 +1435,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev) unregister_netdev(ndev); if (!use_iram_for_net(&pldat->pdev->dev) || - pldat->dma_buff_size > lpc32xx_return_iram_size()) + pldat->dma_buff_size > lpc32xx_return_iram(NULL, NULL)) dma_free_coherent(&pldat->pdev->dev, pldat->dma_buff_size, pldat->dma_buff_base_v, pldat->dma_buff_base_p); diff --git a/include/linux/soc/nxp/lpc32xx-misc.h b/include/linux/soc/nxp/lpc32xx-misc.h new file mode 100644 index 000000000000..f232e1a1bcdc --- /dev/null +++ b/include/linux/soc/nxp/lpc32xx-misc.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Author: Kevin Wells + * + * Copyright (C) 2010 NXP Semiconductors + */ + +#ifndef __SOC_LPC32XX_MISC_H +#define __SOC_LPC32XX_MISC_H + +#include + +#ifdef CONFIG_ARCH_LPC32XX +extern u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr); +#else +static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr) +{ + *mapbase = NULL; + *dmaaddr = 0; + return 0; +} +#endif + +#endif /* __SOC_LPC32XX_MISC_H */ 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 */ From patchwork Wed Jul 31 19:56:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 170218 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4437345ile; Wed, 31 Jul 2019 13:02:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqznsmnOffSB01GkzH/A8zMW/qJB9xTsrmO0jRmSwOjBc2FvoXqohysDlBuNfzPCbSN2TAg/ X-Received: by 2002:a62:ab18:: with SMTP id p24mr49350350pff.113.1564603366960; Wed, 31 Jul 2019 13:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564603366; cv=none; d=google.com; s=arc-20160816; b=wMJH/1KsSjl/QTxglFlBiaZnHgvtMZf6GXXiNkAbOJPBtzGs8B860oPN4/LT0H2vhU urG2ZSW4Kr45yJ3+ErVp4jn8o+F5mW7A94Fd8PvCCQ9dYAmwJ1ISPWdiwne0GBBHUMOP 8Bk1YJDz4zWzf9FHHBQJJGyt4AOWLt45pe73VeMgSUj8SITZIpRvINiPUSxOK8WCwTb/ NzLFXnFxArElrfMY/kDGyaLHEDOF82dk+mUOj6S+J/XCW5CFffXvZMier+f32diTJ5wA Z1rkkKqq+zcW1b+Tb3/feEjKufzt4cG7gQtWH1nBHjKTjJ99Ku/N3Fk/xtKN/+/cxmmP /I0Q== 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=zvkodgCrUb7vWKK6pr/2TYyCRcAnf89cCDMvJOucx5I=; b=Raignldwuh5leX7sqorjHf7jPhzdSbLQZlJ9FNKNj/Zp1fy44H0lHELEg8vZwxe7s8 rdJf/n2o365ZPW3d0ZoE7/Xqx/fbdtCAQq0byEyAKoOhCnEG4Ibu7YiR3JgGXk0mha5b GvQivMuDslGV3WGgTHcuvggwWG9xdZaspmZ9tqZDdVF6FeMo/C5xuR1Htp0hrIpLya+O IjxO/Ot63YnFx8UIYWtUJVQroGmY7a4QNiES3WZI+gyNO+ebxaNIhvrX49PYWtoTmrKG H5zRkdG1Q5l/4UiD6QzG/cgAYTl9XYUqwvKqUz2Kw9x4y6Z/Nz3RG/HWVuZ0OLZ+XMvB tXTQ== 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 j7si39438328pfi.10.2019.07.31.13.02.46; Wed, 31 Jul 2019 13:02:46 -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 S1730293AbfGaUCq (ORCPT + 5 others); Wed, 31 Jul 2019 16:02:46 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:54159 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729280AbfGaUCq (ORCPT ); Wed, 31 Jul 2019 16:02:46 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MyvFC-1iFEmI1isM-00vu1b; Wed, 31 Jul 2019 22:02:08 +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 , Jiri Slaby , linux-kernel@vger.kernel.org Subject: [PATCH 09/14] serial: lpc32xx: allow compile testing Date: Wed, 31 Jul 2019 21:56:51 +0200 Message-Id: <20190731195713.3150463-10-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:U34UKG0WKd1du7DGye/96IP8sexEkIzBlk61JFzClDj31SLKqCI wfz+noGeI4XYslZMxD9cagGBYN/PWTDbo26SLz707TH/Ua6X9hBQLqZGlOQJxZ8AQi6UI9o cSjmHqUz43Veryx8v4Q1bfVU25rLjk0jJYvgztz+l1bZMNCjzxpn2Oz4oZ+VdmqEv+N2NyI AK7H4/I5OUe/oZGljJ50A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:xpMEYv/5InE=:SJjD2WgwLQK7f/E7eG49m1 ORCHWdS6/lv4MHlAX9BAyyAzpJ37dQYNMkXKmZj2nREnuOPDQi8KABrnPacczrAz27FJOfXrx R8OpIbGHb1OZXerV+HbTvHFFmIRMylgwXzscLtC9Lw21WwjNzEfvk5VXvk+RXedvozf707BnR gLKPap9ZJE1WdxxphI0eL3/CfKAz+4eWAxdfGq0g701jnm8txJekpOspq/R+klU7jVStL/qlo uFX4imePVsjfkU3XUgKN/J49zj/WCVXzjl5+bEfQrJzdneGQcuMy5Dflv1C9rJC1guUOKEClr D+MCibHfsUeL73Pz8TjL+aEee1QYidg9uAWVZVE6IO8u3yq4CJ+yRTDbQKlq8xtIz7RauM6Wo 2fzPgU5667Cs1YTWGXcBfPTSFcqcrGUl+7Db+yzjwvHi8W4s+cc9pZyw1lOlCEjkBUKpyXUGq 8oanZOfS4SDpK0V/rh8bp5wAytZ+pa58Nv0NkuphQIm1NgbZutoGbqzO+hSy87q1xXM0LmxVK C2vmeJ/BVUkQK9gGduSd5IZghQq/S65gYcPY34ce41IlP9mie+7rNba87dk+9KIQdEU1FkHt7 X/yu8Ev+mtMh5TQ8dP6o8gN1sNmc7ClBxwoMKNTbwQpTWhCggqRcZjVGcKgpYb4j65PeB1vgB zeQT+UXcTgGAOM/3NC2qSmGn6Dv0v/AuPh4G7fl00U4rgcXkRG1axjkHib/qYlhLxUc3YNvXv y/20aDue/cmZNdH9zEwtoYWsepgqu1h0QGyRXw== Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The lpc32xx_loopback_set() function in hte lpc32xx_hs driver is the one thing that relies on platform header files. Move that into the core platform code so we only need a variable declaration for it, and enable COMPILE_TEST building. Signed-off-by: Arnd Bergmann --- arch/arm/mach-lpc32xx/serial.c | 30 ++++++++++++++++++++++++ drivers/tty/serial/lpc32xx_hs.c | 35 ++++------------------------ include/linux/soc/nxp/lpc32xx-misc.h | 4 ++++ 3 files changed, 38 insertions(+), 31 deletions(-) -- 2.20.0 diff --git a/arch/arm/mach-lpc32xx/serial.c b/arch/arm/mach-lpc32xx/serial.c index 3f9b30df9f0e..cfb35e5691cd 100644 --- a/arch/arm/mach-lpc32xx/serial.c +++ b/arch/arm/mach-lpc32xx/serial.c @@ -60,6 +60,36 @@ static struct uartinit uartinit_data[] __initdata = { }, }; +/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */ +void lpc32xx_loopback_set(resource_size_t mapbase, int state) +{ + int bit; + u32 tmp; + + switch (mapbase) { + case LPC32XX_HS_UART1_BASE: + bit = 0; + break; + case LPC32XX_HS_UART2_BASE: + bit = 1; + break; + case LPC32XX_HS_UART7_BASE: + bit = 6; + break; + default: + WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase); + return; + } + + tmp = readl(LPC32XX_UARTCTL_CLOOP); + if (state) + tmp |= (1 << bit); + else + tmp &= ~(1 << bit); + writel(tmp, LPC32XX_UARTCTL_CLOOP); +} +EXPORT_SYMBOL_GPL(lpc32xx_loopback_set); + void __init lpc32xx_serial_init(void) { u32 tmp, clkmodes = 0; diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c index 7f14cd8fac47..d3843f722182 100644 --- a/drivers/tty/serial/lpc32xx_hs.c +++ b/drivers/tty/serial/lpc32xx_hs.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include /* * High Speed UART register offsets @@ -79,6 +81,8 @@ #define LPC32XX_HSU_TX_TL8B (0x2 << 0) #define LPC32XX_HSU_TX_TL16B (0x3 << 0) +#define LPC32XX_MAIN_OSC_FREQ 13000000 + #define MODNAME "lpc32xx_hsuart" struct lpc32xx_hsuart_port { @@ -149,8 +153,6 @@ static void lpc32xx_hsuart_console_write(struct console *co, const char *s, local_irq_restore(flags); } -static void lpc32xx_loopback_set(resource_size_t mapbase, int state); - static int __init lpc32xx_hsuart_console_setup(struct console *co, char *options) { @@ -437,35 +439,6 @@ static void serial_lpc32xx_break_ctl(struct uart_port *port, spin_unlock_irqrestore(&port->lock, flags); } -/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */ -static void lpc32xx_loopback_set(resource_size_t mapbase, int state) -{ - int bit; - u32 tmp; - - switch (mapbase) { - case LPC32XX_HS_UART1_BASE: - bit = 0; - break; - case LPC32XX_HS_UART2_BASE: - bit = 1; - break; - case LPC32XX_HS_UART7_BASE: - bit = 6; - break; - default: - WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase); - return; - } - - tmp = readl(LPC32XX_UARTCTL_CLOOP); - if (state) - tmp |= (1 << bit); - else - tmp &= ~(1 << bit); - writel(tmp, LPC32XX_UARTCTL_CLOOP); -} - /* port->lock is not held. */ static int serial_lpc32xx_startup(struct uart_port *port) { diff --git a/include/linux/soc/nxp/lpc32xx-misc.h b/include/linux/soc/nxp/lpc32xx-misc.h index af4f82f6cf3b..699c6f1e3aab 100644 --- a/include/linux/soc/nxp/lpc32xx-misc.h +++ b/include/linux/soc/nxp/lpc32xx-misc.h @@ -14,6 +14,7 @@ #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); +extern void lpc32xx_loopback_set(resource_size_t mapbase, int state); #else static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr) { @@ -24,6 +25,9 @@ static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaadd static inline void lpc32xx_set_phy_interface_mode(phy_interface_t mode) { } +static inline void lpc32xx_loopback_set(resource_size_t mapbase, int state) +{ +} #endif #endif /* __SOC_LPC32XX_MISC_H */