Linux-GPIO Archive on lore.kernel.org
 help / color / Atom feed
From: Sylvain Lemieux <slemieux.tyco@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: soc@kernel.org,
	"moderated list:ARM PORT" <linux-arm-kernel@lists.infradead.org>,
	Vladimir Zapolskiy <vz@mleia.com>,
	Russell King <linux@armlinux.org.uk>,
	Gregory Clement <gregory.clement@bootlin.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Guenter Roeck <linux@roeck-us.net>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	linux-serial@vger.kernel.org,
	USB list <linux-usb@vger.kernel.org>,
	LINUXWATCHDOG <linux-watchdog@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 07/14] net: lpc-enet: move phy setup into platform code
Date: Tue, 6 Aug 2019 16:11:38 -0400
Message-ID: <CA+rxa6pcw7une0YUyMd1ZxUpcAqRRqZHcEUXxTYuscmpDUsCuQ@mail.gmail.com> (raw)
In-Reply-To: <20190731195713.3150463-8-arnd@arndb.de>

On Wed, Jul 31, 2019 at 4:01 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> 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 <arnd@arndb.de>
> ---
>  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(-)
>
> 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 <linux/spinlock.h>
>  #include <linux/soc/nxp/lpc32xx-misc.h>
>
> -#include <mach/hardware.h>
> -#include <mach/platform.h>
> -
>  #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 <linux/types.h>
> +#include <linux/phy.h>
>
>  #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 */
> --
> 2.20.0
>

  reply index

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 19:56 [PATCH 00/14] ARM: move lpc32xx and dove to multiplatform Arnd Bergmann
2019-07-31 19:56 ` [PATCH 01/14] usb: ohci-nxp: enable compile-testing Arnd Bergmann
2019-08-01  5:58   ` Greg Kroah-Hartman
2019-07-31 19:56 ` [PATCH 02/14] usb: udc: lpc32xx: allow compile-testing Arnd Bergmann
2019-08-01  5:58   ` Greg Kroah-Hartman
2019-08-05 12:47     ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 03/14] watchdog: pnx4008_wdt: " Arnd Bergmann
2019-07-31 20:23   ` Guenter Roeck
2019-07-31 20:26     ` Arnd Bergmann
2019-07-31 20:36       ` Guenter Roeck
2019-08-05 12:42         ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 04/14] serial: lpc32xx_hs: " Arnd Bergmann
2019-08-01  5:58   ` Greg Kroah-Hartman
2019-08-05 12:43     ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 05/14] gpio: lpc32xx: allow building on non-lpc32xx targets Arnd Bergmann
2019-08-02  7:10   ` Bartosz Golaszewski
2019-08-02 11:19     ` Arnd Bergmann
2019-08-05  8:27       ` Bartosz Golaszewski
2019-08-09 14:18         ` Arnd Bergmann
2019-08-06 20:02   ` Sylvain Lemieux
2019-08-09 14:19     ` Arnd Bergmann
2019-07-31 19:56 ` [PATCH 06/14] net: lpc-enet: factor out iram access Arnd Bergmann
2019-07-31 19:56 ` [PATCH 07/14] net: lpc-enet: move phy setup into platform code Arnd Bergmann
2019-08-06 20:11   ` Sylvain Lemieux [this message]
2019-08-06 20:12   ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 08/14] net: lpc-enet: allow compile testing Arnd Bergmann
2019-08-06 20:13   ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 09/14] serial: lpc32xx: " Arnd Bergmann
2019-08-01  5:59   ` Greg Kroah-Hartman
2019-07-31 19:56 ` [PATCH 10/14] ARM: lpc32xx: clean up header files Arnd Bergmann
2019-08-06 20:16   ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 11/14] ARM: lpc32xx: allow multiplatform build Arnd Bergmann
2019-07-31 19:56 ` [PATCH 12/14] ARM: dove: clean up mach/*.h headers Arnd Bergmann
2019-07-31 19:56 ` [PATCH 13/14] ARM: orion/mvebu: unify debug-ll virtual addresses Arnd Bergmann
2019-07-31 19:56 ` [PATCH 14/14] ARM: dove: multiplatform support Arnd Bergmann
2019-07-31 22:53 ` [PATCH 00/14] ARM: move lpc32xx and dove to multiplatform Russell King - ARM Linux admin
2019-08-01  7:33   ` Arnd Bergmann
2019-08-15 13:11     ` Arnd Bergmann
2019-08-15 18:32       ` Sylvain Lemieux
2019-08-15 19:38         ` Arnd Bergmann

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+rxa6pcw7une0YUyMd1ZxUpcAqRRqZHcEUXxTYuscmpDUsCuQ@mail.gmail.com \
    --to=slemieux.tyco@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@bootlin.com \
    --cc=jason@lakedaemon.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=soc@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=vz@mleia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-GPIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-gpio/0 linux-gpio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-gpio linux-gpio/ https://lore.kernel.org/linux-gpio \
		linux-gpio@vger.kernel.org linux-gpio@archiver.kernel.org
	public-inbox-index linux-gpio


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-gpio


AGPL code for this site: git clone https://public-inbox.org/ public-inbox