summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorVaibhav Hiremath <vaibhav.hiremath@linaro.org>2016-02-13 02:04:03 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-02-12 23:01:32 -0800
commit758ca99de9961036675048e1487713e801b184db (patch)
tree406745b2f89516d2e26afcf2f681e1563d319760 /drivers/staging
parenta821adb47d28e22f96716b0ab8c4a8d5f7d3dadb (diff)
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/greybus/arche-platform.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
index 65c8f718dd86..f3674301a2e6 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -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)