summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-09-22 11:26:38 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-09-27 10:27:31 +0200
commit0c638571f0168760c0157ec4c7be512a2353f6ad (patch)
tree3146b1e86d311e688927eb25616115765b9ddc52 /arch
parentd01070c8af7588337fd79bc37d63a8de6435d771 (diff)
downloadbarebox-0c638571f0168760c0157ec4c7be512a2353f6ad.tar.gz
barebox-0c638571f0168760c0157ec4c7be512a2353f6ad.tar.xz
ppc mpc5200: add function to determine configured sdram size
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc/mach-mpc5xxx/cpu.c17
-rw-r--r--arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/arch/ppc/mach-mpc5xxx/cpu.c b/arch/ppc/mach-mpc5xxx/cpu.c
index 391c705630..cf2ca2fb68 100644
--- a/arch/ppc/mach-mpc5xxx/cpu.c
+++ b/arch/ppc/mach-mpc5xxx/cpu.c
@@ -113,3 +113,20 @@ int cpu_init_board_data(bd_t *bd)
bd->bi_pcifreq = get_pci_clock();
return 0;
}
+
+unsigned long mpc5200_get_sdram_size(unsigned int cs)
+{
+ unsigned long size;
+
+ if (cs > 1)
+ return 0;
+
+ /* retrieve size of memory connected to SDRAM CS0 */
+ size = *(vu_long *)(MPC5XXX_SDRAM_CS0CFG + (cs * 4)) & 0xFF;
+ if (size >= 0x13)
+ size = (1 << (size - 0x13)) << 20;
+ else
+ size = 0;
+
+ return size;
+}
diff --git a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
index d7d081137b..aad2418fd4 100644
--- a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
+++ b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
@@ -779,6 +779,9 @@ struct mpc5xxx_mscan {
/* function prototypes */
void loadtask(int basetask, int tasks);
+/* retrieve configured sdram size connected to a chipselect */
+unsigned long mpc5200_get_sdram_size(unsigned int cs);
+
#endif /* __ASSEMBLY__ */
#endif /* __ASMPPC_MPC5XXX_H */