spi: Remove unused parameters from spi_flash_probe and setup_spi_slave.

The spi_flash_probe and and spi_setup_slave functions each took a max_hz
parameter and a spi_mode parameter which were never used.

BUG=None
TEST=Built for link, falco, rambi, nyan.
BRANCH=None

Change-Id: I3a2e0a9ab530bcc0f722f81f00e8c7bd1f6d2a22
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://chromium-review.googlesource.com/192046
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
[km: cherry-pick from chromium]
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/6174
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
Gabe Black 2014-03-27 20:37:03 -07:00 committed by Kyösti Mälkki
parent ab60510818
commit 1e187356e8
17 changed files with 19 additions and 35 deletions

View File

@ -28,7 +28,7 @@ void spi_SaveS3info(u32 pos, u32 size, u8 *buf, u32 len)
struct spi_flash *flash;
spi_init();
flash = spi_flash_probe(0, 0, 0, 0);
flash = spi_flash_probe(0, 0);
if (!flash) {
printk(BIOS_DEBUG, "Could not find SPI device\n");
/* Dont make flow stop. */

View File

@ -79,8 +79,7 @@ void spi_init(void)
printk(BIOS_INFO, "Exynos SPI driver initiated.\n");
}
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
ASSERT(bus >= 0 && bus < 3);
return &(exynos_spi_slaves[bus].slave);

View File

@ -548,7 +548,7 @@ int elog_init(void)
/* Prepare SPI */
spi_init();
elog_spi = spi_flash_probe(0, 0, 0, 0);
elog_spi = spi_flash_probe(0, 0);
if (!elog_spi) {
printk(BIOS_ERR, "ELOG: Unable to find SPI flash\n");
return -1;

View File

@ -185,7 +185,7 @@ void update_mrc_cache(void *unused)
/* 1. use spi_flash_probe() to find the flash, then... */
spi_init();
struct spi_flash *flash = spi_flash_probe(0, 0, 1000000, SPI_MODE_3);
struct spi_flash *flash = spi_flash_probe(0, 0);
if (!flash) {
printk(BIOS_DEBUG, "Could not find SPI device\n");
return;

View File

@ -250,15 +250,14 @@ static struct {
};
#define IDCODE_LEN (IDCODE_CONT_LEN + IDCODE_PART_LEN)
struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int spi_mode)
struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs)
{
struct spi_slave *spi;
struct spi_flash *flash = NULL;
int ret, i, shift;
u8 idcode[IDCODE_LEN], *idp;
spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
spi = spi_setup_slave(bus, cs);
if (!spi) {
printk(BIOS_WARNING, "SF: Failed to set up slave\n");
return NULL;

View File

@ -23,8 +23,6 @@
#include "ec.h"
#include "ec_commands.h"
#define CROSEC_SPI_SPEED (500000)
static int crosec_spi_io(uint8_t *write_bytes, size_t write_size,
uint8_t *read_bytes, size_t read_size,
void *context)
@ -48,12 +46,9 @@ static int crosec_spi_io(uint8_t *write_bytes, size_t write_size,
int google_chromeec_command(struct chromeec_command *cec_command)
{
static struct spi_slave *slave = NULL;
if (!slave) {
if (!slave)
slave = spi_setup_slave(CONFIG_EC_GOOGLE_CHROMEEC_SPI_BUS,
CONFIG_EC_GOOGLE_CHROMEEC_SPI_CHIP,
CROSEC_SPI_SPEED,
SPI_READ_FLAG | SPI_WRITE_FLAG);
}
CONFIG_EC_GOOGLE_CHROMEEC_SPI_CHIP);
return crosec_command_proto(cec_command, crosec_spi_io, slave);
}

View File

@ -84,14 +84,11 @@ void spi_init(void);
*
* bus: Bus ID of the slave chip.
* cs: Chip select ID of the slave chip on the specified bus.
* max_hz: Maximum SCK rate in Hz.
* mode: Clock polarity, clock phase and other parameters.
*
* Returns: A spi_slave reference that can be used in subsequent SPI
* calls, or NULL if one or more of the parameters are not supported.
*/
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode);
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs);
/*-----------------------------------------------------------------------
* Claim the bus and prepare it for communication with a given slave.

View File

@ -64,8 +64,7 @@ struct spi_flash {
size_t len);
};
struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int spi_mode);
struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs);
static inline int spi_flash_read(struct spi_flash *flash, u32 offset,
size_t len, void *buf)

View File

@ -192,7 +192,7 @@ static void update_mrc_cache(void *unused)
// 1. use spi_flash_probe() to find the flash, then
spi_init();
struct spi_flash *flash = spi_flash_probe(0, 0, 1000000, SPI_MODE_3);
struct spi_flash *flash = spi_flash_probe(0, 0);
if (!flash) {
printk(BIOS_DEBUG, "Could not find SPI device\n");
return;

View File

@ -191,7 +191,7 @@ static void update_mrc_cache(void *unused)
// 1. use spi_flash_probe() to find the flash, then
spi_init();
struct spi_flash *flash = spi_flash_probe(0, 0, 1000000, SPI_MODE_3);
struct spi_flash *flash = spi_flash_probe(0, 0);
if (!flash) {
printk(BIOS_DEBUG, "Could not find SPI device\n");
return;

View File

@ -37,7 +37,7 @@ static int nvm_init(void)
return 0;
spi_init();
flash = spi_flash_probe(0, 0, 1000000, SPI_MODE_3);
flash = spi_flash_probe(0, 0);
if (!flash) {
printk(BIOS_DEBUG, "Could not find SPI device\n");
return -1;

View File

@ -272,8 +272,7 @@ int spi_cs_is_valid(unsigned int bus, unsigned int cs)
return 0;
}
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
ich_spi_slave *slave = malloc(sizeof(*slave));

View File

@ -38,7 +38,7 @@ static int nvm_init(void)
return 0;
spi_init();
flash = spi_flash_probe(0, 0, 1000000, SPI_MODE_3);
flash = spi_flash_probe(0, 0);
if (!flash) {
printk(BIOS_DEBUG, "Could not find SPI device\n");
return -1;

View File

@ -270,8 +270,7 @@ int spi_cs_is_valid(unsigned int bus, unsigned int cs)
return 0;
}
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
ich_spi_slave *slave = malloc(sizeof(*slave));

View File

@ -172,8 +172,7 @@ void spi_cs_deactivate(struct spi_slave *slave)
{
}
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
struct spi_slave *slave = malloc(sizeof(*slave));

View File

@ -164,8 +164,7 @@ void spi_cs_deactivate(struct spi_slave *slave)
{
}
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
struct spi_slave *slave = malloc(sizeof(*slave));

View File

@ -299,8 +299,7 @@ int spi_cs_is_valid(unsigned int bus, unsigned int cs)
return 0;
}
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
{
ich_spi_slave *slave = malloc(sizeof(*slave));