From patchwork Thu Aug 23 21:24:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timur Tabi X-Patchwork-Id: 179725 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 80CFF2C00BE for ; Fri, 24 Aug 2012 07:24:26 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932542Ab2HWVYT (ORCPT ); Thu, 23 Aug 2012 17:24:19 -0400 Received: from ch1ehsobe005.messaging.microsoft.com ([216.32.181.185]:53177 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758315Ab2HWVYP (ORCPT ); Thu, 23 Aug 2012 17:24:15 -0400 Received: from mail55-ch1-R.bigfish.com (10.43.68.244) by CH1EHSOBE006.bigfish.com (10.43.70.56) with Microsoft SMTP Server id 14.1.225.23; Thu, 23 Aug 2012 21:24:11 +0000 Received: from mail55-ch1 (localhost [127.0.0.1]) by mail55-ch1-R.bigfish.com (Postfix) with ESMTP id 9DCB534007F; Thu, 23 Aug 2012 21:24:11 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: -1 X-BigFish: VS-1(zz1102Izz1202hzz8275bhz2dh2a8h668h839hd24he5bhf0ah107ah1155h) Received: from mail55-ch1 (localhost.localdomain [127.0.0.1]) by mail55-ch1 (MessageSwitch) id 1345757050106448_30927; Thu, 23 Aug 2012 21:24:10 +0000 (UTC) Received: from CH1EHSMHS004.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.230]) by mail55-ch1.bigfish.com (Postfix) with ESMTP id 0E17F60232; Thu, 23 Aug 2012 21:24:10 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS004.bigfish.com (10.43.70.4) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 23 Aug 2012 21:24:09 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.309.3; Thu, 23 Aug 2012 16:24:08 -0500 Received: from efes.am.freescale.net (efes.am.freescale.net [10.82.123.3]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id q7NLO7MS015429; Thu, 23 Aug 2012 14:24:07 -0700 From: Timur Tabi To: Andy Fleming , David Miller , Subject: [PATCH] net/fsl_pq_mdio: add support for the Fman 1G MDIO controller Date: Thu, 23 Aug 2012 16:24:07 -0500 Message-ID: <1345757047-14657-1-git-send-email-timur@freescale.com> X-Mailer: git-send-email 1.7.3.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The MDIO controller on the Frame Manager (Fman) is compatible with the QE and Gianfar MDIO controllers, but we don't care about the TBI because the Ethernet drivers (FMD) take care of programming it. Signed-off-by: Timur Tabi --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 36 ++++++++++++++++---------- 1 files changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index 9527b28..3af87cb 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -264,7 +264,7 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev) struct fsl_pq_mdio_priv *priv; struct fsl_pq_mdio __iomem *regs = NULL; void __iomem *map; - u32 __iomem *tbipa; + u32 __iomem *tbipa = NULL; struct mii_bus *new_bus; int tbiaddr = -1; const u32 *addrp; @@ -310,6 +310,7 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev) if (of_device_is_compatible(np, "fsl,gianfar-mdio") || of_device_is_compatible(np, "fsl,gianfar-tbi") || + of_device_is_compatible(np, "fsl,fman-mdio") || of_device_is_compatible(np, "fsl,ucc-mdio") || of_device_is_compatible(np, "ucc_geth_phy")) map -= offsetof(struct fsl_pq_mdio, miimcfg); @@ -350,27 +351,31 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev) mii_mng_master = id; ucc_set_qe_mux_mii_mng(id - 1); } + } else if (of_device_is_compatible(np, "fsl,fman-mdio")) { + /* No TBI operations needed for Fman, but don't fail either */ } else { err = -ENODEV; goto err_free_irqs; } - for_each_child_of_node(np, tbi) { - if (!strncmp(tbi->type, "tbi-phy", 8)) - break; - } + if (tbipa) { + for_each_child_of_node(np, tbi) { + if (!strncmp(tbi->type, "tbi-phy", 8)) + break; + } - if (tbi) { - const u32 *prop = of_get_property(tbi, "reg", NULL); + if (tbi) { + const u32 *prop = of_get_property(tbi, "reg", NULL); - if (prop) - tbiaddr = *prop; + if (prop) + tbiaddr = be32_to_cpup(prop); - if (tbiaddr == -1) { - err = -EBUSY; - goto err_free_irqs; - } else { - out_be32(tbipa, tbiaddr); + if (tbiaddr == -1) { + err = -EBUSY; + goto err_free_irqs; + } else { + out_be32(tbipa, tbiaddr); + } } } @@ -437,6 +442,9 @@ static struct of_device_id fsl_pq_mdio_match[] = { { .compatible = "fsl,etsec2-mdio", }, + { + .compatible = "fsl,fman-mdio", + }, {}, }; MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);