diff options
| author | Phil Reid <preid@electromag.com.au> | 2016-08-31 03:31:38 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2016-09-01 15:53:31 -0400 |
| commit | f99008013e199e6b88ef26c98ecb042c94c7450c (patch) | |
| tree | 8d06d437619946dcdb853cae1e1af7f80a468596 /drivers/spi | |
| parent | 29b4817d4018df78086157ea3a55c1d9424a7cfc (diff) | |
spi: sc18is602: Add reset control via gpio pin.
This sc18is602 has a reset pin that may need to be deasserted.
Add optional binding to specifiy the reset pin via a gpio and deassert
during probe.
Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
| -rw-r--r-- | drivers/spi/spi-sc18is602.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index 36af4d48a700..5666b5d20b87 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/pm_runtime.h> | 23 | #include <linux/pm_runtime.h> |
| 24 | #include <linux/of.h> | 24 | #include <linux/of.h> |
| 25 | #include <linux/platform_data/sc18is602.h> | 25 | #include <linux/platform_data/sc18is602.h> |
| 26 | #include <linux/gpio/consumer.h> | ||
| 26 | 27 | ||
| 27 | enum chips { sc18is602, sc18is602b, sc18is603 }; | 28 | enum chips { sc18is602, sc18is602b, sc18is603 }; |
| 28 | 29 | ||
| @@ -50,6 +51,8 @@ struct sc18is602 { | |||
| 50 | u8 buffer[SC18IS602_BUFSIZ + 1]; | 51 | u8 buffer[SC18IS602_BUFSIZ + 1]; |
| 51 | int tlen; /* Data queued for tx in buffer */ | 52 | int tlen; /* Data queued for tx in buffer */ |
| 52 | int rindex; /* Receive data index in buffer */ | 53 | int rindex; /* Receive data index in buffer */ |
| 54 | |||
| 55 | struct gpio_desc *reset; | ||
| 53 | }; | 56 | }; |
| 54 | 57 | ||
| 55 | static int sc18is602_wait_ready(struct sc18is602 *hw, int len) | 58 | static int sc18is602_wait_ready(struct sc18is602 *hw, int len) |
| @@ -257,6 +260,12 @@ static int sc18is602_probe(struct i2c_client *client, | |||
| 257 | hw = spi_master_get_devdata(master); | 260 | hw = spi_master_get_devdata(master); |
| 258 | i2c_set_clientdata(client, hw); | 261 | i2c_set_clientdata(client, hw); |
| 259 | 262 | ||
| 263 | /* assert reset and then release */ | ||
| 264 | hw->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); | ||
| 265 | if (IS_ERR(hw->reset)) | ||
| 266 | return PTR_ERR(hw->reset); | ||
| 267 | gpiod_set_value(hw->reset, 0); | ||
| 268 | |||
| 260 | hw->master = master; | 269 | hw->master = master; |
| 261 | hw->client = client; | 270 | hw->client = client; |
| 262 | hw->dev = dev; | 271 | hw->dev = dev; |
