CVS commit: src/sys/arch/arm/marvell

2017-01-09 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Jan  9 14:15:20 UTC 2017

Modified Files:
src/sys/arch/arm/marvell: mvsoc.c

Log Message:
Remove no-need #ifdef MARVELL_ATTR_AXI_DDR.  It has defined.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/marvell/mvsoc.c

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



CVS commit: src/sys/arch/arm/marvell

2017-01-09 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Jan  9 14:15:20 UTC 2017

Modified Files:
src/sys/arch/arm/marvell: mvsoc.c

Log Message:
Remove no-need #ifdef MARVELL_ATTR_AXI_DDR.  It has defined.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/marvell/mvsoc.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/marvell/mvsoc.c
diff -u src/sys/arch/arm/marvell/mvsoc.c:1.26 src/sys/arch/arm/marvell/mvsoc.c:1.27
--- src/sys/arch/arm/marvell/mvsoc.c:1.26	Sat Jan  7 21:12:42 2017
+++ src/sys/arch/arm/marvell/mvsoc.c	Mon Jan  9 14:15:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsoc.c,v 1.26 2017/01/07 21:12:42 christos Exp $	*/
+/*	$NetBSD: mvsoc.c,v 1.27 2017/01/09 14:15:20 kiyohara Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013, 2014, 2016 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsoc.c,v 1.26 2017/01/07 21:12:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsoc.c,v 1.27 2017/01/09 14:15:20 kiyohara Exp $");
 
 #include "opt_cputypes.h"
 #include "opt_mvsoc.h"
@@ -148,12 +148,10 @@ static struct {
 	{ MARVELL_TAG_SDRAM_CS3,
 	  MARVELL_ATTR_SDRAM_CS3,	MVSOC_UNITID_DDR },
 
-#ifdef MARVELL_ATTR_AXI_DDR /* XXX */
 	{ MARVELL_TAG_AXI_CS0,
 	  MARVELL_ATTR_AXI_DDR,		MVSOC_UNITID_DDR },
 	{ MARVELL_TAG_AXI_CS1,
 	  MARVELL_ATTR_AXI_DDR,		MVSOC_UNITID_DDR },
-#endif
 
 	{ MARVELL_TAG_DDR3_CS0,
 	  MARVELL_ATTR_SDRAM_CS0,	MVSOC_UNITID_DDR },



CVS commit: src/sys/dev/marvell

2017-01-09 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Jan  9 14:06:35 UTC 2017

Modified Files:
src/sys/dev/marvell: marvellreg.h

Log Message:
Add ATTR_AXI_DDR.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/marvellreg.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/dev/marvell/marvellreg.h
diff -u src/sys/dev/marvell/marvellreg.h:1.10 src/sys/dev/marvell/marvellreg.h:1.11
--- src/sys/dev/marvell/marvellreg.h:1.10	Tue Oct  4 15:02:27 2016
+++ src/sys/dev/marvell/marvellreg.h	Mon Jan  9 14:06:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: marvellreg.h,v 1.10 2016/10/04 15:02:27 kiyohara Exp $	*/
+/*	$NetBSD: marvellreg.h,v 1.11 2017/01/09 14:06:35 kiyohara Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -88,5 +88,6 @@
 #define MARVELL_ATTR_SDRAM_CS2		0x0b
 #define MARVELL_ATTR_SDRAM_CS3		0x07
 #endif
+#define MARVELL_ATTR_AXI_DDR		0x00
 
 #endif	/* _DEV_MARVELL_MARVELLREG_H_ */



CVS commit: src/sys/dev/marvell

2017-01-09 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Jan  9 14:06:35 UTC 2017

Modified Files:
src/sys/dev/marvell: marvellreg.h

Log Message:
Add ATTR_AXI_DDR.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/marvellreg.h

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



CVS commit: src/etc/etc.evbarm

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 16:29:04 UTC 2017

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Add CUBOX to v7 and v7hf.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/etc/etc.evbarm/Makefile.inc

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

Modified files:

Index: src/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.80 src/etc/etc.evbarm/Makefile.inc:1.81
--- src/etc/etc.evbarm/Makefile.inc:1.80	Tue May 17 06:44:45 2016
+++ src/etc/etc.evbarm/Makefile.inc	Sat Jan  7 16:29:04 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.80 2016/05/17 06:44:45 ryo Exp $
+#	$NetBSD: Makefile.inc,v 1.81 2017/01/07 16:29:04 kiyohara Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -98,6 +98,8 @@ EVBARM_BOARDS.armv7+=		CUBIEBOARD
 EVBARM_BOARDS.armv7hf+= 	CUBIEBOARD
 EVBARM_BOARDS.armv7+=		CUBIETRUCK
 EVBARM_BOARDS.armv7hf+= 	CUBIETRUCK
+EVBARM_BOARDS.armv7+=		CUBOX
+EVBARM_BOARDS.armv7hf+= 	CUBOX
 EVBARM_BOARDS.armv7+=		CUBOX-I
 EVBARM_BOARDS.armv7hf+= 	CUBOX-I
 EVBARM_BOARDS.armv7+=		HUMMINGBIRD_A31



CVS commit: src/etc/etc.evbarm

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 16:29:04 UTC 2017

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Add CUBOX to v7 and v7hf.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/etc/etc.evbarm/Makefile.inc

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



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

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 16:24:07 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: README.evbarm
Added Files:
src/sys/arch/evbarm/conf: CUBOX

Log Message:
Support SolidRun Cubox.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/CUBOX
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/conf/README.evbarm

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/conf/README.evbarm
diff -u src/sys/arch/evbarm/conf/README.evbarm:1.13 src/sys/arch/evbarm/conf/README.evbarm:1.14
--- src/sys/arch/evbarm/conf/README.evbarm:1.13	Sat Oct 15 15:33:02 2016
+++ src/sys/arch/evbarm/conf/README.evbarm	Sat Jan  7 16:24:07 2017
@@ -1,4 +1,4 @@
-$NetBSD: README.evbarm,v 1.13 2016/10/15 15:33:02 kiyohara Exp $
+$NetBSD: README.evbarm,v 1.14 2017/01/07 16:24:07 kiyohara Exp $
 
 config		date		boards
 ---
@@ -13,6 +13,7 @@ BEAGLEBONE	2012/08/20	TI AM335x BeagleBo
 BPI		2014/09/07	Banana Pi
 CUBIEBOARD	2013/09/03	Cubietech Cubieboard 1 & 2
 CUBIETRUCK	2014/04/11	Cubietech Cubietruck
+CUBOX		2017/01/07	SolidRun Cubox
 CP3100		2006/11/08	Certance IOP321 CP-3100
 DEVKIT8000	2010/09/08	Embest OMAP3530 DevKit8000 eval Kit 
 DNS323		2010/10/02	D-Link DNS-323 Marvell SoC based NAS

Added files:

Index: src/sys/arch/evbarm/conf/CUBOX
diff -u /dev/null src/sys/arch/evbarm/conf/CUBOX:1.1
--- /dev/null	Sat Jan  7 16:24:07 2017
+++ src/sys/arch/evbarm/conf/CUBOX	Sat Jan  7 16:24:07 2017
@@ -0,0 +1,417 @@
+# $NetBSD: CUBOX,v 1.1 2017/01/07 16:24:07 kiyohara Exp $
+#
+#	CUBOX -- SolidRun Ltd. Cubox kernel
+#
+
+include	"arch/evbarm/conf/std.marvell"
+
+#options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+# estimated number of users
+
+maxusers	32
+
+# Board Type
+makeoptions	BOARDTYPE="cubox"
+options 	EVBARM_BOARDTYPE=cubox
+
+# CPU options
+options 	CPU_PJ4B	# : CPU is PJ4
+options 	ARM_HAS_VBAR
+options 	FPU_VFP
+makeoptions	CPUFLAGS="-march=armv7-a -mfpu=vfpv3"
+
+# Marvell SoC options
+options 	DOVE
+
+# Standard system options
+
+options 	INSECURE	# disable kernel security levels - X needs this
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+#options 	NTP		# NTP phase/frequency locked loop
+options 	KTRACE		# system call tracing via ktrace(1)
+
+# Note: SysV IPC parameters can be changed dynamically; see sysctl(8).
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+
+#options 	USERCONF	# userconf(4) support
+#options 	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
+options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+# Alternate buffer queue strategies for better responsiveness under high
+# disk I/O load.
+#options 	BUFQ_READPRIO
+options 	BUFQ_PRIOCSCAN
+
+# Diagnostic/debugging support options
+#options 	VERBOSE_INIT_ARM # verbose bootstraping messages
+#options 	PERFCTRS	# performance counters
+options 	DIAGNOSTIC	# internally consistency checks
+
+#options 	DEBUG
+#options 	PMAP_DEBUG	# Enable pmap_debug_level code
+options 	LOCKDEBUG	# expensive locking checks/support
+options 	IRQSTATS	# manage IRQ statistics
+#options 	NO_POWERSAVE	# uncomment this to run under ICE
+
+#makeoptions	COPTS="-O2"
+options 	DDB			# in-kernel debugger
+#options 	DDB_KEYCODE=0x1d	# ^]
+#options 	DDB_COMMANDONENTER="bt"	# execute command when ddb is entered
+options 	DDB_ONPANIC=1		# see also sysctl(7): `ddb.onpanic'
+options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
+options 	DDB_VERBOSE_HELP
+#options 	IPKDB			# remote kernel debugging
+#options	KGDB
+#options 	KGDB_DEVRATE=115200
+makeoptions	DEBUG="-g"		# compile full symbol table
+makeoptions	COPY_SYMTAB=1
+#options 	SYSCALL_STATS			# per syscall counts
+#options 	SYSCALL_TIMES			# per syscall times
+#options 	SYSCALL_TIMES_HASCOUNTER	# use 'broken' rdtsc (soekris)
+
+
+# Compatibility options
+options 	COMPAT_NETBSD32 # allow running arm (e.g. non-earm) binaries
+#options 	COMPAT_43	# 4.3BSD compatibility.
+#options 	COMPAT_09	# NetBSD 0.9,
+#options 	COMPAT_10	# NetBSD 1.0,
+#options 	COMPAT_11	# NetBSD 1.1,
+#options 	COMPAT_12	# NetBSD 1.2,
+#options 	COMPAT_13	# NetBSD 1.3,
+#options 	COMPAT_14	# NetBSD 1.4,
+#options 	COMPAT_15	# NetBSD 1.5,
+#options 	COMPAT_16	# NetBSD 1.6,
+#options 	COMPAT_20	# NetBSD 2.0,
+#options 	COMPAT_30	# NetBSD 3.0,
+#options 	COMPAT_40	# NetBSD 4.0,
+#options 	COMPAT_50	# NetBSD 5.0,
+options 	COMPAT_60	# NetBSD 6.0, and
+options 	COMPAT_70	# NetBSD 7.0 binary compatibility.
+#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
+
+options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
+#options 	COMPAT_NDIS	# NDIS network driver
+options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
+
+# Wedge support

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

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 16:24:07 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: README.evbarm
Added Files:
src/sys/arch/evbarm/conf: CUBOX

Log Message:
Support SolidRun Cubox.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/CUBOX
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/conf/README.evbarm

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



CVS commit: src/sys/arch

2017-01-07 Thread KIYOHARA Takashi
wood.c,v 1.10 2017/01/07 16:19:28 kiyohara Exp $	*/
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kirkwood.c,v 1.9 2014/03/11 07:52:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kirkwood.c,v 1.10 2017/01/07 16:19:28 kiyohara Exp $");
 
 #define _INTR_PRIVATE
 
@@ -56,6 +56,9 @@ static void kirkwood_pic_source_name(str
 
 static int kirkwood_find_pending_irqs(void);
 
+static void kirkwood_getclks(vaddr_t);
+static int kirkwood_clkgating(struct marvell_attach_args *);
+
 static const char * const sources[64] = {
 "MainHighSum(0)",  "Bridge(1)",   "Host2CPU DB(2)",  "CPU2Host DB(3)",
 "Reserved_4(4)",   "Xor0Chan0(5)","Xor0Chan1(6)","Xor1Chan0(7)",
@@ -111,15 +114,14 @@ static struct {
 
 
 /*
- * kirkwood_intr_bootstrap:
+ * kirkwood_bootstrap:
  *
- *	Initialize the rest of the interrupt subsystem, making it
+ *	Initialize the rest of the Kirkwood dependencies, making it
  *	ready to handle interrupts from devices.
  */
 void
-kirkwood_intr_bootstrap(void)
+kirkwood_bootstrap(vaddr_t iobase)
 {
-	extern void (*mvsoc_intr_init)(void);
 
 	/* disable all interrupts */
 	write_mlmbreg(KIRKWOOD_MLMB_MIRQIMLR, 0);
@@ -139,6 +141,9 @@ kirkwood_intr_bootstrap(void)
 	}
 	gpp_irqbase = 96;	/* Main Low(32) + High(32) + Bridge(32) */
 #endif
+
+	kirkwood_getclks(iobase);
+	mvsoc_clkgating = kirkwood_clkgating;
 }
 
 static void
@@ -224,8 +229,8 @@ kirkwood_find_pending_irqs(void)
  * Clock functions
  */
 
-void
-kirkwood_getclks(bus_addr_t iobase)
+static void
+kirkwood_getclks(vaddr_t iobase)
 {
 	uint32_t reg;
 	uint16_t model;
@@ -282,7 +287,7 @@ kirkwood_getclks(bus_addr_t iobase)
 
 }
 
-int
+static int
 kirkwood_clkgating(struct marvell_attach_args *mva)
 {
 	uint32_t val;

Index: src/sys/arch/arm/marvell/mv78xx0.c
diff -u src/sys/arch/arm/marvell/mv78xx0.c:1.1 src/sys/arch/arm/marvell/mv78xx0.c:1.2
--- src/sys/arch/arm/marvell/mv78xx0.c:1.1	Mon Sep 30 13:07:30 2013
+++ src/sys/arch/arm/marvell/mv78xx0.c	Sat Jan  7 16:19:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mv78xx0.c,v 1.1 2013/09/30 13:07:30 kiyohara Exp $	*/
+/*	$NetBSD: mv78xx0.c,v 1.2 2017/01/07 16:19:28 kiyohara Exp $	*/
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mv78xx0.c,v 1.1 2013/09/30 13:07:30 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mv78xx0.c,v 1.2 2017/01/07 16:19:28 kiyohara Exp $");
 
 #define _INTR_PRIVATE
 
@@ -59,6 +59,8 @@ static void mv78xx0_pic_source_name(stru
 
 static int mv78xx0_find_pending_irqs(void);
 
+static void mv78xx0_getclks(vaddr_t);
+
 static const char * const sources[64] = {
 "ErrSum(0)",   "SPI(1)",  "TWSI0(2)","TWSI1(3)",
 "IDMA0(4)","IDMA1(5)","IDMA2(6)","IDMA3(7)",
@@ -93,15 +95,14 @@ static struct pic_softc mv78xx0_pic = {
 
 
 /*
- * mv78xx0_intr_bootstrap:
+ * mv78xx0_bootstrap:
  *
- *	Initialize the rest of the interrupt subsystem, making it
+ *	Initialize the rest of the Discovery Innovation dependencies, making it
  *	ready to handle interrupts from devices.
  */
 void
-mv78xx0_intr_bootstrap(void)
+mv78xx0_bootstrap(vaddr_t iobase)
 {
-	extern void (*mvsoc_intr_init)(void);
 
 	/* disable all interrupts */
 	write_mlmbreg(MV78XX0_ICI_IRQIMER, 0);
@@ -113,8 +114,12 @@ mv78xx0_intr_bootstrap(void)
 
 	mvsoc_intr_init = mv78xx0_intr_init;
 
+#if NMVSOCGPP > 0
 	gpp_npins = 32;
 	gpp_irqbase = 64;	/* Main Low(32) + High(32) */
+#endif
+
+	mv78xx0_getclks(iobase);
 }
 
 static void
@@ -197,8 +202,8 @@ mv78xx0_find_pending_irqs(void)
  * Clock functions
  */
 
-void
-mv78xx0_getclks(bus_addr_t iobase)
+static void
+mv78xx0_getclks(vaddr_t iobase)
 {
 	const static int sys2cpu_clk_ratio_m[] =	/* Mul constant */
 	{ 1, 3, 2, 5, 3, 7, 4, 9, 5, 1, 6 };

Index: src/sys/arch/arm/marvell/mvsoc.c
diff -u src/sys/arch/arm/marvell/mvsoc.c:1.24 src/sys/arch/arm/marvell/mvsoc.c:1.25
--- src/sys/arch/arm/marvell/mvsoc.c:1.24	Fri Nov  6 12:54:52 2015
+++ src/sys/arch/arm/marvell/mvsoc.c	Sat Jan  7 16:19:28 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: mvsoc.c,v 1.24 2015/11/06 12:54:52 kiyohara Exp $	*/
+/*	$NetBSD: mvsoc.c,v 1.25 2017/01/07 16:19:28 kiyohara Exp $	*/
 /*
- * Copyright (c) 2007, 2008, 2013, 2014 KIYOHARA Takashi
+ * Copyright (c) 2007, 2008, 2013, 2014, 2016 KIYOHARA Takashi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsoc.c,v 1.24 2015/11/06 12:54:52 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsoc.c,v 1.25 2017/01/07 16:19:28 kiyohara Exp $");
 
 #include "opt_cputypes.h"
 #include "opt_mvsoc.h"
@@ -52,6 +52,7

CVS commit: src/sys/arch

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 16:19:29 UTC 2017

Modified Files:
src/sys/arch/arm/arm: cpufunc_asm_pj4b.S
src/sys/arch/arm/marvell: armadaxp.c armadaxpvar.h files.marvell
kirkwood.c mv78xx0.c mvsoc.c mvsoc_space.c mvsocreg.h mvsocvar.h
orion.c
src/sys/arch/evbarm/armadaxp: armadaxp_machdep.c
src/sys/arch/evbarm/marvell: marvell_machdep.c marvellreg.h
Added Files:
src/sys/arch/arm/marvell: dove.c dovereg.h mvsoc_sdhc.c mvsocpmu.c
mvsocpmuvar.h

Log Message:
Add support Marvell Dove.
Also _intr_bootstrap() rename to _bootstrap(). And SoC init func, 
getclk into that.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/arm/cpufunc_asm_pj4b.S
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/marvell/armadaxp.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/marvell/armadaxpvar.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/marvell/dove.c \
src/sys/arch/arm/marvell/dovereg.h src/sys/arch/arm/marvell/mvsoc_sdhc.c \
src/sys/arch/arm/marvell/mvsocpmu.c \
src/sys/arch/arm/marvell/mvsocpmuvar.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/marvell/files.marvell
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/marvell/kirkwood.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/marvell/mv78xx0.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/marvell/mvsoc.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/marvell/mvsoc_space.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/marvell/mvsocreg.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/marvell/mvsocvar.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/marvell/orion.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/evbarm/marvell/marvell_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/marvell/marvellreg.h

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



CVS commit: src/sys/arch/arm/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:47:33 UTC 2017

Modified Files:
src/sys/arch/arm/marvell: armadaxpreg.h

Log Message:
Add register macros.
And reorder registers.
Also remove white-spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/marvell/armadaxpreg.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/marvell/armadaxpreg.h
diff -u src/sys/arch/arm/marvell/armadaxpreg.h:1.6 src/sys/arch/arm/marvell/armadaxpreg.h:1.7
--- src/sys/arch/arm/marvell/armadaxpreg.h:1.6	Fri Nov  6 12:54:52 2015
+++ src/sys/arch/arm/marvell/armadaxpreg.h	Sat Jan  7 15:47:33 2017
@@ -204,6 +204,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #define ARMADAXP_IRQ_PEX11		63	/* PCIe Port1.1 INTA/B/C/D */
 #define ARMADAXP_IRQ_PEX12		64	/* PCIe Port1.2 INTA/B/C/D */
 #define ARMADAXP_IRQ_PEX13		65	/* PCIe Port1.3 INTA/B/C/D */
+#define ARMADAXP_IRQ_GBE0_SUM		66
 #define ARMADAXP_IRQ_XOR1CH2		94	/* XOR1 Ch2 */
 #define ARMADAXP_IRQ_XOR1CH3		95	/* XOR1 Ch3 */
 #define ARMADAXP_IRQ_PEX2		99	/* PCIe Port2 INTA/B/C/D */
@@ -279,18 +280,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #define ARMADAXP_GPIO2_BASE	(MVSOC_DEVBUS_BASE + 0x8140)
 
 /*
- * Thermal Sensor and Thermal Managemer
- */
-#define ARMADAXP_TS_BASE	(MVSOC_DEVBUS_BASE + 0x82b0)
-#define ARMADAXP_TM_BASE	(MVSOC_DEVBUS_BASE + 0x84c0)
-#define ARMADA370_TM_BASE	(MVSOC_DEVBUS_BASE + 0x8300)
-
-/*
- * Power Management Unit Registers
- *//* NS16550 compatible */
-#define ARMADAXP_PMU_BASE	(MVSOC_DEVBUS_BASE + 0xc000)
-
-/*
  * Miscellanseous Register
  */
 #define	ARMADAXP_MISC_BASE	(MVSOC_DEVBUS_BASE + 0x8200)
@@ -303,7 +292,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #define	ARMADAXP_MISC_SSRR		0x64	/* System Soft Reset Register */
 #define	ARMADAXP_MISC_SSRR_GLOBALSOFTRST	(1 << 0)
 
+/*
+ * Thermal Sensor and Thermal Managemer
+ */
+#define ARMADAXP_TS_BASE	(MVSOC_DEVBUS_BASE + 0x82b0)
+#define ARMADAXP_TM_BASE	(MVSOC_DEVBUS_BASE + 0x84c0)
+#define ARMADA370_TM_BASE	(MVSOC_DEVBUS_BASE + 0x8300)
+
 /* Multiprocessor Interrupt Controller Registers */
+#define ARMADAXP_MLMB_CFUCONFIG		  0x228
+#define ARMADAXP_MLMB_CFUCONFIG_POUTOSL2	(1 << 18)
+#define ARMADAXP_MLMB_CFUCONFIG_POCTOSL2	(1 << 18)
+
 #define	ARMADAXP_MLMB_MPIC_BASE			0x20a00
 #define	ARMADAXP_MLMB_MPIC_CPU_BASE		0x21800
 #define	ARMADAXP_MLMB_MPIC_CTRL			0x0
@@ -416,7 +416,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #define ARMADAXP_USB1_BASE	(ARMADAXP_USB_BASE + 0x1000)
 #define ARMADAXP_USB2_BASE	(ARMADAXP_USB_BASE + 0x2000)
 
-/* 
+/*
  * XOR Engine Registers
  */
 #define ARMADAXP_XORE0_BASE	(UNITID2PHYS(XORE0))	/* 0x6 */
@@ -435,7 +435,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  */
 #define ARMADAXP_PTP_BASE	(UNITID2PHYS(GBE0))	/* 0x7c000 */
 
-/* 
+/*
  * Cryptographic Engine and Security Accelerator Registers
  */
 #define ARMADAXP_CESA0_BASE	(UNITID2PHYS(CRYPT) + 0xd000)	/* 0x9d000 */



CVS commit: src/sys/arch/arm/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:47:33 UTC 2017

Modified Files:
src/sys/arch/arm/marvell: armadaxpreg.h

Log Message:
Add register macros.
And reorder registers.
Also remove white-spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/marvell/armadaxpreg.h

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



CVS commit: src/sys/arch/arm/arm

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:22:11 UTC 2017

Modified Files:
src/sys/arch/arm/arm: cpufunc_asm_pj4b.S

Log Message:
Add a white-space into comment and `*/'.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/arm/cpufunc_asm_pj4b.S

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



CVS commit: src/sys/arch/arm/arm

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:22:11 UTC 2017

Modified Files:
src/sys/arch/arm/arm: cpufunc_asm_pj4b.S

Log Message:
Add a white-space into comment and `*/'.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/arm/cpufunc_asm_pj4b.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/arm/arm/cpufunc_asm_pj4b.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_pj4b.S:1.11 src/sys/arch/arm/arm/cpufunc_asm_pj4b.S:1.12
--- src/sys/arch/arm/arm/cpufunc_asm_pj4b.S:1.11	Wed May 20 02:59:57 2015
+++ src/sys/arch/arm/arm/cpufunc_asm_pj4b.S	Sat Jan  7 15:22:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc_asm_pj4b.S,v 1.11 2015/05/20 02:59:57 hsuenaga Exp $ */
+/*	$NetBSD: cpufunc_asm_pj4b.S,v 1.12 2017/01/07 15:22:11 kiyohara Exp $ */
 
 /***
 Copyright (C) Marvell International Ltd. and its affiliates
@@ -43,7 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 
 #define MV_FMC0_SMP		(1 << 1) /* SMP/nAMP enable */
 #define MV_FMC0_PARITY		(1 << 2) /* Enable L1 Cache Parity */
-#define MV_FMC0_LFDIS		(1 << 7) /* Disable DC Speculative linefill*/
+#define MV_FMC0_LFDIS		(1 << 7) /* Disable DC Speculative linefill */
 #define MV_FMC0_FW		(1 << 8) /* Cache & TLB maintenance broadcast */
 
 #define MPIDR_CPUID_MASK	(0x3 << 0) /* CPUID */



CVS commit: src/sys/arch/arm/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:14:20 UTC 2017

Modified Files:
src/sys/arch/arm/marvell: mvsoctmr.c

Log Message:
Change to a tab from white-spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/marvell/mvsoctmr.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/marvell/mvsoctmr.c
diff -u src/sys/arch/arm/marvell/mvsoctmr.c:1.13 src/sys/arch/arm/marvell/mvsoctmr.c:1.14
--- src/sys/arch/arm/marvell/mvsoctmr.c:1.13	Sat Mar 15 10:44:10 2014
+++ src/sys/arch/arm/marvell/mvsoctmr.c	Sat Jan  7 15:14:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsoctmr.c,v 1.13 2014/03/15 10:44:10 kiyohara Exp $	*/
+/*	$NetBSD: mvsoctmr.c,v 1.14 2017/01/07 15:14:20 kiyohara Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v 1.13 2014/03/15 10:44:10 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v 1.14 2017/01/07 15:14:20 kiyohara Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mvsoc.h"
@@ -134,7 +134,7 @@ mvsoctmr_match(device_t parent, struct c
 static void
 mvsoctmr_attach(device_t parent, device_t self, void *aux)
 {
-struct mvsoctmr_softc *sc = device_private(self);
+	struct mvsoctmr_softc *sc = device_private(self);
 	struct marvell_attach_args *mva = aux;
 	uint32_t rstoutn;
 



CVS commit: src/sys/arch/arm/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:14:20 UTC 2017

Modified Files:
src/sys/arch/arm/marvell: mvsoctmr.c

Log Message:
Change to a tab from white-spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/marvell/mvsoctmr.c

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



CVS commit: src/sys/dev/sdmmc

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:05:08 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdhc.c sdhcvar.h

Log Message:
Add flags SDHC_FLAG_NO_AUTO_STOP and SDHC_FLAG_NO_BUSY_INTR.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sdmmc/sdhcvar.h

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



CVS commit: src/sys/dev/sdmmc

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:05:08 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdhc.c sdhcvar.h

Log Message:
Add flags SDHC_FLAG_NO_AUTO_STOP and SDHC_FLAG_NO_BUSY_INTR.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sdmmc/sdhcvar.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/dev/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.96 src/sys/dev/sdmmc/sdhc.c:1.97
--- src/sys/dev/sdmmc/sdhc.c:1.96	Sat Jan  7 15:00:38 2017
+++ src/sys/dev/sdmmc/sdhc.c	Sat Jan  7 15:05:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.96 2017/01/07 15:00:38 kiyohara Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.97 2017/01/07 15:05:08 kiyohara Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.96 2017/01/07 15:00:38 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.97 2017/01/07 15:05:08 kiyohara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -595,7 +595,9 @@ adma_done:
 		saa.saa_clkmin = hp->clkbase / 0x3ff;
 	else
 		saa.saa_clkmin = hp->clkbase / 256;
-	saa.saa_caps = SMC_CAPS_4BIT_MODE|SMC_CAPS_AUTO_STOP;
+	if (!ISSET(sc->sc_flags, SDHC_FLAG_NO_AUTO_STOP))
+		saa.saa_caps |= SMC_CAPS_AUTO_STOP;
+	saa.saa_caps |= SMC_CAPS_4BIT_MODE;
 	if (ISSET(sc->sc_flags, SDHC_FLAG_8BIT_MODE))
 		saa.saa_caps |= SMC_CAPS_8BIT_MODE;
 	if (ISSET(caps, SDHC_HIGH_SPEED_SUPP))
@@ -1572,7 +1574,8 @@ sdhc_exec_command(sdmmc_chipset_handle_t
 	if (cmd->c_error == 0 && cmd->c_data != NULL)
 		sdhc_transfer_data(hp, cmd);
 	else if (ISSET(cmd->c_flags, SCF_RSP_BSY)) {
-		if (!sdhc_wait_intr(hp, SDHC_TRANSFER_COMPLETE, hz * 10, false)) {
+		if (!ISSET(hp->sc->sc_flags, SDHC_FLAG_NO_BUSY_INTR) &&
+		!sdhc_wait_intr(hp, SDHC_TRANSFER_COMPLETE, hz * 10, false)) {
 			DPRINTF(1,("%s: sdhc_exec_command: RSP_BSY\n",
 			HDEVNAME(hp)));
 			cmd->c_error = ETIMEDOUT;
@@ -1588,6 +1591,10 @@ out:
 	}
 	SET(cmd->c_flags, SCF_ITSDONE);
 
+	if (ISSET(hp->sc->sc_flags, SDHC_FLAG_NO_AUTO_STOP) &&
+	cmd->c_opcode == MMC_STOP_TRANSMISSION)
+		(void)sdhc_soft_reset(hp, SDHC_RESET_CMD|SDHC_RESET_DAT);
+
 	mutex_exit(>intr_lock);
 
 	DPRINTF(1,("%s: cmd %d %s (flags=%08x error=%d)\n", HDEVNAME(hp),
@@ -1642,7 +1649,8 @@ sdhc_start_command(struct sdhc_host *hp,
 	if (blkcount > 1) {
 		mode |= SDHC_MULTI_BLOCK_MODE;
 		/* XXX only for memory commands? */
-		mode |= SDHC_AUTO_CMD12_ENABLE;
+		if (!ISSET(sc->sc_flags, SDHC_FLAG_NO_AUTO_STOP))
+			mode |= SDHC_AUTO_CMD12_ENABLE;
 	}
 	if (cmd->c_dmamap != NULL && cmd->c_datalen > 0 &&
 	ISSET(hp->flags,  SHF_MODE_DMAEN)) {

Index: src/sys/dev/sdmmc/sdhcvar.h
diff -u src/sys/dev/sdmmc/sdhcvar.h:1.26 src/sys/dev/sdmmc/sdhcvar.h:1.27
--- src/sys/dev/sdmmc/sdhcvar.h:1.26	Thu Dec 31 11:53:19 2015
+++ src/sys/dev/sdmmc/sdhcvar.h	Sat Jan  7 15:05:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhcvar.h,v 1.26 2015/12/31 11:53:19 ryo Exp $	*/
+/*	$NetBSD: sdhcvar.h,v 1.27 2017/01/07 15:05:08 kiyohara Exp $	*/
 /*	$OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $	*/
 
 /*
@@ -59,6 +59,8 @@ struct sdhc_softc {
 #define	SDHC_FLAG_POLL_CARD_DET	0x0020 /* polling card detect */
 #define	SDHC_FLAG_SLOW_SDR50  	0x0040 /* reduce SDR50 speed */
 #define	SDHC_FLAG_USDHC		0x0080 /* Freescale uSDHC */
+#define	SDHC_FLAG_NO_AUTO_STOP	0x0100 /* No auto CMD12 */
+#define	SDHC_FLAG_NO_BUSY_INTR	0x0200 /* No intr when RESP_BUSY */
 
 	uint32_t		sc_clkbase;
 	int			sc_clkmsk;	/* Mask for SDCLK */



CVS commit: src/sys/dev/sdmmc

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:00:38 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdhc.c

Log Message:
Don't access SDHC_HOST_CTL_VERSION, if iosize less than this.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/sdmmc/sdhc.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/dev/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.95 src/sys/dev/sdmmc/sdhc.c:1.96
--- src/sys/dev/sdmmc/sdhc.c:1.95	Wed Aug 10 04:24:17 2016
+++ src/sys/dev/sdmmc/sdhc.c	Sat Jan  7 15:00:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.95 2016/08/10 04:24:17 nonaka Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.96 2017/01/07 15:00:38 kiyohara Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.95 2016/08/10 04:24:17 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.96 2017/01/07 15:00:38 kiyohara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -290,38 +290,42 @@ sdhc_host_found(struct sdhc_softc *sc, b
 	callout_init(>tuning_timer, CALLOUT_MPSAFE);
 	callout_setfunc(>tuning_timer, sdhc_tuning_timer, hp);
 
-	if (ISSET(hp->sc->sc_flags, SDHC_FLAG_USDHC)) {
-		sdhcver = SDHC_SPEC_VERS_300 << SDHC_SPEC_VERS_SHIFT;
-	} else if (ISSET(hp->sc->sc_flags, SDHC_FLAG_ENHANCED)) {
-		sdhcver = HREAD4(hp, SDHC_ESDHC_HOST_CTL_VERSION);
+	if (iosize <= SDHC_HOST_CTL_VERSION) {
+		aprint_normal_dev(sc->sc_dev, "SDHC NO-VERS");
+		hp->specver = -1;
 	} else {
-		sdhcver = HREAD2(hp, SDHC_HOST_CTL_VERSION);
-	}
-	aprint_normal_dev(sc->sc_dev, "SDHC ");
-	hp->specver = SDHC_SPEC_VERSION(sdhcver);
-	switch (SDHC_SPEC_VERSION(sdhcver)) {
-	case SDHC_SPEC_VERS_100:
-		aprint_normal("1.0");
-		break;
+		if (ISSET(hp->sc->sc_flags, SDHC_FLAG_USDHC)) {
+			sdhcver = SDHC_SPEC_VERS_300 << SDHC_SPEC_VERS_SHIFT;
+		} else if (ISSET(hp->sc->sc_flags, SDHC_FLAG_ENHANCED)) {
+			sdhcver = HREAD4(hp, SDHC_ESDHC_HOST_CTL_VERSION);
+		} else
+			sdhcver = HREAD2(hp, SDHC_HOST_CTL_VERSION);
+		aprint_normal_dev(sc->sc_dev, "SDHC ");
+		hp->specver = SDHC_SPEC_VERSION(sdhcver);
+		switch (SDHC_SPEC_VERSION(sdhcver)) {
+		case SDHC_SPEC_VERS_100:
+			aprint_normal("1.0");
+			break;
 
-	case SDHC_SPEC_VERS_200:
-		aprint_normal("2.0");
-		break;
+		case SDHC_SPEC_VERS_200:
+			aprint_normal("2.0");
+			break;
 
-	case SDHC_SPEC_VERS_300:
-		aprint_normal("3.0");
-		break;
+		case SDHC_SPEC_VERS_300:
+			aprint_normal("3.0");
+			break;
 
-	case SDHC_SPEC_VERS_400:
-		aprint_normal("4.0");
-		break;
+		case SDHC_SPEC_VERS_400:
+			aprint_normal("4.0");
+			break;
 
-	default:
-		aprint_normal("unknown version(0x%x)",
-		SDHC_SPEC_VERSION(sdhcver));
-		break;
+		default:
+			aprint_normal("unknown version(0x%x)",
+			SDHC_SPEC_VERSION(sdhcver));
+			break;
+		}
+		aprint_normal(", rev %u", SDHC_VENDOR_VERSION(sdhcver));
 	}
-	aprint_normal(", rev %u", SDHC_VENDOR_VERSION(sdhcver));
 
 	/*
 	 * Reset the host controller and enable interrupts.



CVS commit: src/sys/dev/sdmmc

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 15:00:38 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdhc.c

Log Message:
Don't access SDHC_HOST_CTL_VERSION, if iosize less than this.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/sdmmc/sdhc.c

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



CVS commit: src/sys/dev/sdmmc

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:49:53 UTC 2017

Modified Files:
src/sys/dev/sdmmc: ld_sdmmc.c

Log Message:
Support retry when error.  like wd(4).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sdmmc/ld_sdmmc.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/dev/sdmmc/ld_sdmmc.c
diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.23 src/sys/dev/sdmmc/ld_sdmmc.c:1.24
--- src/sys/dev/sdmmc/ld_sdmmc.c:1.23	Tue Sep 27 03:33:33 2016
+++ src/sys/dev/sdmmc/ld_sdmmc.c	Sat Jan  7 14:49:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_sdmmc.c,v 1.23 2016/09/27 03:33:33 pgoyette Exp $	*/
+/*	$NetBSD: ld_sdmmc.c,v 1.24 2017/01/07 14:49:53 kiyohara Exp $	*/
 
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.23 2016/09/27 03:33:33 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.24 2017/01/07 14:49:53 kiyohara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -59,6 +59,9 @@ __KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v
 #define DPRINTF(s)	/**/
 #endif
 
+#define	LD_SDMMC_IORETRIES	5	/* number of retries before giving up */
+#define	RECOVERYTIME		hz/2	/* time to wait before retrying a cmd */
+
 struct ld_sdmmc_softc;
 
 struct ld_sdmmc_task {
@@ -66,6 +69,8 @@ struct ld_sdmmc_task {
 
 	struct ld_sdmmc_softc *task_sc;
 	struct buf *task_bp;
+	int task_retries; /* number of xfer retry */
+	struct callout task_restart_ch;
 };
 
 struct ld_sdmmc_softc {
@@ -75,7 +80,7 @@ struct ld_sdmmc_softc {
 	struct sdmmc_function *sc_sf;
 #define LD_SDMMC_MAXQUEUECNT 4
 	struct ld_sdmmc_task sc_task[LD_SDMMC_MAXQUEUECNT];
-	int sc_nexttask;
+	TAILQ_HEAD(, sdmmc_task) sc_freeq;
 };
 
 static int ld_sdmmc_match(device_t, cfdata_t, void *);
@@ -84,6 +89,7 @@ static int ld_sdmmc_detach(device_t, int
 
 static int ld_sdmmc_dump(struct ld_softc *, void *, int, int);
 static int ld_sdmmc_start(struct ld_softc *, struct buf *);
+static void ld_sdmmc_restart(void *);
 
 static void ld_sdmmc_doattach(void *);
 static void ld_sdmmc_dobio(void *);
@@ -110,7 +116,9 @@ ld_sdmmc_attach(device_t parent, device_
 	struct ld_sdmmc_softc *sc = device_private(self);
 	struct sdmmc_attach_args *sa = aux;
 	struct ld_softc *ld = >sc_ld;
+	struct ld_sdmmc_task *task;
 	struct lwp *lwp;
+	int i;
 
 	ld->sc_dv = self;
 
@@ -119,7 +127,13 @@ ld_sdmmc_attach(device_t parent, device_
 	sa->sf->cid.rev, sa->sf->cid.psn, sa->sf->cid.mdt);
 	aprint_naive("\n");
 
-	sc->sc_nexttask = 0;
+	TAILQ_INIT(>sc_freeq);
+	for (i = 0; i < __arraycount(sc->sc_task); i++) {
+		task = >sc_task[i];
+		task->task_sc = sc;
+		callout_init(>task_restart_ch, 0);
+		TAILQ_INSERT_TAIL(>sc_freeq, >task, next);
+	}
 
 	sc->sc_hwunit = 0;	/* always 0? */
 	sc->sc_sf = sa->sf;
@@ -168,12 +182,15 @@ ld_sdmmc_detach(device_t dev, int flags)
 {
 	struct ld_sdmmc_softc *sc = device_private(dev);
 	struct ld_softc *ld = >sc_ld;
-	int rv;
+	int rv, i;
 
 	if ((rv = ldbegindetach(ld, flags)) != 0)
 		return rv;
 	ldenddetach(ld);
 
+	for (i = 0; i < __arraycount(sc->sc_task); i++)
+		callout_destroy(>sc_task[i].task_restart_ch);
+
 	return 0;
 }
 
@@ -181,12 +198,12 @@ static int
 ld_sdmmc_start(struct ld_softc *ld, struct buf *bp)
 {
 	struct ld_sdmmc_softc *sc = device_private(ld->sc_dv);
-	struct ld_sdmmc_task *task = >sc_task[sc->sc_nexttask];
+	struct ld_sdmmc_task *task = (void *)TAILQ_FIRST(>sc_freeq);
 
-	sc->sc_nexttask = (sc->sc_nexttask + 1) % LD_SDMMC_MAXQUEUECNT;
+	TAILQ_REMOVE(>sc_freeq, >task, next);
 
-	task->task_sc = sc;
 	task->task_bp = bp;
+	task->task_retries = 0;
 	sdmmc_init_task(>task, ld_sdmmc_dobio, task);
 
 	sdmmc_add_task(sc->sc_sf->sc, >task);
@@ -195,6 +212,18 @@ ld_sdmmc_start(struct ld_softc *ld, stru
 }
 
 static void
+ld_sdmmc_restart(void *arg)
+{
+	struct ld_sdmmc_task *task = (struct ld_sdmmc_task *)arg;
+	struct ld_sdmmc_softc *sc = task->task_sc;
+	struct buf *bp = task->task_bp;
+
+	bp->b_resid = bp->b_bcount;
+
+	sdmmc_add_task(sc->sc_sf->sc, >task);
+}
+
+static void
 ld_sdmmc_dobio(void *arg)
 {
 	struct ld_sdmmc_task *task = (struct ld_sdmmc_task *)arg;
@@ -228,14 +257,26 @@ ld_sdmmc_dobio(void *arg)
 		error = sdmmc_mem_write_block(sc->sc_sf, bp->b_rawblkno,
 		bp->b_data, bp->b_bcount);
 	if (error) {
-		DPRINTF(("%s: error %d\n", device_xname(sc->sc_ld.sc_dv),
-		error));
+		if (task->task_retries < LD_SDMMC_IORETRIES) {
+			struct dk_softc *dksc = >sc_ld.sc_dksc;
+			struct cfdriver *cd = device_cfdriver(dksc->sc_dev);
+
+			diskerr(bp, cd->cd_name, "error", LOG_PRINTF, 0,
+dksc->sc_dkdev.dk_label);
+			printf(", retrying\n");
+			task->t

CVS commit: src/sys/dev/sdmmc

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:49:53 UTC 2017

Modified Files:
src/sys/dev/sdmmc: ld_sdmmc.c

Log Message:
Support retry when error.  like wd(4).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sdmmc/ld_sdmmc.c

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



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:44:26 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmac.c

Log Message:
Support Marvell Dove.  Use irq array.  Dove's irqs not sequencial.
And remove debug printf().


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/marvell/gtidmac.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/dev/marvell/gtidmac.c
diff -u src/sys/dev/marvell/gtidmac.c:1.12 src/sys/dev/marvell/gtidmac.c:1.13
--- src/sys/dev/marvell/gtidmac.c:1.12	Sat Jan  7 14:36:51 2017
+++ src/sys/dev/marvell/gtidmac.c	Sat Jan  7 14:44:26 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $	*/
+/*	$NetBSD: gtidmac.c,v 1.13 2017/01/07 14:44:26 kiyohara Exp $	*/
 /*
- * Copyright (c) 2008, 2012 KIYOHARA Takashi
+ * Copyright (c) 2008, 2012, 2016 KIYOHARA Takashi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.13 2017/01/07 14:44:26 kiyohara Exp $");
 
 #include 
 #include 
@@ -276,24 +276,30 @@ static const struct dmover_algdesc mvxor
 	},
 };
 
+static int orion_88f5182_xore_irqs[] = { 30, 31 };
+static int kirkwood_xore_irqs[] = { 5, 6, 7, 8 };
+static int dove_xore_irqs[] = { 39, 40, 42, 43 };
+static int armadaxp_xore_irqs0[] = { 51, 52 };
+static int armadaxp_xore_irqs1[] = { 94, 95 };
+
 static struct {
 	int model;
 	int idmac_nchan;
 	int idmac_irq;
 	int xore_nchan;
-	int xore_irq;
+	int *xore_irqs;
 } channels[] = {
 	/*
 	 * Marvell System Controllers:
 	 * need irqs in attach_args.
 	 */
-	{ MARVELL_DISCOVERY,		8, -1, 0, -1 },
-	{ MARVELL_DISCOVERY_II,		8, -1, 0, -1 },
-	{ MARVELL_DISCOVERY_III,	8, -1, 0, -1 },
+	{ MARVELL_DISCOVERY,		8, -1, 0, NULL },
+	{ MARVELL_DISCOVERY_II,		8, -1, 0, NULL },
+	{ MARVELL_DISCOVERY_III,	8, -1, 0, NULL },
 #if 0
-	{ MARVELL_DISCOVERY_LT,		4, -1, 2, -1 },
-	{ MARVELL_DISCOVERY_V,		4, -1, 2, -1 },
-	{ MARVELL_DISCOVERY_VI,		4, -1, 2, -1 },		
+	{ MARVELL_DISCOVERY_LT,		4, -1, 2, NULL },
+	{ MARVELL_DISCOVERY_V,		4, -1, 2, NULL },
+	{ MARVELL_DISCOVERY_VI,		4, -1, 2, NULL },		
 #endif
 
 	/*
@@ -301,28 +307,29 @@ static struct {
 	 * No need irqs in attach_args.  We always connecting to interrupt-pin
 	 * statically.
 	 */
-	{ MARVELL_ORION_1_88F1181,	4, 24, 0, -1 },
-	{ MARVELL_ORION_2_88F1281,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88F5082,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88F5180N,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88F5181,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88F5182,	4, 24, 2, 30 },
-	{ MARVELL_ORION_2_88F5281,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88W8660,	4, 24, 0, -1 },
-	{ MARVELL_KIRKWOOD_88F6180,	0, -1, 4, 5 },
-	{ MARVELL_KIRKWOOD_88F6192,	0, -1, 4, 5 },
-	{ MARVELL_KIRKWOOD_88F6281,	0, -1, 4, 5 },
-	{ MARVELL_KIRKWOOD_88F6282,	0, -1, 4, 5 },
-	{ MARVELL_ARMADAXP_MV78130,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78130,	0, -1, 2, 94 },
-	{ MARVELL_ARMADAXP_MV78160,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78160,	0, -1, 2, 94 },
-	{ MARVELL_ARMADAXP_MV78230,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78230,	0, -1, 2, 94 },
-	{ MARVELL_ARMADAXP_MV78260,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78260,	0, -1, 2, 94 },
-	{ MARVELL_ARMADAXP_MV78460,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78460,	0, -1, 2, 94 },
+	{ MARVELL_ORION_1_88F1181,	4, 24, 0, NULL },
+	{ MARVELL_ORION_2_88F1281,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88F5082,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88F5180N,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88F5181,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88F5182,	4, 24, 2, orion_88f5182_xore_irqs },
+	{ MARVELL_ORION_2_88F5281,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88W8660,	4, 24, 0, NULL },
+	{ MARVELL_KIRKWOOD_88F6180,	0, -1, 4, kirkwood_xore_irqs },
+	{ MARVELL_KIRKWOOD_88F6192,	0, -1, 4, kirkwood_xore_irqs },
+	{ MARVELL_KIRKWOOD_88F6281,	0, -1, 4, kirkwood_xore_irqs },
+	{ MARVELL_KIRKWOOD_88F6282,	0, -1, 4, kirkwood_xore_irqs },
+	{ MARVELL_DOVE_88AP510,		0, -1, 4, dove_xore_irqs },
+	{ MARVELL_ARMADAXP_MV78130,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78130,	0, -1, 2, armadaxp_xore_irqs1 },
+	{ MARVELL_ARMADAXP_MV78160,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78160,	0, -1, 2, armadaxp_xore_irqs1 },
+	{ MARVELL_ARMADAXP_MV78230,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78230,	0, -1, 2, armadaxp_xore_irqs1 },
+	{ MARVELL_ARMADAXP_MV78260,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78260,	0, -1, 2, armadaxp_xore_irqs1 },
+	{ MARVELL_ARMADAXP_MV78460,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78460,	0, -1, 2, armadaxp_xore_irqs1 },
 };
 
 struct gtidmac_winacctbl *gtidmac_winacctbl;
@@ -364,7 +371,7 @@ gtidmac_attach(device_t parent, device_t
 	stru

CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:44:26 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmac.c

Log Message:
Support Marvell Dove.  Use irq array.  Dove's irqs not sequencial.
And remove debug printf().


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/marvell/gtidmac.c

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



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:36:51 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmac.c gtidmacvar.h

Log Message:
Remove unused function.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/gtidmac.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/gtidmacvar.h

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



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:36:51 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmac.c gtidmacvar.h

Log Message:
Remove unused function.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/gtidmac.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/gtidmacvar.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/dev/marvell/gtidmac.c
diff -u src/sys/dev/marvell/gtidmac.c:1.11 src/sys/dev/marvell/gtidmac.c:1.12
--- src/sys/dev/marvell/gtidmac.c:1.11	Sat Mar 15 13:33:48 2014
+++ src/sys/dev/marvell/gtidmac.c	Sat Jan  7 14:36:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtidmac.c,v 1.11 2014/03/15 13:33:48 kiyohara Exp $	*/
+/*	$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008, 2012 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.11 2014/03/15 13:33:48 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $");
 
 #include 
 #include 
@@ -926,13 +926,6 @@ gtidmac_dmmap_unload(struct gtidmac_soft
 }
 
 
-void *
-gtidmac_tag_get(void)
-{
-
-	return gtidmac_softc;
-}
-
 /*
  * IDMAC functions
  */

Index: src/sys/dev/marvell/gtidmacvar.h
diff -u src/sys/dev/marvell/gtidmacvar.h:1.2 src/sys/dev/marvell/gtidmacvar.h:1.3
--- src/sys/dev/marvell/gtidmacvar.h:1.2	Sat Mar 15 13:33:48 2014
+++ src/sys/dev/marvell/gtidmacvar.h	Sat Jan  7 14:36:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtidmacvar.h,v 1.2 2014/03/15 13:33:48 kiyohara Exp $	*/
+/*	$NetBSD: gtidmacvar.h,v 1.3 2017/01/07 14:36:51 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008, 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -48,8 +48,6 @@ struct gtidmac_winacctbl {
 extern struct gtidmac_winacctbl *gtidmac_winacctbl;
 extern struct gtidmac_winacctbl *mvxore_winacctbl;
 
-void *gtidmac_tag_get(void);
-
 int gtidmac_chan_alloc(void *, bus_dmamap_t **, bus_dmamap_t **, void *);
 void gtidmac_chan_free(void *, int);
 int gtidmac_setup(void *, int, int, bus_dmamap_t *, bus_dmamap_t *, bus_size_t);



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:32:33 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmacreg.h

Log Message:
Fix macro MVXORE_CHAN2BASE().  The XORE has 2 channels per port.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/gtidmacreg.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/dev/marvell/gtidmacreg.h
diff -u src/sys/dev/marvell/gtidmacreg.h:1.3 src/sys/dev/marvell/gtidmacreg.h:1.4
--- src/sys/dev/marvell/gtidmacreg.h:1.3	Mon Jul 23 06:09:47 2012
+++ src/sys/dev/marvell/gtidmacreg.h	Sat Jan  7 14:32:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtidmacreg.h,v 1.3 2012/07/23 06:09:47 kiyohara Exp $	*/
+/*	$NetBSD: gtidmacreg.h,v 1.4 2017/01/07 14:32:32 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008, 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -51,7 +51,7 @@
 #define MVXORE_PORT2BASE(sc, p)	\
 (((sc)->sc_gtidmac_nchan == 0 && (p) == 0) ? -0x100 : 0x000)
 #define MVXORE_CHAN2BASE(sc, c)	\
-(MVXORE_PORT2BASE(sc, (c) & 0x4) + (((c) & 0x3) << 2))
+(MVXORE_PORT2BASE(sc, (c) & 0xe) + (((c) & 0x1) << 2))
 
 
 /* IDMA Descriptor Register Map */



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:32:33 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmacreg.h

Log Message:
Fix macro MVXORE_CHAN2BASE().  The XORE has 2 channels per port.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/gtidmacreg.h

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



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:26:37 UTC 2017

Modified Files:
src/sys/dev/marvell: marvellvar.h

Log Message:
Add tags for AXI_CS[01].


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/marvellvar.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/dev/marvell/marvellvar.h
diff -u src/sys/dev/marvell/marvellvar.h:1.5 src/sys/dev/marvell/marvellvar.h:1.6
--- src/sys/dev/marvell/marvellvar.h:1.5	Sat Mar 15 11:47:43 2014
+++ src/sys/dev/marvell/marvellvar.h	Sat Jan  7 14:26:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: marvellvar.h,v 1.5 2014/03/15 11:47:43 kiyohara Exp $	*/
+/*	$NetBSD: marvellvar.h,v 1.6 2017/01/07 14:26:37 kiyohara Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -34,6 +34,9 @@ enum marvell_tags {
 	MARVELL_TAG_SDRAM_CS2,
 	MARVELL_TAG_SDRAM_CS3,
 
+	MARVELL_TAG_AXI_CS0,	/* Advanced eXtensible Interface */
+	MARVELL_TAG_AXI_CS1,	/* Advanced eXtensible Interface */
+
 	MARVELL_TAG_DDR3_CS0,
 	MARVELL_TAG_DDR3_CS1,
 	MARVELL_TAG_DDR3_CS2,



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:26:37 UTC 2017

Modified Files:
src/sys/dev/marvell: marvellvar.h

Log Message:
Add tags for AXI_CS[01].


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/marvellvar.h

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



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:24:27 UTC 2017

Modified Files:
src/sys/dev/marvell: if_mvgbe.c mvsata_mv.c

Log Message:
Support Marvell Dove.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/mvsata_mv.c

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



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:24:27 UTC 2017

Modified Files:
src/sys/dev/marvell: if_mvgbe.c mvsata_mv.c

Log Message:
Support Marvell Dove.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/mvsata_mv.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/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.47 src/sys/dev/marvell/if_mvgbe.c:1.48
--- src/sys/dev/marvell/if_mvgbe.c:1.47	Thu Dec 15 09:28:05 2016
+++ src/sys/dev/marvell/if_mvgbe.c	Sat Jan  7 14:24:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.47 2016/12/15 09:28:05 ozaki-r Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.48 2017/01/07 14:24:27 kiyohara Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.47 2016/12/15 09:28:05 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.48 2017/01/07 14:24:27 kiyohara Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -367,6 +367,8 @@ struct mvgbe_port {
 	{ MARVELL_MV78XX0_MV78200,	2, 1, { 48 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
 	{ MARVELL_MV78XX0_MV78200,	3, 1, { 52 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
 
+	{ MARVELL_DOVE_88AP510,		0, 1, { 29 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+
 	{ MARVELL_ARMADAXP_MV78130,	0, 1, { 66 }, FLAGS_HAS_PV },
 	{ MARVELL_ARMADAXP_MV78130,	1, 1, { 70 }, FLAGS_HAS_PV },
 	{ MARVELL_ARMADAXP_MV78130,	2, 1, { 74 }, FLAGS_HAS_PV },

Index: src/sys/dev/marvell/mvsata_mv.c
diff -u src/sys/dev/marvell/mvsata_mv.c:1.7 src/sys/dev/marvell/mvsata_mv.c:1.8
--- src/sys/dev/marvell/mvsata_mv.c:1.7	Sat Mar 15 13:33:48 2014
+++ src/sys/dev/marvell/mvsata_mv.c	Sat Jan  7 14:24:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata_mv.c,v 1.7 2014/03/15 13:33:48 kiyohara Exp $	*/
+/*	$NetBSD: mvsata_mv.c,v 1.8 2017/01/07 14:24:27 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.7 2014/03/15 13:33:48 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.8 2017/01/07 14:24:27 kiyohara Exp $");
 
 #include 
 #include 
@@ -99,6 +99,9 @@ struct mvsata_product mvsata_products[] 
 	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78100, 1, 2, gen2e, 0 },
 	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78200, 1, 2, gen2e, 0 },
 
+	/* Dove */
+	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88AP510, 1, 1, gen2e, 0 },
+
 	/* Armada XP */
 	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78130, 1, 2, gen2e, 0 },
 	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78160, 1, 2, gen2e, 0 },



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:19:45 UTC 2017

Modified Files:
src/sys/dev/marvell: mvspireg.h

Log Message:
Change MVSPI_SIZE to 0x80 instead of 0x50.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvspireg.h

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



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:19:45 UTC 2017

Modified Files:
src/sys/dev/marvell: mvspireg.h

Log Message:
Change MVSPI_SIZE to 0x80 instead of 0x50.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvspireg.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/dev/marvell/mvspireg.h
diff -u src/sys/dev/marvell/mvspireg.h:1.2 src/sys/dev/marvell/mvspireg.h:1.3
--- src/sys/dev/marvell/mvspireg.h:1.2	Mon May 13 15:47:18 2013
+++ src/sys/dev/marvell/mvspireg.h	Sat Jan  7 14:19:45 2017
@@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #ifndef _MVSPIREG_H_
 #define _MVSPIREG_H_
 
-#define		MVSPI_SIZE			0x50		/* Size of MVSPI */
+#define		MVSPI_SIZE			0x80		/* Size of MVSPI */
 
 /* Definition of registers */
 #define		MVSPI_CTRL_REG			0x00		/* MVSPI Control Register */



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

2016-10-19 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Oct 19 14:07:22 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c

Log Message:
Remove white spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbarm/gumstix/gumstix_machdep.c

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



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

2016-10-19 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Oct 19 14:07:22 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c

Log Message:
Remove white spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbarm/gumstix/gumstix_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/gumstix/gumstix_machdep.c
diff -u src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.55 src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.56
--- src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.55	Tue Oct 18 14:39:52 2016
+++ src/sys/arch/evbarm/gumstix/gumstix_machdep.c	Wed Oct 19 14:07:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstix_machdep.c,v 1.55 2016/10/18 14:39:52 kiyohara Exp $ */
+/*	$NetBSD: gumstix_machdep.c,v 1.56 2016/10/19 14:07:22 kiyohara Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007  WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -583,7 +583,7 @@ initarm(void *arg)
 #ifdef MULTIPROCESSOR
 	if (bus_space_map(iot, OMAP4_SCU_BASE, SCU_SIZE, 0, ) != 0)
 		panic("OMAP4_SCU_BASE map failed\n");
-arm_cpu_max =
+	arm_cpu_max =
 	1 + (bus_space_read_4(iot, ioh, SCU_CFG) & SCU_CFG_CPUMAX);
 #endif
 #endif
@@ -1067,7 +1067,7 @@ gumstix_device_register(device_t dev, vo
 			 * 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
-			 * regisers (which armperiph uses). 
+			 * regisers (which armperiph uses).
 			 */
 			struct mainbus_attach_args * const mb = aux;
 			mb->mb_iot = _bs_tag;



CVS commit: src/sys/arch

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 15:10:35 UTC 2016

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

Log Message:
Move set_mpu_volt() from */*_machdep.c to am335x_prcm.c.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/am335x_prcm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/am335x_prcm.h
cvs rdiff -u -r1.65 -r1.66 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.



CVS commit: src/sys/arch

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 15:10:35 UTC 2016

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

Log Message:
Move set_mpu_volt() from */*_machdep.c to am335x_prcm.c.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/am335x_prcm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/am335x_prcm.h
cvs rdiff -u -r1.65 -r1.66 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/arm/omap/am335x_prcm.c
diff -u src/sys/arch/arm/omap/am335x_prcm.c:1.8 src/sys/arch/arm/omap/am335x_prcm.c:1.9
--- src/sys/arch/arm/omap/am335x_prcm.c:1.8	Tue Sep 30 11:34:07 2014
+++ src/sys/arch/arm/omap/am335x_prcm.c	Tue Oct 18 15:10:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: am335x_prcm.c,v 1.8 2014/09/30 11:34:07 jmcneill Exp $	*/
+/*	$NetBSD: am335x_prcm.c,v 1.9 2016/10/18 15:10:35 kiyohara Exp $	*/
 
 /*
  * TI OMAP Power, Reset, and Clock Management on the AM335x
@@ -34,10 +34,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.8 2014/09/30 11:34:07 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.9 2016/10/18 15:10:35 kiyohara Exp $");
+
+#include "tps65217pmic.h"
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -46,6 +49,8 @@ __KERNEL_RCSID(0, "$NetBSD: am335x_prcm.
 #include 
 #include 
 
+#include 
+
 #define AM335X_CLKCTRL_MODULEMODE_MASK		__BITS(0, 1)
 #define   AM335X_CLKCTRL_MODULEMODE_DISABLED	0
 #define   AM335X_CLKCTRL_MODULEMODE_ENABLE	2
@@ -161,6 +166,25 @@ prcm_mpu_pll_config(u_int mpupll_m)
 	}
 }
 
+const char *mpu_supply = NULL;
+static int
+set_mpu_volt(int mvolt)
+{
+	device_t dev;
+
+	__USE(dev);	// Simpler than complex ifdef.
+
+	if (mpu_supply == NULL)
+		return ENODEV;
+
+#if NTPS65217PMIC > 0
+	dev = device_find_by_xname("tps65217pmic0");
+	if (dev != NULL)
+		return tps65217pmic_set_volt(dev, mpu_supply, mvolt);
+#endif
+	return ENODEV;
+}
+
 static int
 mpu_current_frequency_sysctl_helper(SYSCTLFN_ARGS)
 {

Index: src/sys/arch/arm/omap/am335x_prcm.h
diff -u src/sys/arch/arm/omap/am335x_prcm.h:1.9 src/sys/arch/arm/omap/am335x_prcm.h:1.10
--- src/sys/arch/arm/omap/am335x_prcm.h:1.9	Sat Jun  6 14:00:32 2015
+++ src/sys/arch/arm/omap/am335x_prcm.h	Tue Oct 18 15:10:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: am335x_prcm.h,v 1.9 2015/06/06 14:00:32 jmcneill Exp $	*/
+/*	$NetBSD: am335x_prcm.h,v 1.10 2016/10/18 15:10:35 kiyohara Exp $	*/
 
 /*
  * TI OMAP Power, Reset, and Clock Management on the AM335x
@@ -150,7 +150,6 @@ struct omap_module {
 #define RST_GLOBAL_COLD_SW	__BIT(1)
 
 #ifdef _KERNEL
-int  set_mpu_volt(int);
 void am335x_sys_clk(bus_space_handle_t);
 void am335x_cpu_clk(void);
 #endif

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.65 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.66
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.65	Tue Oct 18 14:39:52 2016
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Oct 18 15:10:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.65 2016/10/18 14:39:52 kiyohara Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.66 2016/10/18 15:10:35 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.65 2016/10/18 14:39:52 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.66 2016/10/18 15:10:35 kiyohara Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -141,7 +141,6 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #include "sdhc.h"
 #include "ukbd.h"
 #include "arml2cc.h"
-#include "tps65217pmic.h"
 
 #include 
 #include 
@@ -191,7 +190,6 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 # endif
 # include 
 # include 
-# include 
 # if NSDHC > 0
 #  include 
 #  include 
@@ -241,9 +239,6 @@ int use_fb_console = true;
 #ifdef CPU_CORTEXA15
 uint32_t omap5_cnt_frq;
 #endif
-#if defined(TI_AM335X)
-device_t pmic_dev = NULL;
-#endif
 
 /*
  * Macros to translate between physical and virtual for a subset of the
@@ -1153,24 +1148,9 @@ beagle_device_register(device_t self, vo
 	}
 #if defined(TI_AM335X)
 	if (device_is_a(self, "tps65217pmic")) {
-		pmic_dev = self;
-	}
-#endif
-}
-
-#if defined(TI_AM335X)
-int
-set_mpu_volt(int mvolt)
-{
-
-#if NTPS65217PMIC > 0
-	if (pmic_dev == NULL)
-		return ENODEV;
+		extern const char *mpu_supply;
 
-	/* MPU voltage is on vdcd2 */
-	return tps65217pmic_set_volt(pmic_dev, "DCDC2", mvolt);
-#else
-	return -1;
+		mpu_supply = "DCDC2";
+	}
 #endif
 }
-#endif



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

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:48:11 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: VTC100

Log Message:
Remove intrbase and intr from omapgpio.


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

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/conf/VTC100
diff -u src/sys/arch/evbarm/conf/VTC100:1.9 src/sys/arch/evbarm/conf/VTC100:1.10
--- src/sys/arch/evbarm/conf/VTC100:1.9	Tue Oct 18 14:45:05 2016
+++ src/sys/arch/evbarm/conf/VTC100	Tue Oct 18 14:48:11 2016
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: VTC100,v 1.9 2016/10/18 14:45:05 kiyohara Exp $
+#	$NetBSD: VTC100,v 1.10 2016/10/18 14:48:11 kiyohara Exp $
 #
 #	VTC100 -- NEXCOM VTC100 Kernel
 #
@@ -198,13 +198,13 @@ ld*		at sdmmc?
 #options SDHC_DEBUG
 
 # General-purpose I/O pins
-omapgpio0	at obio0 addr 0x44e07000 size 0x1000 # intrbase 128 intr 29
+omapgpio0	at obio0 addr 0x44e07000 size 0x1000
 gpio0		at omapgpio0
-omapgpio1	at obio1 addr 0x4804c000 size 0x1000 # intrbase 160 intr 30
+omapgpio1	at obio1 addr 0x4804c000 size 0x1000
 gpio1		at omapgpio1
-omapgpio2	at obio1 addr 0x481ac000 size 0x1000 # intrbase 192 intr 32
+omapgpio2	at obio1 addr 0x481ac000 size 0x1000
 gpio2		at omapgpio2
-omapgpio3	at obio1 addr 0x481ae000 size 0x1000 # intrbase 224 intr 32
+omapgpio3	at obio1 addr 0x481ae000 size 0x1000
 gpio3		at omapgpio3
 
 # I2C Controller



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

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:48:11 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: VTC100

Log Message:
Remove intrbase and intr from omapgpio.


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

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



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

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:47:14 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: PEPPER

Log Message:
Enable tifb and wsdisplay.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/PEPPER

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/conf/PEPPER
diff -u src/sys/arch/evbarm/conf/PEPPER:1.1 src/sys/arch/evbarm/conf/PEPPER:1.2
--- src/sys/arch/evbarm/conf/PEPPER:1.1	Sat Oct 15 15:29:51 2016
+++ src/sys/arch/evbarm/conf/PEPPER	Tue Oct 18 14:47:14 2016
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: PEPPER,v 1.1 2016/10/15 15:29:51 kiyohara Exp $
+#	$NetBSD: PEPPER,v 1.2 2016/10/18 14:47:14 kiyohara Exp $
 #
 #	PEPPER -- Gumstix. Inc. Pepper Single Board Computer platforms kernel
 #
@@ -261,24 +261,24 @@ omapwdt32k*	at obio0 addr 0x44e35000 siz
 trng*		at obio1 addr 0x4831 size 0x2000 intr 111	# TRNG
 
 # onboard video, experimental. Video mode is hardcoded in the driver
-#tifb* 	at obio1 addr 0x4830e000 size 0x1000 intr 36
+tifb* 	at obio1 addr 0x4830e000 size 0x1000 intr 36
 
 # make sure the console display is always wsdisplay0
-#wsdisplay*	at wsemuldisplaydev?
+wsdisplay*	at wsemuldisplaydev?
 
 # various options for wscons - we try to look as much like a standard
 # sun console as possible
-#options 	WSEMUL_VT100
-#options 	WSDISPLAY_COMPAT_PCVT
-#options 	WSDISPLAY_COMPAT_SYSCONS
-#options 	WSDISPLAY_COMPAT_USL
-#options 	WSDISPLAY_SCROLLSUPPORT
-#options 	WS_KERNEL_FG=WSCOL_GREEN
-#options 	WSDISPLAY_DEFAULTSCREENS=4
-#options 	FONT_GALLANT12x22
-#options 	FONT_BOLD8x16
+options 	WSEMUL_VT100
+options 	WSDISPLAY_COMPAT_PCVT
+options 	WSDISPLAY_COMPAT_SYSCONS
+options 	WSDISPLAY_COMPAT_USL
+options 	WSDISPLAY_SCROLLSUPPORT
+options 	WS_KERNEL_FG=WSCOL_GREEN
+options 	WSDISPLAY_DEFAULTSCREENS=4
+options 	FONT_GALLANT12x22
+options 	FONT_BOLD8x16
 # compatibility to other console drivers
-#options 	WSDISPLAY_COMPAT_RAWKBD 	# can get raw scancodes
+options 	WSDISPLAY_COMPAT_RAWKBD 	# can get raw scancodes
 
 # Ethernet
 cpsw*		at obio2 addr 0x4a10 size 0x8000 intrbase 40



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

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:47:14 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: PEPPER

Log Message:
Enable tifb and wsdisplay.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/PEPPER

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



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

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:45:05 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: VTC100

Log Message:
Enable tifb and wsdisplay.


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

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/conf/VTC100
diff -u src/sys/arch/evbarm/conf/VTC100:1.8 src/sys/arch/evbarm/conf/VTC100:1.9
--- src/sys/arch/evbarm/conf/VTC100:1.8	Sat Oct 15 15:24:00 2016
+++ src/sys/arch/evbarm/conf/VTC100	Tue Oct 18 14:45:05 2016
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: VTC100,v 1.8 2016/10/15 15:24:00 kiyohara Exp $
+#	$NetBSD: VTC100,v 1.9 2016/10/18 14:45:05 kiyohara Exp $
 #
 #	VTC100 -- NEXCOM VTC100 Kernel
 #
@@ -241,24 +241,24 @@ omapdmtimer2	at obio1 addr 0x48044000 si
 omapwdt32k*	at obio0 addr 0x44e35000 size 0x1000	# WDT1
 
 # onboard video, experimental. Video mode is hardcoded in the driver
-#tifb* 		at obio1 addr 0x4830E000 size 0x1000 intr 36
+tifb* 		at obio1 addr 0x4830E000 size 0x1000 intr 36
 
 # make sure the console display is always wsdisplay0
-#wsdisplay*	at wsemuldisplaydev?
+wsdisplay*	at wsemuldisplaydev?
 
 # various options for wscons - we try to look as much like a standard
 # sun console as possible
-#options 	WSEMUL_VT100
-#options 	WSDISPLAY_COMPAT_PCVT
-#options 	WSDISPLAY_COMPAT_SYSCONS
-#options 	WSDISPLAY_COMPAT_USL
-#options 	WSDISPLAY_SCROLLSUPPORT
-#options 	WS_KERNEL_FG=WSCOL_GREEN
-#options 	WSDISPLAY_DEFAULTSCREENS=4
-#options 	FONT_GALLANT12x22
-#options 	FONT_BOLD8x16
+options 	WSEMUL_VT100
+options 	WSDISPLAY_COMPAT_PCVT
+options 	WSDISPLAY_COMPAT_SYSCONS
+options 	WSDISPLAY_COMPAT_USL
+options 	WSDISPLAY_SCROLLSUPPORT
+options 	WS_KERNEL_FG=WSCOL_GREEN
+options 	WSDISPLAY_DEFAULTSCREENS=4
+options 	FONT_GALLANT12x22
+options 	FONT_BOLD8x16
 # compatibility to other console drivers
-#options 	WSDISPLAY_COMPAT_RAWKBD 	# can get raw scancodes
+options 	WSDISPLAY_COMPAT_RAWKBD 	# can get raw scancodes
 
 pseudo-device	wsmux			# mouse & keyboard multiplexor
 pseudo-device	wsfont



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

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:45:05 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: VTC100

Log Message:
Enable tifb and wsdisplay.


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

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



CVS commit: src/sys/arch/evbarm

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:39:52 UTC 2016

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

Log Message:
Support tifb.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/gumstix/gxio.c

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



CVS commit: src/sys/arch/evbarm

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:39:52 UTC 2016

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

Log Message:
Support tifb.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/gumstix/gxio.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.64 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.65
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.64	Sun Jul  3 11:40:58 2016
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Tue Oct 18 14:39:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.64 2016/07/03 11:40:58 kiyohara Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.65 2016/10/18 14:39:52 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.64 2016/07/03 11:40:58 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.65 2016/10/18 14:39:52 kiyohara Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -190,6 +190,7 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machd
 #  error no prcm device configured.
 # endif
 # include 
+# include 
 # include 
 # if NSDHC > 0
 #  include 
@@ -497,7 +498,13 @@ initarm(void *arg)
 
 	/* The console is going to try to map things.  Give pmap a devmap. */
 	pmap_devmap_register(devmap);
+
+	if (get_bootconf_option(bootargs, "console",
+		BOOTOPT_TYPE_STRING, ) && strncmp(ptr, "fb", 2) == 0) {
+		use_fb_console = true;
+	}
 	consinit();
+
 #ifdef CPU_CORTEXA15
 #ifdef MULTIPROCESSOR
 	arm_cpu_max = 1 + __SHIFTOUT(armreg_l2ctrl_read(), L2CTRL_NUMCPU);
@@ -618,11 +625,6 @@ initarm(void *arg)
 
 	db_trap_callback = beagle_db_trap;
 
-	if (get_bootconf_option(boot_args, "console",
-		BOOTOPT_TYPE_STRING, ) && strncmp(ptr, "fb", 2) == 0) {
-		use_fb_console = true;
-	}
-	
 	return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0);
 
 }
@@ -688,7 +690,8 @@ consinit(void)
 #endif
 
 #if NUKBD > 0
-	ukbd_cnattach();	/* allow USB keyboard to become console */
+	if (use_fb_console)
+		ukbd_cnattach(); /* allow USB keyboard to become console */
 #endif
 
 	beagle_putchar('f');
@@ -1107,6 +1110,39 @@ beagle_device_register(device_t self, vo
 		return;
 	}
 	if (device_is_a(self, "tifb")) {
+		static const struct tifb_panel_info default_panel_info = {
+			.panel_tft = 1,
+			.panel_mono = false,
+			.panel_bpp = 24,
+
+			.panel_pxl_clk = 3000,
+			.panel_width = 800,
+			.panel_height = 600,
+			.panel_hfp = 0,
+			.panel_hbp = 47,
+			.panel_hsw = 47,
+			.panel_vfp = 0,
+			.panel_vbp = 10,
+			.panel_vsw = 2,
+			.panel_invert_hsync = 1,
+			.panel_invert_vsync = 1,
+
+			.panel_ac_bias = 255,
+			.panel_ac_bias_intrpt = 0,
+			.panel_dma_burst_sz = 16,
+			.panel_fdd = 0x80,
+			.panel_sync_edge = 0,
+			.panel_sync_ctrl = 1,
+			.panel_invert_pxl_clk = 0,
+		};
+		prop_data_t panel_info;
+
+		panel_info = prop_data_create_data_nocopy(_panel_info,
+		sizeof(struct tifb_panel_info));
+		KASSERT(panel_info != NULL);
+		prop_dictionary_set(dict, "panel-info", panel_info);
+		prop_object_release(panel_info);
+
 		if (use_fb_console)
 			prop_dictionary_set_bool(dict, "is_console", true);
 		return;

Index: src/sys/arch/evbarm/gumstix/gumstix_machdep.c
diff -u src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.54 src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.55
--- src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.54	Sun Oct 16 23:07:31 2016
+++ src/sys/arch/evbarm/gumstix/gumstix_machdep.c	Tue Oct 18 14:39:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstix_machdep.c,v 1.54 2016/10/16 23:07:31 kiyohara Exp $ */
+/*	$NetBSD: gumstix_machdep.c,v 1.55 2016/10/18 14:39:52 kiyohara Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007  WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -192,6 +192,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -262,6 +263,7 @@ int comcnmode = CONMODE;
 static char console[16];
 #endif
 
+const struct tifb_panel_info *tifb_panel_info = NULL;
 /* Use TPS65217 White LED Driver */
 bool use_tps65217_wled = false;
 
@@ -1164,6 +1166,14 @@ gumstix_device_register(device_t dev, vo
 		prop_dictionary_set_bool(dict, "dual-volt", dualvolt);
 	}
 	if (device_is_a(dev, "tifb")) {
+		prop_data_t panel_info;
+
+		panel_info = prop_data_create_data_nocopy(tifb_panel_info,
+		sizeof(struct tifb_panel_info));
+		KASSERT(panel_info != NULL);
+		prop_dictionary_set(dict, "panel-info", panel_info);
+		prop_object_release(panel_info);
+
 #if defined(OMAP2)
 		/* enable LCD */
 		omap2_gpio_ctl(59, 

CVS commit: src/sys/arch/arm/omap

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:08:53 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap2_gpio.c

Log Message:
The variable gpio_module[] into #ifdef TI_AM335X - #endif.
Thanks for joerg@.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/omap/omap2_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/omap/omap2_gpio.c
diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.20 src/sys/arch/arm/omap/omap2_gpio.c:1.21
--- src/sys/arch/arm/omap/omap2_gpio.c:1.20	Tue Oct 18 14:02:48 2016
+++ src/sys/arch/arm/omap/omap2_gpio.c	Tue Oct 18 14:08:53 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2_gpio.c,v 1.20 2016/10/18 14:02:48 kiyohara Exp $	*/
+/*	$NetBSD: omap2_gpio.c,v 1.21 2016/10/18 14:08:53 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.20 2016/10/18 14:02:48 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.21 2016/10/18 14:08:53 kiyohara Exp $");
 
 #define _INTR_PRIVATE
 
@@ -64,12 +64,14 @@ __KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c
 #include 
 #endif
 
+#ifdef TI_AM335X
 static const struct omap_module gpio_module[] = {
 	{ 0, 0 },
 	{ AM335X_PRCM_CM_PER, CM_PER_GPIO1_CLKCTRL },
 	{ AM335X_PRCM_CM_PER, CM_PER_GPIO2_CLKCTRL },
 	{ AM335X_PRCM_CM_PER, CM_PER_GPIO3_CLKCTRL },
 };
+#endif
 
 static void gpio_pic_block_irqs(struct pic_softc *, size_t, uint32_t);
 static void gpio_pic_block_irqs2(struct pic_softc *, size_t, uint32_t);



CVS commit: src/sys/arch/arm/omap

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:08:53 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap2_gpio.c

Log Message:
The variable gpio_module[] into #ifdef TI_AM335X - #endif.
Thanks for joerg@.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/omap/omap2_gpio.c

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



CVS commit: src/sys/arch/arm/omap

2016-10-18 Thread KIYOHARA Takashi
sys/arch/arm/omap/tifbreg.h
diff -u src/sys/arch/arm/omap/tifbreg.h:1.1 src/sys/arch/arm/omap/tifbreg.h:1.2
--- src/sys/arch/arm/omap/tifbreg.h:1.1	Wed Jul 16 18:30:43 2014
+++ src/sys/arch/arm/omap/tifbreg.h	Tue Oct 18 14:14:51 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: tifbreg.h,v 1.1 2014/07/16 18:30:43 bouyer Exp $ */
+/* $NetBSD: tifbreg.h,v 1.2 2016/10/18 14:14:51 kiyohara Exp $ */
 /*-
  * Copyright 2013 Oleksandr Tymoshenko <go...@freebsd.org>
  * All rights reserved.
@@ -43,32 +43,31 @@
 #define		RASTER_CTRL_TFT24_UNPACKED	(1 << 26)
 #define		RASTER_CTRL_TFT24		(1 << 25)
 #define		RASTER_CTRL_STN565		(1 << 24)
-#define		RASTER_CTRL_TFTPMAP		(1 << 23)
+#define		RASTER_CTRL_TFTMAP		(1 << 23)
 #define		RASTER_CTRL_NIBMODE		(1 << 22)
-#define		RASTER_CTRL_PALMODE_SHIFT	20
-#define		PALETTE_PALETTE_AND_DATA	0x00
-#define		PALETTE_PALETTE_ONLY		0x01
-#define		PALETTE_DATA_ONLY		0x02
-#define		RASTER_CTRL_REQDLY_SHIFT	12
+#define		RASTER_CTRL_PALMODE_PALETTE_AND_DATA (0 << 20)
+#define		RASTER_CTRL_PALMODE_PALETTE_ONLY (1 << 20)
+#define		RASTER_CTRL_PALMODE_DATA_ONLY	(2 << 20)
+#define		RASTER_CTRL_REQDLY(v)		((v) << 12)
 #define		RASTER_CTRL_MONO8B		(1 << 9)
-#define		RASTER_CTRL_RBORDER		(1 << 8)
+#define		RASTER_CTRL_RDORDER		(1 << 8)
 #define		RASTER_CTRL_LCDTFT		(1 << 7)
 #define		RASTER_CTRL_LCDBW		(1 << 1)
 #define		RASTER_CTRL_LCDEN		(1 << 0)
 #define	LCD_RASTER_TIMING_0	0x2C
-#define		RASTER_TIMING_0_HBP_SHIFT	24
-#define		RASTER_TIMING_0_HFP_SHIFT	16
-#define		RASTER_TIMING_0_HSW_SHIFT	10
-#define		RASTER_TIMING_0_PPLLSB_SHIFT	4
-#define		RASTER_TIMING_0_PPLMSB_SHIFT	3
+#define		RASTER_TIMING_0_HBP(v)		v) - 1) & 0xff) << 24)
+#define		RASTER_TIMING_0_HFP(v)		v) - 1) & 0xff) << 16)
+#define		RASTER_TIMING_0_HSW(v)		v) - 1) & 0x3f) << 10)
+#define		RASTER_TIMING_0_PPL(w) \
+		(w) - 1) >> 7) & 0x8) | w) - 1) >> 0) & 0x3f0))
 #define	LCD_RASTER_TIMING_1	0x30
-#define		RASTER_TIMING_1_VBP_SHIFT	24
-#define		RASTER_TIMING_1_VFP_SHIFT	16
-#define		RASTER_TIMING_1_VSW_SHIFT	10
-#define		RASTER_TIMING_1_LPP_SHIFT	0
+#define		RASTER_TIMING_1_VBP(v)		(((v) & 0xff) << 24)
+#define		RASTER_TIMING_1_VFP(v)		(((v) & 0xff) << 16)
+#define		RASTER_TIMING_1_VSW(v)		v) - 1) & 0x3f) << 10)
+#define		RASTER_TIMING_1_LPP(h)		h) - 1) & 0x3ff) << 0)
 #define	LCD_RASTER_TIMING_2	0x34
-#define		RASTER_TIMING_2_HSWHI_SHIFT	27
-#define		RASTER_TIMING_2_LPP_B10_SHIFT	26
+#define		RASTER_TIMING_2_HSW(v)		(v) - 1) >> 6) & 0xf) << 27)
+#define		RASTER_TIMING_2_LPP(h)		(((h) & 0x400) ? (1 << 26) : 0)
 #define		RASTER_TIMING_2_PHSVS		(1 << 25)
 #define		RASTER_TIMING_2_PHSVS_RISE	(1 << 24)
 #define		RASTER_TIMING_2_PHSVS_FALL	(0 << 24)
@@ -76,10 +75,10 @@
 #define		RASTER_TIMING_2_IPC		(1 << 22)
 #define		RASTER_TIMING_2_IHS		(1 << 21)
 #define		RASTER_TIMING_2_IVS		(1 << 20)
-#define		RASTER_TIMING_2_ACBI_SHIFT	16
-#define		RASTER_TIMING_2_ACB_SHIFT	8
-#define		RASTER_TIMING_2_HBPHI_SHIFT	4
-#define		RASTER_TIMING_2_HFPHI_SHIFT	0
+#define		RASTER_TIMING_2_ACBI(x)		((x) << 16)
+#define		RASTER_TIMING_2_ACB(x)		((x) << 8)
+#define		RASTER_TIMING_2_HBP(v)		v) - 1) >> 4) & 0x30)
+#define		RASTER_TIMING_2_HFP(v)		v) - 1) >> 8) & 0x3)
 #define	LCD_RASTER_SUBPANEL	0x38
 #define	LCD_RASTER_SUBPANEL2	0x3C
 #define	LCD_LCDDMA_CTRL		0x40
@@ -88,8 +87,8 @@
 #define		LCDDMA_CTRL_BURST_SIZE_SHIFT	4
 #define		LCDDMA_CTRL_BYTES_SWAP		(1 << 3)
 #define		LCDDMA_CTRL_BE			(1 << 1)
-#define		LCDDMA_CTRL_FB0_ONLY		0
 #define		LCDDMA_CTRL_FB0_FB1		(1 << 0)
+#define		LCDDMA_CTRL_FB0_ONLY		(0 << 0)
 #define	LCD_LCDDMA_FB0_BASE	0x44
 #define	LCD_LCDDMA_FB0_CEILING	0x48
 #define	LCD_LCDDMA_FB1_BASE	0x4C
@@ -115,10 +114,23 @@
 #define		IRQ_FRAME_DONE		(1 << 0)
 #define	LCD_CLKC_ENABLE		0x6C
 #define		CLKC_ENABLE_DMA		(1 << 2)
-#define		CLKC_ENABLE_LDID	(1 << 1)
+#define		CLKC_ENABLE_LIDD	(1 << 1)
 #define		CLKC_ENABLE_CORE	(1 << 0)
 #define	LCD_CLKC_RESET		0x70
 #define		CLKC_RESET_MAIN		(1 << 3)
 #define		CLKC_RESET_DMA		(1 << 2)
-#define		CLKC_RESET_LDID		(1 << 1)
+#define		CLKC_RESET_LIDD		(1 << 1)
 #define		CLKC_RESET_CORE		(1 << 0)
+
+/* 16-Entry Palette/Buffer Format */
+#define PALETTE_BPP_1			(0 << 12)
+#define PALETTE_BPP_2			(1 << 12)
+#define PALETTE_BPP_4			(2 << 12)
+#define PALETTE_BPP_8			(3 << 12)
+#define PALETTE_BPP_XX			(4 << 12)
+#define PALETTE_MONO(v)			((v) & 0xf)
+#define PALETTE_RED(r)			(((r) & 0xf) << 8)
+#define PALETTE_GREEN(g)		(((g) & 0xf) << 4)
+#define PALETTE_BLUE(b)			(((b) & 0xf) << 0)
+#define PALETTE_COLOR(r, g, b) \
+			(PALETTE_RED(r) | PALETTE_GREEN(g) | PALETTE_BLUE(b)

CVS commit: src/sys/arch/arm/omap

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:02:48 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap2_gpio.c

Log Message:
Allow obio_intr == OBIOCF_INTR_DEFAULT.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/omap/omap2_gpio.c

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



CVS commit: src/sys/arch/arm/omap

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 14:02:48 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap2_gpio.c

Log Message:
Allow obio_intr == OBIOCF_INTR_DEFAULT.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/omap/omap2_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/omap/omap2_gpio.c
diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.19 src/sys/arch/arm/omap/omap2_gpio.c:1.20
--- src/sys/arch/arm/omap/omap2_gpio.c:1.19	Sat Oct 15 15:11:56 2016
+++ src/sys/arch/arm/omap/omap2_gpio.c	Tue Oct 18 14:02:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $	*/
+/*	$NetBSD: omap2_gpio.c,v 1.20 2016/10/18 14:02:48 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.20 2016/10/18 14:02:48 kiyohara Exp $");
 
 #define _INTR_PRIVATE
 
@@ -489,9 +489,6 @@ gpio_attach(device_t parent, device_t se
 
 	gpio->gpio_dev = self;
 
-	if (oa->obio_intr == OBIOCF_INTR_DEFAULT)
-		panic("\n%s: no intr assigned", device_xname(self));
-
 	if (oa->obio_size == OBIOCF_SIZE_DEFAULT)
 		panic("\n%s: no size assigned", device_xname(self));
 



CVS commit: src/sys/arch/arm/arm

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 13:58:53 UTC 2016

Modified Files:
src/sys/arch/arm/arm: cpufunc.c

Log Message:
Indent.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/arm/arm/cpufunc.c

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



CVS commit: src/sys/arch/arm/arm

2016-10-18 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct 18 13:58:53 UTC 2016

Modified Files:
src/sys/arch/arm/arm: cpufunc.c

Log Message:
Indent.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/arm/arm/cpufunc.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/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.161 src/sys/arch/arm/arm/cpufunc.c:1.162
--- src/sys/arch/arm/arm/cpufunc.c:1.161	Mon May 30 17:18:38 2016
+++ src/sys/arch/arm/arm/cpufunc.c	Tue Oct 18 13:58:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.161 2016/05/30 17:18:38 dholland Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.162 2016/10/18 13:58:52 kiyohara Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.161 2016/05/30 17:18:38 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.162 2016/10/18 13:58:52 kiyohara Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_cpuoptions.h"
@@ -2158,13 +2158,13 @@ set_cpufuncs(void)
 	cputype == CPU_ID_ARM_88SV581X_V6 ||
 	cputype == CPU_ID_ARM_88SV581X_V7) &&
 	(armreg_pfr0_read() & ARM_PFR0_THUMBEE_MASK)) {
-			cpufuncs = pj4bv7_cpufuncs;
+		cpufuncs = pj4bv7_cpufuncs;
 #if defined(CPU_ARMV6) || defined(CPU_PRE_ARMV6)
-			cpu_armv7_p = true;
+		cpu_armv7_p = true;
 #endif
-			get_cachetype_cp15();
-			pmap_pte_init_armv7();
-			return 0;
+		get_cachetype_cp15();
+		pmap_pte_init_armv7();
+		return 0;
 	}
 #endif /* CPU_PJ4B */
 



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

2016-10-16 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Oct 16 23:07:31 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c

Log Message:
omap2_gpio_*() into #if - #endif.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/evbarm/gumstix/gumstix_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/gumstix/gumstix_machdep.c
diff -u src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.53 src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.54
--- src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.53	Sun Oct 16 13:54:28 2016
+++ src/sys/arch/evbarm/gumstix/gumstix_machdep.c	Sun Oct 16 23:07:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstix_machdep.c,v 1.53 2016/10/16 13:54:28 kiyohara Exp $ */
+/*	$NetBSD: gumstix_machdep.c,v 1.54 2016/10/16 23:07:31 kiyohara Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007  WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -1164,11 +1164,13 @@ gumstix_device_register(device_t dev, vo
 		prop_dictionary_set_bool(dict, "dual-volt", dualvolt);
 	}
 	if (device_is_a(dev, "tifb")) {
+#if defined(OMAP2)
 		/* enable LCD */
 		omap2_gpio_ctl(59, GPIO_PIN_OUTPUT);
 		omap2_gpio_write(59, 0);	/* reset */
 		delay(100);
 		omap2_gpio_write(59, 1);
+#endif
 	}
 	if (device_is_a(dev, "tps65217pmic")) {
 #if defined(TI_AM335X)



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

2016-10-16 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Oct 16 23:07:31 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c

Log Message:
omap2_gpio_*() into #if - #endif.


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

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



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

2016-10-16 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Oct 16 13:54:28 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c gxio.c

Log Message:
Remove not commited header-file and variable.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/gumstix/gxio.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/gumstix/gumstix_machdep.c
diff -u src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.52 src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.53
--- src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.52	Sat Oct 15 15:27:18 2016
+++ src/sys/arch/evbarm/gumstix/gumstix_machdep.c	Sun Oct 16 13:54:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstix_machdep.c,v 1.52 2016/10/15 15:27:18 kiyohara Exp $ */
+/*	$NetBSD: gumstix_machdep.c,v 1.53 2016/10/16 13:54:28 kiyohara Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007  WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -192,7 +192,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -263,7 +262,6 @@ int comcnmode = CONMODE;
 static char console[16];
 #endif
 
-const struct tifb_panel_info *tifb_panel_info = NULL;
 /* Use TPS65217 White LED Driver */
 bool use_tps65217_wled = false;
 
@@ -1166,14 +1164,6 @@ gumstix_device_register(device_t dev, vo
 		prop_dictionary_set_bool(dict, "dual-volt", dualvolt);
 	}
 	if (device_is_a(dev, "tifb")) {
-		prop_data_t panel_info;
-
-		panel_info = prop_data_create_data_nocopy(tifb_panel_info,
-		sizeof(struct tifb_panel_info));
-		KASSERT(panel_info != NULL);
-		prop_dictionary_set(dict, "panel-info", panel_info);
-		prop_object_release(panel_info);
-
 		/* enable LCD */
 		omap2_gpio_ctl(59, GPIO_PIN_OUTPUT);
 		omap2_gpio_write(59, 0);	/* reset */

Index: src/sys/arch/evbarm/gumstix/gxio.c
diff -u src/sys/arch/evbarm/gumstix/gxio.c:1.21 src/sys/arch/evbarm/gumstix/gxio.c:1.22
--- src/sys/arch/evbarm/gumstix/gxio.c:1.21	Sat Oct 15 15:27:18 2016
+++ src/sys/arch/evbarm/gumstix/gxio.c	Sun Oct 16 13:54:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gxio.c,v 1.21 2016/10/15 15:27:18 kiyohara Exp $ */
+/*	$NetBSD: gxio.c,v 1.22 2016/10/16 13:54:28 kiyohara Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007 WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -31,7 +31,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.21 2016/10/15 15:27:18 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.22 2016/10/16 13:54:28 kiyohara Exp $");
 
 #include "opt_cputypes.h"
 #include "opt_gumstix.h"
@@ -57,7 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.2
 #endif
 #endif
 #include 
-#include 
 #include 
 #if defined(CPU_XSCALE)
 #include 



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

2016-10-16 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Oct 16 13:54:28 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c gxio.c

Log Message:
Remove not commited header-file and variable.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/gumstix/gxio.c

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



CVS commit: src/sys/arch/arm/omap

2016-10-16 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Oct 16 13:09:57 UTC 2016

Modified Files:
src/sys/arch/arm/omap: ti_iic.c

Log Message:
Fix miss commit.
  Add macro OMAP2_I2C_FIFOBYTES.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/ti_iic.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/omap/ti_iic.c
diff -u src/sys/arch/arm/omap/ti_iic.c:1.9 src/sys/arch/arm/omap/ti_iic.c:1.10
--- src/sys/arch/arm/omap/ti_iic.c:1.9	Sat Oct 15 15:08:59 2016
+++ src/sys/arch/arm/omap/ti_iic.c	Sun Oct 16 13:09:57 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_iic.c,v 1.9 2016/10/15 15:08:59 kiyohara Exp $ */
+/* $NetBSD: ti_iic.c,v 1.10 2016/10/16 13:09:57 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.9 2016/10/15 15:08:59 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.10 2016/10/16 13:09:57 kiyohara Exp $");
 
 #include "opt_omap.h"
 #include "locators.h"
@@ -83,6 +83,8 @@ __KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1
 #define OMAP2_I2C_SLAVE_ADDR	0x01
 #endif
 
+#define OMAP2_I2C_FIFOBYTES(fd)	(8 << (fd))
+
 #ifdef I2CDEBUG
 #define DPRINTF(args)	printf args
 #else



CVS commit: src/sys/arch/arm/omap

2016-10-16 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Oct 16 13:09:57 UTC 2016

Modified Files:
src/sys/arch/arm/omap: ti_iic.c

Log Message:
Fix miss commit.
  Add macro OMAP2_I2C_FIFOBYTES.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/ti_iic.c

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



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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 16:30:46 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstixreg.h

Log Message:
Add map for DuoVero and Pepper.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/gumstix/gumstixreg.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/gumstix/gumstixreg.h
diff -u src/sys/arch/evbarm/gumstix/gumstixreg.h:1.8 src/sys/arch/evbarm/gumstix/gumstixreg.h:1.9
--- src/sys/arch/evbarm/gumstix/gumstixreg.h:1.8	Thu Mar 31 14:33:17 2016
+++ src/sys/arch/evbarm/gumstix/gumstixreg.h	Sat Oct 15 16:30:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstixreg.h,v 1.8 2016/03/31 14:33:17 kiyohara Exp $  */
+/*	$NetBSD: gumstixreg.h,v 1.9 2016/10/15 16:30:46 kiyohara Exp $  */
 /*
  * Copyright (C) 2005, 2006 WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -49,8 +49,16 @@
 
 #define OVERO_L4_CORE_VBASE		0xc000
 #define OVERO_L4_PERIPHERAL_VBASE	0xc010
-#define OVERO_GPMC_VBASE		0xc020
+#define OVERO_L4_WAKEUP_VBASE		0xc020
+#define OVERO_GPMC_VBASE		0xc030
 
+#define DUOVERO_L4_CM_VBASE		0xc000
+#define DUOVERO_L4_PERIPHERAL_VBASE	0xc010
+#define DUOVERO_L4_WAKEUP_VBASE		0xc040
+#define DUOVERO_GPMC_VBASE		0xc050
+
+#define PEPPER_PRCM_VBASE		0xc000
+#define PEPPER_L4_PERIPHERAL_VBASE	0xc010
 
 #define ioreg_read(a)		(*(volatile unsigned *)(a))
 #define ioreg_write(a,v)	(*(volatile unsigned *)(a)=(v))



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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 16:30:46 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstixreg.h

Log Message:
Add map for DuoVero and Pepper.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/gumstix/gumstixreg.h

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



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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:33:02 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: README.evbarm

Log Message:
Add Pepper and DuoVero.


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

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



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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:33:02 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: README.evbarm

Log Message:
Add Pepper and DuoVero.


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

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/conf/README.evbarm
diff -u src/sys/arch/evbarm/conf/README.evbarm:1.12 src/sys/arch/evbarm/conf/README.evbarm:1.13
--- src/sys/arch/evbarm/conf/README.evbarm:1.12	Tue Jul 12 13:32:14 2016
+++ src/sys/arch/evbarm/conf/README.evbarm	Sat Oct 15 15:33:02 2016
@@ -1,4 +1,4 @@
-$NetBSD: README.evbarm,v 1.12 2016/07/12 13:32:14 kiyohara Exp $
+$NetBSD: README.evbarm,v 1.13 2016/10/15 15:33:02 kiyohara Exp $
 
 config		date		boards
 ---
@@ -16,6 +16,7 @@ CUBIETRUCK	2014/04/11	Cubietech Cubietru
 CP3100		2006/11/08	Certance IOP321 CP-3100
 DEVKIT8000	2010/09/08	Embest OMAP3530 DevKit8000 eval Kit 
 DNS323		2010/10/02	D-Link DNS-323 Marvell SoC based NAS
+DUOVERO		2016/10/15	Gumstix Inc. DuoVero COMS boards
 GEMINI		2008/10/24	Cortina Systems SL3516 eval board
 GUMSTIX		2006/10/16	Gumstix Inc. PXA255/270 based boards
 HDL_G		2006/04/16	I-O DATA HDL-G Giga LANDISK
@@ -51,6 +52,7 @@ OSK5912		2007/01/06	TI OMAP 5912 OSK boa
 OVERO		2010/07/10	Gumstix Inc. Overo COMS boards
 PANDABOARD	2012/08/20	TI OMAP4430 PandaBoard
 PARALLELLA	2015/01/23	Xilinx Zynq and Epiphany multi-core chips
+PEPPER		2016/10/15	Gumstix Inc. Pepper SBC(Single Board Computer)
 ROCKCHIP	2014/12/26	Radxa Rock/Lite/Pro, MINIX NEO X7, Rayeager PX2
 SHEEVAPLUG	2010/10/02	Marvell SheevaPlug
 SMDK2410	2003/07/31	Samsung SMDK2410 S3C2410 eval board



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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:29:51 UTC 2016

Added Files:
src/sys/arch/evbarm/conf: DUOVERO PEPPER

Log Message:
Add Gumstix Inc's Pepper and DuoVero.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/DUOVERO \
src/sys/arch/evbarm/conf/PEPPER

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

Added files:

Index: src/sys/arch/evbarm/conf/DUOVERO
diff -u /dev/null src/sys/arch/evbarm/conf/DUOVERO:1.1
--- /dev/null	Sat Oct 15 15:29:51 2016
+++ src/sys/arch/evbarm/conf/DUOVERO	Sat Oct 15 15:29:51 2016
@@ -0,0 +1,336 @@
+#
+#	$NetBSD: DUOVERO,v 1.1 2016/10/15 15:29:51 kiyohara Exp $
+#
+#	DUOOVERO -- Gumstix. Inc. DuoVero COMS platforms kernel
+#
+
+include	"arch/evbarm/conf/std.overo"
+
+#options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+# estimated number of users
+
+maxusers	32
+
+# CPU options
+
+options 	CPU_CORTEXA9
+options 	OMAP_4430
+options 	MULTIPROCESSOR
+options 	FPU_VFP
+options 	PMAPCOUNTERS
+options 	ARM_HAS_VBAR
+options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
+makeoptions	CPUFLAGS="-mcpu=cortex-a9 -mfpu=neon"
+
+# Architecture options
+
+makeoptions	BOARDTYPE="duovero"
+options 	EVBARM_BOARDTYPE=duovero
+
+# Gumstix options
+options 	DUOVERO
+# Can specify 'expansion=' in args from u-boot.
+options 	GUMSTIX_NETBSD_ARGS_EXPANSION
+options 	GXIO_DEFAULT_EXPANSION="\"Parlor\""
+
+# Standard system options
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+#options 	NTP		# NTP phase/frequency locked loop
+
+# File systems
+
+file-system	FFS		# UFS
+file-system 	EXT2FS		# second extended file system (linux)
+#file-system	LFS		# log-structured file system
+file-system	MFS		# memory file system
+file-system	NFS		# Network file system
+#file-system	NTFS		# Windows/NT file system (experimental)
+#file-system	CD9660		# ISO 9660 + Rock Ridge file system
+file-system	MSDOSFS		# MS-DOS file system
+file-system	FDESC		# /dev/fd
+file-system	KERNFS		# /kern
+#file-system	NULLFS		# loopback file system
+#file-system	OVERLAY		# overlay file system
+#file-system	PROCFS		# /proc
+#file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
+#file-system	UMAPFS		# NULLFS + uid and gid remapping
+file-system	UNION		# union file system
+#file-system	CODA		# Coda File System; also needs vcoda (below)
+#file-system	SMBFS		# experimental - CIFS; also needs nsmb (below)
+file-system	TMPFS		# memory file system
+file-system	PTYFS		# /dev/pts/N support
+#file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
+#file-system	HFS		# experimental - Apple HFS+ (read-only)
+
+# File system options
+#options 	QUOTA		# legacy UFS quotas
+#options 	QUOTA2		# new, in-filesystem UFS quotas
+#options 	FFS_EI		# FFS Endian Independent support
+options 	WAPBL		# File system journaling support
+#options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
+#options 	NFSSERVER
+#options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+#options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
+# immutable) behave as system flags.
+
+# Networking options
+
+#options 	GATEWAY		# packet forwarding
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
+#options 	IPSEC		# IP security
+#options 	IPSEC_DEBUG	# debug for IP security
+#options 	MROUTING	# IP multicast routing
+#options 	PIM		# Protocol Independent Multicast
+#options 	NETATALK	# AppleTalk networking
+#options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
+#options 	PPP_DEFLATE	# Deflate compression support for PPP
+#options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
+#options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
+
+options 	NFS_BOOT_BOOTP
+options 	NFS_BOOT_DHCP
+#options 	NFS_BOOT_BOOTPARAM
+
+# Compatibility options
+
+options		COMPAT_NETBSD32	# allow running arm (e.g. non-earm) binaries
+#options 	COMPAT_09	# NetBSD 0.9,
+#options 	COMPAT_10	# NetBSD 1.0,
+#options 	COMPAT_11	# NetBSD 1.1,
+#options 	COMPAT_12	# NetBSD 1.2,
+#options 	COMPAT_13	# NetBSD 1.3,
+#options 	COMPAT_14	# NetBSD 1.4,
+#options 	COMPAT_15	# NetBSD 1.5,
+#options 	COMPAT_16	# NetBSD 1.6,
+#options 	COMPAT_20	# NetBSD 2.0,
+options 	COMPAT_30	# NetBSD 3.0,
+options 	COMPAT_40	# NetBSD 4.0,
+options 	COMPAT_50	# NetBSD 5.0,
+options 	COMPAT_60	# NetBSD 6.0, and
+options 	COMPAT_70	# NetBSD 7.0 binary compatibility.
+#options 	COMPAT_43	# 4.3BSD compatibility.
+#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
+
+options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
+options 	COMPAT_LINUX	# binary compatibility with Linux
+options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
+
+# Shared memory options
+
+#options 	SYSVMSG		# System V-like message queues
+#options 	SYSVSEM		# System V-like semaphores
+#options 	SYSVSHM		# System V-like memory sharing
+
+# Device options
+
+#options 	MEMORY_DISK_HOOKS	# boottime 

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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:29:51 UTC 2016

Added Files:
src/sys/arch/evbarm/conf: DUOVERO PEPPER

Log Message:
Add Gumstix Inc's Pepper and DuoVero.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/DUOVERO \
src/sys/arch/evbarm/conf/PEPPER

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



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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:27:18 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c gumstix_start.S gxio.c

Log Message:
Support Duovero and Pepper.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/gumstix/gumstix_start.S
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/gumstix/gxio.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/gumstix/gumstix_machdep.c
diff -u src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.51 src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.52
--- src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.51	Thu Mar 31 14:33:17 2016
+++ src/sys/arch/evbarm/gumstix/gumstix_machdep.c	Sat Oct 15 15:27:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstix_machdep.c,v 1.51 2016/03/31 14:33:17 kiyohara Exp $ */
+/*	$NetBSD: gumstix_machdep.c,v 1.52 2016/10/15 15:27:18 kiyohara Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007  WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -137,16 +137,21 @@
  * boards using RedBoot firmware.
  */
 
-#include "opt_evbarm_boardtype.h"
+#include "opt_com.h"
 #include "opt_cputypes.h"
+#include "opt_evbarm_boardtype.h"
 #include "opt_gumstix.h"
-#ifdef OVERO
+#include "opt_kgdb.h"
+#include "opt_multiprocessor.h"
+#include "opt_pmap_debug.h"
+#if defined(OVERO) || defined(DUOVERO) || defined(PEPPER)
 #include "opt_omap.h"
+
+#if defined(DUOVERO)
+#include "arml2cc.h"
+#endif
 #include "prcm.h"
 #endif
-#include "opt_kgdb.h"
-#include "opt_pmap_debug.h"
-#include "opt_com.h"
 
 #include 
 #include 
@@ -159,22 +164,35 @@
 #include 
 #include 
 #include 
+#include 
+
+#include 
 
 #include 
 
-#include 
+#include 	/* don't reorder */
+
+#include 		/* don't reorder */
 #include 
 #include 
 
 #include 
-#ifdef OVERO
-#include 
+#if NARML2CC > 0
+#include 
+#endif
+#include 
 #include 
+#include 
+#include 
+#include 
 #include 
-#include 
+#if defined(OVERO) || defined(DUOVERO) || defined(PEPPER)
+#include 		/* Must required "opt_omap.h" */
+#endif
+#include 
 #include 
 #include 
-#endif
+#include 
 #include 
 #include 
 #include 
@@ -207,8 +225,9 @@ uint32_t system_serial_low;
 /* Prototypes */
 #if defined(GUMSTIX)
 static void	read_system_serial(void);
-#elif defined(OVERO)
-static void	overo_reset(void);
+#endif
+#if defined(OMAP2)
+static void	omap_reset(void);
 static void	find_cpu_clock(void);
 #endif
 static void	process_kernel_args(int, char *[]);
@@ -226,7 +245,7 @@ bs_protos(bs_notimpl);
 #include 
 #endif
 
-#if defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
+#if defined(CPU_XSCALE)
 #include "lcd.h"
 #endif
 
@@ -244,7 +263,11 @@ int comcnmode = CONMODE;
 static char console[16];
 #endif
 
-extern void gxio_config_pin(void);
+const struct tifb_panel_info *tifb_panel_info = NULL;
+/* Use TPS65217 White LED Driver */
+bool use_tps65217_wled = false;
+
+extern void gxio_config(void);
 extern void gxio_config_expansion(char *);
 
 
@@ -335,20 +358,27 @@ static const struct pmap_devmap gumstix_
 		PTE_NOCACHE,
 	},
 #elif defined(OVERO)
-	{
+	{	/* SCM, PRCM */
 		OVERO_L4_CORE_VBASE,
 		_A(OMAP3530_L4_CORE_BASE),
 		_S(L1_S_SIZE),		/* No need 16MB.  Use only first 1MB */
 		VM_PROT_READ | VM_PROT_WRITE,
 		PTE_NOCACHE
 	},
-	{
+	{	/* Console, GPIO[2-6] */
 		OVERO_L4_PERIPHERAL_VBASE,
 		_A(OMAP3530_L4_PERIPHERAL_BASE),
 		_S(OMAP3530_L4_PERIPHERAL_SIZE),
 		VM_PROT_READ | VM_PROT_WRITE,
 		PTE_NOCACHE
 	},
+	{	/* GPIO1 */
+		OVERO_L4_WAKEUP_VBASE,
+		_A(OMAP3530_L4_WAKEUP_BASE),
+		_S(OMAP3530_L4_WAKEUP_SIZE),
+		VM_PROT_READ | VM_PROT_WRITE,
+		PTE_NOCACHE
+	},
 	{
 		OVERO_GPMC_VBASE,
 		_A(GPMC_BASE),
@@ -356,6 +386,52 @@ static const struct pmap_devmap gumstix_
 		VM_PROT_READ | VM_PROT_WRITE,
 		PTE_NOCACHE
 	},
+#elif defined(DUOVERO)
+	{
+		DUOVERO_L4_CM_VBASE,
+		_A(OMAP4430_L4_CORE_BASE + 0x10),
+		_S(L1_S_SIZE),
+		VM_PROT_READ | VM_PROT_WRITE,
+		PTE_NOCACHE
+	},
+	{	/* Console, SCU, L2CC, GPIO[2-6] */
+		DUOVERO_L4_PERIPHERAL_VBASE,
+		_A(OMAP4430_L4_PERIPHERAL_BASE),
+		_S(L1_S_SIZE * 3),
+		VM_PROT_READ | VM_PROT_WRITE,
+		PTE_NOCACHE
+	},
+	{	/* PRCM, GPIO1 */
+		DUOVERO_L4_WAKEUP_VBASE,
+		_A(OMAP4430_L4_WAKEUP_BASE),
+		_S(OMAP4430_L4_WAKEUP_SIZE),
+		VM_PROT_READ | VM_PROT_WRITE,
+		PTE_NOCACHE
+	},
+	{
+		DUOVERO_GPMC_VBASE,
+		_A(GPMC_BASE),
+		_S(GPMC_SIZE),
+		VM_PROT_READ | VM_PROT_WRITE,
+		PTE_NOCACHE
+	},
+#elif defined(PEPPER)
+	{
+		/* CM, Control Module, GPIO0, Console */
+		PEPPER_PRCM_VBASE,
+		_A(OMAP2_CM_BASE),
+		_S(L1_S_SIZE),
+		VM_PROT_READ | VM_PROT_WRITE,
+		PTE_NOCACHE
+	},
+	{
+		/* GPIO[1-3] */
+		PEPPER_L4_PERIPHERAL_VBASE,
+		_A(TI_AM335X_L4_PERIPHERAL_BASE),
+		_S(L1_S_SIZE),
+		VM_PROT_READ | VM_PROT_WRITE,
+		PTE_NOCACHE
+	},
 #endif
 	{ 0, 0, 0, 0, 0 }
 };
@@ -400,16 +476,22 @@ initarm(void *arg)
 	 * Overo:
 	 

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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:27:18 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c gumstix_start.S gxio.c

Log Message:
Support Duovero and Pepper.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/gumstix/gumstix_start.S
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/gumstix/gxio.c

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



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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:24:00 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: VTC100

Log Message:
s/at mainbus0/at mainbus?/.  And indent.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/VTC100

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/conf/VTC100
diff -u src/sys/arch/evbarm/conf/VTC100:1.7 src/sys/arch/evbarm/conf/VTC100:1.8
--- src/sys/arch/evbarm/conf/VTC100:1.7	Thu Aug  4 06:54:47 2016
+++ src/sys/arch/evbarm/conf/VTC100	Sat Oct 15 15:24:00 2016
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: VTC100,v 1.7 2016/08/04 06:54:47 kiyohara Exp $
+#	$NetBSD: VTC100,v 1.8 2016/10/15 15:24:00 kiyohara Exp $
 #
 #	VTC100 -- NEXCOM VTC100 Kernel
 #
@@ -268,8 +268,8 @@ cpsw*		at obio2 addr 0x4a10 size 0x8
 atphy*		at mii? phy ?		# Attansic/Atheros PHYs
 
 # On-board USB. Experimental
-tiotg* 	at mainbus0 base 0x4740 size 0x5000 intrbase 17
-motg*	at tiotg? port ?
+tiotg*		at mainbus? base 0x4740 size 0x5000 intrbase 17
+motg*		at tiotg? port ?
 usb*		at motg?
 uhub*		at usb?
 uhub*		at uhub? port ?
@@ -277,12 +277,12 @@ uhub*		at uhub? port ?
 uhidev* 	at uhub?
 
 # USB Keyboards
-ukbd*	at uhidev? reportid ?
-wskbd*	at ukbd? console ? mux 1
+ukbd*		at uhidev? reportid ?
+wskbd*		at ukbd? console ? mux 1
 
 # USB Mice
-ums*	at uhidev? reportid ?
-wsmouse* at ums? mux 0
+ums*		at uhidev? reportid ?
+wsmouse*	at ums? mux 0
 
 umass*		at uhub? port ? configuration ? interface ?
 wd*		at umass?



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

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:24:00 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: VTC100

Log Message:
s/at mainbus0/at mainbus?/.  And indent.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/VTC100

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



CVS commit: src/sys/arch/arm/omap

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:14:20 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap2_obio.c

Log Message:
Attach icu before attaching gpio.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/omap/omap2_obio.c

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



CVS commit: src/sys/arch/arm/omap

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:14:20 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap2_obio.c

Log Message:
Attach icu before attaching gpio.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/omap/omap2_obio.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/omap/omap2_obio.c
diff -u src/sys/arch/arm/omap/omap2_obio.c:1.23 src/sys/arch/arm/omap/omap2_obio.c:1.24
--- src/sys/arch/arm/omap/omap2_obio.c:1.23	Mon Apr 25 13:17:16 2016
+++ src/sys/arch/arm/omap/omap2_obio.c	Sat Oct 15 15:14:20 2016
@@ -1,7 +1,7 @@
-/*	$Id: omap2_obio.c,v 1.23 2016/04/25 13:17:16 kiyohara Exp $	*/
+/*	$Id: omap2_obio.c,v 1.24 2016/10/15 15:14:20 kiyohara Exp $	*/
 
 /* adapted from: */
-/*	$NetBSD: omap2_obio.c,v 1.23 2016/04/25 13:17:16 kiyohara Exp $ */
+/*	$NetBSD: omap2_obio.c,v 1.24 2016/10/15 15:14:20 kiyohara Exp $ */
 
 
 /*
@@ -103,7 +103,7 @@
 
 #include "opt_omap.h"
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.23 2016/04/25 13:17:16 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap2_obio.c,v 1.24 2016/10/15 15:14:20 kiyohara Exp $");
 
 #include "locators.h"
 #include "obio.h"
@@ -378,6 +378,9 @@ static const struct {
 #if defined(OMAP_3530)
 	{ .name = "avic",.addr = INTC_BASE_3530, .required = true },
 #endif
+#if defined(TI_AM335X)
+	{ .name = "omapicu", .addr = 0x4820, .required = true },
+#endif
 	{ .name = "gpio1", .addr = GPIO1_BASE, .required = false },
 	{ .name = "gpio2", .addr = GPIO2_BASE, .required = false },
 	{ .name = "gpio3", .addr = GPIO3_BASE, .required = false },
@@ -400,7 +403,6 @@ static const struct {
 	{ .name = "dmac", .addr = DMAC_BASE, .required = true },
 #endif
 #if defined(TI_AM335X)
-	{ .name = "omapicu", .addr = 0x4820, .required = true },
 	{ .name = "prcm", .addr = 0x44e0, .required = true },
 	{ .name = "sitaracm", .addr = 0x44e1, .required = true },
 	{ .name = "edma", .addr = 0x4900, .required = false },



CVS commit: src/sys/arch/arm/omap

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:11:56 UTC 2016

Modified Files:
src/sys/arch/arm/omap: files.omap2 omap2_gpio.c

Log Message:
Support TI_AM335X gpio to omap2_gpio.c.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/omap/files.omap2
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/omap/omap2_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/omap/files.omap2
diff -u src/sys/arch/arm/omap/files.omap2:1.35 src/sys/arch/arm/omap/files.omap2:1.36
--- src/sys/arch/arm/omap/files.omap2:1.35	Tue Oct  4 16:10:34 2016
+++ src/sys/arch/arm/omap/files.omap2	Sat Oct 15 15:11:56 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: files.omap2,v 1.35 2016/10/04 16:10:34 kiyohara Exp $
+#	$NetBSD: files.omap2,v 1.36 2016/10/15 15:11:56 kiyohara Exp $
 #
 # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
 # Based on xscale/files.pxa2x0
@@ -59,8 +59,7 @@ file	arch/arm/omap/omap2430_intr.c		omap
 # OMAP2 GPIO controllers
 device	omapgpio: gpiobus
 attach	omapgpio at obio with omap2gpio
-file	arch/arm/omap/omap2_gpio.c		(omap2 | omap3) & !ti_am335x & omapgpio
-file	arch/arm/omap/am335x_gpio.c		ti_am335x & omapgpio
+file	arch/arm/omap/omap2_gpio.c		(omap2 | omap3) & omapgpio
 
 # TI_AM335X (and maybe TI OMAP4) I2C controllers
 device	tiiic: i2cbus, i2cexec

Index: src/sys/arch/arm/omap/omap2_gpio.c
diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.18 src/sys/arch/arm/omap/omap2_gpio.c:1.19
--- src/sys/arch/arm/omap/omap2_gpio.c:1.18	Mon Jul 11 14:53:05 2016
+++ src/sys/arch/arm/omap/omap2_gpio.c	Sat Oct 15 15:11:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2_gpio.c,v 1.18 2016/07/11 14:53:05 kiyohara Exp $	*/
+/*	$NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.18 2016/07/11 14:53:05 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $");
 
 #define _INTR_PRIVATE
 
@@ -50,9 +50,13 @@ __KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 
 #if NGPIO > 0
@@ -60,6 +64,13 @@ __KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c
 #include 
 #endif
 
+static const struct omap_module gpio_module[] = {
+	{ 0, 0 },
+	{ AM335X_PRCM_CM_PER, CM_PER_GPIO1_CLKCTRL },
+	{ AM335X_PRCM_CM_PER, CM_PER_GPIO2_CLKCTRL },
+	{ AM335X_PRCM_CM_PER, CM_PER_GPIO3_CLKCTRL },
+};
+
 static void gpio_pic_block_irqs(struct pic_softc *, size_t, uint32_t);
 static void gpio_pic_block_irqs2(struct pic_softc *, size_t, uint32_t);
 static void gpio_pic_unblock_irqs(struct pic_softc *, size_t, uint32_t);
@@ -318,16 +329,11 @@ omap2gpio_pin_write(void *arg, int pin, 
 {
 	struct gpio_softc * const gpio = arg;
 	uint32_t mask = 1 << pin;
-	uint32_t old, new;
 
-	old = GPIO_READ(gpio, GPIO_DATAOUT);
 	if (value)
-		new = old | mask;
+		GPIO_WRITE(gpio, GPIO_SETDATAOUT, mask);
 	else
-		new = old & ~mask;
-
-	if (old != new)
-		GPIO_WRITE(gpio, GPIO_DATAOUT, new);
+		GPIO_WRITE(gpio, GPIO_CLEARDATAOUT, mask);
 }
 
 static void
@@ -524,6 +530,23 @@ gpio_attach(device_t parent, device_t se
 		aprint_normal(", intr %d", oa->obio_intr);
 	}
 	aprint_normal("\n");
+
+#ifdef TI_AM335X
+	switch (oa->obio_addr) {
+	case GPIO0_BASE_TI_AM335X:
+		break;
+	case GPIO1_BASE_TI_AM335X:
+		prcm_module_enable(_module[1]);
+		break;
+	case GPIO2_BASE_TI_AM335X:
+		prcm_module_enable(_module[2]);
+		break;
+	case GPIO3_BASE_TI_AM335X:
+		prcm_module_enable(_module[3]);
+		break;
+	}
+#endif
+
 #if NGPIO > 0
 #if 0
 	config_interrupts(self, gpio_attach1);



CVS commit: src/sys/arch/arm/omap

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:11:56 UTC 2016

Modified Files:
src/sys/arch/arm/omap: files.omap2 omap2_gpio.c

Log Message:
Support TI_AM335X gpio to omap2_gpio.c.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/omap/files.omap2
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/omap/omap2_gpio.c

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



CVS commit: src/sys/arch/arm/omap

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:08:59 UTC 2016

Modified Files:
src/sys/arch/arm/omap: ti_iic.c ti_iicreg.h

Log Message:
Fix broken settings for AM335X's I2C[12].


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/ti_iic.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/ti_iicreg.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/omap/ti_iic.c
diff -u src/sys/arch/arm/omap/ti_iic.c:1.8 src/sys/arch/arm/omap/ti_iic.c:1.9
--- src/sys/arch/arm/omap/ti_iic.c:1.8	Sat Oct 15 15:00:12 2016
+++ src/sys/arch/arm/omap/ti_iic.c	Sat Oct 15 15:08:59 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_iic.c,v 1.8 2016/10/15 15:00:12 kiyohara Exp $ */
+/* $NetBSD: ti_iic.c,v 1.9 2016/10/15 15:08:59 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.8 2016/10/15 15:00:12 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.9 2016/10/15 15:08:59 kiyohara Exp $");
 
 #include "opt_omap.h"
 #include "locators.h"
@@ -163,7 +163,7 @@ struct am335x_iic {
 static const struct am335x_iic am335x_iic[] = {
 	{ "I2C0", OMAP2_I2C0_BASE, 70, { AM335X_PRCM_CM_WKUP, 0xb8 } },
 	{ "I2C1", OMAP2_I2C1_BASE, 71, { AM335X_PRCM_CM_PER, 0x48 } },
-	{ "I2C2", OMAP2_I2C1_BASE, 30, { AM335X_PRCM_CM_PER, 0x44 } },
+	{ "I2C2", OMAP2_I2C2_BASE, 30, { AM335X_PRCM_CM_PER, 0x44 } },
 };
 #endif
 
@@ -199,6 +199,7 @@ ti_iic_attach(device_t parent, device_t 
 {
 	struct ti_iic_softc *sc = device_private(self);
 	struct obio_attach_args *obio = opaque;
+	int scheme, major, minor, fifodepth, fifo;
 	uint16_t rev;
 #ifdef TI_AM335X
 	int i;
@@ -219,8 +220,6 @@ ti_iic_attach(device_t parent, device_t 
 	sc->sc_ic.ic_release_bus = ti_iic_release_bus;
 	sc->sc_ic.ic_exec = ti_iic_exec;
 
-	sc->sc_rxthres = sc->sc_txthres = 4;
-
 	if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size,
 	0, >sc_ioh) != 0) {
 		aprint_error(": couldn't map address space\n");
@@ -248,27 +247,40 @@ ti_iic_attach(device_t parent, device_t 
 	snprintf(buf, sizeof(buf), "%s_SDA", am335x_iic[i].as_name);
 	if (sitara_cm_padconf_get(buf, , ) == 0) {
 		aprint_debug(": SDA mode %s state %d ", mode, state);
-	}
-	if (sitara_cm_padconf_set(buf, buf,
-	(0x01 << 4) | (0x01 << 5) | (0x01 << 6)) != 0) {
-		aprint_error(": can't switch %s pad\n", buf);
-		return;
+
+		if (sitara_cm_padconf_set(buf, buf,
+		(0x01 << 4) | (0x01 << 5) | (0x01 << 6)) != 0) {
+			aprint_error(": can't switch %s pad\n", buf);
+			return;
+		}
 	}
 	snprintf(buf, sizeof(buf), "%s_SCL", am335x_iic[i].as_name);
 	if (sitara_cm_padconf_get(buf, , ) == 0) {
 		aprint_debug(": SCL mode %s state %d ", mode, state);
-	}
-	if (sitara_cm_padconf_set(buf, buf,
-	(0x01 << 4) | (0x01 << 5) | (0x01 << 6)) != 0) {
-		aprint_error(": can't switch %s pad\n", buf);
-		return;
+
+		if (sitara_cm_padconf_set(buf, buf,
+		(0x01 << 4) | (0x01 << 5) | (0x01 << 6)) != 0) {
+			aprint_error(": can't switch %s pad\n", buf);
+			return;
+		}
 	}
 #endif
 
+	scheme = I2C_REVNB_HI_SCHEME(I2C_READ_REG(sc, OMAP2_I2C_REVNB_HI));
 	rev = I2C_READ_REG(sc, OMAP2_I2C_REVNB_LO);
-	aprint_normal(": rev %d.%d\n",
-	(int)I2C_REVNB_LO_MAJOR(rev),
-	(int)I2C_REVNB_LO_MINOR(rev));
+	if (scheme == 0) {
+		major = I2C_REV_SCHEME_0_MAJOR(rev);
+		minor = I2C_REV_SCHEME_0_MINOR(rev);
+	} else {
+		major = I2C_REVNB_LO_MAJOR(rev);
+		minor = I2C_REVNB_LO_MINOR(rev);
+	}
+	aprint_normal(": rev %d.%d, scheme %d\n", major, minor, scheme);
+
+	fifodepth = I2C_BUFSTAT_FIFODEPTH(I2C_READ_REG(sc, OMAP2_I2C_BUFSTAT));
+	fifo = OMAP2_I2C_FIFOBYTES(fifodepth);
+	aprint_normal_dev(self, "%d-bytes FIFO\n", fifo);
+	sc->sc_rxthres = sc->sc_txthres = fifo >> 1;
 
 	ti_iic_reset(sc);
 	ti_iic_flush(sc);
@@ -310,9 +322,9 @@ ti_iic_intr(void *arg)
 	mutex_enter(>sc_mtx);
 	DPRINTF(("ti_iic_intr\n"));
 	stat = I2C_READ_REG(sc, OMAP2_I2C_IRQSTATUS);
-	I2C_WRITE_REG(sc, OMAP2_I2C_IRQSTATUS, stat);
 	DPRINTF(("ti_iic_intr pre handle sc->sc_op eq %#x\n", sc->sc_op));
 	ti_iic_handle_intr(sc, stat);
+	I2C_WRITE_REG(sc, OMAP2_I2C_IRQSTATUS, stat);
 	if (sc->sc_op == TI_I2CERROR || sc->sc_op == TI_I2CDONE) {
 		DPRINTF(("ti_iic_intr post handle sc->sc_op %#x\n", sc->sc_op));
 		cv_signal(>sc_cv);
@@ -418,7 +430,7 @@ ti_iic_reset(struct ti_iic_softc *sc)
 		aprint_error_dev(sc->sc_dev, ": couldn't reset module\n");
 		return 1;
 	}
-			
+
 
 	/* XXX standard speed only */
 	psc = 3;
@@ -451,7 +463,7 @@ ti_iic_op(struct ti_iic_softc *sc, i2c_a
 	int err, retry;
 
 	KASSERT(op == TI_I2CREAD || op == TI_I2CWRITE);
-	DPRINTF(("ti_iic_op: addr %#x op %#x buf %p buflen %#x flags %#x\n", 
+	DPRINTF(("ti_iic_op: addr %#x op %#x buf %p buflen %#x flags %#x\n",
 	addr, op, buf, (unsigned int) buflen, flags));
 
 	mask = I2C_IRQSTATUS_ARDY | I2C_IRQSTATUS_NACK | 

CVS commit: src/sys/arch/arm/omap

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:08:59 UTC 2016

Modified Files:
src/sys/arch/arm/omap: ti_iic.c ti_iicreg.h

Log Message:
Fix broken settings for AM335X's I2C[12].


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/ti_iic.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/ti_iicreg.h

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



CVS commit: src/sys/arch/arm/omap

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:00:13 UTC 2016

Modified Files:
src/sys/arch/arm/omap: ti_iic.c

Log Message:
Add support OMAP_4430.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/omap/ti_iic.c

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



CVS commit: src/sys/arch/arm/omap

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 15:00:13 UTC 2016

Modified Files:
src/sys/arch/arm/omap: ti_iic.c

Log Message:
Add support OMAP_4430.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/omap/ti_iic.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/omap/ti_iic.c
diff -u src/sys/arch/arm/omap/ti_iic.c:1.7 src/sys/arch/arm/omap/ti_iic.c:1.8
--- src/sys/arch/arm/omap/ti_iic.c:1.7	Wed Mar 26 11:59:05 2014
+++ src/sys/arch/arm/omap/ti_iic.c	Sat Oct 15 15:00:12 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_iic.c,v 1.7 2014/03/26 11:59:05 ozaki-r Exp $ */
+/* $NetBSD: ti_iic.c,v 1.8 2016/10/15 15:00:12 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.7 2014/03/26 11:59:05 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.8 2016/10/15 15:00:12 kiyohara Exp $");
 
 #include "opt_omap.h"
 #include "locators.h"
@@ -183,6 +183,13 @@ ti_iic_match(device_t parent, cfdata_t m
 	obio->obio_addr == OMAP2_I2C2_BASE)
 		return 1;
 #endif
+#if defined(OMAP_4430)
+	if (obio->obio_addr == 0x4807 ||	/* I2C1 */
+	obio->obio_addr == 0x48072000 ||	/* I2C2 */
+	obio->obio_addr == 0x4806 ||	/* I2C3 */
+	obio->obio_addr == 0x4835)	/* I2C4 */
+		return 1;
+#endif
 
 	return 0;
 }



CVS commit: src/sys/dev/i2c

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 14:40:41 UTC 2016

Modified Files:
src/sys/dev/i2c: tps65217pmic.c

Log Message:
Add White LED initialize function.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/tps65217pmic.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/dev/i2c/tps65217pmic.c
diff -u src/sys/dev/i2c/tps65217pmic.c:1.10 src/sys/dev/i2c/tps65217pmic.c:1.11
--- src/sys/dev/i2c/tps65217pmic.c:1.10	Sun Jul 20 23:01:22 2014
+++ src/sys/dev/i2c/tps65217pmic.c	Sat Oct 15 14:40:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tps65217pmic.c,v 1.10 2014/07/20 23:01:22 bouyer Exp $ */
+/*	$NetBSD: tps65217pmic.c,v 1.11 2016/10/15 14:40:41 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tps65217pmic.c,v 1.10 2014/07/20 23:01:22 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tps65217pmic.c,v 1.11 2016/10/15 14:40:41 kiyohara Exp $");
 
 #include 
 #include 
@@ -154,6 +154,8 @@ static void tps65217pmic_envsys_refresh(
 static void tps65217pmic_power_monitor_init(struct tps65217pmic_softc *);
 static void tps65217pmic_power_monitor(void *);
 
+static void tps65217pmic_wled_init(struct tps65217pmic_softc *, int, int, int);
+
 CFATTACH_DECL_NEW(tps65217pmic, sizeof (struct tps65217pmic_softc),
 tps65217pmic_match, tps65217pmic_attach, NULL, NULL);
 
@@ -291,11 +293,20 @@ tps65217pmic_attach(device_t parent, dev
 {
 	struct tps65217pmic_softc *sc = device_private(self);
 	struct i2c_attach_args *ia = aux;
+	prop_dictionary_t dict;
+	int isel, fdim, brightness;
 
 	sc->sc_dev = self;
 	sc->sc_addr = ia->ia_addr;
 	sc->sc_tag = ia->ia_tag;
 
+	dict = device_properties(self);
+	if (prop_dictionary_get_int32(dict, "isel", )) {
+		prop_dictionary_get_int32(dict, "fdim", );
+		prop_dictionary_get_int32(dict, "brightness", );
+	} else
+		isel = -1;
+
 	tps65217pmic_version(sc);
 
 	aprint_normal(": TPS65217");
@@ -333,6 +344,9 @@ tps65217pmic_attach(device_t parent, dev
 
 	tps65217pmic_power_monitor_init(sc);
 
+	if (isel != -1)
+		tps65217pmic_wled_init(sc, isel, fdim, brightness);
+
 	tps65217pmic_envsys_register(sc);
 }
 
@@ -409,6 +423,55 @@ tps65217pmic_power_monitor(void *aux)
 }
 
 static void
+tps65217pmic_wled_init(struct tps65217pmic_softc *sc, int isel, int fdim,
+		   int brightness)
+{
+	uint8_t val = 0;
+
+	switch (isel) {
+	case 1:
+	case 2:
+		val |= ((isel - 1) << TPS65217PMIC_WLEDCTRL1_ISEL);
+		break;
+	default:
+		aprint_error_dev(sc->sc_dev,
+		"WLED ISET selection is 1 or 2: isel %d\n", isel);
+		return;
+	}
+	switch (fdim) {
+	case 100:
+		val |= TPS65217PMIC_WLEDCTRL1_FDIM_100Hz;
+		break;
+	case 200:
+		val |= TPS65217PMIC_WLEDCTRL1_FDIM_200Hz;
+		break;
+	case 500:
+		val |= TPS65217PMIC_WLEDCTRL1_FDIM_500Hz;
+		break;
+	case 1000:
+		val |= TPS65217PMIC_WLEDCTRL1_FDIM_1000Hz;
+		break;
+	default:
+		aprint_error_dev(sc->sc_dev,
+		"WLED PWM dimming frequency is 100, 200, 500 or 1000:"
+		" fdim %d\n", fdim);
+		return;
+	}
+	if (brightness > 100 ||
+	brightness < 0) {
+		aprint_error_dev(sc->sc_dev,
+		"invalid brightness: between 0 and 100: %d\n", brightness);
+		return;
+	}
+
+	tps65217pmic_reg_write(sc, TPS65217PMIC_WLEDCTRL1, val);
+	tps65217pmic_reg_write(sc, TPS65217PMIC_WLEDCTRL2,
+	(brightness - 1) & TPS65217PMIC_WLEDCTRL2_DUTY);
+	val |= TPS65217PMIC_WLEDCTRL1_ISINK_EN;
+	tps65217pmic_reg_write(sc, TPS65217PMIC_WLEDCTRL1, val);
+}
+
+static void
 tps65217pmic_reg_refresh(struct tps65217pmic_softc *sc)
 {
 	int i;



CVS commit: src/sys/dev/i2c

2016-10-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Oct 15 14:40:41 UTC 2016

Modified Files:
src/sys/dev/i2c: tps65217pmic.c

Log Message:
Add White LED initialize function.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/tps65217pmic.c

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



CVS commit: src/sys/dev/marvell

2016-10-10 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Oct 10 14:23:35 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
The bus_dmamap_sync(PREREAD) is unnecessary for sent mbuf.
Moreover bus_dmamap_sync(POSTWRITE), before unload.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/marvell/if_mvxpe.c

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



CVS commit: src/sys/dev/marvell

2016-10-10 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Oct 10 14:23:35 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
The bus_dmamap_sync(PREREAD) is unnecessary for sent mbuf.
Moreover bus_dmamap_sync(POSTWRITE), before unload.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/marvell/if_mvxpe.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/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.13 src/sys/dev/marvell/if_mvxpe.c:1.14
--- src/sys/dev/marvell/if_mvxpe.c:1.13	Fri Jun 10 13:27:14 2016
+++ src/sys/dev/marvell/if_mvxpe.c	Mon Oct 10 14:23:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.13 2016/06/10 13:27:14 ozaki-r Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.14 2016/10/10 14:23:35 kiyohara Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.13 2016/06/10 13:27:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.14 2016/10/10 14:23:35 kiyohara Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1141,6 +1141,7 @@ mvxpe_ring_flush_queue(struct mvxpe_soft
 {
 	struct mvxpe_rx_ring *rx = MVXPE_RX_RING(sc, q);
 	struct mvxpe_tx_ring *tx = MVXPE_TX_RING(sc, q);
+	struct mbuf *m;
 	int i;
 
 	KASSERT_RX_MTX(sc, q);
@@ -1157,11 +1158,15 @@ mvxpe_ring_flush_queue(struct mvxpe_soft
 
 	/* Tx handle */
 	for (i = 0; i < MVXPE_TX_RING_CNT; i++) {
-		if (MVXPE_TX_MBUF(sc, q, i) == NULL)
+		m = MVXPE_TX_MBUF(sc, q, i);
+		if (m == NULL)
 			continue;
-		bus_dmamap_unload(sc->sc_dmat, MVXPE_TX_MAP(sc, q, i));
-		m_freem(MVXPE_TX_MBUF(sc, q, i));
 		MVXPE_TX_MBUF(sc, q, i) = NULL;
+		bus_dmamap_sync(sc->sc_dmat,
+		MVXPE_TX_MAP(sc, q, i), 0, m->m_pkthdr.len,
+		BUS_DMASYNC_POSTWRITE);
+		bus_dmamap_unload(sc->sc_dmat, MVXPE_TX_MAP(sc, q, i));
+		m_freem(m);
 	}
 	tx->tx_dma = tx->tx_cpu = 0;
	tx->tx_used = 0;
@@ -2141,7 +2146,7 @@ mvxpe_tx_queue(struct mvxpe_softc *sc, s
 	MVXPE_TX_MBUF(sc, q, tx->tx_cpu) = m;
 	bus_dmamap_sync(sc->sc_dmat,
 	MVXPE_TX_MAP(sc, q, tx->tx_cpu), 0, m->m_pkthdr.len,
-	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+	BUS_DMASYNC_PREWRITE);
 
 	/* load to tx descriptors */
 	start = tx->tx_cpu;
@@ -2302,6 +2307,7 @@ mvxpe_tx_queue_complete(struct mvxpe_sof
 {
 	struct mvxpe_tx_ring *tx = MVXPE_TX_RING(sc, q);
 	struct mvxpe_tx_desc *t;
+	struct mbuf *m;
 	uint32_t ptxs, ptxsu, ndesc;
 	int i;
 
@@ -2342,12 +2348,16 @@ mvxpe_tx_queue_complete(struct mvxpe_sof
 			}
 			error = 1;
 		}
-		if (MVXPE_TX_MBUF(sc, q, tx->tx_dma) != NULL) {
+		m = MVXPE_TX_MBUF(sc, q, tx->tx_dma);
+		if (m != NULL) {
 			KASSERT((t->command & MVXPE_TX_CMD_F) != 0);
+			MVXPE_TX_MBUF(sc, q, tx->tx_dma) = NULL;
+			bus_dmamap_sync(sc->sc_dmat,
+			MVXPE_TX_MAP(sc, q, tx->tx_dma), 0, m->m_pkthdr.len,
+			BUS_DMASYNC_POSTWRITE);
 			bus_dmamap_unload(sc->sc_dmat,
 			MVXPE_TX_MAP(sc, q, tx->tx_dma));
-			m_freem(MVXPE_TX_MBUF(sc, q, tx->tx_dma));
-			MVXPE_TX_MBUF(sc, q, tx->tx_dma) = NULL;
+			m_freem(m);
 			sc->sc_tx_pending--;
 		}
 		else



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

2016-10-05 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Oct  5 13:25:25 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: BEAGLEBOARDXM

Log Message:
Comment-out don't matched sdhc.  omap's sdhc not support TI_DM37XX now. However 
Overo FireSTORM(DM3730) work fine with OVERO(OMAP_3530 only).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/BEAGLEBOARDXM

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



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

2016-10-05 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Oct  5 13:25:25 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: BEAGLEBOARDXM

Log Message:
Comment-out don't matched sdhc.  omap's sdhc not support TI_DM37XX now. However 
Overo FireSTORM(DM3730) work fine with OVERO(OMAP_3530 only).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/BEAGLEBOARDXM

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/conf/BEAGLEBOARDXM
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARDXM:1.21 src/sys/arch/evbarm/conf/BEAGLEBOARDXM:1.22
--- src/sys/arch/evbarm/conf/BEAGLEBOARDXM:1.21	Fri Jun 24 12:22:09 2016
+++ src/sys/arch/evbarm/conf/BEAGLEBOARDXM	Wed Oct  5 13:25:25 2016
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARDXM,v 1.21 2016/06/24 12:22:09 skrll Exp $
+#	$NetBSD: BEAGLEBOARDXM,v 1.22 2016/10/05 13:25:25 kiyohara Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -176,11 +176,11 @@ obio2		at mainbus? base 0x4900 size 
 gpmc0		at mainbus? base 0x6e00
 
 # SDHC controllers
-sdhc0		at obio0 addr 0x4809C000 size 0x0400 intr 83
+#sdhc0		at obio0 addr 0x4809C000 size 0x0400 intr 83
 #sdhc1		at obio0 addr 0x480B4000 size 0x0400 intr 86
 #sdhc2		at obio0 addr 0x480AD000 size 0x0400 intr 94
-sdmmc*		at sdhc?		# SD/MMC bus
-ld*		at sdmmc?
+#sdmmc*		at sdhc?		# SD/MMC bus
+#ld*		at sdmmc?
 
 # Interrupt Controller
 omapicu0	at obio0 addr 0x4820 size 0x1000 intrbase 0



CVS commit: src/sys/arch/arm/omap

2016-10-05 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Oct  5 13:12:08 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap3_sdhc.c

Log Message:
Fix rejected patch.
  Support am335x's MMCHS2(sdhc@mainbus).
Tested on Gumstix Pepper 43C.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/omap/omap3_sdhc.c

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



CVS commit: src/sys/arch/arm/omap

2016-10-05 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Oct  5 13:12:08 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap3_sdhc.c

Log Message:
Fix rejected patch.
  Support am335x's MMCHS2(sdhc@mainbus).
Tested on Gumstix Pepper 43C.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c
diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.26 src/sys/arch/arm/omap/omap3_sdhc.c:1.27
--- src/sys/arch/arm/omap/omap3_sdhc.c:1.26	Tue Oct  4 16:06:42 2016
+++ src/sys/arch/arm/omap/omap3_sdhc.c	Wed Oct  5 13:12:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap3_sdhc.c,v 1.26 2016/10/04 16:06:42 kiyohara Exp $	*/
+/*	$NetBSD: omap3_sdhc.c,v 1.27 2016/10/05 13:12:08 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.26 2016/10/04 16:06:42 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.27 2016/10/05 13:12:08 kiyohara Exp $");
 
 #include "opt_omap.h"
 #include "edma.h"
@@ -483,32 +483,36 @@ no_dma:
 		delay(1);
 	}
 	if (timo == 0)
-		aprint_error_dev(self, "Soft reset timeout\n");
+		aprint_error_dev(dev, "Soft reset timeout\n");
 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, MMCHS_SYSCONFIG,
-	SYSCONFIG_ENAWAKEUP | SYSCONFIG_AUTOIDLE | SYSCONFIG_SIDLEMODE_AUTO |
-	SYSCONFIG_CLOCKACTIVITY_FCLK | SYSCONFIG_CLOCKACTIVITY_ICLK);
+	SYSCONFIG_ENAWAKEUP |
+	SYSCONFIG_AUTOIDLE |
+	SYSCONFIG_SIDLEMODE_AUTO |
+	SYSCONFIG_CLOCKACTIVITY_FCLK |
+	SYSCONFIG_CLOCKACTIVITY_ICLK);
 
-	sc->sc_ih = intr_establish(oa->obio_intr, IPL_VM, IST_LEVEL,
+	sc->sc_ih = intr_establish(sc->sc_irq, IPL_VM, IST_LEVEL,
 	sdhc_intr, >sc);
 	if (sc->sc_ih == NULL) {
-		aprint_error_dev(self, "failed to establish interrupt %d\n",
-		 oa->obio_intr);
-		goto fail;
+		aprint_error_dev(dev, "failed to establish interrupt %d\n",
+		 sc->sc_irq);
+		return;
 	}
 
 	error = sdhc_host_found(>sc, sc->sc_bst, sc->sc_sdhc_bsh,
-	oa->obio_size - OMAP3_SDMMC_SDHC_OFFSET);
+	OMAP3_SDMMC_SDHC_SIZE);
 	if (error != 0) {
-		aprint_error_dev(self, "couldn't initialize host, error=%d\n",
+		aprint_error_dev(dev, "couldn't initialize host, error=%d\n",
 		error);
-		goto fail;
+		intr_disestablish(sc->sc_ih);
+		return;
 	}
 
+	clksft = ffs(sc->sc.sc_clkmsk) - 1;
+
 	/* Set SDVS 1.8v and DTW 1bit mode */
 	SDHC_WRITE(sc, SDHC_HOST_CTL,
 	SDHC_VOLTAGE_1_8V << (SDHC_VOLTAGE_SHIFT + 8));
-	bus_space_write_4(sc->sc_bst, sc->sc_bsh, MMCHS_CON,
-	bus_space_read_4(sc->sc_bst, sc->sc_bsh, MMCHS_CON) | CON_OD);
 	SDHC_WRITE(sc, SDHC_CLOCK_CTL,
 	SDHC_READ(sc, SDHC_CLOCK_CTL) | SDHC_INTCLK_ENABLE |
 			SDHC_SDCLK_ENABLE);



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

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:22:43 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: OVERO

Log Message:
Enable com2, sdhc1.
And add flash@nand@omapnand.
And smsh's locator use "cs" instead of "addr".


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/evbarm/conf/OVERO

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



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

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:22:43 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: OVERO

Log Message:
Enable com2, sdhc1.
And add flash@nand@omapnand.
And smsh's locator use "cs" instead of "addr".


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/evbarm/conf/OVERO

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/conf/OVERO
diff -u src/sys/arch/evbarm/conf/OVERO:1.44 src/sys/arch/evbarm/conf/OVERO:1.45
--- src/sys/arch/evbarm/conf/OVERO:1.44	Thu Aug  4 07:02:39 2016
+++ src/sys/arch/evbarm/conf/OVERO	Tue Oct  4 16:22:43 2016
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: OVERO,v 1.44 2016/08/04 07:02:39 kiyohara Exp $
+#	$NetBSD: OVERO,v 1.45 2016/10/04 16:22:43 kiyohara Exp $
 #
 #	OVERO -- Gumstix. Inc. Overo COMS platforms kernel
 #
@@ -205,6 +205,7 @@ tps65950pm3	at iic0 addr 0x4b
 com0		at obio2 addr 0x4902 intr 74 mult 4	# UART3 (console)
 options CONSADDR=0x4902, CONSPEED=115200
 #com1		at obio0 addr 0x4806c000 intr 73 mult 4	# UART2 (bluetooth)
+com2		at obio0 addr 0x4806a000 intr 72 mult 4	# UART1 (Gallop's GPS)
 
 # Operating System Timer
 omapmputmr0	at obio2 addr 0x49032000 intr 38		# GP Timer 2
@@ -226,11 +227,27 @@ prcm*		at obio1 addr 0x48306000 size 0x2
 
 # SDHC controllers
 sdhc0		at obio0 addr 0x4809c000 size 0x1000 intr 83
-#sdhc1		at obio0 addr 0x480b4000 size 0x1000 intr 86 # Wifi
+sdhc1		at obio0 addr 0x480b4000 size 0x1000 intr 86 # Wifi
 
 sdmmc*		at sdhc?	# SD/MMC bus
 ld*		at sdmmc?
 
+# NAND controller
+omapnand0	at gpmc? cs 0
+
+# NAND layer
+nand0		at nandbus?
+
+# use the bad block table
+options NAND_BBT
+
+# Define flash partitions for board
+flash0		at nand0 offset 0x00 size 0x08 readonly 1 # SPL
+flash1		at nand0 offset 0x08 size 0x1c readonly 1 # U-Boot
+flash2		at nand0 offset 0x24 size 0x04 readonly 1 # Environment
+flash3		at nand0 offset 0x28 size 0x80		# Kernel
+flash4		at nand0 offset 0xa8 size 0			# Filesystem
+
 # Hardware clocking and power management
 
 options		HWCLOCK
@@ -240,8 +257,8 @@ options		OMAP_CK_REF_SPEED=1200
 # overo expansion boards
 
 # SMSC LAN9221
-smsh0		at gpmc? addr 0x0100 intr 272	# Tobi, Chestnut43
-smsh1		at gpmc? addr 0x0200 intr 161	# Tobi-Duo
+smsh0		at gpmc? cs 5 intr 272			# Tobi, Chestnut43
+smsh1		at gpmc? cs 4 intr 161			# Tobi-Duo
 
 # MII/PHY support
 ukphy*		at mii? phy ?# smsh(4) internal PHY
@@ -336,7 +353,7 @@ options 	RND_COM
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	ksyms			# /dev/ksyms
 #pseudo-device	btuart			# Bluetooth HCI UART (H4)
-	# connect CSR module
+	# CSR or WiLink 8 module
 
 # a pseudo device needed for Coda	# also needs CODA (above)
 #pseudo-device	vcoda			# coda minicache <-> venus comm.



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

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:18:38 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: mk.gumstix

Log Message:
Add KERNEL_BASE_PHYS for duovero and pepper.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/mk.gumstix

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/conf/mk.gumstix
diff -u src/sys/arch/evbarm/conf/mk.gumstix:1.5 src/sys/arch/evbarm/conf/mk.gumstix:1.6
--- src/sys/arch/evbarm/conf/mk.gumstix:1.5	Tue Apr 19 12:02:55 2016
+++ src/sys/arch/evbarm/conf/mk.gumstix	Tue Oct  4 16:18:38 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: mk.gumstix,v 1.5 2016/04/19 12:02:55 kiyohara Exp $
+#	$NetBSD: mk.gumstix,v 1.6 2016/10/04 16:18:38 kiyohara Exp $
 
 SYSTEM_FIRST_OBJ=	gumstix_start.o
 SYSTEM_FIRST_SFILE=	${THISARM}/gumstix/gumstix_start.S
@@ -9,6 +9,10 @@ _OSRELEASE!=${HOST_SH} $S/co
 KERNEL_BASE_PHYS=0xa020
 .elif ${BOARDTYPE} == "overo"
 KERNEL_BASE_PHYS=$(LOADADDRESS)
+.elif ${BOARDTYPE} == "duovero"
+KERNEL_BASE_PHYS=$(LOADADDRESS)
+.elif ${BOARDTYPE} == "pepper"
+KERNEL_BASE_PHYS=$(LOADADDRESS)
 .endif
 KERNEL_BASE_VIRT=$(LOADADDRESS)
 



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

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:18:38 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: mk.gumstix

Log Message:
Add KERNEL_BASE_PHYS for duovero and pepper.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/mk.gumstix

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



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

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:17:37 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: std.overo

Log Message:
Enable TPIDRPRW_IS_CURCPU.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/std.overo

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/conf/std.overo
diff -u src/sys/arch/evbarm/conf/std.overo:1.7 src/sys/arch/evbarm/conf/std.overo:1.8
--- src/sys/arch/evbarm/conf/std.overo:1.7	Thu Aug  4 07:02:39 2016
+++ src/sys/arch/evbarm/conf/std.overo	Tue Oct  4 16:17:37 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: std.overo,v 1.7 2016/08/04 07:02:39 kiyohara Exp $
+#	$NetBSD: std.overo,v 1.8 2016/10/04 16:17:37 kiyohara Exp $
 #
 # standard NetBSD/evbarm for OVERO options
 
@@ -9,7 +9,7 @@ include		"arch/evbarm/conf/files.overo"
 
 options 	CORTEX_PMC
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
-#options 	TPIDRPRW_IS_CURLWP
+options 	TPIDRPRW_IS_CURCPU
 
 options 	KERNEL_BASE_EXT=0x8000
 makeoptions	LOADADDRESS="0x8020"



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

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:17:37 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: std.overo

Log Message:
Enable TPIDRPRW_IS_CURCPU.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/std.overo

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



CVS commit: src/sys/arch/arm/omap

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:10:34 UTC 2016

Modified Files:
src/sys/arch/arm/omap: files.omap2

Log Message:
Support am335x's MMCHS2(sdhc@mainbus).
  Tested on Gumstix Pepper 43C.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/omap/files.omap2

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/omap/files.omap2
diff -u src/sys/arch/arm/omap/files.omap2:1.34 src/sys/arch/arm/omap/files.omap2:1.35
--- src/sys/arch/arm/omap/files.omap2:1.34	Tue Oct  4 15:23:40 2016
+++ src/sys/arch/arm/omap/files.omap2	Tue Oct  4 16:10:34 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: files.omap2,v 1.34 2016/10/04 15:23:40 kiyohara Exp $
+#	$NetBSD: files.omap2,v 1.35 2016/10/04 16:10:34 kiyohara Exp $
 #
 # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
 # Based on xscale/files.pxa2x0
@@ -134,8 +134,9 @@ file	arch/arm/omap/tiotg.c			tiotg
 attach  motg at tiotg_port
 
 # SDMMC controller
+attach	sdhc at mainbus with mainbussdhc
 attach	sdhc at obio with obiosdhc
-file	arch/arm/omap/omap3_sdhc.c		obiosdhc
+file	arch/arm/omap/omap3_sdhc.c		mainbussdhc | obiosdhc
 
 # NAND flash controller
 device	omapnand: nandbus



CVS commit: src/sys/arch/arm/omap

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:10:34 UTC 2016

Modified Files:
src/sys/arch/arm/omap: files.omap2

Log Message:
Support am335x's MMCHS2(sdhc@mainbus).
  Tested on Gumstix Pepper 43C.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/omap/files.omap2

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



CVS commit: src/sys/arch/arm/omap

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:06:42 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap3_sdhc.c

Log Message:
Support am335x's MMCHS2(sdhc@mainbus).
  Tested on Gumstix Pepper 43C.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/omap/omap3_sdhc.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/omap/omap3_sdhc.c
diff -u src/sys/arch/arm/omap/omap3_sdhc.c:1.25 src/sys/arch/arm/omap/omap3_sdhc.c:1.26
--- src/sys/arch/arm/omap/omap3_sdhc.c:1.25	Tue Oct  4 15:51:34 2016
+++ src/sys/arch/arm/omap/omap3_sdhc.c	Tue Oct  4 16:06:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap3_sdhc.c,v 1.25 2016/10/04 15:51:34 kiyohara Exp $	*/
+/*	$NetBSD: omap3_sdhc.c,v 1.26 2016/10/04 16:06:42 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.25 2016/10/04 15:51:34 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.26 2016/10/04 16:06:42 kiyohara Exp $");
 
 #include "opt_omap.h"
 #include "edma.h"
@@ -37,6 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -49,8 +50,10 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c
 #include 
 
 #ifdef TI_AM335X
+#  include 
 #  include 
 #  include 
+#  include 
 #  include 
 #  include 
 #endif
@@ -82,25 +85,19 @@ int om3sdhcdebug = 1;
 #define SDHC_WRITE(sc, reg, val) \
 	bus_space_write_4((sc)->sc_bst, (sc)->sc_sdhc_bsh, (reg), (val))
 
-static int obiosdhc_match(device_t, cfdata_t, void *);
-static void obiosdhc_attach(device_t, device_t, void *);
-static int obiosdhc_detach(device_t, int);
-
-static int obiosdhc_bus_width(struct sdhc_softc *, int);
-static int obiosdhc_rod(struct sdhc_softc *, int);
-static int obiosdhc_write_protect(struct sdhc_softc *);
-static int obiosdhc_card_detect(struct sdhc_softc *);
-
-struct obiosdhc_softc {
+struct mmchs_softc {
 	struct sdhc_softc	sc;
+	bus_addr_t		sc_addr;
 	bus_space_tag_t		sc_bst;
 	bus_space_handle_t	sc_bsh;
 	bus_space_handle_t	sc_hl_bsh;
 	bus_space_handle_t	sc_sdhc_bsh;
 	struct sdhc_host	*sc_hosts[1];
+	int			sc_irq;
 	void 			*sc_ih;		/* interrupt vectoring */
 
 #if NEDMA > 0
+	int			sc_edmabase;
 	struct edma_channel	*sc_edma_tx;
 	struct edma_channel	*sc_edma_rx;
 	uint16_t		sc_edma_param_tx[EDMA_MAX_PARAMS];
@@ -114,26 +111,45 @@ struct obiosdhc_softc {
 #endif
 };
 
+static int obiosdhc_match(device_t, cfdata_t, void *);
+static void obiosdhc_attach(device_t, device_t, void *);
+#ifdef TI_AM335X
+static int mainbussdhc_match(device_t, cfdata_t, void *);
+static void mainbussdhc_attach(device_t, device_t, void *);
+#endif
+static int mmchs_detach(device_t, int);
+
+static int mmchs_attach(struct mmchs_softc *);
+static void mmchs_init(device_t);
+
+static int mmchs_bus_width(struct sdhc_softc *, int);
+static int mmchs_rod(struct sdhc_softc *, int);
+static int mmchs_write_protect(struct sdhc_softc *);
+static int mmchs_card_detect(struct sdhc_softc *);
+
 #if NEDMA > 0
-static int obiosdhc_edma_init(struct obiosdhc_softc *, unsigned int);
-static int obiosdhc_edma_xfer_data(struct sdhc_softc *, struct sdmmc_command *);
-static void obiosdhc_edma_done(void *);
-static int obiosdhc_edma_transfer(struct sdhc_softc *, struct sdmmc_command *);
+static int mmchs_edma_init(struct mmchs_softc *, unsigned int);
+static int mmchs_edma_xfer_data(struct sdhc_softc *, struct sdmmc_command *);
+static void mmchs_edma_done(void *);
+static int mmchs_edma_transfer(struct sdhc_softc *, struct sdmmc_command *);
 #endif
 
 #ifdef TI_AM335X
-struct am335x_sdhc {
+struct am335x_mmchs {
 	const char *as_name;
+	const char *as_parent_name;
 	bus_addr_t as_base_addr;
 	int as_intr;
 	struct omap_module as_module;
 };
 
-static const struct am335x_sdhc am335x_sdhc[] = {
-	/* XXX All offset by 0x100 because of the am335x's mmc registers.  */
-	{ "MMCHS0", SDMMC1_BASE_TIAM335X, 64, { AM335X_PRCM_CM_PER, 0x3c } },
-	{ "MMC1",   SDMMC2_BASE_TIAM335X, 28, { AM335X_PRCM_CM_PER, 0xf4 } },
-	{ "MMCHS2", SDMMC3_BASE_TIAM335X, 29, { AM335X_PRCM_CM_WKUP, 0xf8 } },
+static const struct am335x_mmchs am335x_mmchs[] = {
+	{ "MMCHS0", "obio",
+	SDMMC1_BASE_TIAM335X, 64, { AM335X_PRCM_CM_PER, 0x3c } },
+	{ "MMC1",   "obio",
+	SDMMC2_BASE_TIAM335X, 28, { AM335X_PRCM_CM_PER, 0xf4 } },
+	{ "MMCHS2", "mainbus",
+	SDMMC3_BASE_TIAM335X, 29, { AM335X_PRCM_CM_PER, 0xf8 } },
 };
 
 struct am335x_padconf {
@@ -155,17 +171,14 @@ const struct am335x_padconf am335x_padco
 };
 #endif
 
-CFATTACH_DECL_NEW(obiosdhc, sizeof(struct obiosdhc_softc),
-obiosdhc_match, obiosdhc_attach, obiosdhc_detach, NULL);
+CFATTACH_DECL_NEW(obiosdhc, sizeof(struct mmchs_softc),
+obiosdhc_match, obiosdhc_attach, mmchs_detach, NULL);
 
 static int
 obiosdhc_match(device_t parent, 

CVS commit: src/sys/arch/arm/omap

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:03:39 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap2_reg.h sitara_cm.c sitara_cmreg.h

Log Message:
Print am335x ID and fetures.  Also add omap_{chip,dev}id().


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/omap/omap2_reg.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/sitara_cm.c \
src/sys/arch/arm/omap/sitara_cmreg.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/omap/omap2_reg.h
diff -u src/sys/arch/arm/omap/omap2_reg.h:1.33 src/sys/arch/arm/omap/omap2_reg.h:1.34
--- src/sys/arch/arm/omap/omap2_reg.h:1.33	Mon Jul 11 14:51:11 2016
+++ src/sys/arch/arm/omap/omap2_reg.h	Tue Oct  4 16:03:39 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: omap2_reg.h,v 1.33 2016/07/11 14:51:11 kiyohara Exp $ */
+/* $NetBSD: omap2_reg.h,v 1.34 2016/10/04 16:03:39 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2007 Microsoft
@@ -163,6 +163,18 @@
 #define DEVID_AMDM37X_ES11	0x1b89102f
 #define DEVID_AMDM37X_ES12	0x2b89102f
 
+#define CHIPID_AM3351		0x00fc0302
+#define CHIPID_AM3352		0x00fc0382
+#define CHIPID_AM3354		0x20fc0382
+#define CHIPID_AM3356		0x00fd0383
+#define CHIPID_AM3357		0x00ff0383
+#define CHIPID_AM3358		0x20fd0383
+#define CHIPID_AM3359		0x20ff0383
+
+#define DEVID_AM335X_SR_10	0x0b94402e
+#define DEVID_AM335X_SR_20	0x1b94402e
+#define DEVID_AM335X_SR_21	0x2b94402e
+
 /*
  * Clock Management registers base, offsets, and size
  */

Index: src/sys/arch/arm/omap/sitara_cm.c
diff -u src/sys/arch/arm/omap/sitara_cm.c:1.2 src/sys/arch/arm/omap/sitara_cm.c:1.3
--- src/sys/arch/arm/omap/sitara_cm.c:1.2	Sat Oct 18 08:33:24 2014
+++ src/sys/arch/arm/omap/sitara_cm.c	Tue Oct  4 16:03:39 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: sitara_cm.c,v 1.2 2014/10/18 08:33:24 snj Exp $ */
+/* $NetBSD: sitara_cm.c,v 1.3 2016/10/04 16:03:39 kiyohara Exp $ */
 /*
  * Copyright (c) 2010
  *	Ben Gray .
@@ -47,7 +47,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sitara_cm.c,v 1.2 2014/10/18 08:33:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sitara_cm.c,v 1.3 2016/10/04 16:03:39 kiyohara Exp $");
 
 #include "opt_omap.h"
 
@@ -60,13 +60,17 @@ __KERNEL_RCSID(0, "$NetBSD: sitara_cm.c,
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
 struct sitara_cm_softc {
-device_tsc_dev;
-	bus_space_tag_t sc_iot;
-	bus_space_handle_t  sc_ioh;
+	device_t		sc_dev;
+	bus_space_tag_t		sc_iot;
+	bus_space_handle_t	sc_ioh;
+
+	uint32_t		sc_cid;	/* Chip Identification */
+	uint32_t		sc_did;	/* Device IDCODE */
 };
 
 
@@ -391,6 +395,15 @@ sitara_cm_attach(device_t parent, device
 	struct sitara_cm_softc *sc = device_private(self);
 	struct obio_attach_args *obio = opaque;
 	uint32_t rev;
+	char cid, buf[256];
+	const char *did;
+	const char *fmt = "\177\020"
+	"b\0ICSS\0"
+	"b\1CPSW\0"
+	"b\7DCAN\0"
+	"f\16\1ICSS_FEA EtherCAT functionality\0=\0disabled\0=\1enabled\0"
+	"f\17\1ICSS_FEA TX_AUTO_SEQUENCE\0=\0disabled\0=\1enabled\0"
+	"b\29SGX\0";
 
 	aprint_naive("\n");
 
@@ -412,4 +425,60 @@ sitara_cm_attach(device_t parent, device
 		panic("sitara_cm_attach: read revision");
 	aprint_normal(": control module, rev %d.%d\n",
 	SCM_REVISION_MAJOR(rev), SCM_REVISION_MINOR(rev));
+
+	sitara_cm_reg_read_4(OMAP2SCM_DEVID, >sc_did);
+	sitara_cm_reg_read_4(OMAP2SCM_DEV_FEATURE, >sc_cid);
+	switch (sc->sc_cid) {
+	case CHIPID_AM3351:	cid = '1'; break;
+	case CHIPID_AM3352:	cid = '2'; break;
+	case CHIPID_AM3354:	cid = '4'; break;
+	case CHIPID_AM3356:	cid = '6'; break;
+	case CHIPID_AM3357:	cid = '7'; break;
+	case CHIPID_AM3358:	cid = '8'; break;
+	case CHIPID_AM3359:	cid = '9'; break;
+	default:
+		aprint_normal_dev(self, "unknwon ChipID found 0x%08x\n",
+		sc->sc_cid);
+		cid = 'x';
+		break;
+	}
+	aprint_normal_dev(self, "AM335%c", cid);
+	switch (sc->sc_did) {
+	case DEVID_AM335X_SR_10:	did = "1.0"; break;
+	case DEVID_AM335X_SR_20:	did = "2.0"; break;
+	case DEVID_AM335X_SR_21:	did = "2.1"; break;
+	default:
+		aprint_normal_dev(self, "unknwon DeviceID found 0x%08x\n",
+		sc->sc_did);
+		did = NULL;
+		break;
+	}
+	if (did != NULL)
+		aprint_normal(" Silicon Revision %s", did);
+	snprintb(buf, sizeof(buf), fmt, sc->sc_cid);
+	aprint_normal(": %s\n", buf);
+}
+
+uint32_t
+omap_chipid(void)
+{
+	struct sitara_cm_softc *sc;
+	device_t dev;
+
+	dev = device_find_by_xname("sitaracm0");
+	KASSERT(dev != NULL);
+	sc = device_private(dev);
+	return sc->sc_cid;
+}
+
+uint32_t
+omap_devid(void)
+{
+	struct sitara_cm_softc *sc;
+	device_t dev;
+
+	dev = device_find_by_xname("sitaracm0");
+	KASSERT(dev != NULL);
+	sc = device_private(dev);
+	return sc->sc_did;
 }
Index: src/sys/arch/arm/omap/sitara_cmreg.h
diff -u src/sys/arch/arm/omap/sitara_cmreg.h:1.2 src/sys/arch/arm/omap/sitara_cmreg.h:1.3
--- src/sys/arch/arm/omap/sitara_cmreg.h:1.2	Wed Jul 16 18:25:24 

CVS commit: src/sys/arch/arm/omap

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 16:03:39 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap2_reg.h sitara_cm.c sitara_cmreg.h

Log Message:
Print am335x ID and fetures.  Also add omap_{chip,dev}id().


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/omap/omap2_reg.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/sitara_cm.c \
src/sys/arch/arm/omap/sitara_cmreg.h

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



CVS commit: src/sys/arch/arm/omap

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 15:59:36 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap3_ehci.c

Log Message:
Support extclk.  This value get from prop-dictionary "port?-extclk".


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/omap/omap3_ehci.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/omap/omap3_ehci.c
diff -u src/sys/arch/arm/omap/omap3_ehci.c:1.11 src/sys/arch/arm/omap/omap3_ehci.c:1.12
--- src/sys/arch/arm/omap/omap3_ehci.c:1.11	Sat Apr 23 10:15:28 2016
+++ src/sys/arch/arm/omap/omap3_ehci.c	Tue Oct  4 15:59:36 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: omap3_ehci.c,v 1.11 2016/04/23 10:15:28 skrll Exp $ */
+/* $NetBSD: omap3_ehci.c,v 1.12 2016/10/04 15:59:36 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2010-2012 Jared D. McNeill 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap3_ehci.c,v 1.11 2016/04/23 10:15:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap3_ehci.c,v 1.12 2016/10/04 15:59:36 kiyohara Exp $");
 
 #include "locators.h"
 
@@ -196,6 +196,7 @@ struct omap3_ehci_softc {
 		enum omap3_ehci_port_mode mode;
 		int gpio;
 		bool value;
+		bool extclk;
 	} sc_portconfig[3];
 	struct {
 		uint16_t m, n, m2;
@@ -405,15 +406,24 @@ omap3_ehci_parse_properties(struct omap3
 	sc->sc_portconfig[0].mode = omap3_ehci_get_port_mode(prop, "port0-mode");
 	sc->sc_portconfig[0].gpio = omap3_ehci_get_port_gpio(prop, "port0-gpio");
 	prop_dictionary_get_bool(prop, "port0-gpioval", >sc_portconfig[0].value);
+#if defined(OMAP4) || defined(OMAP5)
+	prop_dictionary_get_bool(prop, "port0-extclk", >sc_portconfig[0].extclk);
+#endif
 	if (sc->sc_nports > 1) {
 		sc->sc_portconfig[1].mode = omap3_ehci_get_port_mode(prop, "port1-mode");
 		sc->sc_portconfig[1].gpio = omap3_ehci_get_port_gpio(prop, "port1-gpio");
 		prop_dictionary_get_bool(prop, "port1-gpioval", >sc_portconfig[1].value);
+#if defined(OMAP4) || defined(OMAP5)
+		prop_dictionary_get_bool(prop, "port1-extclk", >sc_portconfig[1].extclk);
+#endif
 	}
 	if (sc->sc_nports > 2) {
 		sc->sc_portconfig[2].mode = omap3_ehci_get_port_mode(prop, "port2-mode");
 		sc->sc_portconfig[2].gpio = omap3_ehci_get_port_gpio(prop, "port2-gpio");
 		prop_dictionary_get_bool(prop, "port2-gpioval", >sc_portconfig[2].value);
+#if defined(OMAP4) || defined(OMAP5)
+		prop_dictionary_get_bool(prop, "port2-extclk", >sc_portconfig[2].extclk);
+#endif
 	}
 
 #ifdef OMAP_3XXX
@@ -670,17 +680,43 @@ omap4_usbhost_init(struct omap3_ehci_sof
 	KASSERT(err == 0);
 
 	val = bus_space_read_4(iot, ioh, OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL);
-	val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P3_CLK
-	|  OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P2_CLK
-	|  OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P3_CLK
-	|  OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P2_CLK
-	|  OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P3_CLK
-	|  OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P2_CLK;
+	if (sc->sc_portconfig[0].mode != OMAP3_EHCI_PORT_MODE_NONE) {
+		if (sc->sc_portconfig[0].extclk)
+			val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_CLKSEL_UTMI_P1;
+		else
+			val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P1_CLK;
+		if (sc->sc_portconfig[0].mode == OMAP3_EHCI_PORT_MODE_HSIC)
+			val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P1_CLK
+			|  OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P1_CLK;
+	}
+	if (sc->sc_nports > 1
+	&& sc->sc_portconfig[1].mode != OMAP3_EHCI_PORT_MODE_NONE) {
+		if (sc->sc_portconfig[1].extclk)
+			val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_CLKSEL_UTMI_P2;
+		else
+			val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P2_CLK;
+		if (sc->sc_portconfig[1].mode == OMAP3_EHCI_PORT_MODE_HSIC)
+			val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P2_CLK
+			|  OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P2_CLK;
+	}
+	if (sc->sc_nports > 2
+	&& sc->sc_portconfig[2].mode != OMAP3_EHCI_PORT_MODE_NONE) {
+		val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_UTMI_P3_CLK;
+		if (sc->sc_portconfig[2].mode == OMAP3_EHCI_PORT_MODE_HSIC)
+			val |= OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC60M_P3_CLK
+			|  OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL_OPTFCLKEN_HSIC480M_P3_CLK;
+	}
 	bus_space_write_4(iot, ioh, OMAP4_CM_L3INIT_USB_HOST_HS_CLKCTRL, val);
 
 	val = bus_space_read_4(iot, ioh, OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL);
-	val |= OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH2_CLK
-	|  OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH1_CLK;
+	if (sc->sc_portconfig[0].mode != OMAP3_EHCI_PORT_MODE_NONE)
+		val |= OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH0_CLK;
+	if (sc->sc_nports > 1
+	&& sc->sc_portconfig[1].mode != OMAP3_EHCI_PORT_MODE_NONE)
+		val |= OMAP4_CM_L3INIT_USB_TLL_HS_CLKCTRL_USB_CH1_CLK;
+	if 

CVS commit: src/sys/arch/arm/omap

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 15:59:36 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap3_ehci.c

Log Message:
Support extclk.  This value get from prop-dictionary "port?-extclk".


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/omap/omap3_ehci.c

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



CVS commit: src/sys/arch/arm/omap

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 15:47:53 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap3_sdmmcreg.h

Log Message:
Add OMAP4430 MMCHS_CON macros.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap3_sdmmcreg.h

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



CVS commit: src/sys/arch/arm/omap

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 15:54:10 UTC 2016

Modified Files:
src/sys/arch/arm/omap: omap2430_intr.h

Log Message:
am335x's main interrupt source is 128.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omap2430_intr.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/omap/omap2430_intr.h
diff -u src/sys/arch/arm/omap/omap2430_intr.h:1.4 src/sys/arch/arm/omap/omap2430_intr.h:1.5
--- src/sys/arch/arm/omap/omap2430_intr.h:1.4	Sat Jul 14 07:42:57 2012
+++ src/sys/arch/arm/omap/omap2430_intr.h	Tue Oct  4 15:54:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2430_intr.h,v 1.4 2012/07/14 07:42:57 matt Exp $ */
+/*	$NetBSD: omap2430_intr.h,v 1.5 2016/10/04 15:54:09 kiyohara Exp $ */
 
 /*
  * Define the SDP2430 specific information and then include the generic OMAP
@@ -161,7 +161,11 @@ uint32_t omap_microtimer_interval(uint32
 #define	IRQ_MMC3		94	/* (3530) MMC/SD module 3 */
 #define	IRQ_GPT12_3530		95	/* (3530) GPT12 */
 
+#if defined(TI_AM335X)
+#define	PIC_MAXSOURCES		128
+#else
 #define	PIC_MAXSOURCES		96
+#endif
 #define	PIC_MAXMAXSOURCES	(PIC_MAXSOURCES+192)
 
 void omap_irq_handler(void *);



  1   2   3   4   5   6   7   8   9   10   >