Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4523510ybh; Tue, 6 Aug 2019 13:14:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQ4WdXhV1M8wBSiqjIaFQCeObPq+4bTfp8jJQFnSk5Hnqsw7eL9eUj/YE6AHa1JbSDkELb X-Received: by 2002:aa7:8193:: with SMTP id g19mr5417182pfi.16.1565122440406; Tue, 06 Aug 2019 13:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565122440; cv=none; d=google.com; s=arc-20160816; b=Jn7N6bVchK7tgaK0YTZCwfT0PJgC9hPO/Hg32pGqK/uZaWsgQFoh/XC8YnQbHj12yg QRoglUHlle9YA0a0yqsRlj9rmmypgpum8Sh3WiZroKGp7rexkdSIYB9BsWRJ/d6g9jtr D9wfSSr+vwxlKW0evj1lLC1FOwfp7m95VXhwJNnUBHtOYeVSkKY5X0m0xFKYVD8aefV1 rAqrn1LmxbshplW6/CZDF572v5FO92kZIdTUyS6SM/S+sAV9LH6J7RnbJSBamCIOGEp9 D7yzoBiODXHB7BV+WIQCAv6SV96Rj7Jb4FGPBEdpwm1nPPrj7F4SUMdL2nm7RqaDhcGH SYBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lMxZ0x37GnyZR6snyKLwN4Z+9SDuCLa+7zGM3bgCPsE=; b=W3CyxdGXgRQBnDpZ6N3dBvmRG66k8mciAj2BCJ+iyw5wPvYfzNUrtjEB9rdvnfQimK aaxU/cmooykIhqrske8ozbhQv9AYQYGwBIxk8Md9CHMD2K5hbWzAZflDEEwzAxMFPVxf F9Oe0fAdj4UQixd0+5cjPHkGsYK2zJKy+DrNijK10TEtYBwQ2mJRDeSFB2kzs1oSWzNC ZcBXrRzi16nl5b1pNy3M/pMGblI8FgbzRWYLOnTiEvM4YyzJGDGO+MfBbBpmuaxPjjZG 4T25BiYu89pbbm7VoXVvH/2Mk9Sbxs36AngoXfg5cSGaRDcupctPcmMIzERXp8Snjlaz fVhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uNhHnqHW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18si48955466pgg.28.2019.08.06.13.13.44; Tue, 06 Aug 2019 13:14:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uNhHnqHW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726494AbfHFUNH (ORCPT + 99 others); Tue, 6 Aug 2019 16:13:07 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:35765 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbfHFUNH (ORCPT ); Tue, 6 Aug 2019 16:13:07 -0400 Received: by mail-ot1-f65.google.com with SMTP id j19so19047399otq.2; Tue, 06 Aug 2019 13:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lMxZ0x37GnyZR6snyKLwN4Z+9SDuCLa+7zGM3bgCPsE=; b=uNhHnqHWxcUMjj/DObO9qobJZuWy3455TBAFqXuRBPRMYC5UOcehqvZgzujVQQ4tO7 iDYaYUxpX3n0Mk6A0VuEi2MFvBpyGPkiicuFcaiBnkyAPwdFiIPP6T38CwGYN0rNYukJ fBODZFn5Oz2nqDIu++qJzEiRM6bpn5EyKgEsSS5lD09B271GHk3KNUYGKOyjtqAOWD1E p5Z/YfvgTNzyKHA7stW8/f5WGpf4d8iMSt4BlUyR9C5ezdn55uVRgKPYsPQdPzFgM4VT cRlCvxxZWCluzM8Embbcxk15JKo7CMf3oSK45KhhnTFQqDEsfnNjRAwlkx136AVhMz2g oGvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lMxZ0x37GnyZR6snyKLwN4Z+9SDuCLa+7zGM3bgCPsE=; b=MT0XTplbvRDBM9TS8MYZluUQ1U2a3vjNA165zqKog8vfky65QRKAAZ9koWfxxGMghj WMK+dkZ3R/PRLd7zQkp6Bh4jBgKwMX80ih4FuXabsJ6vEkuLp3807dIqj4JQCkGC1e2j G5SgSwxgrz0TwO5VNrOp3oI4PKiryDXpWTZOFG5ERq50OFmLBaX/6wGHWEljO4jdK7bk CuTZdB8Z4dwMLR4uF8rygpQSyzkBBjd0xTWMTAYK2FgTDKxrT6xS5CY6DKbNo5dtLczD dXiIi+4n1pq4/xfoFvnDj5TbEqnyeFuYMVjpJjYamtWCBMvw44PSeSTD5UFmdLaybUlJ dppw== X-Gm-Message-State: APjAAAWedk7jm86Zlqf1rK1vIkshoeQB7XQio/KGuKNa4V8Tb8k2Nr35 DziRdPwA8yUvr62khxRP0tKCPvqRlHZ9cttYSo0= X-Received: by 2002:a05:6602:144:: with SMTP id v4mr5426163iot.202.1565122385732; Tue, 06 Aug 2019 13:13:05 -0700 (PDT) MIME-Version: 1.0 References: <20190731195713.3150463-1-arnd@arndb.de> <20190731195713.3150463-8-arnd@arndb.de> In-Reply-To: <20190731195713.3150463-8-arnd@arndb.de> From: Sylvain Lemieux Date: Tue, 6 Aug 2019 16:12:54 -0400 Message-ID: Subject: Re: [PATCH 07/14] net: lpc-enet: move phy setup into platform code To: Arnd Bergmann Cc: soc@kernel.org, "moderated list:ARM PORT" , Vladimir Zapolskiy , Russell King , Gregory Clement , Linus Walleij , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , "David S. Miller" , Greg Kroah-Hartman , Alan Stern , Guenter Roeck , "open list:GPIO SUBSYSTEM" , Networking , linux-serial@vger.kernel.org, USB list , LINUXWATCHDOG , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acked-by: Sylvain Lemieux On Wed, Jul 31, 2019 at 4:01 PM Arnd Bergmann 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 > --- > 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 > #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 */ > -- > 2.20.0 >