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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 85E5CC2D0EF for ; Sat, 18 Apr 2020 11:41:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 53E4E206A1 for ; Sat, 18 Apr 2020 11:41:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XVgSR+lh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="nAUQPpYP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53E4E206A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=a6y4h3VuhDu+XXGB1VGT7cCkjeBu0lk2cTSHSnNVcrE=; b=XVgSR+lhZIXtB1 mXIG1lhw4GgSYyuQoD0XvlHHjeKhkYDq81+NOm2za0xKS264VfwbDvVWZpu4h3MfrwWLKsMWDJJJv NLJz/KGeaV1D1Wwil3eqgb39z5ssf/N1n18BTKo70orclB/r2ZhWwOjoR/M6xRTsChqckO7e4z4fW 5YJ15ko2H0NxkHvuS+XwZhvVHOIF4JWDYvwEm0afeDifxxUesFkVR0Boz1OwVWfY2zPSAvhJj0aHB add4eZRG7Gzq3wsdU9BwODWIS5kr5ryeZKLlCSCZeX+CjkjAQwmPEhDtZqrjRSVdXN52hBZ3CGhcA Jpi94BvxRfRRTll5wbvQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPlqq-00035m-Lk; Sat, 18 Apr 2020 11:41:36 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPlqn-00034d-6S for linux-arm-kernel@lists.infradead.org; Sat, 18 Apr 2020 11:41:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=f0yHxPnJ4f0dB3+aObaskVJwqP9Vh3YSIkWQwfwhGfY=; b=nAUQPpYPImHaOkKUw8FoF83Mh UeQPgLagCtSswt3JODiv30UXzLVtA1mLDzsumB09CfWIGMItowEg8dGwHxoBsEdnbK0RkWTR6hqpu rkonsHEFM/EZIr++vc7Veu5fWAQgRt1jweHDBE87ZsEnH3GL3tafalW3AhXshpgjh8ETeuJWl9XfL Y4MOnqOB9FNkf7N2PtpYNnzYAdJb0kNNq8SJCbNhoV8iIeGIGz7V952OXpf1Q2cnZWhAVmROfh7dF A3pED/rVM7Tj6TD81pcG6maoNNvpa3DtlPnFjL9TPeWt2b8wjPYh6gZO58Zi1/AO6N7mONHdW4XeJ VHPxZTgeQ==; Received: from shell.armlinux.org.uk ([2002:4e20:1eda:1:5054:ff:fe00:4ec]:47572) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jPlqX-0007qT-PX; Sat, 18 Apr 2020 12:41:17 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jPlqW-0003qM-3f; Sat, 18 Apr 2020 12:41:16 +0100 Date: Sat, 18 Apr 2020 12:41:16 +0100 From: Russell King - ARM Linux admin To: Calvin Johnson Subject: Re: [RFC net-next PATCH v2 1/2] net/fsl: add ACPI support for mdio bus Message-ID: <20200418114116.GU25745@shell.armlinux.org.uk> References: <20200418105432.11233-1-calvin.johnson@oss.nxp.com> <20200418105432.11233-2-calvin.johnson@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200418105432.11233-2-calvin.johnson@oss.nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200418_044133_240734_0666FA88 X-CRM114-Status: GOOD ( 15.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Florian Fainelli , "Rajesh V . Bikkina" , Madalin Bucur , netdev@vger.kernel.org, Pankaj Bansal , linux-kernel@vger.kernel.org, Jeremy Linton , Marcin Wojtas , Diana Madalina Craciun , linux-acpi@vger.kernel.org, Andy Shevchenko , Cristi Sovaiala , Varun Sethi , linux.cj@gmail.com, Ioana Ciornei , Laurentiu Tudor , Makarand Pawagi , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Florin Laurentiu Chiculita Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Apr 18, 2020 at 04:24:31PM +0530, Calvin Johnson wrote: > @@ -241,18 +244,81 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) > return value; > } > > +/* Extract the clause 22 phy ID from the compatible string of the form > + * ethernet-phy-idAAAA.BBBB This comment is incorrect. What about clause 45 PHYs? > + */ > +static int xgmac_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id) > +{ > + const char *cp; > + unsigned int upper, lower; > + int ret; > + > + ret = fwnode_property_read_string(fwnode, "compatible", &cp); > + if (!ret) { > + if (sscanf(cp, "ethernet-phy-id%4x.%4x", > + &upper, &lower) == 2) { > + *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF); > + return 0; > + } > + } > + return -EINVAL; > +} > + > +static int xgmac_mdiobus_register_phy(struct mii_bus *bus, > + struct fwnode_handle *child, u32 addr) > +{ > + struct phy_device *phy; > + bool is_c45 = false; > + int rc; > + const char *cp; > + u32 phy_id; > + > + fwnode_property_read_string(child, "compatible", &cp); > + if (!strcmp(cp, "ethernet-phy-ieee802.3-c45")) > + is_c45 = true; > + > + if (!is_c45 && !xgmac_get_phy_id(child, &phy_id)) > + phy = phy_device_create(bus, addr, phy_id, 0, NULL); > + else > + phy = get_phy_device(bus, addr, is_c45); > + if (IS_ERR(phy)) > + return PTR_ERR(phy); > + > + phy->irq = bus->irq[addr]; > + > + /* Associate the fwnode with the device structure so it > + * can be looked up later. > + */ > + phy->mdio.dev.fwnode = child; > + > + /* All data is now stored in the phy struct, so register it */ > + rc = phy_device_register(phy); > + if (rc) { > + phy_device_free(phy); > + fwnode_handle_put(child); > + return rc; > + } > + > + dev_dbg(&bus->dev, "registered phy at address %i\n", addr); > + > + return 0; You seem to be duplicating the OF implementation in a private driver, converting it to fwnode. This is not how we develop the Linux kernel. We fix subsystem problems by fixing the subsystems, not by throwing what should be subsystem code into private drivers. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel