Message ID | eb805b97a0ca48cc68e26c3a5d329547198fc524.1485179128.git-series.maxime.ripard@free-electrons.com |
---|---|
State | Superseded |
Delegated to: | Jagannadha Sutradharudu Teki |
Headers | show |
On Mon, Jan 23, 2017 at 2:46 PM, Maxime Ripard <maxime.ripard@free-electrons.com> wrote: > The environment location is something that might change per board > (depending on what storage options are availaible there) or depending on > the user choice (when we have several options). > > Instead of hardcoding it in our configuration header, create a Kconfig > choice with the options we use for now, and the symbols that depend on it. > > Once done, also remove the irrelevant sunxi defines. > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> > Reviewed-by: Tom Rini <trini@konsulko.com> > --- > common/Kconfig | 69 +++++++++++++++++++++++++++++++++++- > include/configs/sunxi-common.h | 14 +------ > include/environment.h | 2 +- > 3 files changed, 74 insertions(+), 11 deletions(-) > > diff --git a/common/Kconfig b/common/Kconfig > index a04ee1084fed..e8c88f4ee258 100644 > --- a/common/Kconfig > +++ b/common/Kconfig > @@ -158,6 +158,75 @@ config SPI_BOOT > > endmenu > > +menu "Environment" > + > +if ARCH_SUNXI Why we need this arch specific on common, since all these ENV_* are common for all?
Hi Jagan, On Thu, Jan 26, 2017 at 12:49:49PM +0100, Jagan Teki wrote: > On Mon, Jan 23, 2017 at 2:46 PM, Maxime Ripard > <maxime.ripard@free-electrons.com> wrote: > > The environment location is something that might change per board > > (depending on what storage options are availaible there) or depending on > > the user choice (when we have several options). > > > > Instead of hardcoding it in our configuration header, create a Kconfig > > choice with the options we use for now, and the symbols that depend on it. > > > > Once done, also remove the irrelevant sunxi defines. > > > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> > > Reviewed-by: Tom Rini <trini@konsulko.com> > > --- > > common/Kconfig | 69 +++++++++++++++++++++++++++++++++++- > > include/configs/sunxi-common.h | 14 +------ > > include/environment.h | 2 +- > > 3 files changed, 74 insertions(+), 11 deletions(-) > > > > diff --git a/common/Kconfig b/common/Kconfig > > index a04ee1084fed..e8c88f4ee258 100644 > > --- a/common/Kconfig > > +++ b/common/Kconfig > > @@ -158,6 +158,75 @@ config SPI_BOOT > > > > endmenu > > > > +menu "Environment" > > + > > +if ARCH_SUNXI > > Why we need this arch specific on common, since all these ENV_* are > common for all? Precisely because it's common for all. Otherwise we'll get warnings about the symbol being defined multiple times. Maxime
diff --git a/common/Kconfig b/common/Kconfig index a04ee1084fed..e8c88f4ee258 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -158,6 +158,75 @@ config SPI_BOOT endmenu +menu "Environment" + +if ARCH_SUNXI + +choice + prompt "Environment Device" + default ENV_IS_IN_MMC if ARCH_SUNXI + +config ENV_IS_IN_MMC + bool "Environment in an MMC device" + depends on CMD_MMC + help + Define this if you have an MMC device which you want to use for the + environment. + +config ENV_IS_IN_NAND + bool "Environment in a NAND device" + depends on CMD_NAND + help + Define this if you have a NAND device which you want to use for the + environment. + +config ENV_IS_IN_UBI + bool "Environment in a UBI volume" + depends on CMD_UBI + depends on CMD_MTDPARTS + help + Define this if you have a UBI volume which you want to use for the + environment. + +config ENV_IS_NOWHERE + bool "Environment is not stored" + help + Define this if you don't want to or can't have an environment stored + on a storage medium + +endchoice + +config ENV_OFFSET + hex "Environment Offset" + depends on !ENV_IS_IN_UBI + depends on !ENV_IS_NOWHERE + default 0x88000 if ARCH_SUNXI + help + Offset from the start of the device (or partition) + +config ENV_SIZE + hex "Environment Size" + depends on !ENV_IS_NOWHERE + default 0x20000 if ARCH_SUNXI + help + Size of the environment storage area + +config ENV_UBI_PART + string "UBI partition name" + depends on ENV_IS_IN_UBI + help + MTD partition containing the UBI device + +config ENV_UBI_VOLUME + string "UBI volume name" + depends on ENV_IS_IN_UBI + help + Name of the volume that you want to store the environment in. + +endif + +endmenu + config BOOTDELAY int "delay in seconds before automatically booting" default 2 diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index d58e5bacae5e..254708596eca 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -142,7 +142,9 @@ #ifdef CONFIG_MMC #define CONFIG_GENERIC_MMC #define CONFIG_MMC_SUNXI_SLOT 0 -#define CONFIG_ENV_IS_IN_MMC +#endif + +#if defined(CONFIG_ENV_IS_IN_MMC) #define CONFIG_SYS_MMC_ENV_DEV 0 /* first detected MMC controller */ #define CONFIG_SYS_MMC_MAX_DEVICE 4 #endif @@ -175,9 +177,6 @@ #define CONFIG_SYS_MONITOR_LEN (768 << 10) /* 768 KiB */ -#define CONFIG_ENV_OFFSET (544 << 10) /* (8 + 24 + 512) KiB */ -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ - #define CONFIG_FAT_WRITE /* enable write access */ #define CONFIG_SPL_FRAMEWORK @@ -350,13 +349,6 @@ extern int soft_i2c_gpio_scl; #define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE #endif -#if !defined CONFIG_ENV_IS_IN_MMC && \ - !defined CONFIG_ENV_IS_IN_NAND && \ - !defined CONFIG_ENV_IS_IN_FAT && \ - !defined CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_IS_NOWHERE -#endif - #define CONFIG_MISC_INIT_R #ifndef CONFIG_SPL_BUILD diff --git a/include/environment.h b/include/environment.h index b602e8ac46b6..6f94986c6b3e 100644 --- a/include/environment.h +++ b/include/environment.h @@ -8,6 +8,8 @@ #ifndef _ENVIRONMENT_H_ #define _ENVIRONMENT_H_ +#include <linux/kconfig.h> + /************************************************************************** * * The "environment" is stored as a list of '\0' terminated