Commit 55dabcc8 authored by Tom Rini's avatar Tom Rini
Browse files

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY



First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig.  Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL.  Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support.  Convert all of the existing users to
one or more symbols.
Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
parent 5b422551
......@@ -1461,11 +1461,7 @@ The following options need to be configured:
In such cases CONFIG_GPIO_LED_INVERTED_TABLE may be defined
with a list of GPIO LEDs that have inverted polarity.
- I2C Support: CONFIG_SYS_I2C_LEGACY
Note: This is deprecated in favour of driver model. Use
CONFIG_DM_I2C instead.
- I2C Support:
- drivers/i2c/fsl_i2c.c:
- activate i2c driver with CONFIG_SYS_I2C_FSL
define CONFIG_SYS_FSL_I2C_OFFSET for setting the register
......
......@@ -121,6 +121,7 @@ config ARCH_LS1046A
imply ID_EEPROM
imply SCSI
imply SCSI_AHCI
imply SPL_SYS_I2C_LEGACY
config ARCH_LS1088A
bool
......@@ -162,6 +163,7 @@ config ARCH_LS1088A
select RESV_RAM if GIC_V3_ITS
imply ID_EEPROM
imply SCSI
imply SPL_SYS_I2C_LEGACY
imply PANIC_HANG
config ARCH_LS2080A
......@@ -215,6 +217,7 @@ config ARCH_LS2080A
imply DISTRO_DEFAULTS
imply ID_EEPROM
imply PANIC_HANG
imply SPL_SYS_I2C_LEGACY
config ARCH_LX2162A
bool
......@@ -246,6 +249,7 @@ config ARCH_LX2162A
imply PANIC_HANG
imply SCSI
imply SCSI_AHCI
imply SPL_SYS_I2C_LEGACY
config ARCH_LX2160A
bool
......@@ -280,6 +284,7 @@ config ARCH_LX2160A
imply PANIC_HANG
imply SCSI
imply SCSI_AHCI
imply SPL_SYS_I2C_LEGACY
config FSL_LSCH2
bool
......
......@@ -329,7 +329,7 @@ static void erratum_rcw_src(void)
#ifdef CONFIG_SYS_FSL_ERRATUM_A009203
static void erratum_a009203(void)
{
#ifdef CONFIG_SYS_I2C_LEGACY
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
u8 __iomem *ptr;
#ifdef I2C1_BASE_ADDR
ptr = (u8 __iomem *)(I2C1_BASE_ADDR + I2C_DEBUG_REG);
......
......@@ -88,7 +88,7 @@ void board_init_f(ulong dummy)
preloader_console_init();
spl_set_bd();
#ifdef CONFIG_SYS_I2C_LEGACY
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
#ifdef CONFIG_SPL_I2C
i2c_init_all();
#endif
......
......@@ -184,7 +184,6 @@
#define TZPC_BASE 0x02200000
#define TZPCDECPROT_0_SET_BASE (TZPC_BASE + 0x804)
#if !CONFIG_IS_ENABLED(DM_I2C)
#define CONFIG_SYS_I2C_LEGACY
#define CONFIG_SYS_I2C_EARLY_INIT
#endif
#define SRDS_MAX_LANES 8
......
......@@ -95,9 +95,6 @@
* I2C related stuff
*/
#if defined(CONFIG_CMD_I2C) && !CONFIG_IS_ENABLED(DM_I2C)
#ifndef CONFIG_SYS_I2C_SOFT
#define CONFIG_SYS_I2C_LEGACY
#endif
#define CONFIG_SYS_I2C_SLAVE 0x0
#define CONFIG_SYS_I2C_SPEED 100000
#endif
......
......@@ -209,6 +209,8 @@ config MACH_SUN4I
select DRAM_SUN4I
select SUNXI_GEN_SUN4I
select SUPPORT_SPL
imply SPL_SYS_I2C_LEGACY
imply SYS_I2C_LEGACY
config MACH_SUN5I
bool "sun5i (Allwinner A13)"
......@@ -219,6 +221,8 @@ config MACH_SUN5I
select SUNXI_GEN_SUN4I
select SUPPORT_SPL
imply CONS_INDEX_2 if !DM_SERIAL
imply SPL_SYS_I2C_LEGACY
imply SYS_I2C_LEGACY
config MACH_SUN6I
bool "sun6i (Allwinner A31)"
......@@ -245,6 +249,8 @@ config MACH_SUN7I
select SUNXI_GEN_SUN4I
select SUPPORT_SPL
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
imply SPL_SYS_I2C_LEGACY
imply SYS_I2C_LEGACY
config MACH_SUN8I_A23
bool "sun8i (Allwinner A23)"
......@@ -303,6 +309,7 @@ config MACH_SUN8I_R40
select SUNXI_DRAM_DW
select SUNXI_DRAM_DW_32BIT
select PHY_SUN4I_USB
imply SPL_SYS_I2C_LEGACY
config MACH_SUN8I_V3S
bool "sun8i (Allwinner V3/V3s/S3/S3L)"
......
......@@ -106,7 +106,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
env_relocate();
#endif
#ifdef CONFIG_SYS_I2C_LEGACY
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
i2c_init_all();
#else
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
......
......@@ -5,6 +5,6 @@
# Author: Igor Grinberg <grinberg@compulab.co.il>
obj-y += common.o
obj-$(CONFIG_SYS_I2C_LEGACY) += eeprom.o
obj-$(CONFIG_$(SPL_)SYS_I2C_LEGACY) += eeprom.o
obj-$(CONFIG_LCD) += omap3_display.o
obj-$(CONFIG_SMC911X) += omap3_smc911x.o
......@@ -10,7 +10,7 @@
#define _EEPROM_
#include <errno.h>
#ifdef CONFIG_SYS_I2C_LEGACY
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus);
u32 cl_eeprom_get_board_rev(uint eeprom_bus);
int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus);
......
......@@ -99,7 +99,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
env_relocate();
#endif
#ifdef CONFIG_SYS_I2C_LEGACY
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
i2c_init_all();
#else
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
......
......@@ -38,7 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
int board_early_init_f(void)
{
#if defined(CONFIG_SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH)
/* DVFS for reset */
mstp_clrbits_le32(SMSTPCR9, SMSTPCR9, DVFS_MSTP926);
#endif
......
......@@ -37,7 +37,7 @@ DECLARE_GLOBAL_DATA_PTR;
int board_early_init_f(void)
{
#if defined(CONFIG_SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH)
/* DVFS for reset */
mstp_clrbits_le32(SMSTPCR9, SMSTPCR9, DVFS_MSTP926);
#endif
......@@ -75,7 +75,7 @@ int board_init(void)
void reset_cpu(void)
{
#if defined(CONFIG_SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH)
i2c_reg_write(CONFIG_SYS_I2C_POWERIC_ADDR, 0x20, 0x80);
#else
/* only CA57 ? */
......
......@@ -35,7 +35,7 @@ DECLARE_GLOBAL_DATA_PTR;
int board_early_init_f(void)
{
#if defined(CONFIG_SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH)
/* DVFS for reset */
mstp_clrbits_le32(SMSTPCR9, SMSTPCR9, DVFS_MSTP926);
#endif
......
......@@ -104,7 +104,7 @@ int board_init(void)
/* Address of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
#ifdef CONFIG_SYS_I2C_LEGACY
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
#endif
......
......@@ -171,7 +171,7 @@ int board_spi_cs_gpio(unsigned bus, unsigned cs)
#endif
#endif
#ifdef CONFIG_SYS_I2C_LEGACY
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
static struct i2c_pads_info tqma6_i2c3_pads = {
/* I2C3: on board LM75, M24C64, */
.scl = {
......@@ -216,7 +216,7 @@ int board_init(void)
#ifndef CONFIG_DM_SPI
tqma6_iomuxc_spi();
#endif
#ifdef CONFIG_SYS_I2C_LEGACY
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
tqma6_setup_i2c();
#endif
......
......@@ -49,7 +49,7 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
}
#elif defined(CONFIG_SYS_I2C_LEGACY)
#elif CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
old_bus = i2c_get_bus_num();
i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM);
#else
......@@ -122,7 +122,7 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
}
/* switch back to original I2C bus */
#ifdef CONFIG_SYS_I2C_LEGACY
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
i2c_set_bus_num(old_bus);
#elif !defined(CONFIG_DM_RTC)
I2C_SET_BUS(old_bus);
......
......@@ -52,7 +52,7 @@ void eeprom_init(int bus)
/* I2C EEPROM */
#if CONFIG_IS_ENABLED(DM_I2C)
eeprom_i2c_bus = bus;
#elif defined(CONFIG_SYS_I2C_LEGACY)
#elif CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
if (bus >= 0)
i2c_set_bus_num(bus);
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
......
......@@ -98,7 +98,7 @@ static uint i2c_mm_last_alen;
* pairs. The following macros take care of this */
#if defined(CONFIG_SYS_I2C_NOPROBES)
#if defined(CONFIG_SYS_I2C_LEGACY) || defined(CONFIG_I2C_MULTI_BUS)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || defined(CONFIG_I2C_MULTI_BUS)
static struct
{
uchar bus;
......@@ -114,7 +114,7 @@ static uchar i2c_no_probes[] = CONFIG_SYS_I2C_NOPROBES;
#define COMPARE_BUS(b,i) ((b) == 0) /* Make compiler happy */
#define COMPARE_ADDR(a,i) (i2c_no_probes[(i)] == (a))
#define NO_PROBE_ADDR(i) i2c_no_probes[(i)]
#endif /* defined(CONFIG_SYS_I2C_LEGACY) */
#endif /* CONFIG_IS_ENABLED(SYS_I2C_LEGACY) */
#endif
#define DISP_LINE_LEN 16
......@@ -209,7 +209,7 @@ void i2c_init_board(void)
*
* Returns I2C bus speed in Hz.
*/
#if !defined(CONFIG_SYS_I2C_LEGACY) && !CONFIG_IS_ENABLED(DM_I2C)
#if !CONFIG_IS_ENABLED(SYS_I2C_LEGACY) && !CONFIG_IS_ENABLED(DM_I2C)
/*
* TODO: Implement architecture-specific get/set functions
* Should go away, if we switched completely to new multibus support
......@@ -1725,7 +1725,7 @@ static void show_bus(struct udevice *bus)
*
* Returns zero always.
*/
#if defined(CONFIG_SYS_I2C_LEGACY) || CONFIG_IS_ENABLED(DM_I2C)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || CONFIG_IS_ENABLED(DM_I2C)
static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
......@@ -1811,7 +1811,7 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
#if defined(CONFIG_SYS_I2C_LEGACY) || defined(CONFIG_I2C_MULTI_BUS) || \
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || defined(CONFIG_I2C_MULTI_BUS) || \
CONFIG_IS_ENABLED(DM_I2C)
static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
......@@ -1834,7 +1834,7 @@ static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
printf("Current bus is %d\n", bus_no);
} else {
bus_no = dectoul(argv[1], NULL);
#if defined(CONFIG_SYS_I2C_LEGACY)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
if (bus_no >= CONFIG_SYS_NUM_I2C_BUSES) {
printf("Invalid bus %d\n", bus_no);
return -1;
......@@ -1852,7 +1852,7 @@ static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
return ret ? CMD_RET_FAILURE : 0;
}
#endif /* defined(CONFIG_SYS_I2C_LEGACY) */
#endif /* CONFIG_IS_ENABLED(SYS_I2C_LEGACY) */
/**
* do_i2c_bus_speed() - Handle the "i2c speed" command-line command
......@@ -1951,7 +1951,7 @@ static int do_i2c_reset(struct cmd_tbl *cmdtp, int flag, int argc,
printf("Error: Not supported by the driver\n");
return CMD_RET_FAILURE;
}
#elif defined(CONFIG_SYS_I2C_LEGACY)
#elif CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
i2c_init(I2C_ADAP->speed, I2C_ADAP->slaveaddr);
#else
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
......@@ -1960,11 +1960,11 @@ static int do_i2c_reset(struct cmd_tbl *cmdtp, int flag, int argc,
}
static struct cmd_tbl cmd_i2c_sub[] = {
#if defined(CONFIG_SYS_I2C_LEGACY) || CONFIG_IS_ENABLED(DM_I2C)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || CONFIG_IS_ENABLED(DM_I2C)
U_BOOT_CMD_MKENT(bus, 1, 1, do_i2c_show_bus, "", ""),
#endif
U_BOOT_CMD_MKENT(crc32, 3, 1, do_i2c_crc, "", ""),
#if defined(CONFIG_SYS_I2C_LEGACY) || \
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || \
defined(CONFIG_I2C_MULTI_BUS) || CONFIG_IS_ENABLED(DM_I2C)
U_BOOT_CMD_MKENT(dev, 1, 1, do_i2c_bus_num, "", ""),
#endif /* CONFIG_I2C_MULTI_BUS */
......@@ -2036,12 +2036,12 @@ static int do_i2c(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/***************************************************/
#ifdef CONFIG_SYS_LONGHELP
static char i2c_help_text[] =
#if defined(CONFIG_SYS_I2C_LEGACY) || CONFIG_IS_ENABLED(DM_I2C)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || CONFIG_IS_ENABLED(DM_I2C)
"bus [muxtype:muxaddr:muxchannel] - show I2C bus info\n"
"i2c " /* That's the prefix for the crc32 command below. */
#endif
"crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n"
#if defined(CONFIG_SYS_I2C_LEGACY) || \
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || \
defined(CONFIG_I2C_MULTI_BUS) || CONFIG_IS_ENABLED(DM_I2C)
"i2c dev [dev] - show or set current I2C bus\n"
#endif /* CONFIG_I2C_MULTI_BUS */
......
......@@ -244,7 +244,7 @@ __weak int dram_init_banksize(void)
return 0;
}
#if defined(CONFIG_SYS_I2C_LEGACY)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
static int init_func_i2c(void)
{
puts("I2C: ");
......@@ -871,7 +871,7 @@ static const init_fnc_t init_sequence_f[] = {
misc_init_f,
#endif
INIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_SYS_I2C_LEGACY)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
init_func_i2c,
#endif
#if defined(CONFIG_VID) && !defined(CONFIG_SPL)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment