From patchwork Tue Dec 17 19:42:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 22616 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C6D4523FBC for ; Tue, 17 Dec 2013 19:43:03 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id w5sf11767469vbf.5 for ; Tue, 17 Dec 2013 11:43:03 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=nLGgzaC0h9+ZqOXOudQ37//LFb1vvXi2SUEF47ISBkE=; b=UmnYiCnTsIR0+WC2pXXV+lqfNB5gY5wu4EuIFoERhy/EXC+bvx2Z6RBomZCzw6adew 1/7lgwfnRhaZmCvsZVMdJ1opEPk2/Pkp89pMVkz9SWOA9GXQc5U1msEiKkb73mEvaxke cv9yHPGUAOHYRGhTqv1QdFBKGgPQiPgAw0c5Z3ypi0OStX9zHK3LU2ZRLbQtI17EVMZV RJDTo+t/uzQPOWxnDOSQvL0QPxRAc6i4sGfB6bI/Ujt6HDb43SvpnRamq7u1RQ02BXFH pp3OvmkF5+PQ1fp5kQBPRlrANQunKfVgAViC22W4iJc8IZYnUQ7zLs5H0KUtDG1E6L1v ktGA== X-Gm-Message-State: ALoCoQnuGqmghEaXXCAaXkU+MR/8+weWAIdr6vZqzmqxdlU1kSmuEtzEOwF9EaXt0ku6EJMjkvFi X-Received: by 10.58.50.202 with SMTP id e10mr1400696veo.41.1387309383009; Tue, 17 Dec 2013 11:43:03 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.12.241 with SMTP id b17ls2710562qec.11.gmail; Tue, 17 Dec 2013 11:43:02 -0800 (PST) X-Received: by 10.52.117.176 with SMTP id kf16mr9641219vdb.6.1387309382909; Tue, 17 Dec 2013 11:43:02 -0800 (PST) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id lu1si5151913vcb.13.2013.12.17.11.43.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 11:43:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id ks9so4394440vcb.26 for ; Tue, 17 Dec 2013 11:43:02 -0800 (PST) X-Received: by 10.52.244.15 with SMTP id xc15mr1643642vdc.52.1387309382831; Tue, 17 Dec 2013 11:43:02 -0800 (PST) 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.59.13.131 with SMTP id ey3csp191035ved; Tue, 17 Dec 2013 11:43:02 -0800 (PST) X-Received: by 10.43.170.130 with SMTP id nq2mr2791913icc.69.1387309381716; Tue, 17 Dec 2013 11:43:01 -0800 (PST) Received: from mail-ig0-f172.google.com (mail-ig0-f172.google.com [209.85.213.172]) by mx.google.com with ESMTPS id mg9si18426978icc.50.2013.12.17.11.43.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 11:43:01 -0800 (PST) Received-SPF: neutral (google.com: 209.85.213.172 is neither permitted nor denied by best guess record for domain of mporter@linaro.org) client-ip=209.85.213.172; Received: by mail-ig0-f172.google.com with SMTP id hl1so7167323igb.5 for ; Tue, 17 Dec 2013 11:43:01 -0800 (PST) X-Received: by 10.50.73.136 with SMTP id l8mr3031467igv.7.1387309381415; Tue, 17 Dec 2013 11:43:01 -0800 (PST) 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 v2sm23254399igz.3.2013.12.17.11.42.57 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 11:43:00 -0800 (PST) From: Matt Porter To: Felipe Balbi , Greg Kroah-Hartman , Kishon Vijay Abraham I , Rob Herring , Pawel Moll , Mark Rutland , Kumar Gala , Ian Campbell , Christian Daudt , Paul Zimmerman Cc: Tomasz Figa , Kamil Debski , Kyungmin Park , Dinh Nguyen , Russell King , Linux USB List , Linux ARM Kernel List , Linux Kernel Mailing List , Devicetree List , Linaro Patches Subject: [PATCH v7 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem Date: Tue, 17 Dec 2013 14:42:33 -0500 Message-Id: <1387309356-17195-7-git-send-email-mporter@linaro.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1387309356-17195-1-git-send-email-mporter@linaro.org> References: <1387309356-17195-1-git-send-email-mporter@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mporter@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 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: , Adds support for querying the phy bus width from the generic phy subsystem. Configure UTMI bus width in GUSBCFG based on this value. Signed-off-by: Matt Porter Acked-by: Kishon Vijay Abraham I --- drivers/usb/gadget/s3c-hsotg.c | 14 +++++++++++++- drivers/usb/gadget/s3c-hsotg.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 8f9bcdb..93ba8b6 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -146,6 +146,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. @@ -174,6 +175,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; @@ -2279,7 +2281,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); @@ -3638,6 +3640,16 @@ static int s3c_hsotg_probe(struct platform_device *pdev) goto err_supplies; } + /* Set default UTMI width */ + hsotg->phyif = GUSBCFG_PHYIf16; + + /* + * If using the generic PHY framework, check if the PHY bus + * width is 8-bit and set the phyif appropriately. + */ + if (hsotg->phy && (phy_get_bus_width(phy) == 8)) + hsotg->phyif = GUSBCFG_PHYIf8; + if (hsotg->phy) phy_init(hsotg->phy); 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)