Module Name:    src
Committed By:   macallan
Date:           Sat Oct 13 20:11:48 UTC 2018

Modified Files:
        src/sys/arch/sparc64/conf: files.sparc64
        src/sys/arch/sparc64/dev: pckbc_ebus.c tadpmu.c

Log Message:
config and attachment goop for tadpmu


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/sparc64/conf/files.sparc64
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/dev/pckbc_ebus.c \
    src/sys/arch/sparc64/dev/tadpmu.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/sparc64/conf/files.sparc64
diff -u src/sys/arch/sparc64/conf/files.sparc64:1.154 src/sys/arch/sparc64/conf/files.sparc64:1.155
--- src/sys/arch/sparc64/conf/files.sparc64:1.154	Tue Dec 19 14:34:08 2017
+++ src/sys/arch/sparc64/conf/files.sparc64	Sat Oct 13 20:11:48 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sparc64,v 1.154 2017/12/19 14:34:08 nakayama Exp $
+#	$NetBSD: files.sparc64,v 1.155 2018/10/13 20:11:48 macallan Exp $
 
 # @(#)files.sparc64	8.1 (Berkeley) 7/19/93
 # sparc64-specific configuration info
@@ -164,8 +164,10 @@ file	arch/sparc64/dev/com_ebus.c		com_eb
 
 # ebus PS/2 keyboard attachment for Tadpole SPARCle, etc.
 include "dev/pckbport/files.pckbport"
-attach pckbc at ebus with pckbc_ebus
+attach pckbc at ebus with pckbc_ebus : sysmon_envsys
 file	arch/sparc64/dev/pckbc_ebus.c		pckbc_ebus
+defflag opt_tadpmu.h	HAVE_TADPMU
+file	arch/sparc64/dev/tadpmu.c		pckbc_ebus
 
 device zstty {}: tty
 attach zstty at zs

Index: src/sys/arch/sparc64/dev/pckbc_ebus.c
diff -u src/sys/arch/sparc64/dev/pckbc_ebus.c:1.2 src/sys/arch/sparc64/dev/pckbc_ebus.c:1.3
--- src/sys/arch/sparc64/dev/pckbc_ebus.c:1.2	Fri Aug 14 10:59:27 2015
+++ src/sys/arch/sparc64/dev/pckbc_ebus.c	Sat Oct 13 20:11:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pckbc_ebus.c,v 1.2 2015/08/14 10:59:27 nakayama Exp $ */
+/*	$NetBSD: pckbc_ebus.c,v 1.3 2018/10/13 20:11:48 macallan Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc_ebus.c,v 1.2 2015/08/14 10:59:27 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_ebus.c,v 1.3 2018/10/13 20:11:48 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,9 +47,13 @@ __KERNEL_RCSID(0, "$NetBSD: pckbc_ebus.c
 #include <dev/ebus/ebusreg.h>
 #include <dev/ebus/ebusvar.h>
 
+#include "opt_tadpmu.h"
+#include <sparc64/dev/tadpmureg.h>
+#include <sparc64/dev/tadpmuvar.h>
+
 struct pckbc_ebus_softc {
 	struct pckbc_softc psc_pckbc;	/* real "pckbc" softc */
-	uint32_t psc_intr[PCKBC_NSLOTS];
+	uint32_t psc_intr[5];	/* Tadpole Viper's pckbc has 3 slots */
 };
 
 static int	pckbc_ebus_match(device_t, cfdata_t, void *);
@@ -118,7 +122,7 @@ pckbc_ebus_attach(device_t parent, devic
 			return;
 		}
 	} else {
-		for (i = 0; i < PCKBC_NSLOTS; i++)
+		for (i = 0; i < ea->ea_nintr; i++)
 			sc->psc_intr[i] = ea->ea_intr[i];
 	}
 
@@ -182,8 +186,42 @@ pckbc_ebus_attach(device_t parent, devic
 	/* finish off the attach */
 	aprint_normal("\n");
 	pckbc_attach(psc);
-}
+#ifdef HAVE_TADPMU
+	/* now look for a tadpmu child device */
+	char name[64], *p;
+	int pmu = 0;
+	for (node = prom_firstchild(ea->ea_node);
+	     node != 0; node = prom_nextsibling(node)) {
+		if((p = prom_getpropstringA(node, "name", name, 64)) != NULL) {
+			if (strcmp(name, "tadpmu") == 0) {
+				pmu = node;
+				break;
+			}
+		}
+	}
+	if (pmu != 0) {
+		void *irq;
 
+		bus_space_handle_t hcmd, hdata;
+		if (bus_space_map(iot, ioaddr + TADPMU_CMD,  1, 0, &hcmd) != 0) {
+			bus_space_unmap(iot, hcmd, 1);
+			aprint_error(": unable to map PMU cmd register\n");
+			return;
+		}
+		if (bus_space_map(iot, ioaddr + TADPMU_DATA,  1, 0, &hdata) != 0) {
+			bus_space_unmap(iot, hdata, 1);
+			aprint_error(": unable to map PMU data register\n");
+			return;
+		}
+		tadpmu_init(iot, hcmd, hdata);
+		irq = bus_intr_establish(iot, sc->psc_intr[2], IPL_TTY,
+		                         tadpmu_intr, sc);
+		if (irq == NULL) {
+			aprint_error("failed to establish tadpmu interrupt\n");
+		}
+	}
+#endif
+}
 
 static void
 pckbc_ebus_intr_establish(struct pckbc_softc *sc, pckbport_slot_t slot)
Index: src/sys/arch/sparc64/dev/tadpmu.c
diff -u src/sys/arch/sparc64/dev/tadpmu.c:1.2 src/sys/arch/sparc64/dev/tadpmu.c:1.3
--- src/sys/arch/sparc64/dev/tadpmu.c:1.2	Sat Oct 13 19:53:43 2018
+++ src/sys/arch/sparc64/dev/tadpmu.c	Sat Oct 13 20:11:48 2018
@@ -1,4 +1,4 @@
-/*/* $NetBSD: tadpmu.c,v 1.2 2018/10/13 19:53:43 macallan Exp $ */
+/*/* $NetBSD: tadpmu.c,v 1.3 2018/10/13 20:11:48 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz <macal...@netbsd.org>
@@ -28,6 +28,8 @@
 
 /* a driver for the PMU found in Tadpole Wiper and possibly SPARCle laptops */
 
+#include "opt_tadpmu.h"
+#ifdef HAVE_TADPMU
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -315,4 +317,4 @@ tadpmu_init(bus_space_tag_t t, bus_space
 
 	return 0;
 }
-
+#endif /* HAVE_TADPMU */

Reply via email to