From patchwork Mon Feb 13 16:24:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 93903 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1168596qgi; Mon, 13 Feb 2017 08:25:03 -0800 (PST) X-Received: by 10.223.154.114 with SMTP id z105mr20633178wrb.89.1487003102914; Mon, 13 Feb 2017 08:25:02 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id b109si14428248wrd.317.2017.02.13.08.25.02; Mon, 13 Feb 2017 08:25:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3A1C94AAA7; Mon, 13 Feb 2017 17:25:01 +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 d4hEdFpTuJnR; Mon, 13 Feb 2017 17:25:00 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7C01F4A05F; Mon, 13 Feb 2017 17:25:00 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D99B94A99B for ; Mon, 13 Feb 2017 17:24:52 +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 esRpoo3Ut6SM for ; Mon, 13 Feb 2017 17:24:52 +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 conuserg-10.nifty.com (conuserg-10.nifty.com [210.131.2.77]) by theia.denx.de (Postfix) with ESMTPS id 2066D4A068 for ; Mon, 13 Feb 2017 17:24:47 +0100 (CET) Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-10.nifty.com with ESMTP id v1DGORTZ006492; Tue, 14 Feb 2017 01:24:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com v1DGORTZ006492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1487003070; bh=H7rb4uEYIIZxf+gpvz8HLM4F5wayBEMMF6YqA49sjio=; h=From:To:Cc:Subject:Date:From; b=eeI7l/jknImrUMZELrtXFM6mFnQ+DmBQq092pLvfxyb1+FrFlrX7UODlvCkVMWkI8 dPUfGdke0lVZDC1I9GbUAnYqA55Z3dqm130cguNjKf/dWDYw/3W1cyPGktmvoEsqYq E2GfHgPor7tSzZUvHUqNaSqtm5JrpctYzF41LrGIpVJneupJmZrR7qlAEwD1CzWcFE Ql3lrIWuON6A40mmxObRa2tA8iIXEm3mLpRGeY25VzNFMRdV+pnhWEvcRWXtxKv+vf k0LAXWOk7bQSF2noKaWgO56c7jM8ekE5GsC81dMh/4djvW6yqr8wjoVc6Z1mNeydQh ktqlKTxS/DnbQ== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Tue, 14 Feb 2017 01:24:24 +0900 Message-Id: <1487003066-14387-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Cc: Albert Aribaud Subject: [U-Boot] [PATCH 1/3] ARM: uniphier: move MMC code to a separate file 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" Currently, arch/arm/mach-uniphier/boot-mode/boot-mode.c is messed up with unrelated code; there is no reason why the "mmcsetn" command must be placed in this file. Split out the MMC code into arch/arm/mach-uniphier/mmc-first-dev.c. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/Makefile | 1 + arch/arm/mach-uniphier/boot-mode/boot-mode.c | 38 ----------------------- arch/arm/mach-uniphier/mmc-first-dev.c | 46 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 38 deletions(-) create mode 100644 arch/arm/mach-uniphier/mmc-first-dev.c -- 2.7.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/arch/arm/mach-uniphier/Makefile b/arch/arm/mach-uniphier/Makefile index 166b41f..0eb59fb 100644 --- a/arch/arm/mach-uniphier/Makefile +++ b/arch/arm/mach-uniphier/Makefile @@ -19,6 +19,7 @@ obj-y += reset.o obj-$(CONFIG_MICRO_SUPPORT_CARD) += sbc/ micro-support-card.o obj-y += pinctrl-glue.o +obj-$(CONFIG_MMC) += mmc-first-dev.o endif diff --git a/arch/arm/mach-uniphier/boot-mode/boot-mode.c b/arch/arm/mach-uniphier/boot-mode/boot-mode.c index a552770..6ce3273 100644 --- a/arch/arm/mach-uniphier/boot-mode/boot-mode.c +++ b/arch/arm/mach-uniphier/boot-mode/boot-mode.c @@ -100,41 +100,3 @@ u32 spl_boot_mode(const u32 boot_device) return MMCSD_MODE_EMMCBOOT; } - -#if defined(CONFIG_DM_MMC) && !defined(CONFIG_SPL_BUILD) -static int find_first_mmc_device(void) -{ - struct mmc *mmc; - int i; - - for (i = 0; (mmc = find_mmc_device(i)); i++) { - if (!mmc_init(mmc) && IS_MMC(mmc)) - return i; - } - - return -ENODEV; -} - -int mmc_get_env_dev(void) -{ - return find_first_mmc_device(); -} - -static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - int dev; - - dev = find_first_mmc_device(); - if (dev < 0) - return CMD_RET_FAILURE; - - setenv_ulong("mmc_first_dev", dev); - return CMD_RET_SUCCESS; -} - -U_BOOT_CMD( - mmcsetn, 1, 1, do_mmcsetn, - "Set the first MMC (not SD) dev number to \"mmc_first_dev\" environment", - "" -); -#endif diff --git a/arch/arm/mach-uniphier/mmc-first-dev.c b/arch/arm/mach-uniphier/mmc-first-dev.c new file mode 100644 index 0000000..8c45229 --- /dev/null +++ b/arch/arm/mach-uniphier/mmc-first-dev.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2016 Socionext Inc. + * Author: Masahiro Yamada + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include + +static int find_first_mmc_device(void) +{ + struct mmc *mmc; + int i; + + for (i = 0; (mmc = find_mmc_device(i)); i++) { + if (!mmc_init(mmc) && IS_MMC(mmc)) + return i; + } + + return -ENODEV; +} + +int mmc_get_env_dev(void) +{ + return find_first_mmc_device(); +} + +static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + int dev; + + dev = find_first_mmc_device(); + if (dev < 0) + return CMD_RET_FAILURE; + + setenv_ulong("mmc_first_dev", dev); + return CMD_RET_SUCCESS; +} + +U_BOOT_CMD( + mmcsetn, 1, 1, do_mmcsetn, + "Set the first MMC (not SD) dev number to \"mmc_first_dev\" environment", + "" +);