From patchwork Thu Nov 8 07:21:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Dongsheng" X-Patchwork-Id: 10673623 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB7C01057 for ; Thu, 8 Nov 2018 07:23:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D35D12D950 for ; Thu, 8 Nov 2018 07:23:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C65342D968; Thu, 8 Nov 2018 07:23:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6DF42D967 for ; Thu, 8 Nov 2018 07:23:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726583AbeKHQ5J (ORCPT ); Thu, 8 Nov 2018 11:57:09 -0500 Received: from mx01.hxt-semitech.com ([223.203.96.7]:38372 "EHLO barracuda.hxt-semitech.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726454AbeKHQ5J (ORCPT ); Thu, 8 Nov 2018 11:57:09 -0500 X-ASG-Debug-ID: 1541661761-093b7e63fe003f0001-I98ny2 Received: from HXTBJIDCEMVIW02.hxtcorp.net ([10.128.0.15]) by barracuda.hxt-semitech.com with ESMTP id OQccmhfqXeVbJJxK (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Thu, 08 Nov 2018 15:22:41 +0800 (CST) X-Barracuda-Envelope-From: dongsheng.wang@hxt-semitech.com Received: from arch.hxtcorp.net (10.64.6.141) by HXTBJIDCEMVIW02.hxtcorp.net (10.128.0.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 8 Nov 2018 15:22:08 +0800 From: Wang Dongsheng To: , CC: Wang Dongsheng , , , , , Subject: [RFC PATCH 0/3] acpi: Add acpi mdio support code Date: Thu, 8 Nov 2018 15:21:29 +0800 X-ASG-Orig-Subj: [RFC PATCH 0/3] acpi: Add acpi mdio support code Message-ID: X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181029124044.GB9174@lunn.ch> References: <20181029124044.GB9174@lunn.ch> MIME-Version: 1.0 X-Originating-IP: [10.64.6.141] X-ClientProxiedBy: HXTBJIDCEMVIW01.hxtcorp.net (10.128.0.14) To HXTBJIDCEMVIW02.hxtcorp.net (10.128.0.15) X-Barracuda-Connect: UNKNOWN[10.128.0.15] X-Barracuda-Start-Time: 1541661761 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA384 X-Barracuda-URL: https://192.168.50.101:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at hxt-semitech.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: SPAM GLOBAL 0.9984 1.0000 4.3246 X-Barracuda-Spam-Score: 4.32 X-Barracuda-Spam-Status: No, SCORE=4.32 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.61411 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Originally I just push "phy-handle" support for ACPI on the QCOM QDF2400 platform. After some discussion and following Andrew's advice, I send out with a generic version of ACPI. Current there is no clear documentation about MDIO/PHY for ACPI, so when I reading some documents about ACPI [1], I think we just need to reuse the DT binding in the ACPI.[2]. However, this series of patches are not fully compatible with all contents specified in DT binding. The most important thing about this iseries is link the phy device and fwnode of acpi. Besides, we need to carry out bus scan at the mdio register. Therefore, I am not compatible with more DT binding properties in this series of patches. More support will be in the follow-up patches support, or some people do the support. Example: Based on ACPI doc: Documentation/acpi/dsd/data-node-references.txt Documentation/acpi/dsd/graph.txt With _DSD device properties we can finally do this: Device (MDIO) { Name (_DSD, Package () { ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), Package () { Package () { "ethernet-phy@0", PHY0 }, } }) Name (PHY0, Package() { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () { "reg", 0x0 }, } }) } Device (MACO) { Name (_DSD, Package () { ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () { "phy-handle", \_SB.MDIO, "ethernet-phy@0" }, } }) } Tested: QDF2400 (ACPI), buildin/insmod/rmmod [1]: Documentation/acpi/dsd/data-node-references.txt Documentation/acpi/dsd/graph.txt [2]: Documentation/devicetree/bindings/phy/phy-bindings.txt https://lore.kernel.org/patchwork/patch/597296/ Wang Dongsheng (3): acpi: Add acpi mdio support code net: qcom/emac: split phy_config to mdio bus create and get phy device net: qcom/emac: add phy-handle support for ACPI drivers/acpi/Kconfig | 6 + drivers/acpi/Makefile | 1 + drivers/acpi/acpi_mdio.c | 167 ++++++++++++++++++ drivers/net/ethernet/qualcomm/emac/emac-mac.c | 19 +- drivers/net/ethernet/qualcomm/emac/emac-phy.c | 142 ++++++++++----- drivers/net/phy/mdio_bus.c | 3 + include/linux/acpi_mdio.h | 82 +++++++++ 7 files changed, 369 insertions(+), 51 deletions(-) create mode 100644 drivers/acpi/acpi_mdio.c create mode 100644 include/linux/acpi_mdio.h