summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/arche-platform.c
diff options
context:
space:
mode:
authorVaibhav Hiremath <vaibhav.hiremath@linaro.org>2016-01-06 11:31:20 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-01-06 20:00:35 -0800
commit6da86df3a4aa6dfbb9af350df4a908a7a9254be0 (patch)
tree708cec490c4e215c1b844e02de7c7193a5c93a2b /drivers/staging/greybus/arche-platform.c
parent1f67ee5c04c9690c4c99fc4d31f4add46ea7be73 (diff)
greybus: arche-platform: Export gpio (reset & sys_boot) to user
In order to allow user to flash the firmware to, SVC: user need to assert the reset first, set sysboot pin and deassert reset. And then issue a flashing command. And APB: User need to assert the reset first, and then issue flashing command. So this patch exports the gpio's to user. Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/arche-platform.c')
-rw-r--r--drivers/staging/greybus/arche-platform.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
index 50699520834f..e6fe0156e128 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -45,6 +45,19 @@ static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
gpio_set_value(gpio, onoff);
}
+/* Export gpio's to user space */
+static void export_gpios(struct arche_platform_drvdata *arche_pdata)
+{
+ gpio_export(arche_pdata->svc_reset_gpio, false);
+ gpio_export(arche_pdata->svc_sysboot_gpio, false);
+}
+
+static void unexport_gpios(struct arche_platform_drvdata *arche_pdata)
+{
+ gpio_unexport(arche_pdata->svc_reset_gpio);
+ gpio_unexport(arche_pdata->svc_sysboot_gpio);
+}
+
static void arche_platform_cleanup(struct arche_platform_drvdata *arche_pdata)
{
/* As part of exit, put APB back in reset state */
@@ -141,6 +154,8 @@ static int arche_platform_probe(struct platform_device *pdev)
arche_pdata->num_apbs = of_get_child_count(np);
dev_dbg(dev, "Number of APB's available - %d\n", arche_pdata->num_apbs);
+ export_gpios(arche_pdata);
+
/* probe all childs here */
ret = of_platform_populate(np, NULL, NULL, dev);
if (ret)
@@ -169,6 +184,7 @@ static int arche_platform_remove(struct platform_device *pdev)
arche_platform_cleanup(arche_pdata);
platform_set_drvdata(pdev, NULL);
+ unexport_gpios(arche_pdata);
return 0;
}