mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-30 16:35:37 +00:00
spi: atmel_spi: using ip version to check whether has wdrbt
Using IP version to check whether it has wdrbt bit in mode register Tested in at91sam9x5ek and at91sam9n12ek. Signed-off-by: Bo Shen <voice.shen@atmel.com> [fix warning about incompatible parameter] Signed-off-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
This commit is contained in:
parent
cac423a730
commit
e0d2d3bd29
2 changed files with 13 additions and 4 deletions
|
@ -30,6 +30,15 @@
|
||||||
|
|
||||||
#include "atmel_spi.h"
|
#include "atmel_spi.h"
|
||||||
|
|
||||||
|
static int spi_has_wdrbt(struct atmel_spi_slave *slave)
|
||||||
|
{
|
||||||
|
unsigned int ver;
|
||||||
|
|
||||||
|
ver = spi_readl(slave, VERSION);
|
||||||
|
|
||||||
|
return (ATMEL_SPI_VERSION_REV(ver) >= 0x210);
|
||||||
|
}
|
||||||
|
|
||||||
void spi_init()
|
void spi_init()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -90,10 +99,10 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
|
||||||
|
|
||||||
as->regs = regs;
|
as->regs = regs;
|
||||||
as->mr = ATMEL_SPI_MR_MSTR | ATMEL_SPI_MR_MODFDIS
|
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);
|
| ATMEL_SPI_MR_PCS(~(1 << cs) & 0xf);
|
||||||
|
if (spi_has_wdrbt(as))
|
||||||
|
as->mr |= ATMEL_SPI_MR_WDRBT;
|
||||||
|
|
||||||
spi_writel(as, CSR(cs), csrx);
|
spi_writel(as, CSR(cs), csrx);
|
||||||
|
|
||||||
return &as->slave;
|
return &as->slave;
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
#define ATMEL_SPI_CSRx_DLYBCT(x) ((x) << 24)
|
#define ATMEL_SPI_CSRx_DLYBCT(x) ((x) << 24)
|
||||||
|
|
||||||
/* Bits in VERSION */
|
/* Bits in VERSION */
|
||||||
#define ATMEL_SPI_VERSION_REV(x) ((x) << 0)
|
#define ATMEL_SPI_VERSION_REV(x) ((x) & 0xfff)
|
||||||
#define ATMEL_SPI_VERSION_MFN(x) ((x) << 16)
|
#define ATMEL_SPI_VERSION_MFN(x) ((x) << 16)
|
||||||
|
|
||||||
/* Constants for CSRx:BITS */
|
/* Constants for CSRx:BITS */
|
||||||
|
|
Loading…
Add table
Reference in a new issue