From patchwork Mon Jan 9 10:06:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 90379 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp5871qgi; Mon, 9 Jan 2017 02:07:12 -0800 (PST) X-Received: by 10.223.169.110 with SMTP id u101mr13073208wrc.167.1483956431914; Mon, 09 Jan 2017 02:07:11 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id d5si7868592wrc.171.2017.01.09.02.07.11; Mon, 09 Jan 2017 02:07:11 -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=@baylibre-com.20150623.gappssmtp.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 2DF19B3A05; Mon, 9 Jan 2017 11:07:09 +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 g5Vni2CGh1zx; Mon, 9 Jan 2017 11:07:08 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 682CFB39CD; Mon, 9 Jan 2017 11:07:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6190FB3959 for ; Mon, 9 Jan 2017 11:06:56 +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 M2dTPNBqXRo6 for ; Mon, 9 Jan 2017 11:06:56 +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 mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by theia.denx.de (Postfix) with ESMTPS id 39C05B3874 for ; Mon, 9 Jan 2017 11:06:52 +0100 (CET) Received: by mail-wm0-f51.google.com with SMTP id c206so24342402wme.0 for ; Mon, 09 Jan 2017 02:06:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eJmktrEsz0OO3tdRPxqyoFLv8w3uryIAOmJ7NONgItw=; b=cY2OM9R2rSJCF9MklYAZ9x8m7uCKbOc2Jw5rafX35WJnHL9lX8JgwGzGrLS2EY0OXP SCuHC4T2ODnkNGQ3pNiyN0mdWhocPTbCT2buQNqZGT+279L61vZQWCOX4A6IwqwC842p LjD1glhWevidSWIvuKug+g/4jb5wMx4hBImm9K0+fcg084zRMd3LFeUGF9byXsx28jdA mMWV53HwOwBzkr7ZPkl08les4wiKt8LgAxy8oCVne9l2Mahb/Od/ScBk1METrhEA2BRJ BjWUFD2iPruknN7PNnYefz6JU1q0WiNZ1bal1Ir4c8hrpxJQgWwq/JvOfaM+Zdplumnc 5e/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eJmktrEsz0OO3tdRPxqyoFLv8w3uryIAOmJ7NONgItw=; b=OQKQxNcbgiT9vghwp0rY0YB+69lBAtZp3SaTT3JefCcyXwDD8WeqHd/L/Drg+b1E/q gjzpQQ4OAhpqu9ub6vQ3DPZH2sDNEPKSDh/K62oVD+zidxYTpkuNEG9SRElxVeoXnqV1 eGyDNvKOFVKEYo4Q+4pcIYxrDr90OXRjj8zJpjcZsP/x+Ru1gkFGFEx3unQvhxWMak4Z ccEV3+DNGXmA0mLeKocWU0UN5h95SV26Bhu6hv7qK7t6M94zeoZTlB/cNJsj574T/Np0 njHpu/7qMEyPL/KmcUqX51oLjh0QUfSw2f5Nkmflt6RDzouZjQF6LEov6zHLAKUF7dpE GhIA== X-Gm-Message-State: AIkVDXJG1SEqzNHHkBMOBzB7fCXmwpLfVJxt7CEpYFcYyXaXBsMkjgyn/cC649VQswwHqs5c X-Received: by 10.223.170.65 with SMTP id q1mr13098482wrd.115.1483956412239; Mon, 09 Jan 2017 02:06:52 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id g197sm17889739wmd.15.2017.01.09.02.06.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jan 2017 02:06:51 -0800 (PST) From: Fabien Parent To: u-boot@lists.denx.de Date: Mon, 9 Jan 2017 11:06:36 +0100 Message-Id: <20170109100638.19990-2-fparent@baylibre.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170109100638.19990-1-fparent@baylibre.com> References: <20170109100638.19990-1-fparent@baylibre.com> Cc: Tom Rini Subject: [U-Boot] [PATCH 1/3] davinci: spl: use bootcfg to select boot device 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" Right now the SPL is trying to load u-boot based on defines, i.e. one has to define CONFIG_SPL_NAND_SIMPLE to boot from NAND, or CONFIG_SPL_SPI_LOAD to boot from SPI FLASH, etc... This prevent us from having a single SPL image that is able to boot from all media, and one need to build an image for each medium. This commit is replacing the #ifdef that select the boot medium by reading the value of the boot pins (via the BOOTCFG register). Now a single SPL image will be able to read from the boot pin to know which device should be used to load u-boot. Signed-off-by: Fabien Parent --- arch/arm/mach-davinci/include/mach/hardware.h | 16 ++++++++++++-- arch/arm/mach-davinci/spl.c | 31 +++++++++++++++++++-------- 2 files changed, 36 insertions(+), 11 deletions(-) -- 2.11.0 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot Reviewed-by: Tom Rini diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h index 2a0360a785..c31f38c8a2 100644 --- a/arch/arm/mach-davinci/include/mach/hardware.h +++ b/arch/arm/mach-davinci/include/mach/hardware.h @@ -475,12 +475,15 @@ int clk_get(enum davinci_clk_ids id); /* Boot config */ struct davinci_syscfg_regs { dv_reg revid; - dv_reg rsvd[13]; + dv_reg rsvd[7]; + dv_reg bootcfg; + dv_reg chiprevidr; + dv_reg rsvd2[4]; dv_reg kick0; dv_reg kick1; dv_reg rsvd1[52]; dv_reg mstpri[3]; - dv_reg rsvd2; + dv_reg rsvd3; dv_reg pinmux[20]; dv_reg suspsrc; dv_reg chipsig; @@ -495,6 +498,15 @@ struct davinci_syscfg_regs { #define davinci_syscfg_regs \ ((struct davinci_syscfg_regs *)DAVINCI_BOOTCFG_BASE) +enum { + DAVINCI_NAND8_BOOT = 0b001110, + DAVINCI_NAND16_BOOT = 0b010000, + DAVINCI_SD_OR_MMC_BOOT = 0b011100, + DAVINCI_MMC_ONLY_BOOT = 0b111100, + DAVINCI_SPI0_FLASH_BOOT = 0b001010, + DAVINCI_SPI1_FLASH_BOOT = 0b001100, +}; + #define pinmux(x) (&davinci_syscfg_regs->pinmux[x]) /* Emulation suspend bits */ diff --git a/arch/arm/mach-davinci/spl.c b/arch/arm/mach-davinci/spl.c index 0aeaa7d8b7..564c2008e0 100644 --- a/arch/arm/mach-davinci/spl.c +++ b/arch/arm/mach-davinci/spl.c @@ -52,14 +52,27 @@ u32 spl_boot_mode(const u32 boot_device) u32 spl_boot_device(void) { -#ifdef CONFIG_SPL_NAND_SIMPLE - return BOOT_DEVICE_NAND; -#elif defined(CONFIG_SPL_SPI_LOAD) - return BOOT_DEVICE_SPI; -#elif defined(CONFIG_SPL_MMC_LOAD) - return BOOT_DEVICE_MMC1; -#else - puts("Unknown boot device\n"); - hang(); + switch (davinci_syscfg_regs->bootcfg) { +#ifdef CONFIG_SPL_NAND_SUPPORT + case DAVINCI_NAND8_BOOT: + case DAVINCI_NAND16_BOOT: + return BOOT_DEVICE_NAND; #endif + +#ifdef CONFIG_SPL_MMC_SUPPORT + case DAVINCI_SD_OR_MMC_BOOT: + case DAVINCI_MMC_ONLY_BOOT: + return BOOT_DEVICE_MMC1; +#endif + +#ifdef CONFIG_SPL_SPI_FLASH_SUPPORT + case DAVINCI_SPI0_FLASH_BOOT: + case DAVINCI_SPI1_FLASH_BOOT: + return BOOT_DEVICE_SPI; +#endif + + default: + puts("Unknown boot device\n"); + hang(); + } }