From patchwork Mon Oct 7 10:12:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 20847 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6ACC024697 for ; Mon, 7 Oct 2013 10:12:44 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id a11sf14964615qen.6 for ; Mon, 07 Oct 2013 03:12:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=xqKsK5RMQbOwzQXOOyjvaWf4E76VYhwXshgx/VxVYWs=; b=PqdLfK9Xf5cXkVcG0CyZTgkS5s94tFYyfVm0xg0kwUMsq3LRj+FOTJP8SnWbRHOYYH XozRQ3CfJL2mr61YPKlH9Qh8rephxa9bvL5aABKiqzQVLfF9wTCg+a5YFwWr/seTJ0+h Yr+fCh6KR4zFdLnJ7LV7Om0fjgbSgqrBDIJqLodo8T+OEq+xOBk7bIGZm2Zglnvbk3VG AcNfvWq6jHfaccrRogkL4FG8Q9QuZyUCd54HwY83NCfsfvlmlCcEDh9X2MXEeew6XgiH C6kdao+NRz4itrytth8CUrWIfnGm1xcfQG+qLYF23iCNHDo2GxBsnDf/jpzcYOMLVXLR HRYg== X-Received: by 10.236.6.134 with SMTP id 6mr26374831yhn.7.1381140764299; Mon, 07 Oct 2013 03:12:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.83 with SMTP id s19ls2405576qeu.7.gmail; Mon, 07 Oct 2013 03:12:44 -0700 (PDT) X-Received: by 10.58.133.66 with SMTP id pa2mr3509166veb.18.1381140764197; Mon, 07 Oct 2013 03:12:44 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id vv9si7616826vec.43.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Oct 2013 03:12:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id db12so3752840veb.0 for ; Mon, 07 Oct 2013 03:12:44 -0700 (PDT) X-Gm-Message-State: ALoCoQnhgB4cL/XH0fseHWB4lmska777IEp7Cjoy27tIKsaOpWI16AkNqeBR+PpkEW9HY3pAmTLY X-Received: by 10.58.208.130 with SMTP id me2mr26025876vec.13.1381140764090; Mon, 07 Oct 2013 03:12:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp113276vcz; Mon, 7 Oct 2013 03:12:43 -0700 (PDT) X-Received: by 10.43.154.73 with SMTP id ld9mr598145icc.53.1381140763316; Mon, 07 Oct 2013 03:12:43 -0700 (PDT) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx.google.com with ESMTPS id n2si10701591igp.64.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Oct 2013 03:12:43 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.223.182 is neither permitted nor denied by best guess record for domain of matt.porter@linaro.org) client-ip=209.85.223.182; Received: by mail-ie0-f182.google.com with SMTP id aq17so15184957iec.41 for ; Mon, 07 Oct 2013 03:12:43 -0700 (PDT) X-Received: by 10.50.36.5 with SMTP id m5mr16329505igj.3.1381140762887; Mon, 07 Oct 2013 03:12:42 -0700 (PDT) Received: from beef.ohporter.com (cpe-98-27-254-98.neo.res.rr.com. [98.27.254.98]) by mx.google.com with ESMTPSA id y10sm22710942igl.4.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Oct 2013 03:12:42 -0700 (PDT) From: Matt Porter To: Felipe Balbi , Greg Kroah-Hartman , Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Christian Daudt Cc: Paul Zimmerman , Linux USB List , Linux ARM Kernel List , Linux Kernel Mailing List , Devicetree List , Linaro Patches Subject: [PATCH 2/5] usb: gadget: s3c-hsotg: support configurable UTMI PHY width Date: Mon, 7 Oct 2013 06:12:29 -0400 Message-Id: <1381140752-312-3-git-send-email-matt.porter@linaro.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1381140752-312-1-git-send-email-matt.porter@linaro.org> References: <1381140752-312-1-git-send-email-matt.porter@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: matt.porter@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Extend dwc2 binding with an optional utmi phy width property. Enable the s3c-hsotg.c driver to use standard dwc2 binding and enable configuration of the UTMI phy width based on the property. Signed-off-by: Matt Porter Reviewed-by: Markus Mayer Reviewed-by: Tim Kryger --- Documentation/devicetree/bindings/staging/dwc2.txt | 4 ++++ drivers/usb/gadget/s3c-hsotg.c | 18 +++++++++++++++++- drivers/usb/gadget/s3c-hsotg.h | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/staging/dwc2.txt b/Documentation/devicetree/bindings/staging/dwc2.txt index 1a1b7cf..fb6b8ee 100644 --- a/Documentation/devicetree/bindings/staging/dwc2.txt +++ b/Documentation/devicetree/bindings/staging/dwc2.txt @@ -6,10 +6,14 @@ Required properties: - reg : Should contain 1 register range (address and length) - interrupts : Should contain 1 interrupt +Optional properties: +- snps,phy-utmi-width: Must contain the UTMI data width (either 8 or 16) + Example: usb@101c0000 { compatible = "ralink,rt3050-usb, snps,dwc2"; reg = <0x101c0000 40000>; interrupts = <18>; + snps,phy-utmi-width = <8>; }; diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 34d80f3..396afb3 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -137,6 +137,7 @@ struct s3c_hsotg_ep { * @regs: The memory area mapped for accessing registers. * @irq: The IRQ number we are using * @supplies: Definition of USB power supplies + * @phyif: PHY interface width * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos. * @num_of_eps: Number of available EPs (excluding EP0) * @debug_root: root directrory for debugfs. @@ -164,6 +165,7 @@ struct s3c_hsotg { struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; + u32 phyif; unsigned int dedicated_fifos:1; unsigned char num_of_eps; @@ -2212,7 +2214,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg) */ /* set the PLL on, remove the HNP/SRP and set the PHY */ - writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) | + writel(hsotg->phyif | GUSBCFG_TOutCal(7) | (0x5 << 10), hsotg->regs + GUSBCFG); s3c_hsotg_init_fifo(hsotg); @@ -3447,9 +3449,11 @@ static int s3c_hsotg_probe(struct platform_device *pdev) struct s3c_hsotg_plat *plat = dev_get_platdata(&pdev->dev); struct usb_phy *phy; struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; struct resource *res; + u32 phy_utmi_width = 16; int epnum; int ret; int i; @@ -3539,6 +3543,17 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + /* Set default UTMI width */ + hsotg->phyif = GUSBCFG_PHYIf16; + if (np) { + of_property_read_u32(np, "snps,phy-utmi-width", + &phy_utmi_width); + if (phy_utmi_width == 8) + hsotg->phyif = GUSBCFG_PHYIf8; + if ((phy_utmi_width != 8) && (phy_utmi_width != 16)) + dev_warn(dev, "invalid snps,phy-utmi-width value\n"); + } + /* usb phy enable */ s3c_hsotg_phy_enable(hsotg); @@ -3645,6 +3660,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id s3c_hsotg_of_ids[] = { { .compatible = "samsung,s3c6400-hsotg", }, + { .compatible = "snps,dwc2", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids); diff --git a/drivers/usb/gadget/s3c-hsotg.h b/drivers/usb/gadget/s3c-hsotg.h index d650b12..85f549f 100644 --- a/drivers/usb/gadget/s3c-hsotg.h +++ b/drivers/usb/gadget/s3c-hsotg.h @@ -55,6 +55,7 @@ #define GUSBCFG_HNPCap (1 << 9) #define GUSBCFG_SRPCap (1 << 8) #define GUSBCFG_PHYIf16 (1 << 3) +#define GUSBCFG_PHYIf8 (0 << 3) #define GUSBCFG_TOutCal_MASK (0x7 << 0) #define GUSBCFG_TOutCal_SHIFT (0) #define GUSBCFG_TOutCal_LIMIT (0x7)