From patchwork Fri Feb 20 11:29:26 2015
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Przemyslaw Marczak
X-Patchwork-Id: 441919
X-Patchwork-Delegate: panto@antoniou-consulting.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 2E8FA140188
for ;
Fri, 20 Feb 2015 22:30:44 +1100 (AEDT)
Received: from localhost (localhost [127.0.0.1])
by theia.denx.de (Postfix) with ESMTP id E5EF74B712;
Fri, 20 Feb 2015 12:30:38 +0100 (CET)
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 npnqNe0y1flM; Fri, 20 Feb 2015 12:30:38 +0100 (CET)
Received: from theia.denx.de (localhost [127.0.0.1])
by theia.denx.de (Postfix) with ESMTP id 348BC4B73A;
Fri, 20 Feb 2015 12:30:34 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
by theia.denx.de (Postfix) with ESMTP id 5A3254A047
for ; Fri, 20 Feb 2015 12:30:29 +0100 (CET)
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 jRn_-aXkNfPG for ;
Fri, 20 Feb 2015 12:30:29 +0100 (CET)
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 mailout4.w1.samsung.com (mailout4.w1.samsung.com
[210.118.77.14]) by theia.denx.de (Postfix) with ESMTPS id 31F7A4A044
for ; Fri, 20 Feb 2015 12:30:27 +0100 (CET)
Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244])
by mailout4.w1.samsung.com
(Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit
(built Nov
17 2011)) with ESMTP id <0NK20049GITB2820@mailout4.w1.samsung.com>
for u-boot@lists.denx.de; Fri, 20 Feb 2015 11:34:23 +0000 (GMT)
X-AuditID: cbfec7f4-b7f126d000001e9a-fb-54e71a3e5b30
Received: from eusync4.samsung.com ( [203.254.199.214])
by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id B8.10.07834.E3A17E45;
Fri, 20 Feb 2015 11:27:58 +0000 (GMT)
Received: from AMDC1186.digital.local ([106.116.147.185])
by eusync4.samsung.com
(Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit
(built Nov
17 2011)) with ESMTPA id <0NK2004QAIMJ2520@eusync4.samsung.com>; Fri,
20 Feb 2015 11:30:23 +0000 (GMT)
From: Przemyslaw Marczak
To: u-boot@lists.denx.de
Date: Fri, 20 Feb 2015 12:29:26 +0100
Message-id: <1424431767-15321-2-git-send-email-p.marczak@samsung.com>
X-Mailer: git-send-email 1.9.1
In-reply-to: <1424431767-15321-1-git-send-email-p.marczak@samsung.com>
References: <1424178544-28632-1-git-send-email-p.marczak@samsung.com>
<1424431767-15321-1-git-send-email-p.marczak@samsung.com>
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e/4NV07qechBm9uGlic+vOY0WLX3/uM
Fjd+tbFavLh3kcXizcPNjBYdR1oYLXZcvsFisev2ZBaLb1u2AZVMb2G1eLu3k92B22Pez4lM
HrMbLrJ4nL2zg9Gjt/kdm0ffllWMAaxRXDYpqTmZZalF+nYJXBknL89jLHgqWvHit0ED4xXB
LkZODgkBE4kdqw4xQthiEhfurWfrYuTiEBJYyiix78kvFginj0nix/w3TCBVbAIGEnsunWEG
sUUEJCR+9V9lBCliFuhmlnhwYx4bSEJYwEdi8cHlYDaLgKrE3EcLWUBsXgFXiQ/fp7FCrJOT
OHlsMpjNKeAmsW/dXqjVjYwSs+ceYJnAyLuAkWEVo2hqaXJBcVJ6rqFecWJucWleul5yfu4m
RkgIftnBuPiY1SFGAQ5GJR7eH3uehQixJpYVV+YeYpTgYFYS4Y0Xfh4ixJuSWFmVWpQfX1Sa
k1p8iJGJg1OqgTH7t1a5ppkj18NfzwJnOgewnWdaaf5oyRSl7TGHtq3hk+RtvaNS8etQ4bKv
nxT//X2qoPF+9/6PX9QSF3hnSfSqLrHViy72W9y722HRnC7b2FU3dpc5sUwokxLiPtxWo2XX
Eh28cTrjupwlKZNC9Y1mhSvJ7fwobHItOGnhZcYrp6czLIny2K7EUpyRaKjFXFScCABY5ToA
HwIAAA==
Cc: Akshay Saraswat , swarren@nvidia.com,
Pantelis Antoniou ,
Jaehoon Chung ,
Przemyslaw Marczak
Subject: [U-Boot] [PATCH V3 1/2] mmc: exynos dwmmc: check boot mode before
init dwmmc
X-BeenThere: u-boot@lists.denx.de
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: U-Boot discussion
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Errors-To: u-boot-bounces@lists.denx.de
Sender: "U-Boot"
Before this commit, the mmc devices were always registered
in the same order. So dwmmc channel 0 was registered as mmc 0,
channel 1 as mmc 1, etc.
In case of possibility to boot from more then one device,
the CONFIG_SYS_MMC_ENV_DEV should always point to right mmc device.
This can be achieved by init boot device as first, so it will be
always registered as mmc 0. Thanks to this, the 'saveenv' command
will work fine for all mmc boot devices.
Exynos based boards usually uses mmc host channels configuration:
- 0, or 0+1 for 8 bit - as a default boot device (usually eMMC)
- 2 for 4bit - as an optional boot device (usually SD card slot)
And usually the boot order is defined by OM pin configuration,
which can be changed in a few ways, eg.
- Odroid U3 - eMMC card insertion -> first boot from eMMC
- Odroid X2/XU3 - boot priority jumper
By this commit, Exynos dwmmc driver will check the OM pin configuration,
and then try to init the boot device and register it as mmc 0.
Signed-off-by: Przemyslaw Marczak
Cc: Minkyu Kang
Cc: Jaehoon Chung
Cc: Pantelis Antoniou
Cc: Simon Glass
Cc: Akshay Saraswat
---
Changes v2:
- none
Changes v3:
- Fix email to Pantelis
---
drivers/mmc/exynos_dw_mmc.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
index dfa209b..91f0163 100644
--- a/drivers/mmc/exynos_dw_mmc.c
+++ b/drivers/mmc/exynos_dw_mmc.c
@@ -13,6 +13,7 @@
#include
#include
#include
+#include
#include
#include
@@ -166,7 +167,6 @@ static int exynos_dwmci_get_config(const void *blob, int node,
if (host->dev_index == host->dev_id)
host->dev_index = host->dev_id - PERIPH_ID_SDMMC0;
-
/* Get the bus width from the device node */
host->buswidth = fdtdec_get_int(blob, node, "samsung,bus-width", 0);
if (host->buswidth <= 0) {
@@ -229,12 +229,21 @@ int exynos_dwmmc_init(const void *blob)
{
int compat_id;
int node_list[DWMMC_MAX_CH_NUM];
+ int boot_dev_node;
int err = 0, count;
compat_id = COMPAT_SAMSUNG_EXYNOS_DWMMC;
count = fdtdec_find_aliases_for_id(blob, "mmc",
compat_id, node_list, DWMMC_MAX_CH_NUM);
+
+ /* For DWMMC always set boot device as mmc 0 */
+ if (count >= 3 && get_boot_mode() == BOOT_MODE_SD) {
+ boot_dev_node = node_list[2];
+ node_list[2] = node_list[0];
+ node_list[0] = boot_dev_node;
+ }
+
err = exynos_dwmci_process_node(blob, node_list, count);
return err;