CVS commit: src/sys/arch/evbarm/beagle

2018-10-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 18 06:36:53 UTC 2018

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.74 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.75
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.74	Fri Sep 21 12:04:08 2018
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Thu Oct 18 06:36:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.74 2018/09/21 12:04:08 skrll Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.75 2018/10/18 06:36:53 skrll Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.74 2018/09/21 12:04:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.75 2018/10/18 06:36:53 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -314,7 +314,7 @@ static const struct pmap_devmap devmap[]
 	{
 		/*
 		 * Map the all 1MB of the L4 Core area
-		 * this gets us the console UART3, GPT[2-9], WDT1, 
+		 * this gets us the console UART3, GPT[2-9], WDT1,
 		 * and GPIO[2-6].
 		 */
 		.pd_va = _A(OMAP_L4_PERIPHERAL_VBASE),
@@ -573,7 +573,7 @@ initarm(void *arg)
 #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
 	if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) {
 		printf("%s: dropping RAM size from %luMB to %uMB\n",
-		__func__, (unsigned long) (ram_size >> 20), 
+		__func__, (unsigned long) (ram_size >> 20),
 		(KERNEL_VM_BASE - KERNEL_BASE) >> 20);
 		ram_size = KERNEL_VM_BASE - KERNEL_BASE;
 	}
@@ -803,8 +803,8 @@ omap4_cpu_clk(void)
 	if ((armreg_pfr1_read() & ARM_PFR1_GTIMER_MASK) != 0) {
 		beagle_putchar('0');
 		uint32_t voffset = OMAP_L4_PERIPHERAL_VBASE - OMAP_L4_PERIPHERAL_BASE;
-		uint32_t frac1_reg = OMAP5_PRM_FRAC_INCREMENTER_NUMERATOR; 
-		uint32_t frac2_reg = OMAP5_PRM_FRAC_INCREMENTER_DENUMERATOR_RELOAD; 
+		uint32_t frac1_reg = OMAP5_PRM_FRAC_INCREMENTER_NUMERATOR;
+		uint32_t frac2_reg = OMAP5_PRM_FRAC_INCREMENTER_DENUMERATOR_RELOAD;
 		uint32_t frac1 = *(volatile uint32_t *)(frac1_reg + voffset);
 		beagle_putchar('1');
 		uint32_t frac2 = *(volatile uint32_t *)(frac2_reg + voffset);
@@ -867,7 +867,7 @@ emif_read_sdram_config(vaddr_t emif_base
 #endif
 }
 
-static psize_t 
+static psize_t
 emif_memprobe(void)
 {
 	uint32_t sdram_config = emif_read_sdram_config(OMAP_EMIF1_VBASE);
@@ -910,7 +910,7 @@ emif_memprobe(void)
 #if defined(OMAP_3XXX)
 #define SDRC_MCFG(p)		(0x80 + (0x30 * (p)))
 #define SDRC_MCFG_MEMSIZE(m)	m) & __BITS(8,17)) >> 8) * 2)
-static psize_t 
+static psize_t
 omap3_memprobe(void)
 {
 	const vaddr_t gpmc_base = OMAP_SDRC_VBASE;
@@ -971,13 +971,13 @@ beagle_device_register(device_t self, vo
 		 * XXX KLUDGE ALERT XXX
 		 * The iot mainbus supplies is completely wrong since it scales
 		 * addresses by 2.  The simpliest remedy is to replace with our
-		 * bus space used for the armcore registers (which armperiph uses). 
+		 * bus space used for the armcore registers (which armperiph uses).
 		 */
 		struct mainbus_attach_args * const mb = aux;
 		mb->mb_iot = &omap_bs_tag;
 		return;
 	}
- 
+
 #ifdef CPU_CORTEXA9
 	/*
 	 * We need to tell the A9 Global/Watchdog Timer



CVS commit: src/sys/arch/evbarm/beagle

2016-10-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Oct 19 08:18:38 UTC 2016

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
apply some #if defined(TI_AM335X) so this builds again.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.66 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.67
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.66	Tue Oct 18 15:10:35 2016
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Wed Oct 19 08:18:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.66 2016/10/18 15:10:35 kiyohara Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.67 2016/10/19 08:18:38 mrg Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.66 2016/10/18 15:10:35 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.67 2016/10/19 08:18:38 mrg Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -1104,6 +1104,7 @@ beagle_device_register(device_t self, vo
 			prop_dictionary_set_bool(dict, "is_console", true);
 		return;
 	}
+#if defined(TI_AM335X)
 	if (device_is_a(self, "tifb")) {
 		static const struct tifb_panel_info default_panel_info = {
 			.panel_tft = 1,
@@ -1142,6 +1143,7 @@ beagle_device_register(device_t self, vo
 			prop_dictionary_set_bool(dict, "is_console", true);
 		return;
 	}
+#endif
 	if (device_is_a(self, "com")) {
 		if (use_fb_console)
 			prop_dictionary_set_bool(dict, "is_console", false);



CVS commit: src/sys/arch/evbarm/beagle

2016-07-03 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Jul  3 11:25:27 UTC 2016

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
No need beagle_putchar(), if not defined VERBOSE_INIT_ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.62 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.63
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.62	Mon Nov  2 22:21:26 2015
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Sun Jul  3 11:25:27 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.62 2015/11/02 22:21:26 jmcneill Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.63 2016/07/03 11:25:27 kiyohara Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.62 2015/11/02 22:21:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.63 2016/07/03 11:25:27 kiyohara Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -421,6 +421,7 @@ beagle_db_trap(int where)
 }
 #endif
 
+#ifdef VERBOSE_INIT_ARM
 void beagle_putchar(char c);
 void
 beagle_putchar(char c)
@@ -442,6 +443,9 @@ beagle_putchar(char c)
 	}
 #endif
 }
+#else
+#define beagle_putchar(c)	((void)0)
+#endif
 
 /*
  * u_int initarm(...)



CVS commit: src/sys/arch/evbarm/beagle

2015-11-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Nov  2 22:21:26 UTC 2015

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
enable 8-bit mode on AM335X SDMMC2


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.61 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.62
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.61	Wed Jul 22 14:10:45 2015
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon Nov  2 22:21:26 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.61 2015/07/22 14:10:45 maxv Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.62 2015/11/02 22:21:26 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.61 2015/07/22 14:10:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.62 2015/11/02 22:21:26 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -1083,7 +1083,7 @@ beagle_device_register(device_t self, vo
 		prop_dictionary_set_uint32(dict, "clkmask", 0);
 		prop_dictionary_set_bool(dict, "8bit", true);
 #endif
-#if defined(TI_AM335X) && 0	// doesn't work
+#if defined(TI_AM335X)
 		struct obio_attach_args * const obio = aux;
 		if (obio->obio_addr == SDMMC2_BASE_TIAM335X)
 			prop_dictionary_set_bool(dict, "8bit", true);



CVS commit: src/sys/arch/evbarm/beagle

2015-07-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 22 14:10:45 UTC 2015

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Double compiler branch.

Found by Brainy


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.60 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.61
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.60	Mon Jul 21 22:17:44 2014
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Wed Jul 22 14:10:45 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.60 2014/07/21 22:17:44 riz Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.61 2015/07/22 14:10:45 maxv Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.60 2014/07/21 22:17:44 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.61 2015/07/22 14:10:45 maxv Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -697,7 +697,6 @@ beagle_reset(void)
 	*(volatile uint32_t *)(OMAP_L4_CORE_VBASE + (OMAP_L4_WAKEUP_BASE - OMAP_L4_CORE_BASE) + OMAP4_PRM_RSTCTRL) = OMAP4_PRM_RSTCTRL_WARM;
 #elif defined(OMAP_5XXX)
 	*(volatile uint32_t *)(OMAP_L4_CORE_VBASE + (OMAP_L4_WAKEUP_BASE - OMAP_L4_CORE_BASE) + OMAP5_PRM_RSTCTRL) = OMAP4_PRM_RSTCTRL_COLD;
-#elif defined(OMAP_5XXX)
 #elif defined(TI_AM335X)
 	*(volatile uint32_t *)(OMAP_L4_CORE_VBASE + (OMAP2_CM_BASE - OMAP_L4_CORE_BASE) + AM335X_PRCM_PRM_DEVICE + PRM_RSTCTRL) = RST_GLOBAL_WARM_SW;
 #else



CVS commit: src/sys/arch/evbarm/beagle

2014-07-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Jul 21 22:17:45 UTC 2014

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Conditionalize more stuff on TI_AM335X so BEAGLEBONEXM kernel
builds succeed.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.59 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.60
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.59	Sun Jul 20 23:08:43 2014
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon Jul 21 22:17:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.59 2014/07/20 23:08:43 bouyer Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.60 2014/07/21 22:17:44 riz Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.59 2014/07/20 23:08:43 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.60 2014/07/21 22:17:44 riz Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -,11 +,14 @@ beagle_device_register(device_t self, vo
 		if (use_fb_console)
 			prop_dictionary_set_bool(dict, "is_console", false);
 	}
+#if defined(TI_AM335X)
 	if (device_is_a(self, "tps65217pmic")) {
 		pmic_dev = self;
 	}
+#endif
 }
 
+#if defined(TI_AM335X)
 int
 set_mpu_volt(int mvolt)
 {
@@ -1125,3 +1128,4 @@ set_mpu_volt(int mvolt)
 	/* MPU voltage is on vdcd2 */
 	return tps65217pmic_set_volt(pmic_dev, "DCDC2", mvolt);
 }
+#endif



CVS commit: src/sys/arch/evbarm/beagle

2014-07-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Jul 19 18:16:50 UTC 2014

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Allow tifb to be the console when bootargs contains "console=fb".


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.57 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.58
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.57	Thu Apr  3 17:14:41 2014
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Sat Jul 19 18:16:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.57 2014/04/03 17:14:41 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.58 2014/07/19 18:16:50 bouyer Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.57 2014/04/03 17:14:41 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.58 2014/07/19 18:16:50 bouyer Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -1098,6 +1098,11 @@ beagle_device_register(device_t self, vo
 			prop_dictionary_set_bool(dict, "is_console", true);
 		return;
 	}
+	if (device_is_a(self, "tifb")) {
+		if (use_fb_console)
+			prop_dictionary_set_bool(dict, "is_console", true);
+		return;
+	}
 	if (device_is_a(self, "com")) {
 		if (use_fb_console)
 			prop_dictionary_set_bool(dict, "is_console", false);



CVS commit: src/sys/arch/evbarm/beagle

2014-04-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr  3 17:14:41 UTC 2014

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Make sure to enable refclk for usb on omap5


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.56 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.57
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.56	Sat Mar 29 14:47:30 2014
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Thu Apr  3 17:14:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.56 2014/03/29 14:47:30 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.57 2014/04/03 17:14:41 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.56 2014/03/29 14:47:30 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.57 2014/04/03 17:14:41 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -1049,6 +1049,29 @@ beagle_device_register(device_t self, vo
 		prop_dictionary_set_cstring(dict, "port2-mode", "hsic");
 		prop_dictionary_set_int16(dict, "port2-gpio", -1);
 #endif
+#if defined(OMAP_5430)
+		bus_space_tag_t iot = &omap_bs_tag;
+		bus_space_handle_t ioh;
+		omap2_gpio_ctl(80, GPIO_PIN_OUTPUT);
+		omap2_gpio_write(80, 0);
+		prop_dictionary_set_uint16(dict, "nports", 1);
+		prop_dictionary_set_cstring(dict, "port0-mode", "hsi");
+#if 0
+		prop_dictionary_set_bool(dict, "phy-reset", true);
+		prop_dictionary_set_int16(dict, "port0-gpio", 80);
+		prop_dictionary_set_bool(dict, "port0-gpioval", true);
+#endif
+		int rv = bus_space_map(iot, OMAP5_CM_CTL_WKUP_REF_CLK0_OUT_REF_CLK1_OUT, 4, 0, &ioh);
+		KASSERT(rv == 0);
+		uint32_t v = bus_space_read_4(iot, ioh, 0);
+		v &= 0x;
+		v |= __SHIFTIN(OMAP5_CM_CTL_WKUP_MUXMODE1_REF_CLK1_OUT,
+		OMAP5_CM_CTL_WKUP_MUXMODE1);
+		bus_space_write_4(iot, ioh, 0, v);
+		bus_space_unmap(iot, ioh, 4);
+
+		omap2_gpio_write(80, 1);
+#endif
 		return;
 	}
 



CVS commit: src/sys/arch/evbarm/beagle

2014-03-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Mar 29 14:47:30 UTC 2014

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c beagle_start.S

Log Message:
OMAP5/OMAP4 MP Changes + better OMAP5 support.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/beagle/beagle_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.55 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.56
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.55	Thu Aug 29 15:46:17 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Sat Mar 29 14:47:30 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.55 2013/08/29 15:46:17 riz Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.56 2014/03/29 14:47:30 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.55 2013/08/29 15:46:17 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.56 2014/03/29 14:47:30 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -140,6 +140,7 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include "prcm.h"
 #include "sdhc.h"
 #include "ukbd.h"
+#include "arml2cc.h"
 
 #include 
 #include 
@@ -196,9 +197,16 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 
 #ifdef CPU_CORTEXA9
 #include 
+#include 
+
+#include 
 #include 
 #endif
 
+#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA15)
+#include 
+#endif
+
 #include 
 #include 
 
@@ -481,14 +489,29 @@ initarm(void *arg)
 	/* The console is going to try to map things.  Give pmap a devmap. */
 	pmap_devmap_register(devmap);
 	consinit();
+#ifdef CPU_CORTEXA15
+#ifdef MULTIPROCESSOR
+	arm_cpu_max = 1 + __SHIFTOUT(armreg_l2ctrl_read(), L2CTRL_NUMCPU);
+#endif
+#endif
 #if defined(OMAP_4XXX)
+#if NARML2CC > 0
 	/*
 	 * Probe the PL310 L2CC
 	 */
-	const bus_space_handle_t pl310_bh = OMAP4_L2CC_BASE +
-	OMAP_L4_PERIPHERAL_VBASE - OMAP_L4_PERIPHERAL_BASE;
+	const bus_space_handle_t pl310_bh = OMAP4_L2CC_BASE
+	+ OMAP_L4_PERIPHERAL_VBASE - OMAP_L4_PERIPHERAL_BASE;
 	arml2cc_init(&omap_bs_tag, pl310_bh, 0);
+	beagle_putchar('l');
 #endif
+#ifdef MULTIPROCESSOR
+	const bus_space_handle_t scu_bh = OMAP4_SCU_BASE
+	+ OMAP_L4_PERIPHERAL_VBASE - OMAP_L4_PERIPHERAL_BASE;
+	uint32_t scu_cfg = bus_space_read_4(&omap_bs_tag, scu_bh, SCU_CFG);
+	arm_cpu_max = 1 + (scu_cfg & SCU_CFG_CPUMAX);
+	beagle_putchar('s');
+#endif
+#endif /* OMAP_4XXX */
 #if defined(TI_AM335X) && defined(VERBOSE_INIT_ARM)
 	am335x_cpu_clk();		// find our CPU speed.
 #endif
@@ -498,6 +521,7 @@ initarm(void *arg)
 	printf("\nuboot arg = %#x, %#x, %#x, %#x\n",
 	uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]);
 
+
 #ifdef KGDB
 	kgdb_port_init();
 #endif
@@ -518,7 +542,7 @@ initarm(void *arg)
 	printf("initarm: Configuring system ...\n");
 #endif
 
-#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA9) || defined(CPU_CORTEXA15)
+#if !defined(CPU_CORTEXA8)
 	printf("initarm: cbar=%#x\n", armreg_cbar_read());
 #endif
 
@@ -533,6 +557,15 @@ initarm(void *arg)
 	ram_size = emif_memprobe();
 #endif
 
+#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
+	if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) {
+		printf("%s: dropping RAM size from %luMB to %uMB\n",
+		__func__, (unsigned long) (ram_size >> 20), 
+		(KERNEL_VM_BASE - KERNEL_BASE) >> 20);
+		ram_size = KERNEL_VM_BASE - KERNEL_BASE;
+	}
+#endif
+
 	/*
 	 * If MEMSIZE specified less than what we really have, limit ourselves
 	 * to that.
@@ -998,24 +1031,23 @@ beagle_device_register(device_t self, vo
 #endif
 #if defined(OMAP_4430)
 		prop_dictionary_set_uint16(dict, "nports", 2);
-#if 0
-		prop_dictionary_set_bool(dict, "phy-reset", true);
-#else
 		prop_dictionary_set_bool(dict, "phy-reset", false);
-#endif
 		prop_dictionary_set_cstring(dict, "port0-mode", "none");
 		prop_dictionary_set_int16(dict, "port0-gpio", -1);
-#if 0
 		prop_dictionary_set_cstring(dict, "port1-mode", "phy");
-#else
-		prop_dictionary_set_cstring(dict, "port1-mode", "none");
-#endif
 		prop_dictionary_set_int16(dict, "port1-gpio", 62);
 		prop_dictionary_set_bool(dict, "port1-gpioval", true);
-#if 0
 		omap2_gpio_ctl(1, GPIO_PIN_OUTPUT);
-		omap2_gpio_write(1, 1);		// Enable Hub
+		omap2_gpio_write(1, 1);		// Power Hub
 #endif
+#if defined(OMAP_5430)
+		prop_dictionary_set_uint16(dict, "nports", 3);
+		prop_dictionary_set_cstring(dict, "port0-mode", "none");
+		prop_dictionary_set_int16(dict, "port0-gpio", -1);
+		prop_dictionary_set_cstring(dict, "port1-mode", "hsic");
+		prop_dictionary_set_int16(dict, "port1-gpio", -1);
+		prop_dictionary_set_cstring(dict, "port2-mode", "hsic");
+		prop_dictionary_set_int16(dict, "port2-gpio", -1);
 #endif
 		return;
 	}

Index: src/

CVS commit: src/sys/arch/evbarm/beagle

2013-08-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 18 06:34:02 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_start.S

Log Message:
Add END(beagle_start)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/beagle/beagle_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_start.S
diff -u src/sys/arch/evbarm/beagle/beagle_start.S:1.17 src/sys/arch/evbarm/beagle/beagle_start.S:1.18
--- src/sys/arch/evbarm/beagle/beagle_start.S:1.17	Tue Jun 18 15:28:36 2013
+++ src/sys/arch/evbarm/beagle/beagle_start.S	Sun Aug 18 06:34:02 2013
@@ -99,7 +99,7 @@
 #include 
 #endif
 
-RCSID("$NetBSD: beagle_start.S,v 1.17 2013/06/18 15:28:36 matt Exp $")
+RCSID("$NetBSD: beagle_start.S,v 1.18 2013/08/18 06:34:02 matt Exp $")
 
 #if defined(VERBOSE_INIT_ARM)
 #define	XPUTC(n)	mov r0, n; bl xputc
@@ -242,3 +242,5 @@ _C_LABEL(beagle_start):
 
 	/* end of table */
 	MMU_INIT(0, 0, 0, 0)
+
+END(_C_LABEL(beagle_start))



CVS commit: src/sys/arch/evbarm/beagle

2013-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 30 22:23:45 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Actually, only copy the uboot args if they are within the amount of ram we
mapped.  If they aren't we'd fault trying to access them.  It's too early
to grab a VA to map them so we just punt for now. XXX


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.53 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.54
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.53	Tue Jul 30 20:45:44 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Jul 30 22:23:45 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.53 2013/07/30 20:45:44 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.54 2013/07/30 22:23:45 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.53 2013/07/30 20:45:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.54 2013/07/30 22:23:45 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -562,10 +562,12 @@ initarm(void *arg)
 	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, devmap,
 	mapallmem_p);
 
+#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
 	/* "bootargs" env variable is passed as 4th argument to kernel */
-	if ((uboot_args[3] & 0xe000) == 0x8000) {
+	if (uboot_args[3] - 0x8000 < ram_size) {
 		strlcpy(bootargs, (char *)uboot_args[3], sizeof(bootargs));
 	}
+#endif
 	boot_args = bootargs;
 	parse_mi_bootargs(boot_args);
 



CVS commit: src/sys/arch/evbarm/beagle

2013-07-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 30 20:45:44 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
sanity check uboot_args is within 512MB (not 256MB) for beaglebone black).


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.52 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.53
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.52	Sat Jun 29 20:44:52 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Jul 30 20:45:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.52 2013/06/29 20:44:52 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.53 2013/07/30 20:45:44 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.52 2013/06/29 20:44:52 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.53 2013/07/30 20:45:44 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -563,7 +563,7 @@ initarm(void *arg)
 	mapallmem_p);
 
 	/* "bootargs" env variable is passed as 4th argument to kernel */
-	if ((uboot_args[3] & 0xf000) == 0x8000) {
+	if ((uboot_args[3] & 0xe000) == 0x8000) {
 		strlcpy(bootargs, (char *)uboot_args[3], sizeof(bootargs));
 	}
 	boot_args = bootargs;
@@ -977,6 +977,23 @@ beagle_device_register(device_t self, vo
 		prop_dictionary_set_uint16(dict, "dpll5-n", 11);
 		prop_dictionary_set_uint16(dict, "dpll5-m2", 4);
 #endif
+#if defined(TI_DM37XX)
+		/* XXX Beagleboard specific port configuration */
+		prop_dictionary_set_uint16(dict, "nports", 3);
+		prop_dictionary_set_cstring(dict, "port0-mode", "none");
+		prop_dictionary_set_cstring(dict, "port1-mode", "phy");
+		prop_dictionary_set_cstring(dict, "port2-mode", "none");
+		prop_dictionary_set_bool(dict, "phy-reset", true);
+		prop_dictionary_set_int16(dict, "port0-gpio", -1);
+		prop_dictionary_set_int16(dict, "port1-gpio", 56);
+		prop_dictionary_set_bool(dict, "port1-gpioval", true);
+		prop_dictionary_set_int16(dict, "port2-gpio", -1);
+#if 0
+		prop_dictionary_set_uint16(dict, "dpll5-m", 443);
+		prop_dictionary_set_uint16(dict, "dpll5-n", 11);
+		prop_dictionary_set_uint16(dict, "dpll5-m2", 4);
+#endif
+#endif
 #if defined(OMAP_4430)
 		prop_dictionary_set_uint16(dict, "nports", 2);
 #if 0



CVS commit: src/sys/arch/evbarm/beagle

2013-06-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jun 29 20:44:52 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
am335x_cpu_clk is now am335x_sys_clk and am335x_cpu_clk and they are now
in .


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.51 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.52
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.51	Fri Jun 28 00:53:04 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Sat Jun 29 20:44:52 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.51 2013/06/28 00:53:04 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.52 2013/06/29 20:44:52 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.51 2013/06/28 00:53:04 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.52 2013/06/29 20:44:52 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -134,9 +134,12 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include "opt_md.h"
 #include "opt_com.h"
 #include "opt_omap.h"
-#include "prcm.h"
+
 #include "com.h"
+#include "omapwdt32k.h"
+#include "prcm.h"
 #include "sdhc.h"
+#include "ukbd.h"
 
 #include 
 #include 
@@ -181,6 +184,9 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include 
 #include 
 #ifdef TI_AM335X
+# if NPRCM == 0
+#  error no prcm device configured.
+# endif
 # include 
 # if NSDHC > 0
 #  include 
@@ -199,9 +205,6 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include 
 #include 
 
-#include "prcm.h"
-#include "omapwdt32k.h"
-#include "ukbd.h"
 #include 
 
 BootConfig bootconfig;		/* Boot config storage */
@@ -233,6 +236,7 @@ uint32_t omap5_cnt_frq;
  * kernel address space.  *Not* for general use.
  */
 #define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys)
+#define	OMAP_L4_CORE_VOFFSET	(OMAP_L4_CORE_VBASE - OMAP_L4_CORE_BASE)
 
 /* Prototypes */
 
@@ -250,9 +254,6 @@ static void omap3_cpu_clk(void);
 #if defined(OMAP_4XXX) || defined(OMAP_5XXX)
 static void omap4_cpu_clk(void);
 #endif
-#if defined(TI_AM335X)
-static void am335x_cpu_clk(void);
-#endif
 #if defined(OMAP_4XXX) || defined(OMAP_5XXX) || defined(TI_AM335X)
 static psize_t emif_memprobe(void);
 #endif
@@ -466,6 +467,9 @@ initarm(void *arg)
 	omap4_cpu_clk();		// find our CPU speed.
 #endif
 #if defined(TI_AM335X)
+	prcm_bootstrap(OMAP2_CM_BASE + OMAP_L4_CORE_VOFFSET);
+	// find our reference clock.
+	am335x_sys_clk(TI_AM335X_CTLMOD_BASE + OMAP_L4_CORE_VOFFSET);
 	am335x_cpu_clk();		// find our CPU speed.
 #endif
 	/* Heads up ... Setup the CPU / MMU / TLB functions. */
@@ -485,7 +489,7 @@ initarm(void *arg)
 	OMAP_L4_PERIPHERAL_VBASE - OMAP_L4_PERIPHERAL_BASE;
 	arml2cc_init(&omap_bs_tag, pl310_bh, 0);
 #endif
-#if defined(TI_AM335X)
+#if defined(TI_AM335X) && defined(VERBOSE_ARM_INIT)
 	am335x_cpu_clk();		// find our CPU speed.
 #endif
 #if 1
@@ -708,7 +712,7 @@ static kgdb_port_init(void)
 void
 omap3_cpu_clk(void)
 {
-	const vaddr_t prm_base = OMAP2_PRM_BASE - OMAP_L4_CORE_BASE + OMAP_L4_CORE_VBASE;
+	const vaddr_t prm_base = OMAP2_PRM_BASE + OMAP_L4_CORE_VOFFSET;
 	const uint32_t prm_clksel = *(volatile uint32_t *)(prm_base + PLL_MOD + OMAP3_PRM_CLKSEL);
 	static const uint32_t prm_clksel_freqs[] = OMAP3_PRM_CLKSEL_FREQS;
 	const uint32_t sys_clk = prm_clksel_freqs[__SHIFTOUT(prm_clksel, OMAP3_PRM_CLKSEL_CLKIN)];
@@ -731,8 +735,8 @@ omap3_cpu_clk(void)
 void
 omap4_cpu_clk(void)
 {
-	const vaddr_t prm_base = OMAP2_PRM_BASE - OMAP_L4_CORE_BASE + OMAP_L4_CORE_VBASE;
-	const vaddr_t cm_base = OMAP2_CM_BASE - OMAP_L4_CORE_BASE + OMAP_L4_CORE_VBASE;
+	const vaddr_t prm_base = OMAP2_PRM_BASE + OMAP_L4_CORE_VOFFSET;
+	const vaddr_t cm_base = OMAP2_CM_BASE + OMAP_L4_CORE_VOFFSET;
 	static const uint32_t cm_clksel_freqs[] = OMAP4_CM_CLKSEL_FREQS;
 	const uint32_t prm_clksel = *(volatile uint32_t *)(prm_base + OMAP4_CM_SYS_CLKSEL);
 	const u_int clksel = __SHIFTOUT(prm_clksel, OMAP4_CM_SYS_CLKSEL_CLKIN);
@@ -804,31 +808,6 @@ omap4_cpu_clk(void)
 }
 #endif /* OMAP_4XXX || OMAP_5XXX */
 
-#if defined(TI_AM335X)
-void
-am335x_cpu_clk(void)
-{
-	static const uint32_t sys_clks[4] = {
-		[0] = 1920, [1] = 2400, [2] = 2500, [3] = 2600
-	};
-	const vaddr_t cm_base = OMAP2_CM_BASE - OMAP_L4_CORE_BASE + OMAP_L4_CORE_VBASE;
-	const vaddr_t cm_wkup_base = cm_base + AM335X_PRCM_CM_WKUP;
-	const vaddr_t ctlmod_base = TI_AM335X_CTLMOD_BASE - OMAP_L4_CORE_BASE + OMAP_L4_CORE_VBASE;
-	const uint32_t control_status = *(const volatile uint32_t *)(ctlmod_base + CTLMOD_CONTROL_STATUS);
-	const uint32_t sys_clk = sys_clks[__SHIFTOUT(control_status, CTLMOD_CONTROL_STATUS_SYSBOOT1)];
-	const uint32_t clksel_dpll_mp

CVS commit: src/sys/arch/evbarm/beagle

2013-06-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun 28 00:53:04 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Add code to make eMMC 8-bit (disabled) since it still needs code in omap3_sdhc
to actually enable 8-bit mode.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.50 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.51
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.50	Thu Jun 27 14:58:55 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Fri Jun 28 00:53:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.50 2013/06/27 14:58:55 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.51 2013/06/28 00:53:04 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.50 2013/06/27 14:58:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.51 2013/06/28 00:53:04 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -136,6 +136,7 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include "opt_omap.h"
 #include "prcm.h"
 #include "com.h"
+#include "sdhc.h"
 
 #include 
 #include 
@@ -180,7 +181,11 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include 
 #include 
 #ifdef TI_AM335X
-#  include 
+# include 
+# if NSDHC > 0
+#  include 
+#  include 
+# endif
 #endif
 
 #ifdef CPU_CORTEXA9
@@ -480,6 +485,9 @@ initarm(void *arg)
 	OMAP_L4_PERIPHERAL_VBASE - OMAP_L4_PERIPHERAL_BASE;
 	arml2cc_init(&omap_bs_tag, pl310_bh, 0);
 #endif
+#if defined(TI_AM335X)
+	am335x_cpu_clk();		// find our CPU speed.
+#endif
 #if 1
 	beagle_putchar('h');
 #endif
@@ -1019,6 +1027,11 @@ beagle_device_register(device_t self, vo
 		prop_dictionary_set_uint32(dict, "clkmask", 0);
 		prop_dictionary_set_bool(dict, "8bit", true);
 #endif
+#if defined(TI_AM335X) && 0	// doesn't work
+		struct obio_attach_args * const obio = aux;
+		if (obio->obio_addr == SDMMC2_BASE_TIAM335X)
+			prop_dictionary_set_bool(dict, "8bit", true);
+#endif
 		return;
 	}
 



CVS commit: src/sys/arch/evbarm/beagle

2013-06-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jun 27 14:58:55 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Only print CBAR on those cortex with CBAR


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.49 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.50
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.49	Thu Jun 20 05:39:19 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Thu Jun 27 14:58:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.49 2013/06/20 05:39:19 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.50 2013/06/27 14:58:55 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.49 2013/06/20 05:39:19 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.50 2013/06/27 14:58:55 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -506,7 +506,9 @@ initarm(void *arg)
 	printf("initarm: Configuring system ...\n");
 #endif
 
+#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA9) || defined(CPU_CORTEXA15)
 	printf("initarm: cbar=%#x\n", armreg_cbar_read());
+#endif
 
 	/*
 	 * Set up the variables that define the availability of physical



CVS commit: src/sys/arch/evbarm/beagle

2013-06-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jun 20 05:39:19 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
more OMAP5 workarounds.
u-boot doesn't initialize the generic timer on the omap5430 evm properly.
so check to see if it's OK, and if not, initialize omap5 registers properly.
Pass the timer freq via properties to the armgtmr since we can't write the
cnt_frq cp15 register (which can be written in secure mode).


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.48 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.49
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.48	Tue Jun 18 23:40:38 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Thu Jun 20 05:39:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.48 2013/06/18 23:40:38 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.49 2013/06/20 05:39:19 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.48 2013/06/18 23:40:38 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.49 2013/06/20 05:39:19 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -219,6 +219,10 @@ int use_fb_console = false;
 int use_fb_console = true;
 #endif
 
+#ifdef CPU_CORTEXA15
+uint32_t omap5_cnt_frq;
+#endif
+
 /*
  * Macros to translate between physical and virtual for a subset of the
  * kernel address space.  *Not* for general use.
@@ -479,7 +483,7 @@ initarm(void *arg)
 #if 1
 	beagle_putchar('h');
 #endif
-	printf("uboot arg = %#x, %#x, %#x, %#x\n",
+	printf("\nuboot arg = %#x, %#x, %#x, %#x\n",
 	uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]);
 
 #ifdef KGDB
@@ -502,6 +506,8 @@ initarm(void *arg)
 	printf("initarm: Configuring system ...\n");
 #endif
 
+	printf("initarm: cbar=%#x\n", armreg_cbar_read());
+
 	/*
 	 * Set up the variables that define the availability of physical
 	 * memory.
@@ -719,7 +725,8 @@ omap4_cpu_clk(void)
 	const vaddr_t cm_base = OMAP2_CM_BASE - OMAP_L4_CORE_BASE + OMAP_L4_CORE_VBASE;
 	static const uint32_t cm_clksel_freqs[] = OMAP4_CM_CLKSEL_FREQS;
 	const uint32_t prm_clksel = *(volatile uint32_t *)(prm_base + OMAP4_CM_SYS_CLKSEL);
-	const uint32_t sys_clk = cm_clksel_freqs[__SHIFTOUT(prm_clksel, OMAP4_CM_SYS_CLKSEL_CLKIN)];
+	const u_int clksel = __SHIFTOUT(prm_clksel, OMAP4_CM_SYS_CLKSEL_CLKIN);
+	const uint32_t sys_clk = cm_clksel_freqs[clksel];
 	const uint32_t dpll1 = *(volatile uint32_t *)(cm_base + OMAP4_CM_CLKSEL_DPLL_MPU);
 	const uint32_t dpll2 = *(volatile uint32_t *)(cm_base + OMAP4_CM_DIV_M2_DPLL_MPU);
 	const uint32_t m = __SHIFTOUT(dpll1, OMAP4_CM_CLKSEL_DPLL_MPU_DPLL_MULT);
@@ -734,6 +741,56 @@ omap4_cpu_clk(void)
 	printf("%s: %"PRIu64": sys_clk=%u m=%u n=%u (%u) m2=%u mult=%u\n",
 	__func__, curcpu()->ci_data.cpu_cc_freq,
 	sys_clk, m, n, n+1, m2, OMAP4_CM_CLKSEL_MULT);
+
+#if defined(CPU_CORTEXA15)
+	if ((armreg_pfr1_read() & ARM_PFR1_GTIMER_MASK) != 0) {
+		beagle_putchar('0');
+		uint32_t voffset = OMAP_L4_PERIPHERAL_VBASE - OMAP_L4_PERIPHERAL_BASE;
+		uint32_t frac1_reg = OMAP5_PRM_FRAC_INCREMENTER_NUMERATOR; 
+		uint32_t frac2_reg = OMAP5_PRM_FRAC_INCREMENTER_DENUMERATOR_RELOAD; 
+		uint32_t frac1 = *(volatile uint32_t *)(frac1_reg + voffset);
+		beagle_putchar('1');
+		uint32_t frac2 = *(volatile uint32_t *)(frac2_reg + voffset);
+		beagle_putchar('2');
+		uint32_t numer = __SHIFTOUT(frac1, PRM_FRAC_INCR_NUM_SYS_MODE);
+		uint32_t denom = __SHIFTOUT(frac2, PRM_FRAC_INCR_DENUM_DENOMINATOR);
+		uint32_t freq = (uint64_t)omap_sys_clk * numer / denom;
+#if 1
+		if (freq != OMAP5_GTIMER_FREQ) {
+			static uint16_t numer_demon[8][2] = {
+			{ 0,  0 },	/* not used */
+			{  26 *  64,  26 *  125 },	/* 12.0Mhz */
+			{   2 * 768,   2 * 1625 },	/* 13.0Mhz */
+			{ 0,  0 },	/* 16.8Mhz (not used) */
+			{ 130 *   8, 130 *   25 },	/* 19.2Mhz */
+			{   2 * 384,   2 * 1625 },	/* 26.0Mhz */
+			{   3 * 256,   3 * 1125 },	/* 27.0Mhz */
+			{ 130 *   4, 130 *   25 },	/* 38.4Mhz */
+			};
+			if (numer_demon[clksel][0] != numer) {
+frac1 &= ~PRM_FRAC_INCR_NUM_SYS_MODE;
+frac1 |= numer_demon[clksel][0];
+			}
+			if (numer_demon[clksel][1] != denom) {
+frac2 &= ~PRM_FRAC_INCR_DENUM_DENOMINATOR;
+frac2 |= numer_demon[clksel][1];
+			}
+			*(volatile uint32_t *)(frac1_reg + voffset) = frac1;
+			*(volatile uint32_t *)(frac2_reg + voffset) = frac2
+			| PRM_FRAC_INCR_DENUM_RELOAD;
+			freq = OMAP5_GTIMER_FREQ;
+		}
+#endif
+		beagle_putchar('3');
+#if 0
+		if (gtimer_freq != freq) {
+			armreg_cnt_frq_write(freq);	// secure only
+		}

CVS commit: src/sys/arch/evbarm/beagle

2013-06-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 18 23:40:38 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Add OMAP5 reset code.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.47 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.48
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.47	Tue Jun 18 15:37:16 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Jun 18 23:40:38 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.47 2013/06/18 15:37:16 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.48 2013/06/18 23:40:38 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.47 2013/06/18 15:37:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.48 2013/06/18 23:40:38 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -634,8 +634,11 @@ consinit(void)
 void
 beagle_reset(void)
 {
-#if defined(OMAP_4XXX) || defined(OMAP_5XXX)
+#if defined(OMAP_4XXX)
 	*(volatile uint32_t *)(OMAP_L4_CORE_VBASE + (OMAP_L4_WAKEUP_BASE - OMAP_L4_CORE_BASE) + OMAP4_PRM_RSTCTRL) = OMAP4_PRM_RSTCTRL_WARM;
+#elif defined(OMAP_5XXX)
+	*(volatile uint32_t *)(OMAP_L4_CORE_VBASE + (OMAP_L4_WAKEUP_BASE - OMAP_L4_CORE_BASE) + OMAP5_PRM_RSTCTRL) = OMAP4_PRM_RSTCTRL_COLD;
+#elif defined(OMAP_5XXX)
 #elif defined(TI_AM335X)
 	*(volatile uint32_t *)(OMAP_L4_CORE_VBASE + (OMAP2_CM_BASE - OMAP_L4_CORE_BASE) + AM335X_PRCM_PRM_DEVICE + PRM_RSTCTRL) = RST_GLOBAL_WARM_SW;
 #else



CVS commit: src/sys/arch/evbarm/beagle

2013-06-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 18 15:39:19 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle.h

Log Message:
Use OMAP_[345]XXX


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/beagle/beagle.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle.h
diff -u src/sys/arch/evbarm/beagle/beagle.h:1.12 src/sys/arch/evbarm/beagle/beagle.h:1.13
--- src/sys/arch/evbarm/beagle/beagle.h:1.12	Mon Jun 17 04:38:14 2013
+++ src/sys/arch/evbarm/beagle/beagle.h	Tue Jun 18 15:39:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle.h,v 1.12 2013/06/17 04:38:14 matt Exp $	*/
+/*	$NetBSD: beagle.h,v 1.13 2013/06/18 15:39:19 matt Exp $	*/
 /*
  * Copyright (c) 2007 Microsoft
  * All rights reserved.
@@ -62,7 +62,7 @@
 #define OMAP_SDRC_SIZE			OMAP3530_SDRC_SIZE
 #endif
 
-#ifdef OMAP_4430
+#ifdef OMAP_4XXX
 #define OMAP_L4_CORE_BASE		OMAP4430_L4_CORE_BASE
 #define OMAP_L4_CORE_SIZE		OMAP4430_L4_CORE_SIZE
 #define OMAP_L4_PERIPHERAL_BASE		OMAP4430_L4_PERIPHERAL_BASE
@@ -77,7 +77,7 @@
 #define OMAP_EMIF2_SIZE			OMAP4430_EMIF2_SIZE
 #endif
 
-#ifdef OMAP_5430
+#ifdef OMAP_5XXX
 #define OMAP_L4_CORE_BASE		OMAP5430_L4_CORE_BASE
 #define OMAP_L4_CORE_SIZE		OMAP5430_L4_CORE_SIZE
 #define OMAP_L4_PERIPHERAL_BASE		OMAP5430_L4_PERIPHERAL_BASE
@@ -116,14 +116,14 @@
  * We devmap IO starting at KERNEL_VM_BASE + KERNEL_VM_SIZE
  */
 #define OMAP_KERNEL_IO_VBASE	(KERNEL_VM_BASE + KERNEL_VM_SIZE)
-#if defined(OMAP_3430) || defined(OMAP_3530)
+#if defined(OMAP_3XXX)
 #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_WAKEUP_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
 #define OMAP_SDRC_VBASE		(OMAP_L4_WAKEUP_VBASE + OMAP_L4_WAKEUP_SIZE)
 #define OMAP_KERNEL_IO_VEND	(OMAP_SDRC_VBASE + OMAP_SDRC_SIZE)
 #define CONSADDR_VA	((CONSADDR - OMAP_L4_PERIPHERAL_BASE) + OMAP_L4_PERIPHERAL_VBASE)
-#elif defined(OMAP_4430) || defined(OMAP_5430)
+#elif defined(OMAP_4XXX) || defined(OMAP_5XXX)
 #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_ABE_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)



CVS commit: src/sys/arch/evbarm/beagle

2013-06-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 18 15:37:16 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Add PL310 L2CC init for OMAP4.
Use OMAP_[345]XXX
Add OMAP4 hooks in beagle_device_register


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.46 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.47
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.46	Mon Jun 17 04:37:39 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Jun 18 15:37:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.46 2013/06/17 04:37:39 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.47 2013/06/18 15:37:16 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.46 2013/06/17 04:37:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.47 2013/06/18 15:37:16 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -149,6 +149,7 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -182,6 +183,11 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #  include 
 #endif
 
+#ifdef CPU_CORTEXA9
+#include 
+#include 
+#endif
+
 #include 
 #include 
 
@@ -229,21 +235,21 @@ static void kgdb_port_init(void);
 static void init_clocks(void);
 static void beagle_device_register(device_t, void *);
 static void beagle_reset(void);
-#if defined(OMAP_3430) || defined(OMAP_3530) || defined(TI_DM37XX)
+#if defined(OMAP_3XXX) || defined(TI_DM37XX)
 static void omap3_cpu_clk(void);
 #endif
-#if defined(OMAP_4430) || defined(OMAP_5430)
+#if defined(OMAP_4XXX) || defined(OMAP_5XXX)
 static void omap4_cpu_clk(void);
 #endif
 #if defined(TI_AM335X)
 static void am335x_cpu_clk(void);
 #endif
-#if defined(OMAP_4430) || defined(OMAP_5430) || defined(TI_AM335X)
+#if defined(OMAP_4XXX) || defined(OMAP_5XXX) || defined(TI_AM335X)
 static psize_t emif_memprobe(void);
 #endif
 
-#if defined(OMAP_3430) || defined(OMAP_3530)
-static psize_t omap3530_memprobe(void);
+#if defined(OMAP_3XXX)
+static psize_t omap3_memprobe(void);
 #endif
 
 bs_protos(bs_notimpl);
@@ -444,10 +450,10 @@ initarm(void *arg)
 	 * peripherals and SDRAM.  The temporary first level translation table
 	 * is at the end of SDRAM.
 	 */
-#if defined(OMAP_3430) || defined(OMAP_3530) || defined(TI_DM37XX)
+#if defined(OMAP_3XXX) || defined(TI_DM37XX)
 	omap3_cpu_clk();		// find our CPU speed.
 #endif
-#if defined(OMAP_4430) || defined(OMAP_5430)
+#if defined(OMAP_4XXX) || defined(OMAP_5XXX)
 	omap4_cpu_clk();		// find our CPU speed.
 #endif
 #if defined(TI_AM335X)
@@ -462,6 +468,14 @@ initarm(void *arg)
 	/* The console is going to try to map things.  Give pmap a devmap. */
 	pmap_devmap_register(devmap);
 	consinit();
+#if defined(OMAP_4XXX)
+	/*
+	 * Probe the PL310 L2CC
+	 */
+	const bus_space_handle_t pl310_bh = OMAP4_L2CC_BASE +
+	OMAP_L4_PERIPHERAL_VBASE - OMAP_L4_PERIPHERAL_BASE;
+	arml2cc_init(&omap_bs_tag, pl310_bh, 0);
+#endif
 #if 1
 	beagle_putchar('h');
 #endif
@@ -479,7 +493,7 @@ initarm(void *arg)
 	printf("\nNetBSD/evbarm (beagle) booting ...\n");
 #endif
 
-#ifdef BOOT_ARGSt
+#ifdef BOOT_ARGS
 	char mi_bootargs[] = BOOT_ARGS;
 	parse_mi_bootargs(mi_bootargs);
 #endif
@@ -492,10 +506,10 @@ initarm(void *arg)
 	 * Set up the variables that define the availability of physical
 	 * memory.
 	 */
-#if defined(OMAP_3430) || defined(OMAP_3530)
-	ram_size = omap3530_memprobe();
+#if defined(OMAP_3XXX)
+	ram_size = omap3_memprobe();
 #endif
-#if defined(OMAP_4430) || defined(OMAP_5430) || defined(TI_AM335X)
+#if defined(OMAP_4XXX) || defined(OMAP_5XXX) || defined(TI_AM335X)
 	ram_size = emif_memprobe();
 #endif
 
@@ -515,18 +529,6 @@ initarm(void *arg)
 	bootconfig.dram[0].address = KERNEL_BASE_PHYS & -0x40;
 	bootconfig.dram[0].pages = ram_size / PAGE_SIZE;
 
-#if 0
-#if defined(OMAP_4430) || defined(OMAP_5430) || defined(TI_AM335X)
-	KASSERT(cs1_p == false);
-	if (cs1_p > 0) {
-		bootconfig.dramblocks = 2;
-		bootconfig.dram[1].address = 0xC000;
-		bootconfig.dram[0].pages /= 2;
-		bootconfig.dram[1].pages = bootconfig.dram[0].pages;
-	}
-#endif
-#endif
-
 #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
 	const bool mapallmem_p = true;
 	KASSERT(ram_size <= KERNEL_VM_BASE - KERNEL_BASE);
@@ -632,7 +634,7 @@ consinit(void)
 void
 beagle_reset(void)
 {
-#if defined(OMAP_4430)
+#if defined(OMAP_4XXX) || defined(OMAP_5XXX)
 	*(volatile uint32_t *)(OMAP_L4_CORE_VBASE + (OMAP_L4_WAKEUP_BASE - OMAP_L4_CORE_BASE) + OMAP4_PRM_RSTCTRL) = OMAP4_PRM_RSTCTRL_WARM;
 #elif defined(TI_AM335X)
 	*(volatile uint32_t *)(OMAP_L4_CORE_VBASE + (OMAP2_CM_BASE - OMAP_L

CVS commit: src/sys/arch/evbarm/beagle

2013-06-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 18 15:28:36 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_start.S

Log Message:
Unforce VERBOSE_INIT_ARM
Add a crlf after the final 'Z'


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbarm/beagle/beagle_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_start.S
diff -u src/sys/arch/evbarm/beagle/beagle_start.S:1.16 src/sys/arch/evbarm/beagle/beagle_start.S:1.17
--- src/sys/arch/evbarm/beagle/beagle_start.S:1.16	Mon Jun 17 04:39:48 2013
+++ src/sys/arch/evbarm/beagle/beagle_start.S	Tue Jun 18 15:28:36 2013
@@ -99,10 +99,8 @@
 #include 
 #endif
 
-RCSID("$NetBSD: beagle_start.S,v 1.16 2013/06/17 04:39:48 matt Exp $")
+RCSID("$NetBSD: beagle_start.S,v 1.17 2013/06/18 15:28:36 matt Exp $")
 
-#undef VERBOSE_INIT_ARM
-#define VERBOSE_INIT_ARM
 #if defined(VERBOSE_INIT_ARM)
 #define	XPUTC(n)	mov r0, n; bl xputc
 #define COM_MULT	4
@@ -159,6 +157,8 @@ _C_LABEL(beagle_start):
 	movt	r0, #:upper16:TEMP_L1_TABLE
 	bl	arm_cpuinit
 	XPUTC(#90)
+	XPUTC(#13)
+	XPUTC(#10)
 
 	/*
 	 * Jump to start in locore.S, which in turn will call initarm and main.



CVS commit: src/sys/arch/evbarm/beagle

2013-06-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun 17 04:39:49 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_start.S
Added Files:
src/sys/arch/evbarm/beagle: genassym.cf

Log Message:
Use  for the PANDABOARD as well as using
its cpuinit and l1pt init routines.
Add support for printing progress chars.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/beagle/beagle_start.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/beagle/genassym.cf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_start.S
diff -u src/sys/arch/evbarm/beagle/beagle_start.S:1.15 src/sys/arch/evbarm/beagle/beagle_start.S:1.16
--- src/sys/arch/evbarm/beagle/beagle_start.S:1.15	Sun Jun 16 17:57:21 2013
+++ src/sys/arch/evbarm/beagle/beagle_start.S	Mon Jun 17 04:39:48 2013
@@ -84,24 +84,35 @@
 
 #include "opt_omap.h"
 #include "opt_com.h"
+#include "opt_cpuoptions.h"
+#include "opt_cputypes.h"
+#include "opt_multiprocessor.h"
 
-#include 
+#include 
 #include 
 #include "assym.h"
 
 #include 
 #include   
 
-#ifdef MEMSIZE
-#define INIT_MEMSIZE	MEMSIZE
-#else
-#define INIT_MEMSIZE	128
+#ifdef CPU_CORTEXA9
+#include 
 #endif
 
-RCSID("$NetBSD: beagle_start.S,v 1.15 2013/06/16 17:57:21 matt Exp $")
+RCSID("$NetBSD: beagle_start.S,v 1.16 2013/06/17 04:39:48 matt Exp $")
+
+#undef VERBOSE_INIT_ARM
+#define VERBOSE_INIT_ARM
+#if defined(VERBOSE_INIT_ARM)
+#define	XPUTC(n)	mov r0, n; bl xputc
+#define COM_MULT	4
+#define XPUTC_COM	1
+#else
+#define	XPUTC(n)
+#endif
 
-#define Invalidate_I_cache(reg) \
-	mcr	p15, 0, reg, c7, c5, 0	/* Invalidate Entire I cache */
+#define INIT_MEMSIZE	128
+#define	TEMP_L1_TABLE	(0x8000 + INIT_MEMSIZE * 0x10 - L1_TABLE_SIZE)
 
 /*
  * Kernel start routine for BEAGLEBOARD boards.
@@ -115,104 +126,39 @@ _C_LABEL(beagle_start):
 	/* Move into supervisor mode and disable IRQs/FIQs. */
 	cpsid	if, #PSR_SVC32_MODE
 
-	ldr	r4, .Luboot_args
-	stmia	r4, {r0-r3}
-
 	/*
-	 * Set up a preliminary mapping in the MMU to allow us to run
-	 * at KERNEL_BASE with caches on.
+	 * Save any arguments passed to us.
 	 */
-	/* Build page table from scratch */
-	ldr	r0, Ltemp_l1_table
-	mov	r1, r0			/* Save the page table address. */
-	/* Zero the entire table so all virtual addresses are invalid. */
-	mov	r2, #L1_TABLE_SIZE	/* in bytes */
-	mov	r3, #0
-	mov	r4, r3
-	mov	r5, r3
-	mov	r6, r3
-	mov	r7, r3
-	mov	r8, r3
-	mov	r10, r3
-	mov	r11, r3
-1:	stmia	r1!, {r3-r8,r10-r11}
-	stmia	r1!, {r3-r8,r10-r11}
-	stmia	r1!, {r3-r8,r10-r11}
-	stmia	r1!, {r3-r8,r10-r11}
-	subs	r2, r2, #(4 * 4 * 8)	/* bytes per loop */
-	bne	1b
-
-	/* Now create our entries per the mmu_init_table. */
-	l1table	.req r0
-	va	.req r1
-	pa	.req r2
-	n_sec	.req r3
-	attr	.req r4
-	itable	.req r5
-	l1sfrm	.req r6
-	adr	itable, mmu_init_table
-	ldr	l1sfrm, Ll1_s_frame
-	b	3f
-2:	str	pa, [l1table, va, lsl #2]
-	add	va, va, #1
-	add	pa, pa, #(L1_S_SIZE)
-	adds	n_sec, n_sec, #-1
-	bhi	2b
-3:	ldmia	itable!, {va,pa,n_sec,attr}
-	/* Convert va to l1 offset:	va = 4 * (va >> L1_S_SHIFT)	*/
-	lsr	va, va, #L1_S_SHIFT
-	/* Convert pa to l1 entry:	pa = (pa & L1_S_FRAME) | attr	*/
-	and	pa, pa, l1sfrm
-	orr	pa, pa, attr
-	cmp	n_sec, #0
-	bne	2b
-	.unreq	va
-	.unreq	pa
-	.unreq	n_sec
-	.unreq	attr
-	.unreq	itable
-	.unreq	l1table
-	.unreq	l1sfrm
+	movw	r4, #:lower16:uboot_args
+	movt	r4, #:upper16:uboot_args
+	stmia	r4, {r0-r3}
 
+#ifdef CPU_CORTEXA9
 	/*
-	 * In theory, because the MMU is off, we shouldn't need all of this,
-	 * but let's not take any chances and do a typical sequence to set
-	 * the Translation Table Base.
+	 * Turn on the SCU if we are on a Cortex-A9
 	 */
-
-	Invalidate_I_cache(r0)
-
-ldr r2, Lctl_ID_dis		/* Disable I+D caches */
-	mrc	p15, 0, r1, c1, c0, 0	/*  "   "   " */
-	and	r1, r1, r2		/*  "   "   " */
-	mcr	p15, 0, r1, c1, c0, 0	/*  "   "   " */
-
-	mcr	p15, 0, r0, c7, c10, 4	/* Drain the write buffers. */
-	mcr	p15, 0, r0, c2, c0, 0	/* Set Translation Table Base */
-	mcr	p15, 0, r0, c8, c7, 0	/* Invalidate TLBs */
-
-	/* Set the Domain Access register.  Very important! */
-mov r0, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
-	mcr	p15, 0, r0, c3, c0, 0
+	bl	a9_start
+	XPUTC(#67)
+#endif
 
 	/*
-	 * Enable the MMU, etc.
+	 * Set up a preliminary mapping in the MMU to allow us to run
+	 * at KERNEL_BASE with caches on.
 	 */
-	mrc p15, 0, r0, c1, c0, 0
-	ldr r1, Lcontrol_wax
-	and	r0, r0, r1
-	ldr r1, Lcontrol_clr
-	mvn	r1, r1
-	and	r0, r0, r1
-	ldr r1, Lcontrol_set
-	orr	r0, r0, r1
-	mcr p15, 0, r0, c1, c0, 0
+	movw	r0, #:lower16:TEMP_L1_TABLE
+	movt	r0, #:upper16:TEMP_L1_TABLE
+	adr	r1, .Lmmu_init_table
+	bl	arm_boot_l1pt_init
+
+	XPUTC(#68)
 
 	/*
-	 * Ensure that the coprocessor has finished turning on the MMU.
+	 * Turn on the MMU, Caches, etc.
 	 */
-	mrc	p15, 0, r0, c2, c0,

CVS commit: src/sys/arch/evbarm/beagle

2013-06-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun 17 04:37:39 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Don't hardcode beagle_putchar com values.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.45 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.46
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.45	Sun Jun 16 16:48:23 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon Jun 17 04:37:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.45 2013/06/16 16:48:23 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.46 2013/06/17 04:37:39 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.45 2013/06/16 16:48:23 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.46 2013/06/17 04:37:39 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -170,6 +170,9 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -395,18 +398,20 @@ void
 beagle_putchar(char c)
 {
 #if NCOM > 0
-	unsigned char *com0addr = (char *)CONSADDR_VA;
+	volatile uint32_t *com0addr = (volatile uint32_t *)CONSADDR_VA;
 	int timo = 15;
 
-	while ((com0addr[5 * 4] & 0x20) == 0)
+	while ((com0addr[com_lsr] & LSR_TXRDY) == 0) {
 		if (--timo == 0)
 			break;
+	}
 
-	com0addr[0] = c;
+	com0addr[com_data] = c;
 
-	while ((com0addr[5 * 4] & 0x20) == 0)
+	while ((com0addr[com_lsr] & LSR_TXRDY) == 0) {
 		if (--timo == 0)
 			break;
+	}
 #endif
 }
 
@@ -428,9 +433,11 @@ initarm(void *arg)
 {
 	psize_t ram_size = 0;
 	char *ptr;
+
 #if 1
 	beagle_putchar('d');
 #endif
+
 	/*
 	 * When we enter here, we are using a temporary first level
 	 * translation table with section entries in it to cover the OBIO
@@ -776,7 +783,8 @@ emif_memprobe(void)
 	 * OMAP4 and OMAP5 have two EMIFs so if the 2nd one is configured
 	 * like the first, we have twice the memory.
 	 */
-	if (emif_read_sdram_config(OMAP_EMIF2_VBASE) == sdram_config)
+	const uint32_t sdram_config2 = emif_read_sdram_config(OMAP_EMIF2_VBASE);
+	if (sdram_config2 == sdram_config)
 		memsize <<= 1;
 #endif
 



CVS commit: src/sys/arch/evbarm/beagle

2013-06-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun 17 04:38:14 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle.h

Log Message:
On the 4430/5430, console is in peripheral space, not core.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/beagle/beagle.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle.h
diff -u src/sys/arch/evbarm/beagle/beagle.h:1.11 src/sys/arch/evbarm/beagle/beagle.h:1.12
--- src/sys/arch/evbarm/beagle/beagle.h:1.11	Sun Jun 16 16:48:23 2013
+++ src/sys/arch/evbarm/beagle/beagle.h	Mon Jun 17 04:38:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle.h,v 1.11 2013/06/16 16:48:23 matt Exp $	*/
+/*	$NetBSD: beagle.h,v 1.12 2013/06/17 04:38:14 matt Exp $	*/
 /*
  * Copyright (c) 2007 Microsoft
  * All rights reserved.
@@ -130,7 +130,7 @@
 #define OMAP_EMIF1_VBASE	(OMAP_L4_ABE_VBASE + OMAP_L4_ABE_SIZE)
 #define OMAP_EMIF2_VBASE	(OMAP_EMIF1_VBASE + OMAP_EMIF1_SIZE)
 #define OMAP_KERNEL_IO_VEND	(OMAP_EMIF2_VBASE + OMAP_EMIF2_SIZE)
-#define CONSADDR_VA	((CONSADDR - OMAP_L4_CORE_BASE) + OMAP_L4_CORE_VBASE)
+#define CONSADDR_VA	((CONSADDR - OMAP_L4_PERIPHERAL_BASE) + OMAP_L4_PERIPHERAL_VBASE)
 #elif defined(TI_AM335X)
 #define OMAP_L4_PERIPHERAL_VBASE	OMAP_KERNEL_IO_VBASE
 #define OMAP_L4_FAST_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)



CVS commit: src/sys/arch/evbarm/beagle

2013-06-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jun 16 17:57:21 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_start.S

Log Message:
Fix pasto.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/beagle/beagle_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_start.S
diff -u src/sys/arch/evbarm/beagle/beagle_start.S:1.14 src/sys/arch/evbarm/beagle/beagle_start.S:1.15
--- src/sys/arch/evbarm/beagle/beagle_start.S:1.14	Sun Jun 16 16:48:23 2013
+++ src/sys/arch/evbarm/beagle/beagle_start.S	Sun Jun 16 17:57:21 2013
@@ -98,7 +98,7 @@
 #define INIT_MEMSIZE	128
 #endif
 
-RCSID("$NetBSD: beagle_start.S,v 1.14 2013/06/16 16:48:23 matt Exp $")
+RCSID("$NetBSD: beagle_start.S,v 1.15 2013/06/16 17:57:21 matt Exp $")
 
 #define Invalidate_I_cache(reg) \
 	mcr	p15, 0, reg, c7, c5, 0	/* Invalidate Entire I cache */
@@ -285,8 +285,8 @@ mmu_init_table:
 		L1_S_PROTO | L1_S_APv7_KRW)
 
 #if OMAP_L4_CORE_BASE <= CONSADDR \
-	/* Map first 1MB of L4 CORE 1:1 (so console will work) */
 	&& CONSADDR < OMAP_L4_CORE_BASE + OMAP_L4_CORE_SIZE
+	/* Map first 1MB of L4 CORE 1:1 (so console will work) */
 	MMU_INIT(OMAP_L4_CORE_BASE, OMAP_L4_CORE_BASE,
 		(OMAP_L4_CORE_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
 		L1_S_PROTO | L1_S_APv7_KRW)



CVS commit: src/sys/arch/evbarm/beagle

2013-06-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jun 12 20:36:53 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Now that VBAR support is present, switch to ARM_VECTORS_LOW.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.43 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.44
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.43	Tue Jun 11 22:59:54 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Wed Jun 12 20:36:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.43 2013/06/11 22:59:54 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.44 2013/06/12 20:36:53 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.43 2013/06/11 22:59:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.44 2013/06/12 20:36:53 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -499,10 +499,11 @@ initarm(void *arg)
 #else
 	const bool mapallmem_p = false;
 #endif
+	KASSERT((armreg_pfr1_read() & ARM_PFR1_SEC_MASK) != 0);
 
 	arm32_bootmem_init(bootconfig.dram[0].address, ram_size,
 	KERNEL_BASE_PHYS);
-	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap,
+	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, devmap,
 	mapallmem_p);
 
 	/* "bootargs" env variable is passed as 4th argument to kernel */



CVS commit: src/sys/arch/evbarm/beagle

2013-06-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 11 22:59:54 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Make sure there is enough KVA to map all of memory if
__HAVE_MM_MD_DIRECT_MAPPED_PHYS is defined.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.42 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.43
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.42	Sun May 12 02:55:54 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Jun 11 22:59:54 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.42 2013/05/12 02:55:54 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.43 2013/06/11 22:59:54 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.42 2013/05/12 02:55:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.43 2013/06/11 22:59:54 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -493,9 +493,17 @@ initarm(void *arg)
 	bootconfig.dram[0].address = KERNEL_BASE_PHYS & -0x40;
 	bootconfig.dram[0].pages = ram_size / PAGE_SIZE;
 
+#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
+	const bool mapallmem_p = true;
+	KASSERT(ram_size <= KERNEL_VM_BASE - KERNEL_BASE);
+#else
+	const bool mapallmem_p = false;
+#endif
+
 	arm32_bootmem_init(bootconfig.dram[0].address, ram_size,
 	KERNEL_BASE_PHYS);
-	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap, true);
+	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap,
+	mapallmem_p);
 
 	/* "bootargs" env variable is passed as 4th argument to kernel */
 	if ((uboot_args[3] & 0xf000) == 0x8000) {



CVS commit: src/sys/arch/evbarm/beagle

2013-05-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun May 12 02:55:54 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.41 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.42
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.41	Mon May  6 23:12:53 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Sun May 12 02:55:54 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.41 2013/05/06 23:12:53 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.42 2013/05/12 02:55:54 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.41 2013/05/06 23:12:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.42 2013/05/12 02:55:54 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -721,7 +721,7 @@ am335x_memprobe(void)
 	 * if we detect if it has the wrong value.
 	 */
 	if (sdram_config == 0x41805332)
-		sdram_config -= __SHIFTOUT(1, SDRAM_CONFIG_RSIZE);
+		sdram_config -= __SHIFTIN(1, SDRAM_CONFIG_RSIZE);
 
 	const u_int ibank = __SHIFTOUT(sdram_config, SDRAM_CONFIG_IBANK);
 	const u_int rsize = 9 + __SHIFTOUT(sdram_config, SDRAM_CONFIG_RSIZE);



CVS commit: src/sys/arch/evbarm/beagle

2013-05-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon May  6 23:12:53 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Fix probing error on BBONE due to wrong value being used in u-boot to
program the DDR controller.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.40 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.41
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.40	Tue Apr 30 05:39:44 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon May  6 23:12:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.40 2013/04/30 05:39:44 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.41 2013/05/06 23:12:53 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.40 2013/04/30 05:39:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.41 2013/05/06 23:12:53 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -715,7 +715,14 @@ 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);
+	uint32_t sdram_config = *(const volatile uint32_t *)(emif_base + EMIF_SDRAM_CONFIG);
+	/*
+	 * The original bbone's u-boot misprograms the EMIF so correct it
+	 * if we detect if it has the wrong value.
+	 */
+	if (sdram_config == 0x41805332)
+		sdram_config -= __SHIFTOUT(1, SDRAM_CONFIG_RSIZE);
+
 	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);



CVS commit: src/sys/arch/evbarm/beagle

2013-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr 30 05:39:45 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
for the TI AM335x, use the control_status register in the control module
to obtain the base frequency instead of assuming it's always 24MHz.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.39 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.40
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.39	Tue Apr 30 00:18:01 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Apr 30 05:39:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.39 2013/04/30 00:18:01 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.40 2013/04/30 05:39:44 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.39 2013/04/30 00:18:01 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.40 2013/04/30 05:39:44 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -691,9 +691,14 @@ omap4_cpu_clk(void)
 void
 am335x_cpu_clk(void)
 {
+	static const uint32_t sys_clks[4] = {
+		[0] = 1920, [1] = 2400, [2] = 2500, [3] = 2600
+	};
 	const vaddr_t cm_base = OMAP2_CM_BASE - OMAP_L4_CORE_BASE + OMAP_L4_CORE_VBASE;
 	const vaddr_t cm_wkup_base = cm_base + AM335X_PRCM_CM_WKUP;
-	const uint32_t sys_clk = 2400;
+	const vaddr_t ctlmod_base = TI_AM335X_CTLMOD_BASE - OMAP_L4_CORE_BASE + OMAP_L4_CORE_VBASE;
+	const uint32_t control_status = *(const volatile uint32_t *)(ctlmod_base + CTLMOD_CONTROL_STATUS);
+	const uint32_t sys_clk = sys_clks[__SHIFTOUT(control_status, CTLMOD_CONTROL_STATUS_SYSBOOT1)];
 	const uint32_t clksel_dpll_mpu = *(volatile uint32_t *)(cm_wkup_base + TI_AM335X_CM_CLKSEL_DPLL_MPU);
 	const uint32_t div_m2_dpll_mpu = *(volatile uint32_t *)(cm_wkup_base + TI_AM335X_CM_DIV_M2_DPLL_MPU);
 	const uint32_t m = __SHIFTOUT(clksel_dpll_mpu, TI_AM335X_CM_CLKSEL_DPLL_MPU_DPLL_MULT);



CVS commit: src/sys/arch/evbarm/beagle

2013-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr 30 00:18:02 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle.h beagle_machdep.c beagle_start.S

Log Message:
Map EMIF0 for TIAM335X and use to probe memory size.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/beagle/beagle.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/beagle/beagle_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle.h
diff -u src/sys/arch/evbarm/beagle/beagle.h:1.9 src/sys/arch/evbarm/beagle/beagle.h:1.10
--- src/sys/arch/evbarm/beagle/beagle.h:1.9	Thu Dec 13 01:16:39 2012
+++ src/sys/arch/evbarm/beagle/beagle.h	Tue Apr 30 00:18:01 2013
@@ -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

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.38 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.39
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.38	Mon Apr 15 18:56:38 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Apr 30 00:18:01 2013
@@ -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 
-__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 @@ static void omap4_cpu_clk(void);
 #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 @@ static const struct pmap_devmap devmap[]
 		.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 @@ initarm(void *arg)
 #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 @@ am335x_cpu_clk(void)
 	__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)

Index: src/sys/arch/evbarm/beagle/beagle_start.S
diff -u src/sys/arch/evbarm/beagle/beagle_start.S:1.12 src/sys/arch/evbarm/beagle/beagle_start.S:1.13
--- src/sys/arch/evbarm/beagle/beagle_start.S:1.12	Thu Dec 13 01:16:39 2012
+++ src/sys/arch/evbarm/beagle/beagle_start.S	Tue Apr 30 00:18:02 2013
@@ -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 En

CVS commit: src/sys/arch/evbarm/beagle

2013-04-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Mon Apr 15 18:56:38 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
include com.h before testing NCOM


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.37 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.38
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.37	Wed Mar 13 03:03:04 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon Apr 15 18:56:38 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.37 2013/03/13 03:03:04 khorben Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.38 2013/04/15 18:56:38 bouyer Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.37 2013/03/13 03:03:04 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.38 2013/04/15 18:56:38 bouyer Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -135,6 +135,7 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include "opt_com.h"
 #include "opt_omap.h"
 #include "prcm.h"
+#include "com.h"
 
 #include 
 #include 
@@ -241,7 +242,6 @@ static psize_t omap3530_memprobe(void);
 
 bs_protos(bs_notimpl);
 
-#include "com.h"
 #if NCOM > 0
 #include 
 #include 



CVS commit: src/sys/arch/evbarm/beagle

2013-03-12 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Mar 13 03:03:04 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Set the framebuffer as the default console when no serial port is configured.
This was tested on a Nokia N900 with the N900 kernel. The BEAGLEBOARD kernel
still builds.

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.36 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.37
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.36	Sat Feb  9 22:11:29 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Wed Mar 13 03:03:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.36 2013/02/09 22:11:29 christos Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.37 2013/03/13 03:03:04 khorben Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.36 2013/02/09 22:11:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.37 2013/03/13 03:03:04 khorben Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -203,7 +203,11 @@ u_int uboot_args[4] = { 0 };	/* filled i
 extern char KERNEL_BASE_phys[];
 extern char _end[];
 
+#if NCOM > 0
 int use_fb_console = false;
+#else
+int use_fb_console = true;
+#endif
 
 /*
  * Macros to translate between physical and virtual for a subset of the
@@ -231,7 +235,7 @@ static void omap4_cpu_clk(void);
 static void am335x_cpu_clk(void);
 #endif
 
-#if defined(OMAP_3530) || defined(OMAP_3430)
+#if defined(OMAP_3430) || defined(OMAP_3530)
 static psize_t omap3530_memprobe(void);
 #endif
 
@@ -363,6 +367,7 @@ void beagle_putchar(char c);
 void
 beagle_putchar(char c)
 {
+#if NCOM > 0
 	unsigned char *com0addr = (char *)CONSADDR_VA;
 	int timo = 15;
 
@@ -375,6 +380,7 @@ beagle_putchar(char c)
 	while ((com0addr[5 * 4] & 0x20) == 0)
 		if (--timo == 0)
 			break;
+#endif
 }
 
 /*
@@ -452,7 +458,7 @@ initarm(void *arg)
 	 * Set up the variables that define the availability of physical
 	 * memory.
 	 */
-#if defined(OMAP_3530) || defined(OMAP_3430)
+#if defined(OMAP_3430) || defined(OMAP_3530)
 	ram_size = omap3530_memprobe();
 #endif
 	/*
@@ -514,6 +520,7 @@ init_clocks(void)
 #endif
 }
 
+#if NCOM > 0
 #ifndef CONSADDR
 #error Specify the address of the console UART with the CONSADDR option.
 #endif
@@ -527,11 +534,14 @@ init_clocks(void)
 static const bus_addr_t consaddr = CONSADDR;
 static const int conspeed = CONSPEED;
 static const int conmode = CONMODE;
+#endif
 
 void
 consinit(void)
 {
+#if NCOM > 0
 	bus_space_handle_t bh;
+#endif
 	static int consinit_called = 0;
 
 	if (consinit_called != 0)
@@ -541,6 +551,7 @@ consinit(void)
 
 	beagle_putchar('e');
 
+#if NCOM > 0
 	if (bus_space_map(&omap_a4x_bs_tag, consaddr, OMAP_COM_SIZE, 0, &bh))
 		panic("Serial console can not be mapped.");
 
@@ -549,6 +560,7 @@ consinit(void)
 		panic("Serial console can not be initialized.");
 
 	bus_space_unmap(&omap_a4x_bs_tag, bh, OMAP_COM_SIZE);
+#endif
 
 #if NUKBD > 0
 	ukbd_cnattach();	/* allow USB keyboard to become console */
@@ -679,7 +691,7 @@ am335x_cpu_clk(void)
 }
 #endif
 
-#if defined(OMAP_3530) || defined(OMAP_3430)
+#if defined(OMAP_3430) || defined(OMAP_3530)
 #define SDRC_MCFG(p)		(0x80 + (0x30 * (p)))
 #define SDRC_MCFG_MEMSIZE(m)	m) & __BITS(8,17)) >> 8) * 2)
 static psize_t 
@@ -782,7 +794,7 @@ beagle_device_register(device_t self, vo
 	}
 
 	if (device_is_a(self, "sdhc")) {
-#if defined(OMAP_3530)
+#if defined(OMAP_3430) || defined(OMAP_3530)
 		prop_dictionary_set_uint32(dict, "clkmask", 0);
 		prop_dictionary_set_bool(dict, "8bit", true);
 #endif



CVS commit: src/sys/arch/evbarm/beagle

2013-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb  9 22:11:29 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
fix BEAGLEBONEXM linking


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.35 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.36
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.35	Mon Jan 14 06:23:48 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Sat Feb  9 17:11:29 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.35 2013/01/14 11:23:48 jmcneill Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.36 2013/02/09 22:11:29 christos Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.35 2013/01/14 11:23:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.36 2013/02/09 22:11:29 christos Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -705,15 +705,14 @@ omap3530_memprobe(void)
 static bool
 beagle_read_edid(uint8_t *edid_buf, size_t edid_buflen)
 {
+#if defined(OMAP_3530)
 	i2c_tag_t ic = NULL;
 	uint8_t reg;
 	int error;
 
-#if defined(OMAP_3530)
 	/* On Beagleboard, EDID is accessed using I2C2 ("omapiic2"). */
 	extern i2c_tag_t omap3_i2c_get_tag(device_t);
 	ic = omap3_i2c_get_tag(device_find_by_xname("omapiic2"));
-#endif
 
 	if (ic == NULL)
 		return false;
@@ -728,6 +727,9 @@ beagle_read_edid(uint8_t *edid_buf, size
 	iic_release_bus(ic, 0);
 
 	return error == 0 ? true : false;
+#else
+	return false;
+#endif
 }
 
 void



CVS commit: src/sys/arch/evbarm/beagle

2013-01-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan 14 11:23:49 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
copy boot args so they dont get clobbered later, fixes root= on beagleboard


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.34 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.35
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.34	Thu Jan 10 17:36:35 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon Jan 14 11:23:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.34 2013/01/10 17:36:35 macallan Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.35 2013/01/14 11:23:48 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.34 2013/01/10 17:36:35 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.35 2013/01/14 11:23:48 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -189,15 +189,9 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include "ukbd.h"
 #include 
 
-#ifdef BOOT_ARGS
-#define DEFAULT_BOOT_ARGS BOOT_ARGS
-#else
-#define DEFAULT_BOOT_ARGS "-a"
-#endif
-
 BootConfig bootconfig;		/* Boot config storage */
-static char beagle_default_boot_args[] = DEFAULT_BOOT_ARGS;
-char *boot_args = beagle_default_boot_args;
+static char bootargs[MAX_BOOT_STRING];
+char *boot_args = NULL;
 char *boot_file = NULL;
 
 static uint8_t beagle_edid[128];	/* EDID storage */
@@ -483,8 +477,9 @@ initarm(void *arg)
 
 	/* "bootargs" env variable is passed as 4th argument to kernel */
 	if ((uboot_args[3] & 0xf000) == 0x8000) {
-		boot_args = (char *)uboot_args[3];
+		strlcpy(bootargs, (char *)uboot_args[3], sizeof(bootargs));
 	}
+	boot_args = bootargs;
 	parse_mi_bootargs(boot_args);
 
 	/* we've a specific device_register routine */



CVS commit: src/sys/arch/evbarm/beagle

2013-01-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan 10 17:36:36 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
do as RPi does - if console=fb is in bootargs, tell omapfb to become the
console and com not to, otherwise let com be the console


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.33 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.34
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.33	Tue Jan  1 23:21:26 2013
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Thu Jan 10 17:36:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.33 2013/01/01 23:21:26 jmcneill Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.34 2013/01/10 17:36:35 macallan Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.33 2013/01/01 23:21:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.34 2013/01/10 17:36:35 macallan Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -186,6 +186,8 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 
 #include "prcm.h"
 #include "omapwdt32k.h"
+#include "ukbd.h"
+#include 
 
 #ifdef BOOT_ARGS
 #define DEFAULT_BOOT_ARGS BOOT_ARGS
@@ -207,6 +209,8 @@ u_int uboot_args[4] = { 0 };	/* filled i
 extern char KERNEL_BASE_phys[];
 extern char _end[];
 
+int use_fb_console = false;
+
 /*
  * Macros to translate between physical and virtual for a subset of the
  * kernel address space.  *Not* for general use.
@@ -396,6 +400,7 @@ u_int
 initarm(void *arg)
 {
 	psize_t ram_size = 0;
+	char *ptr;
 #if 1
 	beagle_putchar('d');
 #endif
@@ -440,7 +445,7 @@ initarm(void *arg)
 	printf("\nNetBSD/evbarm (beagle) booting ...\n");
 #endif
 
-#ifdef BOOT_ARGS
+#ifdef BOOT_ARGSt
 	char mi_bootargs[] = BOOT_ARGS;
 	parse_mi_bootargs(mi_bootargs);
 #endif
@@ -487,7 +492,13 @@ initarm(void *arg)
 
 	db_trap_callback = beagle_db_trap;
 
+	if (get_bootconf_option(boot_args, "console",
+		BOOTOPT_TYPE_STRING, &ptr) && strncmp(ptr, "fb", 2) == 0) {
+		use_fb_console = true;
+	}
+	
 	return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0);
+
 }
 
 static void
@@ -544,6 +555,10 @@ consinit(void)
 
 	bus_space_unmap(&omap_a4x_bs_tag, bh, OMAP_COM_SIZE);
 
+#if NUKBD > 0
+	ukbd_cnattach();	/* allow USB keyboard to become console */
+#endif
+
 	beagle_putchar('f');
 	beagle_putchar('g');
 }
@@ -783,6 +798,12 @@ beagle_device_register(device_t self, vo
 			prop_data_create_data(beagle_edid,
 		  sizeof(beagle_edid)));
 		}
+		if (use_fb_console)
+			prop_dictionary_set_bool(dict, "is_console", true);
 		return;
 	}
+	if (device_is_a(self, "com")) {
+		if (use_fb_console)
+			prop_dictionary_set_bool(dict, "is_console", false);
+	}
 }



CVS commit: src/sys/arch/evbarm/beagle

2013-01-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan  1 23:21:26 UTC 2013

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Read EDID data on Beagleboard and pass it to omapfb driver if found.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.32 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.33
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.32	Mon Dec 31 13:20:16 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Jan  1 23:21:26 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.32 2012/12/31 13:20:16 jmcneill Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.33 2013/01/01 23:21:26 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.32 2012/12/31 13:20:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.33 2013/01/01 23:21:26 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -181,6 +181,9 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include 
 #include 
 
+#include 
+#include 
+
 #include "prcm.h"
 #include "omapwdt32k.h"
 
@@ -195,6 +198,8 @@ static char beagle_default_boot_args[] =
 char *boot_args = beagle_default_boot_args;
 char *boot_file = NULL;
 
+static uint8_t beagle_edid[128];	/* EDID storage */
+
 u_int uboot_args[4] = { 0 };	/* filled in by beagle_start.S (not in bss) */
 
 /* Same things, but for the free (unused by the kernel) memory. */
@@ -681,6 +686,40 @@ omap3530_memprobe(void)
 }
 #endif
 
+/*
+ * EDID can be read from DVI-D (HDMI) port on BeagleBoard from
+ * If EDID data is present, this function fills in the supplied edid_buf
+ * and returns true. Otherwise, it returns false and the contents of the
+ * buffer are undefined.
+ */
+static bool
+beagle_read_edid(uint8_t *edid_buf, size_t edid_buflen)
+{
+	i2c_tag_t ic = NULL;
+	uint8_t reg;
+	int error;
+
+#if defined(OMAP_3530)
+	/* On Beagleboard, EDID is accessed using I2C2 ("omapiic2"). */
+	extern i2c_tag_t omap3_i2c_get_tag(device_t);
+	ic = omap3_i2c_get_tag(device_find_by_xname("omapiic2"));
+#endif
+
+	if (ic == NULL)
+		return false;
+
+	iic_acquire_bus(ic, 0);
+	for (reg = DDC_EDID_START; reg < edid_buflen; reg++) {
+		error = iic_exec(ic, I2C_OP_READ_WITH_STOP, DDC_ADDR,
+		®, sizeof(reg), &edid_buf[reg], 1, 0);
+		if (error)
+			break;
+	}
+	iic_release_bus(ic, 0);
+
+	return error == 0 ? true : false;
+}
+
 void
 beagle_device_register(device_t self, void *aux)
 {
@@ -737,4 +776,13 @@ beagle_device_register(device_t self, vo
 #endif
 		return;
 	}
+
+	if (device_is_a(self, "omapfb")) {
+		if (beagle_read_edid(beagle_edid, sizeof(beagle_edid))) {
+			prop_dictionary_set(dict, "EDID",
+			prop_data_create_data(beagle_edid,
+		  sizeof(beagle_edid)));
+		}
+		return;
+	}
 }



CVS commit: src/sys/arch/evbarm/beagle

2012-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec 13 05:58:14 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Add default boot args and support parsing of u-boot bootargs.
Fix problem when MEMSIZE was not defined.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.30 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.31
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.30	Thu Dec 13 02:12:16 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Thu Dec 13 05:58:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.30 2012/12/13 02:12:16 jakllsch Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.31 2012/12/13 05:58:14 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.30 2012/12/13 02:12:16 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.31 2012/12/13 05:58:14 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -184,8 +184,15 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include "prcm.h"
 #include "omapwdt32k.h"
 
+#ifdef BOOT_ARGS
+#define DEFAULT_BOOT_ARGS BOOT_ARGS
+#else
+#define DEFAULT_BOOT_ARGS "-a"
+#endif
+
 BootConfig bootconfig;		/* Boot config storage */
-char *boot_args = NULL;
+static char beagle_default_boot_args[] = DEFAULT_BOOT_ARGS;
+char *boot_args = beagle_default_boot_args;
 char *boot_file = NULL;
 
 u_int uboot_args[4] = { 0 };	/* filled in by beagle_start.S (not in bss) */
@@ -416,6 +423,7 @@ initarm(void *arg)
 #endif
 	printf("uboot arg = %#x, %#x, %#x, %#x\n",
 	uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]);
+
 #ifdef KGDB
 	kgdb_port_init();
 #endif
@@ -447,8 +455,12 @@ initarm(void *arg)
 	 * If MEMSIZE specified less than what we really have, limit ourselves
 	 * to that.
 	 */
+#ifdef MEMSIZE
 	if (ram_size == 0 || ram_size > MEMSIZE * 1024 * 1024)
 		ram_size = MEMSIZE * 1024 * 1024;
+#else
+	KASSERTMSG(ram_size > 0, "RAM size unknown and MEMSIZE undefined");
+#endif
 
 	/* Fake bootconfig structure for the benefit of pmap.c. */
 	bootconfig.dramblocks = 1;
@@ -459,6 +471,12 @@ initarm(void *arg)
 	KERNEL_BASE_PHYS);
 	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap, true);
 
+	/* "bootargs" env variable is passed as 4th argument to kernel */
+	if ((uboot_args[3] & 0xf000) == 0x8000) {
+		boot_args = (char *)uboot_args[3];
+	}
+	parse_mi_bootargs(boot_args);
+
 	/* we've a specific device_register routine */
 	evbarm_device_register = beagle_device_register;
 



CVS commit: src/sys/arch/evbarm/beagle

2012-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec 13 01:23:16 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Allow MEMSIZE to only lower the amount of memory probed, not increase it.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.28 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.29
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.28	Thu Dec 13 01:16:39 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Thu Dec 13 01:23:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.28 2012/12/13 01:16:39 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.29 2012/12/13 01:23:16 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.28 2012/12/13 01:16:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.29 2012/12/13 01:23:16 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -383,7 +383,7 @@ beagle_putchar(char c)
 u_int
 initarm(void *arg)
 {
-	psize_t ram_size;
+	psize_t ram_size = 0;
 #if 1
 	beagle_putchar('d');
 #endif
@@ -442,9 +442,13 @@ initarm(void *arg)
 	 */
 #if defined(OMAP_3530) || defined(OMAP_3430)
 	ram_size = omap3530_memprobe();
-#else
-	ram_size = MEMSIZE * 1024 * 1024;
 #endif
+	/*
+	 * If MEMSIZE specified less than what we really have, limit ourselves
+	 * to that.
+	 */
+	if (ram_size == 0 || ram_size > MEMSIZE * 1024 * 1024)
+		ram_size = MEMSIZE * 1024 * 1024;
 
 	/* Fake bootconfig structure for the benefit of pmap.c. */
 	bootconfig.dramblocks = 1;



CVS commit: src/sys/arch/evbarm/beagle

2012-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec 13 01:16:39 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle.h beagle_machdep.c beagle_start.S

Log Message:
Add SDRC to devmap.
Use SDRC to determine RAM size on OMAP3xxx.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/beagle/beagle.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/beagle/beagle_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle.h
diff -u src/sys/arch/evbarm/beagle/beagle.h:1.8 src/sys/arch/evbarm/beagle/beagle.h:1.9
--- src/sys/arch/evbarm/beagle/beagle.h:1.8	Tue Dec 11 01:54:43 2012
+++ src/sys/arch/evbarm/beagle/beagle.h	Thu Dec 13 01:16:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle.h,v 1.8 2012/12/11 01:54:43 khorben Exp $	*/
+/*	$NetBSD: beagle.h,v 1.9 2012/12/13 01:16:39 matt Exp $	*/
 /*
  * Copyright (c) 2007 Microsoft
  * All rights reserved.
@@ -47,6 +47,8 @@
 #define OMAP_L4_PERIPHERAL_SIZE		OMAP3430_L4_PERIPHERAL_SIZE
 #define OMAP_L4_WAKEUP_BASE		OMAP3430_L4_WAKEUP_BASE
 #define OMAP_L4_WAKEUP_SIZE		OMAP3430_L4_WAKEUP_SIZE
+#define OMAP_SDRC_BASE			OMAP3530_SDRC_BASE
+#define OMAP_SDRC_SIZE			OMAP3530_SDRC_SIZE
 #endif
 
 #ifdef OMAP_3530
@@ -56,6 +58,8 @@
 #define OMAP_L4_PERIPHERAL_SIZE		OMAP3530_L4_PERIPHERAL_SIZE
 #define OMAP_L4_WAKEUP_BASE		OMAP3530_L4_WAKEUP_BASE
 #define OMAP_L4_WAKEUP_SIZE		OMAP3530_L4_WAKEUP_SIZE
+#define OMAP_SDRC_BASE			OMAP3530_SDRC_BASE
+#define OMAP_SDRC_SIZE			OMAP3530_SDRC_SIZE
 #endif
 
 #ifdef OMAP_4430
@@ -95,7 +99,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_WAKEUP_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
-#define OMAP_KERNEL_IO_VEND	(OMAP_L4_WAKEUP_VBASE + OMAP_L4_WAKEUP_SIZE)
+#define OMAP_SDRC_VBASE		(OMAP_L4_WAKEUP_VBASE + OMAP_L4_WAKEUP_SIZE)
+#define OMAP_KERNEL_IO_VEND	(OMAP_SDRC_VBASE + OMAP_SDRC_SIZE)
 #define CONSADDR_VA	((CONSADDR - OMAP_L4_PERIPHERAL_BASE) + OMAP_L4_PERIPHERAL_VBASE)
 #elif defined(OMAP_4430)
 #define OMAP_L4_CORE_VBASE	OMAP_KERNEL_IO_VBASE

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.27 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.28
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.27	Wed Dec 12 15:20:44 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Thu Dec 13 01:16:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.27 2012/12/12 15:20:44 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.28 2012/12/13 01:16:39 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.27 2012/12/12 15:20:44 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.28 2012/12/13 01:16:39 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -221,6 +221,10 @@ static void omap4_cpu_clk(void);
 static void am335x_cpu_clk(void);
 #endif
 
+#if defined(OMAP_3530) || defined(OMAP_3430)
+static psize_t omap3530_memprobe(void);
+#endif
+
 bs_protos(bs_notimpl);
 
 #include "com.h"
@@ -311,6 +315,18 @@ static const struct pmap_devmap devmap[]
 		.pd_cache = PTE_NOCACHE
 	},
 #endif
+#ifdef OMAP_SDRC_BASE
+	{
+		/*
+		 * Map SDRAM Controller (SDRC) registers
+		 */
+		.pd_va = _A(OMAP_SDRC_VBASE),
+		.pd_pa = _A(OMAP_SDRC_BASE),
+		.pd_size = _S(OMAP_SDRC_SIZE),
+		.pd_prot = VM_PROT_READ|VM_PROT_WRITE,
+		.pd_cache = PTE_NOCACHE,
+	},
+#endif
 	{0}
 };
 
@@ -367,6 +383,7 @@ beagle_putchar(char c)
 u_int
 initarm(void *arg)
 {
+	psize_t ram_size;
 #if 1
 	beagle_putchar('d');
 #endif
@@ -423,14 +440,18 @@ initarm(void *arg)
 	 * Set up the variables that define the availability of physical
 	 * memory.
 	 */
-#define	MEMSIZE_BYTES 	(MEMSIZE * 1024 * 1024)
+#if defined(OMAP_3530) || defined(OMAP_3430)
+	ram_size = omap3530_memprobe();
+#else
+	ram_size = MEMSIZE * 1024 * 1024;
+#endif
 
 	/* Fake bootconfig structure for the benefit of pmap.c. */
 	bootconfig.dramblocks = 1;
 	bootconfig.dram[0].address = KERNEL_BASE_PHYS & -0x40;
-	bootconfig.dram[0].pages = MEMSIZE_BYTES;
+	bootconfig.dram[0].pages = ram_size / PAGE_SIZE;
 
-	arm32_bootmem_init(bootconfig.dram[0].address, MEMSIZE_BYTES,
+	arm32_bootmem_init(bootconfig.dram[0].address, ram_size,
 	KERNEL_BASE_PHYS);
 	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap, true);
 
@@ -619,6 +640,23 @@ am335x_cpu_clk(void)
 }
 #endif
 
+#if defined(OMAP_3530) || defined(OMAP_3430)
+#define SDRC_MCFG(p)		(0x80 + (0x30 * (p)))
+#define SDRC_MCFG_MEMSIZE(m)	m) & __BITS(8,17)) >> 8) * 2)
+static psize_t 
+omap3530_memprobe(void)
+{
+	const vaddr_t gpmc_base = OMAP_SDRC_VBASE;
+	const uint32_t mcfg0 = *(volatile uint32_t *)(gpmc_base

CVS commit: src/sys/arch/evbarm/beagle

2012-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 12 15:20:44 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Set clkmask for sdhc to 0.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.26 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.27
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.26	Wed Dec 12 02:42:25 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Wed Dec 12 15:20:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.26 2012/12/12 02:42:25 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.27 2012/12/12 15:20:44 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.26 2012/12/12 02:42:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.27 2012/12/12 15:20:44 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -667,4 +667,11 @@ beagle_device_register(device_t self, vo
 #endif
 		return;
 	}
+
+	if (device_is_a(self, "sdhc")) {
+#if defined(OMAP_3530)
+		prop_dictionary_set_uint32(dict, "clkmask", 0);
+#endif
+		return;
+	}
 }



CVS commit: src/sys/arch/evbarm/beagle

2012-12-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 12 02:42:25 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Map all of RAM.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.25 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.26
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.25	Wed Dec 12 00:33:45 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Wed Dec 12 02:42:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.25 2012/12/12 00:33:45 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.26 2012/12/12 02:42:25 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.25 2012/12/12 00:33:45 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.26 2012/12/12 02:42:25 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -432,7 +432,7 @@ initarm(void *arg)
 
 	arm32_bootmem_init(bootconfig.dram[0].address, MEMSIZE_BYTES,
 	KERNEL_BASE_PHYS);
-	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap, false);
+	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap, true);
 
 	/* we've a specific device_register routine */
 	evbarm_device_register = beagle_device_register;



CVS commit: src/sys/arch/evbarm/beagle

2012-09-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Sep  1 14:54:59 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle_start.S

Log Message:
shrink a little


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/beagle/beagle_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_start.S
diff -u src/sys/arch/evbarm/beagle/beagle_start.S:1.9 src/sys/arch/evbarm/beagle/beagle_start.S:1.10
--- src/sys/arch/evbarm/beagle/beagle_start.S:1.9	Wed Aug 29 18:04:23 2012
+++ src/sys/arch/evbarm/beagle/beagle_start.S	Sat Sep  1 14:54:59 2012
@@ -92,7 +92,7 @@
 #include 
 #include   
 
-RCSID("$NetBSD: beagle_start.S,v 1.9 2012/08/29 18:04:23 matt Exp $")
+RCSID("$NetBSD: beagle_start.S,v 1.10 2012/09/01 14:54:59 matt Exp $")
 
 #define Invalidate_I_cache(reg) \
 	mcr	p15, 0, reg, c7, c5, 0	/* Invalidate Entire I cache */
@@ -144,15 +144,14 @@ _C_LABEL(beagle_start):
 	adr	itable, mmu_init_table
 	ldr	l1sfrm, Ll1_s_frame
 	b	3f
-2:	str	pa, [l1table, va]
-	add	va, va, #4
+2:	str	pa, [l1table, va, lsl #2]
+	add	va, va, #1
 	add	pa, pa, #(L1_S_SIZE)
 	adds	n_sec, n_sec, #-1
 	bhi	2b
 3:	ldmia	itable!, {va,pa,n_sec,attr}
 	/* Convert va to l1 offset:	va = 4 * (va >> L1_S_SHIFT)	*/
-	mov	va, va, LSR #L1_S_SHIFT
-	mov	va, va, LSL #2
+	lsr	va, va, #L1_S_SHIFT
 	/* Convert pa to l1 entry:	pa = (pa & L1_S_FRAME) | attr	*/
 	and	pa, pa, l1sfrm
 	orr	pa, pa, attr



CVS commit: src/sys/arch/evbarm/beagle

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 18:05:42 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle.h beagle_machdep.c

Log Message:
For OMAP3530/TIAM37XX and OMAP4430, read the PLL regisers and calculate the
real CPU clock rate.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/beagle/beagle.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle.h
diff -u src/sys/arch/evbarm/beagle/beagle.h:1.6 src/sys/arch/evbarm/beagle/beagle.h:1.7
--- src/sys/arch/evbarm/beagle/beagle.h:1.6	Thu Aug 23 01:27:25 2012
+++ src/sys/arch/evbarm/beagle/beagle.h	Wed Aug 29 18:05:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle.h,v 1.6 2012/08/23 01:27:25 matt Exp $	*/
+/*	$NetBSD: beagle.h,v 1.7 2012/08/29 18:05:41 matt Exp $	*/
 /*
  * Copyright (c) 2007 Microsoft
  * All rights reserved.
@@ -56,6 +56,8 @@
 #define OMAP_L4_PERIPHERAL_SIZE		OMAP4430_L4_PERIPHERAL_SIZE
 #define OMAP_L4_WAKEUP_BASE		OMAP4430_L4_WAKEUP_BASE
 #define OMAP_L4_WAKEUP_SIZE		OMAP4430_L4_WAKEUP_SIZE
+#define OMAP_L4_ABE_BASE		OMAP4430_L4_ABE_BASE
+#define OMAP_L4_ABE_SIZE		OMAP4430_L4_ABE_SIZE
 #endif
 
 #ifdef TI_AM335X
@@ -80,12 +82,18 @@
  * We devmap IO starting at KERNEL_VM_BASE + KERNEL_VM_SIZE
  */
 #define OMAP_KERNEL_IO_VBASE	(KERNEL_VM_BASE + KERNEL_VM_SIZE)
-#if defined(OMAP_3530) || defined(OMAP_4430)
+#if defined(OMAP_3530)
 #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_WAKEUP_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
 #define OMAP_KERNEL_IO_VEND	(OMAP_L4_WAKEUP_VBASE + OMAP_L4_WAKEUP_SIZE)
 #define CONSADDR_VA	((CONSADDR - OMAP_L4_PERIPHERAL_BASE) + OMAP_L4_PERIPHERAL_VBASE)
+#elif defined(OMAP_4430)
+#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_ABE_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
+#define OMAP_KERNEL_IO_VEND	(OMAP_L4_ABE_VBASE + OMAP_L4_ABE_SIZE)
+#define CONSADDR_VA	((CONSADDR - OMAP_L4_PERIPHERAL_BASE) + OMAP_L4_PERIPHERAL_VBASE)
 #elif defined(TI_AM335X)
 #define OMAP_L4_CORE_VBASE	OMAP_KERNEL_IO_VBASE
 #define OMAP_L4_PERIPHERAL_VBASE	(OMAP_L4_CORE_VBASE + OMAP_L4_CORE_SIZE)

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.17 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.18
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.17	Wed Aug 22 22:18:22 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Wed Aug 29 18:05:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.17 2012/08/22 22:18:22 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.18 2012/08/29 18:05:41 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.17 2012/08/22 22:18:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.18 2012/08/29 18:05:41 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -137,15 +137,17 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include "prcm.h"
 
 #include 
-#include 
 #include 
-#include 
+#include 
+#include 
+#include 
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -161,9 +163,6 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #endif
 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
 
@@ -232,6 +231,12 @@ static void kgdb_port_init(void);
 
 static void setup_real_page_tables(void);
 static void init_clocks(void);
+#if defined(OMAP_3530) || defined(TI_DM37XX)
+static void omap3_cpu_clk(void);
+#endif
+#if defined(OMAP_4430)
+static void omap4_cpu_clk(void);
+#endif
 
 bs_protos(bs_notimpl);
 
@@ -366,9 +371,7 @@ static const struct pmap_devmap devmap[]
 		.pd_prot = VM_PROT_READ|VM_PROT_WRITE,
 		.pd_cache = PTE_NOCACHE
 	},
-#if defined(OMAP_L4_WAKEUP_BASE) \
-&& (OMAP_L4_WAKEUP_BASE < OMAP_L4_CORE_BASE \
-	|| OMAP_L4_CORE_BASE + OMAP_L4_CORE_SIZE <= OMAP_L4_WAKEUP_BASE)
+#if defined(OMAP_L4_WAKEUP_BASE) && defined(OMAP_L4_WAKEUP_VBASE)
 	{
 		/*
 		 * Map all 256KB of the L4 Wakeup area
@@ -394,6 +397,19 @@ static const struct pmap_devmap devmap[]
 		.pd_cache = PTE_NOCACHE
 	},
 #endif
+#ifdef OMAP_L4_ABE_BASE
+	{
+		/*
+		 * Map all of the L4 Fast area
+		 * this gets us GPIO1, WDT2, GPT1, 32K and power/reset regs
+		 */
+		.pd_va = _A(OMAP_L4_ABE_VBASE),
+		.pd_pa = _A(OMAP_L4_ABE_BASE),
+		.pd_size = _S(OMAP_L4_ABE_SIZE),
+		.pd_prot = VM_PROT_READ|VM_PROT_WRITE,
+		.pd_cache = PTE_NOCACHE
+	},
+#endif
 	{0}
 };
 
@@ -458,7 +474,13 @@ initarm(void *arg)
 	 * peripherals and SDRAM.  The temporary first level translation table
 	 * is at the end of SDRAM

CVS commit: src/sys/arch/evbarm/beagle

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 18:04:23 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle_start.S

Log Message:
Use cpsid
Don't add mmu entries for overlapping entries.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/beagle/beagle_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_start.S
diff -u src/sys/arch/evbarm/beagle/beagle_start.S:1.8 src/sys/arch/evbarm/beagle/beagle_start.S:1.9
--- src/sys/arch/evbarm/beagle/beagle_start.S:1.8	Wed Aug 22 22:18:22 2012
+++ src/sys/arch/evbarm/beagle/beagle_start.S	Wed Aug 29 18:04:23 2012
@@ -92,7 +92,7 @@
 #include 
 #include   
 
-RCSID("$NetBSD: beagle_start.S,v 1.8 2012/08/22 22:18:22 matt Exp $")
+RCSID("$NetBSD: beagle_start.S,v 1.9 2012/08/29 18:04:23 matt Exp $")
 
 #define Invalidate_I_cache(reg) \
 	mcr	p15, 0, reg, c7, c5, 0	/* Invalidate Entire I cache */
@@ -107,10 +107,7 @@ RCSID("$NetBSD: beagle_start.S,v 1.8 201
 	.global	_C_LABEL(beagle_start)
 _C_LABEL(beagle_start):
 	/* Move into supervisor mode and disable IRQs/FIQs. */
-	mrs	r0, cpsr
-	bic	r0, r0, #PSR_MODE
-	orr	r0, r0, #(I32_bit | F32_bit | PSR_SVC32_MODE)
-	msr	cpsr, r0
+	cpsid	if, #PSR_SVC32_MODE
 
 	/*
 	 * Set up a preliminary mapping in the MMU to allow us to run
@@ -282,9 +279,7 @@ mmu_init_table:
 		(OMAP_L4_PERIPHERAL_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
 		L1_S_PROTO | L1_S_APv7_KRW)
 
-#if defined(OMAP_L4_WAKEUP_BASE) \
-&& (OMAP_L4_WAKEUP_BASE < OMAP_L4_CORE_BASE \
-	|| OMAP_L4_CORE_BASE + OMAP_L4_CORE_SIZE <= OMAP_L4_WAKEUP_BASE)
+#if defined(OMAP_L4_WAKEUP_BASE) && defined(OMAP_L4_WAKEUP_VBASE)
 	/* Map all 4MB of L4 WAKEUP (so console will work) */
 	MMU_INIT(OMAP_L4_WAKEUP_VBASE, OMAP_L4_WAKEUP_BASE,
 		(OMAP_L4_WAKEUP_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,



CVS commit: src/sys/arch/evbarm/beagle

2012-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 20 12:40:40 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle.h beagle_machdep.c beagle_start.S

Log Message:
Add initial support for BEAGLEBONE and PANDABOARD.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/beagle/beagle.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/beagle/beagle_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle.h
diff -u src/sys/arch/evbarm/beagle/beagle.h:1.3 src/sys/arch/evbarm/beagle/beagle.h:1.4
--- src/sys/arch/evbarm/beagle/beagle.h:1.3	Wed Jun 16 22:06:54 2010
+++ src/sys/arch/evbarm/beagle/beagle.h	Mon Aug 20 12:40:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle.h,v 1.3 2010/06/16 22:06:54 jmcneill Exp $	*/
+/*	$NetBSD: beagle.h,v 1.4 2012/08/20 12:40:40 matt Exp $	*/
 /*
  * Copyright (c) 2007 Microsoft
  * All rights reserved.
@@ -34,21 +34,58 @@
 #include 
 
 /*
- * Kernel VM space: 576MB at KERNEL_VM_BASE
+ * Memory will mapped 1:1 VA:PA starting at 0x8000
+ * Kernel VM space: 512MB at KERNEL_VM_BASE
  */
-#define	KERNEL_VM_BASE		((KERNEL_BASE + 0x0100) & ~(0x40-1))
-#define KERNEL_VM_SIZE		0x2400
+#define KERNEL_VM_BASE		0xc000
+#define KERNEL_VM_SIZE		0x2000
+
+#ifdef OMAP_3530
+#define OMAP_L4_CORE_BASE		OMAP3530_L4_CORE_BASE
+#define OMAP_L4_CORE_SIZE		OMAP3530_L4_CORE_SIZE
+#define OMAP_L4_PERIPHERAL_BASE		OMAP3530_L4_PERIPHERAL_BASE
+#define OMAP_L4_PERIPHERAL_SIZE		OMAP3530_L4_PERIPHERAL_SIZE
+#define OMAP_L4_WAKEUP_BASE		OMAP3530_L4_WAKEUP_BASE
+#define OMAP_L4_WAKEUP_SIZE		OMAP3530_L4_WAKEUP_SIZE
+#endif
+
+#ifdef OMAP_4430
+#define OMAP_L4_CORE_BASE		OMAP4430_L4_CORE_BASE
+#define OMAP_L4_CORE_SIZE		OMAP4430_L4_CORE_SIZE
+#define OMAP_L4_PERIPHERAL_BASE		OMAP4430_L4_PERIPHERAL_BASE
+#define OMAP_L4_PERIPHERAL_SIZE		OMAP4430_L4_PERIPHERAL_SIZE
+#define OMAP_L4_WAKEUP_BASE		OMAP4430_L4_WAKEUP_BASE
+#define OMAP_L4_WAKEUP_SIZE		OMAP4430_L4_WAKEUP_SIZE
+#endif
+
+#ifdef TI_AM335X
+#define OMAP_L4_CORE_BASE		TI_AM335X_L4_WAKEUP_BASE
+#define OMAP_L4_CORE_SIZE		TI_AM335X_L4_WAKEUP_SIZE
+#define OMAP_L4_PERIPHERAL_BASE		TI_AM335X_L4_PERIPHERAL_BASE
+#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
+#endif
 
 /*
  * We devmap IO starting at KERNEL_VM_BASE + KERNEL_VM_SIZE
  */
-#define	OMAP3530_KERNEL_IO_VBASE	(KERNEL_VM_BASE + KERNEL_VM_SIZE)
-#define	OMAP3530_L4_CORE_VBASE		OMAP3530_KERNEL_IO_VBASE
-#define	OMAP3530_L4_PERIPHERAL_VBASE	(OMAP3530_L4_CORE_VBASE   + OMAP3530_L4_CORE_SIZE)
-#define	OMAP3530_L4_WAKEUP_VBASE	(OMAP3530_L4_PERIPHERAL_VBASE + OMAP3530_L4_PERIPHERAL_SIZE)
-#define	OMAP3530_KERNEL_IO_VEND		(OMAP3530_L4_WAKEUP_VBASE + OMAP3530_L4_WAKEUP_SIZE)
-
-#define CONSADDR_VA	((CONSADDR - OMAP3530_L4_PERIPHERAL_BASE) + OMAP3530_L4_PERIPHERAL_VBASE)
+#define OMAP_KERNEL_IO_VBASE	(KERNEL_VM_BASE + KERNEL_VM_SIZE)
+#if defined(OMAP_3530) || defined(OMAP_4430)
+#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_WAKEUP_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
+#define OMAP_KERNEL_IO_VEND	(OMAP_L4_WAKEUP_VBASE + OMAP_L4_WAKEUP_SIZE)
+#define CONSADDR_VA	((CONSADDR - OMAP_L4_PERIPHERAL_BASE) + OMAP_L4_PERIPHERAL_VBASE)
+#elif defined(TI_AM335X)
+#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 CONSADDR_VA	((CONSADDR - OMAP_L4_CORE_BASE) + OMAP_L4_CORE_VBASE)
+#else
+#error unknown OMAP variant
+#endif
 
 
 #endif /* _EVBARM_BEAGLE_BEAGLE_H */

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.15 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.16
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.15	Thu Aug 16 18:26:22 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon Aug 20 12:40:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.15 2012/08/16 18:26:22 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.16 2012/08/20 12:40:40 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.15 2012/08/16 18:26:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.16 2012/08/20 12:40:40 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -348,9 +348,9 @@ static const struct pmap_devmap devmap[]
 		 * this gets us the ICU, I2C, USB, GPT[10-11], MMC, McSPI
 		 * UART[12], clock manager, sDMA

CVS commit: src/sys/arch/evbarm/beagle

2012-08-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 16 18:26:22 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
Remove *_STACK_SIZE and cpu_reset_address definitons.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.14 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.15
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.14	Sun Jul 29 00:07:07 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Thu Aug 16 18:26:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.14 2012/07/29 00:07:07 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.15 2012/08/16 18:26:22 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.14 2012/07/29 00:07:07 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.15 2012/08/16 18:26:22 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -178,24 +178,6 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 
 #include "omapwdt32k.h"
 
-/*
- * Address to call from cpu_reset() to reset the machine.
- * This is machine architecture dependent as it varies depending
- * on where the ROM appears when you turn the MMU off.
- */
-
-u_int cpu_reset_address = 0;
-
-/* Define various stack sizes in pages */
-#define IRQ_STACK_SIZE	1
-#define FIQ_STACK_SIZE	1
-#define ABT_STACK_SIZE	1
-#ifdef IPKDB
-#define UND_STACK_SIZE	2
-#else
-#define UND_STACK_SIZE	1
-#endif
-
 BootConfig bootconfig;		/* Boot config storage */
 char *boot_args = NULL;
 char *boot_file = NULL;



CVS commit: src/sys/arch/evbarm/beagle

2010-08-28 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Sat Aug 28 13:42:12 UTC 2010

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
include prcm.h for NPRCM


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/beagle/beagle_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.9 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.10
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.9	Sat Aug 28 13:02:32 2010
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Sat Aug 28 13:42:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.9 2010/08/28 13:02:32 ahoka Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.10 2010/08/28 13:42:12 ahoka Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.9 2010/08/28 13:02:32 ahoka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.10 2010/08/28 13:42:12 ahoka Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -134,6 +134,7 @@
 #include "opt_md.h"
 #include "opt_com.h"
 #include "opt_omap.h"
+#include "prcm.h"
 #include "md.h"
 
 #include