From patchwork Fri Jan 25 10:06:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 2042661 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id EBC893FD1A for ; Fri, 25 Jan 2013 10:13:10 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TygEx-0008DF-OS; Fri, 25 Jan 2013 10:10:31 +0000 Received: from zmc.proxad.net ([212.27.53.206]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TygE6-0007sR-21 for linux-arm-kernel@lists.infradead.org; Fri, 25 Jan 2013 10:09:41 +0000 Received: from localhost (localhost [127.0.0.1]) by zmc.proxad.net (Postfix) with ESMTP id 46B00BAF266; Fri, 25 Jan 2013 11:09:35 +0100 (CET) X-Virus-Scanned: amavisd-new at localhost Received: from zmc.proxad.net ([127.0.0.1]) by localhost (zmc.proxad.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WD9iQDgvfYoE; Fri, 25 Jan 2013 11:09:34 +0100 (CET) Received: from flexo.iliad.local (freebox.vlq16.iliad.fr [213.36.7.13]) by zmc.proxad.net (Postfix) with ESMTPSA id BC3C9BAF88A; Fri, 25 Jan 2013 11:09:34 +0100 (CET) From: Florian Fainelli To: netdev@vger.kernel.org Subject: [RFC PATCH 2/4] net: mvmdio: do not assume SMI reg is at offset 0 of the resource Date: Fri, 25 Jan 2013 11:06:47 +0100 Message-Id: <1359108409-4378-3-git-send-email-florian@openwrt.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359108409-4378-1-git-send-email-florian@openwrt.org> References: <1359108409-4378-1-git-send-email-florian@openwrt.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130125_050938_411865_6BE8BC8D X-CRM114-Status: GOOD ( 12.39 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: thomas.petazzoni@free-electrons.com, andrew@lunn.ch, jason@lakedaemon.net, arnd@arndb.de, gregory.clement@free-electrons.com, ian.molton@codethink.co.uk, Florian Fainelli , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch changes the mvmdio driver not to assume that the MVMDIO_SMI_REG is at offset 0 of the resource we are being passed via Device Tree. This is actually required to reduce the differences between the mv643xx_eth SMI driver and mvmdio. The only user of the "orion-mdio" binding is updated accordingly. Signed-off-by: Florian Fainelli --- Documentation/devicetree/bindings/net/marvell-orion-mdio.txt | 2 +- arch/arm/boot/dts/armada-370-xp.dtsi | 2 +- drivers/net/ethernet/marvell/mvmdio.c | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt b/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt index 34e7aaf..3320d5c 100644 --- a/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt +++ b/Documentation/devicetree/bindings/net/marvell-orion-mdio.txt @@ -19,7 +19,7 @@ mdio { #address-cells = <1>; #size-cells = <0>; compatible = "marvell,orion-mdio"; - reg = <0xd0072004 0x4>; + reg = <0xd0072000 0x8>; }; And at the board level: diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi index 4c0abe8..0e7d880 100644 --- a/arch/arm/boot/dts/armada-370-xp.dtsi +++ b/arch/arm/boot/dts/armada-370-xp.dtsi @@ -91,7 +91,7 @@ #address-cells = <1>; #size-cells = <0>; compatible = "marvell,orion-mdio"; - reg = <0xd0072004 0x4>; + reg = <0xd0072000 0x8>; }; ethernet@d0070000 { diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c index e4a89b2..16be140 100644 --- a/drivers/net/ethernet/marvell/mvmdio.c +++ b/drivers/net/ethernet/marvell/mvmdio.c @@ -29,6 +29,7 @@ #include #include +#define MVMDIO_SMI_REG 0x0004 #define MVMDIO_SMI_DATA_SHIFT 0 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 #define MVMDIO_SMI_PHY_REG_SHIFT 21 @@ -52,7 +53,7 @@ static int orion_mdio_wait_ready(struct mii_bus *bus) count = 0; while (1) { - val = readl(dev->regs); + val = readl(dev->regs + MVMDIO_SMI_REG); if (!(val & MVMDIO_SMI_BUSY)) break; @@ -87,12 +88,12 @@ static int orion_mdio_read(struct mii_bus *bus, int mii_id, writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) | (regnum << MVMDIO_SMI_PHY_REG_SHIFT) | MVMDIO_SMI_READ_OPERATION), - dev->regs); + dev->regs + MVMDIO_SMI_REG); /* Wait for the value to become available */ count = 0; while (1) { - val = readl(dev->regs); + val = readl(dev->regs + MVMDIO_SMI_REG); if (val & MVMDIO_SMI_READ_VALID) break; @@ -129,7 +130,7 @@ static int orion_mdio_write(struct mii_bus *bus, int mii_id, (regnum << MVMDIO_SMI_PHY_REG_SHIFT) | MVMDIO_SMI_WRITE_OPERATION | (value << MVMDIO_SMI_DATA_SHIFT)), - dev->regs); + dev->regs + MVMDIO_SMI_REG); mutex_unlock(&dev->lock);