All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: exynos: Read default MMC device from XOM[7:5] pins
       [not found] <CGME20200115140607eucas1p2abbf759b7ebbe07b14455bb135c02fa0@eucas1p2.samsung.com>
@ 2020-01-15 14:05 ` Marek Szyprowski
  2020-01-15 14:19   ` Lukasz Majewski
  2020-01-15 16:23   ` Anand Moon
  0 siblings, 2 replies; 3+ messages in thread
From: Marek Szyprowski @ 2020-01-15 14:05 UTC (permalink / raw)
  To: u-boot

XOM pins provide information for iROM bootloader about the boot device.
Those pins are mapped to lower bits of OP_MODE register (0x10000008),
which is common for all Exynos SoC variants. Set the default MMC device id
to reflect the boot device selected by XOM[7:5] pins (2 for the SD or 0 for
the eMMC).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 arch/arm/mach-exynos/include/mach/cpu.h |  1 +
 board/samsung/common/board.c            | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-exynos/include/mach/cpu.h b/arch/arm/mach-exynos/include/mach/cpu.h
index 766edeeb29..fb5fdaf3ba 100644
--- a/arch/arm/mach-exynos/include/mach/cpu.h
+++ b/arch/arm/mach-exynos/include/mach/cpu.h
@@ -17,6 +17,7 @@
 
 #define EXYNOS4_GPIO_PART3_BASE		0x03860000
 #define EXYNOS4_PRO_ID			0x10000000
+#define EXYNOS4_OP_MODE			0x10000008
 #define EXYNOS4_SYSREG_BASE		0x10010000
 #define EXYNOS4_POWER_BASE		0x10020000
 #define EXYNOS4_SWRESET			0x10020400
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index ee2fc7971e..ac91c0a6fb 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -359,3 +359,17 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 #endif
 	return 0;
 }
+
+/**
+ * mmc_get_env_dev() - read boot MMC device id from XOM[7:5] pins.
+ */
+int mmc_get_env_dev(void)
+{
+	u32 mode = readl(EXYNOS4_OP_MODE) & 0x1C;
+
+	if (mode == 0x04)
+		return 2; /* MMC2: SD */
+
+	/* MMC0: eMMC or unknown */
+	return 0;
+}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] arm: exynos: Read default MMC device from XOM[7:5] pins
  2020-01-15 14:05 ` [PATCH] arm: exynos: Read default MMC device from XOM[7:5] pins Marek Szyprowski
@ 2020-01-15 14:19   ` Lukasz Majewski
  2020-01-15 16:23   ` Anand Moon
  1 sibling, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2020-01-15 14:19 UTC (permalink / raw)
  To: u-boot

On Wed, 15 Jan 2020 15:05:58 +0100
Marek Szyprowski <m.szyprowski@samsung.com> wrote:

> XOM pins provide information for iROM bootloader about the boot
> device. Those pins are mapped to lower bits of OP_MODE register
> (0x10000008), which is common for all Exynos SoC variants. Set the
> default MMC device id to reflect the boot device selected by XOM[7:5]
> pins (2 for the SD or 0 for the eMMC).
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  arch/arm/mach-exynos/include/mach/cpu.h |  1 +
>  board/samsung/common/board.c            | 14 ++++++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/arch/arm/mach-exynos/include/mach/cpu.h
> b/arch/arm/mach-exynos/include/mach/cpu.h index
> 766edeeb29..fb5fdaf3ba 100644 ---
> a/arch/arm/mach-exynos/include/mach/cpu.h +++
> b/arch/arm/mach-exynos/include/mach/cpu.h @@ -17,6 +17,7 @@
>  
>  #define EXYNOS4_GPIO_PART3_BASE		0x03860000
>  #define EXYNOS4_PRO_ID			0x10000000
> +#define EXYNOS4_OP_MODE			0x10000008
>  #define EXYNOS4_SYSREG_BASE		0x10010000
>  #define EXYNOS4_POWER_BASE		0x10020000
>  #define EXYNOS4_SWRESET			0x10020400
> diff --git a/board/samsung/common/board.c
> b/board/samsung/common/board.c index ee2fc7971e..ac91c0a6fb 100644
> --- a/board/samsung/common/board.c
> +++ b/board/samsung/common/board.c
> @@ -359,3 +359,17 @@ int board_usb_cleanup(int index, enum
> usb_init_type init) #endif
>  	return 0;
>  }
> +
> +/**
> + * mmc_get_env_dev() - read boot MMC device id from XOM[7:5] pins.
> + */
> +int mmc_get_env_dev(void)
> +{
> +	u32 mode = readl(EXYNOS4_OP_MODE) & 0x1C;
> +
> +	if (mode == 0x04)
> +		return 2; /* MMC2: SD */
> +
> +	/* MMC0: eMMC or unknown */
> +	return 0;
> +}

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200115/2f754d3a/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] arm: exynos: Read default MMC device from XOM[7:5] pins
  2020-01-15 14:05 ` [PATCH] arm: exynos: Read default MMC device from XOM[7:5] pins Marek Szyprowski
  2020-01-15 14:19   ` Lukasz Majewski
@ 2020-01-15 16:23   ` Anand Moon
  1 sibling, 0 replies; 3+ messages in thread
From: Anand Moon @ 2020-01-15 16:23 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On Wed, 15 Jan 2020 at 19:36, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>
> XOM pins provide information for iROM bootloader about the boot device.
> Those pins are mapped to lower bits of OP_MODE register (0x10000008),
> which is common for all Exynos SoC variants. Set the default MMC device id
> to reflect the boot device selected by XOM[7:5] pins (2 for the SD or 0 for
> the eMMC).
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  arch/arm/mach-exynos/include/mach/cpu.h |  1 +
>  board/samsung/common/board.c            | 14 ++++++++++++++
>  2 files changed, 15 insertions(+)
>
> diff --git a/arch/arm/mach-exynos/include/mach/cpu.h b/arch/arm/mach-exynos/include/mach/cpu.h
> index 766edeeb29..fb5fdaf3ba 100644
> --- a/arch/arm/mach-exynos/include/mach/cpu.h
> +++ b/arch/arm/mach-exynos/include/mach/cpu.h
> @@ -17,6 +17,7 @@
>
>  #define EXYNOS4_GPIO_PART3_BASE                0x03860000
>  #define EXYNOS4_PRO_ID                 0x10000000
> +#define EXYNOS4_OP_MODE                        0x10000008
>  #define EXYNOS4_SYSREG_BASE            0x10010000
>  #define EXYNOS4_POWER_BASE             0x10020000
>  #define EXYNOS4_SWRESET                        0x10020400
> diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
> index ee2fc7971e..ac91c0a6fb 100644
> --- a/board/samsung/common/board.c
> +++ b/board/samsung/common/board.c
> @@ -359,3 +359,17 @@ int board_usb_cleanup(int index, enum usb_init_type init)
>  #endif
>         return 0;
>  }
> +
> +/**
> + * mmc_get_env_dev() - read boot MMC device id from XOM[7:5] pins.
> + */
> +int mmc_get_env_dev(void)
> +{
> +       u32 mode = readl(EXYNOS4_OP_MODE) & 0x1C;
> +
> +       if (mode == 0x04)
> +               return 2; /* MMC2: SD */
> +
> +       /* MMC0: eMMC or unknown */
> +       return 0;
> +}
> --
> 2.17.1
>
If you could add some debug prints which boot mode got selected,
It will be much help. Please add my

Reviewed-by: Anand Moon <linux.amoon@gmail.com>

-Anand

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-15 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200115140607eucas1p2abbf759b7ebbe07b14455bb135c02fa0@eucas1p2.samsung.com>
2020-01-15 14:05 ` [PATCH] arm: exynos: Read default MMC device from XOM[7:5] pins Marek Szyprowski
2020-01-15 14:19   ` Lukasz Majewski
2020-01-15 16:23   ` Anand Moon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.