diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/include/asm/mach-types.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91_pmc.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/atmel_mpddrc.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-at91/mpddrc.c | 41 |
5 files changed, 34 insertions, 21 deletions
diff --git a/arch/arm/include/asm/mach-types.h b/arch/arm/include/asm/mach-types.h index 847da59..e72184b 100644 --- a/arch/arm/include/asm/mach-types.h +++ b/arch/arm/include/asm/mach-types.h @@ -1105,6 +1105,7 @@ extern unsigned int __machine_arch_type; #define MACH_TYPE_UBISYS_P9D_EVP 3493 #define MACH_TYPE_ATDGP318 3494 #define MACH_TYPE_OMAP5_SEVM 3777 +#define MACH_TYPE_PICOSAM9G45 3838 #define MACH_TYPE_ARMADILLO_800EVA 3863 #define MACH_TYPE_KZM9G 4140 #define MACH_TYPE_COLIBRI_T30 4493 diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index d8d46dc..f9f148d 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -64,6 +64,11 @@ config TARGET_PM9G45 bool "Ronetix pm9g45 board" select CPU_ARM926EJS +config TARGET_PICOSAM9G45 + bool "Mini-box picosam9g45 board" + select CPU_ARM926EJS + select SUPPORT_SPL + config TARGET_AT91SAM9N12EK bool "Atmel AT91SAM9N12-EK board" select CPU_ARM926EJS @@ -155,6 +160,7 @@ source "board/egnite/ethernut5/Kconfig" source "board/esd/meesc/Kconfig" source "board/esd/otc570/Kconfig" source "board/eukrea/cpu9260/Kconfig" +source "board/mini-box/picosam9g45/Kconfig" source "board/ronetix/pm9261/Kconfig" source "board/ronetix/pm9263/Kconfig" source "board/ronetix/pm9g45/Kconfig" diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h index ebb7dec..8a3fb94 100644 --- a/arch/arm/mach-at91/include/mach/at91_pmc.h +++ b/arch/arm/mach-at91/include/mach/at91_pmc.h @@ -158,6 +158,7 @@ typedef struct at91_pmc { #define AT91_PMC_PCK (1 << 0) /* Processor Clock */ #define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */ +#define AT91_PMC_DDR (1 << 2) /* DDR Clock */ #define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */ #define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */ #define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */ diff --git a/arch/arm/mach-at91/include/mach/atmel_mpddrc.h b/arch/arm/mach-at91/include/mach/atmel_mpddrc.h index 130a85a..c6c8dda 100644 --- a/arch/arm/mach-at91/include/mach/atmel_mpddrc.h +++ b/arch/arm/mach-at91/include/mach/atmel_mpddrc.h @@ -23,8 +23,10 @@ struct atmel_mpddr { u32 md; }; -int ddr2_init(const unsigned int ram_address, - const struct atmel_mpddr *mpddr); + +int ddr2_init(const unsigned int base, + const unsigned int ram_address, + const struct atmel_mpddr *mpddr); /* Bit field in mode register */ #define ATMEL_MPDDRC_MR_MODE_NORMAL_CMD 0x0 diff --git a/arch/arm/mach-at91/mpddrc.c b/arch/arm/mach-at91/mpddrc.c index e2b6a49..47e6e5a 100644 --- a/arch/arm/mach-at91/mpddrc.c +++ b/arch/arm/mach-at91/mpddrc.c @@ -9,10 +9,10 @@ #include <asm/io.h> #include <asm/arch/atmel_mpddrc.h> -static inline void atmel_mpddr_op(int mode, u32 ram_address) +static inline void atmel_mpddr_op(const struct atmel_mpddr *mpddr, + int mode, + u32 ram_address) { - struct atmel_mpddr *mpddr = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC; - writel(mode, &mpddr->mr); writel(0, ram_address); } @@ -27,10 +27,13 @@ static int ddr2_decodtype_is_seq(u32 cr) return 1; } -int ddr2_init(const unsigned int ram_address, + +int ddr2_init(const unsigned int base, + const unsigned int ram_address, const struct atmel_mpddr *mpddr_value) { - struct atmel_mpddr *mpddr = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC; + const struct atmel_mpddr *mpddr = (struct atmel_mpddr *)base; + u32 ba_off, cr; /* Compute bank offset according to NC in configuration register */ @@ -52,30 +55,30 @@ int ddr2_init(const unsigned int ram_address, writel(mpddr_value->tpr2, &mpddr->tpr2); /* Issue a NOP command */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_NOP_CMD, ram_address); + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_NOP_CMD, ram_address); /* A 200 us is provided to precede any signal toggle */ udelay(200); /* Issue a NOP command */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_NOP_CMD, ram_address); + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_NOP_CMD, ram_address); /* Issue an all banks precharge command */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_PRCGALL_CMD, ram_address); + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_PRCGALL_CMD, ram_address); /* Issue an extended mode register set(EMRS2) to choose operation */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, ram_address + (0x2 << ba_off)); /* Issue an extended mode register set(EMRS3) to set EMSR to 0 */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, ram_address + (0x3 << ba_off)); /* * Issue an extended mode register set(EMRS1) to enable DLL and * program D.I.C (output driver impedance control) */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, ram_address + (0x1 << ba_off)); /* Enable DLL reset */ @@ -83,21 +86,21 @@ int ddr2_init(const unsigned int ram_address, writel(cr | ATMEL_MPDDRC_CR_DLL_RESET_ENABLED, &mpddr->cr); /* A mode register set(MRS) cycle is issued to reset DLL */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_LMR_CMD, ram_address); + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_LMR_CMD, ram_address); /* Issue an all banks precharge command */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_PRCGALL_CMD, ram_address); + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_PRCGALL_CMD, ram_address); /* Two auto-refresh (CBR) cycles are provided */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_RFSH_CMD, ram_address); - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_RFSH_CMD, ram_address); + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_RFSH_CMD, ram_address); + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_RFSH_CMD, ram_address); /* Disable DLL reset */ cr = readl(&mpddr->cr); writel(cr & (~ATMEL_MPDDRC_CR_DLL_RESET_ENABLED), &mpddr->cr); /* A mode register set (MRS) cycle is issued to disable DLL reset */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_LMR_CMD, ram_address); + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_LMR_CMD, ram_address); /* Set OCD calibration in default state */ cr = readl(&mpddr->cr); @@ -107,7 +110,7 @@ int ddr2_init(const unsigned int ram_address, * An extended mode register set (EMRS1) cycle is issued * to OCD default value */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, ram_address + (0x1 << ba_off)); /* OCD calibration mode exit */ @@ -118,11 +121,11 @@ int ddr2_init(const unsigned int ram_address, * An extended mode register set (EMRS1) cycle is issued * to enable OCD exit */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_EXT_LMR_CMD, ram_address + (0x1 << ba_off)); /* A nornal mode command is provided */ - atmel_mpddr_op(ATMEL_MPDDRC_MR_MODE_NORMAL_CMD, ram_address); + atmel_mpddr_op(mpddr, ATMEL_MPDDRC_MR_MODE_NORMAL_CMD, ram_address); /* Perform a write access to any DDR2-SDRAM address */ writel(0, ram_address); |