All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux dev-4.7] drivers/fsi: Set I/O to standby values on unbind
@ 2017-03-03 21:37 Christopher Bostic
  2017-03-07  2:26 ` Joel Stanley
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Bostic @ 2017-03-03 21:37 UTC (permalink / raw)
  To: joel; +Cc: Christopher Bostic, openbmc

On unbind send a break command to reset any connected slave
and put bus in a good state. Next set each FSI pin to standby
state, '0' except for SDA (data) which is negative active so set
it to a '1'.

Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
---
 drivers/fsi/fsi-master-gpio.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
index 49f3399..c923846 100644
--- a/drivers/fsi/fsi-master-gpio.c
+++ b/drivers/fsi/fsi-master-gpio.c
@@ -557,14 +557,24 @@ static int fsi_master_gpio_remove(struct platform_device *pdev)
 {
 	struct fsi_master_gpio *master = platform_get_drvdata(pdev);
 
+	fsi_master_gpio_break(&master->master, 0);
+
+	gpiod_set_value(master->gpio_clk, 0);
 	devm_gpiod_put(&pdev->dev, master->gpio_clk);
+	gpiod_set_value(master->gpio_data, 1);
 	devm_gpiod_put(&pdev->dev, master->gpio_data);
-	if (master->gpio_trans)
+	if (master->gpio_trans) {
+		gpiod_set_value(master->gpio_trans, 0);
 		devm_gpiod_put(&pdev->dev, master->gpio_trans);
-	if (master->gpio_enable)
+	}
+	if (master->gpio_enable) {
+		gpiod_set_value(master->gpio_enable, 0);
 		devm_gpiod_put(&pdev->dev, master->gpio_enable);
-	if (master->gpio_mux)
+	}
+	if (master->gpio_mux) {
+		gpiod_set_value(master->gpio_mux, 0);
 		devm_gpiod_put(&pdev->dev, master->gpio_mux);
+	}
 	fsi_master_unregister(&master->master);
 
 	return 0;
-- 
1.8.2.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux dev-4.7] drivers/fsi: Set I/O to standby values on unbind
  2017-03-03 21:37 [PATCH linux dev-4.7] drivers/fsi: Set I/O to standby values on unbind Christopher Bostic
@ 2017-03-07  2:26 ` Joel Stanley
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Stanley @ 2017-03-07  2:26 UTC (permalink / raw)
  To: Christopher Bostic; +Cc: OpenBMC Maillist

On Sat, Mar 4, 2017 at 8:07 AM, Christopher Bostic
<cbostic@linux.vnet.ibm.com> wrote:
> On unbind send a break command to reset any connected slave
> and put bus in a good state. Next set each FSI pin to standby
> state, '0' except for SDA (data) which is negative active so set
> it to a '1'.

I recommend  you investigate fixing the device tree node so the data
line is configured as active-low.

I've applied this as-is to dev-4.7.

Cheers,

Joel

>
> Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
> ---
>  drivers/fsi/fsi-master-gpio.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
> index 49f3399..c923846 100644
> --- a/drivers/fsi/fsi-master-gpio.c
> +++ b/drivers/fsi/fsi-master-gpio.c
> @@ -557,14 +557,24 @@ static int fsi_master_gpio_remove(struct platform_device *pdev)
>  {
>         struct fsi_master_gpio *master = platform_get_drvdata(pdev);
>
> +       fsi_master_gpio_break(&master->master, 0);
> +
> +       gpiod_set_value(master->gpio_clk, 0);
>         devm_gpiod_put(&pdev->dev, master->gpio_clk);
> +       gpiod_set_value(master->gpio_data, 1);
>         devm_gpiod_put(&pdev->dev, master->gpio_data);
> -       if (master->gpio_trans)
> +       if (master->gpio_trans) {
> +               gpiod_set_value(master->gpio_trans, 0);
>                 devm_gpiod_put(&pdev->dev, master->gpio_trans);
> -       if (master->gpio_enable)
> +       }
> +       if (master->gpio_enable) {
> +               gpiod_set_value(master->gpio_enable, 0);
>                 devm_gpiod_put(&pdev->dev, master->gpio_enable);
> -       if (master->gpio_mux)
> +       }
> +       if (master->gpio_mux) {
> +               gpiod_set_value(master->gpio_mux, 0);
>                 devm_gpiod_put(&pdev->dev, master->gpio_mux);
> +       }
>         fsi_master_unregister(&master->master);
>
>         return 0;
> --
> 1.8.2.2
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-07  2:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 21:37 [PATCH linux dev-4.7] drivers/fsi: Set I/O to standby values on unbind Christopher Bostic
2017-03-07  2:26 ` Joel Stanley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.