From patchwork Mon Nov 25 18:16:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 21753 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 60F7620299 for ; Mon, 25 Nov 2013 18:16:27 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id lx4sf15327652iec.10 for ; Mon, 25 Nov 2013 10:16:27 -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=3Ru2TwDDmWHcaNIIDp0+G+mA9UuMV9vnttbPUWBsM/E=; b=O++6YiT/kqKujmbh9kbFH7nvaUQWFja4EWPHK+vG0YAo+JBcE7RWoo2Xrq15Ln2h3b zPjsaC+2OZHCtQ8OX8kKvL8UjqH3u4SVvq8iCv+2VSenp8kzOIeNYb3lbKerf7pKUrTE 5aSk1YeTqHG6lVm94gkPQqZR9gn7PlqDrUTGKHXnRsho9hE2K2xslTKy2QQnzeSp6CUv I2PcxMQ2QJmpJnvSyOpwzLLlDcFDxlkJLJycp3Dy7bRjv22tR3OvAGRToMhmK9uTRE3c nIbxH6TYfvR3Sb0zk+B/SVI4bqqA7oy2yaKZQk3ElxydNfC/i/pHp7U2D1Pa/finr33S x+/g== X-Gm-Message-State: ALoCoQl+s/wqH3y3XXGcNouDZeoZRjLL62F3ojNxhOxAMBWoiy83x/OOPYcNYtk4g9+wwWLuIBAC X-Received: by 10.182.47.168 with SMTP id e8mr9649647obn.12.1385403387037; Mon, 25 Nov 2013 10:16:27 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.98.35 with SMTP id ef3ls2128502qeb.76.gmail; Mon, 25 Nov 2013 10:16:26 -0800 (PST) X-Received: by 10.58.207.15 with SMTP id ls15mr27635837vec.17.1385403386873; Mon, 25 Nov 2013 10:16:26 -0800 (PST) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id tj6si18215104vcb.43.2013.11.25.10.16.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Nov 2013 10:16:26 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.51; Received: by mail-vb0-f51.google.com with SMTP id m10so2986717vbh.38 for ; Mon, 25 Nov 2013 10:16:26 -0800 (PST) X-Received: by 10.58.233.98 with SMTP id tv2mr27722811vec.11.1385403386789; Mon, 25 Nov 2013 10:16:26 -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.220.174.196 with SMTP id u4csp152998vcz; Mon, 25 Nov 2013 10:16:26 -0800 (PST) X-Received: by 10.50.66.195 with SMTP id h3mr145390igt.41.1385403386144; Mon, 25 Nov 2013 10:16:26 -0800 (PST) Received: from mail-ie0-f170.google.com (mail-ie0-f170.google.com [209.85.223.170]) by mx.google.com with ESMTPS id hb7si30112746icc.130.2013.11.25.10.16.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Nov 2013 10:16:26 -0800 (PST) Received-SPF: neutral (google.com: 209.85.223.170 is neither permitted nor denied by best guess record for domain of matt.porter@linaro.org) client-ip=209.85.223.170; Received: by mail-ie0-f170.google.com with SMTP id qd12so7603152ieb.1 for ; Mon, 25 Nov 2013 10:16:25 -0800 (PST) X-Received: by 10.50.87.36 with SMTP id u4mr13959305igz.40.1385403385892; Mon, 25 Nov 2013 10:16:25 -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 j16sm26901318igf.6.2013.11.25.10.16.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Nov 2013 10:16:25 -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 , Linux USB List , Linux ARM Kernel List , Linux Kernel Mailing List , Devicetree List , Linaro Patches Subject: [PATCH v3 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem Date: Mon, 25 Nov 2013 13:16:04 -0500 Message-Id: <1385403367-18144-7-git-send-email-matt.porter@linaro.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1385403367-18144-1-git-send-email-matt.porter@linaro.org> References: <1385403367-18144-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.212.51 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 --- 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 8dfe33f..be41585 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -144,6 +144,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. @@ -171,6 +172,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; @@ -2276,7 +2278,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); @@ -3622,6 +3624,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)