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=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 EC525C47257 for ; Thu, 7 May 2020 19:54:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0D5821582 for ; Thu, 7 May 2020 19:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726326AbgEGTyM (ORCPT ); Thu, 7 May 2020 15:54:12 -0400 Received: from foss.arm.com ([217.140.110.172]:38360 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbgEGTyM (ORCPT ); Thu, 7 May 2020 15:54:12 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0E7961FB; Thu, 7 May 2020 12:54:11 -0700 (PDT) Received: from [192.168.122.166] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D60F83F68F; Thu, 7 May 2020 12:54:09 -0700 (PDT) Subject: Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id() To: Andy Shevchenko Cc: Calvin Johnson , "Rafael J . Wysocki" , Russell King - ARM Linux admin , linux.cj@gmail.com, Andrew Lunn , Florian Fainelli , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Greg Kroah-Hartman , Heikki Krogerus , Varun Sethi , "Rajesh V . Bikkina" , ACPI Devel Maling List , Linux Kernel Mailing List , Diana Madalina Craciun , netdev , Marcin Wojtas , Laurentiu Tudor , Makarand Pawagi , linux-arm Mailing List , Pankaj Bansal , "David S. Miller" , Heiner Kallweit References: <20200505132905.10276-1-calvin.johnson@oss.nxp.com> <20200505132905.10276-5-calvin.johnson@oss.nxp.com> <67e263cf-5cd7-98d1-56ff-ebd9ac2265b6@arm.com> From: Jeremy Linton Message-ID: <83ab4ca4-9c34-4cdd-4413-3b4cdf96727d@arm.com> Date: Thu, 7 May 2020 14:54:09 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Hi, On 5/7/20 12:27 PM, Andy Shevchenko wrote: > On Thu, May 7, 2020 at 4:26 PM Jeremy Linton wrote: >> On 5/5/20 8:29 AM, Calvin Johnson wrote: > >>> + if (sscanf(cp, "ethernet-phy-id%4x.%4x", >>> + &upper, &lower) == 2) { >>> + *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF); >>> + return 0; >>> + } > >> Isn't the ACPI _CID() conceptually similar to the DT compatible >> property? > > Where? Not, sure I understand exactly what your asking. AFAIK, in general the dt property is used to select a device driver/etc based on a more to less compatible set of substrings. The phy case is a bit different because it codes a numerical part number into the string rather than just using arbitrary strings to select a driver and device. But it uses that as a vendor selector for binding to the correct driver/device. Rephrasing the ACPI spec, the _CID() is either a single compatible id, or a list of ids in order of preference. Each id is either a HID (string or EISA type id) or a bus specific string encoding vendor/device/etc. (https://elixir.bootlin.com/linux/v5.7-rc4/source/drivers/acpi/acpica/utids.c#L186). One of the examples is "PCI\VEN_vvvv&DEV_dddd" So that latter case seems to be almost exactly what we have here. > >> It even appears to be getting used in a similar way to >> identify particular phy drivers in this case. > > _CID() is a string. It can't be used as pure number. > It does have a numeric version defined for EISA types. OTOH I suspect that your right. If there were a "PHY\VEN_IDvvvv&ID_DDDD" definition, it may not be ideal to parse it. Instead the normal ACPI model of exactly matching the complete string in the phy driver might be more appropriate. Similarly to how I suspect the next patch's use of "compatible" isn't ideal either, because whether a device is c45 or not, should tend to be fixed to a particular vendor/device implementation and not a firmware provided property. 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 D83B8C38A2A for ; Thu, 7 May 2020 19:54:19 +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 A097B208E4 for ; Thu, 7 May 2020 19:54:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GiiQNLpI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A097B208E4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com 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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ATom3+NtAr4Xx9Bj4KwipfskYLLlJQS5HVntoKyTN44=; b=GiiQNLpIbtCuYHmRXMVCdvxc6 Q+/HJpU6ECXuz48Minr7qtz5E8KdI68lMafNI0mqBUEfEnB9xrF96reRGOtUZO5KrDoXuAiOo+H+z P8rd9wwdIQAi4HG1k2mdGtSVmr/qzhT88WsYFC3VK49ZlQwksTfF9ON7SH1UsGUjPokEE35w7nsi1 hIuRGFJKy25V8NsctG58/fB0SuIMdVW7yNphnJDcPQ9fTNFaFf0s8GoISnN488eM/88nA3lc7qhLA URw/93s9C7nLjitxWcUegpXpQXJH4Mr2UEjIvxcXnyuJgilRzfZ9ZQ/p3zhXUh/5MrSj+TcSBKuk5 eF5jAvPAA==; 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 1jWmb4-000733-6D; Thu, 07 May 2020 19:54:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWmb0-00071p-Da for linux-arm-kernel@lists.infradead.org; Thu, 07 May 2020 19:54:16 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0E7961FB; Thu, 7 May 2020 12:54:11 -0700 (PDT) Received: from [192.168.122.166] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D60F83F68F; Thu, 7 May 2020 12:54:09 -0700 (PDT) Subject: Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id() To: Andy Shevchenko References: <20200505132905.10276-1-calvin.johnson@oss.nxp.com> <20200505132905.10276-5-calvin.johnson@oss.nxp.com> <67e263cf-5cd7-98d1-56ff-ebd9ac2265b6@arm.com> From: Jeremy Linton Message-ID: <83ab4ca4-9c34-4cdd-4413-3b4cdf96727d@arm.com> Date: Thu, 7 May 2020 14:54:09 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200507_125414_543134_DF6C0BD8 X-CRM114-Status: GOOD ( 21.61 ) 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 , Heikki Krogerus , "Rafael J . Wysocki" , Cristi Sovaiala , Ioana Ciornei , Florian Fainelli , "Rajesh V . Bikkina" , Pankaj Bansal , Russell King - ARM Linux admin , Diana Madalina Craciun , ACPI Devel Maling List , Florin Laurentiu Chiculita , Madalin Bucur , Makarand Pawagi , Varun Sethi , Marcin Wojtas , linux-arm Mailing List , Laurentiu Tudor , Greg Kroah-Hartman , Linux Kernel Mailing List , Calvin Johnson , linux.cj@gmail.com, netdev , "David S. Miller" , Heiner Kallweit Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On 5/7/20 12:27 PM, Andy Shevchenko wrote: > On Thu, May 7, 2020 at 4:26 PM Jeremy Linton wrote: >> On 5/5/20 8:29 AM, Calvin Johnson wrote: > >>> + if (sscanf(cp, "ethernet-phy-id%4x.%4x", >>> + &upper, &lower) == 2) { >>> + *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF); >>> + return 0; >>> + } > >> Isn't the ACPI _CID() conceptually similar to the DT compatible >> property? > > Where? Not, sure I understand exactly what your asking. AFAIK, in general the dt property is used to select a device driver/etc based on a more to less compatible set of substrings. The phy case is a bit different because it codes a numerical part number into the string rather than just using arbitrary strings to select a driver and device. But it uses that as a vendor selector for binding to the correct driver/device. Rephrasing the ACPI spec, the _CID() is either a single compatible id, or a list of ids in order of preference. Each id is either a HID (string or EISA type id) or a bus specific string encoding vendor/device/etc. (https://elixir.bootlin.com/linux/v5.7-rc4/source/drivers/acpi/acpica/utids.c#L186). One of the examples is "PCI\VEN_vvvv&DEV_dddd" So that latter case seems to be almost exactly what we have here. > >> It even appears to be getting used in a similar way to >> identify particular phy drivers in this case. > > _CID() is a string. It can't be used as pure number. > It does have a numeric version defined for EISA types. OTOH I suspect that your right. If there were a "PHY\VEN_IDvvvv&ID_DDDD" definition, it may not be ideal to parse it. Instead the normal ACPI model of exactly matching the complete string in the phy driver might be more appropriate. Similarly to how I suspect the next patch's use of "compatible" isn't ideal either, because whether a device is c45 or not, should tend to be fixed to a particular vendor/device implementation and not a firmware provided property. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel