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: 21311 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 58D6623908 for ; Fri, 1 Nov 2013 19:46:26 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id uo5sf7944172pbc.2 for ; Fri, 01 Nov 2013 12:46:25 -0700 (PDT) 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=JPrSQQTFhLIpC/H6LgN10NxuzNIS/dxcr25kXWBvaRc=; b=Hzxqh13a2L6MLEnuKj29zDbKpqtKTbnbcl4T/zc2PuIV+nY4Q+C8Hbz9zEIrr3q+y3 Fk6D8QnSB/0OU31tiuQYo1Jdxr6TLkbmu9xmZ9VkOYqt1AK7Gtyi0QFmdKK7bUFdh1e/ PQwQIdg1tpZqFgRUmUIXvDM2qOM8gTo1PTOqu5XW4CBW7ED1ph8GB/RsjzFcwdEcq05E jhJay3dTgteUD78z4HNo1ij4ku16J9i1cAiIrKYdT63ombpzHNG+dc3w54w65dIrc3Pi mCor0L71GC+VwROEqrCqISr7GvOLoTrkFilrrtXPLhI5OlxQaqn753Kt4X2HJoFGOT19 3D/w== X-Gm-Message-State: ALoCoQk4Xqz3CSaVFl6ZMLf52iu8CeAL3JNKl/szN68r/6M1yWOMsZnzAg1qQRHOdiuVxWc1zjZa X-Received: by 10.66.248.193 with SMTP id yo1mr1410796pac.6.1383335185647; Fri, 01 Nov 2013 12:46:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.18.199 with SMTP id y7ls1439777qed.78.gmail; Fri, 01 Nov 2013 12:46:25 -0700 (PDT) X-Received: by 10.220.47.10 with SMTP id l10mr451375vcf.32.1383335185486; Fri, 01 Nov 2013 12:46:25 -0700 (PDT) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id dl10si1030895veb.133.2013.11.01.12.46.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Nov 2013 12:46:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.41 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.41; Received: by mail-vb0-f41.google.com with SMTP id w8so3218238vbj.28 for ; Fri, 01 Nov 2013 12:46:25 -0700 (PDT) X-Received: by 10.58.228.231 with SMTP id sl7mr432264vec.49.1383335185402; Fri, 01 Nov 2013 12:46:25 -0700 (PDT) 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 u4csp66770vcz; Fri, 1 Nov 2013 12:46:25 -0700 (PDT) X-Received: by 10.50.22.67 with SMTP id b3mr3671281igf.39.1383335184719; Fri, 01 Nov 2013 12:46:24 -0700 (PDT) Received: from mail-ie0-f179.google.com (mail-ie0-f179.google.com [209.85.223.179]) by mx.google.com with ESMTPS id ph1si2482298igb.8.2013.11.01.12.46.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Nov 2013 12:46:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.223.179 is neither permitted nor denied by best guess record for domain of matt.porter@linaro.org) client-ip=209.85.223.179; Received: by mail-ie0-f179.google.com with SMTP id aq17so7982424iec.24 for ; Fri, 01 Nov 2013 12:46:24 -0700 (PDT) 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 Cc: Linux USB List , Linux ARM Kernel List , Linux Kernel Mailing List , Devicetree List , Linaro Patches 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-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.41 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 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)