From: Robert Nelson <robertcnelson@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 13/13] ARM: atmel: sama5d4_xplained: enable spl support
Date: Wed, 10 Dec 2014 15:35:59 -0600 [thread overview]
Message-ID: <CAOCHtYjxQFe9DfH69MU4F1U2BpxgzcmyWNmx554C5wKj3OveGA@mail.gmail.com> (raw)
In-Reply-To: <1418018958-23342-14-git-send-email-voice.shen@atmel.com>
On Mon, Dec 8, 2014 at 12:09 AM, Bo Shen <voice.shen@atmel.com> wrote:
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> ---
>
> arch/arm/Kconfig | 1 +
> board/atmel/sama5d4_xplained/sama5d4_xplained.c | 85 +++++++++++++++++++++++++
> configs/sama5d4_xplained_mmc_defconfig | 1 +
> configs/sama5d4_xplained_nandflash_defconfig | 1 +
> configs/sama5d4_xplained_spiflash_defconfig | 1 +
> include/configs/sama5d4_xplained.h | 56 ++++++++++++++++
> 6 files changed, 145 insertions(+)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 091d615..9c43255 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -514,6 +514,7 @@ config TARGET_SAMA5D3XEK
> config TARGET_SAMA5D4_XPLAINED
> bool "Support sama5d4_xplained"
> select CPU_V7
> + select SUPPORT_SPL
>
> config TARGET_SAMA5D4EK
> bool "Support sama5d4ek"
> diff --git a/board/atmel/sama5d4_xplained/sama5d4_xplained.c b/board/atmel/sama5d4_xplained/sama5d4_xplained.c
> index 93bebd4..d64d320 100644
> --- a/board/atmel/sama5d4_xplained/sama5d4_xplained.c
> +++ b/board/atmel/sama5d4_xplained/sama5d4_xplained.c
> @@ -10,6 +10,7 @@
> #include <asm/arch/at91_common.h>
> #include <asm/arch/at91_pmc.h>
> #include <asm/arch/at91_rstc.h>
> +#include <asm/arch/atmel_mpddrc.h>
> #include <asm/arch/atmel_usba_udc.h>
> #include <asm/arch/gpio.h>
> #include <asm/arch/clk.h>
> @@ -328,3 +329,87 @@ int board_eth_init(bd_t *bis)
>
> return rc;
> }
> +
> +/* SPL */
> +#ifdef CONFIG_SPL_BUILD
> +void spl_board_init(void)
> +{
> +#ifdef CONFIG_SYS_USE_MMC
> + sama5d4_xplained_mci1_hw_init();
> +#elif CONFIG_SYS_USE_NANDFLASH
> + sama5d4_xplained_nand_hw_init();
> +#elif CONFIG_SYS_USE_SERIALFLASH
> + sama5d4_xplained_spi0_hw_init();
> +#endif
> +}
> +
> +static void ddr2_conf(struct atmel_mpddr *ddr2)
> +{
> + ddr2->md = (ATMEL_MPDDRC_MD_DBW_32_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
> +
> + ddr2->cr = (ATMEL_MPDDRC_CR_NC_COL_10 |
> + ATMEL_MPDDRC_CR_NR_ROW_14 |
> + ATMEL_MPDDRC_CR_CAS_DDR_CAS3 |
> + ATMEL_MPDDRC_CR_NB_8BANKS |
> + ATMEL_MPDDRC_CR_NDQS_DISABLED |
> + ATMEL_MPDDRC_CR_DECOD_INTERLEAVED |
> + ATMEL_MPDDRC_CR_UNAL_SUPPORTED);
> +
> + ddr2->rtr = 0x2b0;
> +
> + ddr2->tpr0 = (8 << ATMEL_MPDDRC_TPR0_TRAS_OFFSET |
> + 3 << ATMEL_MPDDRC_TPR0_TRCD_OFFSET |
> + 3 << ATMEL_MPDDRC_TPR0_TWR_OFFSET |
> + 10 << ATMEL_MPDDRC_TPR0_TRC_OFFSET |
> + 3 << ATMEL_MPDDRC_TPR0_TRP_OFFSET |
> + 2 << ATMEL_MPDDRC_TPR0_TRRD_OFFSET |
> + 2 << ATMEL_MPDDRC_TPR0_TWTR_OFFSET |
> + 2 << ATMEL_MPDDRC_TPR0_TMRD_OFFSET);
> +
> + ddr2->tpr1 = (2 << ATMEL_MPDDRC_TPR1_TXP_OFFSET |
> + 200 << ATMEL_MPDDRC_TPR1_TXSRD_OFFSET |
> + 25 << ATMEL_MPDDRC_TPR1_TXSNR_OFFSET |
> + 23 << ATMEL_MPDDRC_TPR1_TRFC_OFFSET);
> +
> + ddr2->tpr2 = (7 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET |
> + 2 << ATMEL_MPDDRC_TPR2_TRTP_OFFSET |
> + 3 << ATMEL_MPDDRC_TPR2_TRPA_OFFSET |
> + 2 << ATMEL_MPDDRC_TPR2_TXARDS_OFFSET |
> + 8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
> +}
> +
> +void mem_init(void)
> +{
> + struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
> + struct atmel_mpddr ddr2;
> +
> + ddr2_conf(&ddr2);
> +
> + /* enable MPDDR clock */
> + at91_periph_clk_enable(ATMEL_ID_MPDDRC);
> + writel(0x4, &pmc->scer);
> +
> + /* DDRAM2 Controller initialize */
> + ddr2_init(ATMEL_BASE_DDRCS, &ddr2);
> +}
> +
> +void at91_pmc_init(void)
> +{
> + struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
> + u32 tmp;
> +
> + tmp = AT91_PMC_PLLAR_29 |
> + AT91_PMC_PLLXR_PLLCOUNT(0x3f) |
> + AT91_PMC_PLLXR_MUL(87) |
> + AT91_PMC_PLLXR_DIV(1);
> + at91_plla_init(tmp);
> +
> + writel(0x0 << 8, &pmc->pllicpr);
> +
> + tmp = AT91_PMC_MCKR_H32MXDIV |
> + AT91_PMC_MCKR_PLLADIV_2 |
> + AT91_PMC_MCKR_MDIV_3 |
> + AT91_PMC_MCKR_CSS_PLLA;
> + at91_mck_init(tmp);
> +}
> +#endif
> diff --git a/configs/sama5d4_xplained_mmc_defconfig b/configs/sama5d4_xplained_mmc_defconfig
> index 3720f3c..73df28c 100644
> --- a/configs/sama5d4_xplained_mmc_defconfig
> +++ b/configs/sama5d4_xplained_mmc_defconfig
> @@ -1,3 +1,4 @@
> +CONFIG_SPL=y
> CONFIG_SYS_EXTRA_OPTIONS="SAMA5D4,SYS_USE_MMC"
> +S:CONFIG_ARM=y
> +S:CONFIG_TARGET_SAMA5D4_XPLAINED=y
> diff --git a/configs/sama5d4_xplained_nandflash_defconfig b/configs/sama5d4_xplained_nandflash_defconfig
> index 5e13da7..046fe06 100644
> --- a/configs/sama5d4_xplained_nandflash_defconfig
> +++ b/configs/sama5d4_xplained_nandflash_defconfig
> @@ -1,3 +1,4 @@
> +CONFIG_SPL=y
> CONFIG_SYS_EXTRA_OPTIONS="SAMA5D4,SYS_USE_NANDFLASH"
> +S:CONFIG_ARM=y
> +S:CONFIG_TARGET_SAMA5D4_XPLAINED=y
> diff --git a/configs/sama5d4_xplained_spiflash_defconfig b/configs/sama5d4_xplained_spiflash_defconfig
> index 3a4607c..755dd8b 100644
> --- a/configs/sama5d4_xplained_spiflash_defconfig
> +++ b/configs/sama5d4_xplained_spiflash_defconfig
> @@ -1,3 +1,4 @@
> +CONFIG_SPL=y
> CONFIG_SYS_EXTRA_OPTIONS="SAMA5D4,SYS_USE_SERIALFLASH"
> +S:CONFIG_ARM=y
> +S:CONFIG_TARGET_SAMA5D4_XPLAINED=y
> diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h
> index 996973d..6d70bc9 100644
> --- a/include/configs/sama5d4_xplained.h
> +++ b/include/configs/sama5d4_xplained.h
> @@ -20,7 +20,9 @@
>
> #define CONFIG_ARCH_CPU_INIT
>
> +#ifndef CONFIG_SPL_BUILD
> #define CONFIG_SKIP_LOWLEVEL_INIT
> +#endif
> #define CONFIG_BOARD_EARLY_INIT_F
> #define CONFIG_DISPLAY_CPUINFO
>
> @@ -66,8 +68,12 @@
> #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS
> #define CONFIG_SYS_SDRAM_SIZE 0x20000000
>
> +#ifdef CONFIG_SPL_BUILD
> +#define CONFIG_SYS_INIT_SP_ADDR 0x210000
> +#else
> #define CONFIG_SYS_INIT_SP_ADDR \
> (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
> +#endif
>
> #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */
>
> @@ -221,4 +227,54 @@
> /* Size of malloc() pool */
> #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
>
> +
> +/* SPL */
> +#define CONFIG_SPL_FRAMEWORK
> +#define CONFIG_SPL_TEXT_BASE 0x200000
> +#define CONFIG_SPL_MAX_SIZE 0x10000
> +#define CONFIG_SPL_BSS_START_ADDR 0x20000000
> +#define CONFIG_SPL_BSS_MAX_SIZE 0x80000
> +#define CONFIG_SYS_SPL_MALLOC_START 0x20080000
> +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x80000
> +
> +#define CONFIG_SPL_LIBCOMMON_SUPPORT
> +#define CONFIG_SPL_LIBGENERIC_SUPPORT
> +#define CONFIG_SPL_GPIO_SUPPORT
> +#define CONFIG_SPL_SERIAL_SUPPORT
> +
> +#define CONFIG_SPL_BOARD_INIT
> +#define CONFIG_SYS_MONITOR_LEN (512 << 10)
> +
> +#ifdef CONFIG_SYS_USE_MMC
> +#define CONFIG_SPL_LDSCRIPT arch/arm/cpu/at91-common/u-boot-spl.lds
> +#define CONFIG_SPL_MMC_SUPPORT
> +#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x400
> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x200
> +#define CONFIG_SYS_MMC_SD_FS_BOOT_PARTITION 1
Hi Bo,
You have an extra "_" there: (MMC_SD) -> (MMCSD), it should be:
#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
build error:
common/spl/spl_mmc.c: In function ?spl_mmc_load_image?:
common/spl/spl_mmc.c:135:6: error:
?CONFIG_SYS_MMCSD_FS_BOOT_PARTITION? undeclared (first use in this
function)
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
^
common/spl/spl_mmc.c:135:6: note: each undeclared identifier is
reported only once for each function it appears in
scripts/Makefile.build:275: recipe for target 'spl/common/spl/spl_mmc.o' failed
make[2]: *** [spl/common/spl/spl_mmc.o] Error 1
scripts/Makefile.spl:212: recipe for target 'spl/common/spl' failed
make[1]: *** [spl/common/spl] Error 2
make[1]: *** Waiting for unfinished jobs....
Regards,
--
Robert Nelson
http://www.rcn-ee.com/
next prev parent reply other threads:[~2014-12-10 21:35 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-08 6:09 [U-Boot] [PATCH 0/13] ARM: atmel: enable spl for sama5d4 related boards Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 01/13] ARM: atmel: clock: make it possible to configure HMX32 Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 02/13] ARM: atmel: sama5: add bus matrix header file Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 03/13] ARM: atmel: sama5: add sfr register " Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 04/13] ARM: atmel: spl: add weak bus matrix init function Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 05/13] ARM: atmel: spl: add saic to aic redirect function Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 06/13] ARM: atmel: spl: can not disable osc for sama5d4 Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 07/13] ARM: atmel: sama5d4: add matrix1 base addr definition Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 08/13] ARM: atmel: sama5d4: add bus matrix init function Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 09/13] ARM: atmel: sama5d4: add interrupt redirec function Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 10/13] ARM: atmel: sama5d4: can access DDR in interleave mode Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 11/13] ARM: atmel: sama5d4: build related file when enable SPL Bo Shen
2014-12-08 6:09 ` [U-Boot] [PATCH 12/13] ARM: atmel: sama5d4ek: enable SPL support Bo Shen
2014-12-10 21:38 ` Robert Nelson
2014-12-08 6:09 ` [U-Boot] [PATCH 13/13] ARM: atmel: sama5d4_xplained: enable spl support Bo Shen
2014-12-10 21:35 ` Robert Nelson [this message]
2014-12-11 1:21 ` Bo Shen
2014-12-11 1:29 ` Bo Shen
2014-12-11 1:56 ` Robert Nelson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOCHtYjxQFe9DfH69MU4F1U2BpxgzcmyWNmx554C5wKj3OveGA@mail.gmail.com \
--to=robertcnelson@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.