mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 07:35:10 +00:00
greybus: arche-platform: Introduce coldboot_seq fn
This is preparation for support for different operational states (defined by arche_platform_state) in the driver, to enable user/developer to dynamically configure the state. arche_platform_coldboot_seq() fn will be responsible for rebooting SVC device. Testing Done: Tested on EVT1.2 and DB3.5 platform Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
a821adb47d
commit
758ca99de9
1 changed files with 34 additions and 15 deletions
|
@ -104,6 +104,32 @@ static void unexport_gpios(struct arche_platform_drvdata *arche_pdata)
|
|||
gpio_unexport(arche_pdata->svc_sysboot_gpio);
|
||||
}
|
||||
|
||||
static int arche_platform_coldboot_seq(struct arche_platform_drvdata *arche_pdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
dev_info(arche_pdata->dev, "Booting from cold boot state\n");
|
||||
|
||||
svc_reset_onoff(arche_pdata->svc_reset_gpio,
|
||||
arche_pdata->is_reset_act_hi);
|
||||
|
||||
gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
|
||||
usleep_range(100, 200);
|
||||
|
||||
ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
|
||||
if (ret) {
|
||||
dev_err(arche_pdata->dev, "failed to enable svc_ref_clk: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* bring SVC out of reset */
|
||||
svc_reset_onoff(arche_pdata->svc_reset_gpio,
|
||||
!arche_pdata->is_reset_act_hi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void arche_platform_cleanup(struct arche_platform_drvdata *arche_pdata)
|
||||
{
|
||||
clk_disable_unprepare(arche_pdata->svc_ref_clk);
|
||||
|
@ -185,11 +211,6 @@ static int arche_platform_probe(struct platform_device *pdev)
|
|||
dev_err(dev, "failed to get svc_ref_clk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to enable svc_ref_clk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, arche_pdata);
|
||||
|
||||
|
@ -200,34 +221,32 @@ static int arche_platform_probe(struct platform_device *pdev)
|
|||
if (arche_pdata->wake_detect_gpio < 0) {
|
||||
dev_err(dev, "failed to get wake detect gpio\n");
|
||||
ret = arche_pdata->wake_detect_gpio;
|
||||
goto exit;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = devm_gpio_request(dev, arche_pdata->wake_detect_gpio, "wake detect");
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed requesting wake_detect gpio %d\n",
|
||||
arche_pdata->wake_detect_gpio);
|
||||
goto exit;
|
||||
return ret;
|
||||
}
|
||||
/* deassert wake detect */
|
||||
gpio_direction_output(arche_pdata->wake_detect_gpio, 0);
|
||||
|
||||
/* bring SVC out of reset */
|
||||
svc_reset_onoff(arche_pdata->svc_reset_gpio,
|
||||
!arche_pdata->is_reset_act_hi);
|
||||
|
||||
arche_pdata->dev = &pdev->dev;
|
||||
INIT_DELAYED_WORK(&arche_pdata->delayed_work, svc_delayed_work);
|
||||
schedule_delayed_work(&arche_pdata->delayed_work, msecs_to_jiffies(2000));
|
||||
|
||||
ret = arche_platform_coldboot_seq(arche_pdata);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to cold boot svc %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
export_gpios(arche_pdata);
|
||||
|
||||
dev_info(dev, "Device registered successfully\n");
|
||||
return 0;
|
||||
|
||||
exit:
|
||||
arche_platform_cleanup(arche_pdata);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int arche_remove_child(struct device *dev, void *unused)
|
||||
|
|
Loading…
Reference in a new issue