Module Name:    src
Committed By:   rkujawa
Date:           Thu Nov  8 18:30:21 UTC 2012

Modified Files:
        src/sys/arch/amiga/clockport: files.clockport
Added Files:
        src/sys/arch/amiga/clockport: flipper.c flipperreg.h flippervar.h

Log Message:
Add driver for Delfina 1200 / Delfina Flipper. Useless now (doesn't support
audio or DSP), but is able to disable interrupts which is important if booting
NetBSD from AmigaOS to avoid unhandled interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amiga/clockport/files.clockport
cvs rdiff -u -r0 -r1.1 src/sys/arch/amiga/clockport/flipper.c \
    src/sys/arch/amiga/clockport/flipperreg.h \
    src/sys/arch/amiga/clockport/flippervar.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/amiga/clockport/files.clockport
diff -u src/sys/arch/amiga/clockport/files.clockport:1.3 src/sys/arch/amiga/clockport/files.clockport:1.4
--- src/sys/arch/amiga/clockport/files.clockport:1.3	Sat Oct 27 11:54:21 2012
+++ src/sys/arch/amiga/clockport/files.clockport	Thu Nov  8 18:30:21 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.clockport,v 1.3 2012/10/27 11:54:21 phx Exp $
+#	$NetBSD: files.clockport,v 1.4 2012/11/08 18:30:21 rkujawa Exp $
 
 define	clockportbus {}
 
@@ -37,3 +37,9 @@ file	arch/amiga/clockport/clockport.c	cl
 # Individual Computers SilverSurfer serial
 attach	com at clockport with com_ss
 file	arch/amiga/clockport/com_ss.c		com_ss
+
+# Individual Computers / Petsoff - Delfina 1200 / Flipper
+device	flipper
+attach	flipper at clockport
+file	arch/amiga/clockport/flipper.c		flipper
+

Added files:

Index: src/sys/arch/amiga/clockport/flipper.c
diff -u /dev/null src/sys/arch/amiga/clockport/flipper.c:1.1
--- /dev/null	Thu Nov  8 18:30:21 2012
+++ src/sys/arch/amiga/clockport/flipper.c	Thu Nov  8 18:30:21 2012
@@ -0,0 +1,120 @@
+/*      $NetBSD: flipper.c,v 1.1 2012/11/08 18:30:21 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Driver for Individual Computers Delfina Flipper / Petsoff Delfina 1200. 
+ *
+ * TODO:
+ * - linux-style /dev/dsp56k interface
+ * - audio
+ * - firmware
+ * - interrupts: caa->cp_intr_establish(dspintr, sc);
+ */
+
+#include <sys/cdefs.h>
+
+#include <sys/param.h>
+#include <sys/device.h>
+
+#include <sys/bus.h>
+
+#include <amiga/clockport/clockportvar.h>
+
+#include <amiga/clockport/flipperreg.h>
+#include <amiga/clockport/flippervar.h>
+
+#define FLIPPER_DEBUG 1
+
+static int flipper_probe(device_t, cfdata_t , void *);
+static void flipper_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(flipper, sizeof(struct flipper_softc),
+    flipper_probe, flipper_attach, NULL, NULL);
+
+static int
+flipper_probe(device_t parent, cfdata_t cf, void *aux)
+{
+	struct clockport_attach_args *caa = aux;
+	uint8_t delfinaver;
+	bus_space_handle_t ioh;
+
+	bus_space_map(caa->cp_iot, 0, FLIPPER_REGSIZE, 0, &ioh);
+
+	delfinaver = bus_space_read_1(caa->cp_iot, ioh, FLIPPER_HOSTCTL);
+#ifdef FLIPPER_DEBUG
+	aprint_normal("flipper: hostctl probe read %x\n", delfinaver);
+#endif /* FLIPPER_DEBUG */
+
+	bus_space_unmap(caa->cp_iot, ioh, FLIPPER_REGSIZE);
+
+	if ((delfinaver == 0xB5) || (delfinaver == 0xB6))
+		return 1;
+
+	return 0; 
+}
+
+static void
+flipper_attach(device_t parent, device_t self, void *aux)
+{
+	struct flipper_softc *sc = device_private(self);
+	struct clockport_attach_args *caa = aux;
+	sc->sc_dev = self;
+	sc->sc_iot = caa->cp_iot;
+
+	if (bus_space_map(sc->sc_iot, 0, FLIPPER_REGSIZE, 0, &sc->sc_ioh)) {
+		aprint_normal("can't map the bus space\n");
+		return;
+	}
+
+	sc->sc_delfinaver = bus_space_read_1(sc->sc_iot, sc->sc_ioh, 
+	    FLIPPER_HOSTCTL);
+
+	switch (sc->sc_delfinaver) {
+	case DELFINA_FLIPPER:
+		aprint_normal(": Individual Computers Delfina Flipper\n");
+		break;
+	case DELFINA_1200:
+		aprint_normal(": Petsoff Delfina 1200\n");
+		break;
+	default:
+		aprint_normal(": unknown model\n");
+		return;
+	}
+
+	/* reset the board */
+	bus_space_write_1(sc->sc_iot, sc->sc_ioh, FLIPPER_HOSTCTL,
+	    FLIPPER_HOSTCTL_RESET | FLIPPER_HOSTCTL_IRQDIS);
+	delay(10000);
+	bus_space_write_1(sc->sc_iot, sc->sc_ioh, FLIPPER_HOSTCTL, 
+	    FLIPPER_HOSTCTL_IRQDIS); /* leave interrupts disabled for now */
+
+	/* attach dsp56k, audio, etc. */
+}
+
Index: src/sys/arch/amiga/clockport/flipperreg.h
diff -u /dev/null src/sys/arch/amiga/clockport/flipperreg.h:1.1
--- /dev/null	Thu Nov  8 18:30:21 2012
+++ src/sys/arch/amiga/clockport/flipperreg.h	Thu Nov  8 18:30:21 2012
@@ -0,0 +1,55 @@
+/*      $NetBSD: flipperreg.h,v 1.1 2012/11/08 18:30:21 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _AMIGA_FLIPPERREG_H_
+#define _AMIGA_FLIPPERREG_H_
+
+#define DELFINA_1200		0xB5
+#define DELFINA_FLIPPER		0xB6
+
+#define FLIPPER_REGSIZE		0x8
+
+#define FLIPPER_DSP_ICR		0x0
+#define FLIPPER_DSP_ISR		0x1
+#define FLIPPER_HOSTCTL		0x2
+#define FLIPPER_HOSTCTL_CODECSEL	__BIT(0)
+#define FLIPPER_HOSTCTL_IRQDIS		__BIT(4)
+#define FLIPPER_HOSTCTL_QUERYVER	__BIT(5)
+#define FLIPPER_HOSTCTL_HENCLK		__BIT(6)
+#define FLIPPER_HOSTCTL_RESET		__BIT(7)
+#define FLIPPER_DSP_DM		0x3
+#define FLIPPER_DSP_CVR		0x4
+#define FLIPPER_DSP_IVR		0x5
+#define FLIPPER_DSP_DH		0x6
+#define FLIPPER_DSP_DL		0x7
+
+#endif /* _AMIGA_FLIPPERREG_H_ */
+
Index: src/sys/arch/amiga/clockport/flippervar.h
diff -u /dev/null src/sys/arch/amiga/clockport/flippervar.h:1.1
--- /dev/null	Thu Nov  8 18:30:21 2012
+++ src/sys/arch/amiga/clockport/flippervar.h	Thu Nov  8 18:30:21 2012
@@ -0,0 +1,45 @@
+/*      $NetBSD: flippervar.h,v 1.1 2012/11/08 18:30:21 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _AMIGA_FLIPPERVAR_H_
+#define _AMIGA_FLIPPERVAR_H_
+
+struct flipper_softc {
+	device_t	sc_dev;	
+
+	bus_space_tag_t	sc_iot;
+	bus_space_handle_t sc_ioh;
+
+	uint8_t		sc_delfinaver;
+};
+
+#endif /* _AMIGA_FLIPPERVAR_H_ */
+

Reply via email to