From patchwork Sat Jan 31 14:28:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 44081 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 696962188C for ; Sat, 31 Jan 2015 14:29:47 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id h11sf7602320wiw.1 for ; Sat, 31 Jan 2015 06:29:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=1PbvxDN5oWdKyxoQerGpQpkGEb0sFwxwEjCrrYluNp8=; b=ewnj3h/gpJ6PKyiDXw3qXYxWLhoBL8vVLmrmnE66Wt4q9bIjEkW+oSEW/SCZuhWwPn xagexacuQeUn+m2X7q+fTDLNVRlD2oFbw+by2ysghcpjRXGOG2mZ5ZPyfHM01RY9/jWB cnWeEpn229CAKEmj8fV1Lezji4P5F/4ozl8ZgzkZEIOB0uDUfstsp7IJtwR266ssyP/b I5UZx8/SGPgHQ2qkpqXmJZm1/j8PA91HqRvymFxw9OY+6XuiuKxo/rMLBzCE3ArovH12 JU+99Sbs7yN4AoUMLUgRF/xsd3T6RbFLco2bcdKpTEoNX1d5yAVDu6Cychz3i2CWIYth RFkg== X-Gm-Message-State: ALoCoQk6lHG+r5D03S/4C3ugsu7vGoUVj4qE/JVlpTifhAkyMxmGEIcXxgqFf54FSY91ConiLV+d X-Received: by 10.152.5.98 with SMTP id r2mr1409352lar.6.1422714586624; Sat, 31 Jan 2015 06:29:46 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.193 with SMTP id v1ls65769lag.102.gmail; Sat, 31 Jan 2015 06:29:46 -0800 (PST) X-Received: by 10.152.37.106 with SMTP id x10mr11484694laj.52.1422714586436; Sat, 31 Jan 2015 06:29:46 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id pf5si782888lbc.94.2015.01.31.06.29.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 31 Jan 2015 06:29:46 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id pv20so29020027lab.7 for ; Sat, 31 Jan 2015 06:29:46 -0800 (PST) X-Received: by 10.112.63.134 with SMTP id g6mr7394707lbs.52.1422714586295; Sat, 31 Jan 2015 06:29:46 -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.35.133 with SMTP id h5csp304519lbj; Sat, 31 Jan 2015 06:29:45 -0800 (PST) X-Received: by 10.68.106.226 with SMTP id gx2mr6753459pbb.78.1422714584476; Sat, 31 Jan 2015 06:29:44 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mj8si5835097pdb.96.2015.01.31.06.29.43; Sat, 31 Jan 2015 06:29:44 -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 S1755192AbbAaO3k (ORCPT + 29 others); Sat, 31 Jan 2015 09:29:40 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:60438 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753328AbbAaO22 (ORCPT ); Sat, 31 Jan 2015 09:28:28 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t0VESRMt003083; Sat, 31 Jan 2015 08:28:27 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t0VESQ0O023001; Sat, 31 Jan 2015 08:28:26 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Sat, 31 Jan 2015 08:28:26 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t0VESGgI017089; Sat, 31 Jan 2015 08:28:25 -0600 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 5/9] phy: phy-stih407-usb: Pass sysconfig register offsets via syscfg property. Date: Sat, 31 Jan 2015 19:58:12 +0530 Message-ID: <1422714496-423-6-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1422714496-423-1-git-send-email-kishon@ti.com> References: <1422714496-423-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 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: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 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: , From: Peter Griffin 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 Reviewed-by: Arnd Bergmann Signed-off-by: Maxime Coquelin Signed-off-by: Kishon Vijay Abraham I --- .../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 74f0fab..1d5ae5f 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); if (IS_ERR(phy)) {