Convert CONFIG_ENV_SPI_BUS et al to Kconfig

This converts the following to Kconfig:
   CONFIG_ENV_SPI_BUS
   CONFIG_ENV_SPI_CS
   CONFIG_ENV_SPI_MAX_HZ
   CONFIG_ENV_SPI_MODE

As part of this, we use Kconfig to provide the defaults now that were
done in include/spi_flash.h.  We also in some cases change from using
CONFIG_ENV_SPI_FOO to CONFIG_SF_DEFAULT_FOO as those were the values in
use anyhow as ENV was not enabled.

Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Tom Rini
2021-12-11 14:55:48 -05:00
parent 5fd4a7ed0c
commit 7e6a6fd821
94 changed files with 40 additions and 256 deletions

View File

@@ -57,7 +57,7 @@ config SF_DEFAULT_CS
config SF_DEFAULT_MODE
hex "SPI Flash default mode (see include/spi.h)"
depends on SPI_FLASH || DM_SPI_FLASH
default 0
default 0x0
help
The default mode may be provided by the platform
to handle the common case when only a single serial

View File

@@ -387,8 +387,8 @@ int fm_init_common(int index, struct ccsr_fman *reg)
struct udevice *new;
/* speed and mode will be read from DT */
ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS,
CONFIG_ENV_SPI_CS, 0, 0, &new);
ret = spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS,
CONFIG_SF_DEFAULT_CS, 0, 0, &new);
ucode_flash = dev_get_uclass_priv(new);
#else
@@ -474,7 +474,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
struct udevice *new;
/* speed and mode will be read from DT */
ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
ret = spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS,
0, 0, &new);
ucode_flash = dev_get_uclass_priv(new);

View File

@@ -9,4 +9,20 @@ config SYS_FSL_PFE_ADDR
hex "PFE base address"
default 0x04000000
config SYS_FSL_PFE_SPI_BUS
int "Value of SPI flash bus for PFE firmware"
default SF_DEFAULT_BUS
config SYS_FSL_PFE_SPI_CS
int "Value of SPI flash chip select for PFE firmware"
default SF_DEFAULT_CS
config SYS_FSL_PFE_SPI_MAX_HZ
int "Value of SPI flash max frequency for PFE firmware"
default SF_DEFAULT_SPEED
config SYS_FSL_PFE_SPI_MODE
hex "Value of SPI flash work mode for PFE firmware"
default SF_DEFAULT_MODE
endif

View File

@@ -179,10 +179,10 @@ int pfe_spi_flash_init(void)
if (!addr)
return -ENOMEM;
ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS,
CONFIG_ENV_SPI_CS,
CONFIG_ENV_SPI_MAX_HZ,
CONFIG_ENV_SPI_MODE,
ret = spi_flash_probe_bus_cs(CONFIG_SYS_FSL_PFE_SPI_BUS,
CONFIG_SYS_FSL_PFE_SPI_CS,
CONFIG_SYS_FSL_PFE_SPI_MAX_HZ,
CONFIG_SYS_FSL_PFE_SPI_MODE,
&new);
if (ret) {
printf("SF: failed to probe spi\n");

View File

@@ -159,8 +159,8 @@ void cs4340_upload_firmware(struct phy_device *phydev)
struct spi_flash *ucode_flash;
addr = malloc(CONFIG_CORTINA_FW_LENGTH);
ucode_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
ucode_flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS,
CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE);
if (!ucode_flash) {
puts("SF: probe for Cortina ucode failed\n");
} else {
@@ -212,8 +212,8 @@ void cs4340_upload_firmware(struct phy_device *phydev)
struct spi_flash *ucode_flash;
addr = malloc(CONFIG_CORTINA_FW_LENGTH);
ucode_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
ucode_flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS,
CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE);
if (!ucode_flash) {
puts("SF: probe for Cortina ucode failed\n");
} else {