summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Graf <rapha@cvs.openbsd.org>2013-06-11 19:19:44 +0000
committerRaphael Graf <rapha@cvs.openbsd.org>2013-06-11 19:19:44 +0000
commit20e2e1aeb5358d6d31358e83782156716c2cf3cd (patch)
tree3eff5b0c44fd429a957877423c4e3e55cd10c24d
parentb29b588cb6b616097930e14f7beaac7e4e8b3533 (diff)
Activate the sitaracm driver. (beaglebone only)
ok bmercer@
-rw-r--r--sys/arch/beagle/conf/GENERIC3
-rw-r--r--sys/arch/beagle/conf/files.beagle12
-rw-r--r--sys/arch/beagle/dev/am335x.c14
-rw-r--r--sys/arch/beagle/dev/if_cpsw.c29
-rw-r--r--sys/arch/beagle/dev/omap.c3
5 files changed, 35 insertions, 26 deletions
diff --git a/sys/arch/beagle/conf/GENERIC b/sys/arch/beagle/conf/GENERIC
index a6add3f6ea5..a848ea51518 100644
--- a/sys/arch/beagle/conf/GENERIC
+++ b/sys/arch/beagle/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.20 2013/06/05 15:03:23 bmercer Exp $
+# $OpenBSD: GENERIC,v 1.21 2013/06/11 19:19:43 rapha Exp $
#
# GENERIC machine description file
#
@@ -67,6 +67,7 @@ intc* at soc? # interrupt controller
# OMAP on-chip devices
prcm* at soc? # power/clock controller
+sitaracm* at soc? # sitara control module
omdog* at soc? # watchdog timer
omgpio* at soc? # user-visible GPIO pins?
gptimer* at soc? # general purpose timers
diff --git a/sys/arch/beagle/conf/files.beagle b/sys/arch/beagle/conf/files.beagle
index 553b3373381..37f26d7c41a 100644
--- a/sys/arch/beagle/conf/files.beagle
+++ b/sys/arch/beagle/conf/files.beagle
@@ -1,4 +1,4 @@
-# $OpenBSD: files.beagle,v 1.18 2013/06/05 17:56:32 rapha Exp $
+# $OpenBSD: files.beagle,v 1.19 2013/06/11 19:19:43 rapha Exp $
#
# First try for arm-specific configuration info
#
@@ -50,6 +50,11 @@ device prcm
attach prcm at soc
file arch/beagle/dev/prcm.c prcm
+device sitaracm
+attach sitaracm at soc
+file arch/beagle/dev/am335x_cm_padconf.c sitaracm
+file arch/beagle/dev/sitara_cm.c sitaracm
+
device omgpio
attach omgpio at soc
file arch/beagle/dev/omgpio.c omgpio
@@ -147,3 +152,8 @@ include "dev/usb/files.usb"
# Bluetooth
include "dev/bluetooth/files.bluetooth"
+
+#
+# Machine-independent GPIO drivers
+#
+include "dev/gpio/files.gpio"
diff --git a/sys/arch/beagle/dev/am335x.c b/sys/arch/beagle/dev/am335x.c
index 88677a00415..6214749c9f9 100644
--- a/sys/arch/beagle/dev/am335x.c
+++ b/sys/arch/beagle/dev/am335x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: am335x.c,v 1.3 2013/06/05 17:56:32 rapha Exp $ */
+/* $OpenBSD: am335x.c,v 1.4 2013/06/11 19:19:43 rapha Exp $ */
/*
* Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org>
@@ -26,6 +26,9 @@
#define PRCM_SIZE 0x2000
#define PRCM_ADDR 0x44E00000
+#define SCM_SIZE 0x2000
+#define SCM_ADDR 0x44E10000
+
#define INTC_SIZE 0x300
#define INTC_ADDR 0x48200000
@@ -95,6 +98,15 @@ struct omap_dev am335x_devs[] = {
},
/*
+ * System Control Module
+ */
+
+ { .name = "sitaracm",
+ .unit = 0,
+ .mem = { { SCM_ADDR, SCM_SIZE } },
+ },
+
+ /*
* Interrupt Controller
*/
diff --git a/sys/arch/beagle/dev/if_cpsw.c b/sys/arch/beagle/dev/if_cpsw.c
index 11958b0fb01..c124a4c0cc2 100644
--- a/sys/arch/beagle/dev/if_cpsw.c
+++ b/sys/arch/beagle/dev/if_cpsw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cpsw.c,v 1.2 2013/06/05 17:56:32 rapha Exp $ */
+/* $OpenBSD: if_cpsw.c,v 1.3 2013/06/11 19:19:43 rapha Exp $ */
/* $NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $ */
/*
@@ -85,6 +85,7 @@
#include <dev/mii/miivar.h>
#include <arch/beagle/dev/omapvar.h>
+#include <arch/beagle/dev/sitara_cm.h>
#include <arch/beagle/dev/if_cpswreg.h>
#define CPSW_TXFRAGS 16
@@ -193,8 +194,6 @@ int cpsw_rxintr(void *);
int cpsw_txintr(void *);
int cpsw_miscintr(void *);
-int sitara_cm_reg_read_4(uint32_t reg, uint32_t *val);
-
struct cfattach cpsw_ca = {
sizeof (struct cpsw_softc), NULL, cpsw_attach
};
@@ -221,20 +220,6 @@ m_length(const struct mbuf *m)
return pktlen;
}
-int
-sitara_cm_reg_read_4(uint32_t reg, uint32_t *val)
-{
- /* XXX this needs to be fixed */
-#if 0
- if (!sitara_cm_sc)
- return (ENXIO);
-
- *val = sitara_cm_read_4(sitara_cm_sc, reg);
- return (0);
-#endif
- return (ENXIO);
-}
-
static inline u_int
cpsw_txdesc_adjust(u_int x, int y)
{
@@ -337,8 +322,8 @@ cpsw_get_mac_addr(struct cpsw_softc *sc)
{
u_int32_t mac_lo = 0, mac_hi = 0;
- mac_lo = sitara_cm_reg_read_4(OMAP2SCM_MAC_ID0_LO, &mac_lo);
- mac_hi = sitara_cm_reg_read_4(OMAP2SCM_MAC_ID0_HI, &mac_hi);
+ sitara_cm_reg_read_4(OMAP2SCM_MAC_ID0_LO, &mac_lo);
+ sitara_cm_reg_read_4(OMAP2SCM_MAC_ID0_HI, &mac_hi);
if ((mac_lo == 0) && (mac_hi == 0)) {
CPSW_PRINTF(sc, "%s(%d): Invalid Ethernet address!\n",
@@ -407,7 +392,7 @@ cpsw_attach(struct device *parent, struct device *self, void *aux)
printf("can't subregion tx ring SRAM: %d\n", error);
return;
}
- printf("txdescs at %p\n", (void *)sc->sc_bsh_txdescs);
+ printf(" txdescs at %p", (void *)sc->sc_bsh_txdescs);
sc->sc_rxdescs_pa = oa->oa_dev->mem[0].addr + CPSW_CPPI_RAM_RXDESCS_BASE;
error = bus_space_subregion(sc->sc_bst, sc->sc_bsh,
@@ -417,7 +402,7 @@ cpsw_attach(struct device *parent, struct device *self, void *aux)
printf("can't subregion rx ring SRAM: %d\n", error);
return;
}
- printf("rxdescs at %p\n", (void *)sc->sc_bsh_rxdescs);
+ printf(" rxdescs at %p", (void *)sc->sc_bsh_rxdescs);
sc->sc_rdp = malloc(sizeof(*sc->sc_rdp), M_TEMP, M_WAITOK);
KASSERT(sc->sc_rdp != NULL);
@@ -451,7 +436,7 @@ cpsw_attach(struct device *parent, struct device *self, void *aux)
bus_dmamap_sync(sc->sc_bdt, sc->sc_txpad_dm, 0, ETHER_MIN_LEN,
BUS_DMASYNC_PREWRITE);
- printf("Ethernet address %s\n", sc->sc_enaddr);
+ printf(", address %s\n", ether_sprintf(sc->sc_enaddr));
strlcpy(ifp->if_xname, "cpsw", IFNAMSIZ);
ifp->if_softc = sc;
diff --git a/sys/arch/beagle/dev/omap.c b/sys/arch/beagle/dev/omap.c
index 631fd7925d2..5c633ceeda0 100644
--- a/sys/arch/beagle/dev/omap.c
+++ b/sys/arch/beagle/dev/omap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omap.c,v 1.8 2013/06/05 15:03:23 bmercer Exp $ */
+/* $OpenBSD: omap.c,v 1.9 2013/06/11 19:19:43 rapha Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
*
@@ -68,6 +68,7 @@ struct board_dev beagleboard_devs[] = {
struct board_dev beaglebone_devs[] = {
{ "prcm", 0 },
+ { "sitaracm", 0 },
{ "intc", 0 },
{ "dmtimer", 0 },
{ "dmtimer", 1 },