CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2015-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec 10 23:44:11 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_mmc.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1043):
sys/arch/arm/allwinner/awin_mmc.c: revision 1.23 via patch
Wait 20ms for the PLL to stabilize after enabling it.
Fixes occasional bogus size report for my SD card.


To generate a diff of this commit:
cvs rdiff -u -r1.3.10.4 -r1.3.10.5 src/sys/arch/arm/allwinner/awin_mmc.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/arm/allwinner/awin_mmc.c
diff -u src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.4 src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.5
--- src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.4	Sat Nov  7 16:15:03 2015
+++ src/sys/arch/arm/allwinner/awin_mmc.c	Thu Dec 10 23:44:11 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_mmc.c,v 1.3.10.4 2015/11/07 16:15:03 riz Exp $ */
+/* $NetBSD: awin_mmc.c,v 1.3.10.5 2015/12/10 23:44:11 snj Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.3.10.4 2015/11/07 16:15:03 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.3.10.5 2015/12/10 23:44:11 snj Exp $");
 
 #include 
 #include 
@@ -557,6 +557,7 @@ awin_mmc_bus_clock(sdmmc_chipset_handle_
 		clk |= __SHIFTIN(sdly, AWIN_SD_CLK_PHASE_CTR);
 		clk |= AWIN_PLL_CFG_ENABLE;
 		bus_space_write_4(sc->sc_bst, sc->sc_clk_bsh, 0, clk);
+		delay(2);
 
 		clkcr |= AWIN_MMC_CLKCR_CARDCLKON;
 		MMC_WRITE(sc, AWIN_MMC_CLKCR, clkcr);



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2015-11-07 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Nov  7 16:15:03 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_mmc.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1006):
sys/arch/arm/allwinner/awin_mmc.c: revision 1.22
Avoid a divide by 0 when unplugging a sd card.


To generate a diff of this commit:
cvs rdiff -u -r1.3.10.3 -r1.3.10.4 src/sys/arch/arm/allwinner/awin_mmc.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/arm/allwinner/awin_mmc.c
diff -u src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.3 src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.4
--- src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.3	Thu Dec  4 11:08:38 2014
+++ src/sys/arch/arm/allwinner/awin_mmc.c	Sat Nov  7 16:15:03 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_mmc.c,v 1.3.10.3 2014/12/04 11:08:38 martin Exp $ */
+/* $NetBSD: awin_mmc.c,v 1.3.10.4 2015/11/07 16:15:03 riz Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.3.10.3 2014/12/04 11:08:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.3.10.4 2015/11/07 16:15:03 riz Exp $");
 
 #include 
 #include 
@@ -510,7 +510,10 @@ awin_mmc_bus_clock(sdmmc_chipset_handle_
 		sdly = awin_chip_id() == AWIN_CHIP_ID_A31 ? 0 : 7;
 		clksrc = AWIN_SD_CLK_SRC_SEL_OSC24M;
 		n = 2;
-		m = ((osc24m_freq / (1 << n)) / freq) - 1;
+		if (freq > 0)
+			m = ((osc24m_freq / (1 << n)) / freq) - 1;
+		else
+			m = 15;
 	} else if (freq <= 25000) {
 		odly = 0;
 		sdly = 5;



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2015-11-06 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Nov  7 01:53:43 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_gpio.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1004):
sys/arch/arm/allwinner/awin_gpio.c: revision 1.19
sys/arch/arm/allwinner/awin_gpio.c: revision 1.20
Print the port name when gpio(4) attaches, makes it much easier to find
what port is connected to what gpio instance:
gpio0 at awingpio0: 18 pins
gpio0: port B
gpio1 at awingpio0: 25 pins
gpio1: port C
gpio2 at awingpio0: 28 pins
gpio2: port D
gpio3 at awingpio0: 12 pins
gpio3: port E
gpio4 at awingpio0: 12 pins
gpio4: port G
gpio5 at awingpio0: 28 pins
gpio5: port H
gpio6 at awingpio0: 22 pins
gpio6: port I
Based on suggestion from jared, redo previous using a specific print callback
to avoid the extra line. Now output looks like:
gpio0 at awingpio0 port B: 18 pins
gpio1 at awingpio0 port C: 25 pins
gpio2 at awingpio0 port D: 28 pins
gpio3 at awingpio0 port E: 12 pins
gpio4 at awingpio0 port G: 12 pins
gpio5 at awingpio0 port H: 28 pins
gpio6 at awingpio0 port I: 22 pins


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.5 -r1.8.10.6 src/sys/arch/arm/allwinner/awin_gpio.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/arm/allwinner/awin_gpio.c
diff -u src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.5 src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.6
--- src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.5	Sun Mar 15 22:59:39 2015
+++ src/sys/arch/arm/allwinner/awin_gpio.c	Sat Nov  7 01:53:43 2015
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.5 2015/03/15 22:59:39 snj Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.6 2015/11/07 01:53:43 riz Exp $");
 
 #include 
 #include 
@@ -81,6 +81,7 @@ static struct awin_gpio_pin_group {
 	bus_space_handle_t grp_bsh;
 	struct awin_gpio_pin_cfg grp_cfg;
 	struct gpio_chipset_tag grp_gc_tag;
+	const int grp_index;
 	const char grp_nc_name[6];
 } pin_groups[] = {
 	[0] = {
@@ -92,6 +93,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_write = awin_gpio_pin_write,
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
+		.grp_index = 0,
 		.grp_nc_name = "nc-pa",
 	},
 	[1] = {
@@ -103,6 +105,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_write = awin_gpio_pin_write,
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
+		.grp_index = 1,
 		.grp_nc_name = "nc-pb",
 	},
 	[2] = {
@@ -114,6 +117,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_write = awin_gpio_pin_write,
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
+		.grp_index = 2,
 		.grp_nc_name = "nc-pc",
 	},
 	[3] = {
@@ -125,6 +129,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_write = awin_gpio_pin_write,
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
+		.grp_index = 3,
 		.grp_nc_name = "nc-pd",
 	},
 	[4] = {
@@ -136,6 +141,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_write = awin_gpio_pin_write,
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
+		.grp_index = 4,
 		.grp_nc_name = "nc-pe",
 	},
 	[5] = {
@@ -147,6 +153,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_write = awin_gpio_pin_write,
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
+		.grp_index = 5,
 		.grp_nc_name = "nc-pf",
 	},
 	[6] = {
@@ -158,6 +165,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_write = awin_gpio_pin_write,
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
+		.grp_index = 6,
 		.grp_nc_name = "nc-pg",
 	},
 	[7] = {
@@ -169,6 +177,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_write = awin_gpio_pin_write,
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
+		.grp_index = 7,
 		.grp_nc_name = "nc-ph",
 	},
 	[8] = {
@@ -180,6 +189,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_write = awin_gpio_pin_write,
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
+		.grp_index = 8,
 		.grp_nc_name = "nc-pi",
 	},
 	[9] = {
@@ -191,6 +201,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
 		.grp_pin_mask = 0,
+		.grp_index = 9,
 		.grp_nc_name = "nc-pj",
 	},
 	[10] = {
@@ -202,6 +213,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
 		.grp_pin_mask = 0,
+		.grp_index = 10,
 		.grp_nc_name = "nc-pk",
 	},
 	[11] = {
@@ -213,6 +225,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
 		.grp_pin_mask = 0,
+		.grp_index = 11,
 		.grp_nc_name = "nc-pl",
 	},
 	[12] = {
@@ -224,6 +237,7 @@ static struct awin_gpio_pin_group {
 			.gp_pin_ctl = awin_gpio_pin_ctl,
 		},
 		.grp_pin_mask = 0,
+		.grp_index = 12,
 		.grp_nc_name = "nc-pm",
 	},
 };
@@ -257,6 +271,20 @@ awin_gpio_match(device_t parent, cfdata_
 }
 
 #if NGPIO > 0
+static int
+awin_gpio_cfprint(void *priv, const char *pnp)
+{
+	struct gpiobus_attach_args *gba = priv;
+	struct awin_gpio_pin_group *grp = gba->gba_gc->gp_cookie;
+
+	if (pnp)
+		aprint_normal("gpiobus at %s", pnp);
+
+	aprint_normal(

CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2015-03-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 15 22:59:39 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_eth.c awin_gige.c
awin_gpio.c awin_usb.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #595):
sys/arch/arm/allwinner/awin_eth.c: revision 1.8
sys/arch/arm/allwinner/awin_gige.c: revision 1.22
sys/arch/arm/allwinner/awin_gpio.c: revision 1.17
sys/arch/arm/allwinner/awin_usb.c: revision 1.20
sprinkle __diagused to fix "no options DIAGNOSTIC" build


To generate a diff of this commit:
cvs rdiff -u -r1.5.2.1 -r1.5.2.2 src/sys/arch/arm/allwinner/awin_eth.c
cvs rdiff -u -r1.4.10.2 -r1.4.10.3 src/sys/arch/arm/allwinner/awin_gige.c
cvs rdiff -u -r1.8.10.4 -r1.8.10.5 src/sys/arch/arm/allwinner/awin_gpio.c
cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/arch/arm/allwinner/awin_usb.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/arm/allwinner/awin_eth.c
diff -u src/sys/arch/arm/allwinner/awin_eth.c:1.5.2.1 src/sys/arch/arm/allwinner/awin_eth.c:1.5.2.2
--- src/sys/arch/arm/allwinner/awin_eth.c:1.5.2.1	Sun Nov  9 14:42:33 2014
+++ src/sys/arch/arm/allwinner/awin_eth.c	Sun Mar 15 22:59:39 2015
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_eth.c,v 1.5.2.1 2014/11/09 14:42:33 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_eth.c,v 1.5.2.2 2015/03/15 22:59:39 snj Exp $");
 
 #include 
 #include 
@@ -141,10 +141,8 @@ awin_eth_clear_set(struct awin_eth_softc
 static int
 awin_eth_match(device_t parent, cfdata_t cf, void *aux)
 {
-	struct awinio_attach_args * const aio = aux;
-#ifdef DIAGNOSTIC
-	const struct awin_locators * const loc = &aio->aio_loc;
-#endif
+	struct awinio_attach_args * const aio __diagused = aux;
+	const struct awin_locators * const loc __diagused = &aio->aio_loc;
 	const struct awin_gpio_pinset * const pinset =
 	&awin_eth_pinsets[cf->cf_flags & 1];
 

Index: src/sys/arch/arm/allwinner/awin_gige.c
diff -u src/sys/arch/arm/allwinner/awin_gige.c:1.4.10.2 src/sys/arch/arm/allwinner/awin_gige.c:1.4.10.3
--- src/sys/arch/arm/allwinner/awin_gige.c:1.4.10.2	Tue Nov 25 08:03:06 2014
+++ src/sys/arch/arm/allwinner/awin_gige.c	Sun Mar 15 22:59:39 2015
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_gige.c,v 1.4.10.2 2014/11/25 08:03:06 snj Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gige.c,v 1.4.10.3 2015/03/15 22:59:39 snj Exp $");
 
 #include 
 #include 
@@ -76,13 +76,11 @@ CFATTACH_DECL_NEW(awin_gige, sizeof(stru
 static int
 awin_gige_match(device_t parent, cfdata_t cf, void *aux)
 {
-	struct awinio_attach_args * const aio = aux;
 	const struct awin_gpio_pinset *pinset =
 	awin_chip_id() == AWIN_CHIP_ID_A31 ?
 	&awin_gige_gpio_pinset_a31 : &awin_gige_gpio_pinset;
-#ifdef DIAGNOSTIC
-	const struct awin_locators * const loc = &aio->aio_loc;
-#endif
+	struct awinio_attach_args * const aio __diagused = aux;
+	const struct awin_locators * const loc __diagused = &aio->aio_loc;
 	if (cf->cf_flags & 1)
 		return 0;
 

Index: src/sys/arch/arm/allwinner/awin_gpio.c
diff -u src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.4 src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.5
--- src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.4	Tue Nov 25 08:03:06 2014
+++ src/sys/arch/arm/allwinner/awin_gpio.c	Sun Mar 15 22:59:39 2015
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.4 2014/11/25 08:03:06 snj Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.5 2015/03/15 22:59:39 snj Exp $");
 
 #include 
 #include 
@@ -243,8 +243,8 @@ CFATTACH_DECL_NEW(awin_gpio, sizeof(stru
 static int
 awin_gpio_match(device_t parent, cfdata_t cf, void *aux)
 {
-	struct awinio_attach_args * const aio = aux;
-	const struct awin_locators * const loc = &aio->aio_loc;
+	struct awinio_attach_args * const aio __diagused = aux;
+	const struct awin_locators * const loc __diagused = &aio->aio_loc;
 
 	KASSERT(!strcmp(cf->cf_name, loc->loc_name));
 	KASSERT(loc->loc_port == AWINIOCF_PORT_DEFAULT);

Index: src/sys/arch/arm/allwinner/awin_usb.c
diff -u src/sys/arch/arm/allwinner/awin_usb.c:1.12.2.2 src/sys/arch/arm/allwinner/awin_usb.c:1.12.2.3
--- src/sys/arch/arm/allwinner/awin_usb.c:1.12.2.2	Thu Nov 20 10:05:06 2014
+++ src/sys/arch/arm/allwinner/awin_usb.c	Sun Mar 15 22:59:39 2015
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_usb.c,v 1.12.2.2 2014/11/20 10:05:06 snj Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_usb.c,v 1.12.2.3 2015/03/15 22:59:39 snj Exp $");
 
 #include 
 #include 
@@ -354,8 +354,8 @@ static const uint32_t awinusb_usb_ahb_re
 int
 awinusb_match(device_t parent, cfdata_t cf, void *aux)
 {
-	struct awinio_attach_args * const aio = aux;
-	const struct awin_locators * const loc = &aio->aio_loc;
+	struct awinio_attach_args * const aio __diagused = aux;
+	const struct awin_locators * const loc __diagused = &aio->aio_loc;
 

CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2015-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan  2 20:32:02 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_reg.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #367):
sys/arch/arm/allwinner/awin_reg.h: revision 1.74
RCSID police


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.10 -r1.14.2.11 src/sys/arch/arm/allwinner/awin_reg.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/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.10 src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.11
--- src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.10	Tue Dec  9 19:21:09 2014
+++ src/sys/arch/arm/allwinner/awin_reg.h	Fri Jan  2 20:32:02 2015
@@ -1,4 +1,5 @@
-/* $NetBSD */
+/* $NetBSD: awin_reg.h,v 1.14.2.11 2015/01/02 20:32:02 martin Exp $ */
+
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-12-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  9 19:21:09 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_debe.c awin_reg.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #301):
sys/arch/arm/allwinner/awin_reg.h: revision 1.72
sys/arch/arm/allwinner/awin_debe.c: revision 1.12
Set BGRA pixel sequence if __ARMEB__ is defined.


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.5 -r1.6.2.6 src/sys/arch/arm/allwinner/awin_debe.c
cvs rdiff -u -r1.14.2.9 -r1.14.2.10 src/sys/arch/arm/allwinner/awin_reg.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/arm/allwinner/awin_debe.c
diff -u src/sys/arch/arm/allwinner/awin_debe.c:1.6.2.5 src/sys/arch/arm/allwinner/awin_debe.c:1.6.2.6
--- src/sys/arch/arm/allwinner/awin_debe.c:1.6.2.5	Mon Dec  1 13:23:49 2014
+++ src/sys/arch/arm/allwinner/awin_debe.c	Tue Dec  9 19:21:09 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_debe.c,v 1.6.2.5 2014/12/01 13:23:49 martin Exp $ */
+/* $NetBSD: awin_debe.c,v 1.6.2.6 2014/12/09 19:21:09 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -36,7 +36,7 @@
 #define AWIN_DEBE_CURMAX	64
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.6.2.5 2014/12/01 13:23:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.6.2.6 2014/12/09 19:21:09 martin Exp $");
 
 #include 
 #include 
@@ -473,6 +473,13 @@ awin_debe_set_videomode(const struct vid
  AWIN_DEBE_ATTCTL1_LAY_FBFMT);
 		val &= ~AWIN_DEBE_ATTCTL1_LAY_BRSWAPEN;
 		val &= ~AWIN_DEBE_ATTCTL1_LAY_FBPS;
+#if __ARMEB__
+		val |= __SHIFTIN(AWIN_DEBE_ATTCTL1_LAY_FBPS_32BPP_BGRA,
+ AWIN_DEBE_ATTCTL1_LAY_FBPS);
+#else
+		val |= __SHIFTIN(AWIN_DEBE_ATTCTL1_LAY_FBPS_32BPP_ARGB,
+ AWIN_DEBE_ATTCTL1_LAY_FBPS);
+#endif
 		DEBE_WRITE(sc, AWIN_DEBE_ATTCTL1_REG, val);
 
 		val = DEBE_READ(sc, AWIN_DEBE_MODCTL_REG);

Index: src/sys/arch/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.9 src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.10
--- src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.9	Thu Dec  4 11:08:38 2014
+++ src/sys/arch/arm/allwinner/awin_reg.h	Tue Dec  9 19:21:09 2014
@@ -1710,6 +1710,8 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_DEBE_ATTCTL1_LAY_FBFMT_RGBA	13
 #define AWIN_DEBE_ATTCTL1_LAY_BRSWAPEN	__BIT(2)
 #define AWIN_DEBE_ATTCTL1_LAY_FBPS	__BITS(1,0)
+#define AWIN_DEBE_ATTCTL1_LAY_FBPS_32BPP_ARGB	0
+#define AWIN_DEBE_ATTCTL1_LAY_FBPS_32BPP_BGRA	2
 
 #define AWIN_DEBE_REGBUFFCTL_REGAUTOLOAD_DIS __BIT(1)
 #define AWIN_DEBE_REGBUFFCTL_REGLOADCTL	__BIT(0)



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-12-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec  4 11:08:38 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_board.c awin_mmc.c
awin_reg.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #294):
sys/arch/arm/allwinner/awin_mmc.c: revision 1.16
sys/arch/arm/allwinner/awin_board.c: revision 1.29
sys/arch/arm/allwinner/awin_reg.h: revision 1.55,1.57
Add mixer processor regs.
-
Fix some mixer processor definitions, add A31 PLL6 cfg lock bit and
some extra SD CLK bits for A31, when enabling pll, wait for pll to
become stable before returning
-
Clock fixes:
 - Don't rely on U-boot to enable AHB gating
 - Instead of always running at 100MHz (!), calculate proper clk dividers.
 - Replace PLL6 parsing code with a call to awin_pll6_get_rate()


To generate a diff of this commit:
cvs rdiff -u -r1.14.6.3 -r1.14.6.4 src/sys/arch/arm/allwinner/awin_board.c
cvs rdiff -u -r1.3.10.2 -r1.3.10.3 src/sys/arch/arm/allwinner/awin_mmc.c
cvs rdiff -u -r1.14.2.8 -r1.14.2.9 src/sys/arch/arm/allwinner/awin_reg.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/arm/allwinner/awin_board.c
diff -u src/sys/arch/arm/allwinner/awin_board.c:1.14.6.3 src/sys/arch/arm/allwinner/awin_board.c:1.14.6.4
--- src/sys/arch/arm/allwinner/awin_board.c:1.14.6.3	Fri Nov 14 13:37:39 2014
+++ src/sys/arch/arm/allwinner/awin_board.c	Thu Dec  4 11:08:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_board.c,v 1.14.6.3 2014/11/14 13:37:39 martin Exp $	*/
+/*	$NetBSD: awin_board.c,v 1.14.6.4 2014/12/04 11:08:38 martin Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_board.c,v 1.14.6.3 2014/11/14 13:37:39 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_board.c,v 1.14.6.4 2014/12/04 11:08:38 martin Exp $");
 
 #include 
 #include 
@@ -345,6 +345,13 @@ awin_pll6_enable(void)
 	if (ncfg != ocfg) {
 		bus_space_write_4(bst, bsh,
 		AWIN_CCM_OFFSET + AWIN_PLL6_CFG_REG, ncfg);
+
+		if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+			do {
+ncfg = bus_space_read_4(bst, bsh,
+AWIN_CCM_OFFSET + AWIN_PLL6_CFG_REG);
+			} while ((ncfg & AWIN_A31_PLL6_CFG_LOCK) == 0);
+		}
 	}
 #if 0
 	printf(" [pll6=%#x->%#x:n=%ju k=%ju m=%ju] ",
@@ -390,6 +397,13 @@ awin_pll2_enable(void)
 	if (ncfg != ocfg) {
 		bus_space_write_4(bst, bsh,
 		AWIN_CCM_OFFSET + AWIN_PLL2_CFG_REG, ncfg);
+
+		if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+			do {
+ncfg = bus_space_read_4(bst, bsh,
+AWIN_CCM_OFFSET + AWIN_PLL2_CFG_REG);
+			} while ((ncfg & AWIN_A31_PLL2_CFG_LOCK) == 0);
+		}
 	}
 }
 
@@ -459,6 +473,13 @@ awin_pll7_enable(void)
 	if (ncfg != ocfg) {
 		bus_space_write_4(bst, bsh,
 		AWIN_CCM_OFFSET + AWIN_PLL7_CFG_REG, ncfg);
+
+		if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+			do {
+ncfg = bus_space_read_4(bst, bsh,
+AWIN_CCM_OFFSET + AWIN_PLL7_CFG_REG);
+			} while ((ncfg & AWIN_A31_PLL7_CFG_LOCK) == 0);
+		}
 	}
 }
 

Index: src/sys/arch/arm/allwinner/awin_mmc.c
diff -u src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.2 src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.3
--- src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.2	Sun Nov  9 14:42:33 2014
+++ src/sys/arch/arm/allwinner/awin_mmc.c	Thu Dec  4 11:08:38 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_mmc.c,v 1.3.10.2 2014/11/09 14:42:33 martin Exp $ */
+/* $NetBSD: awin_mmc.c,v 1.3.10.3 2014/12/04 11:08:38 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.3.10.2 2014/11/09 14:42:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.3.10.3 2014/12/04 11:08:38 martin Exp $");
 
 #include 
 #include 
@@ -97,13 +97,10 @@ struct awin_mmc_softc {
 	kcondvar_t sc_intr_cv;
 	kcondvar_t sc_idst_cv;
 
-	int sc_mmc_number;
 	int sc_mmc_width;
 	int sc_mmc_present;
 
 	device_t sc_sdmmc_dev;
-	unsigned int sc_pll_freq;
-	unsigned int sc_mod_clk;
 
 	uint32_t sc_fifo_reg;
 
@@ -151,53 +148,6 @@ awin_mmc_match(device_t parent, cfdata_t
 	return 1;
 }
 
-static void
-awin_mmc_probe_clocks(struct awin_mmc_softc *sc, struct awinio_attach_args *aio)
-{
-	uint32_t val, freq;
-	int n, k, p, div;
-
-	val = bus_space_read_4(aio->aio_core_bst, aio->aio_ccm_bsh,
-	AWIN_PLL6_CFG_REG);
-
-	if (awin_chip_id() == AWIN_CHIP_ID_A31) {
-		n = ((val >> 8) & 0x1f) + 1;
-		k = ((val >> 4) & 3) + 1;
-		freq = 2400 * n * k / 2;
-#ifdef AWIN_MMC_DEBUG
-		device_printf(sc->sc_dev, "n = %d k = %d freq = %u\n",
-		n, k, freq);
-#endif
-	} else {
-		n = (val >> 8) & 0x1f;
-		k = ((val >> 4) & 3) + 1;
-		p = 1 << ((val >> 16) & 3);
-		freq = 2400 * n * k / p;
-#ifdef AWIN_MMC_DEBUG
-		device_printf(sc->sc_dev, "n = %d k = %d p = %d freq = %u\n",
-		n, k, p, freq);
-#endif
-	}
-
-	sc->sc_pll_freq = freq;
-	div

CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-12-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  1 13:30:37 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_fb.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #285):
sys/arch/arm/allwinner/awin_fb.c: revision 1.8
make the full amount of reserved video memory available to userland


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.5 -r1.4.2.6 src/sys/arch/arm/allwinner/awin_fb.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/arm/allwinner/awin_fb.c
diff -u src/sys/arch/arm/allwinner/awin_fb.c:1.4.2.5 src/sys/arch/arm/allwinner/awin_fb.c:1.4.2.6
--- src/sys/arch/arm/allwinner/awin_fb.c:1.4.2.5	Mon Dec  1 13:23:49 2014
+++ src/sys/arch/arm/allwinner/awin_fb.c	Mon Dec  1 13:30:37 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_fb.c,v 1.4.2.5 2014/12/01 13:23:49 martin Exp $ */
+/* $NetBSD: awin_fb.c,v 1.4.2.6 2014/12/01 13:30:37 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_fb.c,v 1.4.2.5 2014/12/01 13:23:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_fb.c,v 1.4.2.6 2014/12/01 13:30:37 martin Exp $");
 
 #include 
 #include 
@@ -143,8 +143,10 @@ awin_fb_ioctl(void *v, void *vs, u_long 
 		fbi = data;
 		ri = &sc->sc_gen.vd.active->scr_ri;
 		error = wsdisplayio_get_fbinfo(ri, fbi);
-		if (error == 0)
+		if (error == 0) {
 			fbi->fbi_flags |= WSFB_VRAM_IS_RAM;
+			fbi->fbi_fbsize = sc->sc_dmasegs[0].ds_len;
+		}
 		return error;
 	case WSDISPLAYIO_SVIDEO:
 	case WSDISPLAYIO_GVIDEO:
@@ -163,7 +165,7 @@ awin_fb_mmap(void *v, void *vs, off_t of
 {
 	struct awin_fb_softc *sc = v;
 
-	if (off < 0 || off >= sc->sc_gen.sc_fbsize)
+	if (off < 0 || off >= sc->sc_dmasegs[0].ds_len)
 		return -1;
 
 	return bus_dmamem_mmap(sc->sc_dmat, sc->sc_dmasegs, sc->sc_ndmasegs,



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-12-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  1 13:23:49 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_debe.c awin_fb.c awin_reg.h
Added Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_mp.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #284):
sys/arch/arm/allwinner/awin_reg.h: revision 1.56
sys/arch/arm/allwinner/awin_debe.c: revision 1.9-1.10
sys/arch/arm/allwinner/awin_mp.c: revision 1.1
sys/arch/arm/allwinner/awin_fb.c: revision 1.7
hardware cursor support
hide the hw cursor when blanking the screen


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.4 -r1.6.2.5 src/sys/arch/arm/allwinner/awin_debe.c
cvs rdiff -u -r1.4.2.4 -r1.4.2.5 src/sys/arch/arm/allwinner/awin_fb.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/allwinner/awin_mp.c
cvs rdiff -u -r1.14.2.7 -r1.14.2.8 src/sys/arch/arm/allwinner/awin_reg.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/arm/allwinner/awin_debe.c
diff -u src/sys/arch/arm/allwinner/awin_debe.c:1.6.2.4 src/sys/arch/arm/allwinner/awin_debe.c:1.6.2.5
--- src/sys/arch/arm/allwinner/awin_debe.c:1.6.2.4	Sat Nov 15 11:31:40 2014
+++ src/sys/arch/arm/allwinner/awin_debe.c	Mon Dec  1 13:23:49 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_debe.c,v 1.6.2.4 2014/11/15 11:31:40 martin Exp $ */
+/* $NetBSD: awin_debe.c,v 1.6.2.5 2014/12/01 13:23:49 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -33,8 +33,10 @@
 #define AWIN_DEBE_VIDEOMEM	(16 * 1024 * 1024)
 #endif
 
+#define AWIN_DEBE_CURMAX	64
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.6.2.4 2014/11/15 11:31:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.6.2.5 2014/12/01 13:23:49 martin Exp $");
 
 #include 
 #include 
@@ -66,6 +68,12 @@ struct awin_debe_softc {
 	void *sc_dmap;
 
 	uint16_t sc_margin;
+
+	bool sc_cursor_enable;
+	int sc_cursor_x, sc_cursor_y;
+	int sc_hot_x, sc_hot_y;
+	uint8_t sc_cursor_bitmap[8 * AWIN_DEBE_CURMAX];
+	uint8_t sc_cursor_mask[8 * AWIN_DEBE_CURMAX];
 };
 
 #define DEBE_READ(sc, reg) \
@@ -80,6 +88,10 @@ static int	awin_debe_alloc_videomem(stru
 static void	awin_debe_setup_fbdev(struct awin_debe_softc *,
   const struct videomode *);
 
+static int	awin_debe_set_curpos(struct awin_debe_softc *, int, int);
+static int	awin_debe_set_cursor(struct awin_debe_softc *,
+ struct wsdisplay_cursor *);
+
 CFATTACH_DECL_NEW(awin_debe, sizeof(struct awin_debe_softc),
 	awin_debe_match, awin_debe_attach, NULL, NULL);
 
@@ -177,6 +189,8 @@ awin_debe_attach(device_t parent, device
 
 	DEBE_WRITE(sc, AWIN_DEBE_MODCTL_REG, AWIN_DEBE_MODCTL_EN);
 
+	DEBE_WRITE(sc, AWIN_DEBE_HWC_PALETTE_TABLE, 0);
+
 	error = awin_debe_alloc_videomem(sc);
 	if (error) {
 		aprint_error_dev(sc->sc_dev,
@@ -255,6 +269,125 @@ awin_debe_setup_fbdev(struct awin_debe_s
 #endif
 }
 
+static int
+awin_debe_set_curpos(struct awin_debe_softc *sc, int x, int y)
+{
+	int xx, yy;
+	u_int yoff, xoff;
+
+	xoff = yoff = 0;
+	xx = x - sc->sc_hot_x + sc->sc_margin;
+	yy = y - sc->sc_hot_y + sc->sc_margin;
+	if (xx < 0) {
+		xoff -= xx;
+		xx = 0;
+	}
+	if (yy < 0) {
+		yoff -= yy;
+		yy = 0;
+	}
+
+	DEBE_WRITE(sc, AWIN_DEBE_HWCCTL_REG,
+	__SHIFTIN(yy, AWIN_DEBE_HWCCTL_YCOOR) |
+	__SHIFTIN(xx, AWIN_DEBE_HWCCTL_XCOOR));
+	DEBE_WRITE(sc, AWIN_DEBE_HWCFBCTL_REG,
+#if AWIN_DEBE_CURMAX == 32
+	__SHIFTIN(AWIN_DEBE_HWCFBCTL_YSIZE_32, AWIN_DEBE_HWCFBCTL_YSIZE) |
+	__SHIFTIN(AWIN_DEBE_HWCFBCTL_XSIZE_32, AWIN_DEBE_HWCFBCTL_XSIZE) |
+#else
+	__SHIFTIN(AWIN_DEBE_HWCFBCTL_YSIZE_64, AWIN_DEBE_HWCFBCTL_YSIZE) |
+	__SHIFTIN(AWIN_DEBE_HWCFBCTL_XSIZE_64, AWIN_DEBE_HWCFBCTL_XSIZE) |
+#endif
+	__SHIFTIN(AWIN_DEBE_HWCFBCTL_FBFMT_2BPP, AWIN_DEBE_HWCFBCTL_FBFMT) |
+	__SHIFTIN(yoff, AWIN_DEBE_HWCFBCTL_YCOOROFF) |
+	__SHIFTIN(xoff, AWIN_DEBE_HWCFBCTL_XCOOROFF));
+
+	return 0;
+}
+
+static int
+awin_debe_set_cursor(struct awin_debe_softc *sc, struct wsdisplay_cursor *cur)
+{
+	uint32_t val;
+	uint8_t r[4], g[4], b[4];
+	u_int index, count, shift, off, pcnt;
+	int i, j, idx, error;
+	uint8_t mask;
+
+	if (cur->which & WSDISPLAY_CURSOR_DOCUR) {
+		val = DEBE_READ(sc, AWIN_DEBE_MODCTL_REG);
+		if (cur->enable)
+			val |= AWIN_DEBE_MODCTL_HWC_EN;
+		else
+			val &= ~AWIN_DEBE_MODCTL_HWC_EN;
+		DEBE_WRITE(sc, AWIN_DEBE_MODCTL_REG, val);
+
+		sc->sc_cursor_enable = cur->enable;
+	}
+
+	if (cur->which & WSDISPLAY_CURSOR_DOHOT) {
+		sc->sc_hot_x = cur->hot.x;
+		sc->sc_hot_y = cur->hot.y;
+		cur->which |= WSDISPLAY_CURSOR_DOPOS;
+	}
+
+	if (cur->which & WSDISPLAY_CURSOR_DOPOS) {
+		awin_debe_set_curpos(sc, cur->pos.x, cur->pos.y);
+	}
+
+	if (cur->which & WSDISPLAY_CURSOR_DOCMAP) {
+		index = cur->cmap.index;
+		count = cur->cmap.count;
+		if (index >= 2 || (index + count) > 2)
+			return EINVAL;
+		error = copyin(cur->cmap.red, &r[index], count);
+		if (error)
+			re

CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-11-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Nov 25 08:08:10 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_reg.h awin_wdt.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #266):
sys/arch/arm/allwinner/awin_reg.h: revision 1.54
sys/arch/arm/allwinner/awin_wdt.c: revision 1.5
- Write the correct value to the ctrl register to restart the watchdog.
  Watchdog restart bit is 0 not 1, and we need to write a key as well.
- Add A31 support.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.6 -r1.14.2.7 src/sys/arch/arm/allwinner/awin_reg.h
cvs rdiff -u -r1.3.10.1 -r1.3.10.2 src/sys/arch/arm/allwinner/awin_wdt.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/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.6 src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.7
--- src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.6	Tue Nov 25 07:49:22 2014
+++ src/sys/arch/arm/allwinner/awin_reg.h	Tue Nov 25 08:08:10 2014
@@ -1501,7 +1501,9 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_CNT64_CTRL_RL_ENABLE	__BIT(1)
 #define AWIN_CNT64_CTRL_CLR_ENABLE	__BIT(0)
 
-#define AWIN_WDOG_CTRL_RSTART		__BIT(1)
+#define AWIN_WDOG_CTRL_KEY		__BITS(12,1)
+#define AWIN_WDOG_CTRL_KEY_MAGIC	0xa57
+#define AWIN_WDOG_CTRL_RSTART		__BIT(0)
 #define AWIN_WDOG_MODE_INTV		__BITS(6,3)
 #define AWIN_WDOG_MODE_INTV_HALFSEC	0
 #define AWIN_WDOG_MODE_INTV_1SEC	1
@@ -2159,6 +2161,7 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_A31_WDOG_CFG_CONFIG_INT		2
 
 #define AWIN_A31_WDOG_MODE_EN			__BIT(0)
+#define AWIN_A31_WDOG_MODE_INTV			__BITS(7,4)
 
 #define AWIN_A31_MMC_FIFO			0x0200
 

Index: src/sys/arch/arm/allwinner/awin_wdt.c
diff -u src/sys/arch/arm/allwinner/awin_wdt.c:1.3.10.1 src/sys/arch/arm/allwinner/awin_wdt.c:1.3.10.2
--- src/sys/arch/arm/allwinner/awin_wdt.c:1.3.10.1	Sun Nov  9 14:42:33 2014
+++ src/sys/arch/arm/allwinner/awin_wdt.c	Tue Nov 25 08:08:10 2014
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_wdt.c,v 1.3.10.1 2014/11/09 14:42:33 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_wdt.c,v 1.3.10.2 2014/11/25 08:08:10 snj Exp $");
 
 #include 
 #include 
@@ -78,6 +78,26 @@ static const uint8_t period_map[] = {
 	[16] = __SHIFTIN(AWIN_WDOG_MODE_INTV_16SEC, AWIN_WDOG_MODE_INTV),
 };
 
+static const uint8_t period_map_a31[] = {
+	[0] = __SHIFTIN(AWIN_WDOG_MODE_INTV_1SEC, AWIN_A31_WDOG_MODE_INTV),
+	[1] = __SHIFTIN(AWIN_WDOG_MODE_INTV_1SEC, AWIN_A31_WDOG_MODE_INTV),
+	[2] = __SHIFTIN(AWIN_WDOG_MODE_INTV_2SEC, AWIN_A31_WDOG_MODE_INTV),
+	[3] = __SHIFTIN(AWIN_WDOG_MODE_INTV_3SEC, AWIN_A31_WDOG_MODE_INTV),
+	[4] = __SHIFTIN(AWIN_WDOG_MODE_INTV_4SEC, AWIN_A31_WDOG_MODE_INTV),
+	[5] = __SHIFTIN(AWIN_WDOG_MODE_INTV_5SEC, AWIN_A31_WDOG_MODE_INTV),
+	[6] = __SHIFTIN(AWIN_WDOG_MODE_INTV_6SEC, AWIN_A31_WDOG_MODE_INTV),
+	[7] = __SHIFTIN(AWIN_WDOG_MODE_INTV_8SEC, AWIN_A31_WDOG_MODE_INTV),
+	[8] = __SHIFTIN(AWIN_WDOG_MODE_INTV_8SEC, AWIN_A31_WDOG_MODE_INTV),
+	[9] = __SHIFTIN(AWIN_WDOG_MODE_INTV_10SEC, AWIN_A31_WDOG_MODE_INTV),
+	[10] = __SHIFTIN(AWIN_WDOG_MODE_INTV_10SEC, AWIN_A31_WDOG_MODE_INTV),
+	[11] = __SHIFTIN(AWIN_WDOG_MODE_INTV_12SEC, AWIN_A31_WDOG_MODE_INTV),
+	[12] = __SHIFTIN(AWIN_WDOG_MODE_INTV_12SEC, AWIN_A31_WDOG_MODE_INTV),
+	[13] = __SHIFTIN(AWIN_WDOG_MODE_INTV_14SEC, AWIN_A31_WDOG_MODE_INTV),
+	[14] = __SHIFTIN(AWIN_WDOG_MODE_INTV_14SEC, AWIN_A31_WDOG_MODE_INTV),
+	[15] = __SHIFTIN(AWIN_WDOG_MODE_INTV_16SEC, AWIN_A31_WDOG_MODE_INTV),
+	[16] = __SHIFTIN(AWIN_WDOG_MODE_INTV_16SEC, AWIN_A31_WDOG_MODE_INTV),
+};
+
 static struct awin_wdt_softc {
 	device_t sc_dev;
 	bus_space_tag_t sc_bst;
@@ -86,6 +106,8 @@ static struct awin_wdt_softc {
 u_int sc_wdog_period;
 bool sc_wdog_armed;
 	uint32_t sc_wdog_mode;
+	bus_size_t sc_ctrl_reg;
+	bus_size_t sc_mode_reg;
 } awin_wdt_sc = {
 	.sc_bst = &awin_bs_tag,
 	.sc_wdog_period = AWIN_WDT_PERIOD_DEFAULT,
@@ -95,8 +117,11 @@ static int
 awin_wdt_tickle(struct sysmon_wdog *smw)
 {
 	struct awin_wdt_softc * const sc = smw->smw_cookie;
-	bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_WDOG_CTRL_REG,
+
+	bus_space_write_4(sc->sc_bst, sc->sc_bsh, sc->sc_ctrl_reg,
+	__SHIFTIN(AWIN_WDOG_CTRL_KEY_MAGIC, AWIN_WDOG_CTRL_KEY) |
 	AWIN_WDOG_CTRL_RSTART);
+
 	return 0;
 }
 
@@ -104,6 +129,16 @@ static int
 awin_wdt_setmode(struct sysmon_wdog *smw)
 {
 	struct awin_wdt_softc * const sc = smw->smw_cookie;
+	const uint8_t *map;
+	size_t mapsize;
+
+	if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+		map = period_map_a31;
+		mapsize = __arraycount(period_map_a31);
+	} else {
+		map = period_map;
+		mapsize = __arraycount(period_map);
+	}
 
 	if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
 		/*
@@ -113,26 +148,39 @@ awin_wdt_setmode(struct sysmon_wdog *smw
 	}
 
 	if (sc->sc_wdog_armed && smw->smw_period == sc->sc_wdog_period) {
-		bus_space

CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-11-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Nov 25 08:03:06 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_gige.c awin_gpio.c
awin_var.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #260):
sys/arch/arm/allwinner/awin_var.h: revision 1.26
sys/arch/arm/allwinner/awin_gige.c: revision 1.19
sys/arch/arm/allwinner/awin_gpio.c: revision 1.14
Let pinsets override the default multi-driving select level.
--
Set GMAC pin drv level 3 on A31


To generate a diff of this commit:
cvs rdiff -u -r1.4.10.1 -r1.4.10.2 src/sys/arch/arm/allwinner/awin_gige.c
cvs rdiff -u -r1.8.10.3 -r1.8.10.4 src/sys/arch/arm/allwinner/awin_gpio.c
cvs rdiff -u -r1.10.2.5 -r1.10.2.6 src/sys/arch/arm/allwinner/awin_var.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/arm/allwinner/awin_gige.c
diff -u src/sys/arch/arm/allwinner/awin_gige.c:1.4.10.1 src/sys/arch/arm/allwinner/awin_gige.c:1.4.10.2
--- src/sys/arch/arm/allwinner/awin_gige.c:1.4.10.1	Sun Nov  9 14:42:33 2014
+++ src/sys/arch/arm/allwinner/awin_gige.c	Tue Nov 25 08:03:06 2014
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_gige.c,v 1.4.10.1 2014/11/09 14:42:33 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gige.c,v 1.4.10.2 2014/11/25 08:03:06 snj Exp $");
 
 #include 
 #include 
@@ -66,7 +66,7 @@ static const struct awin_gpio_pinset awi
 };
 
 static const struct awin_gpio_pinset awin_gige_gpio_pinset_a31 = {
-	'A', AWIN_A31_PIO_PA_GMAC_FUNC, AWIN_A31_PIO_PA_GMAC_PINS,
+	'A', AWIN_A31_PIO_PA_GMAC_FUNC, AWIN_A31_PIO_PA_GMAC_PINS, 0, 3
 };
 
 

Index: src/sys/arch/arm/allwinner/awin_gpio.c
diff -u src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.3 src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.4
--- src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.3	Mon Nov 10 08:17:45 2014
+++ src/sys/arch/arm/allwinner/awin_gpio.c	Tue Nov 25 08:03:06 2014
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.3 2014/11/10 08:17:45 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.4 2014/11/25 08:03:06 snj Exp $");
 
 #include 
 #include 
@@ -384,6 +384,16 @@ awin_gpio_set_pin_pull(struct awin_gpio_
 }
 
 static void
+awin_gpio_set_pin_drv(struct awin_gpio_pin_cfg *cfg, u_int pin, u_int drv)
+{
+	const u_int shift = (pin & 15) << 1;
+	const u_int i = (pin >> 4) & 1;
+	
+	cfg->drv[i] &= ~(0x03 << shift);
+	cfg->drv[i] |= drv << shift;
+}
+
+static void
 awin_gpio_update_cfg_regs(bus_space_tag_t bst, struct awin_gpio_pin_group *grp,
 const struct awin_gpio_pin_cfg *ncfg)
 {
@@ -577,6 +587,9 @@ awin_gpio_pinset_acquire(const struct aw
 			awin_gpio_set_pin_pull(&ncfg, j, AWIN_PIO_PULL_DOWN);
 		else if (req->pinset_flags & GPIO_PIN_PULLUP)
 			awin_gpio_set_pin_pull(&ncfg, j, AWIN_PIO_PULL_UP);
+
+		if (req->pinset_drv)
+			awin_gpio_set_pin_drv(&ncfg, j, req->pinset_drv);
 	}
 
 	/*

Index: src/sys/arch/arm/allwinner/awin_var.h
diff -u src/sys/arch/arm/allwinner/awin_var.h:1.10.2.5 src/sys/arch/arm/allwinner/awin_var.h:1.10.2.6
--- src/sys/arch/arm/allwinner/awin_var.h:1.10.2.5	Tue Nov 18 18:19:09 2014
+++ src/sys/arch/arm/allwinner/awin_var.h	Tue Nov 25 08:03:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_var.h,v 1.10.2.5 2014/11/18 18:19:09 snj Exp $ */
+/* $NetBSD: awin_var.h,v 1.10.2.6 2014/11/25 08:03:06 snj Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -76,6 +76,7 @@ struct awin_gpio_pinset {
 	uint8_t pinset_func;
 	uint32_t pinset_mask;
 	int pinset_flags;
+	int pinset_drv;
 };
 
 struct awin_gpio_pindata {



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-11-20 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Nov 20 10:05:06 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_usb.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #252):
sys/arch/arm/allwinner/awin_usb.c: revision 1.17
IPL_SCHED -> IPL_VM
Something isn't MP safe.


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/arch/arm/allwinner/awin_usb.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/arm/allwinner/awin_usb.c
diff -u src/sys/arch/arm/allwinner/awin_usb.c:1.12.2.1 src/sys/arch/arm/allwinner/awin_usb.c:1.12.2.2
--- src/sys/arch/arm/allwinner/awin_usb.c:1.12.2.1	Sun Nov  9 14:42:33 2014
+++ src/sys/arch/arm/allwinner/awin_usb.c	Thu Nov 20 10:05:06 2014
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_usb.c,v 1.12.2.1 2014/11/09 14:42:33 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_usb.c,v 1.12.2.2 2014/11/20 10:05:06 snj Exp $");
 
 #include 
 #include 
@@ -151,7 +151,7 @@ ohci_awinusb_attach(device_t parent, dev
 	const int irq = awin_chip_id() == AWIN_CHIP_ID_A31 ?
 			awinusb_ohci_irqs_a31[usbaa->usbaa_port] :
 			awinusb_ohci_irqs[usbaa->usbaa_port];
-	usbsc->usbsc_ohci_ih = intr_establish(irq, IPL_SCHED,
+	usbsc->usbsc_ohci_ih = intr_establish(irq, IPL_VM,
 	IST_LEVEL, ohci_intr, sc);
 	if (usbsc->usbsc_ohci_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %d\n",
@@ -228,7 +228,7 @@ ehci_awinusb_attach(device_t parent, dev
 	const int irq = awin_chip_id() == AWIN_CHIP_ID_A31 ?
 			awinusb_ehci_irqs_a31[usbaa->usbaa_port] :
 			awinusb_ehci_irqs[usbaa->usbaa_port];
-	usbsc->usbsc_ehci_ih = intr_establish(irq, IPL_SCHED,
+	usbsc->usbsc_ehci_ih = intr_establish(irq, IPL_VM,
 	IST_LEVEL, ehci_intr, sc);
 	if (usbsc->usbsc_ehci_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %d\n",



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-11-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Nov 18 18:50:33 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_cnt.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #250):
sys/arch/arm/allwinner/awin_cnt.c: revision 1.2
s/IPL_SCHED/IPL_HIGH/
This allows binuptime to be called from any interrupt handler.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/arm/allwinner/awin_cnt.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/arm/allwinner/awin_cnt.c
diff -u src/sys/arch/arm/allwinner/awin_cnt.c:1.1.2.2 src/sys/arch/arm/allwinner/awin_cnt.c:1.1.2.3
--- src/sys/arch/arm/allwinner/awin_cnt.c:1.1.2.2	Sun Nov  9 14:42:33 2014
+++ src/sys/arch/arm/allwinner/awin_cnt.c	Tue Nov 18 18:50:33 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_cnt.c,v 1.1.2.2 2014/11/09 14:42:33 martin Exp $ */
+/* $NetBSD: awin_cnt.c,v 1.1.2.3 2014/11/18 18:50:33 snj Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_cnt.c,v 1.1.2.2 2014/11/09 14:42:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_cnt.c,v 1.1.2.3 2014/11/18 18:50:33 snj Exp $");
 
 #include 
 #include 
@@ -84,7 +84,7 @@ awin_cnt_attach(device_t parent, device_
 
 	sc->sc_dev = self;
 	sc->sc_bst = aio->aio_core_bst;
-	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SCHED);
+	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH);
 	bus_space_subregion(sc->sc_bst, aio->aio_core_bsh,
 	loc->loc_offset, loc->loc_size, &sc->sc_bsh);
 



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-11-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 15 11:31:40 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_debe.c awin_fb.c awin_var.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #239):
sys/arch/arm/allwinner/awin_debe.c: revision 1.8
sys/arch/arm/allwinner/awin_var.h: revision 1.24
sys/arch/arm/allwinner/awin_fb.c: revision 1.6
Implement WSDISPLAYIO_SVIDEO, WSDISPLAYIO_GVIDEO for screen blanking


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/arch/arm/allwinner/awin_debe.c
cvs rdiff -u -r1.4.2.3 -r1.4.2.4 src/sys/arch/arm/allwinner/awin_fb.c
cvs rdiff -u -r1.10.2.3 -r1.10.2.4 src/sys/arch/arm/allwinner/awin_var.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/arm/allwinner/awin_debe.c
diff -u src/sys/arch/arm/allwinner/awin_debe.c:1.6.2.3 src/sys/arch/arm/allwinner/awin_debe.c:1.6.2.4
--- src/sys/arch/arm/allwinner/awin_debe.c:1.6.2.3	Fri Nov 14 22:23:28 2014
+++ src/sys/arch/arm/allwinner/awin_debe.c	Sat Nov 15 11:31:40 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_debe.c,v 1.6.2.3 2014/11/14 22:23:28 martin Exp $ */
+/* $NetBSD: awin_debe.c,v 1.6.2.4 2014/11/15 11:31:40 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -34,7 +34,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.6.2.3 2014/11/14 22:23:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.6.2.4 2014/11/15 11:31:40 martin Exp $");
 
 #include 
 #include 
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: awin_debe.c,
 #include 
 
 #include 
+#include 
 
 struct awin_debe_softc {
 	device_t sc_dev;
@@ -360,3 +361,30 @@ awin_debe_set_videomode(const struct vid
 		awin_debe_setup_fbdev(sc, mode);
 	}
 }
+
+int
+awin_debe_ioctl(device_t self, u_long cmd, void *data)
+{
+	struct awin_debe_softc *sc = device_private(self);
+	uint32_t val;
+	int enable;
+
+	switch (cmd) {
+	case WSDISPLAYIO_SVIDEO:
+		enable = *(int *)data;
+		val = DEBE_READ(sc, AWIN_DEBE_MODCTL_REG);
+		if (enable)
+			val |= AWIN_DEBE_MODCTL_LAY0_EN;
+		else
+			val &= ~AWIN_DEBE_MODCTL_LAY0_EN;
+		DEBE_WRITE(sc, AWIN_DEBE_MODCTL_REG, val);
+		return 0;
+	case WSDISPLAYIO_GVIDEO:
+		val = DEBE_READ(sc, AWIN_DEBE_MODCTL_REG);
+		*(int *)data = !!(val & AWIN_DEBE_MODCTL_LAY0_EN);
+		return 0;
+	}
+
+	return EPASSTHROUGH;
+}
+

Index: src/sys/arch/arm/allwinner/awin_fb.c
diff -u src/sys/arch/arm/allwinner/awin_fb.c:1.4.2.3 src/sys/arch/arm/allwinner/awin_fb.c:1.4.2.4
--- src/sys/arch/arm/allwinner/awin_fb.c:1.4.2.3	Fri Nov 14 22:23:28 2014
+++ src/sys/arch/arm/allwinner/awin_fb.c	Sat Nov 15 11:31:40 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_fb.c,v 1.4.2.3 2014/11/14 22:23:28 martin Exp $ */
+/* $NetBSD: awin_fb.c,v 1.4.2.4 2014/11/15 11:31:40 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_fb.c,v 1.4.2.3 2014/11/14 22:23:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_fb.c,v 1.4.2.4 2014/11/15 11:31:40 martin Exp $");
 
 #include 
 #include 
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: awin_fb.c,v 
 
 struct awin_fb_softc {
 	struct genfb_softc sc_gen;
+	device_t sc_debedev;
 
 	bus_dma_tag_t sc_dmat;
 	bus_dma_segment_t *sc_dmasegs;
@@ -82,6 +83,7 @@ awin_fb_attach(device_t parent, device_t
 		awin_fb_consoledev = self;
 
 	sc->sc_gen.sc_dev = self;
+	sc->sc_debedev = parent;
 	sc->sc_dmat = afb->afb_dmat;
 	sc->sc_dmasegs = afb->afb_dmasegs;
 	sc->sc_ndmasegs = afb->afb_ndmasegs;
@@ -144,6 +146,9 @@ awin_fb_ioctl(void *v, void *vs, u_long 
 		if (error == 0)
 			fbi->fbi_flags |= WSFB_VRAM_IS_RAM;
 		return error;
+	case WSDISPLAYIO_SVIDEO:
+	case WSDISPLAYIO_GVIDEO:
+		return awin_debe_ioctl(sc->sc_debedev, cmd, data);
 	default:
 		return EPASSTHROUGH;
 	}

Index: src/sys/arch/arm/allwinner/awin_var.h
diff -u src/sys/arch/arm/allwinner/awin_var.h:1.10.2.3 src/sys/arch/arm/allwinner/awin_var.h:1.10.2.4
--- src/sys/arch/arm/allwinner/awin_var.h:1.10.2.3	Fri Nov 14 22:23:28 2014
+++ src/sys/arch/arm/allwinner/awin_var.h	Sat Nov 15 11:31:40 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_var.h,v 1.10.2.3 2014/11/14 22:23:28 martin Exp $ */
+/* $NetBSD: awin_var.h,v 1.10.2.4 2014/11/15 11:31:40 martin Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -131,6 +131,7 @@ void	awin_tcon_set_videomode(const struc
 void	awin_tcon_enable(bool);
 void	awin_debe_set_videomode(const struct videomode *);
 void	awin_debe_enable(bool);
+int	awin_debe_ioctl(device_t, u_long, void *);
 void	awin_fb_set_videomode(device_t, u_int, u_int);
 void	awin_fb_ddb_trap_callback(int);
 



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 10 08:17:45 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_gpio.c

Log Message:
Undo previous "fix" to last pullup - it was completely unneeded, the original
pullup was fine.


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.2 -r1.8.10.3 src/sys/arch/arm/allwinner/awin_gpio.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/arm/allwinner/awin_gpio.c
diff -u src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.2 src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.3
--- src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.2	Sun Nov  9 16:25:51 2014
+++ src/sys/arch/arm/allwinner/awin_gpio.c	Mon Nov 10 08:17:45 2014
@@ -33,11 +33,9 @@
 #include "opt_arm_debug.h"
 #include "opt_allwinner.h"
 
-#include "opt_arm_debug.h"
-
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.2 2014/11/09 16:25:51 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.3 2014/11/10 08:17:45 martin Exp $");
 
 #include 
 #include 



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-11-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  9 16:25:51 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_gpio.c

Log Message:
Fix pullup mishap in previous


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.1 -r1.8.10.2 src/sys/arch/arm/allwinner/awin_gpio.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/arm/allwinner/awin_gpio.c
diff -u src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.1 src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.2
--- src/sys/arch/arm/allwinner/awin_gpio.c:1.8.10.1	Sun Nov  9 14:42:33 2014
+++ src/sys/arch/arm/allwinner/awin_gpio.c	Sun Nov  9 16:25:51 2014
@@ -33,9 +33,11 @@
 #include "opt_arm_debug.h"
 #include "opt_allwinner.h"
 
+#include "opt_arm_debug.h"
+
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.1 2014/11/09 14:42:33 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.8.10.2 2014/11/09 16:25:51 martin Exp $");
 
 #include 
 #include 



CVS commit: [netbsd-7] src/sys/arch/arm/allwinner

2014-08-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 29 11:17:39 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner [netbsd-7]: awin_mmc.c awin_reg.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #57):
sys/arch/arm/allwinner/awin_reg.h: revision 1.15
sys/arch/arm/allwinner/awin_mmc.c: revision 1.4
Correct the mmc clock.  Banana Pi can now find an SD card.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.10.1 src/sys/arch/arm/allwinner/awin_mmc.c
cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/arm/allwinner/awin_reg.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/arm/allwinner/awin_mmc.c
diff -u src/sys/arch/arm/allwinner/awin_mmc.c:1.3 src/sys/arch/arm/allwinner/awin_mmc.c:1.3.10.1
--- src/sys/arch/arm/allwinner/awin_mmc.c:1.3	Wed Feb 26 02:01:02 2014
+++ src/sys/arch/arm/allwinner/awin_mmc.c	Fri Aug 29 11:17:38 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_mmc.c,v 1.3 2014/02/26 02:01:02 jmcneill Exp $ */
+/* $NetBSD: awin_mmc.c,v 1.3.10.1 2014/08/29 11:17:38 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.3 2014/02/26 02:01:02 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_mmc.c,v 1.3.10.1 2014/08/29 11:17:38 martin Exp $");
 
 #include 
 #include 
@@ -87,7 +87,7 @@ struct awin_mmc_softc {
 	int sc_mmc_present;
 
 	device_t sc_sdmmc_dev;
-	unsigned int sc_pll5_freq;
+	unsigned int sc_pll_freq;
 	unsigned int sc_mod_clk;
 
 	bool sc_has_gpio_detect;
@@ -129,7 +129,7 @@ awin_mmc_probe_clocks(struct awin_mmc_so
 	int n, k, p, div;
 
 	val = bus_space_read_4(aio->aio_core_bst, aio->aio_ccm_bsh,
-	AWIN_PLL5_CFG_REG);
+	AWIN_PLL6_CFG_REG);
 
 	n = (val >> 8) & 0x1f;
 	k = ((val >> 4) & 3) + 1;
@@ -137,20 +137,16 @@ awin_mmc_probe_clocks(struct awin_mmc_so
 
 	freq = 2400 * n * k / p;
 
-	sc->sc_pll5_freq = freq;
-	if (sc->sc_pll5_freq > 4) {
-		div = 4;
-	} else {
-		div = 3;
-	}
-	sc->sc_mod_clk = sc->sc_pll5_freq / (div + 1);
+	sc->sc_pll_freq = freq;
+	div = ((sc->sc_pll_freq + ) / 1) - 1;
+	sc->sc_mod_clk = sc->sc_pll_freq / (div + 1);
 
-	awin_reg_set_clear(aio->aio_core_bst, aio->aio_ccm_bsh,
+	bus_space_write_4(aio->aio_core_bst, aio->aio_ccm_bsh,
 	AWIN_SD0_CLK_REG + (sc->sc_mmc_number * 8),
-	AWIN_PLL_CFG_ENABLE | AWIN_PLL_CFG_EXG_MODE | div, 0);
+	AWIN_PLL_CFG_ENABLE | AWIN_PLL_CFG_PLL6 | div);
 
 #ifdef AWIN_MMC_DEBUG
-	aprint_normal_dev(sc->sc_dev, "PLL5 @ %u Hz\n", freq);
+	aprint_normal_dev(sc->sc_dev, "PLL6 @ %u Hz\n", freq);
 #endif
 }
 

Index: src/sys/arch/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.14 src/sys/arch/arm/allwinner/awin_reg.h:1.14.2.1
--- src/sys/arch/arm/allwinner/awin_reg.h:1.14	Sun Aug  3 19:14:24 2014
+++ src/sys/arch/arm/allwinner/awin_reg.h	Fri Aug 29 11:17:38 2014
@@ -720,7 +720,8 @@
 
 #define AWIN_PLL_CFG_ENABLE		__BIT(31)
 #define AWIN_PLL_CFG_BYPASS		__BIT(30)
-#define AWIN_PLL_CFG_EXG_MODE		__BIT(25)
+#define AWIN_PLL_CFG_PLL5		__BIT(25)
+#define AWIN_PLL_CFG_PLL6		__BIT(24)
 #define AWIN_PLL_CFG_OUT_EXP_DIVP	__BITS(17,16)
 #define AWIN_PLL_CFG_FACTOR_N		__BITS(12,8)
 #define AWIN_PLL_CFG_FACTOR_K		__BITS(5,4)