public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [linux-sunxi] [PATCH 1/6] sunxi: Add an option to disable MMC
Date: Fri, 18 Sep 2015 10:52:37 -0400	[thread overview]
Message-ID: <55FC2535.8080906@redhat.com> (raw)
In-Reply-To: <1442577980-26373-2-git-send-email-maxime.ripard@free-electrons.com>

Hi,

First if all, thanks for the patches for this. I've a couple
of comments on a few of them (including this one) I'll reply to the one
I've comments on. no reply means I think it is fine :)

On 09/18/2015 08:06 AM, Maxime Ripard wrote:
> Some devices don't have any MMC devices, so it doesn't really make sense to
> enable the MMC related functions and options for them.
>
> Add an option to disable the MMC support entirely.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>   arch/arm/cpu/armv7/sunxi/board.c | 6 ++++++
>   include/configs/sunxi-common.h   | 7 +++++--
>   2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
> index b40198b36ee5..e6721feb4a4c 100644
> --- a/arch/arm/cpu/armv7/sunxi/board.c
> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> @@ -135,7 +135,9 @@ DECLARE_GLOBAL_DATA_PTR;
>    */
>   u32 spl_boot_device(void)
>   {
> +#ifdef CONFIG_MMC
>   	struct mmc *mmc0, *mmc1;
> +#endif
>   	/*
>   	 * When booting from the SD card or NAND memory, the "eGON.BT0"
>   	 * signature is expected to be found in memory at the address 0x0004
> @@ -156,15 +158,18 @@ u32 spl_boot_device(void)
>   		return BOOT_DEVICE_BOARD;
>
>   	/* The BROM will try to boot from mmc0 first, so try that first. */
> +#ifdef CONFIG_MMC
>   	mmc_initialize(gd->bd);
>   	mmc0 = find_mmc_device(0);
>   	if (sunxi_mmc_has_egon_boot_signature(mmc0))
>   		return BOOT_DEVICE_MMC1;
> +#endif
>
>   	/* Fallback to booting NAND if enabled. */
>   	if (IS_ENABLED(CONFIG_SPL_NAND_SUPPORT))
>   		return BOOT_DEVICE_NAND;
>
> +#ifdef CONFIG_MMC
>   	if (CONFIG_MMC_SUNXI_SLOT_EXTRA == 2) {
>   		mmc1 = find_mmc_device(1);
>   		if (sunxi_mmc_has_egon_boot_signature(mmc1)) {
> @@ -178,6 +183,7 @@ u32 spl_boot_device(void)
>   			return BOOT_DEVICE_MMC2;
>   		}
>   	}
> +#endif
>
>   	panic("Could not determine boot source\n");
>   	return -1;		/* Never reached */
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 48cc4ed6f629..4fde0d4371e4 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -142,7 +142,7 @@
>   #endif
>
>   /* mmc config */
> -#if !defined(CONFIG_UART0_PORT_F)
> +#if !defined(CONFIG_UART0_PORT_F) && !defined(CONFIG_NO_MMC)

You're introducing a CONFIG_NO_MMC here, and setting that using
EXTRA_OPTIONS. EXTRA_OPTIONS has been deprecated, and adding
new options there is something which we do not want to do.

Instead I think it would be better to Kconfig-ify CONFIG_MMC,
the problem with doing this is that CONFIG_MMC gets used by
almost all SoCs supported by u-boot, and moving all of them
to use Kconfig for this at once is not ideal.

What u-boot has been doing so far for this is using a construct
like this:

config SYS_CLK_FREQ
         depends on ARC || ARCH_SUNXI
         int "CPU clock frequency"
         help
           TODO: Move CONFIG_SYS_CLK_FREQ for all the architecture

So for mmc we would get something like this in drivers/mmc/Kconfig:

config MMC
	depends on ARCH_SUNXI
	bool "Enable MMC support"
	help
	  TODO: Move CONFIG_MMC for all the architecture

And in board/sunxi/Kconfig

config MMC
	default y if ARCH_SUNXI && !UART0_PORT_F

We need the if ARCH_SUNXI to make "make savedefconfig" not cry out on
non SUNXI archs.

And then in sunxi-common.h we can just do:

#ifdef CONFIG_MMC
#define CONFIG_GENERIC_MMC
...

>   #define CONFIG_MMC
>   #define CONFIG_GENERIC_MMC
>   #define CONFIG_CMD_MMC
> @@ -199,7 +199,7 @@
>
>   #define CONFIG_SPL_LIBDISK_SUPPORT
>
> -#if !defined(CONFIG_UART0_PORT_F)
> +#if !defined(CONFIG_UART0_PORT_F) && !defined(CONFIG_NO_MMC)
>   #define CONFIG_SPL_MMC_SUPPORT
>   #endif
>

And this would become #ifdef CONFIG_MMC too

> @@ -360,9 +360,12 @@ extern int soft_i2c_gpio_scl;
>   #define CONFIG_FASTBOOT_BUF_SIZE	0x2000000
>
>   #define CONFIG_FASTBOOT_FLASH
> +
> +#ifdef CONFIG_MMC
>   #define CONFIG_FASTBOOT_FLASH_MMC_DEV	0
>   #define CONFIG_EFI_PARTITION
>   #endif
> +#endif
>
>   #ifdef CONFIG_USB_FUNCTION_MASS_STORAGE
>   #define CONFIG_CMD_USB_MASS_STORAGE
>

Regards,

Hans

  reply	other threads:[~2015-09-18 14:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18 12:06 [U-Boot] [PATCH 0/6] ARM: sunxi: Introduce CHIP support Maxime Ripard
2015-09-18 12:06 ` [U-Boot] [PATCH 1/6] sunxi: Add an option to disable MMC Maxime Ripard
2015-09-18 14:52   ` Hans de Goede [this message]
2015-09-22  9:12     ` [U-Boot] [linux-sunxi] " Maxime Ripard
2015-09-18 15:02   ` [U-Boot] " Tom Rini
2015-09-18 15:04     ` Hans de Goede
2015-09-22  9:15     ` Maxime Ripard
2015-09-18 12:06 ` [U-Boot] [PATCH 2/6] fastboot: Implement OEM format only when we have MMC support Maxime Ripard
2015-09-18 14:53   ` [U-Boot] [linux-sunxi] " Hans de Goede
2015-09-22  9:02     ` Maxime Ripard
2015-09-18 15:02   ` [U-Boot] " Tom Rini
2015-09-22  9:00     ` Maxime Ripard
2015-09-18 12:06 ` [U-Boot] [PATCH 3/6] sunxi: Add the R8 DTSI Maxime Ripard
2015-09-18 15:02   ` Tom Rini
2015-09-18 15:17     ` [U-Boot] [linux-sunxi] " Hans de Goede
2015-09-18 15:39       ` Tom Rini
2015-09-18 15:39         ` Hans de Goede
2015-09-18 15:49           ` Tom Rini
2015-09-18 23:31           ` Julian Calaby
2015-09-19 11:13             ` Tom Rini
2015-09-22  9:22               ` Maxime Ripard
2015-09-18 15:08   ` [U-Boot] " Ian Campbell
2015-09-22  9:17     ` Maxime Ripard
2015-09-22  9:20       ` Ian Campbell
2015-09-22 12:08         ` Maxime Ripard
2015-09-18 12:06 ` [U-Boot] [PATCH 4/6] ARM: sun5i: dt: Move uart3 pinctrl node to common DTSI Maxime Ripard
2015-09-18 15:02   ` Tom Rini
2015-09-18 12:06 ` [U-Boot] [PATCH 5/6] ARM: sun5i: dt: Add UART3 CTS and RTS pins Maxime Ripard
2015-09-18 15:02   ` Tom Rini
2015-09-18 12:06 ` [U-Boot] [PATCH 6/6] sunxi: Add CHIP support Maxime Ripard
2015-09-18 14:55   ` [U-Boot] [linux-sunxi] " Hans de Goede
2015-09-18 15:02   ` [U-Boot] " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55FC2535.8080906@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox