From patchwork Fri Nov 1 19:45:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 3127491 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C63C9BEEB2 for ; Fri, 1 Nov 2013 19:49:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CBA9203F4 for ; Fri, 1 Nov 2013 19:49:30 +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 877CF201BF for ; Fri, 1 Nov 2013 19:49:29 +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 1VcKh3-0004LM-Fu; Fri, 01 Nov 2013 19:47:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VcKgg-00082H-U8; Fri, 01 Nov 2013 19:47:18 +0000 Received: from mail-ie0-f170.google.com ([209.85.223.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VcKg6-0007tb-JP for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2013 19:46:45 +0000 Received: by mail-ie0-f170.google.com with SMTP id at1so8344804iec.1 for ; Fri, 01 Nov 2013 12:46:24 -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=JPrSQQTFhLIpC/H6LgN10NxuzNIS/dxcr25kXWBvaRc=; b=Mg2mpxWtHgbBL49N9GxJ+QJUt1BqTPBMUGnS6+9tSYAMJyQ6k2riMjHucC9apWI74Q Q3ZCMwwRQ0BO/qp6GT7d2MQAdHcr1pAo3snAQCYSABKObktfYZ13nd/QR1uawVtOH2xv tx4c7KNd4yB2nEOYiwhaZWjJikcQh+SW/B9hJG8P4szi18ITggnEsbCISDxmDPJPgnGv tTSmy2C0dO7bgUa6YKNqraURBhjCCPVO7NyQ3vPnsbt10NgHatnZnlh2HyKXieK/0/SE g3loZ4Nl1CMRHlDHxxjH0l+ShSypQ/mqLXPOjp1geUM2CDoF+jXM11kkB4GChrRZQpYp NePg== X-Gm-Message-State: ALoCoQloswO0yxUo7YvTTjRS6makUa71QuHSsGIDDAcxK6pU6IJNdi0Nk48lqp2MSzSnIW/9f0ga X-Received: by 10.50.40.37 with SMTP id u5mr3723919igk.29.1383335184440; Fri, 01 Nov 2013 12:46:24 -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 f5sm5616338igc.4.2013.11.01.12.46.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Nov 2013 12:46:23 -0700 (PDT) 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 Subject: [PATCH v2 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem Date: Fri, 1 Nov 2013 15:45:55 -0400 Message-Id: <1383335158-19730-7-git-send-email-matt.porter@linaro.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1383335158-19730-1-git-send-email-matt.porter@linaro.org> References: <1383335158-19730-1-git-send-email-matt.porter@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131101_154642_673982_1293A4AB X-CRM114-Status: GOOD ( 15.21 ) X-Spam-Score: -2.6 (--) Cc: Devicetree List , Linux USB List , Linux Kernel Mailing List , Linux ARM Kernel List , Linaro Patches 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.7 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 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 f97978b..0be6242 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -139,6 +139,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. @@ -167,6 +168,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; @@ -2215,7 +2217,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); @@ -3557,6 +3559,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->gphy && (phy_get_bus_width(gphy) == 8)) + hsotg->phyif = GUSBCFG_PHYIf8; + /* usb phy enable */ s3c_hsotg_phy_enable(hsotg); 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)