From patchwork Mon Sep 1 11:50:44 2014
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Przemyslaw Marczak
X-Patchwork-Id: 384784
X-Patchwork-Delegate: promsoft@gmail.com
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Received: from theia.denx.de (theia.denx.de [85.214.87.163])
by ozlabs.org (Postfix) with ESMTP id 0EF6A14012B
for ;
Mon, 1 Sep 2014 21:52:03 +1000 (EST)
Received: from localhost (localhost [127.0.0.1])
by theia.denx.de (Postfix) with ESMTP id 21D0AA74E1;
Mon, 1 Sep 2014 13:51:57 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at theia.denx.de
Received: from theia.denx.de ([127.0.0.1])
by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id Q8GP-7rgq46h; Mon, 1 Sep 2014 13:51:56 +0200 (CEST)
Received: from theia.denx.de (localhost [127.0.0.1])
by theia.denx.de (Postfix) with ESMTP id A380EA74E2;
Mon, 1 Sep 2014 13:51:22 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
by theia.denx.de (Postfix) with ESMTP id A04B4A74CE
for ; Mon, 1 Sep 2014 13:51:17 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at theia.denx.de
Received: from theia.denx.de ([127.0.0.1])
by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id HNOpftGe5MC3 for ;
Mon, 1 Sep 2014 13:51:14 +0200 (CEST)
X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5
NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested)
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11]) by theia.denx.de (Postfix) with ESMTPS id 11931A7426
for ; Mon, 1 Sep 2014 13:51:08 +0200 (CEST)
Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245])
by mailout1.w1.samsung.com
(Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit
(built Nov
17 2011)) with ESMTP id <0NB800EXI121DU20@mailout1.w1.samsung.com>
for u-boot@lists.denx.de; Mon, 01 Sep 2014 12:54:01 +0100 (BST)
X-AuditID: cbfec7f5-b7f776d000003e54-2e-54045da99a15
Received: from eusync1.samsung.com ( [203.254.199.211])
by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 6D.0C.15956.9AD54045;
Mon, 01 Sep 2014 12:51:05 +0100 (BST)
Received: from AMDC1186.digital.local ([106.116.147.185])
by eusync1.samsung.com
(Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit
(built Aug
10 2011)) with ESMTPA id <0NB800E0G0WXC770@eusync1.samsung.com>; Mon,
01 Sep 2014 12:51:05 +0100 (BST)
From: Przemyslaw Marczak
To: u-boot@lists.denx.de
Date: Mon, 01 Sep 2014 13:50:44 +0200
Message-id: <1409572253-17018-4-git-send-email-p.marczak@samsung.com>
X-Mailer: git-send-email 1.9.1
In-reply-to: <1409572253-17018-1-git-send-email-p.marczak@samsung.com>
References: <1406720120-16999-1-git-send-email-p.marczak@samsung.com>
<1409572253-17018-1-git-send-email-p.marczak@samsung.com>
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrKJMWRmVeSWpSXmKPExsVy+t/xy7orY1lCDBp+aVlsb5zGZvFo/mNm
i11/7zNa3PjVxmrx5uFmRou1R+6yW+y4fIPF4u3eTnYHDo9F37M8zt7Zweix/6y4R9+WVYwB
LFFcNimpOZllqUX6dglcGVdXeResUK1YuGIrWwPjTrkuRk4OCQETiSUPJrNA2GISF+6tZwOx
hQSWMkr0fA3uYuQCsvuYJH58bmEGSbAJGEjsuXQGzBYRkJD41X+VEaSIWWASk8Tl+xcYQRLC
AqEShzauBZvKIqAqsfPGPXYQm1fAVeLY8t/sENvkJE4em8wKYnMKuEnsuTiJHWJbI6PEvM73
jBMYeRcwMqxiFE0tTS4oTkrPNdIrTswtLs1L10vOz93ECAmqrzsYlx6zOsQowMGoxMP7YiFz
iBBrYllxZe4hRgkOZiUR3umhLCFCvCmJlVWpRfnxRaU5qcWHGJk4OKUaGCMLIgMVDlzaqThX
4jqnjfahjPyvby6uL9o0t2jvMZGOggK+Bw0XO4QPMISUTRX2Nuk5EJqefnL54Xv3RBP5pvbM
vsC+L/mZ1bnvhxzjjbTeS7mJS0sU1f53LEisyT3bFHpKISDDzIyl7fncGzoO22VlLu1c8fxU
HfvRwsqOUk75r1emdk7Zq8RSnJFoqMVcVJwIACANLs4IAgAA
Cc: Daniel Drake , Jaehoon Chung ,
Przemyslaw Marczak , m.szyprowski@samsung.com
Subject: [U-Boot] [PATCH v8 03/12] arch:exynos: boot mode: add
get_boot_mode(), code cleanup
X-BeenThere: u-boot@lists.denx.de
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: U-Boot discussion
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Sender: u-boot-bounces@lists.denx.de
Errors-To: u-boot-bounces@lists.denx.de
This patch introduces code clean-up for exynos boot mode check.
It includes:
- removal of typedef: boot_mode
- move the boot mode enum to arch-exynos/power.h
- add bootmode for sequence: eMMC 4.4 ch4 / SD ch2
- add new function: get_boot_mode() for OM[5:1] pin check
- update spl boot code
Signed-off-by: Przemyslaw Marczak
Changes v5:
- exynos: boot mode: add missing bootmode (1st:EMMC 4.4 / 2nd:SD ch2)
Changes v6:
- none
changes v7:
- change boot mode name: BOOT_MODE_MMC to BOOT_MODE_SD
---
arch/arm/cpu/armv7/exynos/power.c | 7 +++++++
arch/arm/cpu/armv7/exynos/spl_boot.c | 7 +++----
arch/arm/include/asm/arch-exynos/power.h | 21 +++++++++++++++++++++
arch/arm/include/asm/arch-exynos/spl.h | 17 ++---------------
4 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
index 638ee0b..e1ab3d6 100644
--- a/arch/arm/cpu/armv7/exynos/power.c
+++ b/arch/arm/cpu/armv7/exynos/power.c
@@ -202,3 +202,10 @@ void power_exit_wakeup(void)
else
exynos4_power_exit_wakeup();
}
+
+unsigned int get_boot_mode(void)
+{
+ unsigned int om_pin = samsung_get_base_power();
+
+ return readl(om_pin) & OM_PIN_MASK;
+}
diff --git a/arch/arm/cpu/armv7/exynos/spl_boot.c b/arch/arm/cpu/armv7/exynos/spl_boot.c
index 7916630..658e4cb 100644
--- a/arch/arm/cpu/armv7/exynos/spl_boot.c
+++ b/arch/arm/cpu/armv7/exynos/spl_boot.c
@@ -20,7 +20,6 @@
#include "clock_init.h"
DECLARE_GLOBAL_DATA_PTR;
-#define OM_STAT (0x1f << 1)
/* Index into irom ptr table */
enum index {
@@ -184,7 +183,7 @@ static void exynos_spi_copy(unsigned int uboot_size, unsigned int uboot_addr)
*/
void copy_uboot_to_ram(void)
{
- enum boot_mode bootmode = BOOT_MODE_OM;
+ unsigned int bootmode = BOOT_MODE_OM;
u32 (*copy_bl2)(u32 offset, u32 nblock, u32 dst) = NULL;
u32 offset = 0, size = 0;
@@ -207,7 +206,7 @@ void copy_uboot_to_ram(void)
#endif
if (bootmode == BOOT_MODE_OM)
- bootmode = readl(samsung_get_base_power()) & OM_STAT;
+ bootmode = get_boot_mode();
switch (bootmode) {
#ifdef CONFIG_SPI_BOOTING
@@ -216,7 +215,7 @@ void copy_uboot_to_ram(void)
exynos_spi_copy(param->uboot_size, CONFIG_SYS_TEXT_BASE);
break;
#endif
- case BOOT_MODE_MMC:
+ case BOOT_MODE_SD:
offset = BL2_START_OFFSET;
size = BL2_SIZE_BLOC_COUNT;
copy_bl2 = get_irom_func(MMC_INDEX);
diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
index 4f2447b..e8a98a5 100644
--- a/arch/arm/include/asm/arch-exynos/power.h
+++ b/arch/arm/include/asm/arch-exynos/power.h
@@ -1670,6 +1670,27 @@ struct exynos5420_power {
};
#endif /* __ASSEMBLY__ */
+#define OM_PIN_BITS 0x1f
+#define OM_PIN_SHIFT 0x1
+#define OM_PIN_MASK (OM_PIN_BITS << OM_PIN_SHIFT)
+
+enum {
+ /*
+ * Assign the OM pin values for respective boot modes.
+ * Exynos4 does not support spi boot and the mmc boot OM
+ * pin values are the same across Exynos4 and Exynos5.
+ */
+ BOOT_MODE_SD = 4, /* SD_CH2 | USB */
+ BOOT_MODE_EMMC = 8, /* EMMC4.4 | USB */
+ BOOT_MODE_EMMC_SD = 40, /* EMMC4.4 | SD_CH2 */
+ BOOT_MODE_SERIAL = 20,
+ /* Boot based on Operating Mode pin settings */
+ BOOT_MODE_OM = 32,
+ BOOT_MODE_USB, /* Boot using USB download */
+};
+
+unsigned int get_boot_mode(void);
+
void set_mipi_phy_ctrl(unsigned int dev_index, unsigned int enable);
#define EXYNOS_MIPI_PHY_ENABLE (1 << 0)
diff --git a/arch/arm/include/asm/arch-exynos/spl.h b/arch/arm/include/asm/arch-exynos/spl.h
index b1d68c3..cdcb2bc 100644
--- a/arch/arm/include/asm/arch-exynos/spl.h
+++ b/arch/arm/include/asm/arch-exynos/spl.h
@@ -8,20 +8,7 @@
#define __ASM_ARCH_EXYNOS_SPL_H__
#include
-
-enum boot_mode {
- /*
- * Assign the OM pin values for respective boot modes.
- * Exynos4 does not support spi boot and the mmc boot OM
- * pin values are the same across Exynos4 and Exynos5.
- */
- BOOT_MODE_MMC = 4,
- BOOT_MODE_EMMC = 8, /* EMMC4.4 */
- BOOT_MODE_SERIAL = 20,
- /* Boot based on Operating Mode pin settings */
- BOOT_MODE_OM = 32,
- BOOT_MODE_USB, /* Boot using USB download */
-};
+#include
#ifndef __ASSEMBLY__
/* Parameters of early board initialization in SPL */
@@ -62,7 +49,7 @@ struct spl_machine_param {
* table only for mmc boot.
*/
u32 uboot_size;
- enum boot_mode boot_source; /* Boot device */
+ unsigned boot_source; /* Boot device */
unsigned frequency_mhz; /* Frequency of memory in MHz */
unsigned arm_freq_mhz; /* ARM Frequency in MHz */
u32 serial_base; /* Serial base address */