Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162330AbbKTIh0 (ORCPT ); Fri, 20 Nov 2015 03:37:26 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:39963 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161228AbbKTIfi (ORCPT ); Fri, 20 Nov 2015 03:35:38 -0500 From: Andy Gross To: linux-arm-msm@vger.kernel.org Cc: Felipe Balbi , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, Greg KH , devicetree@vger.kernel.org, Kishon Vijay Abraham I , Andy Gross Subject: [PATCH 2/4] usb: dwc3: qcom: Configure TCSR phy mux register Date: Fri, 20 Nov 2015 02:35:07 -0600 Message-Id: <1448008509-8913-3-git-send-email-agross@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1448008509-8913-1-git-send-email-agross@codeaurora.org> References: <1448008509-8913-1-git-send-email-agross@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2223 Lines: 68 This patch adds automatic configuration of the TCSR phy mux register based on the syscon-tcsr devicetree entry. This configuration is optional, as some platforms may not require the mux selection. Signed-off-by: Andy Gross --- drivers/usb/dwc3/dwc3-qcom.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 0880260..fcf264c 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include struct dwc3_qcom { struct device *dev; @@ -30,6 +32,9 @@ static int dwc3_qcom_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; struct dwc3_qcom *qdwc; + struct regmap *regmap; + u32 mux_offset; + u32 mux_bit; int ret; qdwc = devm_kzalloc(&pdev->dev, sizeof(*qdwc), GFP_KERNEL); @@ -58,6 +63,26 @@ static int dwc3_qcom_probe(struct platform_device *pdev) qdwc->sleep_clk = NULL; } + /* look for tcsr and if present, provision it */ + regmap = syscon_regmap_lookup_by_phandle(node, "syscon-tcsr"); + if (!IS_ERR(regmap)) { + if (of_property_read_u32_index(node, "syscon-tcsr", 1, + &mux_offset)) { + dev_err(qdwc->dev, "missing USB TCSR mux offset\n"); + return -EINVAL; + } + if (of_property_read_u32_index(node, "syscon-tcsr", 2, + &mux_bit)) { + dev_err(qdwc->dev, "missing USB TCSR mux bit\n"); + return -EINVAL; + } + + regmap_update_bits(regmap, mux_offset, BIT(mux_bit), + BIT(mux_bit)); + } else { + dev_info(qdwc->dev, "missing syscon tcsr entry\n"); + } + ret = clk_prepare_enable(qdwc->core_clk); if (ret) { dev_err(qdwc->dev, "failed to enable core clock\n"); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/