diff mbox

[U-Boot,3/6] sunxi: Turn MMC_SUNXI_SLOT_EXTRA into a proper Kconfig option

Message ID 1412348759-4599-4-git-send-email-hdegoede@redhat.com
State Superseded
Delegated to: Ian Campbell
Headers show

Commit Message

Hans de Goede Oct. 3, 2014, 3:05 p.m. UTC
Note we also drop the SPL check for initializing the 2nd mmc slot, the SPL
check is not necessary with Kconfig, because only options explicitly marked
as also being for the SPL get set during SPL builds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 board/sunxi/Kconfig | 8 ++++++++
 board/sunxi/board.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Ian Campbell Oct. 4, 2014, 8:32 a.m. UTC | #1
On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote:
> Note we also drop the SPL check for initializing the 2nd mmc slot, the SPL
> check is not necessary with Kconfig, because only options explicitly marked
> as also being for the SPL get set during SPL builds.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

If we come across a system with e.g. 3 slots then this is just going to
get more complex, isn't it? Shall we bite the bullet now and got
straight to a bool option per potential slot?

> ---
>  board/sunxi/Kconfig | 8 ++++++++
>  board/sunxi/board.c | 2 +-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
> index 72d6dfa..c9b459a 100644
> --- a/board/sunxi/Kconfig
> +++ b/board/sunxi/Kconfig
> @@ -32,6 +32,14 @@ config USB_KEYBOARD
>  	Say Y here to add support for using a USB keyboard (typically used
>  	in combination with a graphical console on HDMI).
>  
> +config MMC_SUNXI_SLOT_EXTRA
> +	int "mmc extra slot number"
> +	default -1
> +	---help---
> +	sunxi builds always enable mmc0, some boards also have a sdcard slot
> +	or emmc on mmc2 or mmc3. Setting this to 2 or 3 will enable support
> +	for this.
> +
>  config MMC0_CD_PIN
>  	int "Card detect pin for mmc0"
>  	default -1
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index e819b12..4d602ca 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -110,7 +110,7 @@ int board_mmc_init(bd_t *bis)
>  {
>  	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
>  	sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
> -#if !defined (CONFIG_SPL_BUILD) && defined (CONFIG_MMC_SUNXI_SLOT_EXTRA)
> +#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
>  	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
>  	sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
>  #endif
Hans de Goede Oct. 5, 2014, 3 p.m. UTC | #2
Hi,

On 10/04/2014 10:32 AM, Ian Campbell wrote:
> On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote:
>> Note we also drop the SPL check for initializing the 2nd mmc slot, the SPL
>> check is not necessary with Kconfig, because only options explicitly marked
>> as also being for the SPL get set during SPL builds.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> If we come across a system with e.g. 3 slots then this is just going to
> get more complex, isn't it? Shall we bite the bullet now and got
> straight to a bool option per potential slot?

I think that the current solution is somewhat more KISS then doing a bool
per slot. So lets wait with moving to a bool per mmc controller, until such
a hypothetical board with 3 mmc slots actually shows up, and keep what we've
for now.

Regards,

Hans


> 
>> ---
>>  board/sunxi/Kconfig | 8 ++++++++
>>  board/sunxi/board.c | 2 +-
>>  2 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
>> index 72d6dfa..c9b459a 100644
>> --- a/board/sunxi/Kconfig
>> +++ b/board/sunxi/Kconfig
>> @@ -32,6 +32,14 @@ config USB_KEYBOARD
>>  	Say Y here to add support for using a USB keyboard (typically used
>>  	in combination with a graphical console on HDMI).
>>  
>> +config MMC_SUNXI_SLOT_EXTRA
>> +	int "mmc extra slot number"
>> +	default -1
>> +	---help---
>> +	sunxi builds always enable mmc0, some boards also have a sdcard slot
>> +	or emmc on mmc2 or mmc3. Setting this to 2 or 3 will enable support
>> +	for this.
>> +
>>  config MMC0_CD_PIN
>>  	int "Card detect pin for mmc0"
>>  	default -1
>> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
>> index e819b12..4d602ca 100644
>> --- a/board/sunxi/board.c
>> +++ b/board/sunxi/board.c
>> @@ -110,7 +110,7 @@ int board_mmc_init(bd_t *bis)
>>  {
>>  	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
>>  	sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
>> -#if !defined (CONFIG_SPL_BUILD) && defined (CONFIG_MMC_SUNXI_SLOT_EXTRA)
>> +#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
>>  	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
>>  	sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
>>  #endif
> 
>
Ian Campbell Oct. 6, 2014, 8:30 a.m. UTC | #3
On Sun, 2014-10-05 at 17:00 +0200, Hans de Goede wrote:
> Hi,
> 
> On 10/04/2014 10:32 AM, Ian Campbell wrote:
> > On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote:
> >> Note we also drop the SPL check for initializing the 2nd mmc slot, the SPL
> >> check is not necessary with Kconfig, because only options explicitly marked
> >> as also being for the SPL get set during SPL builds.
> >>
> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > 
> > If we come across a system with e.g. 3 slots then this is just going to
> > get more complex, isn't it? Shall we bite the bullet now and got
> > straight to a bool option per potential slot?
> 
> I think that the current solution is somewhat more KISS then doing a bool
> per slot. So lets wait with moving to a bool per mmc controller, until such
> a hypothetical board with 3 mmc slots actually shows up, and keep what we've
> for now.

That's OK so long as we don't try to care about "forwards compatibility"
for .config files. I have a feeling that we don't in general, I expect
very few people are using oldconfig as opposed to rerunning defconfig,
since there is very little opportunity to tweak things once you have the
defconfig for a board.

Ian.
diff mbox

Patch

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 72d6dfa..c9b459a 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -32,6 +32,14 @@  config USB_KEYBOARD
 	Say Y here to add support for using a USB keyboard (typically used
 	in combination with a graphical console on HDMI).
 
+config MMC_SUNXI_SLOT_EXTRA
+	int "mmc extra slot number"
+	default -1
+	---help---
+	sunxi builds always enable mmc0, some boards also have a sdcard slot
+	or emmc on mmc2 or mmc3. Setting this to 2 or 3 will enable support
+	for this.
+
 config MMC0_CD_PIN
 	int "Card detect pin for mmc0"
 	default -1
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index e819b12..4d602ca 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -110,7 +110,7 @@  int board_mmc_init(bd_t *bis)
 {
 	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
 	sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
-#if !defined (CONFIG_SPL_BUILD) && defined (CONFIG_MMC_SUNXI_SLOT_EXTRA)
+#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
 	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
 	sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
 #endif