* [PATCH] Added SDR-size auto detection.
@ 2012-07-18 12:58 Juergen Kilb
2012-07-18 12:58 ` [PATCH] omap_hsmmc: Hack allert! Add delay in omap_hsmmc Juergen Kilb
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Juergen Kilb @ 2012-07-18 12:58 UTC (permalink / raw)
To: barebox; +Cc: Juergen Kilb
Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---
arch/arm/boards/phycard-a-l1/pca-a-l1.c | 169 +++++++++++++++++++++++--------
1 files changed, 125 insertions(+), 44 deletions(-)
diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
index a388f63..1dc7678 100644
--- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
+++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
@@ -73,10 +73,82 @@
#define SMC911X_BASE 0x2c000000
+/* Slower full frequency range default timings for x32 operation */
+#define SDP_SDRC_SHARING 0x00000100
+/* Diabling power down mode using CKE pin */
+#define SDP_SDRC_POWER_POP 0x00000081
+/* rkw - need to find of 90/72 degree recommendation for speed like before. */
+#define SDP_SDRC_DLLAB_CTRL ((DLL_ENADLL << 3) | \
+ (DLL_LOCKDLL << 2) | (DLL_DLLPHASE_90 << 1))
+
+/* used to create an array of memory configuartions. */
+struct sdrc_config {
+ u32 cs_cfg;
+ u32 mcfg;
+ u32 mr;
+ u32 actim_ctrla;
+ u32 actim_ctrlb;
+ u32 rfr_ctrl;
+} const sdrc_config[] = {
+/* max cs_size for autodetection, common timing */
+/* 2x256MByte, 14 Rows, 10 Columns , RBC (BAL=2) */
+{ 0x00000004, 0x03590099, 0x00000032, 0x9A9DB4C6, 0x00011216, 0x0004e201},
+/* MT46H32M32LF 2x128MByte, 13 Rows, 10 Columns */
+{ 0x00000001, 0x02584099, 0x00000032, 0x9A9DB4C6, 0x00011216, 0x0004e201},
+/* MT46H64M32LF 1x256MByte, 14 Rows, 10 Columns */
+{ 0x00000002, 0x03588099, 0x00000032, 0x629DB4C6, 0x00011113, 0x0004e201},
+/* MT64H128M32L2 2x256MByte, 14 Rows, 10 Columns */
+{ 0x00000002, 0x03588099, 0x00000032, 0x629DB4C6, 0x00011113, 0x0004e201},
+};
+
/*
* Boot-time initialization(s)
*/
+/*********************************************************************
+ * init_sdram_ddr() - Init DDR controller.
+ *********************************************************************/
+void init_sdram_ddr(void)
+{
+ /* reset sdrc controller */
+ writel(SOFTRESET, SDRC_REG(SYSCONFIG));
+ wait_on_value(1<<0, 1<<0, SDRC_REG(STATUS), 12000000);
+ writel(0, SDRC_REG(SYSCONFIG));
+
+ /* setup sdrc to ball mux */
+ writel(SDP_SDRC_SHARING, SDRC_REG(SHARING));
+ writel(SDP_SDRC_POWER_POP, SDRC_REG(POWER));
+
+ /* set up dll */
+ writel(SDP_SDRC_DLLAB_CTRL, SDRC_REG(DLLA_CTRL));
+ sdelay(0x2000); /* give time to lock */
+
+}
+/*********************************************************************
+ * config_sdram_ddr() - Init DDR on dev board.
+ *********************************************************************/
+void config_sdram_ddr(u8 cs, u8 cfg)
+{
+
+ writel(sdrc_config[cfg].mcfg, SDRC_REG(MCFG_0) + (0x30 * cs));
+ writel(sdrc_config[cfg].actim_ctrla, SDRC_REG(ACTIM_CTRLA_0) + (0x28 * cs));
+ writel(sdrc_config[cfg].actim_ctrlb, SDRC_REG(ACTIM_CTRLB_0) + (0x28 * cs));
+ writel(sdrc_config[cfg].rfr_ctrl, SDRC_REG(RFR_CTRL_0) + (0x30 * cs));
+
+ writel(CMD_NOP, SDRC_REG(MANUAL_0) + (0x30 * cs));
+
+ sdelay(5000);
+
+ writel(CMD_PRECHARGE, SDRC_REG(MANUAL_0) + (0x30 * cs));
+ writel(CMD_AUTOREFRESH, SDRC_REG(MANUAL_0) + (0x30 * cs));
+ writel(CMD_AUTOREFRESH, SDRC_REG(MANUAL_0) + (0x30 * cs));
+
+ /* set mr0 */
+ writel(sdrc_config[cfg].mr, SDRC_REG(MR_0) + (0x30 * cs));
+
+ sdelay(2000);
+}
+
/**
* @brief Initialize the SDRC module
* Initialisation for 1x256MByte but normally
@@ -85,49 +157,55 @@
*/
static void pcaal1_sdrc_init(void)
{
- /* SDRAM software reset */
- /* No idle ack and RESET enable */
- writel(0x1A, SDRC_REG(SYSCONFIG));
- sdelay(100);
- /* No idle ack and RESET disable */
- writel(0x18, SDRC_REG(SYSCONFIG));
-
- /* SDRC Sharing register */
- /* 32-bit SDRAM on data lane [31:0] - CS0 */
- /* pin tri-stated = 1 */
- writel(0x00000100, SDRC_REG(SHARING));
-
- /* ----- SDRC Registers Configuration --------- */
- /* SDRC_MCFG0 register */
- writel(0x03588099, SDRC_REG(MCFG_0));
-
- /* SDRC_RFR_CTRL0 register */
- writel(0x0004e201, SDRC_REG(RFR_CTRL_0));
-
- /* SDRC_ACTIM_CTRLA0 register */
- writel(0x629DB4C6, SDRC_REG(ACTIM_CTRLA_0));
-
- /* SDRC_ACTIM_CTRLB0 register */
- writel(0x00011113, SDRC_REG(ACTIM_CTRLB_0));
-
- /* Disble Power Down of CKE due to 1 CKE on combo part */
- writel(0x00000081, SDRC_REG(POWER));
-
- /* SDRC_MANUAL command register */
- /* NOP command */
- writel(0x00000000, SDRC_REG(MANUAL_0));
- /* Precharge command */
- writel(0x00000001, SDRC_REG(MANUAL_0));
- /* Auto-refresh command */
- writel(0x00000002, SDRC_REG(MANUAL_0));
- /* Auto-refresh command */
- writel(0x00000002, SDRC_REG(MANUAL_0));
-
- /* SDRC MR0 register Burst length=4 */
- writel(0x00000032, SDRC_REG(MR_0));
-
- /* SDRC DLLA control register */
- writel(0x0000000A, SDRC_REG(DLLA_CTRL));
+ u32 test0, test1;
+ char cfg;
+
+ init_sdram_ddr();
+
+ config_sdram_ddr(0, 0); /* 256MByte at CS0 */
+ config_sdram_ddr(1, 0); /* 256MByte at CS1 */
+
+ test0 = get_ram_size((long *) 0x80000000, SZ_256M);
+ test1 = get_ram_size((long *) 0xA0000000, SZ_256M);
+
+ /* mask out lower nible, its not tested with
+ in common/memsize.c */
+ test1 &= 0xfffffff0;
+
+ if ((test1 > 0) && (test1 != test0))
+ hang();
+
+ cfg = -1; /* illegal configuration found */
+
+ if (test1 == 0) {
+ init_sdram_ddr();
+ writel((sdrc_config[(uchar) cfg].mcfg & 0xfffc00ff), SDRC_REG(MCFG_1));
+
+ /* 1 x 256MByte */
+ if (test0 == SZ_256M)
+ cfg = 2;
+
+ if (cfg != -1) {
+ config_sdram_ddr(0, cfg);
+ writel(sdrc_config[(uchar) cfg].cs_cfg, SDRC_REG(CS_CFG));
+ }
+ return;
+ }
+
+ /* reinit both cs with correct size */
+ /* 2 x 128MByte */
+ if (test0 == SZ_128M)
+ cfg = 1;
+ /* 2 x 256MByte */
+ if (test0 == SZ_256M)
+ cfg = 3;
+
+ if (cfg != -1) {
+ init_sdram_ddr();
+ writel(sdrc_config[(uchar) cfg].cs_cfg, SDRC_REG(CS_CFG));
+ config_sdram_ddr(0, cfg);
+ config_sdram_ddr(1, cfg);
+ }
}
/**
@@ -296,9 +374,12 @@ static int pcaal1_mem_init(void)
IORESOURCE_MEM_WRITEABLE);
arm_add_mem_device("ram0", OMAP_SDRC_CS0, get_sdr_cs_size(SDRC_CS0_OSET));
+ printf("found %s at SDCS0\n", size_human_readable(get_sdr_cs_size(SDRC_CS0_OSET)));
- if ((get_sdr_cs_size(SDRC_CS1_OSET) != 0) && (get_sdr_cs1_base() != OMAP_SDRC_CS0))
+ if ((get_sdr_cs_size(SDRC_CS1_OSET) != 0) && (get_sdr_cs1_base() != OMAP_SDRC_CS0)) {
arm_add_mem_device("ram1", get_sdr_cs1_base(), get_sdr_cs_size(SDRC_CS1_OSET));
+ printf("found %s at SDCS1\n", size_human_readable(get_sdr_cs_size(SDRC_CS1_OSET)));
+ }
return 0;
}
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] omap_hsmmc: Hack allert! Add delay in omap_hsmmc.
2012-07-18 12:58 [PATCH] Added SDR-size auto detection Juergen Kilb
@ 2012-07-18 12:58 ` Juergen Kilb
2012-07-18 12:58 ` [PATCH] pca-a-l1: added memory device for int. 60kB RAM Juergen Kilb
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Juergen Kilb @ 2012-07-18 12:58 UTC (permalink / raw)
To: barebox; +Cc: Juergen Kilb
Most of the time, a SD card was not found during probing.
This hack fixed the problem.
Further investigation needed !!
Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---
drivers/mci/omap_hsmmc.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c
index e0b245b..125e8a4 100644
--- a/drivers/mci/omap_hsmmc.c
+++ b/drivers/mci/omap_hsmmc.c
@@ -472,6 +472,8 @@ static int mmc_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
writel(cmd->cmdarg, &mmc_base->arg);
writel((cmd->cmdidx << 24) | flags, &mmc_base->cmd);
+ mdelay(5); /* wait 5 ms */
+
start = get_time_ns();
do {
mmc_stat = readl(&mmc_base->stat);
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] pca-a-l1: added memory device for int. 60kB RAM.
2012-07-18 12:58 [PATCH] Added SDR-size auto detection Juergen Kilb
2012-07-18 12:58 ` [PATCH] omap_hsmmc: Hack allert! Add delay in omap_hsmmc Juergen Kilb
@ 2012-07-18 12:58 ` Juergen Kilb
2012-07-19 13:10 ` Sascha Hauer
2012-07-18 12:58 ` [PATCH] phyCARD-A-L1: Create xload configuration Juergen Kilb
2012-07-20 7:24 ` [PATCH] Added SDR-size auto detection Sascha Hauer
3 siblings, 1 reply; 7+ messages in thread
From: Juergen Kilb @ 2012-07-18 12:58 UTC (permalink / raw)
To: barebox; +Cc: Juergen Kilb
Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---
arch/arm/boards/phycard-a-l1/pca-a-l1.c | 2 ++
arch/arm/mach-omap/include/mach/omap3-silicon.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
index 1cc2815..8fae405 100644
--- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
+++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
@@ -292,6 +292,8 @@ static int pcaal1_mem_init(void)
*/
gpmc_generic_init(0x10);
#endif
+ add_mem_device("sram0", OMAP_SRAM_BASE, 60 * SZ_1K,
+ IORESOURCE_MEM_WRITEABLE);
arm_add_mem_device("ram0", OMAP_SDRC_CS0, get_sdr_cs_size(SDRC_CS0_OSET));
diff --git a/arch/arm/mach-omap/include/mach/omap3-silicon.h b/arch/arm/mach-omap/include/mach/omap3-silicon.h
index 361d25e..e4002e6 100644
--- a/arch/arm/mach-omap/include/mach/omap3-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap3-silicon.h
@@ -107,6 +107,7 @@
#define OMAP_EHCI_BASE (OMAP_L4_CORE_BASE + 0x64800)
/** Interrupt Vector base address */
+#define OMAP_SRAM_BASE 0x40200000
#define OMAP_SRAM_INTVECT 0x4020F800
#define OMAP_SRAM_INTVECT_COPYSIZE 0x64
/** Temporary stack for us to use C calls in low_level_init */
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] phyCARD-A-L1: Create xload configuration.
2012-07-18 12:58 [PATCH] Added SDR-size auto detection Juergen Kilb
2012-07-18 12:58 ` [PATCH] omap_hsmmc: Hack allert! Add delay in omap_hsmmc Juergen Kilb
2012-07-18 12:58 ` [PATCH] pca-a-l1: added memory device for int. 60kB RAM Juergen Kilb
@ 2012-07-18 12:58 ` Juergen Kilb
2012-07-20 7:24 ` [PATCH] Added SDR-size auto detection Sascha Hauer
3 siblings, 0 replies; 7+ messages in thread
From: Juergen Kilb @ 2012-07-18 12:58 UTC (permalink / raw)
To: barebox; +Cc: Juergen Kilb
This configuration can be used to use barebox as
x-loader replacement.
Also the ECC-Mode is changed from SOFT to BCH8.
Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---
arch/arm/boards/phycard-a-l1/pca-a-l1.c | 10 ++----
arch/arm/configs/phycard_a_l1_xload_defconfig | 43 +++++++++++++++++++++++++
arch/arm/mach-omap/Kconfig | 1 +
3 files changed, 47 insertions(+), 7 deletions(-)
create mode 100644 arch/arm/configs/phycard_a_l1_xload_defconfig
diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
index 8fae405..a388f63 100644
--- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
+++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
@@ -312,6 +312,7 @@ struct omap_hsmmc_platform_data pcaal1_hsmmc_plat = {
static int pcaal1_init_devices(void)
{
+ gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_BCH8_CODE_HW, &omap3_nand_cfg);
#ifdef CONFIG_MCI_OMAP_HSMMC
add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
IORESOURCE_MEM, &pcaal1_hsmmc_plat);
@@ -332,12 +333,7 @@ device_initcall(pcaal1_init_devices);
static int pcaal1_late_init(void)
{
- struct device_d *nand;
-
- gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_SOFT, &omap3_nand_cfg);
-
- nand = get_device_by_name("nand0");
-
+#ifdef CONFIG_PARTITION
devfs_add_partition("nand0", 0x00000, 0x80000, DEVFS_PARTITION_FIXED, "x-loader");
dev_add_bb_dev("self_raw", "x_loader0");
@@ -346,7 +342,7 @@ static int pcaal1_late_init(void)
devfs_add_partition("nand0", 0x260000, 0x20000, DEVFS_PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
-
+#endif
return 0;
}
late_initcall(pcaal1_late_init);
diff --git a/arch/arm/configs/phycard_a_l1_xload_defconfig b/arch/arm/configs/phycard_a_l1_xload_defconfig
new file mode 100644
index 0000000..30253cb
--- /dev/null
+++ b/arch/arm/configs/phycard_a_l1_xload_defconfig
@@ -0,0 +1,43 @@
+CONFIG_ARCH_OMAP=y
+CONFIG_OMAP_BUILD_IFT=y
+CONFIG_MACH_PCAAL1=y
+CONFIG_AEABI=y
+CONFIG_THUMB2_BAREBOX=y
+# CONFIG_CMD_ARM_CPUINFO is not set
+# CONFIG_ARM_EXCEPTIONS is not set
+CONFIG_ENVIRONMENT_VARIABLES=y
+CONFIG_TEXT_BASE=0x40200000
+CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x0000f000
+CONFIG_BAREBOX_MAX_BARE_INIT_SIZE=0x0000f000
+CONFIG_MEMORY_LAYOUT_FIXED=y
+CONFIG_STACK_BASE=0x4020F000
+CONFIG_STACK_SIZE=0xc00
+CONFIG_MALLOC_BASE=0x84000000
+CONFIG_MALLOC_SIZE=0x1000000
+CONFIG_MALLOC_DUMMY=y
+CONFIG_PROMPT="X-load pca-a-l1>"
+CONFIG_CBSIZE=128
+CONFIG_SHELL_NONE=y
+# CONFIG_ERRNO_MESSAGES is not set
+# CONFIG_TIMESTAMP is not set
+# CONFIG_CONSOLE_FULL is not set
+# CONFIG_DEFAULT_ENVIRONMENT is not set
+CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
+# CONFIG_SPI is not set
+CONFIG_MTD=y
+# CONFIG_MTD_WRITE is not set
+# CONFIG_MTD_OOB_DEVICE is not set
+CONFIG_NAND=y
+# CONFIG_NAND_ECC_SOFT is not set
+# CONFIG_NAND_ECC_HW_SYNDROME is not set
+# CONFIG_NAND_ECC_HW_NONE is not set
+# CONFIG_NAND_BBT is not set
+CONFIG_NAND_OMAP_GPMC=y
+CONFIG_MCI=y
+CONFIG_MCI_STARTUP=y
+# CONFIG_MCI_WRITE is not set
+CONFIG_MCI_OMAP_HSMMC=y
+# CONFIG_FS_RAMFS is not set
+# CONFIG_FS_DEVFS is not set
+CONFIG_FS_FAT=y
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index 386c484..d735284 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -151,6 +151,7 @@ config MACH_PCM049
config MACH_PCAAL1
bool "Phytec phyCARD-A-L1"
select OMAP_CLOCK_ALL
+ select HAVE_NOSHELL
depends on ARCH_OMAP3
help
Say Y here if you are using a phyCARD-A-L1 PCA-A-L1
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pca-a-l1: added memory device for int. 60kB RAM.
2012-07-18 12:58 ` [PATCH] pca-a-l1: added memory device for int. 60kB RAM Juergen Kilb
@ 2012-07-19 13:10 ` Sascha Hauer
2012-07-19 18:04 ` Jürgen Kilb
0 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2012-07-19 13:10 UTC (permalink / raw)
To: Juergen Kilb; +Cc: barebox
Hi Jürgen,
On Wed, Jul 18, 2012 at 02:58:46PM +0200, Juergen Kilb wrote:
>
> Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
> ---
> arch/arm/boards/phycard-a-l1/pca-a-l1.c | 2 ++
> arch/arm/mach-omap/include/mach/omap3-silicon.h | 1 +
> 2 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
> index 1cc2815..8fae405 100644
> --- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
> +++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
> @@ -292,6 +292,8 @@ static int pcaal1_mem_init(void)
> */
> gpmc_generic_init(0x10);
> #endif
> + add_mem_device("sram0", OMAP_SRAM_BASE, 60 * SZ_1K,
> + IORESOURCE_MEM_WRITEABLE);
Isn't this 64K? Or does the ROM code store stuff in the upper 4k which
you want to preserve?
Sascha
--
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] 7+ messages in thread
* Re: [PATCH] pca-a-l1: added memory device for int. 60kB RAM.
2012-07-19 13:10 ` Sascha Hauer
@ 2012-07-19 18:04 ` Jürgen Kilb
0 siblings, 0 replies; 7+ messages in thread
From: Jürgen Kilb @ 2012-07-19 18:04 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
On 19.07.2012 15:10, Sascha Hauer wrote:
> Hi Jürgen,
>
> On Wed, Jul 18, 2012 at 02:58:46PM +0200, Juergen Kilb wrote:
>> Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
>> ---
>> arch/arm/boards/phycard-a-l1/pca-a-l1.c | 2 ++
>> arch/arm/mach-omap/include/mach/omap3-silicon.h | 1 +
>> 2 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
>> index 1cc2815..8fae405 100644
>> --- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
>> +++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
>> @@ -292,6 +292,8 @@ static int pcaal1_mem_init(void)
>> */
>> gpmc_generic_init(0x10);
>> #endif
>> + add_mem_device("sram0", OMAP_SRAM_BASE, 60 * SZ_1K,
>> + IORESOURCE_MEM_WRITEABLE);
> Isn't this 64K? Or does the ROM code store stuff in the upper 4k which
> you want to preserve?
Yes it is a 64K memory range but it is splitted into 5 regions and they are
used during the booting process.
0x4020_0000 - 0x4020_EFFF => Used for storing a downloaded booting image
0x4020_F000 - 0x4020_FCAF => Public Stack (reserved for stacks)
0x4020_FCB0 - 0x4020_FFC7 => Tracing Data
0x4020_FFC8 - 0x4020_FFFF => RAM exception Vectors
We can increase the size to 0xFCB0 but I think it's better to use only 60K.
At least the tracing vectors should be preserved.
> Sascha
>
Jürgen
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Added SDR-size auto detection.
2012-07-18 12:58 [PATCH] Added SDR-size auto detection Juergen Kilb
` (2 preceding siblings ...)
2012-07-18 12:58 ` [PATCH] phyCARD-A-L1: Create xload configuration Juergen Kilb
@ 2012-07-20 7:24 ` Sascha Hauer
3 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2012-07-20 7:24 UTC (permalink / raw)
To: Juergen Kilb; +Cc: barebox
Hi Jürgen,
Applied this series except the hack alert.
Sascha
On Wed, Jul 18, 2012 at 02:58:44PM +0200, Juergen Kilb wrote:
>
> Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
> ---
> arch/arm/boards/phycard-a-l1/pca-a-l1.c | 169 +++++++++++++++++++++++--------
> 1 files changed, 125 insertions(+), 44 deletions(-)
>
> diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
> index a388f63..1dc7678 100644
> --- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
> +++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
> @@ -73,10 +73,82 @@
>
> #define SMC911X_BASE 0x2c000000
>
> +/* Slower full frequency range default timings for x32 operation */
> +#define SDP_SDRC_SHARING 0x00000100
> +/* Diabling power down mode using CKE pin */
> +#define SDP_SDRC_POWER_POP 0x00000081
> +/* rkw - need to find of 90/72 degree recommendation for speed like before. */
> +#define SDP_SDRC_DLLAB_CTRL ((DLL_ENADLL << 3) | \
> + (DLL_LOCKDLL << 2) | (DLL_DLLPHASE_90 << 1))
> +
> +/* used to create an array of memory configuartions. */
> +struct sdrc_config {
> + u32 cs_cfg;
> + u32 mcfg;
> + u32 mr;
> + u32 actim_ctrla;
> + u32 actim_ctrlb;
> + u32 rfr_ctrl;
> +} const sdrc_config[] = {
> +/* max cs_size for autodetection, common timing */
> +/* 2x256MByte, 14 Rows, 10 Columns , RBC (BAL=2) */
> +{ 0x00000004, 0x03590099, 0x00000032, 0x9A9DB4C6, 0x00011216, 0x0004e201},
> +/* MT46H32M32LF 2x128MByte, 13 Rows, 10 Columns */
> +{ 0x00000001, 0x02584099, 0x00000032, 0x9A9DB4C6, 0x00011216, 0x0004e201},
> +/* MT46H64M32LF 1x256MByte, 14 Rows, 10 Columns */
> +{ 0x00000002, 0x03588099, 0x00000032, 0x629DB4C6, 0x00011113, 0x0004e201},
> +/* MT64H128M32L2 2x256MByte, 14 Rows, 10 Columns */
> +{ 0x00000002, 0x03588099, 0x00000032, 0x629DB4C6, 0x00011113, 0x0004e201},
> +};
> +
> /*
> * Boot-time initialization(s)
> */
>
> +/*********************************************************************
> + * init_sdram_ddr() - Init DDR controller.
> + *********************************************************************/
> +void init_sdram_ddr(void)
> +{
> + /* reset sdrc controller */
> + writel(SOFTRESET, SDRC_REG(SYSCONFIG));
> + wait_on_value(1<<0, 1<<0, SDRC_REG(STATUS), 12000000);
> + writel(0, SDRC_REG(SYSCONFIG));
> +
> + /* setup sdrc to ball mux */
> + writel(SDP_SDRC_SHARING, SDRC_REG(SHARING));
> + writel(SDP_SDRC_POWER_POP, SDRC_REG(POWER));
> +
> + /* set up dll */
> + writel(SDP_SDRC_DLLAB_CTRL, SDRC_REG(DLLA_CTRL));
> + sdelay(0x2000); /* give time to lock */
> +
> +}
> +/*********************************************************************
> + * config_sdram_ddr() - Init DDR on dev board.
> + *********************************************************************/
> +void config_sdram_ddr(u8 cs, u8 cfg)
> +{
> +
> + writel(sdrc_config[cfg].mcfg, SDRC_REG(MCFG_0) + (0x30 * cs));
> + writel(sdrc_config[cfg].actim_ctrla, SDRC_REG(ACTIM_CTRLA_0) + (0x28 * cs));
> + writel(sdrc_config[cfg].actim_ctrlb, SDRC_REG(ACTIM_CTRLB_0) + (0x28 * cs));
> + writel(sdrc_config[cfg].rfr_ctrl, SDRC_REG(RFR_CTRL_0) + (0x30 * cs));
> +
> + writel(CMD_NOP, SDRC_REG(MANUAL_0) + (0x30 * cs));
> +
> + sdelay(5000);
> +
> + writel(CMD_PRECHARGE, SDRC_REG(MANUAL_0) + (0x30 * cs));
> + writel(CMD_AUTOREFRESH, SDRC_REG(MANUAL_0) + (0x30 * cs));
> + writel(CMD_AUTOREFRESH, SDRC_REG(MANUAL_0) + (0x30 * cs));
> +
> + /* set mr0 */
> + writel(sdrc_config[cfg].mr, SDRC_REG(MR_0) + (0x30 * cs));
> +
> + sdelay(2000);
> +}
> +
> /**
> * @brief Initialize the SDRC module
> * Initialisation for 1x256MByte but normally
> @@ -85,49 +157,55 @@
> */
> static void pcaal1_sdrc_init(void)
> {
> - /* SDRAM software reset */
> - /* No idle ack and RESET enable */
> - writel(0x1A, SDRC_REG(SYSCONFIG));
> - sdelay(100);
> - /* No idle ack and RESET disable */
> - writel(0x18, SDRC_REG(SYSCONFIG));
> -
> - /* SDRC Sharing register */
> - /* 32-bit SDRAM on data lane [31:0] - CS0 */
> - /* pin tri-stated = 1 */
> - writel(0x00000100, SDRC_REG(SHARING));
> -
> - /* ----- SDRC Registers Configuration --------- */
> - /* SDRC_MCFG0 register */
> - writel(0x03588099, SDRC_REG(MCFG_0));
> -
> - /* SDRC_RFR_CTRL0 register */
> - writel(0x0004e201, SDRC_REG(RFR_CTRL_0));
> -
> - /* SDRC_ACTIM_CTRLA0 register */
> - writel(0x629DB4C6, SDRC_REG(ACTIM_CTRLA_0));
> -
> - /* SDRC_ACTIM_CTRLB0 register */
> - writel(0x00011113, SDRC_REG(ACTIM_CTRLB_0));
> -
> - /* Disble Power Down of CKE due to 1 CKE on combo part */
> - writel(0x00000081, SDRC_REG(POWER));
> -
> - /* SDRC_MANUAL command register */
> - /* NOP command */
> - writel(0x00000000, SDRC_REG(MANUAL_0));
> - /* Precharge command */
> - writel(0x00000001, SDRC_REG(MANUAL_0));
> - /* Auto-refresh command */
> - writel(0x00000002, SDRC_REG(MANUAL_0));
> - /* Auto-refresh command */
> - writel(0x00000002, SDRC_REG(MANUAL_0));
> -
> - /* SDRC MR0 register Burst length=4 */
> - writel(0x00000032, SDRC_REG(MR_0));
> -
> - /* SDRC DLLA control register */
> - writel(0x0000000A, SDRC_REG(DLLA_CTRL));
> + u32 test0, test1;
> + char cfg;
> +
> + init_sdram_ddr();
> +
> + config_sdram_ddr(0, 0); /* 256MByte at CS0 */
> + config_sdram_ddr(1, 0); /* 256MByte at CS1 */
> +
> + test0 = get_ram_size((long *) 0x80000000, SZ_256M);
> + test1 = get_ram_size((long *) 0xA0000000, SZ_256M);
> +
> + /* mask out lower nible, its not tested with
> + in common/memsize.c */
> + test1 &= 0xfffffff0;
> +
> + if ((test1 > 0) && (test1 != test0))
> + hang();
> +
> + cfg = -1; /* illegal configuration found */
> +
> + if (test1 == 0) {
> + init_sdram_ddr();
> + writel((sdrc_config[(uchar) cfg].mcfg & 0xfffc00ff), SDRC_REG(MCFG_1));
> +
> + /* 1 x 256MByte */
> + if (test0 == SZ_256M)
> + cfg = 2;
> +
> + if (cfg != -1) {
> + config_sdram_ddr(0, cfg);
> + writel(sdrc_config[(uchar) cfg].cs_cfg, SDRC_REG(CS_CFG));
> + }
> + return;
> + }
> +
> + /* reinit both cs with correct size */
> + /* 2 x 128MByte */
> + if (test0 == SZ_128M)
> + cfg = 1;
> + /* 2 x 256MByte */
> + if (test0 == SZ_256M)
> + cfg = 3;
> +
> + if (cfg != -1) {
> + init_sdram_ddr();
> + writel(sdrc_config[(uchar) cfg].cs_cfg, SDRC_REG(CS_CFG));
> + config_sdram_ddr(0, cfg);
> + config_sdram_ddr(1, cfg);
> + }
> }
>
> /**
> @@ -296,9 +374,12 @@ static int pcaal1_mem_init(void)
> IORESOURCE_MEM_WRITEABLE);
>
> arm_add_mem_device("ram0", OMAP_SDRC_CS0, get_sdr_cs_size(SDRC_CS0_OSET));
> + printf("found %s at SDCS0\n", size_human_readable(get_sdr_cs_size(SDRC_CS0_OSET)));
>
> - if ((get_sdr_cs_size(SDRC_CS1_OSET) != 0) && (get_sdr_cs1_base() != OMAP_SDRC_CS0))
> + if ((get_sdr_cs_size(SDRC_CS1_OSET) != 0) && (get_sdr_cs1_base() != OMAP_SDRC_CS0)) {
> arm_add_mem_device("ram1", get_sdr_cs1_base(), get_sdr_cs_size(SDRC_CS1_OSET));
> + printf("found %s at SDCS1\n", size_human_readable(get_sdr_cs_size(SDRC_CS1_OSET)));
> + }
>
> return 0;
> }
> --
> 1.7.0.4
>
>
--
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] 7+ messages in thread
end of thread, other threads:[~2012-07-20 7:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-18 12:58 [PATCH] Added SDR-size auto detection Juergen Kilb
2012-07-18 12:58 ` [PATCH] omap_hsmmc: Hack allert! Add delay in omap_hsmmc Juergen Kilb
2012-07-18 12:58 ` [PATCH] pca-a-l1: added memory device for int. 60kB RAM Juergen Kilb
2012-07-19 13:10 ` Sascha Hauer
2012-07-19 18:04 ` Jürgen Kilb
2012-07-18 12:58 ` [PATCH] phyCARD-A-L1: Create xload configuration Juergen Kilb
2012-07-20 7:24 ` [PATCH] Added SDR-size auto detection Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox