Module Name:    src
Committed By:   jdc
Date:           Mon May 11 15:56:15 UTC 2020

Modified Files:
        src/sys/arch/sparc64/conf: files.sparc64
Added Files:
        src/sys/arch/sparc64/dev: wb_ebus.c

Log Message:
Add an ebus frontend for the Winbond W83l518D SD card reader as found on
Tadpole SPARCLE latops.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/sparc64/conf/files.sparc64
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc64/dev/wb_ebus.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.158 src/sys/arch/sparc64/conf/files.sparc64:1.159
--- src/sys/arch/sparc64/conf/files.sparc64:1.158	Sun Jan 27 02:08:38 2019
+++ src/sys/arch/sparc64/conf/files.sparc64	Mon May 11 15:56:15 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sparc64,v 1.158 2019/01/27 02:08:38 pgoyette Exp $
+#	$NetBSD: files.sparc64,v 1.159 2020/05/11 15:56:15 jdc Exp $
 
 # @(#)files.sparc64	8.1 (Berkeley) 7/19/93
 # sparc64-specific configuration info
@@ -140,6 +140,10 @@ file	arch/sparc64/dev/fdc.c			fdc | fd n
 attach	audiocs at ebus with audiocs_ebus
 file	dev/ebus/cs4231_ebus.c			audiocs_ebus
 
+include	"dev/sdmmc/files.sdmmc"
+attach	wb at ebus with wb_ebus
+file	arch/sparc64/dev/wb_ebus.c		wb_ebus
+
 # PCMCIA bus (references fdc)
 include "dev/pcmcia/files.pcmcia"
 

Added files:

Index: src/sys/arch/sparc64/dev/wb_ebus.c
diff -u /dev/null src/sys/arch/sparc64/dev/wb_ebus.c:1.1
--- /dev/null	Mon May 11 15:56:15 2020
+++ src/sys/arch/sparc64/dev/wb_ebus.c	Mon May 11 15:56:15 2020
@@ -0,0 +1,86 @@
+/*	$NetBSD: wb_ebus.c,v 1.1 2020/05/11 15:56:15 jdc Exp $	*/
+
+/*
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Julian Coleman.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: wb_ebus.c,v 1.1 2020/05/11 15:56:15 jdc Exp $");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/autoconf.h>
+
+#include <dev/ebus/ebusreg.h>
+#include <dev/ebus/ebusvar.h>
+
+#include <dev/ic/w83l518dreg.h>
+#include <dev/ic/w83l518dvar.h>
+#include <dev/ic/w83l518d_sdmmc.h>
+
+static int	wb_ebus_match(device_t, cfdata_t , void *);
+static void	wb_ebus_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(wb_ebus, sizeof(struct wb_softc),
+	wb_ebus_match, wb_ebus_attach, NULL, NULL);
+
+static int
+wb_ebus_match(device_t parent, cfdata_t match, void *aux) 
+{
+	struct ebus_attach_args *ea = aux;
+
+	return (strcmp(ea->ea_name, "TAD,wb-sdcard") == 0);
+}
+
+static void
+wb_ebus_attach(device_t parent, device_t self, void *aux)
+{
+	struct wb_softc *sc = device_private(self);
+	struct ebus_attach_args *ea = aux;
+
+	sc->wb_dev = self;
+
+	if (bus_space_map(ea->ea_bustag, EBUS_ADDR_FROM_REG(&ea->ea_reg[0]),
+	    ea->ea_reg[0].size, 0, &sc->wb_ioh) == 0)
+		sc->wb_iot = ea->ea_bustag;
+	else {
+		aprint_error(": can't map register space\n");
+                return;
+	}
+
+	bus_intr_establish(sc->wb_iot, ea->ea_intr[0], IPL_BIO, wb_intr, sc);
+
+	aprint_normal("\n");
+
+	sc->wb_type = WB_DEVNO_SD;
+	sc->wb_quirks = WB_QUIRK_1BIT;	/* 4bit bus width always fails */
+	wb_attach(sc);
+}

Reply via email to