Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c68403f6 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

USB: HSIC SMSC HUB: Fix device tree style problems



Add the missing documentation for some device tree properties. Fix
the regulator supply naming convention.  The hub-vbus supply is
optional. Don't call regualtor_get on this supply unconditionally.
This leads to unnecessary multiple probe deferrals.

Change-Id: I866bfb9d87ad274030b7997461e89c6bc42f6d98
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent f75c756e
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -135,14 +135,20 @@ SMSC HSIC HUB
Required properties :
- compatible : should be "qcom,hsic-smsc-hub"
- smsc,model-id : should be either <3503> or <4604> depending on hub model
- smsc,<gpio-name>-gpio : handle to the GPIO node, see "gpios property"
  in Documentation/devicetree/bindings/gpio/gpio.txt.
  Required "gpio-name" is "reset" and optionally - "refclk", "int".
- <supply-name>-supply: handle to the regulator device tree node
  Required "supply-name" is "hub_init" and optionally - "hub_vbus".
- smsc,reset-gpio: this output gpio is used to assert/de-assert the hub reset
- Sub node for "MSM HSIC EHCI controller".
  Sub node has the required properties mentioned above.

Optional properties :
- smsc,int-gpio: this input gpio indicate HUB suspend status and signal remote
  wakeup interrupt
- smsc,refclk-gpio: this gpio is used to supply the reference clock
- hub-vbus-supply: this regulator is used to supply the power to
  downstream ports
- hub-int-supply: this regulator is used to bias the interrupt gpio
- ext-hub-vddio-supply: this regulator is used to supply the power to one of
  the hub's VDD.

Example SMSC HSIC HUB :
	hsic_hub {
		compatible = "qcom,hsic-smsc-hub";
@@ -151,8 +157,8 @@ Example SMSC HSIC HUB :
		smsc,reset-gpio = <&pm8941_gpios 8 0x00>;
		smsc,refclk-gpio = <&pm8941_gpios 16 0x00>;
		smsc,int-gpio = <&msmgpio 50 0x00>;
		hub_int-supply = <&pm8941_l10>;
		hub_vbus-supply = <&pm8941_mvs1>;
		hub-int-supply = <&pm8941_l10>;
		hub-vbus-supply = <&pm8941_mvs1>;

		hsic@f9a00000 {
			compatible = "qcom,hsic-host";
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -73,7 +73,7 @@
		/* Dragonboard has an always-on VBUS supply for HSIC hub,
		 * providing a dummy regulator for the hub driver
		 */
		hub_vbus-supply = <&vph_pwr_vreg>;
		hub-vbus-supply = <&vph_pwr_vreg>;

		hsic_host: hsic@f9a00000 {
			compatible = "qcom,hsic-host";
+16 −10
Original line number Diff line number Diff line
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -266,7 +266,7 @@ static int msm_hsic_hub_init_gpio(struct hsic_hub *hub, int init)
		}

		/* Enable LDO if required for external pull-up */
		smsc_hub->int_pad_reg = devm_regulator_get(hub->dev, "hub_int");
		smsc_hub->int_pad_reg = devm_regulator_get(hub->dev, "hub-int");
		if (IS_ERR(smsc_hub->int_pad_reg)) {
			dev_dbg(hub->dev, "unable to get ext hub_int reg\n");
		} else {
@@ -298,6 +298,9 @@ static int msm_hsic_hub_init_vdd(struct hsic_hub *hub, int init)
{
	int ret;

	if (!of_get_property(hub->dev->of_node, "ext-hub-vddio-supply", NULL))
		return 0;

	if (!init) {
		if (!IS_ERR(smsc_hub->hsic_hub_reg)) {
			regulator_disable(smsc_hub->hsic_hub_reg);
@@ -308,7 +311,7 @@ static int msm_hsic_hub_init_vdd(struct hsic_hub *hub, int init)
		return 0;
	}

	smsc_hub->hsic_hub_reg = devm_regulator_get(hub->dev, "EXT_HUB_VDDIO");
	smsc_hub->hsic_hub_reg = devm_regulator_get(hub->dev, "ext-hub-vddio");
	if (IS_ERR(smsc_hub->hsic_hub_reg)) {
		dev_dbg(hub->dev, "unable to get ext hub vddcx\n");
	} else {
@@ -416,12 +419,15 @@ static int smsc_hub_probe(struct platform_device *pdev)
	smsc_hub->dev = &pdev->dev;
	smsc_hub->pdata = pdata;

	smsc_hub->hub_vbus_reg = devm_regulator_get(&pdev->dev, "hub_vbus");
	if (of_get_property(pdev->dev.of_node, "hub-vbus-supply", NULL)) {
		smsc_hub->hub_vbus_reg = devm_regulator_get(&pdev->dev,
				"hub-vbus");
		ret = PTR_ERR(smsc_hub->hub_vbus_reg);
		if (ret == -EPROBE_DEFER) {
			dev_dbg(&pdev->dev, "failed to get hub_vbus\n");
			return ret;
		}
	}

	ret = msm_hsic_hub_init_vdd(smsc_hub, 1);
	if (ret) {
@@ -447,7 +453,7 @@ static int smsc_hub_probe(struct platform_device *pdev)
	udelay(5);
	gpio_direction_output(pdata->hub_reset, 1);

	if (!IS_ERR(smsc_hub->hub_vbus_reg)) {
	if (!IS_ERR_OR_NULL(smsc_hub->hub_vbus_reg)) {
		ret = regulator_enable(smsc_hub->hub_vbus_reg);
		if (ret) {
			dev_err(&pdev->dev, "unable to enable hub_vbus\n");
@@ -532,7 +538,7 @@ static int smsc_hub_remove(struct platform_device *pdev)
	}
	pm_runtime_disable(&pdev->dev);

	if (!IS_ERR(smsc_hub->hub_vbus_reg))
	if (!IS_ERR_OR_NULL(smsc_hub->hub_vbus_reg))
		regulator_disable(smsc_hub->hub_vbus_reg);
	msm_hsic_hub_init_gpio(smsc_hub, 0);
	msm_hsic_hub_init_clock(smsc_hub, 0);