]> git.sur5r.net Git - u-boot/blobdiff - drivers/spi/xilinx_spi.c
ARM: AM43xx: Add build support
[u-boot] / drivers / spi / xilinx_spi.c
index 52a4134f18b956963d8aa65c6a814f57bb9b585e..a82b056948a4cecd716a776f6d7eae1e63b89423 100644 (file)
@@ -85,20 +85,20 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
                return NULL;
        }
 
-       xilspi = malloc(sizeof(*xilspi));
+       xilspi = spi_alloc_slave(struct xilinx_spi_slave, bus, cs);
        if (!xilspi) {
                printf("XILSPI error: %s: malloc of SPI structure failed\n",
                                __func__);
                return NULL;
        }
-       xilspi->slave.bus = bus;
-       xilspi->slave.cs = cs;
        xilspi->regs = (struct xilinx_spi_reg *)xilinx_spi_base_list[bus];
        xilspi->freq = max_hz;
        xilspi->mode = mode;
        debug("%s: bus:%i cs:%i base:%p mode:%x max_hz:%d\n", __func__,
                bus, cs, xilspi->regs, xilspi->mode, xilspi->freq);
 
+       writel(SPISSR_RESET_VALUE, &xilspi->regs->srr);
+
        return &xilspi->slave;
 }