Revert "spi: atmel: Drop non-dm code"
As we aren't quite able to convert some platforms with a very small size
limit in SPL yet, we need to revert this for now.
This reverts commit 7b0947787358c6b277431d6b76ce043d8bec641d.
Signed-off-by: Tom Rini <trini@konsulko.com>
diff --git a/drivers/spi/atmel_spi.h b/drivers/spi/atmel_spi.h
index 685eeed..76b8556 100644
--- a/drivers/spi/atmel_spi.h
+++ b/drivers/spi/atmel_spi.h
@@ -79,6 +79,22 @@
#define ATMEL_SPI_BITS_16 8
struct atmel_spi_slave {
+ struct spi_slave slave;
void *regs;
u32 mr;
};
+
+static inline struct atmel_spi_slave *to_atmel_spi(struct spi_slave *slave)
+{
+ return container_of(slave, struct atmel_spi_slave, slave);
+}
+
+/* Register access macros */
+#define spi_readl(as, reg) \
+ readl(as->regs + ATMEL_SPI_##reg)
+#define spi_writel(as, reg, value) \
+ writel(value, as->regs + ATMEL_SPI_##reg)
+
+#if !defined(CONFIG_SYS_SPI_WRITE_TOUT)
+#define CONFIG_SYS_SPI_WRITE_TOUT (5 * CONFIG_SYS_HZ)
+#endif