SPI: Split writes using spi_crop_chunk()
SPI controllers in Intel and AMD bridges have a slightly different restriction on how long transactions they can handle. Change-Id: I3d149d4b7e7e9633482a153d5e380a86c553d871 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/6163 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
@@ -42,6 +42,7 @@ static int bus_claimed = 0;
|
||||
#define SPI_REG_CNTRL11 0xd
|
||||
#define CNTRL11_FIFOPTR_MASK 0x07
|
||||
|
||||
#define AMD_SB_SPI_TX_LEN 64
|
||||
|
||||
static u32 spibar;
|
||||
|
||||
@@ -86,6 +87,11 @@ void spi_init(void)
|
||||
spibar = pci_read_config32(dev, 0xA0) & ~0x1F;
|
||||
}
|
||||
|
||||
unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
|
||||
{
|
||||
return min(AMD_SB_SPI_TX_LEN - cmd_len, buf_len);
|
||||
}
|
||||
|
||||
int spi_xfer(struct spi_slave *slave, const void *dout,
|
||||
unsigned int bytesout, void *din, unsigned int bytesin)
|
||||
{
|
||||
|
Reference in New Issue
Block a user