greybus: arche-apb-ctrl: deassert reset at the end of probe
authorVaibhav Hiremath <vaibhav.hiremath@linaro.org>
Mon, 11 Jan 2016 12:11:23 +0000 (17:41 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 11 Jan 2016 23:58:10 +0000 (15:58 -0800)
Now the complete handshaking between AP<=>SVC would be
offloaded to parent driver (arche-platform) who is
responsible for SVC control, so the apb-ctrl driver can
just simply bring APB's out of reset during probe itself.

Along with deasserting reset, this patch renames the local fn
to exclusively use it for reset purpose.

Note that, driver is exporting reset gpio to
user, so user can still flash FW from prompt.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/arche-apb-ctrl.c

index 5b9a3ed..65b1e9a 100644 (file)
@@ -51,13 +51,13 @@ struct arche_apb_ctrl_drvdata {
 /*
  * Note that these low level api's are active high
  */
-static inline void assert_gpio(unsigned int gpio)
+static inline void deassert_reset(unsigned int gpio)
 {
        gpio_set_value(gpio, 1);
        msleep(500);
 }
 
-static inline void deassert_gpio(unsigned int gpio)
+static inline void assert_reset(unsigned int gpio)
 {
        gpio_set_value(gpio, 0);
 }
@@ -224,7 +224,7 @@ static void apb_ctrl_cleanup(struct arche_apb_ctrl_drvdata *apb)
                regulator_disable(apb->vio);
 
        /* As part of exit, put APB back in reset state */
-       gpio_set_value(apb->resetn_gpio, 0);
+       assert_reset(apb->resetn_gpio);
        apb->state = APB_STATE_OFF;
 
        /* TODO: May have to send an event to SVC about this exit */
@@ -253,8 +253,9 @@ int arche_apb_ctrl_probe(struct platform_device *pdev)
                return ret;
        }
 
-       apb->state = APB_STATE_OFF;
-
+       /* deassert reset to APB : Active-low signal */
+       deassert_reset(apb->resetn_gpio);
+       apb->state = APB_STATE_ACTIVE;
 
        platform_set_drvdata(pdev, apb);