From patchwork Wed Nov 19 08:27:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 41107 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0A61F24542 for ; Wed, 19 Nov 2014 08:27:43 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf360207wib.2 for ; Wed, 19 Nov 2014 00:27:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=R0Pfcm/zw0wFV9XpgscmQBjZOurY0oaHBsPfYExIvO0=; b=Bv+RkoIjIXxBddt2O+MfqbFwRk+sHuPSIk4X7Y+DyODU/NVKH4kwIJy4wQJ0Urwewp 2uI7Lcc1DrsfJ0561p8GEL2WbSsoSHXjvt2yhoGkxGptmpch1em62re46JwMYCFUxmeN L6j6uoUsLbBMhzxI5hAZL0CqrsvAR1DQ2SK4XMOic1FSPWqZTX31t1tfjcNIUbL1yhpG dTf1fJvYFTVc+nJ5ivfB5xiPIMH0GFJrAzUxZ3Ke4UtujzeFXehEM6jl0b8NpRCw7ha5 fuGYhohp/9079nYiLCe1OqKtpcJQe9C0wuLXB16IL29d/OJ+J8S+uwto0Hd4xL5sZo3Y 22EQ== X-Gm-Message-State: ALoCoQm7qIzU9t5EDhcLaeULocH+LcYcANxfQ9v+rAUkdZXLWQ+7ObxTXnSZiOiZz+yAO9gNcDaX X-Received: by 10.194.86.66 with SMTP id n2mr15966wjz.7.1416385662246; Wed, 19 Nov 2014 00:27:42 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.202.166 with SMTP id kj6ls1177065lac.73.gmail; Wed, 19 Nov 2014 00:27:41 -0800 (PST) X-Received: by 10.152.224.163 with SMTP id rd3mr40906737lac.24.1416385661968; Wed, 19 Nov 2014 00:27:41 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id le2si1040390lac.42.2014.11.19.00.27.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 00:27:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id z11so74874lbi.25 for ; Wed, 19 Nov 2014 00:27:41 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr3988892lbo.32.1416385661869; Wed, 19 Nov 2014 00:27:41 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp45675lbc; Wed, 19 Nov 2014 00:27:40 -0800 (PST) X-Received: by 10.69.3.65 with SMTP id bu1mr25768997pbd.24.1416385660237; Wed, 19 Nov 2014 00:27:40 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si1483797pdo.25.2014.11.19.00.27.39 for ; Wed, 19 Nov 2014 00:27:40 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755509AbaKSI1Y (ORCPT + 26 others); Wed, 19 Nov 2014 03:27:24 -0500 Received: from mail-wg0-f41.google.com ([74.125.82.41]:40660 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755130AbaKSI1V (ORCPT ); Wed, 19 Nov 2014 03:27:21 -0500 Received: by mail-wg0-f41.google.com with SMTP id y19so146608wgg.14 for ; Wed, 19 Nov 2014 00:27:20 -0800 (PST) X-Received: by 10.181.13.230 with SMTP id fb6mr3348451wid.72.1416385640046; Wed, 19 Nov 2014 00:27:20 -0800 (PST) Received: from localhost.localdomain (cpc14-aztw22-2-0-cust189.18-1.cable.virginm.net. [82.45.1.190]) by mx.google.com with ESMTPSA id mc10sm1164670wic.24.2014.11.19.00.27.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Nov 2014 00:27:19 -0800 (PST) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com, maxime.coquelin@st.com, patrice.chotard@st.com, peppe.cavallaro@st.com, kishon@ti.com, arnd@arndb.de Cc: peter.griffin@linaro.org, lee.jones@linaro.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, alexandre.torgue@st.com Subject: [PATCH 1/7] phy: phy-stih407-usb: Pass sysconfig register offsets via syscfg property. Date: Wed, 19 Nov 2014 08:27:06 +0000 Message-Id: <1416385632-5832-2-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416385632-5832-1-git-send-email-peter.griffin@linaro.org> References: <1416385632-5832-1-git-send-email-peter.griffin@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.griffin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Based on Arnds review comments here https://lkml.org/lkml/2014/11/13/161, update the phy driver to not use the reg property to access the sysconfig register offsets. This is because other phy's (miphy28, miphy365) have a combination of memory mapped registers and sysconfig control regs, and we shouldn't be mixing address spaces in the reg property. In addition we would ideally like the sysconfig offsets to be passed via DT in a uniform way. This new method will also allow us to support devices which have sysconfig registers in different banks more easily and it is also analagous to how keystone and bcm7745 platforms pass there syscon offsets in DT. This breaks DT compatibility, but this platform is considered WIP, and is only used by a few developers who are upstreaming support for it. Signed-off-by: Peter Griffin --- .../devicetree/bindings/phy/phy-stih407-usb.txt | 10 ++------- drivers/phy/phy-stih407-usb.c | 25 ++++++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/phy-stih407-usb.txt b/Documentation/devicetree/bindings/phy/phy-stih407-usb.txt index 1ef8228..de6a706 100644 --- a/Documentation/devicetree/bindings/phy/phy-stih407-usb.txt +++ b/Documentation/devicetree/bindings/phy/phy-stih407-usb.txt @@ -5,10 +5,7 @@ host controllers (when controlling usb2/1.1 devices) available on STiH407 SoC fa Required properties: - compatible : should be "st,stih407-usb2-phy" -- reg : contain the offset and length of the system configuration registers - used as glue logic to control & parameter phy -- reg-names : the names of the system configuration registers in "reg", should be "param" and "reg" -- st,syscfg : sysconfig register to manage phy parameter at driver level +- st,syscfg : phandle of sysconfig bank plus integer array containing phyparam and phyctrl register offsets - resets : list of phandle and reset specifier pairs. There should be two entries, one for the whole phy and one for the port - reset-names : list of reset signal names. Should be "global" and "port" @@ -19,11 +16,8 @@ Example: usb2_picophy0: usbpicophy@f8 { compatible = "st,stih407-usb2-phy"; - reg = <0xf8 0x04>, /* syscfg 5062 */ - <0xf4 0x04>; /* syscfg 5061 */ - reg-names = "param", "ctrl"; #phy-cells = <0>; - st,syscfg = <&syscfg_core>; + st,syscfg = <&syscfg_core 0x100 0xf4>; resets = <&softreset STIH407_PICOPHY_SOFTRESET>, <&picophyreset STIH407_PICOPHY0_RESET>; reset-names = "global", "port"; diff --git a/drivers/phy/phy-stih407-usb.c b/drivers/phy/phy-stih407-usb.c index 42428d4..24d5e2a 100644 --- a/drivers/phy/phy-stih407-usb.c +++ b/drivers/phy/phy-stih407-usb.c @@ -22,6 +22,9 @@ #include #include +#define PHYPARAM_REG 1 +#define PHYCTRL_REG 2 + /* Default PHY_SEL and REFCLKSEL configuration */ #define STIH407_USB_PICOPHY_CTRL_PORT_CONF 0x6 #define STIH407_USB_PICOPHY_CTRL_PORT_MASK 0x1f @@ -93,7 +96,7 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct phy_provider *phy_provider; struct phy *phy; - struct resource *res; + int ret; phy_dev = devm_kzalloc(dev, sizeof(*phy_dev), GFP_KERNEL); if (!phy_dev) @@ -123,19 +126,19 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev) return PTR_ERR(phy_dev->regmap); } - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); - if (!res) { - dev_err(dev, "No ctrl reg found\n"); - return -ENXIO; + ret = of_property_read_u32_index(np, "st,syscfg", PHYPARAM_REG, + &phy_dev->param); + if (ret) { + dev_err(dev, "can't get phyparam offset (%d)\n", ret); + return ret; } - phy_dev->ctrl = res->start; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "param"); - if (!res) { - dev_err(dev, "No param reg found\n"); - return -ENXIO; + ret = of_property_read_u32_index(np, "st,syscfg", PHYCTRL_REG, + &phy_dev->ctrl); + if (ret) { + dev_err(dev, "can't get phyctrl offset (%d)\n", ret); + return ret; } - phy_dev->param = res->start; phy = devm_phy_create(dev, NULL, &stih407_usb2_picophy_data, NULL); if (IS_ERR(phy)) {