From: kremlin Date: Sat, 11 Feb 2017 04:10:14 +0000 (-0600) Subject: initial commit X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=commitdiff_plain;h=efe0ef7bfeab92bb4b5e6df74cafd09debfb145e;p=bbb-usb.git initial commit --- efe0ef7bfeab92bb4b5e6df74cafd09debfb145e diff --git a/misc/.install.sh.swp b/misc/.install.sh.swp new file mode 100644 index 0000000..c0a50ec Binary files /dev/null and b/misc/.install.sh.swp differ diff --git a/misc/armmake b/misc/armmake new file mode 100755 index 0000000..11b50c0 --- /dev/null +++ b/misc/armmake @@ -0,0 +1,41 @@ +#!/bin/ksh +MACHINE=armv7 +MACHINE_ARCH=arm +MACHINE_COMP=arm +VERSION=6.0 +#this is true for most archs +MACHINE_CPU=${MACHINE_ARCH} +TARGET=${MACHINE} + +HOST=$(uname -m) + +export MAKEOBJDIR=obj.${HOST}.${MACHINE} +export HOST MACHINE TARGET + +ABI= +CROSSDIR=/usr/cross/${MACHINE} +CROSS=${MACHINE_COMP}-unknown-openbsd${VERSION}${ABI} +PATH=$PATH:${CROSSDIR}/usr/${CROSS}/bin:${CROSSDIR}/usr/bin + +export BSDOBJDIR=${CROSSDIR}/usr/obj + +MACHINE=${MACHINE} \ +MACHINE_ARCH=${MACHINE_ARCH} \ +MACHINE_CPU=${MACHINE_CPU} \ +CROSSDIR=${CROSSDIR} \ +CC=${CROSS}-cc \ +CPP=${CROSS}-cpp \ +CXX=${CROSS}-c++ \ +AS=${CROSS}-as \ +LD=${CROSS}-ld \ +SIZE=size \ +STRIP=${CROSS}-strip \ +OBJDUMP=${CROSS}-objdump \ +OBJCOPY=${CROSS}-objcopy \ +make \ +MACHINE=${MACHINE} \ +MACHINE_ARCH=${MACHINE_ARCH} \ +OBJMACHINE=${MACHINE_ARCH} \ +MAKEOBJDIR=obj.${HOST}.${MACHINE} \ +"$@" + diff --git a/misc/dhcpd.conf b/misc/dhcpd.conf new file mode 100644 index 0000000..1205b76 --- /dev/null +++ b/misc/dhcpd.conf @@ -0,0 +1,48 @@ +# $OpenBSD: dhcpd.conf,v 1.1 2014/07/11 21:20:10 deraadt Exp $ +# +# DHCP server options. +# See dhcpd.conf(5) and dhcpd(8) for more information. +# + +# Network: 192.168.1.0/255.255.255.0 +# Domain name: my.domain +# Name servers: 192.168.1.3 and 192.168.1.5 +# Default router: 192.168.1.1 +# Addresses: 192.168.1.32 - 192.168.1.127 + +option domain-name-servers 8.8.8.8; + +subnet 192.168.9.0 netmask 255.255.255.0 { + option routers 192.168.9.1; + + range 192.168.9.32 192.168.9.127; + +} + +subnet 192.168.12.0 netmask 255.255.255.0 { + option routers 192.168.12.1; + range 192.168.12.2 192.168.12.127; +} + +subnet 192.168.8.0 netmask 255.255.255.0 { + option routers 192.168.8.1; + + range 192.168.8.32 192.168.8.127; + +} +subnet 192.168.45.0 netmask 255.255.255.0 { + option routers 192.168.45.1; + range 192.168.45.4 192.168.45.127; + + host kremserve { + fixed-address 192.168.45.2; + hardware ethernet 00:00:00:00:00:00; + } + +} +# re2 +subnet 192.168.6.0 netmask 255.255.255.0 { + option routers 192.168.6.1; + + range 192.168.6.32 192.168.6.127; +} diff --git a/misc/install.sh b/misc/install.sh new file mode 100755 index 0000000..30764de --- /dev/null +++ b/misc/install.sh @@ -0,0 +1,4 @@ +#!/bin/ksh + +cd $(dirname "$0") +pwd diff --git a/misc/pf.conf b/misc/pf.conf new file mode 100644 index 0000000..cd4ce29 --- /dev/null +++ b/misc/pf.conf @@ -0,0 +1,30 @@ +# $OpenBSD: pf.conf,v 1.54 2014/08/23 05:49:42 deraadt Exp $ +# +# See pf.conf(5) and /etc/examples/pf.conf + +#set skip on lo + +#block return # block stateless traffic +#pass # establish keep-state + +# By default, do not permit remote connections to X11 +#block return in on ! lo0 proto tcp to port 6000:6010 + +int_if="re1" +table { 0.0.0.0/8 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 \ + 172.16.0.0/12 192.0.0.0/24 192.0.2.0/24 224.0.0.0/3 \ + 192.168.0.0/16 198.18.0.0/15 198.51.100.0/24 \ + 203.0.113.0/24 } +set block-policy drop +set loginterface egress +set skip on lo0 +match in all scrub (no-df random-id max-mss 1440) +match out on egress inet from !(egress:network) to any nat-to (egress:0) +block in quick on egress from to any +block return out quick on egress from any to +block all +pass out quick inet +pass in on $int_if inet +pass in on egress inet proto tcp from any to (egress) port 22 +pass in on egress inet proto tcp from any to (egress) port { 80 443 } rdr-to 192.168.5.1 + diff --git a/src/sys/arch/armv7/USB b/src/sys/arch/armv7/USB new file mode 100644 index 0000000..43dcbd6 --- /dev/null +++ b/src/sys/arch/armv7/USB @@ -0,0 +1,295 @@ +# $OpenBSD: GENERIC,v 1.70 2017/01/03 19:57:01 kettenis Exp $ +# +# For further information on compiling OpenBSD kernels, see the config(8) +# man page. +# +# For further information on hardware support for this architecture, see +# the intro(4) man page. For further information about kernel options +# for this architecture, see the options(4) man page. For an explanation +# of each device driver in this file see the section 4 man page for the +# device. + +machine armv7 arm +include "../../../conf/GENERIC" + +makeoptions KERNEL_BASE_VIRT="0xc0300000" + +maxusers 32 # estimated number of users +option CPU_ARMv7 # Support the ARMv7 + +#option WSDISPLAY_COMPAT_USL # VT handling +option WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes +option WSDISPLAY_DEFAULTSCREENS=1 + +option CONF_HAVE_GPIO +option USBVERBOSE + +config bsd swap generic + +# The main bus device +mainbus0 at root +simplebus* at fdt? +cpu0 at mainbus? + +# Cortex-A9 +cortex0 at mainbus? +ampintc* at fdt? +amptimer* at cortex? +agtimer* at fdt? +armliicc* at cortex? + +# iMX +imxccm* at fdt? early 1 # clock control module +imxiomuxc* at fdt? early 1 # iomux controller +imxocotp* at fdt? # on-chip otp controller +imxgpc* at fdt? # power controller +imxdog* at fdt? # watchdog timer +imxtemp* at fdt? # temperature monitor +imxgpio* at fdt? # user-visible GPIO pins? +fec* at fdt? # Ethernet +imxuart* at fdt? # onboard uarts +imxiic* at fdt? # i2c +iic* at imxiic? +imxesdhc* at fdt? # SDHC controller +sdmmc* at imxesdhc? # SD/MMC bus +imxahci* at fdt? # AHCI/SATA +imxehci* at fdt? # EHCI +usb* at imxehci? + +# OMAP3xxx/OMAP4xxx SoC +omap0 at mainbus? +omapid* at omap? + +# OMAP on-chip devices +intc* at fdt? # OMAP3 interrupt controller +omwugen* at fdt? # Wake-up generator +#edma* at omap? # OMAP3 dma controller +prcm* at omap? # power/clock controller +ompinmux* at fdt? # pin muxing +omdog* at fdt? # watchdog timer +omgpio* at fdt? # user-visible GPIO pins? +gpio* at omgpio? +tiiic* at fdt? +iic* at tiiic? +gptimer* at omap? # general purpose timers +dmtimer* at omap? # am335x dual mode timers +omusbtll* at omap? +cpsw* at fdt? +com* at fdt? # onboard uarts +ommmc* at fdt? # SD/MMC card controller +sdmmc* at ommmc? # SD/MMC bus + +amusbss* at fdt? # am335x usb subsystem +ammusb* at fdt? # am335x usb-otg controller +omehci* at fdt? # EHCI +usb* at omehci? + +# Sunxi A1x/A20 SoC +sxiintc* at fdt? # A1x interrupt controller +sxipio* at fdt? early 1 # GPIO pins for leds & PHYs +gpio* at sxipio? +sxiccmu* at fdt? early 1 # Clock Control Module/Unit +sxitimer* at fdt? early 1 +sxidog* at fdt? # watchdog timer +sxirtc* at fdt? # Real Time Clock +sxie* at fdt? +dwge* at fdt? +sxiahci* at fdt? # AHCI/SATA +sximmc* at fdt? # SD/MMC card controller +sdmmc* at sximmc? # SD/MMC bus +ehci* at fdt? # EHCI (shim) +usb* at ehci? #flags 0x1 +#ohci* at sunxi? +#usb* at ohci? + +# ARM Versatile Express +sysreg* at fdt? +pluart* at fdt? +plrtc* at fdt? +virtio* at fdt? + +psci* at fdt? + +simplefb* at fdt? +wsdisplay* at simplefb? + +# Exynos +exynos0 at mainbus? +exdisplay* at exynos? +wsdisplay* at exdisplay? console ? +exclock* at exynos? +expower* at exynos? +exsysreg* at exynos? +exmct* at exynos? +exdog* at exynos? +exgpio* at exynos? +exiic* at exynos? +iic* at exiic? +exehci* at exynos? +ehci* at exehci? +exesdhc* at exynos? +sdmmc* at exesdhc? +exuart* at fdt? + +# Raspberry Pi 2/3 +bcmintc* at fdt? +dwctwo* at fdt? +usb* at dwctwo? + +# Marvell SoC +mvacc* at fdt? early 1 +mvagc* at fdt? +mvsysctrl* at fdt? +mvmbus* at fdt? + +crosec* at iic? +wskbd* at crosec? mux 1 +pcfrtc* at iic? +tpspmic* at iic? + +# virtio devices +vioblk* at virtio? +vio* at virtio? +viomb* at virtio? +viornd* at virtio? +vioscsi* at virtio? + +# USB bus support +usb* at ehci? flags 0x1 + +# USB devices +uhub* at usb? # USB Hubs +uhub* at uhub? # USB Hubs +ualea* at uhub? # Araneus Alea II TRNG +uonerng* at uhub? # Moonbase Otago OneRNG +umodem* at uhub? # USB Modems/Serial +ucom* at umodem? +uvisor* at uhub? # Handspring Visor +ucom* at uvisor? +uvscom* at uhub? # SUNTAC Slipper U VS-10U serial +ucom* at uvscom? +ubsa* at uhub? # Belkin serial adapter +ucom* at ubsa? +uftdi* at uhub? # FTDI FT8U100AX serial adapter +ucom* at uftdi? +uplcom* at uhub? # I/O DATA USB-RSAQ2 serial adapter +ucom* at uplcom? +umct* at uhub? # MCT USB-RS232 serial adapter +ucom* at umct? +uslcom* at uhub? # Silicon Laboratories CP210x serial +ucom* at uslcom? +uark* at uhub? # Arkmicro ARK3116 serial +ucom* at uark? +moscom* at uhub? # MosChip MCS7703 serial +ucom* at moscom? +umcs* at uhub? # MosChip MCS78x0 serial +ucom* at umcs? +uipaq* at uhub? # iPAQ serial adapter +ucom* at uipaq? +umsm* at uhub? # Qualcomm MSM EVDO +ucom* at umsm? +uchcom* at uhub? # WinChipHead CH341/340 serial +ucom* at uchcom? +uticom* at uhub? # TI serial +ucom* at uticom? +uaudio* at uhub? # USB Audio +audio* at uaudio? +umidi* at uhub? # USB MIDI +midi* at umidi? +ulpt* at uhub? # USB Printers +umass* at uhub? # USB Mass Storage devices +uhidev* at uhub? # Human Interface Devices +ums* at uhidev? # USB mouse +wsmouse* at ums? mux 0 +uts* at uhub? # USB touchscreen +wsmouse* at uts? mux 0 +uwacom* at uhidev? # USB Wacom tablet +wsmouse* at uwacom? mux 0 +ukbd* at uhidev? # USB keyboard +wskbd* at ukbd? mux 1 +ucycom* at uhidev? # Cypress serial +ucom* at ucycom? +uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART +ucom* at uslhcom? +uhid* at uhidev? # USB generic HID support +upd* at uhidev? # USB Power Devices sensors +aue* at uhub? # ADMtek AN986 Pegasus Ethernet +atu* at uhub? # Atmel AT76c50x based 802.11b +axe* at uhub? # ASIX Electronics AX88172 USB Ethernet +axen* at uhub? # ASIX Electronics AX88179 USB Ethernet +cue* at uhub? # CATC USB-EL1201A based Ethernet +kue* at uhub? # Kawasaki KL5KUSB101B based Ethernet +smsc* at uhub? # SMSC LAN95xx Ethernet +cdce* at uhub? # CDC Ethernet +urndis* at uhub? # Remote NDIS Ethernet +upl* at uhub? # Prolific PL2301/PL2302 host-to-host `network' +ugl* at uhub? # Genesys Logic GL620USB-A host-to-host `network' +udav* at uhub? # Davicom DM9601 based Ethernet +mos* at uhub? # MOSCHIP MCS7730/7830 10/100 Ethernet +url* at uhub? # Realtek RTL8150L based adapters +ure* at uhub? # Realtek RTL8152 based adapters +wi* at uhub? # WaveLAN IEEE 802.11DS +udsbr* at uhub? # D-Link DSB-R100 radio +radio* at udsbr? # USB radio +uberry* at uhub? # Research In Motion BlackBerry +ugen* at uhub? # USB Generic driver +uath* at uhub? # Atheros AR5005UG/AR5005UX +ural* at uhub? # Ralink RT2500USB +rum* at uhub? # Ralink RT2501USB/RT2601USB +run* at uhub? # Ralink RT2700U/RT2800U/RT3000U +otus* at uhub? # Atheros AR9001U +athn* at uhub? # Atheros AR9002U +zyd* at uhub? # Zydas ZD1211 +upgt* at uhub? # Conexant/Intersil PrismGT SoftMAC USB +urtw* at uhub? # Realtek 8187 +rsu* at uhub? # Realtek RTL8188SU/RTL8191SU/RTL8192SU +urtwn* at uhub? # Realtek RTL8188CU/RTL8192CU +udcf* at uhub? # Gude Expert mouseCLOCK +uthum* at uhidev? # TEMPerHUM sensor +ugold* at uhidev? # gold TEMPer sensor +utrh* at uhidev? # USBRH sensor +utwitch* at uhidev? # YUREX BBU sensor +uow* at uhub? # Maxim/Dallas DS2490 1-Wire adapter +uoakrh* at uhidev? # Toradex OAK temp and rel humidity +uoaklux* at uhidev? # Toradex OAK LUX +uoakv* at uhidev? # Toradex OAK 10V sensor +onewire* at uow? +uvideo* at uhub? # USB Video +video* at uvideo? +utvfu* at uhub? # Fushicai Audio-Video Grabber +video* at utvfu? +audio* at utvfu? +udl* at uhub? # DisplayLink USB displays +wsdisplay* at udl? + +atphy* at mii? # Attansic F1 PHYs +rgephy* at mii? # Realtek 8169S/8110S PHY +rlphy* at mii? # Realtek 8139 internal PHYs +ukphy* at mii? # "unknown" PHYs + +scsibus* at scsi? +sd* at scsibus? +cd* at scsibus? +st* at scsibus? +ch* at scsibus? +uk* at scsibus? + +# GPIO "pin bus" drivers +gpioiic* at gpio? # I2C bus bit-banging +iic* at gpioiic? +gpioow* at gpio? # 1-Wire bus bit-banging +onewire* at gpioow? + +# 1-Wire devices +option ONEWIREVERBOSE +owid* at onewire? # ID +owsbm* at onewire? # Smart Battery Monitor +owtemp* at onewire? # Temperature +owctr* at onewire? # Counter device + +# Pseudo-Devices +pseudo-device openprom +pseudo-device hotplug 1 # devices hot plugging + +# mouse & keyboard multiplexor pseudo-devices +pseudo-device wsmux 2 diff --git a/src/sys/arch/armv7/omap/ammusb.c b/src/sys/arch/armv7/omap/ammusb.c new file mode 100644 index 0000000..455b2fb --- /dev/null +++ b/src/sys/arch/armv7/omap/ammusb.c @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2017 Ian Sutton + * Copyright (c) 2013 Oleksandr Tymoshenko + * + * 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 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 AUTHOR 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 +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include + +#define DEVNAME(_s) ((_s)->sc_dev.dv_xname) + +#define AMMUSB_DEBUG /* XXX */ + +#ifdef AMMUSB_DEBUG +int ammusb_debug = 20; +#define DPRINTF(n,s) do { if ((n) <= ammusb_debug) printf s; } while (0) +#else +#define DPRINTF(n,s) do {} +#endif + +#define HREAD4(sc, reg) \ + (bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg))) +#define HWRITE4(sc, reg, val) \ + bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val)) +#define HSET4(sc, reg, bits) \ + HWRITE4((sc), (reg), HREAD4((sc), (reg)) | (bits)) +#define HCLR4(sc, reg, bits) \ + HWRITE4((sc), (reg), HREAD4((sc), (reg)) & ~(bits)) + +struct ammusb_softc { + struct device sc_dev; + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + void *sc_ih; +}; + +/* core decl */ +int ammusb_match(struct device *, void *, void *); +void ammusb_attach(struct device *, struct device *, void *); +int ammusb_detach(struct device *, int); +int ammusb_intr(void *); +void ammusb_reset(struct ammusb_softc *); + +/* debug decl */ +void ammusb_preg(uint32_t, char *, struct ammusb_softc *); +void ammusb_dumpregs(struct ammusb_softc *); + +/* core/iomux.c def */ +struct cfattach ammusb_ca = { + sizeof (struct ammusb_softc), ammusb_match, ammusb_attach, ammusb_detach +}; + +struct cfdriver ammusb_cd = { + NULL, "ammusb", DV_DULL +}; + +int +ammusb_match(struct device *parent, void *v, void *aux) +{ + struct fdt_attach_args *faa = aux; +/* int node; + char name[32]; + + if (OF_is_compatible(faa->fa_node, "ti,am33xx-usb")) { + printf("!!HIT!!\n"); + for (node = OF_child(faa->fa_node); node; node = OF_peer(node)) { + + } + }*/ + printf("MAYBE: %d\n", faa->fa_node); + return OF_is_compatible(faa->fa_node, "ti,musb-am33xx"); +} + +void +ammusb_attach(struct device *parent, struct device *self, void *args) +{ + struct ammusb_softc *sc = (struct ammusb_softc *) self; + struct fdt_attach_args *faa = args; + + uint32_t rev; + + sc->sc_iot = faa->fa_iot; + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, faa->fa_reg[0].size, 0, + &sc->sc_ioh)) + panic("%s: bus_space_map failed!", __func__); + + rev = HREAD4(sc, 0x0); + printf(" rev 0x%08x\n", rev); + printf("%s: phys: 0x%08llx, size: %08llx\n", DEVNAME(sc), faa->fa_reg[0].addr, + faa->fa_reg[0].size); +} + +int +ammusb_detach(struct device *self, int flags) +{ + return 0; /* XXX */ +} + +int +ammusb_intr(void * arg) +{ + return 0; /* XXX */ +} diff --git a/src/sys/arch/armv7/omap/amusbss.c b/src/sys/arch/armv7/omap/amusbss.c new file mode 100644 index 0000000..9d5abe6 --- /dev/null +++ b/src/sys/arch/armv7/omap/amusbss.c @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2017 Ian Sutton + * Copyright (c) 2013 Oleksandr Tymoshenko + * + * 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 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 AUTHOR 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 +#include +#include +#include + +#include +#include + +#include + +#include + +#include + +#define DEVNAME(_s) ((_s)->sc_dev.dv_xname) + +#define AMUSBSS_DEBUG /* XXX */ + +#ifdef AMUSBSS_DEBUG +int amusbss_debug = 20; +#define DPRINTF(n,s) do { if ((n) <= amusbss_debug) printf s; } while (0) +#else +#define DPRINTF(n,s) do {} +#endif + +#define HREAD4(sc, reg) \ + (bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg))) +#define HWRITE4(sc, reg, val) \ + bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val)) +#define HSET4(sc, reg, bits) \ + HWRITE4((sc), (reg), HREAD4((sc), (reg)) | (bits)) +#define HCLR4(sc, reg, bits) \ + HWRITE4((sc), (reg), HREAD4((sc), (reg)) & ~(bits)) + +#define USBSS_REVREG 0x00 +#define USBSS_SYSCONFIG 0x10 +#define USBSS_SYSCONFIG_SRESET 1 + +#define USBCTRL_REV 0x00 +#define USBCTRL_CTRL 0x14 +#define USBCTRL_STAT 0x18 +#define USBCTRL_IRQ_STAT0 0x30 +#define IRQ_STAT0_RXSHIFT 16 +#define IRQ_STAT0_TXSHIFT 0 +#define USBCTRL_IRQ_STAT1 0x34 +#define IRQ_STAT1_DRVVBUS (1 << 8) +#define USBCTRL_INTEN_SET0 0x38 +#define USBCTRL_INTEN_SET1 0x3C +#define USBCTRL_INTEN_USB_ALL 0x1ff +#define USBCTRL_INTEN_USB_SOF (1 << 3) +#define USBCTRL_INTEN_CLR0 0x40 +#define USBCTRL_INTEN_CLR1 0x44 +#define USBCTRL_UTMI 0xE0 +#define USBCTRL_UTMI_FSDATAEXT (1 << 1) +#define USBCTRL_MODE 0xE8 +#define USBCTRL_MODE_IDDIG (1 << 8) +#define USBCTRL_MODE_IDDIGMUX (1 << 7) + +struct amusbss_softc { + struct device sc_dev; +// struct simplebus_softc sc_dev; + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; +}; + +/* core decl */ +int amusbss_match(struct device *, void *, void *); +void amusbss_attach(struct device *, struct device *, void *); +int amusbss_detach(struct device *, int); +void amusbss_reset(struct amusbss_softc *); + +/* debug decl */ +void amusbss_preg(uint32_t, char *, struct amusbss_softc *); +void amusbss_dumpregs(struct amusbss_softc *); + +/* core/iomux.c def */ +struct cfattach amusbss_ca = { + sizeof (struct amusbss_softc), amusbss_match, amusbss_attach, amusbss_detach +}; + +struct cfdriver amusbss_cd = { + NULL, "amusbss", DV_DULL +}; + +int +amusbss_match(struct device *parent, void *v, void *aux) +{ + struct fdt_attach_args *faa = aux; +panic("its openbsd"); + return OF_is_compatible(faa->fa_node, "ti,am33xx-usb"); +} + +void +amusbss_attach(struct device *parent, struct device *self, void *args) +{ + struct amusbss_softc *sc = (struct amusbss_softc *) self; + struct fdt_attach_args *faa = args; + + int i, node; + uint32_t rev; + +// struct fdt_attach_args +// char *name + + sc->sc_iot = faa->fa_iot; + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, faa->fa_reg[0].size, 0, + &sc->sc_ioh)) + panic("%s: bus_space_map failed!", __func__); + + + /* Enable device clocks */ + prcm_enablemodule(PRCM_USB); + + /* Reset USB subsystem, USB0 and USB1 */ + HWRITE4(sc, USBSS_SYSCONFIG, USBSS_SYSCONFIG_SRESET); + delay(100); + i = 10; + while (HREAD4(sc, USBSS_SYSCONFIG) & USBSS_SYSCONFIG_SRESET) { + delay(100); + if (i-- == 0) { + printf(": reset timeout.\n"); + return; + } + } + + rev = HREAD4(sc, USBSS_REVREG); + printf(": rev %d.%d\n", rev >> 4 &0xf, rev & 0xf); + + /* Walk the OFW tree and attach top-level devices */ + for (node = OF_child(faa->fa_node); node > 0; node = OF_peer(node)) { + + } +} + +int +amusbss_detach(struct device *self, int flags) +{ + return 0; /* XXX */ +} + diff --git a/src/sys/arch/armv7/omap/files.omap b/src/sys/arch/armv7/omap/files.omap new file mode 100644 index 0000000..5f66bd1 --- /dev/null +++ b/src/sys/arch/armv7/omap/files.omap @@ -0,0 +1,105 @@ +# $OpenBSD: files.omap,v 1.19 2016/10/03 01:59:20 jsg Exp $ + +define omap {} +device omap: omap +attach omap at fdt +file arch/armv7/omap/omap_machdep.c omap needs-flag +file arch/armv7/omap/omap.c omap +file arch/armv7/omap/omap3.c +file arch/armv7/omap/omap4.c +file arch/armv7/omap/am335x.c + +device ommmc: sdmmcbus +attach ommmc at fdt +file arch/armv7/omap/ommmc.c ommmc + +device cpsw: ether, ifnet, mii, ifmedia +attach cpsw at fdt +file arch/armv7/omap/if_cpsw.c cpsw + +device prcm +attach prcm at omap +file arch/armv7/omap/prcm.c prcm + +device sitaracm +attach sitaracm at omap +file arch/armv7/omap/am335x_cm_padconf.c sitaracm +file arch/armv7/omap/sitara_cm.c sitaracm + +device ompinmux +attach ompinmux at fdt +file arch/armv7/omap/ompinmux.c ompinmux + +device omgpio: gpiobus +attach omgpio at fdt +file arch/armv7/omap/omgpio.c omgpio + +device tiiic: i2cbus +attach tiiic at fdt +file arch/armv7/omap/ti_iic.c tiiic + +device edma +attach edma at omap +file arch/armv7/omap/edma.c edma + +device intc +attach intc at fdt +file arch/armv7/omap/intc.c intc + +device omwugen +attach omwugen at fdt +file arch/armv7/omap/omwugen.c omwugen + +device gptimer +attach gptimer at omap +file arch/armv7/omap/gptimer.c gptimer + +device dmtimer +attach dmtimer at omap +file arch/armv7/omap/dmtimer.c dmtimer + +device omapid +attach omapid at omap +file arch/armv7/omap/omapid.c omapid + +device omdog +attach omdog at fdt +file arch/armv7/omap/omdog.c omdog + +device amusbss +attach amusbss at fdt +file arch/armv7/omap/amusbss.c amusbss + +attach ohci at omap with omohci +file arch/armv7/omap/omohci.c omohci + +device omehci: usbus +attach omehci at fdt +file arch/armv7/omap/omehci.c omehci + +device ammusb: usbus +attach ammusb at fdt +file arch/armv7/omap/ammusb.c ammusb + +device omusbtll +attach omusbtll at omap +file arch/armv7/omap/omusbtll.c omusbtll + +device omkbd: wskbddev +attach omkbd at omap +file arch/armv7/omap/omkbd.c omkbd + +# LCD frame buffer +device omdisplay: wsemuldisplaydev, rasops16 +attach omdisplay at omap +file arch/armv7/omap/omdisplay.c omdisplay + +# MCSPI - spi +device mcspi +attach mcspi at omap +file arch/armv7/omap/mcspi.c mcspi + +# pseudo-Audio Device Driver +device oaudio: audio +attach oaudio at omap # configure after Atlas Driver +file arch/armv7/omap/beagle_audio.c oaudio