Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm/beagle Map EMIF0 for TIAM335X and use to pro...
details: https://anonhg.NetBSD.org/src/rev/780d8e88a59a
branches: trunk
changeset: 786496:780d8e88a59a
user: matt <matt%NetBSD.org@localhost>
date: Tue Apr 30 00:18:01 2013 +0000
description:
Map EMIF0 for TIAM335X and use to probe memory size.
diffstat:
sys/arch/evbarm/beagle/beagle.h | 7 +++++--
sys/arch/evbarm/beagle/beagle_machdep.c | 33 +++++++++++++++++++++++++++++++--
sys/arch/evbarm/beagle/beagle_start.S | 9 ++++++++-
3 files changed, 44 insertions(+), 5 deletions(-)
diffs (129 lines):
diff -r 0a204d4e2447 -r 780d8e88a59a sys/arch/evbarm/beagle/beagle.h
--- a/sys/arch/evbarm/beagle/beagle.h Tue Apr 30 00:17:24 2013 +0000
+++ b/sys/arch/evbarm/beagle/beagle.h Tue Apr 30 00:18:01 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: beagle.h,v 1.9 2012/12/13 01:16:39 matt Exp $ */
+/* $NetBSD: beagle.h,v 1.10 2013/04/30 00:18:01 matt Exp $ */
/*
* Copyright (c) 2007 Microsoft
* All rights reserved.
@@ -80,6 +80,8 @@
#define OMAP_L4_PERIPHERAL_SIZE TI_AM335X_L4_PERIPHERAL_SIZE
#define OMAP_L4_FAST_BASE TI_AM335X_L4_FAST_BASE
#define OMAP_L4_FAST_SIZE TI_AM335X_L4_FAST_SIZE
+#define OMAP_EMIF_BASE TI_AM335X_EMIF0_BASE
+#define OMAP_EMIF_SIZE TI_AM335X_EMIF0_SIZE
#endif
#ifdef TI_DM37XX
@@ -112,7 +114,8 @@
#define OMAP_L4_CORE_VBASE OMAP_KERNEL_IO_VBASE
#define OMAP_L4_PERIPHERAL_VBASE (OMAP_L4_CORE_VBASE + OMAP_L4_CORE_SIZE)
#define OMAP_L4_FAST_VBASE (OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
-#define OMAP_KERNEL_IO_VEND (OMAP_L4_FAST_VBASE + OMAP_L4_FAST_SIZE)
+#define OMAP_EMIF_VBASE (OMAP_L4_FAST_VBASE + OMAP_L4_FAST_SIZE)
+#define OMAP_KERNEL_IO_VEND (OMAP_EMIF_VBASE + OMAP_EMIF_SIZE)
#define CONSADDR_VA ((CONSADDR - OMAP_L4_CORE_BASE) + OMAP_L4_CORE_VBASE)
#elif defined(TI_DM37XX)
#define OMAP_L4_CORE_VBASE OMAP_KERNEL_IO_VBASE
diff -r 0a204d4e2447 -r 780d8e88a59a sys/arch/evbarm/beagle/beagle_machdep.c
--- a/sys/arch/evbarm/beagle/beagle_machdep.c Tue Apr 30 00:17:24 2013 +0000
+++ b/sys/arch/evbarm/beagle/beagle_machdep.c Tue Apr 30 00:18:01 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: beagle_machdep.c,v 1.38 2013/04/15 18:56:38 bouyer Exp $ */
+/* $NetBSD: beagle_machdep.c,v 1.39 2013/04/30 00:18:01 matt Exp $ */
/*
* Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.38 2013/04/15 18:56:38 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.39 2013/04/30 00:18:01 matt Exp $");
#include "opt_machdep.h"
#include "opt_ddb.h"
@@ -234,6 +234,7 @@
#endif
#if defined(TI_AM335X)
static void am335x_cpu_clk(void);
+static psize_t am335x_memprobe(void);
#endif
#if defined(OMAP_3430) || defined(OMAP_3530)
@@ -316,6 +317,18 @@
.pd_cache = PTE_NOCACHE
},
#endif
+#ifdef OMAP_EMIF_BASE
+ {
+ /*
+ * Map all of the L4 EMIF area
+ */
+ .pd_va = _A(OMAP_EMIF_VBASE),
+ .pd_pa = _A(OMAP_EMIF_BASE),
+ .pd_size = _S(OMAP_EMIF_SIZE),
+ .pd_prot = VM_PROT_READ|VM_PROT_WRITE,
+ .pd_cache = PTE_NOCACHE
+ },
+#endif
#ifdef OMAP_L4_ABE_BASE
{
/*
@@ -461,6 +474,9 @@
#if defined(OMAP_3430) || defined(OMAP_3530)
ram_size = omap3530_memprobe();
#endif
+#if defined(TI_AM335X)
+ ram_size = am335x_memprobe();
+#endif
/*
* If MEMSIZE specified less than what we really have, limit ourselves
* to that.
@@ -689,6 +705,19 @@
__func__, curcpu()->ci_data.cpu_cc_freq,
sys_clk, m, n, n+1, m2);
}
+
+static psize_t
+am335x_memprobe(void)
+{
+ const vaddr_t emif_base = OMAP_EMIF_VBASE;
+ const uint32_t sdram_config = *(const volatile uint32_t *)(emif_base + EMIF_SDRAM_CONFIG);
+ const u_int ibank = __SHIFTOUT(sdram_config, SDRAM_CONFIG_IBANK);
+ const u_int rsize = 9 + __SHIFTOUT(sdram_config, SDRAM_CONFIG_RSIZE);
+ const u_int pagesize = 8 + __SHIFTOUT(sdram_config, SDRAM_CONFIG_PAGESIZE);
+ const u_int width = 2 - __SHIFTOUT(sdram_config, SDRAM_CONFIG_WIDTH);
+ printf("sdram_config = %#x\n", sdram_config);
+ return 1L << (ibank + rsize + pagesize + width);
+}
#endif
#if defined(OMAP_3430) || defined(OMAP_3530)
diff -r 0a204d4e2447 -r 780d8e88a59a sys/arch/evbarm/beagle/beagle_start.S
--- a/sys/arch/evbarm/beagle/beagle_start.S Tue Apr 30 00:17:24 2013 +0000
+++ b/sys/arch/evbarm/beagle/beagle_start.S Tue Apr 30 00:18:01 2013 +0000
@@ -98,7 +98,7 @@
#define INIT_MEMSIZE 128
#endif
-RCSID("$NetBSD: beagle_start.S,v 1.12 2012/12/13 01:16:39 matt Exp $")
+RCSID("$NetBSD: beagle_start.S,v 1.13 2013/04/30 00:18:02 matt Exp $")
#define Invalidate_I_cache(reg) \
mcr p15, 0, reg, c7, c5, 0 /* Invalidate Entire I cache */
@@ -303,6 +303,13 @@
L1_S_PROTO | L1_S_APv7_KRW)
#endif
+#ifdef OMAP_EMIF_BASE
+ /* Map first 1MB of EMIF0 (so we can probe memory size) */
+ MMU_INIT(OMAP_EMIF_VBASE, OMAP_EMIF_BASE,
+ (OMAP_EMIF_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
+ L1_S_PROTO | L1_S_APv7_KRW)
+#endif
+
#ifdef OMAP_SDRC_BASE
/* Map 64KB SDRAM Controller (SDRC) */
MMU_INIT(OMAP_SDRC_VBASE, OMAP_SDRC_BASE,
Home |
Main Index |
Thread Index |
Old Index