Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm Support smsh@gpmc.
details: https://anonhg.NetBSD.org/src/rev/43ceaff76f27
branches: trunk
changeset: 757406:43ceaff76f27
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Sat Aug 28 04:54:46 2010 +0000
description:
Support smsh@gpmc.
tested Chestnut43 only.
diffstat:
sys/arch/evbarm/conf/OVERO | 30 +++++--
sys/arch/evbarm/conf/files.overo | 7 +-
sys/arch/evbarm/gumstix/if_smsh_gpmc.c | 119 +++++++++++++++++++++++++++++++++
3 files changed, 146 insertions(+), 10 deletions(-)
diffs (215 lines):
diff -r 6e92ade26fad -r 43ceaff76f27 sys/arch/evbarm/conf/OVERO
--- a/sys/arch/evbarm/conf/OVERO Sat Aug 28 04:46:24 2010 +0000
+++ b/sys/arch/evbarm/conf/OVERO Sat Aug 28 04:54:46 2010 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: OVERO,v 1.3 2010/07/20 12:13:18 kiyohara Exp $
+# $NetBSD: OVERO,v 1.4 2010/08/28 04:54:46 kiyohara Exp $
#
# OVERO -- Gumstix. Inc. Overo platforms kernel
#
@@ -23,6 +23,9 @@
# Gumstix options
options OVERO
+# Can specify 'expansion=' in args from u-boot.
+options GUMSTIX_NETBSD_ARGS_EXPANSION
+options GXIO_DEFAULT_EXPANSION="\"Chestnut43\""
# Standard system options
@@ -134,8 +137,8 @@
options KTRACE # system call tracing, a la ktrace(1)
options IRQSTATS # manage IRQ statistics
#options KMEMSTATS # kernel memory statistics
+#options MIIVERBOSE # verbose PHY autoconfig messages
#options USBVERBOSE # verbose USB device autoconfig messages
-options MIIVERBOSE # Verbose MII autoconfuration messages
#options DDB_KEYCODE=0x40
#options USERCONF # userconf(4) support
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
@@ -179,14 +182,14 @@
# Interrupt Controller
omapicu0 at obio0 addr 0x48200000 size 0x1000 intrbase 0
-#omapgpio0 at obio1 addr 0x48310000 size 0x0400 intrbase 96 intr 29
-#omapgpio1 at obio2 addr 0x49050000 size 0x0400 intrbase 128 intr 30
-#omapgpio2 at obio2 addr 0x49052000 size 0x0400 intrbase 160 intr 31
-#omapgpio3 at obio2 addr 0x49054000 size 0x0400 intrbase 192 intr 32
-#omapgpio4 at obio2 addr 0x49056000 size 0x0400 intrbase 224 intr 33
-#omapgpio5 at obio2 addr 0x49058000 size 0x0400 intrbase 256 intr 34
+omapgpio0 at obio1 addr 0x48310000 size 0x0400 intrbase 96 intr 29
+omapgpio1 at obio2 addr 0x49050000 size 0x0400 intrbase 128 intr 30
+omapgpio2 at obio2 addr 0x49052000 size 0x0400 intrbase 160 intr 31
+omapgpio3 at obio2 addr 0x49054000 size 0x0400 intrbase 192 intr 32
+omapgpio4 at obio2 addr 0x49056000 size 0x0400 intrbase 224 intr 33
+omapgpio5 at obio2 addr 0x49058000 size 0x0400 intrbase 256 intr 34
-#gpio* at omapgpio?
+gpio* at omapgpio?
# On-board 16550 UARTs
com0 at obio2 addr 0x49020000 intr 74 mult 4 # UART3 (console)
@@ -220,6 +223,15 @@
options HWCLOCK_MACHINE="<arch/arm/omap/hwclock_omap1.h>"
options OMAP_CK_REF_SPEED=12000000
+# overo expantion boards
+
+# SMSC LAN9221
+smsh0 at gpmc? addr 0x01000000 intr 272 # Tobi, Chestnut43
+smsh1 at gpmc? addr 0x02000000 intr 161 # Tobi-Duo
+
+# MII/PHY support
+ukphy* at mii? phy ? # smsh(4) internal PHY
+
# Pseudo-Devices
# disk/mass storage pseudo-devices
diff -r 6e92ade26fad -r 43ceaff76f27 sys/arch/evbarm/conf/files.overo
--- a/sys/arch/evbarm/conf/files.overo Sat Aug 28 04:46:24 2010 +0000
+++ b/sys/arch/evbarm/conf/files.overo Sat Aug 28 04:54:46 2010 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: files.overo,v 1.2 2010/07/10 08:31:34 kiyohara Exp $
+# $NetBSD: files.overo,v 1.3 2010/08/28 04:54:46 kiyohara Exp $
#
# Gumstix. Inc. Overo boards configuration info
#
file arch/evbarm/gumstix/gumstix_machdep.c
defflag opt_gumstix.h OVERO
+ GUMSTIX_NETBSD_ARGS_EXPANSION
defparam opt_gxio.h GXIO_DEFAULT_EXPANSION
file arch/evbarm/gumstix/gxio.c
@@ -15,3 +16,7 @@
# NS16550 compatible serial ports
attach com at obio with obiouart
file arch/arm/omap/obio_com.c obiouart
+
+# SMSC LAN9118
+attach smsh at gpmc with smsh_gpmc
+file arch/evbarm/gumstix/if_smsh_gpmc.c smsh_gpmc
diff -r 6e92ade26fad -r 43ceaff76f27 sys/arch/evbarm/gumstix/if_smsh_gpmc.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/gumstix/if_smsh_gpmc.c Sat Aug 28 04:54:46 2010 +0000
@@ -0,0 +1,119 @@
+/* $NetBSD: if_smsh_gpmc.c,v 1.1 2010/08/28 04:54:46 kiyohara Exp $ */
+/*
+ * Copyright (c) 2010 KIYOHARA Takashi
+ * All rights reserved.
+ *
+ * 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 AUTHOR ``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 AUTHOR 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>
+__KERNEL_RCSID(0, "$NetBSD: if_smsh_gpmc.c,v 1.1 2010/08/28 04:54:46 kiyohara Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+#include <sys/bus.h>
+#include <sys/systm.h>
+
+#include <arm/omap/omap2_gpmcvar.h>
+
+#include <evbarm/gumstix/gumstixvar.h>
+
+#include <net/if.h>
+#include <net/if_ether.h>
+#include <net/if_media.h>
+
+#include <dev/mii/miivar.h>
+
+#include <dev/ic/lan9118var.h>
+#include <dev/ic/lan9118reg.h>
+
+#include "locators.h"
+
+
+static int smsh_gpmc_match(device_t, struct cfdata *, void *);
+static void smsh_gpmc_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(smsh_gpmc, sizeof(struct lan9118_softc),
+ smsh_gpmc_match, smsh_gpmc_attach, NULL, NULL);
+
+
+/* ARGSUSED */
+static int
+smsh_gpmc_match(device_t parent, struct cfdata *match, void *aux)
+{
+ struct gpmc_attach_args *gpmc = aux;
+ bus_space_tag_t iot = gpmc->gpmc_iot;
+ bus_space_handle_t ioh;
+ uint32_t val;
+ int rv = 0;
+
+ /* Disallow wildcarded values. */
+ if (gpmc->gpmc_addr == GPMCCF_ADDR_DEFAULT)
+ return 0;
+ if (gpmc->gpmc_intr == GPMCCF_INTR_DEFAULT)
+ return 0;
+
+ if (bus_space_map(iot, gpmc->gpmc_addr, LAN9118_IOSIZE, 0, &ioh) != 0)
+ return 0;
+
+ bus_space_write_4(iot, ioh, LAN9118_BYTE_TEST, 0);
+ val = bus_space_read_4(iot, ioh, LAN9118_BYTE_TEST);
+ if (val == LAN9118_BYTE_TEST_VALUE)
+ /* Assume we have an SMSC LAN9221 */
+ rv = 1;
+
+ bus_space_unmap(iot, ioh, LAN9118_IOSIZE);
+ return rv;
+}
+
+/* ARGSUSED */
+static void
+smsh_gpmc_attach(device_t parent, device_t self, void *aux)
+{
+ struct lan9118_softc *sc = device_private(self);
+ struct gpmc_attach_args *gpmc = aux;
+ void *ih;
+
+ sc->sc_dev = self;
+
+ /* Map i/o space. */
+ if (bus_space_map(gpmc->gpmc_iot, gpmc->gpmc_addr, LAN9118_IOSIZE, 0,
+ &sc->sc_ioh))
+ panic("smsh_gpmc_attach: can't map i/o space");
+ sc->sc_iot = gpmc->gpmc_iot;
+
+ if (lan9118_attach(sc) != 0) {
+ bus_space_unmap(sc->sc_iot, sc->sc_ioh, LAN9118_IOSIZE);
+ return;
+ }
+
+ /* Establish the interrupt handler. */
+ ih = intr_establish(gpmc->gpmc_intr, IPL_NET, IST_LEVEL_LOW,
+ lan9118_intr, sc);
+ if (ih == NULL) {
+ aprint_error_dev(self,
+ "couldn't establish interrupt handler\n");
+ bus_space_unmap(sc->sc_iot, sc->sc_ioh, LAN9118_IOSIZE);
+ return;
+ }
+}
Home |
Main Index |
Thread Index |
Old Index