summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/broadcom/cygnus/spi.c6
-rw-r--r--src/soc/imgtec/pistachio/spi.c6
-rw-r--r--src/soc/intel/baytrail/spi.c7
-rw-r--r--src/soc/intel/braswell/spi.c7
-rw-r--r--src/soc/intel/broadwell/spi.c7
-rw-r--r--src/soc/intel/common/block/fast_spi/fast_spi_flash.c1
-rw-r--r--src/soc/intel/common/block/gspi/gspi.c1
-rw-r--r--src/soc/intel/fsp_baytrail/spi.c7
-rw-r--r--src/soc/intel/fsp_broadwell_de/spi.c7
-rw-r--r--src/soc/marvell/armada38x/spi.c6
-rw-r--r--src/soc/marvell/bg4cd/spi.c5
-rw-r--r--src/soc/mediatek/mt8173/flash_controller.c5
-rw-r--r--src/soc/mediatek/mt8173/spi.c1
-rw-r--r--src/soc/nvidia/tegra124/spi.c6
-rw-r--r--src/soc/nvidia/tegra210/spi.c6
-rw-r--r--src/soc/qualcomm/ipq40xx/spi.c6
-rw-r--r--src/soc/qualcomm/ipq806x/spi.c6
-rw-r--r--src/soc/rockchip/common/spi.c6
-rw-r--r--src/soc/samsung/exynos5420/spi.c1
19 files changed, 22 insertions, 75 deletions
diff --git a/src/soc/broadcom/cygnus/spi.c b/src/soc/broadcom/cygnus/spi.c
index f03d453307..fde21ba202 100644
--- a/src/soc/broadcom/cygnus/spi.c
+++ b/src/soc/broadcom/cygnus/spi.c
@@ -280,6 +280,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
+ .max_xfer_size = 65535,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
@@ -318,8 +319,3 @@ int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
return 0;
}
-
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(65535, buf_len);
-}
diff --git a/src/soc/imgtec/pistachio/spi.c b/src/soc/imgtec/pistachio/spi.c
index 2b706f0980..30e14fab10 100644
--- a/src/soc/imgtec/pistachio/spi.c
+++ b/src/soc/imgtec/pistachio/spi.c
@@ -538,6 +538,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
+ .max_xfer_size = IMGTEC_SPI_MAX_TRANSFER_SIZE,
};
/* Set up communications parameters for a SPI slave. */
@@ -585,8 +586,3 @@ int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
return 0;
}
-
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(IMGTEC_SPI_MAX_TRANSFER_SIZE, buf_len);
-}
diff --git a/src/soc/intel/baytrail/spi.c b/src/soc/intel/baytrail/spi.c
index 639954bcfe..36b542f181 100644
--- a/src/soc/intel/baytrail/spi.c
+++ b/src/soc/intel/baytrail/spi.c
@@ -19,6 +19,7 @@
#include <bootstate.h>
#include <delay.h>
#include <arch/io.h>
+#include <commonlib/helpers.h>
#include <console/console.h>
#include <device/pci_ids.h>
#include <spi_flash.h>
@@ -457,11 +458,6 @@ static int ich_status_poll(u16 bitmask, int wait_til_set)
return -1;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(cntlr.databytes, buf_len);
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t bytesout, void *din, size_t bytesin)
{
@@ -613,6 +609,7 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
static const struct spi_ctrlr spi_ctrlr = {
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
+ .max_xfer_size = member_size(ich9_spi_regs, fdata),
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/intel/braswell/spi.c b/src/soc/intel/braswell/spi.c
index 5121be016b..12bf7d5c80 100644
--- a/src/soc/intel/braswell/spi.c
+++ b/src/soc/intel/braswell/spi.c
@@ -16,6 +16,7 @@
/* This file is derived from the flashrom project. */
#include <arch/io.h>
#include <bootstate.h>
+#include <commonlib/helpers.h>
#include <console/console.h>
#include <delay.h>
#include <device/pci_ids.h>
@@ -438,11 +439,6 @@ static int ich_status_poll(u16 bitmask, int wait_til_set)
return -1;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(cntlr.databytes, buf_len);
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t bytesout, void *din, size_t bytesin)
{
@@ -597,6 +593,7 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
static const struct spi_ctrlr spi_ctrlr = {
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
+ .max_xfer_size = member_size(ich9_spi_regs, fdata),
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/intel/broadwell/spi.c b/src/soc/intel/broadwell/spi.c
index aaf3b85b5a..40969bc404 100644
--- a/src/soc/intel/broadwell/spi.c
+++ b/src/soc/intel/broadwell/spi.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include <bootstate.h>
+#include <commonlib/helpers.h>
#include <delay.h>
#include <arch/io.h>
#include <console/console.h>
@@ -454,11 +455,6 @@ static int ich_status_poll(u16 bitmask, int wait_til_set)
return -1;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(cntlr.databytes, buf_len);
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t bytesout, void *din, size_t bytesin)
{
@@ -654,6 +650,7 @@ int spi_flash_protect(u32 start, u32 size)
static const struct spi_ctrlr spi_ctrlr = {
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
+ .max_xfer_size = member_size(ich9_spi_regs, fdata),
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c
index 27a4bb7886..d56b33fa15 100644
--- a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c
+++ b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c
@@ -364,4 +364,5 @@ static int fast_spi_flash_ctrlr_setup(const struct spi_slave *dev)
const struct spi_ctrlr fast_spi_flash_ctrlr = {
.setup = fast_spi_flash_ctrlr_setup,
+ .max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE,
};
diff --git a/src/soc/intel/common/block/gspi/gspi.c b/src/soc/intel/common/block/gspi/gspi.c
index 51e8ef54e1..8e527ed0b1 100644
--- a/src/soc/intel/common/block/gspi/gspi.c
+++ b/src/soc/intel/common/block/gspi/gspi.c
@@ -611,4 +611,5 @@ const struct spi_ctrlr gspi_ctrlr = {
.release_bus = gspi_cs_deassert,
.setup = gspi_ctrlr_setup,
.xfer = gspi_ctrlr_xfer,
+ .max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE,
};
diff --git a/src/soc/intel/fsp_baytrail/spi.c b/src/soc/intel/fsp_baytrail/spi.c
index 409e796daf..236ff741fc 100644
--- a/src/soc/intel/fsp_baytrail/spi.c
+++ b/src/soc/intel/fsp_baytrail/spi.c
@@ -18,6 +18,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include <commonlib/helpers.h>
#include <delay.h>
#include <arch/io.h>
#include <console/console.h>
@@ -438,11 +439,6 @@ static int ich_status_poll(uint16_t bitmask, int wait_til_set)
return -1;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(cntlr.databytes, buf_len);
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t bytesout, void *din, size_t bytesin)
{
@@ -594,6 +590,7 @@ spi_xfer_exit:
static const struct spi_ctrlr spi_ctrlr = {
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
+ .max_xfer_size = member_size(ich9_spi_regs, fdata),
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/intel/fsp_broadwell_de/spi.c b/src/soc/intel/fsp_broadwell_de/spi.c
index a6b6f3541a..01cb281fe0 100644
--- a/src/soc/intel/fsp_broadwell_de/spi.c
+++ b/src/soc/intel/fsp_broadwell_de/spi.c
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include <delay.h>
+#include <commonlib/helpers.h>
#include <arch/io.h>
#include <console/console.h>
#include <device/pci_ids.h>
@@ -452,11 +453,6 @@ static int ich_status_poll(uint16_t bitmask, int wait_til_set)
return -1;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(cntlr.databytes, buf_len);
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t bytesout, void *din, size_t bytesin)
{
@@ -610,6 +606,7 @@ spi_xfer_exit:
static const struct spi_ctrlr spi_ctrlr = {
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
+ .max_xfer_size = member_size(ich9_spi_regs, fdata),
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/marvell/armada38x/spi.c b/src/soc/marvell/armada38x/spi.c
index 25480e49ff..47631f4c69 100644
--- a/src/soc/marvell/armada38x/spi.c
+++ b/src/soc/marvell/armada38x/spi.c
@@ -454,11 +454,6 @@ static void spi_ctrlr_release_bus(const struct spi_slave *slave)
mv_spi_cs_deassert(slave->bus);
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return buf_len;
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave,
const void *dout,
size_t out_bytes,
@@ -480,6 +475,7 @@ static const spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
+ .max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/marvell/bg4cd/spi.c b/src/soc/marvell/bg4cd/spi.c
index f9faf9504a..188a6bd483 100644
--- a/src/soc/marvell/bg4cd/spi.c
+++ b/src/soc/marvell/bg4cd/spi.c
@@ -19,8 +19,3 @@ int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
{
return -1;
}
-
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return buf_len;
-}
diff --git a/src/soc/mediatek/mt8173/flash_controller.c b/src/soc/mediatek/mt8173/flash_controller.c
index f6f6e2a6c7..09df1a47f7 100644
--- a/src/soc/mediatek/mt8173/flash_controller.c
+++ b/src/soc/mediatek/mt8173/flash_controller.c
@@ -108,11 +108,6 @@ static int sector_erase(int offset)
return 0;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(65535, buf_len);
-}
-
static int dma_read(u32 addr, u8 *buf, u32 len, uintptr_t dma_buf,
size_t dma_buf_len)
{
diff --git a/src/soc/mediatek/mt8173/spi.c b/src/soc/mediatek/mt8173/spi.c
index 415764a1b6..188bdc2881 100644
--- a/src/soc/mediatek/mt8173/spi.c
+++ b/src/soc/mediatek/mt8173/spi.c
@@ -294,6 +294,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
+ .max_xfer_size = 65535,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/nvidia/tegra124/spi.c b/src/soc/nvidia/tegra124/spi.c
index 5d8084fbdf..4ecd67a8a4 100644
--- a/src/soc/nvidia/tegra124/spi.c
+++ b/src/soc/nvidia/tegra124/spi.c
@@ -714,11 +714,6 @@ static int xfer_finish(struct tegra_spi_channel *spi)
return ret;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return buf_len;
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t out_bytes, void *din, size_t in_bytes)
{
@@ -802,6 +797,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
+ .max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/nvidia/tegra210/spi.c b/src/soc/nvidia/tegra210/spi.c
index 292135542a..0987ddb53a 100644
--- a/src/soc/nvidia/tegra210/spi.c
+++ b/src/soc/nvidia/tegra210/spi.c
@@ -750,11 +750,6 @@ static int xfer_finish(struct tegra_spi_channel *spi)
return ret;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return buf_len;
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t out_bytes, void *din, size_t in_bytes)
{
@@ -838,6 +833,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
+ .max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/qualcomm/ipq40xx/spi.c b/src/soc/qualcomm/ipq40xx/spi.c
index 68c2dd0b72..b5c1f6699a 100644
--- a/src/soc/qualcomm/ipq40xx/spi.c
+++ b/src/soc/qualcomm/ipq40xx/spi.c
@@ -410,11 +410,6 @@ static void enable_io_config(struct ipq_spi_slave *ds,
return;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(MAX_PACKET_COUNT, buf_len);
-}
-
/*
* Function to read bytes number of data from the Input FIFO
*/
@@ -657,6 +652,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
+ .max_xfer_size = MAX_PACKET_COUNT,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/qualcomm/ipq806x/spi.c b/src/soc/qualcomm/ipq806x/spi.c
index e907729a13..9a34f7a948 100644
--- a/src/soc/qualcomm/ipq806x/spi.c
+++ b/src/soc/qualcomm/ipq806x/spi.c
@@ -683,11 +683,6 @@ static int spi_xfer_rx_packet(struct ipq_spi_slave *ds,
return config_spi_state(ds, SPI_RESET_STATE);
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(MAX_PACKET_COUNT, buf_len);
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t out_bytes, void *din, size_t in_bytes)
{
@@ -761,6 +756,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
+ .max_xfer_size = MAX_PACKET_COUNT,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/rockchip/common/spi.c b/src/soc/rockchip/common/spi.c
index 16143b5ac8..0e7376945b 100644
--- a/src/soc/rockchip/common/spi.c
+++ b/src/soc/rockchip/common/spi.c
@@ -251,11 +251,6 @@ static int do_xfer(struct rockchip_spi *regs, bool use_16bit, const void *dout,
return 0;
}
-unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len)
-{
- return min(65535, buf_len);
-}
-
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
size_t bytes_out, void *din, size_t bytes_in)
{
@@ -332,6 +327,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
+ .max_xfer_size = 65535,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)
diff --git a/src/soc/samsung/exynos5420/spi.c b/src/soc/samsung/exynos5420/spi.c
index f17566e2c5..c2a5828f14 100644
--- a/src/soc/samsung/exynos5420/spi.c
+++ b/src/soc/samsung/exynos5420/spi.c
@@ -212,6 +212,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.claim_bus = spi_ctrlr_claim_bus,
.release_bus = spi_ctrlr_release_bus,
.xfer = spi_ctrlr_xfer,
+ .max_xfer_size = SPI_CTRLR_DEFAULT_MAX_XFER_SIZE,
};
int spi_setup_slave(unsigned int bus, unsigned int cs, struct spi_slave *slave)