summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/spi-generic.h17
-rw-r--r--src/soc/intel/baytrail/spi.c10
-rw-r--r--src/soc/intel/fsp_baytrail/spi.c10
-rw-r--r--src/soc/nvidia/tegra124/spi.c24
-rw-r--r--src/soc/samsung/exynos5420/spi.c16
-rw-r--r--src/southbridge/amd/agesa/hudson/spi.c8
-rw-r--r--src/southbridge/amd/cimx/sb800/spi.c8
-rw-r--r--src/southbridge/intel/common/spi.c10
-rw-r--r--src/southbridge/intel/fsp_rangeley/spi.c10
9 files changed, 10 insertions, 103 deletions
diff --git a/src/include/spi-generic.h b/src/include/spi-generic.h
index 931376db3e..bd0020f5d2 100644
--- a/src/include/spi-generic.h
+++ b/src/include/spi-generic.h
@@ -117,23 +117,6 @@ int spi_xfer(struct spi_slave *slave, const void *dout, unsigned int bytesout,
void *din, unsigned int bytesin);
-/*-----------------------------------------------------------------------
- * Activate a SPI chipselect.
- * This function is provided by the board code when using a driver
- * that can't control its chipselects automatically (e.g.
- * common/soft_spi.c). When called, it should activate the chip select
- * to the device identified by "slave".
- */
-void spi_cs_activate(struct spi_slave *slave);
-
-/*-----------------------------------------------------------------------
- * Deactivate a SPI chipselect.
- * This function is provided by the board code when using a driver
- * that can't control its chipselects automatically (e.g.
- * common/soft_spi.c). When called, it should deactivate the chip
- * select to the device identified by "slave".
- */
-void spi_cs_deactivate(struct spi_slave *slave);
unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len);
diff --git a/src/soc/intel/baytrail/spi.c b/src/soc/intel/baytrail/spi.c
index 7dd21e849e..64aeb9bcc9 100644
--- a/src/soc/intel/baytrail/spi.c
+++ b/src/soc/intel/baytrail/spi.c
@@ -327,16 +327,6 @@ void spi_release_bus(struct spi_slave *slave)
/* Handled by ICH automatically. */
}
-void spi_cs_activate(struct spi_slave *slave)
-{
- /* Handled by ICH automatically. */
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
- /* Handled by ICH automatically. */
-}
-
typedef struct spi_transaction {
const uint8_t *out;
uint32_t bytesout;
diff --git a/src/soc/intel/fsp_baytrail/spi.c b/src/soc/intel/fsp_baytrail/spi.c
index f62164a4a2..0c3c63d8da 100644
--- a/src/soc/intel/fsp_baytrail/spi.c
+++ b/src/soc/intel/fsp_baytrail/spi.c
@@ -325,16 +325,6 @@ void spi_release_bus(struct spi_slave *slave)
/* Handled by ICH automatically. */
}
-void spi_cs_activate(struct spi_slave *slave)
-{
- /* Handled by ICH automatically. */
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
- /* Handled by ICH automatically. */
-}
-
typedef struct spi_transaction {
const uint8_t *out;
uint32_t bytesout;
diff --git a/src/soc/nvidia/tegra124/spi.c b/src/soc/nvidia/tegra124/spi.c
index 7ad771633c..841a3c109b 100644
--- a/src/soc/nvidia/tegra124/spi.c
+++ b/src/soc/nvidia/tegra124/spi.c
@@ -212,11 +212,13 @@ static unsigned int tegra_spi_speed(unsigned int bus)
return 50000000;
}
-void spi_cs_activate(struct spi_slave *slave)
+int spi_claim_bus(struct spi_slave *slave)
{
struct tegra_spi_regs *regs = to_tegra_spi(slave->bus)->regs;
u32 val;
+ tegra_spi_init(slave->bus);
+
val = read32(&regs->command1);
/* select appropriate chip-select line */
@@ -230,9 +232,10 @@ void spi_cs_activate(struct spi_slave *slave)
val |= SPI_CMD1_CS_SW_VAL;
write32(val, &regs->command1);
+ return 0;
}
-void spi_cs_deactivate(struct spi_slave *slave)
+void spi_release_bus(struct spi_slave *slave)
{
struct tegra_spi_regs *regs = to_tegra_spi(slave->bus)->regs;
u32 val;
@@ -848,8 +851,7 @@ static size_t tegra_spi_cbfs_read(struct cbfs_media *media, void *dest,
spi_read_cmd[2] = (offset >> 8) & 0xff;
spi_read_cmd[3] = offset & 0xff;
- /* assert /CS */
- spi_cs_activate(spi->slave);
+ spi_claim_bus(spi->slave);
if (spi_xfer(spi->slave, spi_read_cmd,
read_cmd_bytes, NULL, 0) < 0) {
@@ -872,7 +874,7 @@ static size_t tegra_spi_cbfs_read(struct cbfs_media *media, void *dest,
tegra_spi_cbfs_read_exit:
/* de-assert /CS */
- spi_cs_deactivate(spi->slave);
+ spi_release_bus(spi->slave);
return (ret < 0) ? 0 : ret;
}
@@ -933,15 +935,3 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
return &channel->slave;
}
-
-int spi_claim_bus(struct spi_slave *slave)
-{
- tegra_spi_init(slave->bus);
- spi_cs_activate(slave);
- return 0;
-}
-
-void spi_release_bus(struct spi_slave *slave)
-{
- spi_cs_deactivate(slave);
-}
diff --git a/src/soc/samsung/exynos5420/spi.c b/src/soc/samsung/exynos5420/spi.c
index 31611e3ed6..36742a7279 100644
--- a/src/soc/samsung/exynos5420/spi.c
+++ b/src/soc/samsung/exynos5420/spi.c
@@ -133,22 +133,11 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
return &eslave->slave;
}
-void spi_cs_activate(struct spi_slave *slave)
+int spi_claim_bus(struct spi_slave *slave)
{
struct exynos_spi *regs = to_exynos_spi(slave)->regs;
// TODO(hungte) Add some delay if too many transactions happen at once.
clrbits_le32(&regs->cs_reg, SPI_SLAVE_SIG_INACT);
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
- struct exynos_spi *regs = to_exynos_spi(slave)->regs;
- setbits_le32(&regs->cs_reg, SPI_SLAVE_SIG_INACT);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
-{
- spi_cs_activate(slave);
return 0;
}
@@ -231,7 +220,8 @@ int spi_xfer(struct spi_slave *slave, const void *dout, unsigned int bytes_out,
void spi_release_bus(struct spi_slave *slave)
{
- spi_cs_deactivate(slave);
+ struct exynos_spi *regs = to_exynos_spi(slave)->regs;
+ setbits_le32(&regs->cs_reg, SPI_SLAVE_SIG_INACT);
}
static int exynos_spi_read(struct spi_slave *slave, void *dest, uint32_t len,
diff --git a/src/southbridge/amd/agesa/hudson/spi.c b/src/southbridge/amd/agesa/hudson/spi.c
index bbf6dd3ee2..735ab7ed16 100644
--- a/src/southbridge/amd/agesa/hudson/spi.c
+++ b/src/southbridge/amd/agesa/hudson/spi.c
@@ -182,14 +182,6 @@ void spi_release_bus(struct spi_slave *slave)
#endif
}
-void spi_cs_activate(struct spi_slave *slave)
-{
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
-}
-
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
struct spi_slave *slave = malloc(sizeof(*slave));
diff --git a/src/southbridge/amd/cimx/sb800/spi.c b/src/southbridge/amd/cimx/sb800/spi.c
index f38e691254..c84eee20c2 100644
--- a/src/southbridge/amd/cimx/sb800/spi.c
+++ b/src/southbridge/amd/cimx/sb800/spi.c
@@ -174,14 +174,6 @@ void spi_release_bus(struct spi_slave *slave)
#endif
}
-void spi_cs_activate(struct spi_slave *slave)
-{
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
-}
-
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
struct spi_slave *slave = malloc(sizeof(*slave));
diff --git a/src/southbridge/intel/common/spi.c b/src/southbridge/intel/common/spi.c
index c35e8b7413..48c72b7737 100644
--- a/src/southbridge/intel/common/spi.c
+++ b/src/southbridge/intel/common/spi.c
@@ -371,16 +371,6 @@ void spi_release_bus(struct spi_slave *slave)
/* Handled by ICH automatically. */
}
-void spi_cs_activate(struct spi_slave *slave)
-{
- /* Handled by ICH automatically. */
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
- /* Handled by ICH automatically. */
-}
-
typedef struct spi_transaction {
const uint8_t *out;
uint32_t bytesout;
diff --git a/src/southbridge/intel/fsp_rangeley/spi.c b/src/southbridge/intel/fsp_rangeley/spi.c
index 33f645945f..ee22019ade 100644
--- a/src/southbridge/intel/fsp_rangeley/spi.c
+++ b/src/southbridge/intel/fsp_rangeley/spi.c
@@ -447,16 +447,6 @@ void spi_release_bus(struct spi_slave *slave)
/* Handled by ICH automatically. */
}
-void spi_cs_activate(struct spi_slave *slave)
-{
- /* Handled by ICH automatically. */
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
- /* Handled by ICH automatically. */
-}
-
typedef struct spi_transaction {
const uint8_t *out;
uint32_t bytesout;