Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1021689ybj; Thu, 7 May 2020 12:55:58 -0700 (PDT) X-Google-Smtp-Source: APiQypIJ0PPx3lkXSTagGq3vXVpulNHjQpR0e/C5PipEgmSo9XdyMPFvSVxfIJ/sqmOBFXB/6E05 X-Received: by 2002:a05:6402:3125:: with SMTP id dd5mr14216005edb.208.1588881358307; Thu, 07 May 2020 12:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588881358; cv=none; d=google.com; s=arc-20160816; b=VRY6DApGgIBQ1BbueCjyj3U9XuhO7YlHQh2cWQ3D1dPqDbN3EknrqpiOi9orBxZt5e XSRoIfFd0/bUY3ydglmMnEGm5+1SYUzTSEDBuIML23XONwr+za03wnW4OE6/cfkroy1U KUdghmg3q0HisNHCekpbgy9f98Gl65FgFZqQf5BM+OKx7JiNxO4tedFfx64gxiq1nUzl ZORKenf1u2MjFhsJw4BtnD1lEjXgZFz3LdfFgAS1eQ9lGtnONfrqpKj4Zq7txSSi6xqG VeVkBSBzT1oz3o8xxQWQVsFt+R6fDsBkLQJ7fTTIsdsGKRmai/cB256mEOrifnVnmQr4 MHmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Wk6uMZCJg8OLCjejs/gaRye/aq4W+Q61K8eNHmspbo4=; b=NB1wGtN5WXkUqz/QGrYCqaDfNEuVmGSvPg1g3zRRRJ7QjcX+jPWv6LFb4Ftw0qF2uW cVImWBrNUgjz7hCFdFlL4UjiBLBMbGIohZvVwOG/3W513Ts1zzJCFQb01hZiPKte/5fs gWbmzc7gosPJT1Fzavx4paf75gKGF4W/IsxJNWf08FbSxVtTUj5mQ/GDdPsAtS0Zsthm wEOpon5Jj2wHLykw7f3b8kboCMtpcG3NR6LhpGaATrKJ7I355Z0o6d7zA8Ie7s1tE9jX RyS1yiWUC5YF/490wY+p92AoQbhv+rNSKKTz0jVqHDscAWKmycrl+fAYkutPdyHGqX51 MCnw== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk23si3591653edb.282.2020.05.07.12.55.34; Thu, 07 May 2020 12:55:58 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727837AbgEGTyM (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.