From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7F0EC433F5 for ; Mon, 28 Mar 2022 09:26:25 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8CEC583948; Mon, 28 Mar 2022 11:26:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="RegpzP9i"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EE98F83950; Mon, 28 Mar 2022 11:26:21 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::62b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 50DCB83894 for ; Mon, 28 Mar 2022 11:26:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=vladimir.oltean@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HMFUneRC1J0H4jvG+5isLlK71XcCRLZBrrfedAJryvhI21mlgqVwCkwjIJhGBPCxu+2A6WvOg72Q1gHst/wqntEcchUbqlfqO5pj/tDbt3N0AoP5P9qv6ywz7IMT41E/4FjvPmdPGVKGJPjh4f5wYwNTOmZNLHVDbcbqM3YrlA/5qX/2n5fx9Cd2arzQd+AUkTSDLyWawGkZZtu5g0bxwvj8AyuM/1Tcz0wabH8LXhlYQGwDdwA1jUv8wB17SorenXNfepe+X9Clwd6Of2OpMwDwJ5s8Rrx6o29OXYV05KMfuZrQugG6193FW4lOB6TrPm4WclGV3/umkQOg+EuRxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=19GAfB6D48xJeyFQY2jQel6L0eCh4ykZ3CVpQRZiED8=; b=L2I54tSeGUgKKu/WXQP8R3qrvU1i+HyxMokFhBc1Vw50TdjNAycOkp+eLBRqW+y2ZiQStpNPRtx9Hp80WCLEW7SoJsH8zVE8UbG4uA0AbUu3IxRMFL1Mmk6PdkaaG0xRZ/vIN/zcL+nJhDwfepdIUPOau/vOMVnr0LSMlF0N7uDShyN2kulA2xd5iV0LY2BFsKu34oMbMn9S3Pg2ZuXmMWf6/VKJ75KTQkD9Iv+2N1PWBmdEFMAFDd1SAEgU0+5fPIAwqDi+bRy5vMhlWOhibAdlrVB1FFKyR7WxkistrQo6kOHJwGut4X0AVDeuG65YaJexaRnHVDcvRFi1v/pX7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=19GAfB6D48xJeyFQY2jQel6L0eCh4ykZ3CVpQRZiED8=; b=RegpzP9i1DAfwdyhHlpv9OWjOLGlrjaR2ui0MbxZmgiEzd4/HtencXIyFRpbMG6d+jntJUI5OvajC3c9eXsG4ur4w8+IuaOpn+eyB1ebR+AQwqEihcjSPrJnusqOI1VWt4K8dqMTidM+CGso0SyKqWV4fmDb7NMzt4Ha1j8pg3U= Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by AM0PR04MB4788.eurprd04.prod.outlook.com (2603:10a6:208:cd::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.22; Mon, 28 Mar 2022 09:26:16 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::f090:8a7e:c1e1:3d8e]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::f090:8a7e:c1e1:3d8e%3]) with mapi id 15.20.5102.022; Mon, 28 Mar 2022 09:26:16 +0000 From: Vladimir Oltean To: "tharvey@gateworks.com" CC: u-boot , Joe Hershberger , Ramon Fried Subject: Re: [PATCH 1/2] net: dsa: fix phydev->speed being uninitialized for the CPU port fixed PHY Thread-Topic: [PATCH 1/2] net: dsa: fix phydev->speed being uninitialized for the CPU port fixed PHY Thread-Index: AQHX6WLGbgqP2emMnUmjsbRdEkVaQazQ/uQAgAAUnACAADFoAIAD9BCA Date: Mon, 28 Mar 2022 09:26:15 +0000 Message-ID: <20220328092615.f4wbsmbkbf6cmhak@skbuf> References: <20211204230035.4136596-1-vladimir.oltean@nxp.com> <20211204230035.4136596-2-vladimir.oltean@nxp.com> <20220325180706.w3faqca3xt5jakcj@skbuf> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 75cc7291-b6e1-4d75-41c1-08da109d024a x-ms-traffictypediagnostic: AM0PR04MB4788:EE_ x-ld-processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Xph8FGQ/hMGoTUgMYOcdVHOF6N/sui7wCOs0n32wotuI9lSN3m6B+2DKZ/FogbNkvMDSHm9Mp3/udfNtZVu67EiqYxswYvUN0xlr+7L+NxTQD/BL4WqIprDoYJqAvV69IddfFyVcw8RQLh25p1hydHC0sG7WhdU+c1fPG/H0Zu7uozvGzueN9IuHTtpV7GdzbRJKKhp2gb46bOsYdArHR4MrdBR9BIt04k0cssetelZ0yynyRJ3fbKkx8R3PeW9vUzIHeuMvZvaCYtbyySx+2jPkPD49Y3pVuUx2jJHNAoyQXy19PVAjS+JiZmigO8X8vM3yyQZ7NiHONZWAtna00Zfbd4TfwODJ3j6/p5xaXfLM0sgQnbJXCN4RN7Izc5+lGsqWHY7ShzRS0sAmRtzmTC/2LrAl4C7VCg0oI7iNXdbz9nJYk6VEUvUg2znTcl1QzPys0RByH6+TsuBqDsttuDa6h/sJobHVCQrztnVzpYDxNzc7FwisEXAmWvAt/RueFINoS4OwJt6T9j96wx+RolMGNaNWqczf6C/okhdDsP8D1d2xJNYpkyJqQNnwAU0POIShrpyPPCiCmVUof82Xs9nnYzxKuCf6g4zFUtJQIa4Q3CwR3nExhJ5fR2dkoSUUx6PKYajXbD6HYgNSKNejDNznu9d4Pg5AtK4GgU8Ma1qeVM8AR+vuvdxWdQE517kG/x+dnL6+aHnEBFuaP/j8bj8pUHhY3PPSF4QHDTmW4zk= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5136.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(7916004)(366004)(83380400001)(6506007)(6512007)(4326008)(9686003)(6916009)(8676002)(5660300002)(316002)(508600001)(64756008)(76116006)(66556008)(66446008)(66476007)(54906003)(91956017)(38100700002)(53546011)(66946007)(6486002)(33716001)(44832011)(71200400001)(122000001)(38070700005)(26005)(186003)(8936002)(86362001)(1076003)(2906002)(9944002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?GfsIwS5U6uJAgJ/xzXBykWPNRmAqsrFQIclsvXvJ4DGDCSR43ru0X+8clxXz?= =?us-ascii?Q?vv5tSE3DTKmK4o7dkspG8SJxu8x9XD8T5Lqzq2oAb9Pg1QXKpmhfQB+RvWC2?= =?us-ascii?Q?GT8VyZ4SO1FzTIMpDYb1KNkDDvTQRZtzvAX68WWwzBM+zwWOJmjGFNOtJ4g9?= =?us-ascii?Q?RVBoIDXqoM+ryrCV7o9cCpISHP7HjoJvr6C5LJ1GGY8RFtO1Tj46WFU+KoTK?= =?us-ascii?Q?uGDovrw06eK+CLS4tuMyjHi8aZxjmv1kDm4Q42xtTFwgGW/VrQSlKEQPF6sf?= =?us-ascii?Q?Fnn5b5e9uEKWesZgCEOFwkOuQm1ExLJDMhPy8pxdoCzP+hKT8L792aCAVnFZ?= =?us-ascii?Q?1pUjcv8JIuqhgEu20hCLKppgI05OSYS6VOWm+UPcAMDWRDwcVesEYlqpY6vC?= =?us-ascii?Q?R3mBY5R/qmvWhSQQQVVCmgGLl/3LbqqaynGcgUdhdT+FYh5naBY55EV4gDJB?= =?us-ascii?Q?huSMV3YKRuXTi6GZ74tFvp0pU5nrbvbb1tD0v4N1wA5S6bRxAOyOT6/3zuwt?= =?us-ascii?Q?qizMz+9lVD2OBV+8lkYezIU0vmmpWLgObkaoD6LrDYZA+oHhjb6G6GCw+IU9?= =?us-ascii?Q?TMLrOMKVqxwnBvCUw+j3jgjULG1SwV8jhDGTtsAUIqHU0nF8zLFJ8LI3lO0y?= =?us-ascii?Q?3hv8KL+yrX0HgmnjU36aENrIrDbOjthOGrNJIvRN73xjYDliBrAV19bYwa1H?= =?us-ascii?Q?g6eFb2aoJBU822X67DWlmdquTv5lA7viwXAqY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0HpUpCnka2RbN6OgO2Xju/yXng73OrZ7UfkcvtfdOsJWYu5pO4Mp5?= =?us-ascii?Q?d0umid+h4f94E3fH8wkcXVWY7lNrwQ0VXRG1nLRvCTPU7aAoMm5hYzcLV/+k?= =?us-ascii?Q?rBC90QFgKlc4WCCRTaI2VKVNszcMRaY=3D?= Content-Type: text/plain; charset="us-ascii" Content-ID: <3EC03794C1A53F47A07E46D4C57771F9@eurprd04.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75cc7291-b6e1-4d75-41c1-08da109d024a X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Mar 2022 09:26:15.9114 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: FAST0m4j10XTK8n8vShzLcpkxpm4ZrJyjpg5XEW4oxLm+Lu6the0Acq1FhUqeYWxfG7C/SC6x1oZsh64ZbeIOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4788 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Fri, Mar 25, 2022 at 02:03:56PM -0700, Tim Harvey wrote: > On Fri, Mar 25, 2022 at 11:07 AM Vladimir Oltean > wrote: > > > > Hi Tim, > > > > On Fri, Mar 25, 2022 at 09:53:20AM -0700, Tim Harvey wrote: > > > Vladimir, > > > > > > I came across this while looking for the best place to configure cpu > > > port interface mode (ie rgmii id) for the mv88e61xx dsa driver I'm > > > working on. Note that this patch causes port_probe to be called on th= e > > > cpu port 'before' the master device has been probed. I'm not sure if > > > this is intended or not? > > > > > > In my case I was looking to configure the cpu port interface mode whe= n > > > the port was probed but I can't do that because it happens before the > > > switch is probed because of some things that need to happen there. > > > Best Regards, > > > > > > Tim > > > > You're past the DM_MDIO probing issues now? Glad to hear that. > > Probing the DSA CPU port before the master wasn't necessarily the > > intention, but then again, I'm not sure that there's a strict ordering > > guarantee between the two that needs to be satisfied? > > > > What do you need exactly? We could probably always reverse the > > device_probe(master) call with the probing of the CPU port if the > > ordering turns out to be a real problem. I can regression-test the > > change on my boards, but I'd like to understand the need you have, mayb= e > > even document it so that future changes are aware of it. >=20 > Yes, I've got the mdio probing working now. The mv88e61xx driver > supports several chips that have different register offsets that need > to be known before indirect read/write and port read/write can be > used. That detection happens early on so I have it in the dsa_probe. I > would prefer to configure the cpu port interface mode (mac mode, link > speed/duplex etc) once instead of doing it every time the cpu port > gets enabled so I want to put that in the dsa_probe but at that time I > don't have the phy_device to determine interface mode (I suppose I > could get it from dt?). I noticed dsa_class calls ops->port_probe for > the cpu port early so that seemed like a great place to do all that, > but then I found my switch dsa_probe hadn't been called yet so I > haven't identified the switch and set the register offsets yet. >=20 > I have worked around the fact that the port_probe is called for the > cpu port before the switch is probed I just wasn't sure if something > in this patch should be changed in case others fall into this trap in > the future. dsa_port_probe probes the master before calling > ops->port_probe with the comment 'We depend on the master device for > proper operation' so I just figured the same should be done for the > pre_probe. Sorry, that was quite a blunder, we should definitely ensure that U_BOOT_DRIVER :: probe gets called before dsa_ops :: port_probe. I've made a change moving the port_probe call for the CPU port to dsa_post_probe(), tested it in the sandbox, and it appears to work. > I hope to send a series in the next few days but I do have a few items > I still need to fix: >=20 > 1. my board currently uses the mv88e61xx_hw_reset weak override to > configure LEDs, GPIO's using direct register writes as I need one of > the GPIO's to be configured as a 125MHz RGMII_RCLK and configure MAC > interface mode(rgmii delays). I've moved the mac interface config into > the driver based on the dt props (phy-mode and fixed-link subnode) but > am still not sure how to go about dealing with the 'very custom' LED > and GPIO config without the hassle of defining new dt bindings. I was > hoping to use board_phy_config() but when that is called for the > switch the phy_id is a generic PHY_FIXED_ID and when called for the > ports the phydev->bus uses indirect register writes which can't be > used to configure the gpios. How are these configs handled in Linux? > 2. While my switch mdio bus is probing now as well as my fec_dm_mdio > bus I'm not clear how to properly get the struct mii_dev * associated > with the fec_dm_mdio from the dsa switch. Currently I'm using > miiphy_get_dev_by_name("mdio") which is horrible. How do I get the > mii_bus or even the udevice of an dm_mdio bus associated with a dm_eth > device? Hmm, isn't the MDIO bus udevice the dev->parent of the switch? Assuming that the reason you need this is for MDIO input/output towards the switch. Although my suggestion would be to wrap this I/O behind dm_mdio_read(struct udevice *dev /* MDIO child device */) and dm_mdio_write(struct udevice *dev), rather than poking inside struct udevice from the mv88e61xx driver.=