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

Commit aa187d33 authored by Vaibhav Hiremath's avatar Vaibhav Hiremath Committed by Greg Kroah-Hartman
Browse files

greybus: arche-apb-ctrl: Enable the clocks after regulator enable



It makes more sense to enable the clock after power is enabled
to the device, so move clock enable code after regulator_enable
and setting up BOOT_RET pin.

Signed-off-by: default avatarVaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: default avatarMichael Scott <michael.scott@linaro.org>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@linaro.org>
Tested-by: default avatarLaurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 3a8dba4e
Loading
Loading
Loading
Loading
+17 −14
Original line number Original line Diff line number Diff line
@@ -82,19 +82,6 @@ static int apb_ctrl_init_seq(struct platform_device *pdev,
	struct device *dev = &pdev->dev;
	struct device *dev = &pdev->dev;
	int ret;
	int ret;


	/* On DB3 clock was not mandatory */
	if (gpio_is_valid(apb->clk_en_gpio)) {
		ret = devm_gpio_request(dev, apb->clk_en_gpio, "apb_clk_en");
		if (ret) {
			dev_warn(dev, "Failed requesting APB clock en gpio %d\n",
				 apb->clk_en_gpio);
		} else {
			ret = gpio_direction_output(apb->clk_en_gpio, 1);
			if (ret)
				dev_warn(dev, "failed to set APB clock en gpio dir:%d\n",
					 ret);
		}
	}
	/* Hold APB in reset state */
	/* Hold APB in reset state */
	ret = devm_gpio_request(dev, apb->resetn_gpio, "apb-reset");
	ret = devm_gpio_request(dev, apb->resetn_gpio, "apb-reset");
	if (ret) {
	if (ret) {
@@ -128,6 +115,7 @@ static int apb_ctrl_init_seq(struct platform_device *pdev,
			return ret;
			return ret;
		}
		}
	}
	}

	if (!IS_ERR(apb->vio)) {
	if (!IS_ERR(apb->vio)) {
		ret = regulator_enable(apb->vio);
		ret = regulator_enable(apb->vio);
		if (ret) {
		if (ret) {
@@ -144,7 +132,22 @@ static int apb_ctrl_init_seq(struct platform_device *pdev,
		goto out_vio_disable;
		goto out_vio_disable;
	}
	}
	gpio_set_value(apb->boot_ret_gpio, 0);
	gpio_set_value(apb->boot_ret_gpio, 0);
	udelay(50);

	/* On DB3 clock was not mandatory */
	if (gpio_is_valid(apb->clk_en_gpio)) {
		ret = devm_gpio_request(dev, apb->clk_en_gpio, "apb_clk_en");
		if (ret) {
			dev_warn(dev, "Failed requesting APB clock en gpio %d\n",
				 apb->clk_en_gpio);
		} else {
			ret = gpio_direction_output(apb->clk_en_gpio, 1);
			if (ret)
				dev_warn(dev, "failed to set APB clock en gpio dir:%d\n",
					 ret);
		}
	}

	usleep_range(100, 200);


	return 0;
	return 0;