Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE40BC169C4 for ; Wed, 6 Feb 2019 06:20:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CECD217F9 for ; Wed, 6 Feb 2019 06:20:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="DMHW5Bb3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726889AbfBFGUt (ORCPT ); Wed, 6 Feb 2019 01:20:49 -0500 Received: from mail-eopbgr20083.outbound.protection.outlook.com ([40.107.2.83]:58880 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726194AbfBFGUt (ORCPT ); Wed, 6 Feb 2019 01:20:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E+il7e68AFCa9qKp6z9+AD9KVwyy4f9fujqRpvmARBI=; b=DMHW5Bb3cWZ+afWDZdn0QscfNAQ4tsNRDllt/3sGQqgPMi2M5vH+WdRZmb8WFBMuV5wyVWGlwdf1GlwuDer6PcpRYh+6NIiQaDEYCkgbB1PC2oQcRlz3Itr4MBi6HCeNgvUksitFxjaHJzS/wQdUV0YqUMuUU9fZdmgIUGlM0bs= Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com (10.168.65.10) by VI1PR0401MB2384.eurprd04.prod.outlook.com (10.169.134.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19; Wed, 6 Feb 2019 06:20:39 +0000 Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::208f:755e:b057:2cfe]) by VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::208f:755e:b057:2cfe%8]) with mapi id 15.20.1580.019; Wed, 6 Feb 2019 06:20:39 +0000 From: Pankaj Bansal To: Andrew Lunn , Florian Fainelli CC: "netdev@vger.kernel.org" , Pankaj Bansal Subject: [PATCH v4 1/2] dt-bindings: net: add MDIO bus multiplexer driven by a regmap device Thread-Topic: [PATCH v4 1/2] dt-bindings: net: add MDIO bus multiplexer driven by a regmap device Thread-Index: AQHUveQUZ/eZu42ZH0GN/VRPzRa1iA== Date: Wed, 6 Feb 2019 06:20:39 +0000 Message-ID: <20190206114523.8954-2-pankaj.bansal@nxp.com> References: <20190206114523.8954-1-pankaj.bansal@nxp.com> In-Reply-To: <20190206114523.8954-1-pankaj.bansal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR01CA0130.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:40::24) To VI1PR0401MB2496.eurprd04.prod.outlook.com (2603:10a6:800:56::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [92.120.1.69] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0401MB2384;6:jRNfFsXTxC/6nq4d8fjI0ga7v+qf473HMI2RGV7bWKzxWfMLdrHLzzPAZ2WQYlbJto7v2fyy59hE+T7m6CiYQhhP3GFyRyEpJyWmH9ew9biiXVvfXSgOE8ArkDTj+KaHzPRiAtDOuyPkqg7WKPvmgweKKSuYyhqVG7TUcs2yPz6IC6LsiHMTy1bLW23rpYWKrYNBul7rED9q47Tg6zTu7RHC7B8U/mSzjaqTjB/Ah5EedEJDyni/JUUq1hACw32swcu+t/oUFbjX4BABC2l2y7qT9wej8cVXHf+tl0VdviLRFIuGp+pN3KkZaPqbd6rrQZd71wz/YLbvrFAJmzP2d93xhHb0zII4J0xqo4kAusHN4UmQWO60Z2kHfy0B0d7ZyLQ7zmfY+vR1z6z4ioRE8kK5E8UrWMB8LIJ8vkW8asv2WUMtPfzerP7DojX9U/hHpbtYQ7ndIgUjhDnYYtXCFQ==;5:3iNiAVlLAJ3dw7ZUdhAf1n8DkHaaChaxByDLEBcKzAInhEm0dmGQu2tREM4m9ExsiXWRVM0mKkVj95zIeNpcwRYY2lh3MHAMrsGjtJudPIBIkt7hf2F1We5j6mfpnCt9HZ0pbOFUw8RUIlKqgECsqT/3KqQzVjwwXxru2kh1mmrQe0J1ZRqHYNY7p5MUJAZ++RW09H77OGyBhJ0GxwquJA==;7:RUJJsCe6iN+Z4Jfbp05blzaxXXq7YIxYs3WhfKeKkreWuoP6EteAtA+BoB1NqAZI/92y6WqGP30oTP7XFGuyPt5x6q63qpKg1tduS3VHdelVdeiSeUNXLJHYsz2cJZoaP1OF83qHDnlSZAH4PBI7Dw== x-ms-office365-filtering-correlation-id: 84f91fc6-a46c-47e7-0349-08d68bfb36c6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR0401MB2384; x-ms-traffictypediagnostic: VI1PR0401MB2384: x-microsoft-antispam-prvs: x-forefront-prvs: 0940A19703 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(366004)(376002)(396003)(346002)(136003)(199004)(189003)(25786009)(6506007)(386003)(76176011)(52116002)(102836004)(4326008)(5024004)(256004)(6116002)(3846002)(53936002)(6512007)(476003)(110136005)(486006)(54906003)(2616005)(71200400001)(71190400001)(6436002)(44832011)(186003)(446003)(1076003)(11346002)(6486002)(86362001)(316002)(99286004)(2906002)(97736004)(50226002)(8936002)(68736007)(105586002)(7736002)(81156014)(8676002)(26005)(305945005)(81166006)(106356001)(14454004)(478600001)(36756003)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2384;H:VI1PR0401MB2496.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: h0uOBgsy1IyjACyBbvQ6bjVP8SR8uBT/47Rr/oBPbkkQvdSaKyZ55LACiHaSe/OXx1ZYBXe+F1veiI5tsLG+tYW/N/grTz3JhzJvWVU+HvBdmj1vKHh6PzJhF4oEm1Q5fBM/9TTdeoApoljriz5WbCvhCNF9wNbv67SX6VRFl+UuBjdqoCABvrTHrz/K26Pwz7zbzsJ0FneMc+Mm32RNoa/dH5B/fT/Q7AKKB7ef/x1Nd82ZyPnOYibm50KR435BqZkdtfsX2Tu3TexYkwQSI5ChHEe1nwQKbDWB8+RlGKLjfg5jtHzaAA5xqxnvQ6BGtKSs9BXA0a03LQ8JvUmASVF26Yub6cPicv0c469ajOvhR/dzsDv6aIxoJ9cnXpaG90c4BA68GZd2aikoT4XOdoSNRg3M8IE6Ax4F8h0OPEs= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84f91fc6-a46c-47e7-0349-08d68bfb36c6 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2019 06:20:38.2154 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2384 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add support for an MDIO bus multiplexer controlled by a regmap device, like an FPGA. Tested on a NXP LX2160AQDS board which uses the "QIXIS" FPGA attached to the i2c bus. Signed-off-by: Pankaj Bansal --- Notes: V4: - No change V3: - No change V2: - New file describing the device tree bindings for regmap controlled de= vices' mdio mux .../bindings/net/mdio-mux-regmap.txt | 167 +++++++++++++++++ 1 file changed, 167 insertions(+) diff --git a/Documentation/devicetree/bindings/net/mdio-mux-regmap.txt b/Do= cumentation/devicetree/bindings/net/mdio-mux-regmap.txt new file mode 100644 index 000000000000..8968f317965f --- /dev/null +++ b/Documentation/devicetree/bindings/net/mdio-mux-regmap.txt @@ -0,0 +1,167 @@ +Properties for an MDIO bus multiplexer controlled by a regmap + +This is a special case of a MDIO bus multiplexer. A regmap device, +like an FPGA, is used to control which child bus is connected. The mdio-m= ux +node must be a child of the device that is controlled by a regmap. +The driver currently only supports devices with upto 32-bit registers. + +Required properties in addition to the generic multiplexer properties: + +- reg : integer, contains the offset of the register that controls the bus + multiplexer. it can be 32 bit number. + +- mux-mask : integer, contains an 32 bit mask that specifies which + bits in the register control the actual bus multiplexer. The + 'reg' property of each child mdio-mux node must be constrained by + this mask. + +Example 1: + +The FPGA node defines a i2c connected FPGA with a register space of 0x30 b= ytes. +For the "EMI2" MDIO bus, register 0x54 (BRDCFG4) controls the mux on that = bus. +A bitmask of 0x07 means that bits 0, 1 and 2 (bit 0 is lsb) are the bits o= n +BRDCFG4 that control the actual mux. + +i2c@2000000 { + compatible =3D "fsl,vf610-i2c"; + #address-cells =3D <1>; + #size-cells =3D <0>; + reg =3D <0x0 0x2000000 0x0 0x10000>; + interrupts =3D <0 34 0x4>; // Level high type + clock-names =3D "i2c"; + clocks =3D <&clockgen 4 7>; + fsl-scl-gpio =3D <&gpio2 15 0>; + status =3D "okay"; + + /* The FPGA node */ + fpga@66 { + compatible =3D "fsl,lx2160aqds-fpga", "fsl,fpga-qixis-i2c"; + reg =3D <0x66>; // fpga device address on i2c bus + #address-cells =3D <1>; + #size-cells =3D <0>; + + mdio-mux-2@54 { + mdio-parent-bus =3D <&emdio2>; /* MDIO bus */ + reg =3D <0x54>; /* BRDCFG4 */ + mux-mask =3D <0x07>; /* EMI2_MDIO */ + #address-cells=3D<1>; + #size-cells =3D <0>; + + mdio@0 { // Slot 1 + reg =3D <0x00>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + ethernet-phy@@1 { + reg =3D <1>; + compatible =3D "ethernet-phy-id0210.7441"; + }; + + ethernet-phy@@0 { + reg =3D <0>; + compatible =3D "ethernet-phy-id0210.7441"; + }; + }; + + mdio@1 { // Slot 2 + reg =3D <0x01>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + }; + + mdio@2 { // Slot 3 + reg =3D <0x02>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + }; + }; + }; +}; + +/* The parent MDIO bus. */ +emdio2: mdio@0x8B97000 { + compatible =3D "fsl,fman-memac-mdio"; + reg =3D <0x0 0x8B97000 0x0 0x1000>; + #address-cells =3D <1>; + #size-cells =3D <0>; + little-endian; +}; + +Example 2: + +The FPGA node defines a memory mapped FPGA with a register space of 0x100 = bytes. +For the "EMI1" MDIO bus, register 0x54 (BRDCFG4) controls the mux on that = bus. +A bitmask of 0xe0 means that bits 5, 6 and 7 (bit 0 is lsb) are the bits o= n +BRDCFG4 that control the actual mux. + +ifc: ifc@1530000 { + compatible =3D "fsl,ifc", "simple-bus"; + reg =3D <0x0 0x1530000 0x0 0x10000>; + interrupts =3D ; + #address-cells =3D <2>; + #size-cells =3D <1>; + /* NOR, NAND Flashes and FPGA on board */ + ranges =3D <0x0 0x0 0x0 0x60000000 0x08000000 + 0x2 0x0 0x0 0x7e800000 0x00010000 + 0x3 0x0 0x0 0x7fb00000 0x00000100>; + status =3D "okay"; + + /* The FPGA node */ + fpga: board-control@3,0 { + compatible =3D "fsl,ls1021aqds-fpga", "fsl,fpga-qixis"; + reg =3D <0x3 0x0 0x0000100>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + mdio-mux-1@54 { + mdio-parent-bus =3D <&emdio1>; /* MDIO bus */ + reg =3D <0x54>; /* BRDCFG4 */ + mux-mask =3D <0xe0>; /* EMI1_MDIO */ + #address-cells=3D<1>; + #size-cells =3D <0>; + + mdio@0 { // Onboard PHYs rgmii_phy1 + reg =3D <0x00>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + ethernet-phy@@1 { + reg =3D <1>; + compatible =3D "ethernet-phy-ieee802.3-c22"; + }; + }; + + mdio@20 { // Onboard PHYs rgmii_phy2 + reg =3D <0x20>; + #address-cells =3D <1>; + #size-cells =3D <0>; + ethernet-phy@2 { + reg =3D <0x2>; + compatible =3D "ethernet-phy-ieee802.3-c22"; + }; + }; + + mdio@40 { // Onboard PHYs rgmii_phy3 + reg =3D <0x40>; + #address-cells =3D <1>; + #size-cells =3D <0>; + ethernet-phy@3 { + reg =3D <0x3>; + compatible =3D "ethernet-phy-ieee802.3-c22"; + }; + }; + }; + }; +}; + +/* The parent MDIO bus. */ +emdio1: mdio@2d24000 { + compatible =3D "gianfar"; + device_type =3D "mdio"; + #address-cells =3D <1>; + #size-cells =3D <0>; + reg =3D <0x0 0x2d24000 0x0 0x4000>, + <0x0 0x2d10030 0x0 0x4>; +}; --=20 2.17.1