Received: by 10.223.176.46 with SMTP id f43csp1694974wra; Sun, 21 Jan 2018 02:27:55 -0800 (PST) X-Google-Smtp-Source: AH8x2260pFPqroyUjoaUa1jPaT7qbcl1opPGQ8WEU6YhiKX657npYeEtSnGfFb0aajeSprrzBWit X-Received: by 10.101.68.138 with SMTP id l10mr4306576pgq.150.1516530475710; Sun, 21 Jan 2018 02:27:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516530475; cv=none; d=google.com; s=arc-20160816; b=p4oSFexXfENbQhF3rSFgIKQaY+h+fNBJiRQw3JK8zJIZ8SRnUn2Gmv+Ureyx42WK9W 9WQe4ZjCIRQrAQCpxY6gagwwwtuS3jCZJ5FDtL5K7fdTWbAE1Glt7nmlj5I4/ojAAS8i /1zf5jOjgVDr+RHFhae4w53PSrK+gXbHn7+7d8iC6SSDozgf0kZxV2eUSisz6hWL8drv 50PlGDHkR7KEusxnw9P95mkRAvF79XsB3T79fNR5afPRckGHbgV8bO+XR0ksPKHVhWkN c6+2MBu0lYa7TQ/CdD1nXZ676WP05hMxkgWU7hyq6O0+8dSSuCkYXQclq8orpwxsufFA 6GBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=fhl2XzVPGNUZg2UhSNDx4b74TmAA5Z2Mm32fx8kviq4=; b=bxodBvo7AjYiqldrM3Lb3pTiggPmT4lMjY+GekJ0+pCmWTC93cxV42Rk/ky32EGhAE Q/DM/VsZUf51GyqpEWRIldZRK4TBp09uVVGOc7ocl3/zqdcj1lICBl63qIiXmxgvSkbb iKdsuYImgPWpDO1Pi1ClTnoujbp+gLgd7g2Q1fTkR+inuUK8s03Pd3fxz4X9l/Eo53T4 jICg2/U9XK3Lu+6wx95ST336vg9Ob8fw1j+2P/8g3xdKv2V2M4TlbayyXJ0bifKjf0n1 TYjXXJ132Hs4RUXlyu4iWa5pxdyQ64TBY+tyJvQX44LQHQnHB1s136ptJVsXGvAdZcE6 Hwlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z28si12079459pgc.566.2018.01.21.02.27.41; Sun, 21 Jan 2018 02:27:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751156AbeAUK1L (ORCPT + 99 others); Sun, 21 Jan 2018 05:27:11 -0500 Received: from mga07.intel.com ([134.134.136.100]:19352 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107AbeAUK1I (ORCPT ); Sun, 21 Jan 2018 05:27:08 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2018 02:27:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,390,1511856000"; d="scan'208";a="11860349" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by fmsmga007.fm.intel.com with SMTP; 21 Jan 2018 02:27:01 -0800 Received: by lahna (sSMTP sendmail emulation); Sun, 21 Jan 2018 12:27:00 +0200 Date: Sun, 21 Jan 2018 12:27:00 +0200 From: Mika Westerberg To: Andrew Lunn Cc: Marcin Wojtas , Lorenzo Pieralisi , Graeme Gregory , Ard Biesheuvel , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "" , "David S. Miller" , Russell King - ARM Linux , "Rafael J. Wysocki" , Florian Fainelli , Antoine T?nart , Thomas Petazzoni , Gregory CLEMENT , Ezequiel Garcia , Nadav Haklai , Neta Zur Hershkovits , Grzegorz Jaszczyk , Tomasz Nowicki , Hanjun Guo , Sudeep Holla Subject: Re: [net-next: PATCH 0/8] Armada 7k/8k PP2 ACPI support Message-ID: <20180121102700.GF27654@lahna.fi.intel.com> References: <20180108154243.GA30962@lunn.ch> <20180109101941.GD31502@xora-haswell> <20180109130012.GA27447@lunn.ch> <20180118123141.GA2839@e107981-ln.cambridge.arm.com> <20180118130026.GG32299@lunn.ch> <20180120195246.GC27654@lahna.fi.intel.com> <20180121010840.GB1217@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180121010840.GB1217@lunn.ch> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 21, 2018 at 02:08:40AM +0100, Andrew Lunn wrote: > > I'm not familiar with MDIO bus but an alternative to GeneriSerialBus > > would be to follow what SDIO is doing, e.g have the PHY devices listed > > below the MDIO controller and use _ADR to describe their "address" on > > that bus. You can see how _ADR applies to SDIO bus from ACPI spec. > > Hi Mika > > SDIO is not a serial bus, well it can be in its simplest form, but > high speed implementations have 4 data lines. So i can understand them > not using GenericSerialBus. Well, I think SDIO is more of a serial bus pretty much the same way than SPI but it can support more data lines as needed (in the same way than SPI). But I'm not an expert in SDIO. However, that's not the point here :-) SATA (which is definitely a serial bus) uses the same mechanism and not GenericSerialBus. > MDIO is a serial bus, very similar to SPI, I2C, and UART. > > > If you go with the SDIO way then each PHY is described as normal ACPI > > device and you can use ACPI _HID/_CID to match the device to the > > corresponding driver. > > Just some background here. If you have a plain PHY as a device on an > MDIO bus, you don't need to match it to a driver within ACPI. > Registers 2 and 3 contain a vendor and product ID. That is what it > used to match the device to the driver. > > What you might need to know is the protocol to talk on the bus. Most > devices use clause 22 protocol. A few devices are clause 45. 22 is the > default in Linux, and you need to indicate if 45 should be used. You > can also indicate 22. > > It gets more complex when the device on the bus is not a PHY. It is a > generic bus, you can connect anything to it. Ethernet switches can be > on the bus. They generally cannot be identified using registers 2 and > 3. So you do need to match the device to the driver. Most do have ID > registers, so the driver can work out what specific device is on the > bus. However, Marvell moved the ID registers on there newer generation > of devices, so we need to give the driver a hint where to look. So in > device tree, we have two different compatible string. > > Broadcom really do use it as a generic bus. They have their USB PHYs > and PCIE PHYs on an MDIO bus. In DT, they have compatible strings to > match the device to the driver, as normal. OK, thanks for the explanation. > We need to ensure what we define for ACPI has the same level of > flexibility. Right. So if you need to have some additional "parameters" with the connection, then I suppose you may want to go with the GenericSerialBus route. However, looking at the sample device tree description: davinci_mdio: ethernet@5c030000 { compatible = "ti,davinci_mdio"; reg = <0x5c030000 0x1000>; #address-cells = <1>; #size-cells = <0>; reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; reset-delay-us = <2>; ethphy0: ethernet-phy@1 { reg = <1>; }; ethphy1: ethernet-phy@3 { reg = <3>; }; }; would pretty much translate directly to this in ACPI if you don't need any additional attributes: Device (ETH0) { Name (_ADR, /* PCI address of the NIC */) Device (PHY0) { Name (_ADR, 1) ... } Device (PHY1) { Name (_ADR, 3) ... } } which looks pretty simple to me. You can also use _DSM and _DSD here to pass information (like the protocol number) for the PHY devices to Linux.