Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4905015pxb; Mon, 15 Feb 2021 04:35:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5gMCwQdNaAoWShV0pnBWEY0gJPZb5NXJ3mmmodKDdn0bW7xHmaBAD54pimGkf/APDHzHz X-Received: by 2002:a50:d307:: with SMTP id g7mr15401475edh.204.1613392518943; Mon, 15 Feb 2021 04:35:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1613392518; cv=pass; d=google.com; s=arc-20160816; b=dVi17NG9me3lWQvmACfKkOIVJwdKr8YpIwiwSQyZQ/EjeD9eV59u80KDPLEFkOSbAv UHk/mdin5S5x6tn553xl75+EZZMBCYkWjuUq+2zR3pDwO4ixz92kablKQ+YSN618TlMl 2s00OoEg4ly89VmQ9jQFckcb+AzOUw+AhNYCiQWvFQ/Vfja3wRZm/UGbq76IwiLZ7NQQ FZghpQsh8r8Gze+6fM43qlFHzVEjYXAVsJPUyS+A1iepLdueWuN7DIUER8cqt/R+O/9L vYUkq/PwxdHNwk7TEo//zIx3ib/iR/nbIcRmv35iPMNKRIMTpv5od5WTMNsTYTX2SSFb OBvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:in-reply-to :content-disposition:references:message-id:subject:cc:to:from:date :dkim-signature; bh=p26gYdlFWpDSUEZJiaReevvAvYAda7mxD2GRMVux/mY=; b=ez0fOoGqICc4UlU8b2FN/RQjnRYoiml1cfl/js5nOyyUxTgrG2dp7irWFyj7dkZgIm loUCBdaOTce5JnHj4nLKUPrC+UL8rjaLBzqG6PxDcieNB2V0K8Zw/3o9MpTjNgIIBE1+ +GyO5mU4OohAUiCiwQHRGFEIgtnoKnh+gAXcRqtDlD9ewNFS8Xlux5mVMcYf+WqNqJE+ 3Wni4nPXx2idDkUzsndhdrGgrcXiWpoDalW1zXaFz/GCOiMKU2ChP1bBryi6c+1tTK8M MfvqEM8XE+ruZWo0ZqqKNTiUcd/CRXV8DVvcN7lH/MVx0nkOzLvpmuxmxhzxAqV9+ixR 4atQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b="WOBi4o//"; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jv10si12129937ejc.625.2021.02.15.04.34.55; Mon, 15 Feb 2021 04:35:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b="WOBi4o//"; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230090AbhBOMe0 (ORCPT + 99 others); Mon, 15 Feb 2021 07:34:26 -0500 Received: from mail-am6eur05on2061.outbound.protection.outlook.com ([40.107.22.61]:46208 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229652AbhBOMeV (ORCPT ); Mon, 15 Feb 2021 07:34:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fJkr8el+tsK7+Kvkyfl3PCnwMdZCt6cJcXqkj8WdHKKVKpNJPr2ciWrg99Ag4alZz/8FCPP1BXtDv8T/lgtjTSd09IYj5TWnry0l6iObB/MCEVvsv8VYtyEjvRGDZRnZsFz4I7qn49cMAAX8t+4oOcV4JtMl16MukCev5+OjcfNezJzT2RBWfpMLT5LVPBkN1CLZOlruuyFLoQnrt7zba4y1FTSIyNFjXzBArvKEd5L7miu15SauYuYS/YQoxaysA7El/r6oO3QnzPzH5+Qpq/2NB+LhPgAeKk/dYYReFqHsTPddEte96vYfByoi3fAApyTVr7tGMB9RWaBzIWuSTA== 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-SenderADCheck; bh=p26gYdlFWpDSUEZJiaReevvAvYAda7mxD2GRMVux/mY=; b=KC8wEqdoIX0zw23jAk0uf7dqQPyQjyfdNWxo5FN3cnc9n0gh9Amym/S3Y9flJR3njHoYGkqrwIi1JIoxAIEziKBlg9eauSgVmax1XvcdnoVu5pZUrL2vQY/4DG5TLSSZr/5gU74Rok05cCUsoBGPduTnR3zR1lfnRVvv0Jsc79rESCrVxGXzCyyFk8Ep8vTua4d7hTfj6KoLj3D6hd8Sz/mNMfNSBUaMQkch2NYQf+wY4VRblT0OSr2E5uKop+pJpAwUb2XRJ9uHd7gxixZmKdlXdRiKnbdtCZ/hluApe6lcr+X/WY3ODseKx06i5Wa8rOp71IalYcv6MG7OXk67XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p26gYdlFWpDSUEZJiaReevvAvYAda7mxD2GRMVux/mY=; b=WOBi4o//M7dkvuk4NKgUjlME1rXoNntXj6LwInVaGBySvfqX5xvr5AY+UdC20krl9nrC/jDwQx1d+IqgeT+nvNnxH4UjChQFQ1tv0YmkItVmr2KJrSb4b8tIZFMB1wEdjsmucKM7ppoC5UD1ZxOQm49ZhHNnlw8jfo3iGegKYu0= Authentication-Results: armlinux.org.uk; dkim=none (message not signed) header.d=none;armlinux.org.uk; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB4594.eurprd04.prod.outlook.com (2603:10a6:208:74::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.39; Mon, 15 Feb 2021 12:33:31 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%6]) with mapi id 15.20.3846.042; Mon, 15 Feb 2021 12:33:31 +0000 Date: Mon, 15 Feb 2021 18:03:09 +0530 From: Calvin Johnson To: Russell King - ARM Linux admin Cc: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap , Laurentiu Tudor , linux-kernel@vger.kernel.org, linux.cj@gmail.com, Diana Madalina Craciun , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, "David S. Miller" , Ioana Radulescu , Jakub Kicinski Subject: Re: [net-next PATCH v5 15/15] net: dpaa2-mac: Add ACPI support for DPAA2 MAC driver Message-ID: <20210215123309.GA5067@lsv03152.swis.in-blr01.nxp.com> References: <20210208151244.16338-1-calvin.johnson@oss.nxp.com> <20210208151244.16338-16-calvin.johnson@oss.nxp.com> <20210208162831.GM1463@shell.armlinux.org.uk> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210208162831.GM1463@shell.armlinux.org.uk> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR04CA0167.apcprd04.prod.outlook.com (2603:1096:4::29) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by SG2PR04CA0167.apcprd04.prod.outlook.com (2603:1096:4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Mon, 15 Feb 2021 12:33:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8e0fd77b-5d39-4869-6bc6-08d8d1ade730 X-MS-TrafficTypeDiagnostic: AM0PR04MB4594: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZRPXBpva7wf89nx54nC6uCFcaXoztZhJNq27ujclfrXxrgBN4qLGkjbZNX4CNWK8SrAnVhQzqsAczLcAiOyOILLveEkTuc7pxh2YWa2RoTY3oiamb3zxp4QfputWByJ3RSMHXzwH/O6Ctgw4vCM3HHFZlCS4B8MLNA98529nVRH9FNLjJsVc60NlHRClmbMWIMoU6q5CnJGN87sz/dU8JMMw0kyu13uSRZHubg0tXrkYrwnTXdYANTkzWTf0HEpu9ICqVzEej6z+Qli5yfASsQt24VTYvShptYGVgQNXh7dmDU7Rbab/TGHks+6LxyBEbu7+u5dccUT7f8XXVkwyATQj6Ky0bg5W+vx06cbunD1V1OoC99YmGlFMI93KkLT3S6PUByP8dYnXqlNYRFc++fv+a6WXpBU2SzaqjqBpQaBmAfoIQCLRT1eINOE4plk4C3sHzk0T91hE3BZ/LKBjiVO6cMNvjupwTErppUJdYFPTEJ9YlaJ8DH+npyTbIvz+COQlTIO7M7azN0mhGpqwUamkyz3PaIx5BUVrAKrp3NurwLlRQmK33LWJ65TwJ0RV7wLAlbG8m5i6583+2ulo8w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB5636.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(8936002)(6506007)(7696005)(52116002)(55016002)(2906002)(8676002)(478600001)(956004)(6916009)(54906003)(44832011)(26005)(186003)(83380400001)(16526019)(4326008)(316002)(86362001)(5660300002)(1006002)(6666004)(66946007)(66476007)(7416002)(9686003)(66556008)(55236004)(33656002)(1076003)(110426009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?IEp49oU2V+uUbIYYHXucko43aHOVsXY/I8PDMUk8e00aZW4dCM0IxFmMurLN?= =?us-ascii?Q?W6Mq0W74klrFDhZ5ZqPzsGfqDhzSB9K3mnv1bc7efi5Jmq0uMIep469P3i9Z?= =?us-ascii?Q?p9jcr/k3rK/3Sbif601VZG1ubZzQhb8HVaDmpUNkY+tiR3PERwzLbTspwwWF?= =?us-ascii?Q?RR/D9Cqi/hbvot1Xeo8aJ4L9daEIrjnUrUzfbDF9pRk/XpoQuac5BIPmR6rk?= =?us-ascii?Q?O3acsYq9HfG9oxhyS0vEnwkvYNIZ7E/WbuvNQI1IE0aL9j/ZdPF9K64cF0YH?= =?us-ascii?Q?T4O5ziJNDc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=?us-ascii?Q?gxlAHjRr+oGCKq/sE2fkKf4G6FVMa73Ka6uQdGWjX5ZUzX2DyOR+4U2idGDK?= =?us-ascii?Q?b6ss7phgGvWch0mbaTNsp0HeCUR1RbjWjW0/QGJXhvsrnykidtaU0q5DyqL6?= =?us-ascii?Q?mwBAxT18RVenIpFV+q0altuP?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e0fd77b-5d39-4869-6bc6-08d8d1ade730 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2021 12:33:31.4770 (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: wdps6zMvu7ta+6OKFQFzIjYtemtHdlaAp+hFYjKOpMRfHICOySkiLcQQLokhVhB7F38HpIXSdq+PKBUD+gazfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4594 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 08, 2021 at 04:28:31PM +0000, Russell King - ARM Linux admin wrote: > On Mon, Feb 08, 2021 at 08:42:44PM +0530, Calvin Johnson wrote: > > Modify dpaa2_mac_connect() to support ACPI along with DT. > > Modify dpaa2_mac_get_node() to get the dpmac fwnode from either > > DT or ACPI. > > > > Replace of_get_phy_mode with fwnode_get_phy_mode to get > > phy-mode for a dpmac_node. > > > > Use helper function phylink_fwnode_phy_connect() to find phy_dev and > > connect to mac->phylink. > > > > Signed-off-by: Calvin Johnson > > I don't think this does the full job. > > > static int dpaa2_pcs_create(struct dpaa2_mac *mac, > > - struct device_node *dpmac_node, int id) > > + struct fwnode_handle *dpmac_node, > > + int id) > > { > > struct mdio_device *mdiodev; > > - struct device_node *node; > > + struct fwnode_handle *node; > > > > - node = of_parse_phandle(dpmac_node, "pcs-handle", 0); > > - if (!node) { > > + node = fwnode_find_reference(dpmac_node, "pcs-handle", 0); > > + if (IS_ERR(node)) { > > /* do not error out on old DTS files */ > > netdev_warn(mac->net_dev, "pcs-handle node not found\n"); > > return 0; > > } > > > > - if (!of_device_is_available(node)) { > > + if (!of_device_is_available(to_of_node(node))) { > > If "node" is an ACPI node, then to_of_node() returns NULL, and > of_device_is_available(NULL) is false. So, if we're using ACPI > and we enter this path, we will always hit the error below: > > > netdev_err(mac->net_dev, "pcs-handle node not available\n"); > > - of_node_put(node); > > + of_node_put(to_of_node(node)); > > return -ENODEV; > > } > > > @@ -306,7 +321,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) > > * error out if the interface mode requests them and there is no PHY > > * to act upon them > > */ > > - if (of_phy_is_fixed_link(dpmac_node) && > > + if (of_phy_is_fixed_link(to_of_node(dpmac_node)) && > > If "dpmac_node" is an ACPI node, to_of_node() will return NULL, and > of_phy_is_fixed_link() will oops. I think of_phy_is_fixed_link() needs to be fixed. I'll add below fix. --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -439,6 +439,9 @@ bool of_phy_is_fixed_link(struct device_node *np) int len, err; const char *managed; + if (!np) + return false; + /* New binding */ dn = of_get_child_by_name(np, "fixed-link"); if (dn) { Regards Calvin