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: 2995451 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 276829F1C4 for ; Mon, 7 Oct 2013 10:14:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F1920201CE for ; Mon, 7 Oct 2013 10:14:18 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2A02201CB for ; Mon, 7 Oct 2013 10:14:17 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VT7oj-0000Pd-UV; Mon, 07 Oct 2013 10:13:34 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VT7ob-0007Nj-L9; Mon, 07 Oct 2013 10:13:25 +0000 Received: from mail-ie0-f177.google.com ([209.85.223.177]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VT7oF-0007JJ-Va for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2013 10:13:04 +0000 Received: by mail-ie0-f177.google.com with SMTP id qd12so14445146ieb.8 for ; Mon, 07 Oct 2013 03:12:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xqKsK5RMQbOwzQXOOyjvaWf4E76VYhwXshgx/VxVYWs=; b=PGqnPJbKor/SLGC/jQDz4q78zU8u/VxnJB0EubvCF4yrBP2cqqshcb651fR/H+xb9M XZtojZfNoExpp3dAMz8Cr6XTaDeuefzG9da1Hw4qaOYcZ7hfrFZ+Z3bQ6oWsNlk4DGwa XbHwIgGJKrx2Z/whP8frvXEl7AWMZR8/doEjYr4w2jOK+WnT15NIFHs/WFvWHv0MyFdA 4q7SrxSWIXjoMiN4Hy2MwCOKdPBm5greW2cJapri6xybAU3xc9SBkEbiYfSsEiGFxU4e CaEgidbmiXeD8z9i7qpbIDzABkCi2603xk++TwJUHh/7ZLAwX5vnKdKfIFTFP10RsUsQ 4zQQ== X-Gm-Message-State: ALoCoQkL1k6EIOi5i9rJxO7+zprddeqeCbcyxpibEqVuyOD+MuxmUmPww05OX4dOqV37a5EiLEnl 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131007_061304_042700_BC1D07BC X-CRM114-Status: GOOD ( 16.83 ) X-Spam-Score: -2.6 (--) Cc: Devicetree List , Linaro Patches , Linux USB List , Linux Kernel Mailing List , Paul Zimmerman , Linux ARM Kernel List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)