summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-05-15 23:28:41 -0700
committerFurquan Shaikh <furquan@google.com>2017-05-19 21:22:41 +0200
commitbd9e32efdd8f06063c9ee37dd6d0bebf535b86c1 (patch)
tree3c9ed696ad5c71ce8616a3ddabb324b75d1f8061
parent7863395ad19b1c068479546e0b8b3eb3c828062a (diff)
downloadcoreboot-bd9e32efdd8f06063c9ee37dd6d0bebf535b86c1.tar.xz
drivers/spi/spi_flash: Pass in spi_slave structure as const to probe functions
Pointer to spi_slave structure can be passed in as const to spi flash probe functions since the probe functions do not need to modify the slave properties. BUG=b:38330715 Change-Id: I956ee777c62dbb811fd6ce2aeb6ae090e1892acd Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/19707 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/drivers/spi/adesto.c2
-rw-r--r--src/drivers/spi/amic.c2
-rw-r--r--src/drivers/spi/atmel.c2
-rw-r--r--src/drivers/spi/eon.c2
-rw-r--r--src/drivers/spi/gigadevice.c2
-rw-r--r--src/drivers/spi/macronix.c2
-rw-r--r--src/drivers/spi/spansion.c2
-rw-r--r--src/drivers/spi/spi_flash.c7
-rw-r--r--src/drivers/spi/spi_flash_internal.h20
-rw-r--r--src/drivers/spi/sst.c2
-rw-r--r--src/drivers/spi/stmicro.c2
-rw-r--r--src/drivers/spi/winbond.c2
-rw-r--r--src/include/spi_flash.h2
-rw-r--r--src/soc/intel/common/block/fast_spi/fast_spi_flash.c2
-rw-r--r--src/soc/mediatek/mt8173/flash_controller.c2
-rw-r--r--src/southbridge/intel/common/spi.c2
16 files changed, 28 insertions, 27 deletions
diff --git a/src/drivers/spi/adesto.c b/src/drivers/spi/adesto.c
index d062c36594..c22bec1879 100644
--- a/src/drivers/spi/adesto.c
+++ b/src/drivers/spi/adesto.c
@@ -126,7 +126,7 @@ out:
return ret;
}
-int spi_flash_probe_adesto(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_adesto(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct adesto_spi_flash_params *params;
diff --git a/src/drivers/spi/amic.c b/src/drivers/spi/amic.c
index cf5a29601d..e97a3625c5 100644
--- a/src/drivers/spi/amic.c
+++ b/src/drivers/spi/amic.c
@@ -109,7 +109,7 @@ out:
return ret;
}
-int spi_flash_probe_amic(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_amic(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct amic_spi_flash_params *params;
diff --git a/src/drivers/spi/atmel.c b/src/drivers/spi/atmel.c
index edc172e65f..b97f255223 100644
--- a/src/drivers/spi/atmel.c
+++ b/src/drivers/spi/atmel.c
@@ -154,7 +154,7 @@ out:
return ret;
}
-int spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_atmel(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct atmel_spi_flash_params *params;
diff --git a/src/drivers/spi/eon.c b/src/drivers/spi/eon.c
index f5a3af6892..ece9810e2d 100644
--- a/src/drivers/spi/eon.c
+++ b/src/drivers/spi/eon.c
@@ -126,7 +126,7 @@ out:
return ret;
}
-int spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_eon(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct eon_spi_flash_params *params;
diff --git a/src/drivers/spi/gigadevice.c b/src/drivers/spi/gigadevice.c
index 0b7173d608..f68be8b017 100644
--- a/src/drivers/spi/gigadevice.c
+++ b/src/drivers/spi/gigadevice.c
@@ -170,7 +170,7 @@ out:
return ret;
}
-int spi_flash_probe_gigadevice(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_gigadevice(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct gigadevice_spi_flash_params *params;
diff --git a/src/drivers/spi/macronix.c b/src/drivers/spi/macronix.c
index 87b6fd7c42..128d00fd0f 100644
--- a/src/drivers/spi/macronix.c
+++ b/src/drivers/spi/macronix.c
@@ -192,7 +192,7 @@ static int macronix_write(const struct spi_flash *flash, u32 offset, size_t len,
return ret;
}
-int spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_macronix(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct macronix_spi_flash_params *params;
diff --git a/src/drivers/spi/spansion.c b/src/drivers/spi/spansion.c
index a376b6e0a4..de7ad55a34 100644
--- a/src/drivers/spi/spansion.c
+++ b/src/drivers/spi/spansion.c
@@ -246,7 +246,7 @@ static int spansion_write(const struct spi_flash *flash, u32 offset, size_t len,
return ret;
}
-int spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_spansion(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct spansion_spi_flash_params *params;
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index 701033aaf3..096d7cd9bb 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -240,7 +240,7 @@ int spi_flash_cmd_status(const struct spi_flash *flash, u8 *reg)
static struct {
const u8 shift;
const u8 idcode;
- int (*probe) (struct spi_slave *spi, u8 *idcode,
+ int (*probe) (const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
} flashes[] = {
/* Keep it sorted by define name */
@@ -282,7 +282,7 @@ static struct {
#define IDCODE_LEN (IDCODE_CONT_LEN + IDCODE_PART_LEN)
int
-__attribute__((weak)) spi_flash_programmer_probe(struct spi_slave *spi,
+__attribute__((weak)) spi_flash_programmer_probe(const struct spi_slave *spi,
int force,
struct spi_flash *flash)
{
@@ -290,7 +290,8 @@ __attribute__((weak)) spi_flash_programmer_probe(struct spi_slave *spi,
return -1;
}
-static int __spi_flash_probe(struct spi_slave *spi, struct spi_flash *flash)
+static int __spi_flash_probe(const struct spi_slave *spi,
+ struct spi_flash *flash)
{
int ret, i, shift;
u8 idcode[IDCODE_LEN], *idp;
diff --git a/src/drivers/spi/spi_flash_internal.h b/src/drivers/spi/spi_flash_internal.h
index 55d3fa0c16..b42df59c7a 100644
--- a/src/drivers/spi/spi_flash_internal.h
+++ b/src/drivers/spi/spi_flash_internal.h
@@ -64,25 +64,25 @@ int spi_flash_cmd_erase(const struct spi_flash *flash, u32 offset, size_t len);
int spi_flash_cmd_status(const struct spi_flash *flash, u8 *reg);
/* Manufacturer-specific probe functions */
-int spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_spansion(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
-int spi_flash_probe_amic(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_amic(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
-int spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_atmel(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
-int spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_eon(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
-int spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_macronix(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
-int spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_sst(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
-int spi_flash_probe_stmicro(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_stmicro(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
-int spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_winbond(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
-int spi_flash_probe_gigadevice(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_gigadevice(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
-int spi_flash_probe_adesto(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_adesto(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash);
#endif /* SPI_FLASH_INTERNAL_H */
diff --git a/src/drivers/spi/sst.c b/src/drivers/spi/sst.c
index bf211571e1..5325ef4e86 100644
--- a/src/drivers/spi/sst.c
+++ b/src/drivers/spi/sst.c
@@ -314,7 +314,7 @@ sst_unlock(const struct spi_flash *flash)
return ret;
}
-int spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_sst(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct sst_spi_flash_params *params;
diff --git a/src/drivers/spi/stmicro.c b/src/drivers/spi/stmicro.c
index b7ceba21a8..fe8c4663fa 100644
--- a/src/drivers/spi/stmicro.c
+++ b/src/drivers/spi/stmicro.c
@@ -222,7 +222,7 @@ out:
return ret;
}
-int spi_flash_probe_stmicro(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_stmicro(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct stmicro_spi_flash_params *params;
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index c9d4aad4d6..9694f8aee4 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -184,7 +184,7 @@ out:
return ret;
}
-int spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode,
+int spi_flash_probe_winbond(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
const struct winbond_spi_flash_params *params;
diff --git a/src/include/spi_flash.h b/src/include/spi_flash.h
index 3b18717a86..bc0318c7a3 100644
--- a/src/include/spi_flash.h
+++ b/src/include/spi_flash.h
@@ -78,7 +78,7 @@ int spi_flash_probe(unsigned int bus, unsigned int cs, struct spi_flash *flash);
* 0 = success
* non-zero = error
*/
-int spi_flash_programmer_probe(struct spi_slave *spi, int force,
+int spi_flash_programmer_probe(const struct spi_slave *spi, int force,
struct spi_flash *flash);
/* All the following functions return 0 on success and non-zero on error. */
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 9f973b91ef..77801445be 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
@@ -280,7 +280,7 @@ static int fast_spi_flash_status(const struct spi_flash *flash,
* The size of the flash component is always taken from density field in the
* SFDP table. FLCOMP.C0DEN is no longer used by the Flash Controller.
*/
-int spi_flash_programmer_probe(struct spi_slave *dev,
+int spi_flash_programmer_probe(const struct spi_slave *dev,
int force, struct spi_flash *flash)
{
BOILERPLATE_CREATE_CTX(ctx);
diff --git a/src/soc/mediatek/mt8173/flash_controller.c b/src/soc/mediatek/mt8173/flash_controller.c
index 29a1c2f9a7..ee950b8f81 100644
--- a/src/soc/mediatek/mt8173/flash_controller.c
+++ b/src/soc/mediatek/mt8173/flash_controller.c
@@ -228,7 +228,7 @@ static int nor_erase(const struct spi_flash *flash, u32 offset, size_t len)
return 0;
}
-int spi_flash_programmer_probe(struct spi_slave *spi,
+int spi_flash_programmer_probe(const struct spi_slave *spi,
int force, struct spi_flash *flash)
{
static int done;
diff --git a/src/southbridge/intel/common/spi.c b/src/southbridge/intel/common/spi.c
index effcc80f1f..110c29c20d 100644
--- a/src/southbridge/intel/common/spi.c
+++ b/src/southbridge/intel/common/spi.c
@@ -899,7 +899,7 @@ static int ich_hwseq_write(const struct spi_flash *flash, u32 addr, size_t len,
return 0;
}
-int spi_flash_programmer_probe(struct spi_slave *spi,
+int spi_flash_programmer_probe(const struct spi_slave *spi,
int force, struct spi_flash *flash)
{
uint32_t flcomp;