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,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 B4736C282C4 for ; Mon, 4 Feb 2019 08:59:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78C23214DA for ; Mon, 4 Feb 2019 08:59:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="wjif6/wX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728800AbfBDI7y (ORCPT ); Mon, 4 Feb 2019 03:59:54 -0500 Received: from mail-eopbgr140043.outbound.protection.outlook.com ([40.107.14.43]:37457 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726835AbfBDI7x (ORCPT ); Mon, 4 Feb 2019 03:59:53 -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=ITZPw8QHnl+UC9B9bF2zBr+4QsvZbBniW5zFtrTyPSk=; b=wjif6/wXr35XK2+YmA3fa+SLE3D+Z/byCUKoGjrjBuyHpuQKtEMA5Fd/pXATHtcwExZI4MYcBAD5CxNHYGYFnMTMK0udtSIJ9+A93fNwDyIRacWyA6KUsGpYev6DsGans2grtNYBEYq5gDsT2EP16fLGj5yi75kVRlgD0RhTIoo= Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com (10.168.65.10) by VI1PR0401MB2270.eurprd04.prod.outlook.com (10.169.133.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Mon, 4 Feb 2019 08:59:49 +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; Mon, 4 Feb 2019 08:59:49 +0000 From: Pankaj Bansal To: Andrew Lunn , Florian Fainelli CC: "netdev@vger.kernel.org" , Pankaj Bansal Subject: [PATCH v2 1/2] dt-bindings: net: add MDIO bus multiplexer driven by a regmap device Thread-Topic: [PATCH v2 1/2] dt-bindings: net: add MDIO bus multiplexer driven by a regmap device Thread-Index: AQHUvGf7KjAMhkQ0FEmMl5SGwQ00Iw== Date: Mon, 4 Feb 2019 08:59:48 +0000 Message-ID: <20190204142435.21175-2-pankaj.bansal@nxp.com> References: <20190204142435.21175-1-pankaj.bansal@nxp.com> In-Reply-To: <20190204142435.21175-1-pankaj.bansal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0015.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::25) To VI1PR0401MB2496.eurprd04.prod.outlook.com (2603:10a6:800:56::10) 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;VI1PR0401MB2270;6:gU+0FYSK4lMuaOQbm1U542jAnD8UHga8GYx4gAgXQuRfCJagg2S+EL7JZI0m5qb9sw4t6wCuDQ4M8FbpPY+uRv9XxUj6R8AO9nGPO6fY0k4uYdbr7LtXD3xkQUId3D6uGnIwhdJzv9iOkjdVrX+hrprXhc8pvaAyT4Kh6tZ44SUib01khLS9Bcn9egqR6HiQ8oLSVjY5y8dFjucmbs4lrW0wbwe4SeN3xauW4hCmdR0+V+lK7DaZj/yXCffmb0OV7BelB/PA6m7x5AL4Np/IUQOiM+Rp9Pi1kiWwkr5GqF3q8IExUF1ONSrAWA87tzEV+fnBYlj2YWriCBiUZA/mPGqnQxX/JerN0EesqJRUKqpGxyAL9gtW+16/zHtLGD17s12ubzhvDCOrRP9soPG3b4tIopryt6SDcYKfl/SC9l7SXqzKR1kfm8zlFNHd448T/tob9biwc6DZqxTmcmsBXw==;5:8m4tH76c7biVOeaJZ+H/rlzZSvVSvRui/11ALQF6Fer+0yzpQE9+kZqpPN55icBU/xfr2eQym9OAJo2V2HbSM/BBs0mPP/y/p6U3PIslyp+tWhn29LRRtVA8IyK0KVEMboAOU6wGTvZj1/kammSEbVkgkS/IkD+0+rRlpIQEqFiK2Wfli0CQkGXg4ONFDX92jrA7IE5Les2IlxTDHP6R6A==;7:syMcM6mA+IXn152lrElIIcxQ5yjGalpTTKgF/m+CcujflSVRTFeNpypT5Nt8OroMwlSJ1zb1TTLN0KkvPrYuOXeBazAqD17+v3173JUQMmGVmlGe/Wz6FlIASJUz6JwXkFogjCuAgGYKbtUpJm7QMw== x-ms-office365-filtering-correlation-id: 2ffab67b-9cd0-453f-8b63-08d68a7f1dee x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600110)(711020)(4605077)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:VI1PR0401MB2270; x-ms-traffictypediagnostic: VI1PR0401MB2270: authentication-results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@nxp.com; x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(136003)(396003)(366004)(346002)(189003)(199004)(5024004)(256004)(316002)(305945005)(81156014)(7736002)(6486002)(81166006)(54906003)(6506007)(86362001)(386003)(3846002)(6116002)(14454004)(97736004)(68736007)(36756003)(8676002)(50226002)(106356001)(2906002)(105586002)(25786009)(26005)(6436002)(76176011)(2616005)(446003)(44832011)(4326008)(476003)(71200400001)(52116002)(71190400001)(8936002)(486006)(186003)(6512007)(53936002)(102836004)(110136005)(1076003)(478600001)(66066001)(39060400002)(99286004)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2270;H:VI1PR0401MB2496.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A: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: xqwhCaU5iMB4+3h+u6GGSpsT7ecTo6S5b1GDivIgenhFHKneXR6z/prw3KyFi7sc7/sSg/LXjPmfVa5XA0WCEh8BWplBmNHK02aTK2MbfifX/KGFY3h3sSiLyMgQk6ulq5NNoi/H5/KpKs9kMr022JJWE9B/AN28sEMUG9L2xZIx6n7zOKetMCBwGaTuwN62Onv3nSe5KVd51Wgy8/bWrZg5Z6eeEjCGcrjATVWMznJeKPPkbRlcnQrRmA+6yhjYVL8oai+0L5Jjp4+elaCqnvck0HKo6NDYQlbnJ5Gn8v9K1m0aHdRZbkmvOLlj/vWoVpfO2K3ut31C1KjTeFI7HNJyyHZO6/rh1EFICDrBno7zL55irojQZHZlt0LinqRJ2iPxFm3F8wV/2ierpcjPyoAw0V6wqOVxLSCj00JjUSo= 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: 2ffab67b-9cd0-453f-8b63-08d68a7f1dee X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 08:59:47.7668 (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: VI1PR0401MB2270 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: 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