spi: atmel: request cs pin via gpiolib
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
b4f7410ad1
commit
668dffaa0d
|
@ -371,6 +371,7 @@ err:
|
|||
static int atmel_spi_probe(struct device_d *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
struct spi_master *master;
|
||||
struct atmel_spi *as;
|
||||
struct at91_spi_platform_data *pdata = dev->platform_data;
|
||||
|
@ -399,6 +400,12 @@ static int atmel_spi_probe(struct device_d *dev)
|
|||
as->cs_pins = pdata->chipselect;
|
||||
as->regs = dev_request_mem_region(dev, 0);
|
||||
|
||||
for (i = 0; i <= master->num_chipselect; i++) {
|
||||
ret = gpio_request(as->cs_pins[i], dev_name(dev));
|
||||
if (ret)
|
||||
goto out_gpio;
|
||||
}
|
||||
|
||||
/* Initialize the hardware */
|
||||
clk_enable(as->clk);
|
||||
spi_writel(as, CR, SPI_BIT(SWRST));
|
||||
|
@ -418,6 +425,7 @@ static int atmel_spi_probe(struct device_d *dev)
|
|||
out_reset_hw:
|
||||
spi_writel(as, CR, SPI_BIT(SWRST));
|
||||
spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
|
||||
out_gpio:
|
||||
clk_disable(as->clk);
|
||||
clk_put(as->clk);
|
||||
out_free:
|
||||
|
|
Loading…
Reference in New Issue