* [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size @ 2013-01-27 16:39 Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 1/4] at91sam9x5: add autodetect sd/ddram size Jean-Christophe PLAGNIOL-VILLARD 2013-01-28 7:31 ` [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size Sascha Hauer 0 siblings, 2 replies; 6+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-27 16:39 UTC (permalink / raw) To: barebox Hi, The following changes since commit cd1c289b2a4949e8acb235d4847419bde784a9d6: Merge branch 'for-next/misc' into next (2013-01-25 19:51:11 +0100) are available in the git repository at: git://git.jcrosoft.org/barebox.git delivery/at91_ddr_autodetect_size for you to fetch changes up to 1cfd6344df05b57d5ee2103b03f9b3bafcebd0a8: at91: Atmel ref board sam{9x5/9n12/m109g45} EK and Ronetix pm9g45 autodetect ddr size (2013-01-23 17:27:50 +0800) ---------------------------------------------------------------- Jean-Christophe PLAGNIOL-VILLARD (4): at91sam9x5: add autodetect sd/ddram size at91sam9n12: add autodetect sd/ddram size at91sam9g45: add autodetect sd/ddram size at91: Atmel ref board sam{9x5/9n12/m109g45} EK and Ronetix pm9g45 autodetect ddr size arch/arm/boards/at91sam9m10g45ek/init.c | 2 +- arch/arm/boards/at91sam9m10ihd/init.c | 2 +- arch/arm/boards/at91sam9n12ek/init.c | 2 +- arch/arm/boards/at91sam9x5ek/init.c | 2 +- arch/arm/boards/pm9g45/init.c | 2 +- arch/arm/mach-at91/at91sam9g45_devices.c | 4 ++++ arch/arm/mach-at91/at91sam9n12_devices.c | 4 ++++ arch/arm/mach-at91/at91sam9x5_devices.c | 4 ++++ arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 106 insertions(+), 5 deletions(-) Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] at91sam9x5: add autodetect sd/ddram size 2013-01-27 16:39 [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-27 16:40 ` Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 2/4] at91sam9n12: " Jean-Christophe PLAGNIOL-VILLARD ` (2 more replies) 2013-01-28 7:31 ` [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size Sascha Hauer 1 sibling, 3 replies; 6+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-27 16:40 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/mach-at91/at91sam9x5_devices.c | 4 ++ arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | 58 +++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/arch/arm/mach-at91/at91sam9x5_devices.c b/arch/arm/mach-at91/at91sam9x5_devices.c index 8e59fe0..90d8756 100644 --- a/arch/arm/mach-at91/at91sam9x5_devices.c +++ b/arch/arm/mach-at91/at91sam9x5_devices.c @@ -16,6 +16,7 @@ #include <mach/board.h> #include <mach/at91_pmc.h> #include <mach/at91sam9x5_matrix.h> +#include <mach/at91sam9_ddrsdr.h> #include <mach/gpio.h> #include <mach/io.h> #include <mach/cpu.h> @@ -25,6 +26,9 @@ void at91_add_device_sdram(u32 size) { + if (!size) + size = at91sam9x5_get_ddram_size(); + arm_add_mem_device("ram0", AT91_CHIPSELECT_1, size); add_mem_device("sram0", AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE, IORESOURCE_MEM_WRITEABLE); diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h index 070f730..90937f4 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h +++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h @@ -50,6 +50,10 @@ #define AT91_DDRSDRC_OCD (1 << 12) /* Off-Chip Driver [SAM9 Only] */ #define AT91_DDRSDRC_DQMS (1 << 16) /* Mask Data is Shared [SAM9 Only] */ #define AT91_DDRSDRC_ACTBST (1 << 18) /* Active Bank X to Burst Stop Read Access Bank Y [SAM9 Only] */ +#define AT91_DDRSDRC_NB (1 << 20) /* Number of +Banks [not SAM9G45] */ +#define AT91_SDRAMC_NB_4 (0 << 20) +#define AT91_SDRAMC_NB_8 (1 << 20) #define AT91_DDRSDRC_T0PR 0x0C /* Timing 0 Register */ #define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */ @@ -131,4 +135,58 @@ #define AT91_DDRSDRC_WPVS (1 << 0) /* Write protect violation status */ #define AT91_DDRSDRC_WPVSRC (0xffff << 8) /* Write protect violation source */ +#ifndef __ASSEMBLY__ +#include <mach/io.h> + +static inline u32 at91_get_ddram_size(void * __iomem base, bool is_nb) +{ + u32 cr; + u32 mdr; + u32 size; + bool is_sdram; + + cr = __raw_readl(base + AT91_DDRSDRC_CR); + mdr = __raw_readl(base + AT91_DDRSDRC_CR); + + is_sdram = (mdr & AT91_DDRSDRC_MD) <= AT91_DDRSDRC_MD_LOW_POWER_SDR; + + /* Formula: + * size = bank << (col + row + 1); + * if (bandwidth == 32 bits) + * size <<= 1; + */ + size = 1; + /* COL */ + size += (cr & AT91_DDRSDRC_NC) + 8; + if (is_sdram) + size ++; + /* ROW */ + size += ((cr & AT91_DDRSDRC_NR) >> 2) + 11; + /* BANK */ + if (is_nb) + size = ((cr & AT91_DDRSDRC_NB) ? 8 : 4) << size; + else + size = 4 << size; + + /* bandwidth */ + if (!(mdr & AT91_DDRSDRC_DBW)) + size <<= 1; + + return size; +} + +#ifdef CONFIG_SOC_AT91SAM9X5 +static inline u32 at91sam9x5_get_ddram_size(void) +{ + return at91_get_ddram_size(IOMEM(AT91SAM9X5_BASE_DDRSDRC0), true); +} +#else +static inline u32 at91sam9x5_get_ddram_size(void) +{ + return 0; +} +#endif + +#endif + #endif -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] at91sam9n12: add autodetect sd/ddram size 2013-01-27 16:40 ` [PATCH 1/4] at91sam9x5: add autodetect sd/ddram size Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-27 16:40 ` Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 3/4] at91sam9g45: " Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 4/4] at91: Atmel ref board sam{9x5/9n12/m109g45} EK and Ronetix pm9g45 autodetect ddr size Jean-Christophe PLAGNIOL-VILLARD 2 siblings, 0 replies; 6+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-27 16:40 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/mach-at91/at91sam9n12_devices.c | 4 ++++ arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/arm/mach-at91/at91sam9n12_devices.c b/arch/arm/mach-at91/at91sam9n12_devices.c index 9d6e80f..17e2da0 100644 --- a/arch/arm/mach-at91/at91sam9n12_devices.c +++ b/arch/arm/mach-at91/at91sam9n12_devices.c @@ -17,6 +17,7 @@ #include <mach/board.h> #include <mach/at91_pmc.h> #include <mach/at91sam9n12_matrix.h> +#include <mach/at91sam9_ddrsdr.h> #include <mach/gpio.h> #include <mach/io.h> #include <mach/cpu.h> @@ -26,6 +27,9 @@ void at91_add_device_sdram(u32 size) { + if (!size) + size = at91sam9n12_get_ddram_size(); + arm_add_mem_device("ram0", AT91_CHIPSELECT_1, size); add_mem_device("sram0", AT91SAM9N12_SRAM_BASE, AT91SAM9N12_SRAM_SIZE, IORESOURCE_MEM_WRITEABLE); diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h index 90937f4..c90a248 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h +++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h @@ -187,6 +187,18 @@ static inline u32 at91sam9x5_get_ddram_size(void) } #endif +#ifdef CONFIG_SOC_AT91SAM9N12 +static inline u32 at91sam9n12_get_ddram_size(void) +{ + return at91_get_ddram_size(IOMEM(AT91SAM9N12_BASE_DDRSDRC0), true); +} +#else +static inline u32 at91sam9n12_get_ddram_size(void) +{ + return 0; +} +#endif + #endif #endif -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] at91sam9g45: add autodetect sd/ddram size 2013-01-27 16:40 ` [PATCH 1/4] at91sam9x5: add autodetect sd/ddram size Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 2/4] at91sam9n12: " Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-27 16:40 ` Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 4/4] at91: Atmel ref board sam{9x5/9n12/m109g45} EK and Ronetix pm9g45 autodetect ddr size Jean-Christophe PLAGNIOL-VILLARD 2 siblings, 0 replies; 6+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-27 16:40 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/mach-at91/at91sam9g45_devices.c | 4 ++++ arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index c4ca7c6..a2f26b5 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c @@ -15,6 +15,7 @@ #include <asm/hardware.h> #include <mach/at91_pmc.h> #include <mach/at91sam9g45_matrix.h> +#include <mach/at91sam9_ddrsdr.h> #include <mach/board.h> #include <mach/gpio.h> #include <mach/io.h> @@ -24,6 +25,9 @@ void at91_add_device_sdram(u32 size) { + if (!size) + size = at91sam9g45_get_ddram_size(1); + arm_add_mem_device("ram0", AT91_CHIPSELECT_6, size); add_mem_device("sram0", AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE, IORESOURCE_MEM_WRITEABLE); diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h index c90a248..f8699d7 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h +++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h @@ -175,6 +175,25 @@ static inline u32 at91_get_ddram_size(void * __iomem base, bool is_nb) return size; } +#ifdef CONFIG_SOC_AT91SAM9G45 +static inline u32 at91sam9g45_get_ddram_size(int bank) +{ + switch (bank) { + case 0: + return at91_get_ddram_size(IOMEM(AT91SAM9G45_BASE_DDRSDRC0), false); + case 1: + return at91_get_ddram_size(IOMEM(AT91SAM9G45_BASE_DDRSDRC1), false); + default: + return 0; + } +} +#else +static inline u32 at91sam9g45_get_ddram_size(int bank) +{ + return 0; +} +#endif + #ifdef CONFIG_SOC_AT91SAM9X5 static inline u32 at91sam9x5_get_ddram_size(void) { -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] at91: Atmel ref board sam{9x5/9n12/m109g45} EK and Ronetix pm9g45 autodetect ddr size 2013-01-27 16:40 ` [PATCH 1/4] at91sam9x5: add autodetect sd/ddram size Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 2/4] at91sam9n12: " Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 3/4] at91sam9g45: " Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-27 16:40 ` Jean-Christophe PLAGNIOL-VILLARD 2 siblings, 0 replies; 6+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-27 16:40 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/boards/at91sam9m10g45ek/init.c | 2 +- arch/arm/boards/at91sam9m10ihd/init.c | 2 +- arch/arm/boards/at91sam9n12ek/init.c | 2 +- arch/arm/boards/at91sam9x5ek/init.c | 2 +- arch/arm/boards/pm9g45/init.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/boards/at91sam9m10g45ek/init.c b/arch/arm/boards/at91sam9m10g45ek/init.c index 214de96..a32e6cc 100644 --- a/arch/arm/boards/at91sam9m10g45ek/init.c +++ b/arch/arm/boards/at91sam9m10g45ek/init.c @@ -230,7 +230,7 @@ static void ek_add_device_usb(void) {} static int at91sam9m10g45ek_mem_init(void) { - at91_add_device_sdram(128 * 1024 * 1024); + at91_add_device_sdram(0); return 0; } diff --git a/arch/arm/boards/at91sam9m10ihd/init.c b/arch/arm/boards/at91sam9m10ihd/init.c index beede0b..32f6a8c 100644 --- a/arch/arm/boards/at91sam9m10ihd/init.c +++ b/arch/arm/boards/at91sam9m10ihd/init.c @@ -167,7 +167,7 @@ static void ek_add_device_usb(void) static int at91sam9m10g45ek_mem_init(void) { - at91_add_device_sdram(128 * 1024 * 1024); + at91_add_device_sdram(0); return 0; } diff --git a/arch/arm/boards/at91sam9n12ek/init.c b/arch/arm/boards/at91sam9n12ek/init.c index 310f418..57ab607 100644 --- a/arch/arm/boards/at91sam9n12ek/init.c +++ b/arch/arm/boards/at91sam9n12ek/init.c @@ -228,7 +228,7 @@ static void __init ek_add_device_buttons(void) static int at91sam9n12ek_mem_init(void) { - at91_add_device_sdram(128 * 1024 * 1024); + at91_add_device_sdram(0); return 0; } diff --git a/arch/arm/boards/at91sam9x5ek/init.c b/arch/arm/boards/at91sam9x5ek/init.c index 5e11241..29224e2 100644 --- a/arch/arm/boards/at91sam9x5ek/init.c +++ b/arch/arm/boards/at91sam9x5ek/init.c @@ -238,7 +238,7 @@ static void __init ek_add_led(void) static int at91sam9x5ek_mem_init(void) { - at91_add_device_sdram(128 * 1024 * 1024); + at91_add_device_sdram(0); return 0; } diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c index 8e29f62..db1c551 100644 --- a/arch/arm/boards/pm9g45/init.c +++ b/arch/arm/boards/pm9g45/init.c @@ -137,7 +137,7 @@ static void pm9g45_add_device_eth(void) static int pm9g45_mem_init(void) { - at91_add_device_sdram(128 * 1024 * 1024); + at91_add_device_sdram(0); return 0; } -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size 2013-01-27 16:39 [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 1/4] at91sam9x5: add autodetect sd/ddram size Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-28 7:31 ` Sascha Hauer 1 sibling, 0 replies; 6+ messages in thread From: Sascha Hauer @ 2013-01-28 7:31 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox On Sun, Jan 27, 2013 at 05:39:03PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote: > Hi, > > The following changes since commit cd1c289b2a4949e8acb235d4847419bde784a9d6: > > Merge branch 'for-next/misc' into next (2013-01-25 19:51:11 +0100) > > are available in the git repository at: > > > git://git.jcrosoft.org/barebox.git delivery/at91_ddr_autodetect_size Applied, thanks Sascha > > for you to fetch changes up to 1cfd6344df05b57d5ee2103b03f9b3bafcebd0a8: > > at91: Atmel ref board sam{9x5/9n12/m109g45} EK and Ronetix pm9g45 autodetect ddr size (2013-01-23 17:27:50 +0800) > > ---------------------------------------------------------------- > Jean-Christophe PLAGNIOL-VILLARD (4): > at91sam9x5: add autodetect sd/ddram size > at91sam9n12: add autodetect sd/ddram size > at91sam9g45: add autodetect sd/ddram size > at91: Atmel ref board sam{9x5/9n12/m109g45} EK and Ronetix pm9g45 autodetect ddr size > > arch/arm/boards/at91sam9m10g45ek/init.c | 2 +- > arch/arm/boards/at91sam9m10ihd/init.c | 2 +- > arch/arm/boards/at91sam9n12ek/init.c | 2 +- > arch/arm/boards/at91sam9x5ek/init.c | 2 +- > arch/arm/boards/pm9g45/init.c | 2 +- > arch/arm/mach-at91/at91sam9g45_devices.c | 4 ++++ > arch/arm/mach-at91/at91sam9n12_devices.c | 4 ++++ > arch/arm/mach-at91/at91sam9x5_devices.c | 4 ++++ > arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 9 files changed, 106 insertions(+), 5 deletions(-) > > Best Regards, > J. > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-01-28 7:31 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-01-27 16:39 [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 1/4] at91sam9x5: add autodetect sd/ddram size Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 2/4] at91sam9n12: " Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 3/4] at91sam9g45: " Jean-Christophe PLAGNIOL-VILLARD 2013-01-27 16:40 ` [PATCH 4/4] at91: Atmel ref board sam{9x5/9n12/m109g45} EK and Ronetix pm9g45 autodetect ddr size Jean-Christophe PLAGNIOL-VILLARD 2013-01-28 7:31 ` [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox