From patchwork Fri Dec 13 16:51:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 22336 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 179B7202E2 for ; Fri, 13 Dec 2013 16:51:49 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id vb8sf7437099obc.4 for ; Fri, 13 Dec 2013 08:51:48 -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=I0MHHVEJfF+fLhZ9RBjT8hl7IwMRpw99CwrJq46CRK4=; b=bVWbRcVZNQIBBg7WLHlUTlTjrLkoRcRKbP/b3C2MSX6PiWz6MQCoB/zvfJtthydaDm I5CoXVvVGsxMGVIxPfWGiAAbBC8pVm/ZMr8ozmnwsmidHb8QTR7Khd+HP22iHmQfk5Bi wfkxtEJc6jI3bzJyhDvuUJU7T24wGrMFWwklIdzUd1+ioFj8G3K8naW5vIXsdF09A+BE OwRm5KcxMT2xDTmsOl+Gwi0H2oqVD+Y5280p3nEKzoUrfxi3OW99uPpvSS4c10HJCofV DAbWbf8j+hqYo4lnMb8wokITmpxpEURnI/1ZzB0Yat7NrpSRNZcnilgLP5eVj2VTaJ74 td+Q== X-Gm-Message-State: ALoCoQlFC37kdgCdP/HQkQnDeUXiqOuv+fYevZNTaOnb8d32BKi1jpnmfEFJ5vIhTHuiwFmG0nLj X-Received: by 10.182.87.225 with SMTP id bb1mr1302867obb.16.1386953508696; Fri, 13 Dec 2013 08:51:48 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.39.102 with SMTP id o6ls1081508qek.28.gmail; Fri, 13 Dec 2013 08:51:48 -0800 (PST) X-Received: by 10.58.155.162 with SMTP id vx2mr1669070veb.46.1386953508571; Fri, 13 Dec 2013 08:51:48 -0800 (PST) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by mx.google.com with ESMTPS id er6si934980vdc.62.2013.12.13.08.51.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 08:51:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.48 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.48; Received: by mail-vb0-f48.google.com with SMTP id f13so1446182vbg.7 for ; Fri, 13 Dec 2013 08:51:48 -0800 (PST) X-Received: by 10.52.230.102 with SMTP id sx6mr1372105vdc.15.1386953508466; Fri, 13 Dec 2013 08:51:48 -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 u4csp51942vcz; Fri, 13 Dec 2013 08:51:48 -0800 (PST) X-Received: by 10.43.148.69 with SMTP id kf5mr1385482icc.80.1386953507679; Fri, 13 Dec 2013 08:51:47 -0800 (PST) Received: from mail-ig0-f175.google.com (mail-ig0-f175.google.com [209.85.213.175]) by mx.google.com with ESMTPS id go3si2391526icc.4.2013.12.13.08.51.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 08:51:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.213.175 is neither permitted nor denied by best guess record for domain of mporter@linaro.org) client-ip=209.85.213.175; Received: by mail-ig0-f175.google.com with SMTP id j1so1592075iga.2 for ; Fri, 13 Dec 2013 08:51:47 -0800 (PST) X-Received: by 10.50.43.131 with SMTP id w3mr4055447igl.17.1386953507378; Fri, 13 Dec 2013 08:51:47 -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 hv5sm5155766igb.9.2013.12.13.08.51.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 08:51:46 -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 v6 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem Date: Fri, 13 Dec 2013 11:51:20 -0500 Message-Id: <1386953483-21631-7-git-send-email-mporter@linaro.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1386953483-21631-1-git-send-email-mporter@linaro.org> References: <1386953483-21631-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.212.48 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 e9683c2..168aaa9 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); @@ -3621,6 +3623,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)