From patchwork Thu Dec 12 11:18:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 22275 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6FB9323FC9 for ; Thu, 12 Dec 2013 11:19:03 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id i4sf963713oah.2 for ; Thu, 12 Dec 2013 03:19: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=XIXczf8zHKLrGEzrIY/yc7YBhZhokZ3mMwH56vr3szw=; b=a0PU6NZKkUE5Yzj3qJE5Iknpq4zMnCpj65zH9xd9MxwM7YPxXqycDhwZbjoe84eEbs PGcBw5DRwdWaMk9eOBgUZX3b4hBtxb98psZhs2rkTS2gs7Mq38IjGI1AblnsvxuRvXKn doswoUdM7VIcGSHNH/kFXE12bAI7j+gtxftGjIBUpGD2nJ6SnsScjhZNrmvFGJ/NAhWQ gUQ1s6Ag2OEz7E2eyt5vq9Zl+qhm4QC2vjwzljVplcGm9VzKYGwLqc/NQ72HIKFCq6ZS zLrlPTB39U5uFVp6/qGJN7oMDO6ou41YMEFdN9oWzvKjIjawKu375Xo66VnQupc9GcPb BPCA== X-Gm-Message-State: ALoCoQkqhd/rPLMLoos45Q7/WNIbXIzu2xqD+dDmkLdcjyDyLYSOvnlv5Ratom1AlkFm5Z/Vnz7a X-Received: by 10.50.66.238 with SMTP id i14mr12612153igt.4.1386847143047; Thu, 12 Dec 2013 03:19:03 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.108 with SMTP id g12ls431316qej.81.gmail; Thu, 12 Dec 2013 03:19:02 -0800 (PST) X-Received: by 10.221.47.193 with SMTP id ut1mr3367419vcb.8.1386847142934; Thu, 12 Dec 2013 03:19:02 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id pu5si7590261veb.97.2013.12.12.03.19.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 03:19:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 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.47; Received: by mail-vb0-f47.google.com with SMTP id q12so166475vbe.20 for ; Thu, 12 Dec 2013 03:19:02 -0800 (PST) X-Received: by 10.220.64.69 with SMTP id d5mr3313449vci.11.1386847142845; Thu, 12 Dec 2013 03:19: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.220.174.196 with SMTP id u4csp345878vcz; Thu, 12 Dec 2013 03:19:02 -0800 (PST) X-Received: by 10.43.161.2 with SMTP id me2mr5824711icc.20.1386847142119; Thu, 12 Dec 2013 03:19:02 -0800 (PST) Received: from mail-ie0-f177.google.com (mail-ie0-f177.google.com [209.85.223.177]) by mx.google.com with ESMTPS id nh2si23818414icc.39.2013.12.12.03.19.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 03:19:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.223.177 is neither permitted nor denied by best guess record for domain of mporter@linaro.org) client-ip=209.85.223.177; Received: by mail-ie0-f177.google.com with SMTP id tp5so323297ieb.22 for ; Thu, 12 Dec 2013 03:19:01 -0800 (PST) X-Received: by 10.50.117.103 with SMTP id kd7mr8489864igb.4.1386847141824; Thu, 12 Dec 2013 03:19: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 u1sm14511537ige.1.2013.12.12.03.18.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 03:19:01 -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 v4 6/9] usb: gadget: s3c-hsotg: get phy bus width from phy subsystem Date: Thu, 12 Dec 2013 06:18:34 -0500 Message-Id: <1386847117-21240-7-git-send-email-mporter@linaro.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1386847117-21240-1-git-send-email-mporter@linaro.org> References: <1386847117-21240-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.47 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 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)