]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/spi/atmel_spi.c
Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / drivers / spi / atmel_spi.c
index 83ef8e8b193c9c9e30e760a4c8d40afc08ed8cce..f4b1bad22e85f787212194ff265908139946254e 100644 (file)
@@ -84,14 +84,15 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
        if (mode & SPI_CPOL)
                csrx |= ATMEL_SPI_CSRx_CPOL;
 
-       as = malloc(sizeof(struct atmel_spi_slave));
+       as = spi_alloc_slave(struct atmel_spi_slave, bus, cs);
        if (!as)
                return NULL;
 
-       as->slave.bus = bus;
-       as->slave.cs = cs;
        as->regs = regs;
        as->mr = ATMEL_SPI_MR_MSTR | ATMEL_SPI_MR_MODFDIS
+#if defined(CONFIG_AT91SAM9X5) || defined(CONFIG_AT91SAM9M10G45)
+                       | ATMEL_SPI_MR_WDRBT
+#endif
                        | ATMEL_SPI_MR_PCS(~(1 << cs) & 0xf);
        spi_writel(as, CSR(cs), csrx);