summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2016-09-03 13:37:47 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2016-09-03 13:37:47 +0000
commit37aac2adfced782c2d6ae0887a5a64ac95353204 (patch)
tree3f28a85d7bfa42a25d9d65b8881fc55806fe7518 /sys
parent5b18b0a5b8fface0a094617923f26645064dacc8 (diff)
Retire zaurus, as it hasn't made the EABI jump and will be permanently broken
shortly when we use the hardware thread register in userland
Diffstat (limited to 'sys')
-rw-r--r--sys/Makefile5
-rw-r--r--sys/arch/arm/xscale/files.pxa2x089
-rw-r--r--sys/arch/arm/xscale/pxa27x_kpc.c227
-rw-r--r--sys/arch/arm/xscale/pxa27x_kpc.h48
-rw-r--r--sys/arch/arm/xscale/pxa27x_udc.c1162
-rw-r--r--sys/arch/arm/xscale/pxa27x_udc.h68
-rw-r--r--sys/arch/arm/xscale/pxa27x_udcreg.h189
-rw-r--r--sys/arch/arm/xscale/pxa2x0.c461
-rw-r--r--sys/arch/arm/xscale/pxa2x0_a4x_io.S104
-rw-r--r--sys/arch/arm/xscale/pxa2x0_a4x_space.c134
-rw-r--r--sys/arch/arm/xscale/pxa2x0_apm.c1585
-rw-r--r--sys/arch/arm/xscale/pxa2x0_apm.h83
-rw-r--r--sys/arch/arm/xscale/pxa2x0_apm_asm.S588
-rw-r--r--sys/arch/arm/xscale/pxa2x0_clock.c301
-rw-r--r--sys/arch/arm/xscale/pxa2x0_com.c181
-rw-r--r--sys/arch/arm/xscale/pxa2x0_dma.c70
-rw-r--r--sys/arch/arm/xscale/pxa2x0_dmac.c315
-rw-r--r--sys/arch/arm/xscale/pxa2x0_dmac.h30
-rw-r--r--sys/arch/arm/xscale/pxa2x0_gpio.c776
-rw-r--r--sys/arch/arm/xscale/pxa2x0_gpio.h71
-rw-r--r--sys/arch/arm/xscale/pxa2x0_i2c.c322
-rw-r--r--sys/arch/arm/xscale/pxa2x0_i2c.h40
-rw-r--r--sys/arch/arm/xscale/pxa2x0_i2s.c346
-rw-r--r--sys/arch/arm/xscale/pxa2x0_i2s.h58
-rw-r--r--sys/arch/arm/xscale/pxa2x0_intr.c711
-rw-r--r--sys/arch/arm/xscale/pxa2x0_intr.h127
-rw-r--r--sys/arch/arm/xscale/pxa2x0_lcd.c869
-rw-r--r--sys/arch/arm/xscale/pxa2x0_lcd.h151
-rw-r--r--sys/arch/arm/xscale/pxa2x0_mmc.c692
-rw-r--r--sys/arch/arm/xscale/pxa2x0_mutex.c78
-rw-r--r--sys/arch/arm/xscale/pxa2x0_ohci.c233
-rw-r--r--sys/arch/arm/xscale/pxa2x0_pcic.c515
-rw-r--r--sys/arch/arm/xscale/pxa2x0_space.c263
-rw-r--r--sys/arch/arm/xscale/pxa2x0reg.h895
-rw-r--r--sys/arch/arm/xscale/pxa2x0var.h97
-rw-r--r--sys/arch/arm/xscale/pxammcvar.h43
-rw-r--r--sys/arch/arm/xscale/pxapcicvar.h81
-rw-r--r--sys/arch/zaurus/Makefile45
-rw-r--r--sys/arch/zaurus/compile/.cvsignore2
-rw-r--r--sys/arch/zaurus/conf/GENERIC229
-rw-r--r--sys/arch/zaurus/conf/Makefile.zaurus175
-rw-r--r--sys/arch/zaurus/conf/RAMDISK127
-rw-r--r--sys/arch/zaurus/conf/files.zaurus120
-rw-r--r--sys/arch/zaurus/dev/scoop_mmc.c82
-rw-r--r--sys/arch/zaurus/dev/scoop_pcic.c253
-rw-r--r--sys/arch/zaurus/dev/zaurus_apm.c731
-rw-r--r--sys/arch/zaurus/dev/zaurus_apm.h20
-rw-r--r--sys/arch/zaurus/dev/zaurus_audio.c792
-rw-r--r--sys/arch/zaurus/dev/zaurus_flash.c908
-rw-r--r--sys/arch/zaurus/dev/zaurus_kbd.c545
-rw-r--r--sys/arch/zaurus/dev/zaurus_kbdmap.h197
-rw-r--r--sys/arch/zaurus/dev/zaurus_remote.c374
-rw-r--r--sys/arch/zaurus/dev/zaurus_scoop.c472
-rw-r--r--sys/arch/zaurus/dev/zaurus_scoopreg.h83
-rw-r--r--sys/arch/zaurus/dev/zaurus_scoopvar.h33
-rw-r--r--sys/arch/zaurus/dev/zaurus_ssp.c402
-rw-r--r--sys/arch/zaurus/dev/zaurus_sspvar.h28
-rw-r--r--sys/arch/zaurus/dev/zaurus_udc.c108
-rw-r--r--sys/arch/zaurus/dev/zts.c610
-rw-r--r--sys/arch/zaurus/include/_float.h3
-rw-r--r--sys/arch/zaurus/include/_types.h8
-rw-r--r--sys/arch/zaurus/include/apmvar.h2
-rw-r--r--sys/arch/zaurus/include/asm.h4
-rw-r--r--sys/arch/zaurus/include/atomic.h10
-rw-r--r--sys/arch/zaurus/include/bootconfig.h67
-rw-r--r--sys/arch/zaurus/include/bus.h4
-rw-r--r--sys/arch/zaurus/include/cdefs.h3
-rw-r--r--sys/arch/zaurus/include/conf.h17
-rw-r--r--sys/arch/zaurus/include/cpu.h4
-rw-r--r--sys/arch/zaurus/include/db_machdep.h4
-rw-r--r--sys/arch/zaurus/include/disklabel.h3
-rw-r--r--sys/arch/zaurus/include/endian.h4
-rw-r--r--sys/arch/zaurus/include/exec.h3
-rw-r--r--sys/arch/zaurus/include/fenv.h3
-rw-r--r--sys/arch/zaurus/include/fp.h4
-rw-r--r--sys/arch/zaurus/include/frame.h4
-rw-r--r--sys/arch/zaurus/include/ieee.h4
-rw-r--r--sys/arch/zaurus/include/ieeefp.h4
-rw-r--r--sys/arch/zaurus/include/intr.h109
-rw-r--r--sys/arch/zaurus/include/limits.h4
-rw-r--r--sys/arch/zaurus/include/loadfile_machdep.h51
-rw-r--r--sys/arch/zaurus/include/lock.h4
-rw-r--r--sys/arch/zaurus/include/machine_reg.h84
-rw-r--r--sys/arch/zaurus/include/mutex.h3
-rw-r--r--sys/arch/zaurus/include/param.h47
-rw-r--r--sys/arch/zaurus/include/pcb.h4
-rw-r--r--sys/arch/zaurus/include/pio.h4
-rw-r--r--sys/arch/zaurus/include/pmap.h4
-rw-r--r--sys/arch/zaurus/include/proc.h4
-rw-r--r--sys/arch/zaurus/include/profile.h4
-rw-r--r--sys/arch/zaurus/include/ptrace.h4
-rw-r--r--sys/arch/zaurus/include/reg.h4
-rw-r--r--sys/arch/zaurus/include/reloc.h2
-rw-r--r--sys/arch/zaurus/include/setjmp.h4
-rw-r--r--sys/arch/zaurus/include/signal.h4
-rw-r--r--sys/arch/zaurus/include/spinlock.h7
-rw-r--r--sys/arch/zaurus/include/stdarg.h4
-rw-r--r--sys/arch/zaurus/include/sysarch.h4
-rw-r--r--sys/arch/zaurus/include/tcb.h3
-rw-r--r--sys/arch/zaurus/include/trap.h4
-rw-r--r--sys/arch/zaurus/include/vmparam.h84
-rw-r--r--sys/arch/zaurus/include/zaurus_var.h54
-rw-r--r--sys/arch/zaurus/stand/Makefile9
-rw-r--r--sys/arch/zaurus/stand/Makefile.inc3
-rw-r--r--sys/arch/zaurus/stand/zboot/Makefile54
-rw-r--r--sys/arch/zaurus/stand/zboot/alloc.c234
-rw-r--r--sys/arch/zaurus/stand/zboot/boot.8387
-rw-r--r--sys/arch/zaurus/stand/zboot/compat_linux.h149
-rw-r--r--sys/arch/zaurus/stand/zboot/conf.c102
-rw-r--r--sys/arch/zaurus/stand/zboot/crt0.c25
-rw-r--r--sys/arch/zaurus/stand/zboot/devopen.c126
-rw-r--r--sys/arch/zaurus/stand/zboot/disk.h92
-rw-r--r--sys/arch/zaurus/stand/zboot/diskprobe.c317
-rw-r--r--sys/arch/zaurus/stand/zboot/exec.c26
-rw-r--r--sys/arch/zaurus/stand/zboot/exit.c71
-rw-r--r--sys/arch/zaurus/stand/zboot/libsa.h44
-rw-r--r--sys/arch/zaurus/stand/zboot/loadfile.c431
-rw-r--r--sys/arch/zaurus/stand/zboot/machdep.c53
-rw-r--r--sys/arch/zaurus/stand/zboot/pathnames.h19
-rw-r--r--sys/arch/zaurus/stand/zboot/termios.c100
-rw-r--r--sys/arch/zaurus/stand/zboot/unixcons.c231
-rw-r--r--sys/arch/zaurus/stand/zboot/unixdev.c223
-rw-r--r--sys/arch/zaurus/stand/zboot/unixdev.h57
-rw-r--r--sys/arch/zaurus/stand/zboot/unixsys.S75
-rw-r--r--sys/arch/zaurus/stand/zbsdmod/Makefile21
-rw-r--r--sys/arch/zaurus/stand/zbsdmod/compat_linux.h135
-rw-r--r--sys/arch/zaurus/stand/zbsdmod/zbsdmod.c363
-rw-r--r--sys/arch/zaurus/zaurus/autoconf.c147
-rw-r--r--sys/arch/zaurus/zaurus/genassym.cf1
-rw-r--r--sys/arch/zaurus/zaurus/zaurus_lcd.c416
-rw-r--r--sys/arch/zaurus/zaurus/zaurus_machdep.c1334
-rw-r--r--sys/arch/zaurus/zaurus/zaurus_start.S178
-rw-r--r--sys/dev/microcode/atmel/Makefile4
-rw-r--r--sys/dev/microcode/kue/Makefile4
-rw-r--r--sys/dev/microcode/rum/Makefile4
-rw-r--r--sys/dev/microcode/symbol/Makefile4
-rw-r--r--sys/dev/microcode/tusb3410/Makefile4
-rw-r--r--sys/dev/microcode/udl/Makefile4
-rw-r--r--sys/dev/microcode/zydas/Makefile4
-rw-r--r--sys/dev/usb/files.usb15
-rw-r--r--sys/dev/usb/if_cdcef.c557
-rw-r--r--sys/dev/usb/usbf.c708
-rw-r--r--sys/dev/usb/usbf.h170
-rw-r--r--sys/dev/usb/usbf_subr.c1082
-rw-r--r--sys/dev/usb/usbfvar.h169
-rw-r--r--sys/kern/Makefile4
146 files changed, 20 insertions, 27135 deletions
diff --git a/sys/Makefile b/sys/Makefile
index 76604e983fb..2ce99d44c1b 100644
--- a/sys/Makefile
+++ b/sys/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.47 2016/09/01 09:32:49 deraadt Exp $
+# $OpenBSD: Makefile,v 1.48 2016/09/03 13:37:42 guenther Exp $
# $NetBSD: Makefile,v 1.5 1995/09/15 21:05:21 pk Exp $
SUBDIR= dev/microcode \
@@ -6,8 +6,7 @@ SUBDIR= dev/microcode \
arch/hppa arch/i386 \
arch/landisk arch/loongson arch/luna88k \
arch/macppc arch/octeon \
- arch/sgi arch/socppc arch/sparc64 \
- arch/zaurus
+ arch/sgi arch/socppc arch/sparc64
tags:
cd ${.CURDIR}/kern; make tags
diff --git a/sys/arch/arm/xscale/files.pxa2x0 b/sys/arch/arm/xscale/files.pxa2x0
deleted file mode 100644
index 102d2df4119..00000000000
--- a/sys/arch/arm/xscale/files.pxa2x0
+++ /dev/null
@@ -1,89 +0,0 @@
-# $OpenBSD: files.pxa2x0,v 1.25 2016/05/02 08:15:55 patrick Exp $
-# $NetBSD: files.pxa2x0,v 1.6 2004/05/01 19:09:14 thorpej Exp $
-#
-# Configuration info for Intel PXA2[51]0 CPU support
-#
-
-file arch/arm/arm/softintr.c # Use the generic ARM soft interrupt code.
-
-# PXA2[51]0's integrated peripherals bus.
-define pxaip {[addr=-1], [size=0], [intr=-1], [index=-1]}
-device pxaip
-attach pxaip at fdt
-file arch/arm/xscale/pxa2x0.c
-file arch/arm/arm/irq_dispatch.S
-file arch/arm/xscale/pxa2x0_space.c
-#file arch/arm/xscale/pxa2x0_freqchg.S
-file arch/arm/xscale/pxa2x0_dma.c
-
-# Cotulla integrated peripherals.
-
-# INTC controller
-device pxaintc
-attach pxaintc at pxaip
-file arch/arm/xscale/pxa2x0_intr.c pxaintc
-file arch/arm/xscale/pxa2x0_mutex.c pxaintc
-#defflag opt_pxa2x0_gpio.h PXAGPIO_HAS_GPION_INTRS
-
-# GPIO controller
-device pxagpio
-attach pxagpio at pxaip
-file arch/arm/xscale/pxa2x0_gpio.c pxagpio needs-flag
-
-# DMA controller
-device pxadmac
-attach pxadmac at pxaip
-file arch/arm/xscale/pxa2x0_dmac.c pxadmac needs-flag
-
-# PXA2x0's built-in timer.
-device pxaost
-attach pxaost at pxaip
-file arch/arm/xscale/pxa2x0_clock.c pxaost
-
-# NS16550 compatible serial ports
-attach com at pxaip with com_pxaip
-file arch/arm/xscale/pxa2x0_com.c com_pxaip
-file arch/arm/xscale/pxa2x0_a4x_space.c com_pxaip
-file arch/arm/xscale/pxa2x0_a4x_io.S com_pxaip
-
-# PXA27x USB Device Controller
-device pxaudc: usbdev
-file arch/arm/xscale/pxa27x_udc.c pxaudc
-
-# OHCI USB Controller
-attach ohci at pxaip with pxaohci
-file arch/arm/xscale/pxa2x0_ohci.c pxaohci
-
-# LCD controller
-device lcd: wsemuldisplaydev, rasops16, rasops8, rasops4, rasops_rotation
-file arch/arm/xscale/pxa2x0_lcd.c lcd needs-flag
-
-# Inter-Integrated Circuit controller
-device i2c {}
-file arch/arm/xscale/pxa2x0_i2c.c i2c
-
-# Inter-IC Sound controller
-device i2s {}
-file arch/arm/xscale/pxa2x0_i2s.c i2s
-
-# Power manager and APM emulation
-device apm
-file arch/arm/xscale/pxa2x0_apm.c apm needs-flag
-file arch/arm/xscale/pxa2x0_apm_asm.S apm
-
-include "dev/pcmcia/files.pcmcia"
-
-# PCMCIA controller
-device pxapcic: pcmciabus
-file arch/arm/xscale/pxa2x0_pcic.c pxapcic
-
-# XXX this is a hack to use dev/pcmcia without fdc.c
-device fdc
-
-# MMC/SD/SDIO controller
-device pxammc: sdmmcbus
-file arch/arm/xscale/pxa2x0_mmc.c pxammc
-
-# PXA27x keypad
-device pxa27x_kpc: wskbddev
-file arch/arm/xscale/pxa27x_kpc.c pxa27x_kpc
diff --git a/sys/arch/arm/xscale/pxa27x_kpc.c b/sys/arch/arm/xscale/pxa27x_kpc.c
deleted file mode 100644
index 7ae267330d0..00000000000
--- a/sys/arch/arm/xscale/pxa27x_kpc.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* $OpenBSD: pxa27x_kpc.c,v 1.3 2014/01/26 17:48:07 miod Exp $ */
-/*
- * Copyright (c) 2009 Marek Vasut <marex@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/limits.h>
-#include <sys/timeout.h>
-#include <sys/systm.h>
-
-#include <arch/arm/xscale/pxa2x0_gpio.h>
-#include <arch/arm/xscale/pxa2x0reg.h>
-#include <arch/arm/xscale/pxa2x0var.h>
-#include <arch/arm/xscale/pxa27x_kpc.h>
-
-int pxa27x_kpc_enable(void *, int);
-void pxa27x_kpc_setleds(void *, int);
-int pxa27x_kpc_ioctl(void *, u_long, caddr_t, int, struct proc *);
-
-inline void pxa27x_kpc_submit(struct pxa27x_kpc_softc *, int);
-int pxa27x_kpc_intr(void *);
-
-struct cfdriver pxa27x_kpc_cd = {
- NULL, "pxa27x_kpc", DV_DULL,
-};
-
-struct wskbd_accessops pxa27x_kpc_accessops = {
- pxa27x_kpc_enable,
- pxa27x_kpc_setleds,
- pxa27x_kpc_ioctl,
-};
-
-struct wscons_keydesc pxa27x_kpc_keydesctab[] = {
- {KB_US, 0, 0, 0},
- {0, 0, 0, 0},
-};
-
-struct wskbd_mapdata pxa27x_kpc_mapdata = {
- pxa27x_kpc_keydesctab, KB_US | KB_DEFAULT,
-};
-
-void pxa27x_kpc_cngetc(void *, u_int *, int *);
-void pxa27x_kpc_cnpollc(void *, int);
-void pxa27x_kpc_cnbell(void *, u_int, u_int, u_int);
-
-struct wskbd_consops pxa27x_kpc_consops = {
- pxa27x_kpc_cngetc,
- pxa27x_kpc_cnpollc,
- pxa27x_kpc_cnbell,
-};
-
-int
-pxa27x_kpc_match(void *aux)
-{
- struct pxaip_attach_args *pxa = aux;
-
- if (pxa->pxa_addr != PXA2X0_KPC_BASE)
- return 0; /* Wrong device */
-
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) != CPU_ID_PXA27X)
- return 0; /* Wrong CPU */
-
- pxa->pxa_size = PXA2X0_KPC_SIZE;
- return 1;
-}
-
-void
-pxa27x_kpc_attach(struct pxa27x_kpc_softc *sc, void *aux)
-{
- struct pxaip_attach_args *pxa = aux;
- struct wskbddev_attach_args a;
-
- sc->sc_iot = pxa->pxa_sa.sa_iot;
- if (bus_space_map(sc->sc_iot, pxa->pxa_addr, pxa->pxa_size, 0,
- &sc->sc_ioh) != 0) {
- printf(": can't map regs\n");
- goto err;
- }
-
- pxa2x0_clkman_config(CKEN_KEY, 1);
-
- sc->sc_ih = pxa2x0_intr_establish(PXA2X0_INT_KPC, IPL_TTY,
- pxa27x_kpc_intr, sc, sc->sc_dev.dv_xname);
- if (!sc->sc_ih) {
- printf(": can't establish interrupt\n");
- goto err2;
- }
-
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, KPC_KPC, KPC_MIE | KPC_ME |
- KPC_MS(0xff) | KPC_IMKP | KPC_MI | KPC_MKCN(sc->sc_cols) |
- KPC_MKRN(sc->sc_rows) | KPC_ASACT);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, KPC_KPKDI, 0x30);
-
- pxa27x_kpc_keydesctab[0].map_size = sc->sc_ksize;
- pxa27x_kpc_keydesctab[0].map = sc->sc_kcodes;
-
- a.console = 1;
- a.keymap = &pxa27x_kpc_mapdata;
- a.accessops = &pxa27x_kpc_accessops;
- a.accesscookie = sc;
-
- printf("\n");
-
- wskbd_cnattach(&pxa27x_kpc_consops, sc, &pxa27x_kpc_mapdata);
-
- sc->sc_wskbddev = config_found((struct device *)sc, &a, wskbddevprint);
-
- return;
-
-err2:
- bus_space_unmap(sc->sc_iot, sc->sc_ioh, PXA2X0_KPC_SIZE);
-err:
- return;
-}
-
-inline void
-pxa27x_kpc_submit(struct pxa27x_kpc_softc *sc, int event)
-{
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- u_char key;
-
- if (sc->sc_rawkbd) {
- key = sc->sc_key;
- if (event == WSCONS_EVENT_KEY_DOWN)
- key |= 0x80;
- wskbd_rawinput(sc->sc_wskbddev, &key, 1);
- } else
-#endif
- wskbd_input(sc->sc_wskbddev, event, sc->sc_key);
-}
-
-int
-pxa27x_kpc_intr(void *arg)
-{
- u_int32_t val;
- int row = -1, col = -1;
- int i = 0;
- struct pxa27x_kpc_softc *sc = arg;
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, KPC_KPC);
- if (!(val & KPC_MI)) /* interrupt didn't happen .. what ?! */
- return 0;
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, KPC_KPAS);
- if (val & KPAS_SO) /* bogus interrupt */
- return 0;
-
- if (val & KPAS_MUKP) { /* keypress */
- col = val & KPAS_CP;
- row = (val & KPAS_RP) >> 4;
- for (i = 0; i < sc->sc_ksize; i++)
- if (sc->sc_kmap[i].row == row &&
- sc->sc_kmap[i].col == col) {
- sc->sc_key = sc->sc_kmap[i].key;
- pxa27x_kpc_submit(sc, WSCONS_EVENT_KEY_DOWN);
- break;
- }
- } else /* no keypress aka keyrelease */
- pxa27x_kpc_submit(sc, WSCONS_EVENT_KEY_UP);
-
- return 1;
-}
-
-int
-pxa27x_kpc_enable(void *v, int power)
-{
- return 0;
-}
-
-void
-pxa27x_kpc_setleds(void *v, int power)
-{
-}
-
-int
-pxa27x_kpc_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- struct pxa27x_kpc_softc *sc = v;
-#endif
-
- switch (cmd) {
- case WSKBDIO_GTYPE:
- *(int *)data = WSKBD_TYPE_KPC;
- return 0;
- case WSKBDIO_SETLEDS:
- return 0;
- case WSKBDIO_GETLEDS:
- *(int *)data = 0;
- return 0;
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- case WSKBDIO_SETMODE:
- sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
- return 0;
-#endif
- }
- return -1;
-}
-
-void
-pxa27x_kpc_cnbell(void *v, u_int pitch, u_int period, u_int volume)
-{
-}
-
-void
-pxa27x_kpc_cngetc(void *v, u_int *type, int *data)
-{
-}
-
-void
-pxa27x_kpc_cnpollc(void *v, int on)
-{
-}
diff --git a/sys/arch/arm/xscale/pxa27x_kpc.h b/sys/arch/arm/xscale/pxa27x_kpc.h
deleted file mode 100644
index 3541d007790..00000000000
--- a/sys/arch/arm/xscale/pxa27x_kpc.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: pxa27x_kpc.h,v 1.2 2013/10/24 22:40:10 aalm Exp $ */
-/*
- * Copyright (c) 2009 Marek Vasut <marex@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wskbdraw.h>
-#include <dev/wscons/wskbdvar.h>
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-
-struct pxa27x_kpc_keymap {
- int row;
- int col;
- keysym_t key;
-};
-
-struct pxa27x_kpc_softc {
- struct device sc_dev;
- struct device *sc_wskbddev;
- void *sc_ih;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- int sc_key;
- int sc_rawkbd;
-
- int sc_rows;
- int sc_cols;
- const struct pxa27x_kpc_keymap *sc_kmap;
- const keysym_t *sc_kcodes;
- const keysym_t *sc_xt_kcodes;
- int sc_ksize;
-};
-
-int pxa27x_kpc_match(void *);
-void pxa27x_kpc_attach(struct pxa27x_kpc_softc *, void *);
diff --git a/sys/arch/arm/xscale/pxa27x_udc.c b/sys/arch/arm/xscale/pxa27x_udc.c
deleted file mode 100644
index a809141c57a..00000000000
--- a/sys/arch/arm/xscale/pxa27x_udc.c
+++ /dev/null
@@ -1,1162 +0,0 @@
-/* $OpenBSD: pxa27x_udc.c,v 1.31 2015/05/15 13:32:08 jsg Exp $ */
-
-/*
- * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org>
- * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
- * Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/timeout.h>
-
-#include <machine/intr.h>
-#include <machine/bus.h>
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdivar.h>
-#include <dev/usb/usbf.h>
-#include <dev/usb/usbfvar.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-#include <arm/xscale/pxa27x_udc.h>
-
-#include "usbf.h"
-
-struct pxaudc_xfer {
- struct usbf_xfer xfer;
- u_int16_t frmlen;
-};
-
-struct pxaudc_pipe {
- struct usbf_pipe pipe;
-// LIST_ENTRY(pxaudc_pipe) list;
-};
-
-void pxaudc_enable(struct pxaudc_softc *);
-void pxaudc_disable(struct pxaudc_softc *);
-void pxaudc_read_ep0(struct pxaudc_softc *, struct usbf_xfer *);
-void pxaudc_read_epN(struct pxaudc_softc *sc, int ep);
-void pxaudc_write_ep0(struct pxaudc_softc *, struct usbf_xfer *);
-void pxaudc_write(struct pxaudc_softc *, struct usbf_xfer *);
-void pxaudc_write_epN(struct pxaudc_softc *sc, int ep);
-
-int pxaudc_connect_intr(void *);
-int pxaudc_intr(void *);
-void pxaudc_intr1(struct pxaudc_softc *);
-void pxaudc_ep0_intr(struct pxaudc_softc *);
-void pxaudc_epN_intr(struct pxaudc_softc *sc, int ep, int isr);
-
-usbf_status pxaudc_open(struct usbf_pipe *);
-void pxaudc_softintr(void *);
-usbf_status pxaudc_allocm(struct usbf_bus *, struct usb_dma *, u_int32_t);
-void pxaudc_freem(struct usbf_bus *, struct usb_dma *);
-struct usbf_xfer *pxaudc_allocx(struct usbf_bus *);
-void pxaudc_freex(struct usbf_bus *, struct usbf_xfer *);
-
-usbf_status pxaudc_ctrl_transfer(struct usbf_xfer *);
-usbf_status pxaudc_ctrl_start(struct usbf_xfer *);
-void pxaudc_ctrl_abort(struct usbf_xfer *);
-void pxaudc_ctrl_done(struct usbf_xfer *);
-void pxaudc_ctrl_close(struct usbf_pipe *);
-
-usbf_status pxaudc_bulk_transfer(struct usbf_xfer *);
-usbf_status pxaudc_bulk_start(struct usbf_xfer *);
-void pxaudc_bulk_abort(struct usbf_xfer *);
-void pxaudc_bulk_done(struct usbf_xfer *);
-void pxaudc_bulk_close(struct usbf_pipe *);
-
-struct cfdriver pxaudc_cd = {
- NULL, "pxaudc", DV_DULL
-};
-
-#if NUSBF > 0
-
-struct usbf_bus_methods pxaudc_bus_methods = {
- pxaudc_open,
- pxaudc_softintr,
- pxaudc_allocm,
- pxaudc_freem,
- pxaudc_allocx,
- pxaudc_freex
-};
-
-struct usbf_pipe_methods pxaudc_ctrl_methods = {
- pxaudc_ctrl_transfer,
- pxaudc_ctrl_start,
- pxaudc_ctrl_abort,
- pxaudc_ctrl_done,
- pxaudc_ctrl_close
-};
-
-struct usbf_pipe_methods pxaudc_bulk_methods = {
- pxaudc_bulk_transfer,
- pxaudc_bulk_start,
- pxaudc_bulk_abort,
- pxaudc_bulk_done,
- pxaudc_bulk_close
-};
-
-#endif /* NUSBF > 0 */
-
-#define DEVNAME(sc) ((sc)->sc_bus.bdev.dv_xname)
-
-#define CSR_READ_4(sc, reg) \
- bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg))
-#define CSR_WRITE_4(sc, reg, val) \
- bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
-#define CSR_WRITE_1(sc, reg, val) \
- bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
-#define CSR_SET_4(sc, reg, val) \
- CSR_WRITE_4((sc), (reg), CSR_READ_4((sc), (reg)) | (val))
-#define CSR_CLR_4(sc, reg, val) \
- CSR_WRITE_4((sc), (reg), CSR_READ_4((sc), (reg)) & ~(val))
-
-#ifndef PXAUDC_DEBUG
-#define DPRINTF(l, x) do {} while (0)
-#else
-int pxaudcdebug = 0;
-#define DPRINTF(l, x) if ((l) <= pxaudcdebug) printf x; else {}
-#endif
-
-int
-pxaudc_match(void)
-{
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) != CPU_ID_PXA27X)
- return (0);
-
- return (1);
-}
-
-void
-pxaudc_attach(struct pxaudc_softc *sc, void *aux)
-{
- struct pxaip_attach_args *pxa = aux;
-#if NUSBF > 0
- int i;
-#endif
-
- sc->sc_iot = pxa->pxa_iot;
- if (bus_space_map(sc->sc_iot, PXA2X0_USBDC_BASE, PXA2X0_USBDC_SIZE, 0,
- &sc->sc_ioh)) {
- printf(": cannot map mem space\n");
- return;
- }
- sc->sc_size = PXA2X0_USBDC_SIZE;
-
- printf(": USB Device Controller\n");
-
- bus_space_barrier(sc->sc_iot, sc->sc_ioh, 0, sc->sc_size,
- BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
-
- /* Set up GPIO pins and disable the controller. */
- pxaudc_disable(sc);
-
-#if NUSBF > 0
- /* Establish USB device interrupt. */
- sc->sc_ih = pxa2x0_intr_establish(PXA2X0_INT_USB, IPL_USB,
- pxaudc_intr, sc, DEVNAME(sc));
- if (sc->sc_ih == NULL) {
- printf(": unable to establish interrupt\n");
- bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_size);
- sc->sc_size = 0;
- return;
- }
-
- /* Establish device connect interrupt. */
-#if 0
- sc->sc_conn_ih = pxa2x0_gpio_intr_establish(PXA_USB_DEVICE_PIN, /* XXX */
- IST_EDGE_BOTH, IPL_USB, pxaudc_connect_intr, sc, "usbc");
-#endif
- sc->sc_conn_ih = pxa2x0_gpio_intr_establish(sc->sc_gpio_detect,
- IST_EDGE_BOTH, IPL_USB, pxaudc_connect_intr, sc, "usbc");
- if (sc->sc_conn_ih == NULL) {
- printf(": unable to establish connect interrupt\n");
- pxa2x0_intr_disestablish(sc->sc_ih);
- bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_size);
- sc->sc_ioh = 0;
- sc->sc_size = 0;
- return;
- }
-
- /* Set up the bus struct. */
- sc->sc_bus.methods = &pxaudc_bus_methods;
- sc->sc_bus.pipe_size = sizeof(struct pxaudc_pipe);
- sc->sc_bus.ep0_maxp = PXAUDC_EP0MAXP;
- sc->sc_bus.usbrev = USBREV_1_1;
- sc->sc_bus.dmatag = pxa->pxa_dmat;
- sc->sc_npipe = 0; /* ep0 is always there. */
-
- sc->sc_ep_map[0] = 0;
- /* 16 == max logical endpoints */
- for (i = 1; i < 16; i++) {
- sc->sc_ep_map[i] = -1;
- }
-
- /* Attach logical device and function. */
- (void)config_found((struct device *)sc, &sc->sc_bus, NULL);
-
- /* Enable the controller unless we're now acting as a host. */
- if (!sc->sc_is_host())
- pxaudc_enable(sc);
-#endif
-}
-
-int
-pxaudc_detach(struct pxaudc_softc *sc, int flags)
-{
- if (sc->sc_conn_ih != NULL)
- pxa2x0_gpio_intr_disestablish(sc->sc_conn_ih);
-
- if (sc->sc_ih != NULL)
- pxa2x0_intr_disestablish(sc->sc_ih);
-
- if (sc->sc_size) {
- bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_size);
- sc->sc_size = 0;
- }
-
- return (0);
-}
-
-int
-pxaudc_activate(struct pxaudc_softc *self, int act)
-{
- struct pxaudc_softc *sc = (struct pxaudc_softc *)self;
-
- switch (act) {
- case DVACT_SUSPEND:
- pxaudc_disable(sc);
- break;
- case DVACT_RESUME:
- pxaudc_enable(sc);
- break;
- }
- return 0;
-}
-
-/*
- * Register manipulation
- */
-
-#if 0
-static void
-pxaudc_dump_regs(struct pxaudc_softc *sc)
-{
- printf("UDCCR\t%b\n", CSR_READ_4(sc, USBDC_UDCCR),
- USBDC_UDCCR_BITS);
- printf("UDCICR0\t%b\n", CSR_READ_4(sc, USBDC_UDCICR0),
- USBDC_UDCISR0_BITS);
- printf("UDCICR1\t%b\n", CSR_READ_4(sc, USBDC_UDCICR1),
- USBDC_UDCISR1_BITS);
- printf("OTGICR\t%b\n", CSR_READ_4(sc, USBDC_UDCOTGICR),
- USBDC_UDCOTGISR_BITS);
-}
-#endif
-
-void
-pxaudc_enable(struct pxaudc_softc *sc)
-{
- int i;
-
- DPRINTF(10,("pxaudc_enable\n"));
-
- /* Start the clocks. */
- pxa2x0_clkman_config(CKEN_USBDC, 1);
-
-#if 0
- /* Configure Port 2 for USB device. */
- CSR_WRITE_4(sc, USBDC_UP2OCR, USBDC_UP2OCR_DMPUE |
- USBDC_UP2OCR_DPPUE | USBDC_UP2OCR_HXOE);
-#else
- /* Configure Port 2 for USB device. */
- CSR_WRITE_4(sc, USBDC_UP2OCR, USBDC_UP2OCR_DPPUE | USBDC_UP2OCR_HXOE);
-#endif
-
- CSR_SET_4(sc, USBDC_UDCCR, 0);
- sc->sc_icr0 = 0;
- sc->sc_icr1 = 0;
-
- for (i = 1; i < PXAUDC_NEP; i++)
- CSR_WRITE_4(sc, USBDC_UDCECR(i), 0); /* disable endpoints */
-
- for (i = 1; i < sc->sc_npipe; i++) {
- if (sc->sc_pipe[i] != NULL) {
- struct usbf_endpoint *ep =
- sc->sc_pipe[i]->pipe.endpoint;
- u_int32_t cr;
- int dir = usbf_endpoint_dir(ep);
- usb_endpoint_descriptor_t *ed = ep->edesc;
-
- if (i < 16)
- sc->sc_icr0 |= USBDC_UDCICR0_IE(i);
- else
- sc->sc_icr1 |= USBDC_UDCICR1_IE(i-16);
-
- cr = USBDC_UDCECR_EE | USBDC_UDCECR_DE;
- cr |= USBDC_UDCECR_ENs(
- UE_GET_ADDR(ed->bEndpointAddress));
- cr |= USBDC_UDCECR_MPSs(UGETW(ed->wMaxPacketSize));
- cr |= USBDC_UDCECR_ETs(ed->bmAttributes & UE_XFERTYPE);
- if (dir == UE_DIR_IN)
- cr |= USBDC_UDCECR_ED;
-
- /* XXX - until pipe has cn/in/ain */
- cr |= USBDC_UDCECR_AISNs(0) | USBDC_UDCECR_INs(0) |
- USBDC_UDCECR_CNs(1);
-
- CSR_WRITE_4(sc, USBDC_UDCECR(i), cr);
-
- /* clear old status */
- CSR_WRITE_4(sc, USBDC_UDCCSR(1),
- USBDC_UDCCSR_PC | USBDC_UDCCSR_TRN |
- USBDC_UDCCSR_SST | USBDC_UDCCSR_FEF);
- }
- }
-
- CSR_WRITE_4(sc, USBDC_UDCISR0, 0xffffffff); /* clear all */
- CSR_WRITE_4(sc, USBDC_UDCISR1, 0xffffffff); /* clear all */
- CSR_SET_4(sc, USBDC_UDCCSR0, USBDC_UDCCSR0_ACM);
-
-
- /* Enable interrupts for configured endpoints. */
- CSR_WRITE_4(sc, USBDC_UDCICR0, USBDC_UDCICR0_IE(0) |
- sc->sc_icr0);
-
- CSR_WRITE_4(sc, USBDC_UDCICR1, USBDC_UDCICR1_IERS |
- USBDC_UDCICR1_IESU | USBDC_UDCICR1_IERU |
- USBDC_UDCICR1_IECC | sc->sc_icr1);
-
- /* Enable the controller. */
- CSR_CLR_4(sc, USBDC_UDCCR, USBDC_UDCCR_EMCE);
- CSR_SET_4(sc, USBDC_UDCCR, USBDC_UDCCR_UDE);
-
- /* Enable USB client on port 2. */
- pxa2x0_gpio_clear_bit(37); /* USB_P2_8 */
-}
-
-void
-pxaudc_disable(struct pxaudc_softc *sc)
-{
- DPRINTF(10,("pxaudc_disable\n"));
-
- /* Disable the controller. */
- CSR_CLR_4(sc, USBDC_UDCCR, USBDC_UDCCR_UDE);
-
- /* Disable all interrupts. */
- CSR_WRITE_4(sc, USBDC_UDCICR0, 0);
- CSR_WRITE_4(sc, USBDC_UDCICR1, 0);
- CSR_WRITE_4(sc, USBDC_UDCOTGICR, 0);
-
- /* Set Port 2 output to "Non-OTG Host with Differential Port". */
- CSR_WRITE_4(sc, USBDC_UP2OCR, USBDC_UP2OCR_HXS | USBDC_UP2OCR_HXOE);
-
- /* Set "Host Port 2 Transceiver D­ Pull Down Enable". */
- CSR_SET_4(sc, USBDC_UP2OCR, USBDC_UP2OCR_DMPDE);
-
- /* Stop the clocks. */
- pxa2x0_clkman_config(CKEN_USBDC, 0);
-
- /* Enable USB host on port 2. */
- pxa2x0_gpio_set_bit(37); /* USB_P2_8 */
-}
-
-#if NUSBF > 0
-
-/*
- * Endpoint FIFO handling
- */
-
-void
-pxaudc_read_ep0(struct pxaudc_softc *sc, struct usbf_xfer *xfer)
-{
- size_t len;
- u_int8_t *p;
-
- xfer->actlen = CSR_READ_4(sc, USBDC_UDCBCR(0));
- len = MIN(xfer->actlen, xfer->length);
- p = xfer->buffer;
-
- while (CSR_READ_4(sc, USBDC_UDCCSR0) & USBDC_UDCCSR0_RNE) {
- u_int32_t v = CSR_READ_4(sc, USBDC_UDCDR(0));
-
- if (len > 0) {
- if (((unsigned)p & 0x3) == 0)
- *(u_int32_t *)p = v;
- else {
- *(p+0) = v & 0xff;
- *(p+1) = (v >> 8) & 0xff;
- *(p+2) = (v >> 16) & 0xff;
- *(p+3) = (v >> 24) & 0xff;
- }
- p += 4;
- len -= 4;
- }
- }
-
- CSR_WRITE_4(sc, USBDC_UDCCSR0, USBDC_UDCCSR0_SA | USBDC_UDCCSR0_OPC);
-
- xfer->status = USBF_NORMAL_COMPLETION;
- usbf_transfer_complete(xfer);
-}
-
-void
-pxaudc_read_epN(struct pxaudc_softc *sc, int ep)
-{
- size_t len, tlen;
- u_int8_t *p;
- struct pxaudc_pipe *ppipe;
- struct usbf_pipe *pipe = NULL;
- struct usbf_xfer *xfer = NULL;
- int count;
- u_int32_t csr;
-
- ppipe = sc->sc_pipe[ep];
-
- if (ppipe == NULL) {
- return;
- }
- pipe = &ppipe->pipe;
-again:
- xfer = SIMPLEQ_FIRST(&pipe->queue);
-
- if (xfer == NULL) {
- printf("pxaudc_read_epN: ep %d, no xfer\n", ep);
- return;
- }
-
- count = CSR_READ_4(sc, USBDC_UDCBCR(ep));
- tlen = len = MIN(count, xfer->length - xfer->actlen);
- p = xfer->buffer + xfer->actlen;
- csr = CSR_READ_4(sc, USBDC_UDCCSR(ep));
-
- if ((csr & USBDC_UDCCSR_PC) && count == 0)
- {
-#ifdef DEBUG_RX
- printf("trans1 complete\n");
-#endif
- xfer->status = USBF_NORMAL_COMPLETION;
- usbf_transfer_complete(xfer);
- CSR_SET_4(sc, USBDC_UDCCSR(ep), USBDC_UDCCSR_PC);
- return;
- }
-
-#ifdef DEBUG_RX
- printf("reading data from endpoint %x, len %x csr %x",
- ep, count, csr);
-#endif
-
- while (CSR_READ_4(sc, USBDC_UDCCSR(ep)) & USBDC_UDCCSR_BNE) {
- u_int32_t v = CSR_READ_4(sc, USBDC_UDCDR(ep));
-
- /* double buffering? */
- if (len > 0) {
- if (((unsigned)p & 0x3) == 0)
- *(u_int32_t *)p = v;
- else {
- *(p+0) = v & 0xff;
- *(p+1) = (v >> 8) & 0xff;
- *(p+2) = (v >> 16) & 0xff;
- *(p+3) = (v >> 24) & 0xff;
- }
- p += 4;
- len -= 4;
- xfer->actlen += 4;
- }
- count -= 4;
- }
- CSR_SET_4(sc, USBDC_UDCCSR(ep), USBDC_UDCCSR_PC);
-
-
- if (xfer->length == xfer->actlen || (tlen == 0 && xfer->actlen != 0) ||
- csr & USBDC_UDCCSR_SP) {
-#ifdef DEBUG_RX
- printf("trans2 complete\n");
-#endif
- xfer->status = USBF_NORMAL_COMPLETION;
- usbf_transfer_complete(xfer);
- }
- csr = CSR_READ_4(sc, USBDC_UDCCSR(ep));
-#ifdef DEBUG_RX
- printf("csr now %x len %x\n",
- csr, CSR_READ_4(sc, USBDC_UDCBCR(ep)));
-#endif
- if (csr & USBDC_UDCCSR_PC)
- goto again;
-}
-
-void
-pxaudc_write_ep0(struct pxaudc_softc *sc, struct usbf_xfer *xfer)
-{
- struct pxaudc_xfer *lxfer = (struct pxaudc_xfer *)xfer;
- u_int32_t len;
- u_int8_t *p;
-
- if (lxfer->frmlen > 0) {
- xfer->actlen += lxfer->frmlen;
- lxfer->frmlen = 0;
- }
-
- DPRINTF(11,("%s: ep0 ctrl-in, xfer=%p, len=%u, actlen=%u\n",
- DEVNAME(sc), xfer, xfer->length, xfer->actlen));
-
- if (xfer->actlen >= xfer->length) {
- sc->sc_ep0state = EP0_SETUP;
- usbf_transfer_complete(xfer);
- return;
- }
-
- sc->sc_ep0state = EP0_IN;
-
- p = (u_char *)xfer->buffer + xfer->actlen;
- len = xfer->length - xfer->actlen;
- len = MIN(len, PXAUDC_EP0MAXP);
- lxfer->frmlen = len;
-
- while (len >= 4) {
- u_int32_t v;
-
- if (((unsigned)p & 0x3) == 0)
- v = *(u_int32_t *)p;
- else {
- v = *(p+0);
- v |= *(p+1) << 8;
- v |= *(p+2) << 16;
- v |= *(p+3) << 24;
- }
-
- CSR_WRITE_4(sc, USBDC_UDCDR(0), v);
- len -= 4;
- p += 4;
- }
-
- while (len > 0) {
- CSR_WRITE_1(sc, USBDC_UDCDR(0), *p);
- len--;
- p++;
- }
-
- /* (12.6.7) Set IPR only for short packets. */
- if (lxfer->frmlen < PXAUDC_EP0MAXP)
- CSR_SET_4(sc, USBDC_UDCCSR0, USBDC_UDCCSR0_IPR);
-}
-
-void
-pxaudc_write(struct pxaudc_softc *sc, struct usbf_xfer *xfer)
-{
- u_int8_t *p;
- int ep = sc->sc_ep_map[usbf_endpoint_index(xfer->pipe->endpoint)];
- int tlen = 0;
- int maxp = UGETW(xfer->pipe->endpoint->edesc->wMaxPacketSize);
- u_int32_t csr, csr_o;
-
-#ifdef DEBUG_TX_PKT
- if (xfer->actlen == 0)
- printf("new packet len %x\n", xfer->length);
-#endif
-
-#ifdef DEBUG_TX
- printf("writing data to endpoint %x, xlen %x xact %x\n",
- ep, xfer->length, xfer->actlen);
-#endif
-
-
- if (xfer->actlen == xfer->length) {
- /*
- * If the packet size is wMaxPacketSize byte multiple
- * send a zero packet to indicate termiation.
- */
- if ((xfer->actlen % maxp) == 0 &&
- xfer->status != USBF_NORMAL_COMPLETION &&
- xfer->flags & USBD_FORCE_SHORT_XFER) {
- if (CSR_READ_4(sc, USBDC_UDCCSR(ep))
- & USBDC_UDCCSR_BNF) {
- CSR_SET_4(sc, USBDC_UDCCSR(ep),
- USBDC_UDCCSR_SP);
- /*
- * if we send a zero packet, we are 'done', but
- * dont to usbf_transfer_complete() just yet
- * because the short packet will cause another
- * interrupt.
- */
- xfer->status = USBF_NORMAL_COMPLETION;
- return;
- } else {
- printf("fifo full when trying to set short packet\n");
- }
- }
- xfer->status = USBF_NORMAL_COMPLETION;
-#ifdef DEBUG_TX_PKT
- printf("packet complete %x\n", xfer->actlen);
-#endif
- usbf_transfer_complete(xfer);
- return;
- }
-
- p = xfer->buffer + xfer->actlen;
-
-
-
- csr_o = 0;
- csr = CSR_READ_4(sc, USBDC_UDCCSR(ep));
- if (csr & USBDC_UDCCSR_PC)
- csr_o |= USBDC_UDCCSR_PC;
- if (csr & USBDC_UDCCSR_TRN)
- csr_o |= USBDC_UDCCSR_TRN;
- if (csr & USBDC_UDCCSR_SST)
- csr_o |= USBDC_UDCCSR_SST;
- if (csr_o != 0)
- CSR_WRITE_4(sc, USBDC_UDCCSR(ep), csr_o);
-
-
- while (CSR_READ_4(sc, USBDC_UDCCSR(ep)) & USBDC_UDCCSR_BNF) {
- u_int32_t v;
-
- if (xfer->length - xfer->actlen < 4) {
- while (xfer->actlen < xfer->length) {
- CSR_WRITE_1(sc, USBDC_UDCDR(ep), *p);
- p++;
- xfer->actlen++;
- tlen++;
- }
- break;
- }
- if (((unsigned)p & 0x3) == 0)
- v = *(u_int32_t *)p;
- else {
- v = *(p+0);
- v |= *(p+1) << 8;
- v |= *(p+2) << 16;
- v |= *(p+3) << 24;
- }
- CSR_WRITE_4(sc, USBDC_UDCDR(ep), v);
-
- p += 4;
- xfer->actlen += 4;
-
- tlen += 4;
- }
-#ifdef DEBUG_TX
- printf(" wrote tlen %x %x\n", tlen, xfer->actlen);
- if (xfer->actlen == 0) {
- printf("whoa, write_ep called, but no free space\n");
- }
-#endif
- if (xfer->actlen == xfer->length) {
- if ((xfer->actlen % maxp) != 0) {
- if (xfer->flags & USBD_FORCE_SHORT_XFER) {
- CSR_SET_4(sc, USBDC_UDCCSR(ep), USBDC_UDCCSR_SP);
-#ifdef DEBUG_TX
- printf("setting short packet on %x csr\n", ep,
- CSR_READ_4(sc, USBDC_UDCCSR(ep)));
-#endif
- } else {
- /* fill buffer to maxpacket size??? */
- }
- }
- }
-}
-
-/*
- * Interrupt handling
- */
-
-int
-pxaudc_connect_intr(void *v)
-{
- struct pxaudc_softc *sc = v;
-
- DPRINTF(10,("pxaudc_connect_intr: connect=%d\n",
- pxa2x0_gpio_get_bit(sc->sc_gpio_detect)));
-
- /* XXX only set a flag here */
- if (sc->sc_is_host()) {
-#if 0
- printf("%s:switching to host\n", sc->sc_bus.bdev.dv_xname);
-#endif
- pxaudc_disable(sc);
- } else {
-#if 0
- printf("%s:switching to client\n", sc->sc_bus.bdev.dv_xname);
-#endif
- pxaudc_enable(sc);
- }
-
- /* Claim this interrupt. */
- return 1;
-}
-
-int
-pxaudc_intr(void *v)
-{
- struct pxaudc_softc *sc = v;
- u_int32_t isr0, isr1, otgisr;
-
- isr0 = CSR_READ_4(sc, USBDC_UDCISR0);
- isr1 = CSR_READ_4(sc, USBDC_UDCISR1);
- otgisr = CSR_READ_4(sc, USBDC_UDCOTGISR);
-
- DPRINTF(10,("pxaudc_intr: isr0=%b, isr1=%b, otgisr=%b\n",
- isr0, USBDC_UDCISR0_BITS, isr1, USBDC_UDCISR1_BITS,
- otgisr, USBDC_UDCOTGISR_BITS));
-
- if (isr0 || isr1 || otgisr) {
- sc->sc_isr0 |= isr0;
- sc->sc_isr1 |= isr1;
- sc->sc_otgisr |= otgisr;
-
- //usbf_schedsoftintr(&sc->sc_bus);
- pxaudc_intr1(sc); /* XXX */
- }
-
- CSR_WRITE_4(sc, USBDC_UDCISR0, isr0);
- CSR_WRITE_4(sc, USBDC_UDCISR1, isr1);
- CSR_WRITE_4(sc, USBDC_UDCOTGISR, otgisr);
-
- /* Claim this interrupt. */
- return 1;
-}
-u_int32_t csr1, csr2;
-
-void
-pxaudc_intr1(struct pxaudc_softc *sc)
-{
- u_int32_t isr0, isr1, otgisr;
- int i;
- //int s;
-
- //s = splhardusb();
- isr0 = sc->sc_isr0;
- isr1 = sc->sc_isr1;
- otgisr = sc->sc_otgisr;
- sc->sc_isr0 = 0;
- sc->sc_isr1 = 0;
- sc->sc_otgisr = 0;
- //splx(s);
-
- sc->sc_bus.intr_context++;
-
- if (isr1 & USBDC_UDCISR1_IRCC) {
- u_int32_t ccr;
- CSR_SET_4(sc, USBDC_UDCCR, USBDC_UDCCR_SMAC);
-
- /* wait for reconfig to finish (SMAC auto clears) */
- while (CSR_READ_4(sc, USBDC_UDCCR) & USBDC_UDCCR_SMAC)
- delay(10);
-
- ccr = CSR_READ_4(sc, USBDC_UDCCR);
- sc->sc_cn = USBDC_UDCCR_ACNr(ccr);
- sc->sc_in = USBDC_UDCCR_AINr(ccr);
- sc->sc_isn = USBDC_UDCCR_AAISNr(ccr);
- goto ret;
- }
-#if 0
- printf("pxaudc_intr: isr0=%b, isr1=%b, otgisr=%b\n",
- isr0, USBDC_UDCISR0_BITS, isr1, USBDC_UDCISR1_BITS,
- otgisr, USBDC_UDCOTGISR_BITS);
-#endif
-
- /* Handle USB RESET condition. */
- if (isr1 & USBDC_UDCISR1_IRRS) {
- sc->sc_ep0state = EP0_SETUP;
- usbf_host_reset(&sc->sc_bus);
- /* Discard all other interrupts. */
- goto ret;
- }
-
- /* Service control pipe interrupts. */
- if (isr0 & USBDC_UDCISR0_IR(0))
- pxaudc_ep0_intr(sc);
-
- for (i = 1; i < 24; i++) {
- if (i < 16) {
- if (USBDC_UDCISR0_IRs(isr0,i))
- pxaudc_epN_intr(sc, i,
- USBDC_UDCISR0_IRs(isr0,i));
- } else {
- if (USBDC_UDCISR1_IRs(isr1,i))
- pxaudc_epN_intr(sc, i,
- USBDC_UDCISR1_IRs(isr1,i));
- }
- }
-
- if (isr1 & USBDC_UDCISR1_IRSU) {
- /* suspend ?? */
- }
- if (isr1 & USBDC_UDCISR1_IRRU) {
- /* resume ?? */
- }
-
-ret:
- sc->sc_bus.intr_context--;
-}
-
-void
-pxaudc_epN_intr(struct pxaudc_softc *sc, int ep, int isr)
-{
- struct pxaudc_pipe *ppipe;
- struct usbf_pipe *pipe;
- int dir;
-
- /* should not occur before device is configured */
- if (sc->sc_cn == 0)
- return;
- if (isr & 2)
- printf("ep%d: fifo error\n", ep); /* XXX */
-
- /* faster method of determining direction? */
- ppipe = sc->sc_pipe[ep];
-
- if (ppipe == NULL)
- return;
- pipe = &ppipe->pipe;
- dir = usbf_endpoint_dir(pipe->endpoint);
-
- if (dir == UE_DIR_IN) {
- pxaudc_write_epN(sc, ep);
- } else {
- pxaudc_read_epN(sc, ep);
- }
-
-}
-
-void
-pxaudc_write_epN(struct pxaudc_softc *sc, int ep)
-{
- struct pxaudc_pipe *ppipe;
- struct usbf_pipe *pipe = NULL;
- struct usbf_xfer *xfer = NULL;
-
- ppipe = sc->sc_pipe[ep];
-
- if (ppipe == NULL) {
- return;
- }
- pipe = &ppipe->pipe;
- xfer = SIMPLEQ_FIRST(&pipe->queue);
- if (xfer != NULL)
- pxaudc_write(sc, xfer);
-}
-void
-pxaudc_ep0_intr(struct pxaudc_softc *sc)
-{
- struct pxaudc_pipe *ppipe;
- struct usbf_pipe *pipe = NULL;
- struct usbf_xfer *xfer = NULL;
- u_int32_t csr0;
-
- csr0 = CSR_READ_4(sc, USBDC_UDCCSR0);
- DPRINTF(10,("pxaudc_ep0_intr: csr0=%b\n", csr0, USBDC_UDCCSR0_BITS));
- delay (25);
-
- ppipe = sc->sc_pipe[0];
- if (ppipe != NULL) {
- pipe = &ppipe->pipe;
- xfer = SIMPLEQ_FIRST(&pipe->queue);
- }
-
- if (sc->sc_ep0state == EP0_SETUP && (csr0 & USBDC_UDCCSR0_OPC)) {
- if (pipe == NULL) {
- DPRINTF(10,("pxaudc_ep0_intr: no control pipe\n"));
- return;
- }
-
- if (xfer == NULL) {
- DPRINTF(10,("pxaudc_ep0_intr: no xfer\n"));
- return;
- }
-
- pxaudc_read_ep0(sc, xfer);
- } else if (sc->sc_ep0state == EP0_IN &&
- (csr0 & USBDC_UDCCSR0_IPR) == 0 && xfer) {
- pxaudc_write_ep0(sc, xfer);
- }
-}
-
-/*
- * Bus methods
- */
-
-usbf_status
-pxaudc_open(struct usbf_pipe *pipe)
-{
- struct pxaudc_softc *sc = (struct pxaudc_softc *)pipe->device->bus;
- struct pxaudc_pipe *ppipe = (struct pxaudc_pipe *)pipe;
- int ep_idx;
- int s;
-
- ep_idx = usbf_endpoint_index(pipe->endpoint);
- if (ep_idx >= PXAUDC_NEP)
- return USBF_BAD_ADDRESS;
-
- DPRINTF(10,("pxaudc_open\n"));
- s = splhardusb();
-
- switch (usbf_endpoint_type(pipe->endpoint)) {
- case UE_CONTROL:
- pipe->methods = &pxaudc_ctrl_methods;
- break;
-
- case UE_BULK:
- pipe->methods = &pxaudc_bulk_methods;
- break;
-
- case UE_ISOCHRONOUS:
- case UE_INTERRUPT:
- default:
- /* XXX */
- splx(s);
- return USBF_BAD_ADDRESS;
- }
-
- if (ep_idx != 0 && sc->sc_ep_map[ep_idx] != -1) {
- printf("endpoint %d already used by %c",
- ep_idx, '@'+ sc->sc_ep_map[0]);
- splx(s);
- return USBF_BAD_ADDRESS;
- }
- sc->sc_ep_map[ep_idx] = sc->sc_npipe;
-
- sc->sc_pipe[sc->sc_npipe] = ppipe;
- sc->sc_npipe++;
-
- splx(s);
- return USBF_NORMAL_COMPLETION;
-}
-
-void
-pxaudc_softintr(void *v)
-{
- struct pxaudc_softc *sc = v;
-
- pxaudc_intr1(sc);
-}
-
-usbf_status
-pxaudc_allocm(struct usbf_bus *bus, struct usb_dma *dmap, u_int32_t size)
-{
- return usbf_allocmem(bus, size, 0, dmap);
-}
-
-void
-pxaudc_freem(struct usbf_bus *bus, struct usb_dma *dmap)
-{
- usbf_freemem(bus, dmap);
-}
-
-struct usbf_xfer *
-pxaudc_allocx(struct usbf_bus *bus)
-{
- struct pxaudc_softc *sc = (struct pxaudc_softc *)bus;
- struct usbf_xfer *xfer;
-
- xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
- if (xfer != NULL)
- SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, next);
- else
- xfer = malloc(sizeof(struct pxaudc_xfer), M_USB, M_NOWAIT);
- if (xfer != NULL)
- bzero(xfer, sizeof(struct pxaudc_xfer));
- return xfer;
-}
-
-void
-pxaudc_freex(struct usbf_bus *bus, struct usbf_xfer *xfer)
-{
- struct pxaudc_softc *sc = (struct pxaudc_softc *)bus;
-
- SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
-}
-
-/*
- * Control pipe methods
- */
-
-usbf_status
-pxaudc_ctrl_transfer(struct usbf_xfer *xfer)
-{
- usbf_status err;
-
- /* Insert last in queue. */
- err = usbf_insert_transfer(xfer);
- if (err)
- return err;
-
- /*
- * Pipe isn't running (otherwise err would be USBF_IN_PROGRESS),
- * so start first.
- */
- return pxaudc_ctrl_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
-}
-
-usbf_status
-pxaudc_ctrl_start(struct usbf_xfer *xfer)
-{
- struct usbf_pipe *pipe = xfer->pipe;
- struct pxaudc_softc *sc = (struct pxaudc_softc *)pipe->device->bus;
- int iswrite = !(xfer->rqflags & URQ_REQUEST);
- int s;
-
- s = splusb();
- xfer->status = USBF_IN_PROGRESS;
- if (iswrite)
- pxaudc_write_ep0(sc, xfer);
- else {
- /* XXX boring message, this case is normally reached if
- * XXX the xfer for a device request is being queued. */
- DPRINTF(10,("%s: ep[%x] ctrl-out, xfer=%p, len=%u, "
- "actlen=%u\n", DEVNAME(sc),
- usbf_endpoint_address(xfer->pipe->endpoint),
- xfer, xfer->length,
- xfer->actlen));
- }
- splx(s);
- return USBF_IN_PROGRESS;
-}
-
-/* (also used by bulk pipes) */
-void
-pxaudc_ctrl_abort(struct usbf_xfer *xfer)
-{
- int s;
-#ifdef PXAUDC_DEBUG
- struct usbf_pipe *pipe = xfer->pipe;
- struct pxaudc_softc *sc = (struct pxaudc_softc *)pipe->device->bus;
- int index = usbf_endpoint_index(pipe->endpoint);
- int dir = usbf_endpoint_dir(pipe->endpoint);
- int type = usbf_endpoint_type(pipe->endpoint);
-#endif
-
- DPRINTF(10,("%s: ep%d %s-%s abort, xfer=%p\n", DEVNAME(sc), index,
- type == UE_CONTROL ? "ctrl" : "bulk", dir == UE_DIR_IN ?
- "in" : "out", xfer));
-
- /*
- * Step 1: Make soft interrupt routine and hardware ignore the xfer.
- */
- s = splusb();
- xfer->status = USBF_CANCELLED;
- timeout_del(&xfer->timeout_handle);
- splx(s);
-
- /*
- * Step 2: Make sure hardware has finished any possible use of the
- * xfer and the soft interrupt routine has run.
- */
- s = splusb();
- /* XXX this does not seem right, what if there
- * XXX are two xfers in the FIFO and we only want to
- * XXX ignore one? */
-#ifdef notyet
- pxaudc_flush(sc, usbf_endpoint_address(pipe->endpoint));
-#endif
- /* XXX we're not doing DMA and the soft interrupt routine does not
- XXX need to clean up anything. */
- splx(s);
-
- /*
- * Step 3: Execute callback.
- */
- s = splusb();
- usbf_transfer_complete(xfer);
- splx(s);
-}
-
-void
-pxaudc_ctrl_done(struct usbf_xfer *xfer)
-{
-}
-
-void
-pxaudc_ctrl_close(struct usbf_pipe *pipe)
-{
- /* XXX */
-}
-
-/*
- * Bulk pipe methods
- */
-
-usbf_status
-pxaudc_bulk_transfer(struct usbf_xfer *xfer)
-{
- usbf_status err;
-
- /* Insert last in queue. */
- err = usbf_insert_transfer(xfer);
- if (err)
- return err;
-
- /*
- * Pipe isn't running (otherwise err would be USBF_IN_PROGRESS),
- * so start first.
- */
- return pxaudc_bulk_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
-}
-
-usbf_status
-pxaudc_bulk_start(struct usbf_xfer *xfer)
-{
- struct usbf_pipe *pipe = xfer->pipe;
- struct pxaudc_softc *sc = (struct pxaudc_softc *)pipe->device->bus;
- int iswrite = (usbf_endpoint_dir(pipe->endpoint) == UE_DIR_IN);
- int s;
-
- DPRINTF(0,("%s: ep%d bulk-%s start, xfer=%p, len=%u\n", DEVNAME(sc),
- usbf_endpoint_index(pipe->endpoint), iswrite ? "in" : "out",
- xfer, xfer->length));
-
- s = splusb();
- xfer->status = USBF_IN_PROGRESS;
- if (iswrite)
- pxaudc_write(sc, xfer);
- else {
- /* enable interrupt */
- }
- splx(s);
- return USBF_IN_PROGRESS;
-}
-
-void
-pxaudc_bulk_abort(struct usbf_xfer *xfer)
-{
- pxaudc_ctrl_abort(xfer);
-}
-
-void
-pxaudc_bulk_done(struct usbf_xfer *xfer)
-{
-#if 0
- int ep = usbf_endpoint_address(xfer->pipe->endpoint);
- struct usbf_pipe *pipe = xfer->pipe;
- struct pxaudc_softc *sc = (struct pxaudc_softc *)pipe->device->bus;
-
-#endif
-}
-
-void
-pxaudc_bulk_close(struct usbf_pipe *pipe)
-{
- /* XXX */
-}
-
-#endif /* NUSBF > 0 */
diff --git a/sys/arch/arm/xscale/pxa27x_udc.h b/sys/arch/arm/xscale/pxa27x_udc.h
deleted file mode 100644
index f3d97217a02..00000000000
--- a/sys/arch/arm/xscale/pxa27x_udc.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: pxa27x_udc.h,v 1.4 2013/10/24 22:40:10 aalm Exp $ */
-/*
- * Copyright (c) 2009 Marek Vasut <marex@openbsd.org>
- *
- * Moved from pxa27x_udc.c:
- *
- * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org>
- * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
- * Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <arm/xscale/pxa27x_udcreg.h>
-
-#define PXAUDC_EP0MAXP 16 /* XXX */
-#define PXAUDC_NEP 24 /* total number of endpoints */
-
-struct pxaudc_softc {
- struct usbf_bus sc_bus;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_size_t sc_size;
- void *sc_ih;
- void *sc_conn_ih;
- SIMPLEQ_HEAD(,usbf_xfer) sc_free_xfers; /* recycled xfers */
- u_int32_t sc_icr0; /* enabled EP interrupts */
- u_int32_t sc_icr1; /* enabled EP interrupts */
- enum {
- EP0_SETUP,
- EP0_IN
- } sc_ep0state;
- u_int32_t sc_isr0; /* XXX deferred interrupts */
- u_int32_t sc_isr1; /* XXX deferred interrupts */
- u_int32_t sc_otgisr; /* XXX deferred interrupts */
- struct pxaudc_pipe *sc_pipe[PXAUDC_NEP];
- int sc_npipe;
-
- int sc_cn;
- int sc_in;
- int sc_isn;
- int8_t sc_ep_map[16];
-
- struct device *sc_dev;
-
- int sc_gpio_detect;
- int sc_gpio_detect_inv;
-
- int sc_gpio_pullup;
- int sc_gpio_pullup_inv;
-
- int (*sc_is_host)(void);
-};
-
-int pxaudc_match(void);
-void pxaudc_attach(struct pxaudc_softc *, void *);
-int pxaudc_detach(struct pxaudc_softc *, int);
-int pxaudc_activate(struct pxaudc_softc *, int);
diff --git a/sys/arch/arm/xscale/pxa27x_udcreg.h b/sys/arch/arm/xscale/pxa27x_udcreg.h
deleted file mode 100644
index 1d95141ecf0..00000000000
--- a/sys/arch/arm/xscale/pxa27x_udcreg.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* $OpenBSD: pxa27x_udcreg.h,v 1.5 2007/02/25 01:40:12 drahn Exp $ */
-
-/*
- * Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Register Descriptions for the USB Device Controller
- *
- * Reference:
- * Intel(r) PXA27x Processor Family
- * Developer's Manual
- * (2800002.pdf)
- */
-
-#ifndef _ARM_XSCALE_PXA27X_UDCREG_H_
-#define _ARM_XSCALE_PXA27X_UDCREG_H_
-
-#define USBDC_UDCCR 0x0000 /* UDC Control Register */
-#define USBDC_UDCCR_UDE (1<<0) /* UDC Enable */
-#define USBDC_UDCCR_UDA (1<<1) /* UDC Active */
-#define USBDC_UDCCR_UDR (1<<2) /* UDC Resume */
-#define USBDC_UDCCR_EMCE (1<<3) /* Endpoint Mem Config Error */
-#define USBDC_UDCCR_SMAC (1<<4) /* Switch EndPt Mem to Active Config */
-#define USBDC_UDCCR_AAISN (7<<5) /* Active UDC Alt Iface Setting */
-#define USBDC_UDCCR_AAISNr(x) ((x>>5)&7) /* Active UDC Config */
-#define USBDC_UDCCR_AIN (7<<8) /* Active UDC Iface */
-#define USBDC_UDCCR_AINr(x) ((x>>8)&7) /* Active UDC Config */
-#define USBDC_UDCCR_ACN (7<<11) /* Active UDC Config */
-#define USBDC_UDCCR_ACNr(x) ((x>>11)&7) /* Active UDC Config */
-#define USBDC_UDCCR_DWRE (1<<16) /* Device Remote Wake-Up Feature */
-#define USBDC_UDCCR_BHNP (1<<28) /* B-Device Host Neg Proto Enable */
-#define USBDC_UDCCR_AHNP (1<<29) /* A-Device Host NEg Proto Support */
-#define USBDC_UDCCR_AALTHNP (1<<30) /* A-Dev Alt Host Neg Proto Port Sup */
-#define USBDC_UDCCR_OEN (1<<31) /* On-The-Go Enable */
-#define USBDC_UDCICR0 0x0004 /* UDC Interrupt Control Register 0 */
-#define USBDC_UDCICR0_IE(n) (3<<((n)*2)) /* Interrupt Enables */
-#define USBDC_UDCICR1 0x0008 /* UDC Interrupt Control Register 1 */
-#define USBDC_UDCICR1_IE(n) (3<<((n)*2)) /* Interrupt Enables */
-#define USBDC_UDCICR1_IERS (1<<27) /* Interrupt Enable Reset */
-#define USBDC_UDCICR1_IESU (1<<28) /* Interrupt Enable Suspend */
-#define USBDC_UDCICR1_IERU (1<<29) /* Interrupt Enable Resume */
-#define USBDC_UDCICR1_IESOF (1<<30) /* Interrupt Enable Start of Frame */
-#define USBDC_UDCICR1_IECC (1<<31) /* Interrupt Enable Config Change */
-#define USBDC_UDCISR0 0x000c /* UDC Interrupt Status Register 0 */
-#define USBDC_UDCISR0_IR(n) (3<<((n)*2)) /* Interrupt Requests */
-#define USBDC_UDCISR0_IRs(v,n) (((v)>>((n)*2))&3) /* Interrupt Requests */
-#define USBDC_UDCISR1 0x0010 /* UDC Interrupt Status Register 1 */
-#define USBDC_UDCISR1_IR(n) (3<<((n)*2)) /* Interrupt Requests */
-#define USBDC_UDCISR1_IRs(v,n) (((v)>>((n)*2))&3) /* Interrupt Requests */
-#define USBDC_UDCISR1_IRRS (1<<27) /* Interrupt Enable Reset */
-#define USBDC_UDCISR1_IRSU (1<<28) /* Interrupt Enable Suspend */
-#define USBDC_UDCISR1_IRRU (1<<29) /* Interrupt Enable Resume */
-#define USBDC_UDCISR1_IRSOF (1<<30) /* Interrupt Enable Start of Frame */
-#define USBDC_UDCISR1_IRCC (1<<31) /* Interrupt Enable Config Change */
-#define USBDC_UDCFNR 0x0014 /* UDC Frame Number Register */
-#define USBDC_UDCFNR_FN (1023<<0) /* Frame Number */
-#define USBDC_UDCOTGICR 0x0018 /* UDC OTG Interrupt Control Register */
-#define USBDC_UDCOTGICR_IEIDF (1<<0) /* OTG ID Change Fall Intr En */
-#define USBDC_UDCOTGICR_IEIDR (1<<1) /* OTG ID Change Ris Intr En */
-#define USBDC_UDCOTGICR_IESDF (1<<2) /* OTG A-Dev SRP Detect Fall Intr En */
-#define USBDC_UDCOTGICR_IESDR (1<<3) /* OTG A-Dev SRP Detect Ris Intr En */
-#define USBDC_UDCOTGICR_IESVF (1<<4) /* OTG Session Valid Fall Intr En */
-#define USBDC_UDCOTGICR_IESVR (1<<5) /* OTG Session Valid Ris Intr En */
-#define USBDC_UDCOTGICR_IEVV44F (1<<6) /* OTG Vbus Valid 4.4V Fall Intr En */
-#define USBDC_UDCOTGICR_IEVV44R (1<<7) /* OTG Vbus Valid 4.4V Ris Intr En */
-#define USBDC_UDCOTGICR_IEVV40F (1<<8) /* OTG Vbus Valid 4.0V Fall Intr En */
-#define USBDC_UDCOTGICR_IEVV40R (1<<9) /* OTG Vbus Valid 4.0V Ris Intr En */
-#define USBDC_UDCOTGICR_IEXF (1<<16) /* Extern Transceiver Intr Fall En */
-#define USBDC_UDCOTGICR_IEXR (1<<17) /* Extern Transceiver Intr Ris En */
-#define USBDC_UDCOTGICR_IESF (1<<24) /* OTG SET_FEATURE Command Recvd */
-#define USBDC_UDCOTGISR 0x001c /* UDC OTG Interrupt Status Register */
-#define USBDC_UDCOTGISR_IRIDF (1<<0) /* OTG ID Change Fall Intr Req */
-#define USBDC_UDCOTGISR_IRIDR (1<<1) /* OTG ID Change Ris Intr Req */
-#define USBDC_UDCOTGISR_IRSDF (1<<2) /* OTG A-Dev SRP Detect Fall Intr Req */
-#define USBDC_UDCOTGISR_IRSDR (1<<3) /* OTG A-Dev SRP Detect Ris Intr Req */
-#define USBDC_UDCOTGISR_IRSVF (1<<4) /* OTG Session Valid Fall Intr Req */
-#define USBDC_UDCOTGISR_IRSVR (1<<5) /* OTG Session Valid Ris Intr Req */
-#define USBDC_UDCOTGISR_IRVV44F (1<<6) /* OTG Vbus Valid 4.4V Fall Intr Req */
-#define USBDC_UDCOTGISR_IRVV44R (1<<7) /* OTG Vbus Valid 4.4V Ris Intr Req */
-#define USBDC_UDCOTGISR_IRVV40F (1<<8) /* OTG Vbus Valid 4.0V Fall Intr Req */
-#define USBDC_UDCOTGISR_IRVV40R (1<<9) /* OTG Vbus Valid 4.0V Ris Intr Req */
-#define USBDC_UDCOTGISR_IRXF (1<<16) /* Extern Transceiver Intr Fall Req */
-#define USBDC_UDCOTGISR_IRXR (1<<17) /* Extern Transceiver Intr Ris Req */
-#define USBDC_UDCOTGISR_IRSF (1<<24) /* OTG SET_FEATURE Command Recvd */
-#define USBDC_UP2OCR 0x0020 /* USB Port 2 Output Control Register */
-#define USBDC_UP2OCR_CPVEN (1<<0) /* Charge Pump Vbus Enable */
-#define USBDC_UP2OCR_CPVPE (1<<1) /* Charge Pump Vbus Pulse Enable */
-#define USBDC_UP2OCR_DPPDE (1<<2) /* Host Transc D+ Pull Down En */
-#define USBDC_UP2OCR_DMPDE (1<<3) /* Host Transc D- Pull Down En */
-#define USBDC_UP2OCR_DPPUE (1<<4) /* Host Transc D+ Pull Up En */
-#define USBDC_UP2OCR_DMPUE (1<<5) /* Host Transc D- Pull Up En */
-#define USBDC_UP2OCR_DPPUBE (1<<6) /* Host Transc D+ Pull Up Bypass En */
-#define USBDC_UP2OCR_DMPUBE (1<<7) /* Host Transc D- Pull Up Bypass En */
-#define USBDC_UP2OCR_EXSP (1<<8) /* External Transc Speed Control */
-#define USBDC_UP2OCR_EXSUS (1<<9) /* External Transc Suspend Control */
-#define USBDC_UP2OCR_IDON (1<<10) /* OTG ID Read Enable */
-#define USBDC_UP2OCR_HXS (1<<16) /* Host Transc Output Select */
-#define USBDC_UP2OCR_HXOE (1<<17) /* Host Transc Output Enable */
-#define USBDC_UP2OCR_SEOS (7<<24) /* Single-Ended Output Select */
-#define USBDC_UP3OCR 0x0024 /* USB Port 3 Output Control Register */
-#define USBDC_UP3OCR_CFG (3<<0) /* Host Port Configuration */
-/* 0x0028 to 0x00fc is reserved */
-#define USBDC_UDCCSR0 0x0100 /* UDC Endpoint 0 Control/Status Registers */
-#define USBDC_UDCCSR0_OPC (1<<0) /* OUT Packet Complete */
-#define USBDC_UDCCSR0_IPR (1<<1) /* IN Packet Ready */
-#define USBDC_UDCCSR0_FTF (1<<2) /* Flush Transmit FIFO */
-#define USBDC_UDCCSR0_DME (1<<3) /* DMA Enable */
-#define USBDC_UDCCSR0_SST (1<<4) /* Sent Stall */
-#define USBDC_UDCCSR0_FST (1<<5) /* Force Stall */
-#define USBDC_UDCCSR0_RNE (1<<6) /* Receive FIFO Not Empty */
-#define USBDC_UDCCSR0_SA (1<<7) /* Setup Active */
-#define USBDC_UDCCSR0_AREN (1<<8) /* ACK Response Enable */
-#define USBDC_UDCCSR0_ACM (1<<9) /* ACK Control Mode */
-#define USBDC_UDCCSR(n) (0x0100+4*(n)) /* UDC Control/Status Registers */
-#define USBDC_UDCCSR_FS (1<<0) /* FIFO Needs Service */
-#define USBDC_UDCCSR_PC (1<<1) /* Packet Complete */
-#define USBDC_UDCCSR_TRN (1<<2) /* Tx/Rx NAK */
-#define USBDC_UDCCSR_DME (1<<3) /* DMA Enable */
-#define USBDC_UDCCSR_SST (1<<4) /* Sent STALL */
-#define USBDC_UDCCSR_FST (1<<5) /* Force STALL */
-#define USBDC_UDCCSR_BNE (1<<6) /* OUT: Buffer Not Empty */
-#define USBDC_UDCCSR_BNF (1<<6) /* IN: Buffer Not Full */
-#define USBDC_UDCCSR_SP (1<<7) /* Short Packet Control/Status */
-#define USBDC_UDCCSR_FEF (1<<8) /* Flush Endpoint FIFO */
-#define USBDC_UDCCSR_DPE (1<<9) /* Data Packet Empty (async EP only) */
-/* 0x0160 to 0x01fc is reserved */
-#define USBDC_UDCBCR(n) (0x0200+4*(n)) /* UDC Byte Count Registers */
-#define USBDC_UDCBCR_BC (1023<<0) /* Byte Count */
-/* 0x0260 to 0x02fc is reserved */
-#define USBDC_UDCDR(n) (0x0300+4*(n)) /* UDC Data Registers */
-/* 0x0360 to 0x03fc is reserved */
-/* 0x0400 is reserved */
-#define USBDC_UDCECR(n) (0x0400+4*(n)) /* UDC Configuration Registers */
-#define USBDC_UDCECR_EE (1<<0) /* Endpoint Enable */
-#define USBDC_UDCECR_DE (1<<1) /* Double-Buffering Enable */
-#define USBDC_UDCECR_MPS (1023<<2) /* Maximum Packet Size */
-#define USBDC_UDCECR_ED (1<<12) /* USB Endpoint Direction 0 OUT, 1 IN */
-#define USBDC_UDCECR_ET (3<<13) /* USB Enpoint Type */
-#define USBDC_UDCECR_EN (15<<15) /* Endpoint Number */
-#define USBDC_UDCECR_AISN (7<<19) /* Alternate Interface Number */
-#define USBDC_UDCECR_IN (7<<22) /* Interface Number */
-#define USBDC_UDCECR_CN (3<<25) /* Configuration Number */
-
-#define USBDC_UDCECR_MPSs(n) ((n)<<2) /* Maximum Packet Size */
-#define USBDC_UDCECR_ETs(n) ((n)<<13) /* USB Enpoint Type */
-#define USBDC_UDCECR_ET_INT 3
-#define USBDC_UDCECR_ET_BULK 2
-#define USBDC_UDCECR_ET_ISO 1
-#define USBDC_UDCECR_ENs(n) ((n)<<15) /* Endpoint Number */
-#define USBDC_UDCECR_AISNs(n) ((n)<<19) /* Alternate Interface Number */
-#define USBDC_UDCECR_INs(n) ((n)<<22) /* Interface Number */
-#define USBDC_UDCECR_CNs(n) ((n)<<25) /* Configuration Number */
-
-#define USBDC_UDCCR_BITS \
- "\20\001UDE\002UDA\003UDR\004EMCE\005SMAC\021DWRE" \
- "\035BHNP\036AHNP\037OEN"
-#define USBDC_UDCISR0_BITS \
- "\20\0010P\0020F\003AP\004AF\005BP\006BF\007CP\010CF" \
- "\011DP\012DF\013EP\014EF\015FP\016FF\017GP\020GF" \
- "\031HP\032HF\033IP\034IF\035JP\036JF\037KP\030KF" \
- "\041LP\042LF\043MP\044MF\045NP\046NF\047PP\040PF"
-#define USBDC_UDCISR1_BITS \
- "\20\001QP\002QF\003RP\004RF\005SP\006SF\007TP\010TF" \
- "\011UP\012UF\013VP\014VF\015WP\016WF\017XP\020XF" \
- "\034RS\035SU\036RU\037SOF\040CC"
-#define USBDC_UDCOTGISR_BITS \
- "\20\001IRIDF\002IRIDR\003IRSDF\004IRSDR\005IRSVF\006IRSVR" \
- "\007IRVV44F\010IRVV44R\011IRVV40F\012IRVV40R"
-#define USBDC_UDCCSR0_BITS \
- "\20\001OPC\002IPR\003FTF\004DME\005SST\006FST\007RNE" \
- "\010SA\011AREN\012ACM"
-#define USBDC_UDCCSRN_BITS \
- "\20\001FS\002PC\003TRN\004DME\005SST\006FST\007BNEF" \
- "\010SP\011FEF\012DPE"
-
-#endif /* _ARM_XSCALE_PXA27X_UDCREG_H_ */
diff --git a/sys/arch/arm/xscale/pxa2x0.c b/sys/arch/arm/xscale/pxa2x0.c
deleted file mode 100644
index baefb42bf37..00000000000
--- a/sys/arch/arm/xscale/pxa2x0.c
+++ /dev/null
@@ -1,461 +0,0 @@
-/* $OpenBSD: pxa2x0.c,v 1.20 2016/01/31 00:14:50 jsg Exp $ */
-/* $NetBSD: pxa2x0.c,v 1.5 2003/12/12 16:42:44 thorpej Exp $ */
-
-/*
- * Copyright (c) 2002 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Genetec Corporation.
- * 4. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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.
- *
- *
- * Autoconfiguration support for the Intel PXA2[15]0 application
- * processor. This code is derived from arm/sa11x0/sa11x0.c
- */
-
-/*-
- * Copyright (c) 2001, The NetBSD Foundation, Inc. All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by IWAMOTO Toshihiro and Ichiro FUKUHARA.
- *
- * 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.
- */
-/*-
- * Copyright (c) 1999
- * Shin Takemura and PocketBSD Project. 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the PocketBSD project
- * and its contributors.
- * 4. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 "pxagpio.h"
-#include "pxadmac.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/reboot.h>
-#include <sys/timetc.h>
-
-#include <machine/cpu.h>
-#include <machine/bus.h>
-
-#include <arm/cpufunc.h>
-#include <arm/mainbus/mainbus.h>
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-
-struct pxaip_softc {
- struct device sc_dev;
- bus_space_tag_t sc_bust;
- bus_dma_tag_t sc_dmat;
- bus_space_handle_t sc_bush_clk;
- bus_space_handle_t sc_bush_rtc;
-};
-
-/* prototypes */
-int pxaip_match(struct device *, void *, void *);
-void pxaip_attach(struct device *, struct device *, void *);
-int pxaip_search(struct device *, void *, void *);
-void pxaip_attach_critical(struct pxaip_softc *);
-int pxaip_print(void *, const char *);
-
-int pxaip_measure_cpuclock(struct pxaip_softc *);
-
-/* attach structures */
-#ifdef __NetBSD__
-CFATTACH_DECL(pxaip, sizeof(struct pxaip_softc),
- pxaip_match, pxaip_attach, NULL, NULL);
-#else
-struct cfattach pxaip_ca = {
- sizeof(struct pxaip_softc), pxaip_match, pxaip_attach
-};
-
-struct cfdriver pxaip_cd = {
- NULL, "pxaip", DV_DULL
-};
-#endif
-
-struct pxaip_softc *pxaip_sc;
-
-int
-pxaip_match(struct device *parent, void *match, void *aux)
-{
-
- return 1;
-}
-
-void
-pxaip_attach(struct device *parent, struct device *self, void *aux)
-{
- struct pxaip_softc *sc = (struct pxaip_softc *)self;
-#ifdef __APM__
- extern int freq;
-#endif
- int cpuclock;
-
- pxaip_sc = sc;
- sc->sc_bust = &pxa2x0_bs_tag;
- sc->sc_dmat = &pxa2x0_bus_dma_tag;
-
- if (bus_space_map(sc->sc_bust, PXA2X0_CLKMAN_BASE, PXA2X0_CLKMAN_SIZE,
- 0, &sc->sc_bush_clk))
- panic("pxaip_attach: failed to map CLKMAN");
-
- if (bus_space_map(sc->sc_bust, PXA2X0_RTC_BASE, PXA2X0_RTC_SIZE,
- 0, &sc->sc_bush_rtc))
- panic("pxaip_attach: failed to map RTC");
-
- /*
- * Calculate clock speed
- * This takes 2 secs at most.
- */
- cpuclock = pxaip_measure_cpuclock(sc) / 1000;
- if (cpuclock % 1000 > 500)
- cpuclock = cpuclock + 1000 - cpuclock % 1000;
-#ifdef __APM__
- freq = cpuclock / 1000;
-#endif
-
- printf(": CPU clock = %d.%03d MHz\n", cpuclock/1000, cpuclock%1000);
-
- /*
- * Attach critical devices
- */
- pxaip_attach_critical(sc);
-
- /*
- * Attach all other devices
- */
- config_search(pxaip_search, self, sc);
-
-}
-
-int
-pxaip_search(struct device *parent, void *c, void *aux)
-{
- struct pxaip_softc *sc = aux;
- struct pxaip_attach_args aa;
- struct cfdata *cf = c;
-
- aa.pxa_iot = sc->sc_bust;
- aa.pxa_dmat = sc->sc_dmat;
-#if 0
- aa.pxa_addr = cf->cf_addr;
- aa.pxa_size = cf->cf_size;
- aa.pxa_intr = cf->cf_intr;
- aa.pxa_index = cf->cf_index;
-#else
- aa.pxa_addr = (cf->cf_loc)[0];
- aa.pxa_size = (cf->cf_loc)[1];
- aa.pxa_intr = (cf->cf_loc)[2];
- aa.pxa_index = (cf->cf_loc)[3];
-#endif
-
- config_found(parent, &aa, pxaip_print);
-
- return 0;
-}
-
-void
-pxaip_attach_critical(struct pxaip_softc *sc)
-{
- struct pxaip_attach_args aa;
-
- aa.pxa_iot = sc->sc_bust;
- aa.pxa_dmat = sc->sc_dmat;
- aa.pxa_addr = PXA2X0_INTCTL_BASE;
- aa.pxa_size = PXA2X0_INTCTL_SIZE;
- aa.pxa_intr = -1;
- if (config_found(&sc->sc_dev, &aa, pxaip_print) == NULL)
- panic("pxaip_attach_critical: failed to attach INTC!");
-
-#if NPXAGPIO > 0
- aa.pxa_iot = sc->sc_bust;
- aa.pxa_dmat = sc->sc_dmat;
- aa.pxa_addr = PXA2X0_GPIO_BASE;
- aa.pxa_size = PXA2X0_GPIO_SIZE;
- aa.pxa_intr = -1;
- if (config_found(&sc->sc_dev, &aa, pxaip_print) == NULL)
- panic("pxaip_attach_critical: failed to attach GPIO!");
-#endif
-
-#if NPXADMAC > 0
- aa.pxa_iot = sc->sc_bust;
- aa.pxa_dmat = sc->sc_dmat;
- aa.pxa_addr = PXA2X0_DMAC_BASE;
- aa.pxa_size = PXA2X0_DMAC_SIZE;
- aa.pxa_intr = PXA2X0_INT_DMA;
- if (config_found(&sc->sc_dev, &aa, pxaip_print) == NULL)
- panic("pxaip_attach_critical: failed to attach DMAC!");
-#endif
-}
-
-int
-pxaip_print(void *aux, const char *name)
-{
- struct pxaip_attach_args *sa = (struct pxaip_attach_args*)aux;
-
- if (sa->pxa_addr != -1) {
- printf(" addr 0x%lx", sa->pxa_addr);
- if (sa->pxa_size > -1)
- printf("-0x%lx", sa->pxa_addr + sa->pxa_size-1);
- }
- if (sa->pxa_intr != -1)
- printf(" intr %d", sa->pxa_intr);
-
- return (UNCONF);
-}
-
-static inline uint32_t
-read_clock_counter(void)
-{
- uint32_t x;
- __asm volatile("mrc p14, 0, %0, c1, c1, 0" : "=r" (x));
-
- return x;
-}
-
-int
-pxaip_measure_cpuclock(struct pxaip_softc *sc)
-{
- uint32_t rtc0, rtc1, start, end;
- uint32_t pmcr_save;
- bus_space_handle_t ioh;
- int irq;
-
- ioh = sc->sc_bush_rtc;
- irq = disable_interrupts(PSR_I|PSR_F);
-
- __asm volatile( "mrc p14, 0, %0, c0, c1, 0" : "=r" (pmcr_save));
- /* Enable clock counter */
- __asm volatile( "mcr p14, 0, %0, c0, c1, 0" : : "r" (0x0001));
-
- rtc0 = bus_space_read_4(sc->sc_bust, ioh, RTC_RCNR);
- /* Wait for next second starts */
- while ((rtc1 = bus_space_read_4(sc->sc_bust, ioh, RTC_RCNR)) == rtc0)
- ;
- start = read_clock_counter();
- while(rtc1 == bus_space_read_4(sc->sc_bust, ioh, RTC_RCNR))
- ; /* Wait for 1sec */
- end = read_clock_counter();
-
- __asm volatile( "mcr p14, 0, %0, c0, c1, 0" : : "r" (pmcr_save));
- restore_interrupts(irq);
-
- return end - start;
-}
-
-void
-pxa2x0_turbo_mode(int f)
-{
- __asm volatile("mcr p14, 0, %0, c6, c0, 0" : : "r" (f));
-}
-
-void
-pxa2x0_probe_sdram(vaddr_t memctl_va, paddr_t *start, paddr_t *size)
-{
- u_int32_t mdcnfg, dwid, dcac, drac, dnb;
- int i;
-
- mdcnfg = *((volatile u_int32_t *)(memctl_va + MEMCTL_MDCNFG));
-
- /*
- * Scan all 4 SDRAM banks
- */
- for (i = 0; i < PXA2X0_SDRAM_BANKS; i++) {
- start[i] = 0;
- size[i] = 0;
-
- switch (i) {
- case 0:
- case 1:
- if ((i == 0 && (mdcnfg & MDCNFG_DE0) == 0) ||
- (i == 1 && (mdcnfg & MDCNFG_DE1) == 0))
- continue;
- dwid = mdcnfg >> MDCNFD_DWID01_SHIFT;
- dcac = mdcnfg >> MDCNFD_DCAC01_SHIFT;
- drac = mdcnfg >> MDCNFD_DRAC01_SHIFT;
- dnb = mdcnfg >> MDCNFD_DNB01_SHIFT;
- break;
-
- case 2:
- case 3:
- if ((i == 2 && (mdcnfg & MDCNFG_DE2) == 0) ||
- (i == 3 && (mdcnfg & MDCNFG_DE3) == 0))
- continue;
- dwid = mdcnfg >> MDCNFD_DWID23_SHIFT;
- dcac = mdcnfg >> MDCNFD_DCAC23_SHIFT;
- drac = mdcnfg >> MDCNFD_DRAC23_SHIFT;
- dnb = mdcnfg >> MDCNFD_DNB23_SHIFT;
- break;
- default:
- panic("pxa2x0_probe_sdram: impossible");
- }
-
- dwid = 2 << (1 - (dwid & MDCNFD_DWID_MASK)); /* 16/32 width */
- dcac = 1 << ((dcac & MDCNFD_DCAC_MASK) + 8); /* 8-11 columns */
- drac = 1 << ((drac & MDCNFD_DRAC_MASK) + 11); /* 11-13 rows */
- dnb = 2 << (dnb & MDCNFD_DNB_MASK); /* # of banks */
-
- size[i] = (paddr_t)(dwid * dcac * drac * dnb);
- start[i] = PXA2X0_SDRAM0_START + (i * PXA2X0_SDRAM_BANK_SIZE);
- }
-}
-
-void
-pxa2x0_clkman_config(u_int clk, int enable)
-{
- struct pxaip_softc *sc;
- u_int32_t rv;
-
- KDASSERT(pxaip_sc != NULL);
- sc = pxaip_sc;
-
- rv = bus_space_read_4(sc->sc_bust, sc->sc_bush_clk, CLKMAN_CKEN);
- rv &= ~clk;
-
- if (enable)
- rv |= clk;
-
- bus_space_write_4(sc->sc_bust, sc->sc_bush_clk, CLKMAN_CKEN, rv);
-}
-
-void
-pxa2x0_rtc_setalarm(u_int32_t secs)
-{
- struct pxaip_softc *sc;
- u_int32_t rv;
- int s;
-
- KDASSERT(pxaip_sc != NULL);
- sc = pxaip_sc;
-
- s = splhigh();
- bus_space_write_4(sc->sc_bust, sc->sc_bush_rtc, RTC_RTAR, secs);
- rv = bus_space_read_4(sc->sc_bust, sc->sc_bush_rtc, RTC_RTSR);
- if (secs == 0)
- bus_space_write_4(sc->sc_bust, sc->sc_bush_rtc, RTC_RTSR,
- (rv | RTSR_AL) & ~RTSR_ALE);
- else
- bus_space_write_4(sc->sc_bust, sc->sc_bush_rtc, RTC_RTSR,
- (rv | RTSR_AL | RTSR_ALE));
- splx(s);
-}
-
-u_int32_t
-pxa2x0_rtc_getalarm(void)
-{
- struct pxaip_softc *sc;
-
- KDASSERT(pxaip_sc != NULL);
- sc = pxaip_sc;
-
- return (bus_space_read_4(sc->sc_bust, sc->sc_bush_rtc, RTC_RTAR));
-}
-
-u_int32_t
-pxa2x0_rtc_getsecs(void)
-{
- struct pxaip_softc *sc;
-
- KDASSERT(pxaip_sc != NULL);
- sc = pxaip_sc;
-
- return (bus_space_read_4(sc->sc_bust, sc->sc_bush_rtc, RTC_RCNR));
-}
-
-void
-resettodr(void)
-{
- struct pxaip_softc *sc = pxaip_sc;
- struct timeval tv;
-
- microtime(&tv);
-
- bus_space_write_4(sc->sc_bust, sc->sc_bush_rtc, RTC_RCNR,
- (u_int32_t)tv.tv_sec);
-}
-
-void
-inittodr(time_t base)
-{
- struct pxaip_softc *sc = pxaip_sc;
- struct timespec ts;
- u_int32_t rcnr;
-
- /* XXX decide if RCNR can be valid, based on the last reset
- * XXX reason, i.e. RCSR. */
- rcnr = bus_space_read_4(sc->sc_bust, sc->sc_bush_rtc, RTC_RCNR);
-
- /* XXX check how much RCNR differs from the filesystem date. */
- if (rcnr > base)
- ts.tv_sec = rcnr;
- else {
- printf("WARNING: using filesystem date -- CHECK AND RESET THE DATE!\n");
- ts.tv_sec = base;
- }
-
- ts.tv_nsec = 0;
- tc_setclock(&ts);
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_a4x_io.S b/sys/arch/arm/xscale/pxa2x0_a4x_io.S
deleted file mode 100644
index 447c4862c8e..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_a4x_io.S
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $OpenBSD: pxa2x0_a4x_io.S,v 1.2 2005/01/02 19:52:36 drahn Exp $ */
-/* $NetBSD: pxa2x0_a4x_io.S,v 1.1 2002/10/19 19:31:39 bsh Exp $ */
-
-/*
- * Copyright (c) 2002 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Genetec Corporation.
- * 4. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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.
- */
-
-/*
- * There are simple bus space functions for IO registers mapped at
- * 32-bit aligned positions. offset is multiplied by 4.
- */
-
-#include <machine/asm.h>
-
-/*
- * bus_space I/O functions with offset*4
- */
-
-/*
- * read single
- */
-
-ENTRY(a4x_bs_r_1)
- ldrb r0, [r1, r2, LSL #2]
- mov pc, lr
-
-ENTRY(a4x_bs_r_2)
- mov r2, r2, LSL #2
- ldrh r0, [r1, r2]
- mov pc, lr
-
-ENTRY(a4x_bs_r_4)
- ldr r0, [r1, r2, LSL #2]
- mov pc, lr
-
-/*
- * write single
- */
-
-ENTRY(a4x_bs_w_1)
- strb r3, [r1, r2, LSL #2]
- mov pc, lr
-
-ENTRY(a4x_bs_w_2)
- mov r2, r2, LSL #2
- strh r3, [r1, r2]
- mov pc, lr
-
-ENTRY(a4x_bs_w_4)
- str r3, [r1, r2, LSL #2]
- mov pc, lr
-
-/*
- * read multiple
- */
-ENTRY(a4x_bs_rm_1)
- mov r2, r2, LSL #2
- b generic_bs_rm_1
-
-ENTRY(a4x_bs_rm_2)
- mov r2, r2, LSL #2
- b generic_armv4_bs_rm_2
-
-
-
-/*
- * write multiple
- */
-ENTRY(a4x_bs_wm_1)
- mov r2, r2, LSL #2
- b generic_bs_wm_1
-
-ENTRY(a4x_bs_wm_2)
- mov r2, r2, LSL #2
- b generic_armv4_bs_wm_2
diff --git a/sys/arch/arm/xscale/pxa2x0_a4x_space.c b/sys/arch/arm/xscale/pxa2x0_a4x_space.c
deleted file mode 100644
index 54ef6a03071..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_a4x_space.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $OpenBSD: pxa2x0_a4x_space.c,v 1.3 2008/05/15 22:17:08 brad Exp $ */
-/* $NetBSD: pxa2x0_a4x_space.c,v 1.2 2003/07/15 00:24:54 lukem Exp $ */
-
-/*
- * Copyright (c) 2002 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Genetec Corporation.
- * 4. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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.
- */
-
-/*
- * Bus space tag for 8/16-bit devices on 32-bit bus.
- * all registers are located at the address of multiple of 4.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-
-/* Prototypes for all the bus_space structure functions */
-bs_protos(pxa2x0);
-bs_protos(a4x);
-bs_protos(generic);
-bs_protos(generic_armv4);
-bs_protos(bs_notimpl);
-
-struct bus_space pxa2x0_a4x_bs_tag = {
- /* cookie */
- (void *) 0,
-
- /* mapping/unmapping */
- pxa2x0_bs_map,
- pxa2x0_bs_unmap,
- pxa2x0_bs_subregion,
-
- /* allocation/deallocation */
- pxa2x0_bs_alloc, /* not implemented */
- pxa2x0_bs_free, /* not implemented */
-
- /* get kernel virtual address */
- pxa2x0_bs_vaddr,
-
- /* mmap */
- bs_notimpl_bs_mmap,
-
- /* barrier */
- pxa2x0_bs_barrier,
-
- /* read (single) */
- a4x_bs_r_1,
- a4x_bs_r_2,
- a4x_bs_r_4,
- bs_notimpl_bs_r_8,
-
- /* read multiple */
- a4x_bs_rm_1,
- a4x_bs_rm_2,
- bs_notimpl_bs_rm_4,
- bs_notimpl_bs_rm_8,
-
- /* read region */
- bs_notimpl_bs_rr_1,
- bs_notimpl_bs_rr_2,
- bs_notimpl_bs_rr_4,
- bs_notimpl_bs_rr_8,
-
- /* write (single) */
- a4x_bs_w_1,
- a4x_bs_w_2,
- a4x_bs_w_4,
- bs_notimpl_bs_w_8,
-
- /* write multiple */
- a4x_bs_wm_1,
- a4x_bs_wm_2,
- bs_notimpl_bs_wm_4,
- bs_notimpl_bs_wm_8,
-
- /* write region */
- bs_notimpl_bs_wr_1,
- bs_notimpl_bs_wr_2,
- bs_notimpl_bs_wr_4,
- bs_notimpl_bs_wr_8,
-
- /* set multiple */
- bs_notimpl_bs_sm_1,
- bs_notimpl_bs_sm_2,
- bs_notimpl_bs_sm_4,
- bs_notimpl_bs_sm_8,
-
- /* set region */
- bs_notimpl_bs_sr_1,
- bs_notimpl_bs_sr_2,
- bs_notimpl_bs_sr_4,
- bs_notimpl_bs_sr_8,
-
- /* copy */
- bs_notimpl_bs_c_1,
- bs_notimpl_bs_c_2,
- bs_notimpl_bs_c_4,
- bs_notimpl_bs_c_8,
-};
-
-
-
diff --git a/sys/arch/arm/xscale/pxa2x0_apm.c b/sys/arch/arm/xscale/pxa2x0_apm.c
deleted file mode 100644
index 10dc039297f..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_apm.c
+++ /dev/null
@@ -1,1585 +0,0 @@
-/* $OpenBSD: pxa2x0_apm.c,v 1.44 2016/01/31 00:14:50 jsg Exp $ */
-
-/*-
- * Copyright (c) 2001 Alexander Guy. All rights reserved.
- * Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
- * Copyright (c) 1995 John T. Kohl. 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 MIND, 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/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/kthread.h>
-#include <sys/rwlock.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/reboot.h>
-#include <sys/event.h>
-
-#include <machine/conf.h>
-#include <machine/cpu.h>
-#include <machine/apmvar.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_apm.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-#include <dev/wscons/wsdisplayvar.h>
-
-#include "wsdisplay.h"
-
-#if defined(APMDEBUG)
-#define DPRINTF(x) printf x
-#else
-#define DPRINTF(x) /**/
-#endif
-
-#define APM_LOCK(sc) rw_enter_write(&(sc)->sc_lock);
-#define APM_UNLOCK(sc) rw_exit_write(&(sc)->sc_lock);
-
-struct cfdriver apm_cd = {
- NULL, "apm", DV_DULL
-};
-
-#define APMUNIT(dev) (minor(dev)&0xf0)
-#define APMDEV(dev) (minor(dev)&0x0f)
-#define APMDEV_NORMAL 0
-#define APMDEV_CTL 8
-
-int apm_userstandbys;
-int apm_suspends;
-int apm_battlow;
-
-/* battery percentage at which we get verbose in our warnings. This
- value can be changed using sysctl(8), value machdep.apmwarn.
- Setting it to zero kills all warnings */
-int cpu_apmwarn = 10;
-
-void apm_power_print(struct pxa2x0_apm_softc *, struct apm_power_info *);
-void apm_power_info(struct pxa2x0_apm_softc *, struct apm_power_info *);
-void apm_suspend(struct pxa2x0_apm_softc *);
-void apm_resume(struct pxa2x0_apm_softc *);
-int apm_get_event(struct pxa2x0_apm_softc *, u_int *);
-int apm_handle_event(struct pxa2x0_apm_softc *, u_int);
-void apm_thread_create(void *);
-void apm_thread(void *);
-
-extern int perflevel;
-int freq;
-void pxa2x0_setperf(int speed);
-int pxa2x0_cpuspeed(int *speed);
-
-int apm_record_event(struct pxa2x0_apm_softc *, u_int);
-void filt_apmrdetach(struct knote *kn);
-int filt_apmread(struct knote *kn, long hint);
-int apmkqfilter(dev_t dev, struct knote *kn);
-
-struct filterops apmread_filtops =
- { 1, NULL, filt_apmrdetach, filt_apmread};
-
-/*
- * Flags to control kernel display
- * SCFLAG_NOPRINT: do not output APM power messages due to
- * a power change event.
- *
- * SCFLAG_PCTPRINT: do not output APM power messages due to
- * to a power change event unless the battery
- * percentage changes.
- */
-
-#define SCFLAG_NOPRINT 0x0008000
-#define SCFLAG_PCTPRINT 0x0004000
-#define SCFLAG_PRINT (SCFLAG_NOPRINT|SCFLAG_PCTPRINT)
-
-#define SCFLAG_OREAD (1 << 0)
-#define SCFLAG_OWRITE (1 << 1)
-#define SCFLAG_OPEN (SCFLAG_OREAD|SCFLAG_OWRITE)
-
-/* This structure must be kept in sync with pxa2x0_apm_asm.S. */
-struct pxa2x0_memcfg {
- /* SDRAM refresh */
- u_int32_t mdrefr_high; /* 0x00 */
- u_int32_t mdrefr_low; /* 0x04 */
- u_int32_t mdrefr_low2; /* 0x08 */
- /* Synchronous, static, or VLIO interfaces */
- u_int32_t msc_high[3]; /* 0x0c */
- u_int32_t msc_low[3]; /* 0x18 */
- /* XXX move up */
- u_int32_t mdrefr_91; /* 0x24 */
-};
-
-/* XXX */
-#define MDREFR_C3000 (MDREFR_K0DB2 | MDREFR_E1PIN | MDREFR_K1RUN | \
- MDREFR_K1DB2 | MDREFR_K2DB2 | MDREFR_APD)
-#define MSC0_HIGH \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_NONBURST << 16) | \
- ( 2 << MSC_RRR_SHIFT) | \
- (13 << MSC_RDN_SHIFT) | \
- (13 << MSC_RDF_SHIFT) | \
- MSC_RBW /* PXA271 */ | \
- MSC_RT_NONBURST
-#define MSC1_HIGH \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_VLIO << 16) | \
- ( 3 << MSC_RRR_SHIFT) | \
- ( 4 << MSC_RDN_SHIFT) | \
- (13 << MSC_RDF_SHIFT) | \
- MSC_RT_VLIO
-#define MSC2_HIGH \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_NONBURST << 16) | \
- ( 3 << MSC_RRR_SHIFT) | \
- ( 4 << MSC_RDN_SHIFT) | \
- (13 << MSC_RDF_SHIFT) | \
- MSC_RT_VLIO
-#define MSC0_LOW \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_NONBURST << 16) | \
- ( 1 << MSC_RRR_SHIFT) | \
- ( 8 << MSC_RDN_SHIFT) | \
- ( 8 << MSC_RDF_SHIFT) | \
- MSC_RBW /* PXA271 */ | \
- MSC_RT_NONBURST
-#define MSC1_LOW \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_VLIO << 16) | \
- ( 1 << MSC_RRR_SHIFT) | \
- ( 2 << MSC_RDN_SHIFT) | \
- ( 6 << MSC_RDF_SHIFT) | \
- MSC_RT_VLIO
-#define MSC2_LOW \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_NONBURST << 16) | \
- ( 1 << MSC_RRR_SHIFT) | \
- ( 2 << MSC_RDN_SHIFT) | \
- ( 6 << MSC_RDF_SHIFT) | \
- MSC_RT_VLIO
-struct pxa2x0_memcfg pxa2x0_memcfg = {
- (MDREFR_C3000 | 0x030),
- (MDREFR_C3000 | 0x00b),
- (MDREFR_C3000 | 0x017),
- { MSC0_HIGH, MSC1_HIGH, MSC2_HIGH },
- { MSC1_LOW, MSC1_LOW, MSC2_LOW },
- (MDREFR_C3000 | 0x013)
-};
-
-#define PI2C_RETRY_COUNT 10
-/* XXX varies depending on voltage regulator IC. */
-#define PI2C_VOLTAGE_LOW 0x13 /* 1.00V */
-#define PI2C_VOLTAGE_HIGH 0x1a /* 1.35V */
-
-void pxa2x0_pi2c_open(bus_space_tag_t, bus_space_handle_t);
-void pxa2x0_pi2c_close(bus_space_tag_t, bus_space_handle_t);
-int pxa2x0_pi2c_read(bus_space_tag_t, bus_space_handle_t, u_char, u_char *);
-int pxa2x0_pi2c_write(bus_space_tag_t, bus_space_handle_t, u_char, u_char);
-int pxa2x0_pi2c_getvoltage(bus_space_tag_t, bus_space_handle_t, u_char *);
-int pxa2x0_pi2c_setvoltage(bus_space_tag_t, bus_space_handle_t, u_char);
-#if 0
-void pxa2x0_pi2c_print(struct pxa2x0_apm_softc *);
-#endif
-
-/* XXX used in pxa2x0_apm_asm.S */
-bus_space_handle_t pxa2x0_gpio_ioh;
-bus_space_handle_t pxa2x0_clkman_ioh;
-bus_space_handle_t pxa2x0_memctl_ioh;
-
-/* pxa2x0_apm_asm.S */
-void pxa27x_run_mode(void);
-void pxa27x_fastbus_run_mode(int, u_int32_t);
-void pxa27x_frequency_change(int, int, struct pxa2x0_memcfg *);
-void pxa2x0_cpu_suspend(void);
-void pxa2x0_cpu_resume(void);
-void pxa27x_cpu_speed_high(void);
-void pxa27x_cpu_speed_low(void);
-void pxa27x_cpu_speed_91(void);
-void pxa27x_cpu_speed_208(void);
-
-void
-apm_power_print(struct pxa2x0_apm_softc *sc, struct apm_power_info *powerp)
-{
-
- if (powerp->battery_life != APM_BATT_LIFE_UNKNOWN)
- printf("%s: battery life expectancy %d%%\n",
- sc->sc_dev.dv_xname, powerp->battery_life);
-
- printf("%s: AC ", sc->sc_dev.dv_xname);
- switch (powerp->ac_state) {
- case APM_AC_OFF:
- printf("off,");
- break;
- case APM_AC_ON:
- printf("on,");
- break;
- case APM_AC_BACKUP:
- printf("backup power,");
- break;
- default:
- case APM_AC_UNKNOWN:
- printf("unknown,");
- break;
- }
-
- printf(" battery is ");
- switch (powerp->battery_state) {
- case APM_BATT_HIGH:
- printf("high");
- break;
- case APM_BATT_LOW:
- printf("low");
- break;
- case APM_BATT_CRITICAL:
- printf("CRITICAL");
- break;
- case APM_BATT_CHARGING:
- printf("charging");
- break;
- case APM_BATT_UNKNOWN:
- printf("unknown");
- break;
- default:
- printf("undecoded (%x)", powerp->battery_state);
- break;
- }
-
- printf("\n");
-}
-
-void
-apm_power_info(struct pxa2x0_apm_softc *sc,
- struct apm_power_info *power)
-{
-
- power->ac_state = APM_AC_UNKNOWN;
- power->battery_state = APM_BATT_UNKNOWN;
- power->battery_life = 0 /* APM_BATT_LIFE_UNKNOWN */;
- power->minutes_left = 0;
-
- if (sc->sc_power_info != NULL)
- sc->sc_power_info(sc, power);
-}
-
-void
-apm_suspend(struct pxa2x0_apm_softc *sc)
-{
- int s;
-
-#if NWSDISPLAY > 0
- wsdisplay_suspend();
-#endif /* NWSDISPLAY > 0 */
-
- resettodr();
-
- if (sc->sc_suspend == NULL)
- pxa2x0_wakeup_config(PXA2X0_WAKEUP_ALL, 1);
- else
- sc->sc_suspend(sc);
-
- s = splhigh();
- config_suspend_all(DVACT_SUSPEND);
-
- /* XXX
- * Flag to disk drivers that they should "power down" the disk
- * when we get to DVACT_POWERDOWN.
- */
- boothowto |= RB_POWERDOWN;
- config_suspend_all(DVACT_POWERDOWN);
- boothowto &= ~RB_POWERDOWN;
-
- splx(s);
-
- pxa2x0_apm_sleep(sc);
-}
-
-void
-apm_resume(struct pxa2x0_apm_softc *sc)
-{
- int s;
-
- s = splhigh();
- config_suspend_all(DVACT_RESUME);
- splx(s);
-
- inittodr(0);
-
- /*
- * Clear the OTG Peripheral hold after running the pxaudc and pxaohci
- * ca_activate to re-enable their operation. See 3.8.1.2
- */
- /* XXX ifdef NPXAUDC > 0 */
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PSSR, PSSR_OTGPH);
-
- bufq_restart();
-
- config_suspend_all(DVACT_WAKEUP);
-
-#if NWSDISPLAY > 0
- wsdisplay_resume();
-#endif /* NWSDISPLAY > 0 */
-}
-
-int
-apm_get_event(struct pxa2x0_apm_softc *sc, u_int *typep)
-{
-
- if (sc->sc_get_event != NULL)
- return (sc->sc_get_event(sc, typep));
-
- *typep = APM_NOEVENT;
- return (1);
-}
-
-int
-apm_handle_event(struct pxa2x0_apm_softc *sc, u_int type)
-{
- struct apm_power_info power;
- int ret = 0;
-
- switch (type) {
- case APM_NOEVENT:
- ret = 1;
- break;
- case APM_CRIT_SUSPEND_REQ:
- DPRINTF(("suspend required immediately\n"));
-#if 0
- /* XXX apmd would make us suspend again after resume. */
- (void)apm_record_event(sc, type);
-#endif
- /*
- * We ignore APM_CRIT_RESUME and just suspend here as usual
- * to simplify the actual apm_get_event() implementation.
- */
- apm_suspends++;
- ret = 1;
- break;
- case APM_USER_SUSPEND_REQ:
- case APM_SUSPEND_REQ:
- DPRINTF(("suspend requested\n"));
- if (apm_record_event(sc, type)) {
- DPRINTF(("suspend ourselves\n"));
- apm_suspends++;
- }
- break;
- case APM_POWER_CHANGE:
- DPRINTF(("power status change\n"));
- apm_power_info(sc, &power);
- if (power.battery_life != APM_BATT_LIFE_UNKNOWN &&
- power.battery_life < cpu_apmwarn &&
- (sc->sc_flags & SCFLAG_PRINT) != SCFLAG_NOPRINT &&
- ((sc->sc_flags & SCFLAG_PRINT) != SCFLAG_PCTPRINT ||
- sc->sc_batt_life != power.battery_life)) {
- sc->sc_batt_life = power.battery_life;
- apm_power_print(sc, &power);
- }
- apm_record_event(sc, type);
- break;
- case APM_BATTERY_LOW:
- DPRINTF(("Battery low!\n"));
- apm_battlow++;
- apm_record_event(sc, type);
- break;
- default:
- DPRINTF(("apm_handle_event: unsupported event, code %d\n",
- type));
- }
-
- return (ret);
-}
-
-void
-apm_thread_create(void *v)
-{
- struct pxa2x0_apm_softc *sc = v;
-
- if (kthread_create(apm_thread, sc, &sc->sc_thread,
- sc->sc_dev.dv_xname)) {
- /* apm_disconnect(sc); */
- printf("%s: failed to create kernel thread, disabled",
- sc->sc_dev.dv_xname);
- }
-}
-
-void
-apm_thread(void *v)
-{
- struct pxa2x0_apm_softc *sc = v;
- u_int type;
-
- for (;;) {
- APM_LOCK(sc);
-
- while (1) {
- if (apm_get_event(sc, &type) != 0)
- break;
- if (apm_handle_event(sc, type) != 0)
- break;
- }
- if (apm_suspends || apm_userstandbys /* || apm_battlow*/) {
- apm_suspend(sc);
- apm_resume(sc);
- }
- apm_battlow = apm_suspends = apm_userstandbys = 0;
-
- APM_UNLOCK(sc);
- tsleep(&lbolt, PWAIT, "apmev", 0);
- }
-}
-
-int
-apmopen(dev_t dev, int flag, int mode, struct proc *p)
-{
- struct pxa2x0_apm_softc *sc;
- int error = 0;
-
- /* apm0 only */
- if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 ||
- !(sc = apm_cd.cd_devs[APMUNIT(dev)]))
- return (ENXIO);
-
- DPRINTF(("apmopen: dev %d pid %d flag %x mode %x\n",
- APMDEV(dev), p->p_pid, flag, mode));
-
- switch (APMDEV(dev)) {
- case APMDEV_CTL:
- if (!(flag & FWRITE)) {
- error = EINVAL;
- break;
- }
- if (sc->sc_flags & SCFLAG_OWRITE) {
- error = EBUSY;
- break;
- }
- sc->sc_flags |= SCFLAG_OWRITE;
- break;
- case APMDEV_NORMAL:
- if (!(flag & FREAD) || (flag & FWRITE)) {
- error = EINVAL;
- break;
- }
- sc->sc_flags |= SCFLAG_OREAD;
- break;
- default:
- error = ENXIO;
- break;
- }
- return (error);
-}
-
-int
-apmclose(dev_t dev, int flag, int mode, struct proc *p)
-{
- struct pxa2x0_apm_softc *sc;
-
- /* apm0 only */
- if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 ||
- !(sc = apm_cd.cd_devs[APMUNIT(dev)]))
- return (ENXIO);
-
- DPRINTF(("apmclose: pid %d flag %x mode %x\n", p->p_pid, flag, mode));
-
- switch (APMDEV(dev)) {
- case APMDEV_CTL:
- sc->sc_flags &= ~SCFLAG_OWRITE;
- break;
- case APMDEV_NORMAL:
- sc->sc_flags &= ~SCFLAG_OREAD;
- break;
- }
- return (0);
-}
-
-int
-apmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct pxa2x0_apm_softc *sc;
- struct apm_power_info *power;
- int error = 0;
-
- /* apm0 only */
- if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 ||
- !(sc = apm_cd.cd_devs[APMUNIT(dev)]))
- return (ENXIO);
-
- switch (cmd) {
- /* some ioctl names from linux */
- case APM_IOC_STANDBY:
- if ((flag & FWRITE) == 0)
- error = EBADF;
- else
- apm_userstandbys++;
- break;
- case APM_IOC_SUSPEND:
- if ((flag & FWRITE) == 0)
- error = EBADF;
- else
- apm_suspends++; /* XXX */
- break;
- case APM_IOC_PRN_CTL:
- if ((flag & FWRITE) == 0)
- error = EBADF;
- else {
- int flag = *(int *)data;
- DPRINTF(( "APM_IOC_PRN_CTL: %d\n", flag ));
- switch (flag) {
- case APM_PRINT_ON: /* enable printing */
- sc->sc_flags &= ~SCFLAG_PRINT;
- break;
- case APM_PRINT_OFF: /* disable printing */
- sc->sc_flags &= ~SCFLAG_PRINT;
- sc->sc_flags |= SCFLAG_NOPRINT;
- break;
- case APM_PRINT_PCT: /* disable some printing */
- sc->sc_flags &= ~SCFLAG_PRINT;
- sc->sc_flags |= SCFLAG_PCTPRINT;
- break;
- default:
- error = EINVAL;
- break;
- }
- }
- break;
- case APM_IOC_DEV_CTL:
- if ((flag & FWRITE) == 0)
- error = EBADF;
- break;
- case APM_IOC_GETPOWER:
- power = (struct apm_power_info *)data;
- apm_power_info(sc, power);
- break;
- case APM_IOC_STANDBY_REQ:
- if ((flag & FWRITE) == 0)
- error = EBADF;
- else if (apm_record_event(sc, APM_USER_STANDBY_REQ))
- error = EINVAL; /* ? */
- break;
- case APM_IOC_SUSPEND_REQ:
- if ((flag & FWRITE) == 0)
- error = EBADF;
- else if (apm_record_event(sc, APM_USER_SUSPEND_REQ))
- error = EINVAL; /* ? */
- default:
- error = ENOTTY;
- }
-
- return (error);
-}
-
-int
-apm_record_event(struct pxa2x0_apm_softc *sc, u_int type)
-{
- static int apm_evindex;
-
- /* skip if no user waiting */
- if ((sc->sc_flags & SCFLAG_OPEN) == 0)
- return (1);
-
- apm_evindex++;
- KNOTE(&sc->sc_note, APM_EVENT_COMPOSE(type, apm_evindex));
-
- return (0);
-}
-
-void
-filt_apmrdetach(struct knote *kn)
-{
- struct pxa2x0_apm_softc *sc =
- (struct pxa2x0_apm_softc *)kn->kn_hook;
-
- SLIST_REMOVE(&sc->sc_note, kn, knote, kn_selnext);
-}
-
-int
-filt_apmread(struct knote *kn, long hint)
-{
- /* XXX weird kqueue_scan() semantics */
- if (hint && !kn->kn_data)
- kn->kn_data = (int)hint;
-
- return (1);
-}
-
-int
-apmkqfilter(dev_t dev, struct knote *kn)
-{
- struct pxa2x0_apm_softc *sc;
-
- /* apm0 only */
- if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 ||
- !(sc = apm_cd.cd_devs[APMUNIT(dev)]))
- return (ENXIO);
-
- switch (kn->kn_filter) {
- case EVFILT_READ:
- kn->kn_fop = &apmread_filtops;
- break;
- default:
- return (EINVAL);
- }
-
- kn->kn_hook = (caddr_t)sc;
- SLIST_INSERT_HEAD(&sc->sc_note, kn, kn_selnext);
-
- return (0);
-}
-
-void
-pxa2x0_apm_attach_sub(struct pxa2x0_apm_softc *sc)
-{
-
- sc->sc_iot = &pxa2x0_bs_tag;
-
- if (bus_space_map(sc->sc_iot, PXA2X0_POWMAN_BASE,
- PXA2X0_POWMAN_SIZE, 0, &sc->sc_pm_ioh)) {
- printf("pxa2x0_apm_attach_sub: failed to map POWMAN\n");
- return;
- }
-
- rw_init(&sc->sc_lock, "apmlk");
-
- kthread_create_deferred(apm_thread_create, sc);
-
- printf("\n");
-
- if (bus_space_map(sc->sc_iot, PXA2X0_CLKMAN_BASE, PXA2X0_CLKMAN_SIZE,
- 0, &pxa2x0_clkman_ioh)) {
- printf("%s: failed to map CLKMAN\n", sc->sc_dev.dv_xname);
- return;
- }
-
- if (bus_space_map(sc->sc_iot, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE,
- 0, &pxa2x0_memctl_ioh)) {
- printf("%s: failed to map MEMCTL\n", sc->sc_dev.dv_xname);
- return;
- }
- sc->sc_memctl_ioh = pxa2x0_memctl_ioh;
-
- if (bus_space_map(sc->sc_iot, PXA2X0_GPIO_BASE, PXA2X0_GPIO_SIZE,
- 0, &pxa2x0_gpio_ioh)) {
- printf("%s: can't map GPIO\n", sc->sc_dev.dv_xname);
- return;
- }
-
- /* Clear all reset status flags. */
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_RCSR,
- RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR);
-}
-
-void
-pxa2x0_wakeup_config(u_int wsrc, int enable)
-{
- struct pxa2x0_apm_softc *sc;
- u_int32_t prer;
- u_int32_t pfer;
- u_int32_t pkwr;
-
- if (apm_cd.cd_ndevs < 1 || apm_cd.cd_devs[0] == NULL)
- return;
- sc = apm_cd.cd_devs[0];
-
- prer = pfer = pkwr = 0;
-
- if ((wsrc & PXA2X0_WAKEUP_POWERON) != 0) {
- prer |= (1<<0);
- pfer |= (1<<0);
- pkwr |= (1<<12); /* XXX */
- }
-
- if ((wsrc & PXA2X0_WAKEUP_GPIORST) != 0)
- pfer |= (1<<1);
- if ((wsrc & PXA2X0_WAKEUP_SD) != 0)
- prer |= (1<<9);
- if ((wsrc & PXA2X0_WAKEUP_RC) != 0)
- prer |= (1<<13);
- if ((wsrc & PXA2X0_WAKEUP_SYNC) != 0)
- pkwr |= (1<<1);
- if ((wsrc & PXA2X0_WAKEUP_KEYNS0) != 0)
- prer |= (1<<12);
- if ((wsrc & PXA2X0_WAKEUP_KEYNS1) != 0)
- pkwr |= (1<<2);
- if ((wsrc & PXA2X0_WAKEUP_KEYNS2) != 0)
- pkwr |= (1<<9);
- if ((wsrc & PXA2X0_WAKEUP_KEYNS3) != 0)
- pkwr |= (1<<3);
- if ((wsrc & PXA2X0_WAKEUP_KEYNS4) != 0)
- pkwr |= (1<<4);
- if ((wsrc & PXA2X0_WAKEUP_KEYNS5) != 0)
- pkwr |= (1<<6);
- if ((wsrc & PXA2X0_WAKEUP_KEYNS6) != 0)
- pkwr |= (1<<7);
- if ((wsrc & PXA2X0_WAKEUP_CF0) != 0)
- pkwr |= (1<<11);
- if ((wsrc & PXA2X0_WAKEUP_CF1) != 0)
- pkwr |= (1<<10);
- if ((wsrc & PXA2X0_WAKEUP_USBD) != 0)
- prer |= (1<<24);
-
- if ((wsrc & PXA2X0_WAKEUP_LOCKSW) != 0) {
- prer |= (1<<15);
- pfer |= (1<<15);
- }
-
- if ((wsrc & PXA2X0_WAKEUP_JACKIN) != 0) {
- prer |= (1<<23);
- pfer |= (1<<23);
- }
-
- if ((wsrc & PXA2X0_WAKEUP_CHRGFULL) != 0)
- pkwr |= (1<<18);
- if ((wsrc & PXA2X0_WAKEUP_RTC) != 0)
- prer |= (1<<31);
-
- if (enable) {
- sc->sc_wakeon |= wsrc;
- prer |= bus_space_read_4(sc->sc_iot, sc->sc_pm_ioh,
- POWMAN_PRER);
- pfer |= bus_space_read_4(sc->sc_iot, sc->sc_pm_ioh,
- POWMAN_PFER);
- pkwr |= bus_space_read_4(sc->sc_iot, sc->sc_pm_ioh,
- POWMAN_PKWR);
- } else {
- sc->sc_wakeon &= ~wsrc;
- prer = bus_space_read_4(sc->sc_iot, sc->sc_pm_ioh,
- POWMAN_PRER) & ~prer;
- pfer = bus_space_read_4(sc->sc_iot, sc->sc_pm_ioh,
- POWMAN_PFER) & ~pfer;
- pkwr = bus_space_read_4(sc->sc_iot, sc->sc_pm_ioh,
- POWMAN_PKWR) & ~pkwr;
- }
-
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PKWR, pkwr);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PRER, prer);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PFER, pfer);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PWER,
- prer | pfer);
-}
-
-u_int
-pxa2x0_wakeup_status(void)
-{
- struct pxa2x0_apm_softc *sc;
- u_int32_t rv;
- u_int wsrc;
-
- if (apm_cd.cd_ndevs < 1 || apm_cd.cd_devs[0] == NULL)
- return (0);
-
- sc = apm_cd.cd_devs[0];
- wsrc = 0;
-
- rv = bus_space_read_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PEDR);
- if ((rv & (1<<0)) != 0)
- wsrc |= PXA2X0_WAKEUP_POWERON;
- if ((rv & (1<<1)) != 0)
- wsrc |= PXA2X0_WAKEUP_GPIORST;
- if ((rv & (1<<9)) != 0)
- wsrc |= PXA2X0_WAKEUP_SD;
- if ((rv & (1<<12)) != 0)
- wsrc |= PXA2X0_WAKEUP_KEYNS0;
- if ((rv & (1<<13)) != 0)
- wsrc |= PXA2X0_WAKEUP_RC;
- if ((rv & (1<<15)) != 0)
- wsrc |= PXA2X0_WAKEUP_LOCKSW;
- if ((rv & (1<<23)) != 0)
- wsrc |= PXA2X0_WAKEUP_JACKIN;
- if ((rv & (1<<24)) != 0)
- wsrc |= PXA2X0_WAKEUP_USBD;
- if ((rv & (1<<31)) != 0)
- wsrc |= PXA2X0_WAKEUP_RTC;
-
- rv = bus_space_read_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PKSR);
- if ((rv & (1<<1)) != 0)
- wsrc |= PXA2X0_WAKEUP_SYNC;
- if ((rv & (1<<2)) != 0)
- wsrc |= PXA2X0_WAKEUP_KEYNS1;
- if ((rv & (1<<9)) != 0)
- wsrc |= PXA2X0_WAKEUP_KEYNS2;
- if ((rv & (1<<3)) != 0)
- wsrc |= PXA2X0_WAKEUP_KEYNS3;
- if ((rv & (1<<4)) != 0)
- wsrc |= PXA2X0_WAKEUP_KEYNS4;
- if ((rv & (1<<6)) != 0)
- wsrc |= PXA2X0_WAKEUP_KEYNS5;
- if ((rv & (1<<7)) != 0)
- wsrc |= PXA2X0_WAKEUP_KEYNS6;
- if ((rv & (1<<10)) != 0)
- wsrc |= PXA2X0_WAKEUP_CF1;
- if ((rv & (1<<11)) != 0)
- wsrc |= PXA2X0_WAKEUP_CF0;
- if ((rv & (1<<12)) != 0)
- wsrc |= PXA2X0_WAKEUP_POWERON;
- if ((rv & (1<<18)) != 0)
- wsrc |= PXA2X0_WAKEUP_CHRGFULL;
-
- return (wsrc);
-}
-
-struct pxa2x0_sleep_data {
- /* OS timer registers */
- u_int32_t sd_osmr0, sd_osmr1, sd_osmr2, sd_osmr3;
- u_int32_t sd_oscr0;
- u_int32_t sd_osmr4, sd_osmr5;
- u_int32_t sd_oscr4;
- u_int32_t sd_omcr4, sd_omcr5;
- u_int32_t sd_oier;
- /* GPIO registers */
- u_int32_t sd_gpdr0, sd_gpdr1, sd_gpdr2, sd_gpdr3;
- u_int32_t sd_grer0, sd_grer1, sd_grer2, sd_grer3;
- u_int32_t sd_gfer0, sd_gfer1, sd_gfer2, sd_gfer3;
- u_int32_t sd_gafr0_l, sd_gafr1_l, sd_gafr2_l, sd_gafr3_l;
- u_int32_t sd_gafr0_u, sd_gafr1_u, sd_gafr2_u, sd_gafr3_u;
- u_int32_t sd_gplr0, sd_gplr1, sd_gplr2, sd_gplr3;
- /* Interrupt controller registers */
- u_int32_t sd_iclr;
- u_int32_t sd_icmr;
- u_int32_t sd_iccr;
- /* Memory controller registers */
- u_int32_t sd_mecr;
- u_int32_t sd_mcmem0, sd_mcmem1;
- u_int32_t sd_mcatt0, sd_mcatt1;
- u_int32_t sd_mcio0, sd_mcio1;
- /* Clocks manager registers */
- u_int32_t sd_cken;
-};
-
-void
-pxa2x0_apm_sleep(struct pxa2x0_apm_softc *sc)
-{
- struct pxa2x0_sleep_data sd;
- bus_space_handle_t ost_ioh;
- int save;
- u_int32_t rv;
-
- ost_ioh = (bus_space_handle_t)0;
- if (bus_space_map(sc->sc_iot, PXA2X0_OST_BASE, PXA2X0_OST_SIZE, 0,
- &ost_ioh)) {
- printf("pxa2x0_apm_sleep: can't map OST\n");
- goto out;
- }
-
- save = disable_interrupts(PSR_I|PSR_F);
-
- sd.sd_oscr0 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OSCR0);
- sd.sd_oscr4 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OSCR4);
- sd.sd_omcr4 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OMCR4);
- sd.sd_omcr5 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OMCR5);
- sd.sd_osmr0 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OSMR0);
- sd.sd_osmr1 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OSMR1);
- sd.sd_osmr2 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OSMR2);
- sd.sd_osmr3 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OSMR3);
- sd.sd_osmr4 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OSMR4);
- sd.sd_osmr5 = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OSMR5);
- sd.sd_oier = bus_space_read_4(sc->sc_iot, ost_ioh, OST_OIER);
-
- /* Bring the PXA27x into 416MHz turbo mode. */
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA27X &&
- bus_space_read_4(sc->sc_iot, pxa2x0_clkman_ioh, CLKMAN_CCCR) !=
- (CCCR_A | CCCR_TURBO_X2 | CCCR_RUN_X16)) {
-#if 0
- pxa27x_cpu_speed_high();
-#else
-#define CLKCFG_T (1<<0) /* turbo */
-#define CLKCFG_F (1<<1) /* frequency change */
-#define CLKCFG_B (1<<3) /* fast-bus */
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 |
- CCCR_RUN_X16, CLKCFG_B | CLKCFG_F | CLKCFG_T,
- &pxa2x0_memcfg);
-#endif
- delay(500000); /* XXX */
- }
-
-suspend_again:
- /* Clear wake-up status. */
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PEDR,
- 0xffffffff);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PKSR,
- 0xffffffff);
-
- /* XXX control battery charging in sleep mode. */
-
- /* XXX schedule RTC alarm to check the battery, or schedule
- XXX wake-up shortly before an already programmed alarm? */
-
- pxa27x_run_mode();
-#define MDREFR_LOW (MDREFR_C3000 | 0x00b)
- pxa27x_fastbus_run_mode(0, MDREFR_LOW);
- delay(1);
-#if 1
- pxa27x_cpu_speed_91();
-#else
- pxa27x_frequency_change(CCCR_TURBO_X1 | CCCR_RUN_X7, CLKCFG_F,
- &pxa2x0_memcfg);
-#endif
- pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh, PI2C_VOLTAGE_LOW);
-
- sd.sd_gpdr0 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR0);
- sd.sd_gpdr1 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR1);
- sd.sd_gpdr2 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR2);
- sd.sd_gpdr3 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR3);
-
- sd.sd_grer0 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GRER0);
- sd.sd_grer1 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GRER1);
- sd.sd_grer2 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GRER2);
- sd.sd_grer3 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GRER3);
-
- sd.sd_gfer0 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GFER0);
- sd.sd_gfer1 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GFER1);
- sd.sd_gfer2 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GFER2);
- sd.sd_gfer3 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GFER3);
-
- sd.sd_gafr0_l = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR0_L);
- sd.sd_gafr1_l = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR1_L);
- sd.sd_gafr2_l = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR2_L);
- sd.sd_gafr3_l = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR3_L);
-
- sd.sd_gafr0_u = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR0_U);
- sd.sd_gafr1_u = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR1_U);
- sd.sd_gafr2_u = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR2_U);
- sd.sd_gafr3_u = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR3_U);
-
- sd.sd_gplr0 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPLR0);
- sd.sd_gplr1 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPLR1);
- sd.sd_gplr2 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPLR2);
- sd.sd_gplr3 = bus_space_read_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPLR3);
-
- sd.sd_iclr = read_icu(INTCTL_ICLR);
- sd.sd_icmr = read_icu(INTCTL_ICMR);
- sd.sd_iccr = read_icu(INTCTL_ICCR);
- write_icu(INTCTL_ICMR, 0);
-
- sd.sd_mecr = bus_space_read_4(sc->sc_iot, pxa2x0_memctl_ioh,
- MEMCTL_MECR);
- sd.sd_mcmem0 = bus_space_read_4(sc->sc_iot, pxa2x0_memctl_ioh,
- MEMCTL_MCMEM(0));
- sd.sd_mcmem1 = bus_space_read_4(sc->sc_iot, pxa2x0_memctl_ioh,
- MEMCTL_MCMEM(1));
- sd.sd_mcatt0 = bus_space_read_4(sc->sc_iot, pxa2x0_memctl_ioh,
- MEMCTL_MCATT(0));
- sd.sd_mcatt1 = bus_space_read_4(sc->sc_iot, pxa2x0_memctl_ioh,
- MEMCTL_MCATT(1));
- sd.sd_mcio0 = bus_space_read_4(sc->sc_iot, pxa2x0_memctl_ioh,
- MEMCTL_MCIO(0));
- sd.sd_mcio1 = bus_space_read_4(sc->sc_iot, pxa2x0_memctl_ioh,
- MEMCTL_MCIO(1));
-
- sd.sd_cken = bus_space_read_4(sc->sc_iot, pxa2x0_clkman_ioh,
- CLKMAN_CKEN);
-
- /*
- * Stop clocks to all units except to the memory controller, and
- * to the keypad controller if it is enabled as a wake-up source.
- */
- rv = CKEN_MEM;
- if ((sc->sc_wakeon & PXA2X0_WAKEUP_KEYNS_ALL) != 0)
- rv |= CKEN_KEY;
- bus_space_write_4(sc->sc_iot, pxa2x0_clkman_ioh, CLKMAN_CKEN, rv);
-
- /* Disable nRESET_OUT. */
- rv = bus_space_read_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PSLR);
-#define PSLR_SL_ROD (1<<20)
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PSLR,
- rv | PSLR_SL_ROD);
-
- /* Clear all reset status flags. */
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_RCSR,
- RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR);
-
- /* Stop 3/13MHz oscillator; do not float PCMCIA and chip-selects. */
- rv = PCFR_OPDE;
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA27X)
- /* Enable nRESET_GPIO as a GPIO reset input. */
- rv |= PCFR_GPR_EN;
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PCFR, rv);
-
- /* XXX C3000 */
-#define GPIO_G0_STROBE_BIT 0x0f800000
-#define GPIO_G1_STROBE_BIT 0x00100000
-#define GPIO_G2_STROBE_BIT 0x01000000
-#define GPIO_G3_STROBE_BIT 0x00041880
-#define GPIO_KEY_STROBE0 88
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PGSR0,
- 0x00144018);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PGSR1,
- 0x00ef0000);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PGSR2,
- 0x0121c000);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PGSR3,
- 0x00600000);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PGSR0,
- 0x00144018 & ~GPIO_G0_STROBE_BIT);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PGSR1,
- 0x00ef0000 & ~GPIO_G1_STROBE_BIT);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PGSR2,
- 0x0121c000 & ~GPIO_G2_STROBE_BIT);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PGSR3,
- 0x00600000 & ~GPIO_G3_STROBE_BIT);
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PGSR2,
- (0x0121c000 & ~GPIO_G2_STROBE_BIT) |
- GPIO_BIT(GPIO_KEY_STROBE0));
-
- /* C3000 */
-#define GPIO_EXT_BUS_READY 18
- pxa2x0_gpio_set_function(GPIO_EXT_BUS_READY, GPIO_SET | GPIO_OUT);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR0, 0xd01c4418);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR1, 0xfcefbd21);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR2, 0x13a5ffff);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR3, 0x01e3e10c);
-
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PSPR,
- (u_int32_t)&pxa2x0_cpu_resume - 0xc0200000 + 0xa0200000);
-
- pxa2x0_cpu_suspend();
-
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PSPR, 0);
-
- pxa2x0_clkman_config(CKEN_SSP|CKEN_PWM0|CKEN_PWM1, 1);
- pxa2x0_clkman_config(CKEN_KEY, 0);
-
-#if 1
- /* Clear all GPIO interrupt sources. */
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GEDR0, 0xffffffff);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GEDR1, 0xffffffff);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GEDR2, 0xffffffff);
-#endif
-
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR0, sd.sd_gpdr0);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR1, sd.sd_gpdr1);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR2, sd.sd_gpdr2);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GRER0, sd.sd_grer0);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GRER1, sd.sd_grer1);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GRER2, sd.sd_grer2);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GFER0, sd.sd_gfer0);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GFER1, sd.sd_gfer1);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GFER2, sd.sd_gfer2);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR0_L, sd.sd_gafr0_l);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR1_L, sd.sd_gafr1_l);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR2_L, sd.sd_gafr2_l);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR0_U, sd.sd_gafr0_u);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR1_U, sd.sd_gafr1_u);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR2_U, sd.sd_gafr2_u);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPSR0, sd.sd_gplr0 &
- sd.sd_gpdr0);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPSR1, sd.sd_gplr1 &
- sd.sd_gpdr1);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPSR2, sd.sd_gplr2 &
- sd.sd_gpdr2);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPCR0, ~sd.sd_gplr0 &
- sd.sd_gpdr0);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPCR1, ~sd.sd_gplr1 &
- sd.sd_gpdr1);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPCR2, ~sd.sd_gplr2 &
- sd.sd_gpdr2);
-
- /* PXA27x */
-#if 0
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GEDR3, 0xffffffff);
-#endif
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPDR3, sd.sd_gpdr3);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GRER3, sd.sd_grer3);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GFER3, sd.sd_gfer3);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR3_L, sd.sd_gafr3_l);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GAFR3_U, sd.sd_gafr3_u);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPSR3, sd.sd_gplr3 &
- sd.sd_gpdr3);
- bus_space_write_4(sc->sc_iot, pxa2x0_gpio_ioh, GPIO_GPCR3, ~sd.sd_gplr3 &
- sd.sd_gpdr3);
-
- bus_space_write_4(sc->sc_iot, pxa2x0_memctl_ioh, MEMCTL_MECR,
- sd.sd_mecr);
- bus_space_write_4(sc->sc_iot, pxa2x0_memctl_ioh, MEMCTL_MCMEM(0),
- sd.sd_mcmem0);
- bus_space_write_4(sc->sc_iot, pxa2x0_memctl_ioh, MEMCTL_MCMEM(1),
- sd.sd_mcmem1);
- bus_space_write_4(sc->sc_iot, pxa2x0_memctl_ioh, MEMCTL_MCATT(0),
- sd.sd_mcatt0);
- bus_space_write_4(sc->sc_iot, pxa2x0_memctl_ioh, MEMCTL_MCATT(1),
- sd.sd_mcatt1);
- bus_space_write_4(sc->sc_iot, pxa2x0_memctl_ioh, MEMCTL_MCIO(0),
- sd.sd_mcio0);
- bus_space_write_4(sc->sc_iot, pxa2x0_memctl_ioh, MEMCTL_MCIO(1),
- sd.sd_mcio1);
-
- bus_space_write_4(sc->sc_iot, pxa2x0_clkman_ioh, CLKMAN_CKEN,
- sd.sd_cken);
-
- write_icu(INTCTL_ICLR, sd.sd_iclr);
- write_icu(INTCTL_ICCR, sd.sd_iccr);
- write_icu(INTCTL_ICMR, sd.sd_icmr);
-
- if ((read_icu(INTCTL_ICIP) & 0x1) != 0)
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PEDR, 0x1);
-
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OSMR0, sd.sd_osmr0);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OSMR1, sd.sd_osmr1);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OSMR2, sd.sd_osmr2);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OSMR3, sd.sd_osmr3);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OSMR4, sd.sd_osmr4);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OSMR5, sd.sd_osmr5);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OMCR4, sd.sd_omcr4);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OMCR5, sd.sd_omcr5);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OSCR0, sd.sd_oscr0);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OSCR4, sd.sd_oscr4);
- bus_space_write_4(sc->sc_iot, ost_ioh, OST_OIER, sd.sd_oier);
-
- pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh, PI2C_VOLTAGE_HIGH);
-
- /* Change to 208MHz run mode with fast-bus still disabled. */
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 | CCCR_RUN_X16,
- CLKCFG_F, &pxa2x0_memcfg);
- delay(1); /* XXX is the delay long enough, and necessary at all? */
- pxa27x_fastbus_run_mode(1, pxa2x0_memcfg.mdrefr_high);
-
- /* Change to 416MHz turbo mode with fast-bus enabled. */
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 | CCCR_RUN_X16,
- CLKCFG_B | CLKCFG_F | CLKCFG_T, &pxa2x0_memcfg);
-
- if (sc->sc_resume != NULL) {
- if (!sc->sc_resume(sc))
- goto suspend_again;
- }
-
- /*
- * Allow immediate entry into deep-sleep mode if power fails.
- * Resume from immediate deep-sleep is not implemented yet.
- */
- bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PMCR, 0);
-
-
- restore_interrupts(save);
-
- pxa2x0_setperf(perflevel);
-
- out:
- if (ost_ioh != (bus_space_handle_t)0)
- bus_space_unmap(sc->sc_iot, ost_ioh, PXA2X0_OST_SIZE);
-}
-
-void
-pxa2x0_pi2c_open(bus_space_tag_t iot, bus_space_handle_t ioh)
-{
- u_int32_t rv;
-
- /* Enable the I2C unit, and disable automatic voltage change. */
- rv = bus_space_read_4(iot, ioh, POWMAN_PCFR);
- bus_space_write_4(iot, ioh, POWMAN_PCFR, rv | PCFR_PI2C_EN);
- rv = bus_space_read_4(iot, ioh, POWMAN_PCFR);
- bus_space_write_4(iot, ioh, POWMAN_PCFR, rv & ~PCFR_FVC);
- delay(1);
-
- /* Enable the clock to the power manager I2C unit. */
- pxa2x0_clkman_config(CKEN_PI2C, 1);
- delay(1);
-}
-
-void
-pxa2x0_pi2c_close(bus_space_tag_t iot, bus_space_handle_t ioh)
-{
- u_int32_t rv;
-
- bus_space_write_4(iot, ioh, POWMAN_PICR, PICR_UR);
- bus_space_write_4(iot, ioh, POWMAN_PISAR, 0);
- delay(1);
-
- /* Disable the clock to the power manager I2C unit. */
- pxa2x0_clkman_config(CKEN_PI2C, 0);
- delay(1);
-
- /* Disable the I2C unit, and disable automatic voltage change. */
- rv = bus_space_read_4(iot, ioh, POWMAN_PCFR);
- bus_space_write_4(iot, ioh, POWMAN_PCFR,
- rv & ~(PCFR_PI2C_EN | PCFR_FVC));
- delay(1);
-}
-
-int
-pxa2x0_pi2c_read(bus_space_tag_t iot, bus_space_handle_t ioh,
- u_char slave, u_char *valuep)
-{
- u_int32_t rv;
- int timeout;
- int tries = PI2C_RETRY_COUNT;
-
-retry:
-
- bus_space_write_4(iot, ioh, POWMAN_PICR, PICR_UR);
- bus_space_write_4(iot, ioh, POWMAN_PISAR, 0x00);
- delay(1);
- bus_space_write_4(iot, ioh, POWMAN_PICR, PICR_IUE | PICR_SCLE);
-
- /* Write slave device address. */
- bus_space_write_4(iot, ioh, POWMAN_PIDBR, (slave<<1) | 0x1);
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv | PICR_START);
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv & ~PICR_STOP);
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv | PICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, POWMAN_PISR) & PISR_ITE) == 0) {
- if (timeout-- == 0) {
- bus_space_write_4(iot, ioh, POWMAN_PISR, PISR_ITE);
- goto err;
- }
- delay(1);
- }
-
- bus_space_write_4(iot, ioh, POWMAN_PISR, PISR_ITE);
-
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv & ~PICR_START);
-
- /* Read data value. */
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv |
- (PICR_STOP | PICR_ACKNAK));
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv | PICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, POWMAN_PISR) & PISR_IRF) == 0) {
- if (timeout-- == 0) {
- bus_space_write_4(iot, ioh, POWMAN_PISR, PISR_IRF);
- goto err;
- }
- delay(1);
- }
-
- bus_space_write_4(iot, ioh, POWMAN_PISR, PISR_IRF);
- rv = bus_space_read_4(iot, ioh, POWMAN_PIDBR);
- *valuep = (u_char)rv;
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv &
- ~(PICR_STOP | PICR_ACKNAK));
-
- return (0);
-err:
- if (tries-- >= 0)
- goto retry;
-
- bus_space_write_4(iot, ioh, POWMAN_PICR, PICR_UR);
- bus_space_write_4(iot, ioh, POWMAN_PISAR, 0x00);
- bus_space_write_4(iot, ioh, POWMAN_PICR, PICR_IUE | PICR_SCLE);
-
- return (-EIO);
-}
-
-int
-pxa2x0_pi2c_write(bus_space_tag_t iot, bus_space_handle_t ioh,
- u_char slave, u_char value)
-{
- u_int32_t rv;
- int timeout;
- int tries = PI2C_RETRY_COUNT;
-
-retry:
-
- bus_space_write_4(iot, ioh, POWMAN_PICR, PICR_UR);
- bus_space_write_4(iot, ioh, POWMAN_PISAR, 0x00);
- delay(1);
- bus_space_write_4(iot, ioh, POWMAN_PICR, PICR_IUE | PICR_SCLE);
-
- /* Write slave device address. */
- bus_space_write_4(iot, ioh, POWMAN_PIDBR, (slave<<1));
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv | PICR_START);
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv & ~PICR_STOP);
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv | PICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, POWMAN_PISR) & PISR_ITE) == 0) {
- if (timeout-- == 0) {
- bus_space_write_4(iot, ioh, POWMAN_PISR, PISR_ITE);
- goto err;
- }
- delay(1);
- }
- if ((bus_space_read_4(iot, ioh, POWMAN_PISR) & PISR_ACKNAK) != 0)
- goto err;
- bus_space_write_4(iot, ioh, POWMAN_PISR, PISR_ITE);
-
- /* Write data. */
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv & ~PICR_START);
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv | PICR_STOP);
- bus_space_write_4(iot, ioh, POWMAN_PIDBR, value);
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv | PICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, POWMAN_PISR) & PISR_ITE) == 0) {
- if (timeout-- == 0) {
-#if 0
- bus_space_write_4(iot, ioh, POWMAN_PISR, PISR_ITE);
-#endif
- goto err;
- }
- delay(1);
- }
- if ((bus_space_read_4(iot, ioh, POWMAN_PISR) & PISR_ACKNAK) != 0)
- goto err;
- bus_space_write_4(iot, ioh, POWMAN_PISR, PISR_ITE);
-
- rv = bus_space_read_4(iot, ioh, POWMAN_PICR);
- bus_space_write_4(iot, ioh, POWMAN_PICR, rv & ~PICR_STOP);
-
- return (0);
-err:
- bus_space_write_4(iot, ioh, POWMAN_PISR, PISR_ITE);
- if (tries-- >= 0)
- goto retry;
-
- bus_space_write_4(iot, ioh, POWMAN_PICR, PICR_UR);
- bus_space_write_4(iot, ioh, POWMAN_PISAR, 0x00);
- bus_space_write_4(iot, ioh, POWMAN_PICR, PICR_IUE | PICR_SCLE);
-
- return (-EIO);
-}
-
-int
-pxa2x0_pi2c_getvoltage(bus_space_tag_t iot, bus_space_handle_t ioh,
- u_char *valuep)
-{
- int res;
-
- pxa2x0_pi2c_open(iot, ioh);
- res = pxa2x0_pi2c_read(iot, ioh, 0x0c, valuep);
- pxa2x0_pi2c_close(iot, ioh);
- return (res);
-}
-
-int
-pxa2x0_pi2c_setvoltage(bus_space_tag_t iot, bus_space_handle_t ioh,
- u_char value)
-{
- int res;
-
- pxa2x0_pi2c_open(iot, ioh);
- res = pxa2x0_pi2c_write(iot, ioh, 0x0c, value);
- pxa2x0_pi2c_close(iot, ioh);
- return (res);
-}
-
-#if 0
-void
-pxa2x0_pi2c_print(struct pxa2x0_apm_softc *sc)
-{
- u_char value = 0;
-
- (void)pxa2x0_pi2c_getvoltage(sc->sc_iot, sc->sc_pm_ioh, &value);
- printf("xscale core voltage: %s\n", value == PI2C_VOLTAGE_HIGH ?
- "high" : (value == PI2C_VOLTAGE_LOW ? "low" : "unknown"));
-}
-#endif
-
-struct {
- int maxspeed;
- int numspeeds;
- int hz [6];
- int rate [6]; /* could this be simplfied by not having 100% in table? */
-}
-speedtables[] = {
- { 91, 1, { 91 }, { 100 }},
- { 208, 2, { 91, 208}, {50, 100}},
- { 416, 3, { 91, 208, 416}, {25, 50, 100}},
- { 520, 4, { 91, 208, 416, 520}, {18, 40 ,80, 100}},
- { 624, 5, { 91, 208, 416, 520, 624}, {15, 34, 67, 82, 100}},
- { 0 }
-};
-int xscale_maxspeed = 416; /* XXX */
-
-int speed_to_freq(int speed);
-
-int
-speed_to_freq(int speed)
-{
- int i, j;
- int newspeed = 0;
- int numspeeds;
- for (i = 0; speedtables[i].maxspeed != 0; i++) {
- if (speedtables[i].maxspeed != xscale_maxspeed)
- continue;
-
- if (speed <= speedtables[i].rate[0]) {
- return speedtables[i].hz[0];
-
- }
- numspeeds = speedtables[i].numspeeds;
- if (speed == speedtables[i].rate[numspeeds-1]) {
- return speedtables[i].hz[numspeeds-1];
- }
- for (j = 1; j < numspeeds; j++) {
- if (speed < speedtables[i].rate[j]) {
- return speedtables[i].hz[j-1];
- }
- }
- }
- return newspeed;
-}
-
-
-void
-pxa2x0_setperf(int speed)
-{
- struct pxa2x0_apm_softc *sc;
- int s;
- int newfreq;
-
- sc = apm_cd.cd_devs[0];
-
- newfreq = speed_to_freq(speed);
-
- if (newfreq == 0) {
- printf("bogus new frequency 0 for rate %d maxclock %d\n",
- speed, xscale_maxspeed);
- }
-
- DPRINTF(("setperf speed %d newfreq %d, maxfreq %d\n",
- speed, newfreq, xscale_maxspeed));
-
- s = disable_interrupts(PSR_I|PSR_F);
-
- if (newfreq == 91) {
- if (freq > 91) {
- pxa27x_run_mode();
- pxa27x_fastbus_run_mode(0, MDREFR_LOW);
- pxa27x_cpu_speed_91();
- pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh,
- PI2C_VOLTAGE_LOW);
- freq = 91;
- }
- } else if (newfreq == 208) {
- if (freq < 208)
- pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh,
- PI2C_VOLTAGE_HIGH);
- if (freq != 208) {
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 |
- CCCR_RUN_X16, CLKCFG_F, &pxa2x0_memcfg);
- pxa27x_fastbus_run_mode(1, pxa2x0_memcfg.mdrefr_high);
- freq = 208;
- }
- } else if (newfreq == 416) {
- if (freq < 208) {
- pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh,
- PI2C_VOLTAGE_HIGH);
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 |
- CCCR_RUN_X16, CLKCFG_F, &pxa2x0_memcfg);
- pxa27x_fastbus_run_mode(1, pxa2x0_memcfg.mdrefr_high);
- }
- if (freq != 416) {
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 |
- CCCR_RUN_X16, CLKCFG_B | CLKCFG_F | CLKCFG_T,
- &pxa2x0_memcfg);
- freq = 416;
- }
- } else if (newfreq == 520) {
- if (freq < 208) {
- pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh,
- PI2C_VOLTAGE_HIGH);
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 |
- CCCR_RUN_X16, CLKCFG_F, &pxa2x0_memcfg);
- pxa27x_fastbus_run_mode(1, pxa2x0_memcfg.mdrefr_high);
- }
- if (freq != 520) {
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X25 |
- CCCR_RUN_X16, CLKCFG_B | CLKCFG_F | CLKCFG_T,
- &pxa2x0_memcfg);
- freq = 520;
- }
- } else if (newfreq == 624) {
- if (freq < 208) {
- pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh,
- PI2C_VOLTAGE_HIGH);
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 |
- CCCR_RUN_X16, CLKCFG_F, &pxa2x0_memcfg);
- pxa27x_fastbus_run_mode(1, pxa2x0_memcfg.mdrefr_high);
- }
- if (freq != 624) {
- pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X3 |
- CCCR_RUN_X16, CLKCFG_B | CLKCFG_F | CLKCFG_T,
- &pxa2x0_memcfg);
- freq = 624;
- }
- }
-
- restore_interrupts(s);
-}
-
-int
-pxa2x0_cpuspeed(int *freqp)
-{
- *freqp = freq;
- return 0;
-}
-
-void pxa2x0_maxspeed(int *speedp);
-
-void
-pxa2x0_maxspeed(int *speedp)
-{
- /* XXX assumes a pxa270 */
-
- if (*speedp < 207) {
- *speedp = 91;
- } else if (*speedp < 415) {
- *speedp = 208;
- } else if (*speedp < 519) {
- *speedp = 416;
- } else if (*speedp < 624) {
- *speedp = 520;
-#if 0
- } else if (*speedp < 651) {
- *speedp = 624;
-#endif
- } else {
- *speedp = 520; /* hope this is safe. */
- }
- xscale_maxspeed = *speedp;
- pxa2x0_setperf(perflevel);
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_apm.h b/sys/arch/arm/xscale/pxa2x0_apm.h
deleted file mode 100644
index 6d5fe3935f6..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_apm.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $OpenBSD: pxa2x0_apm.h,v 1.8 2009/03/27 16:01:37 oga Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _PXA2X0_APM_H_
-#define _PXA2X0_APM_H_
-
-#include <sys/event.h>
-
-#include <machine/bus.h>
-#include <machine/apmvar.h>
-
-struct pxa2x0_apm_softc {
- struct device sc_dev;
- struct proc *sc_thread;
- struct rwlock sc_lock;
- struct klist sc_note;
- int sc_flags;
- int sc_wakeon; /* enabled wakeup sources */
- int sc_batt_life;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_pm_ioh;
- bus_space_handle_t sc_memctl_ioh;
- int (*sc_get_event)(struct pxa2x0_apm_softc *, u_int *);
- void (*sc_power_info)(struct pxa2x0_apm_softc *,
- struct apm_power_info *);
- void (*sc_suspend)(struct pxa2x0_apm_softc *);
- int (*sc_resume)(struct pxa2x0_apm_softc *);
-};
-
-void pxa2x0_apm_attach_sub(struct pxa2x0_apm_softc *);
-void pxa2x0_apm_sleep(struct pxa2x0_apm_softc *);
-
-#define PXA2X0_WAKEUP_POWERON (1<<0)
-#define PXA2X0_WAKEUP_GPIORST (1<<1)
-#define PXA2X0_WAKEUP_SD (1<<2)
-#define PXA2X0_WAKEUP_RC (1<<3)
-#define PXA2X0_WAKEUP_SYNC (1<<4)
-#define PXA2X0_WAKEUP_KEYNS0 (1<<5)
-#define PXA2X0_WAKEUP_KEYNS1 (1<<6)
-#define PXA2X0_WAKEUP_KEYNS2 (1<<7)
-#define PXA2X0_WAKEUP_KEYNS3 (1<<8)
-#define PXA2X0_WAKEUP_KEYNS4 (1<<9)
-#define PXA2X0_WAKEUP_KEYNS5 (1<<10)
-#define PXA2X0_WAKEUP_KEYNS6 (1<<11)
-#define PXA2X0_WAKEUP_CF0 (1<<12)
-#define PXA2X0_WAKEUP_CF1 (1<<13)
-#define PXA2X0_WAKEUP_USBD (1<<14)
-#define PXA2X0_WAKEUP_LOCKSW (1<<15)
-#define PXA2X0_WAKEUP_JACKIN (1<<16)
-#define PXA2X0_WAKEUP_CHRGFULL (1<<17)
-#define PXA2X0_WAKEUP_RTC (1<<18)
-
-#define PXA2X0_WAKEUP_KEYNS_ALL (PXA2X0_WAKEUP_KEYNS0| \
- PXA2X0_WAKEUP_KEYNS1|PXA2X0_WAKEUP_KEYNS2|PXA2X0_WAKEUP_KEYNS3| \
- PXA2X0_WAKEUP_KEYNS4|PXA2X0_WAKEUP_KEYNS5|PXA2X0_WAKEUP_KEYNS6)
-
-#define PXA2X0_WAKEUP_CF_ALL (PXA2X0_WAKEUP_CF0|PXA2X0_WAKEUP_CF1)
-
-#define PXA2X0_WAKEUP_ALL (PXA2X0_WAKEUP_POWERON| \
- PXA2X0_WAKEUP_GPIORST|PXA2X0_WAKEUP_SD|PXA2X0_WAKEUP_RC| \
- PXA2X0_WAKEUP_SYNC|PXA2X0_WAKEUP_KEYNS_ALL|PXA2X0_WAKEUP_CF_ALL| \
- PXA2X0_WAKEUP_USBD|PXA2X0_WAKEUP_LOCKSW|PXA2X0_WAKEUP_JACKIN| \
- PXA2X0_WAKEUP_CHRGFULL|PXA2X0_WAKEUP_RTC)
-
-void pxa2x0_wakeup_config(u_int, int);
-u_int pxa2x0_wakeup_status(void);
-
-#endif
diff --git a/sys/arch/arm/xscale/pxa2x0_apm_asm.S b/sys/arch/arm/xscale/pxa2x0_apm_asm.S
deleted file mode 100644
index 7ed388e463e..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_apm_asm.S
+++ /dev/null
@@ -1,588 +0,0 @@
-/* $OpenBSD: pxa2x0_apm_asm.S,v 1.6 2016/04/25 04:46:56 jsg Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <machine/asm.h>
-#include <arm/sysreg.h>
-#include <machine/cpu.h>
-
-#include <arch/arm/xscale/pxa2x0reg.h>
-#include <arch/arm/sa11x0/sa11x0_reg.h>
-
-/* XXX replace with values defined elsewhere. */
-#define DCACHE_CACHELINECOUNT 1024
-#define CACHELINESIZE 32
-#define DCACHE_SIZE (CACHELINESIZE * DCACHE_CACHELINECOUNT)
-
-/* cp14 register 6 */
-#define CLKCFG_T (1<<0) /* turbo */
-#define CLKCFG_F (1<<1) /* frequency change */
-#define CLKCFG_HT (1<<2) /* half-turbo */
-#define CLKCFG_B (1<<3) /* fast-bus */
-
-/* cp14 register 7 */
-#define PWRMODE_NORMAL (0<<0)
-#define PWRMODE_IDLE (1<<0)
-#define PWRMODE_STANDBY (2<<0)
-#define PWRMODE_SLEEP (3<<0)
-#define PWRMODE_DEEP_SLEEP (7<<0)
-
-/* XXX */
-#define MDREFR_C3000 (MDREFR_K0DB2|MDREFR_E1PIN|MDREFR_K1RUN|\
- MDREFR_K1DB2|MDREFR_K2DB2|MDREFR_APD)
-#define MDREFR_DRI_91MHZ (0x13<<0)
-#define MDREFR_HIGH (MDREFR_C3000 | 0x030)
-#define MDREFR_LOW (MDREFR_C3000 | 0x00b)
-#define MDREFR_SPEED_91 (MDREFR_C3000 | MDREFR_DRI_91MHZ)
-#define MDREFR_SPEED_LOW (MDREFR_C3000 | 0x017)
-#define MSC0_HIGH \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_NONBURST << 16) | \
- ( 2 << MSC_RRR_SHIFT) | \
- (13 << MSC_RDN_SHIFT) | \
- (13 << MSC_RDF_SHIFT) | \
- MSC_RBW /* PXA271 */ | \
- MSC_RT_NONBURST
-#define MSC1_HIGH \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_VLIO << 16) | \
- ( 3 << MSC_RRR_SHIFT) | \
- ( 4 << MSC_RDN_SHIFT) | \
- (13 << MSC_RDF_SHIFT) | \
- MSC_RT_VLIO
-#define MSC2_HIGH \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_NONBURST << 16) | \
- ( 3 << MSC_RRR_SHIFT) | \
- ( 4 << MSC_RDN_SHIFT) | \
- (13 << MSC_RDF_SHIFT) | \
- MSC_RT_VLIO
-#define MSC0_LOW \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_NONBURST << 16) | \
- ( 1 << MSC_RRR_SHIFT) | \
- ( 8 << MSC_RDN_SHIFT) | \
- ( 8 << MSC_RDF_SHIFT) | \
- MSC_RBW /* PXA271 */ | \
- MSC_RT_NONBURST
-#define MSC1_LOW \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_VLIO << 16) | \
- ( 1 << MSC_RRR_SHIFT) | \
- ( 2 << MSC_RDN_SHIFT) | \
- ( 6 << MSC_RDF_SHIFT) | \
- MSC_RT_VLIO
-#define MSC2_LOW \
- ( 7 << MSC_RRR_SHIFT << 16) | \
- (15 << MSC_RDN_SHIFT << 16) | \
- (15 << MSC_RDF_SHIFT << 16) | \
- (MSC_RT_NONBURST << 16) | \
- ( 1 << MSC_RRR_SHIFT) | \
- ( 2 << MSC_RDN_SHIFT) | \
- ( 6 << MSC_RDF_SHIFT) | \
- MSC_RT_VLIO
-
- .text
- .global _C_LABEL(vector_page)
- .global _C_LABEL(xscale_cache_clean_addr)
- .global _C_LABEL(pxa2x0_clkman_ioh)
- .global _C_LABEL(pxa2x0_memctl_ioh)
-
-.Lvector_page:
- .word _C_LABEL(vector_page)
-.Lxscale_cache_clean_addr:
- .word _C_LABEL(xscale_cache_clean_addr)
-
-.Lgpioiohp: .word _C_LABEL(pxa2x0_gpio_ioh)
-.Lclkmaniohp: .word _C_LABEL(pxa2x0_clkman_ioh)
-.Lmemctliohp: .word _C_LABEL(pxa2x0_memctl_ioh)
-
-.Lsleepdata: .word sleepdata
-.Lsleepdata_phys: .word sleepdata - 0xc0200000 + 0xa0200000 /* XXX */
-.Lsleepdata_svc: .word sleepdata_svc
-
-.Lcccr_high: .word CCCR_A | CCCR_TURBO_X2 | CCCR_RUN_X16
-.Lmdrefr_high: .word MDREFR_HIGH
-.Lmsc0_high: .word MSC0_HIGH
-.Lmsc1_high: .word MSC1_HIGH
-.Lmsc2_high: .word MSC2_HIGH
-.Lmdrefr_low: .word MDREFR_LOW
-.Lmsc0_low: .word MSC0_LOW
-.Lmsc1_low: .word MSC1_LOW
-.Lmsc2_low: .word MSC2_LOW
-
-/*
- * void pxa2x0_cpu_suspend(void)
- *
- * Enter sleep mode without automatic voltage change. The core must
- * be in low power mode, and interrupts disabled.
- */
-ENTRY(pxa2x0_cpu_suspend)
- stmdb sp!, {r0-r12, lr}
-
- ldr r3, .Lsleepdata /* Point to the data area. */
- ldr r2, =pxa2x0_cpu_resume_virt
- str r2, [r3], #4
-
- mrc CP15_SCTLR(r2) /* Load MMU control register. */
- mov r0, #0xff000000
- orr r0, r0, #0x00ff0000
- bic r2, r2, r0 /* Clear undefined bits. */
- str r2, [r3], #4 /* Save MMU control register. */
-
- mrc CP15_TTBR0(r2) /* Load TTB address. */
- mov r0, #0x00003f00
- orr r0, r0, #0x000000ff
- bic r2, r2, r0 /* Clear undefined bits. */
- str r2, [r3], #4 /* Save TTB address. */
-
- mrc CP15_DACR(r2) /* Load domain access control. */
- str r2, [r3], #4 /* Save domain access control. */
-
- mrs r2, spsr /* Load SVC saved CPSR. */
- str r2, [r3], #4 /* Save SVC saved CPSR. */
- str sp, [r3], #4 /* Save SVC stack pointer. */
-
- mov r1, #(PSR_FIQ32_MODE | PSR_I | PSR_F)
- msr cpsr, r1 /* Enter FIQ mode. */
- mrs r2, spsr /* Load FIQ mode saved CPSR. */
- stmia r3!, {r2, r8-r12, sp, lr} /* Save FIQ mode registers. */
-
- mov r1, #(PSR_IRQ32_MODE | PSR_I | PSR_F)
- msr cpsr, r1 /* Enter IRQ mode. */
- mrs r0, spsr /* Load IRQ mode saved CPSR. */
- stmia r3!, {r0, sp, lr} /* Save IRQ mode registers. */
-
- mov r1, #(PSR_ABT32_MODE | PSR_I | PSR_F)
- msr cpsr, r1 /* Enter ABT mode. */
- mrs r0, spsr /* Load ABT mode saved CPSR. */
- stmia r3!, {r0, sp, lr} /* Save ABT mode registers. */
-
- mov r1, #(PSR_UND32_MODE | PSR_I | PSR_F)
- msr cpsr, r1 /* Enter UND mode. */
- mrs r0, spsr /* Load UND mode saved CPSR. */
- stmia r3!, {r0, sp, lr} /* Save UND mode registers. */
-
- mov r1, #(PSR_SYS32_MODE | PSR_I | PSR_F)
- msr cpsr, r1 /* Enter SYS mode. */
- stmia r3!, {sp, lr} /* Save SYS mode registers. */
-
- mov r1, #(PSR_SVC32_MODE | PSR_I | PSR_F)
- msr cpsr, r1 /* Return to SVC mode. */
-
- /* At this point all critical registers have been saved. */
-
- mov r0, #0
- mcr CP15_CP15DSB(r0) /* drain write buffer */
-
- mov r1, #DCACHE_CACHELINECOUNT
- ldr r2, .Lxscale_cache_clean_addr
- ldr r0, [r2]
- /*
- * For an explanation of the following two instructions, refer
- * to the ``BUG ALERT'' section of the XSCALE_CACHE_CLEAN_PROLOGUE
- * macro in arch/arm/arm/cpufunc_asm_xscale.S.
- */
- eor r0, r0, #(DCACHE_SIZE)
- str r0, [r2]
-
-cache_flush_loop:
- mrs r2, cpsr
- orr r2, r2, #(PSR_I|PSR_F)
- msr cpsr_c, r2 /* disable IRQ/FIQ */
-
- mcr p15, 0, r0, c7, c2, 5 /* allocate cache line */
- mcr CP15_DCIMVAC(r0) /* flush D cache single entry */
-
- mrs r2, cpsr
- and r2, r2, #~(PSR_I|PSR_F)
- msr cpsr_c, r2 /* enable IRQ/FIQ */
-
- add r0, r0, #CACHELINESIZE
- subs r1, r1, #1
- bne cache_flush_loop
-
- mov r0, #0
- mcr CP15_CP15DSB(r0) /* drain write buffer */
-
- b 1f
-1:
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
-
- /* Prepare to enter sleep mode. */
- mov r1, #PWRMODE_SLEEP
-
- /* Prepare to put SDRAM into self-refresh mode. */
- ldr r4, .Lmemctliohp
- ldr r4, [r4]
- add r4, r4, #MEMCTL_MDREFR
- ldr r5, [r4]
- orr r5, r5, #MDREFR_SLFRSH
-
- /* XXX prepare pointer to physical address 0, but for whom? */
- ldr r2, .Lvector_page
-
- /*
- * Execute the rest of this routine from cache. The needed values
- * are now in registers.
- */
- b 1f
- /* XXX tell as(1) to dump the literal pool here, but why? */
- .ltorg
- .align 5
-1:
-
- /* Put SDRAM into self-refresh mode manually. */
- str r5, [r4]
- nop
-
- /*
- * Enter sleep mode. Exit from sleep mode returns the processor
- * to normal run mode. Execution resumes at the physical address
- * stored in the PSPR after the required boot sequence (a short
- * excursion into the ROM boot loader).
- */
- mcr p14, 0, r1, c7, c0, 0
-
- /* Just in case that wake-up does not resume at */
- nop
- nop
- nop
-1:
- b 1b
-
-/*
- * void pxa2x0_cpu_resume(void)
- */
- .align 5
-ENTRY(pxa2x0_cpu_resume)
- /* XXX C3000-specific */
- ldr r0, .Lmdrefr_addr_phys
- b 1f
- .align 5
-1:
- ldr r2, [r0]
- bic r2, r2, #MDREFR_DRI & 0x000000ff
- bic r2, r2, #MDREFR_DRI & 0x0000ff00
- orr r2, r2, #MDREFR_DRI_91MHZ
- str r2, [r0]
- b 1f
- .align 5
-1:
- ldr r0, .Lsleepdata_phys /* Point to PA of saved data. */
-
- ldmia r0!, {r7-r10}
- mcr CP15_DACR(r10) /* Restore domain access control. */
- mcr CP15_TTBR0(r9) /* Restore TTB address. */
- mcr CP15_TLBIALL(r0) /* Flush I+D TLBs. */
- mcr p15, 0, r0, c7, c7, 0 /* Flush I+D BTB. */
- mcr CP15_SCTLR(r8) /* Restore MMU control. */
- mov pc, r7 /* Jump to virtual address. */
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
-
-pxa2x0_cpu_resume_virt:
- ldr r2, .Lsleepdata_svc /* Load VA of saved registers. */
-
- /* Restore SVC mode SPSR and stack pointer. */
- ldr r0, [r2], #4
- msr spsr, r0
- ldr sp, [r2], #4
-
- /* Restore FIQ mode registers. */
- mov r1, #(PSR_FIQ32_MODE | PSR_I | PSR_F)
- msr cpsr, r1
- ldr r0, [r2], #4
- msr spsr, r0
- ldr r8, [r2], #4
- ldr r9, [r2], #4
- ldr r10, [r2], #4
- ldr r11, [r2], #4
- ldr r12, [r2], #4
- ldr sp, [r2], #4
- ldr lr, [r2], #4
-
- /* Restore IRQ mode registers. */
- mov r1, #(PSR_IRQ32_MODE | PSR_I | PSR_F)
- msr cpsr, r1
- ldr r0, [r2], #4
- msr spsr, r0
- ldr sp, [r2], #4
- ldr lr, [r2], #4
-
- /* Restore ABT mode registers. */
- mov r1, #(PSR_ABT32_MODE | PSR_I | PSR_F)
- msr cpsr, r1
- ldr r0, [r2], #4
- msr spsr, r0
- ldr sp, [r2], #4
- ldr lr, [r2], #4
-
- /* Restore UND mode registers. */
- mov r1, #(PSR_UND32_MODE | PSR_I | PSR_F)
- msr cpsr, r1
- ldr r0, [r2], #4
- msr spsr, r0
- ldr sp, [r2], #4
- ldr lr, [r2], #4
-
- /* Restore SYS mode registers. */
- mov r1, #(PSR_SYS32_MODE | PSR_I | PSR_F)
- msr cpsr, r1
- ldr sp, [r2], #4
- ldr lr, [r2], #4
-
- /* Return to SVC mode. */
- mov r1, #(PSR_SVC32_MODE | PSR_I | PSR_F)
- msr cpsr, r1
-
- ldmia sp!, {r0-r12, pc}
-
-.Lmdrefr_addr_phys:
- .word PXA2X0_MEMCTL_BASE + MEMCTL_MDREFR
-
- .data
-
-/*
- * Saved processor state
- */
- .align 5
-sleepdata:
- .word 0 /* =pxa2x0_cpu_resume_virt */
- .word 0 /* MMU control */
- .word 0 /* MMU TTB address */
- .word 0 /* MMU domain access control */
-sleepdata_svc:
- .word 0 /* SVC mode saved CPSR */
- .word 0 /* SVC mode stack pointer */
- .word 0 /* FIQ mode saved CPSR */
- .word 0 /* FIQ mode r8 */
- .word 0 /* FIQ mode r9 */
- .word 0 /* FIQ mode r10 */
- .word 0 /* FIQ mode r11 */
- .word 0 /* FIQ mode r12 */
- .word 0 /* FIQ mode stack pointer */
- .word 0 /* FIQ mode link register */
- .word 0 /* IRQ mode saved CPSR */
- .word 0 /* IRQ mode stack pointer */
- .word 0 /* IRQ mode link register */
- .word 0 /* ABT mode saved CPSR */
- .word 0 /* ABT mode stack pointer */
- .word 0 /* ABT mode link register */
- .word 0 /* UND mode saved CPSR */
- .word 0 /* UND mode stack pointer */
- .word 0 /* UND mode link register */
- .word 0 /* SYS mode stack pointer */
- .word 0 /* SYS mode link register */
-
- .text
-
-/*
- * void pxa27x_run_mode(void)
- *
- * Disable half-turbo and turbo mode, but keep fast-bus mode.
- * Memory and LCD clock is not changed, so no reconfiguration is
- * necessary.
- */
-ENTRY(pxa27x_run_mode)
- stmdb sp!, {r0}
- mrc p14, 0, r0, c6, c0, 0
- and r0, r0, #~(CLKCFG_HT | CLKCFG_F| CLKCFG_T)
- mcr p14, 0, r0, c6, c0, 0
- ldmia sp!, {r0}
- mov pc, lr
-
-/*
- * void pxa27x_fastbus_run_mode(int enable, u_int32_t mdrefr)
- *
- * Enter normal run mode with fast-bus mode enabled or disabled.
- * The new value of MDREFR is programmed before or after CLKCFG,
- * as appropriate.
- */
- .align 5
-ENTRY(pxa27x_fastbus_run_mode)
- stmdb sp!, {r0-r2, lr}
- ldr r2, .Lmemctliohp
- ldr r2, [r2]
- cmp r0, #0
- beq disable_fastbus
- b enable_fastbus
- .align 5
-enable_fastbus:
- /* Enter normal run mode with fast-bus mode enabled. */
- mov r0, #CLKCFG_B
- mcr p14, 0, r0, c6, c0, 0
- /* Set the new SDRAM refresh rate. */
- str r1, [r2, #MEMCTL_MDREFR]
- ldr r0, [r2, #MEMCTL_MDREFR]
- mov r0, r0
- ldmia sp!, {r0-r2, pc}
- .align 5
-disable_fastbus:
- /* Set the new SDRAM refresh rate. */
- str r1, [r2, #MEMCTL_MDREFR]
- ldr r0, [r2, #MEMCTL_MDREFR]
- mov r0, r0
- /* Enter normal run mode with fast-bus mode disabled. */
- mov r0, #0x0
- mcr p14, 0, r0, c6, c0, 0
- ldmia sp!, {r0-r2, pc}
-
-/* Keep these offsets in sync with struct memcfg. */
-#define memcfg_mdrefr_high 0x00
-#define memcfg_mdrefr_low 0x04
-#define memcfg_mdrefr_low2 0x08 /* unused */
-#define memcfg_msc_high 0x0c
-#define memcfg_msc_low 0x18
-#define memcfg_mdrefr_91 0x24
-
-/*
- * void pxa27x_frequency_change(int cccr, int clkcfg,
- * struct pxa2x0_memcfg *memcfg)
- *
- * Change the core PLL frequency and SDRAM refresh rate, ensuring the
- * proper sequence of operations. If the CCCR_A bit is clear and L
- * is not equal to 7 the result is undefined.
- */
- .align 5
-ENTRY(pxa27x_frequency_change)
- stmdb sp!, {r0-r5, lr}
-
- /* Always write to CCCR before a frequency change. */
- ldr r3, .Lclkmaniohp
- ldr r3, [r3]
- str r0, [r3, #CLKMAN_CCCR]
-
- /* Load the needed values into registers to avoid SDRAM access. */
- and r3, r0, #CCCR_L_MASK
- ldr r0, .Lmemctliohp
- ldr r0, [r0]
- cmp r3, #CCCR_RUN_X7 /* L=7 is 91MHz mode */
- beq frequency_change_91
- and r3, r1, #CLKCFG_B
- cmp r3, #CLKCFG_B
- bne frequency_change_208
- /* FALLTHROUGH */
-frequency_change_high:
- ldr r3, [r2, #memcfg_mdrefr_low]
- ldr r4, [r2, #memcfg_mdrefr_high]
- add r2, r2, #memcfg_msc_high
- bl frequency_change_on_cache /* XXX why BL? */
-frequency_change_208:
- ldr r3, [r2, #memcfg_mdrefr_low]
- ldr r4, [r2, #memcfg_mdrefr_low]
- add r2, r2, #memcfg_msc_high
- bl frequency_change_on_cache
-frequency_change_91:
- ldr r3, [r2, #memcfg_mdrefr_low]
- ldr r4, [r2, #memcfg_mdrefr_91]
- add r2, r2, #memcfg_msc_low
- bl frequency_change_on_cache
-
- /* Align execution to a cache line. */
- .align 5
-frequency_change_on_cache:
- /* Change to a low SDRAM refresh rate. Wait until the store to
- * MDREFR is complete, following section 2.4 I/O Ordering and
- * 6.5.1.4 of the PXA27x Developer's Manual. */
- str r3, [r0, #MEMCTL_MDREFR]
- ldr r5, [r0, #MEMCTL_MDREFR]
- mov r5, r5
- /* Program new CLKCFG value, starting a core PLL frequency change
- * if CLKCFG_F is set. */
- mcr p14, 0, r1, c6, c0, 0
- /* Change SDRAM clock frequency to 104MHz, and ensure that the
- * store to MDREFR is complete before the next SDRAM access. */
- str r4, [r0, #MEMCTL_MDREFR]
- ldr r5, [r0, #MEMCTL_MDREFR]
- mov r5, r5
- /* Configure synchronous, static, and VLIO interfaces. */
- ldr r1, [r2], #4
- str r1, [r0, #MEMCTL_MSC0]
- ldr r1, [r2], #4
- str r1, [r0, #MEMCTL_MSC1]
- ldr r1, [r2]
- str r1, [r0, #MEMCTL_MSC2]
- ldmia sp!, {r0-r5, pc}
-
-/*
- * void pxa27x_cpu_speed_91(void)
- *
- * Switch core run frequency to 91 MHz.
- */
- .align 5
-ENTRY(pxa27x_cpu_speed_91)
- stmdb sp!, {r0-r3, lr}
-
- ldr r0, .Lclkmaniohp
- ldr r0, [r0]
- ldr r1, .Lcccr_91
- str r1, [r0, #CLKMAN_CCCR]
-
- ldr r0, .Lmemctliohp
- ldr r0, [r0]
- ldr r2, .Lmdrefr_91
- ldr r3, .Lmdrefr_low
-
- bl 1f
- .align 5
-1:
- str r3, [r0, #MEMCTL_MDREFR]
- ldr r3, [r0, #MEMCTL_MDREFR]
-
- mov r1, #CLKCFG_F
- mcr p14, 0, r1, c6, c0, 0
- str r2, [r0, #MEMCTL_MDREFR]
- ldr r2, [r0, #MEMCTL_MDREFR]
-
- ldr r1, .Lmsc0_low
- str r1, [r0, #MEMCTL_MSC0]
- ldr r1, .Lmsc1_low
- str r1, [r0, #MEMCTL_MSC1]
- ldr r1, .Lmsc2_low
- str r1, [r0, #MEMCTL_MSC2]
-
- ldmia sp!, {r0-r3, pc}
-
-.Lcccr_91: .word CCCR_TURBO_X1 | CCCR_RUN_X7
-.Lmdrefr_91: .word MDREFR_SPEED_91
diff --git a/sys/arch/arm/xscale/pxa2x0_clock.c b/sys/arch/arm/xscale/pxa2x0_clock.c
deleted file mode 100644
index 89b9c444614..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_clock.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/* $OpenBSD: pxa2x0_clock.c,v 1.6 2008/01/03 17:59:32 kettenis Exp $ */
-
-/*
- * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/timetc.h>
-
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <arm/cpufunc.h>
-
-#include <arm/sa11x0/sa11x0_reg.h>
-#include <arm/sa11x0/sa11x0_var.h>
-#include <arm/sa11x0/sa11x0_ostreg.h>
-#include <arm/xscale/pxa2x0reg.h>
-
-int pxaost_match(struct device *, void *, void *);
-void pxaost_attach(struct device *, struct device *, void *);
-
-int doclockintr(void *);
-int clockintr(void *);
-int statintr(void *);
-void rtcinit(void);
-
-struct pxaost_softc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
-
- u_int32_t sc_clock_count;
- u_int32_t sc_statclock_count;
- u_int32_t sc_statclock_step;
- u_int32_t sc_clock_step;
- u_int32_t sc_clock_step_err_cnt;
- u_int32_t sc_clock_step_error;
-};
-
-static struct pxaost_softc *pxaost_sc = NULL;
-
-#define CLK4_TIMER_FREQUENCY 32768 /* 32.768KHz */
-
-#define CLK0_TIMER_FREQUENCY 3250000 /* 3.2500MHz */
-
-#ifndef STATHZ
-#define STATHZ 64
-#endif
-
-struct cfattach pxaost_ca = {
- sizeof (struct pxaost_softc), pxaost_match, pxaost_attach
-};
-
-struct cfdriver pxaost_cd = {
- NULL, "pxaost", DV_DULL
-};
-
-u_int pxaost_get_timecount(struct timecounter *tc);
-
-static struct timecounter pxaost_timecounter = {
- pxaost_get_timecount, NULL, 0xffffffff, CLK4_TIMER_FREQUENCY,
- "pxaost", 0, NULL
-};
-
-int
-pxaost_match(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- return (1);
-}
-
-void
-pxaost_attach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct pxaost_softc *sc = (struct pxaost_softc*)self;
- struct sa11x0_attach_args *sa = aux;
-
- printf("\n");
-
- sc->sc_iot = sa->sa_iot;
-
- pxaost_sc = sc;
-
- if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0,
- &sc->sc_ioh))
- panic("%s: Cannot map registers", self->dv_xname);
-
- /* disable all channel and clear interrupt status */
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, SAOST_IR, 0);
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, SAOST_SR, 0x3f);
-
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OMCR4, 0xc1);
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OMCR5, 0x41);
-
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OSMR4,
- pxaost_sc->sc_clock_count);
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OSMR5,
- pxaost_sc->sc_statclock_count);
-
- /* Zero the counter value */
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OSCR4, 0);
-
-}
-
-u_int
-pxaost_get_timecount(struct timecounter *tc)
-{
- return bus_space_read_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh,
- OST_OSCR4);
-}
-
-int
-clockintr(arg)
- void *arg;
-{
- struct clockframe *frame = arg;
- u_int32_t oscr, match;
- u_int32_t match_error;
-
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, SAOST_SR, 0x10);
-
- match = pxaost_sc->sc_clock_count;
-
- do {
- match += pxaost_sc->sc_clock_step;
- pxaost_sc->sc_clock_step_error +=
- pxaost_sc->sc_clock_step_err_cnt;
- if (pxaost_sc->sc_clock_count > hz) {
- match_error = pxaost_sc->sc_clock_step_error / hz;
- pxaost_sc->sc_clock_step_error -= (match_error * hz);
- match += match_error;
- }
- pxaost_sc->sc_clock_count = match;
- hardclock(frame);
-
- oscr = bus_space_read_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh,
- OST_OSCR4);
-
- } while ((signed)(oscr - match) > 0);
-
- /* prevent missed interrupts */
- if (oscr - match < 5)
- match += 5;
-
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OSMR4,
- match);
-
- return(1);
-}
-
-int
-statintr(arg)
- void *arg;
-{
- struct clockframe *frame = arg;
- u_int32_t oscr, match;
-
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, SAOST_SR, 0x20);
-
- /* schedule next clock intr */
- match = pxaost_sc->sc_statclock_count;
- do {
- match += pxaost_sc->sc_statclock_step;
- pxaost_sc->sc_statclock_count = match;
- statclock(frame);
-
- oscr = bus_space_read_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh,
- OST_OSCR4);
-
- } while ((signed)(oscr - match) > 0);
-
- /* prevent missed interrupts */
- if (oscr - match < 5)
- match += 5;
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OSMR5,
- match);
-
- return(1);
-}
-
-void
-setstatclockrate(int newstathz)
-{
- u_int32_t count;
- pxaost_sc->sc_statclock_step = CLK4_TIMER_FREQUENCY / newstathz;
- count = bus_space_read_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OSCR4);
- count += pxaost_sc->sc_statclock_step;
- pxaost_sc->sc_statclock_count = count;
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh,
- OST_OSMR5, count);
-}
-
-int
-doclockintr(void *arg)
-{
- u_int32_t status;
- int result = 0;
-
- status = bus_space_read_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, SAOST_SR);
- if (status & 0x10)
- result |= clockintr(arg);
- if (status & 0x20)
- result |= statintr(arg);
-
- return (result);
-}
-
-void
-cpu_initclocks()
-{
- u_int32_t clk;
-
- stathz = STATHZ;
- profhz = stathz;
- pxaost_sc->sc_statclock_step = CLK4_TIMER_FREQUENCY / stathz;
- pxaost_sc->sc_clock_step = CLK4_TIMER_FREQUENCY / hz;
- pxaost_sc->sc_clock_step_err_cnt = CLK4_TIMER_FREQUENCY % hz;
- pxaost_sc->sc_clock_step_error = 0;
-
- /* Use the channels 0 and 1 for hardclock and statclock, respectively */
- pxaost_sc->sc_clock_count = pxaost_sc->sc_clock_step;
- pxaost_sc->sc_statclock_count = CLK4_TIMER_FREQUENCY / stathz;
-
- pxa2x0_intr_establish(PXA2X0_INT_OST, IPL_CLOCK, doclockintr, 0, "clock");
-
- clk = bus_space_read_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OSCR4);
-
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, SAOST_SR, 0x3f);
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, SAOST_IR, 0x30);
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OSMR4,
- clk + pxaost_sc->sc_clock_count);
- bus_space_write_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh, OST_OSMR5,
- clk + pxaost_sc->sc_statclock_count);
-
- tc_init(&pxaost_timecounter);
-}
-
-void
-delay(usecs)
- u_int usecs;
-{
- u_int32_t clock, oclock, delta, delaycnt;
- volatile int j;
- int csec, usec;
-
- if (usecs > (0x80000000 / (CLK4_TIMER_FREQUENCY))) {
- csec = usecs / 10000;
- usec = usecs % 10000;
-
- delaycnt = (CLK4_TIMER_FREQUENCY / 100) * csec +
- (CLK4_TIMER_FREQUENCY / 100) * usec / 10000;
- } else {
- delaycnt = CLK4_TIMER_FREQUENCY * usecs / 1000000;
- }
-
- if (delaycnt <= 1)
- for (j = 100; j > 0; j--)
- ;
-
- if (!pxaost_sc) {
- /* clock isn't initialized yet */
- for (; usecs > 0; usecs--)
- for (j = 100; j > 0; j--)
- ;
- return;
- }
-
- oclock = bus_space_read_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh,
- OST_OSCR4);
-
- while (1) {
- for (j = 100; j > 0; j--)
- ;
- clock = bus_space_read_4(pxaost_sc->sc_iot, pxaost_sc->sc_ioh,
- OST_OSCR4);
- delta = clock - oclock;
- if (delta > delaycnt)
- break;
- }
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_com.c b/sys/arch/arm/xscale/pxa2x0_com.c
deleted file mode 100644
index 64a65bd880d..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_com.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* $OpenBSD: pxa2x0_com.c,v 1.12 2010/09/07 16:21:35 deraadt Exp $ */
-/* $NetBSD: pxa2x0_com.c,v 1.4 2003/07/15 00:24:55 lukem Exp $ */
-
-/*
- * Copyright 2003 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Steve C. Woodford for Wasabi Systems, Inc.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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 COM_PXA2X0
-#error "You must use options COM_PXA2X0 to get PXA2x0 serial port support"
-#endif
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/tty.h>
-
-#include <machine/intr.h>
-#include <machine/bus.h>
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-
-#define com_isr 8
-#define ISR_RECV (ISR_RXPL | ISR_XMODE | ISR_RCVEIR)
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-
-#ifdef __zaurus__
-#include <zaurus/dev/zaurus_scoopvar.h>
-#endif
-
-int pxauart_match(struct device *, void *, void *);
-void pxauart_attach(struct device *, struct device *, void *);
-int pxauart_activate(struct device *, int);
-
-struct cfattach com_pxaip_ca = {
- sizeof (struct com_softc), pxauart_match, pxauart_attach, NULL,
- pxauart_activate
-};
-
-int
-pxauart_match(struct device *parent, void *cf, void *aux)
-{
- struct pxaip_attach_args *pxa = aux;
- bus_space_tag_t bt = &pxa2x0_a4x_bs_tag; /* XXX: This sucks */
- bus_space_handle_t bh;
- int rv;
-
- switch (pxa->pxa_addr) {
- case PXA2X0_FFUART_BASE:
- if (pxa->pxa_intr != PXA2X0_INT_FFUART)
- return (0);
- break;
-
- case PXA2X0_STUART_BASE:
- if (pxa->pxa_intr != PXA2X0_INT_STUART)
- return (0);
- break;
-
- case PXA2X0_BTUART_BASE: /* XXX: Config file option ... */
- if (pxa->pxa_intr != PXA2X0_INT_BTUART)
- return (0);
- break;
-
- default:
- return (0);
- }
-
- pxa->pxa_size = 0x20;
-
- {
- extern bus_addr_t comconsaddr;
-
- if (comconsaddr == pxa->pxa_addr)
- return (1);
- }
-
- if (bus_space_map(bt, pxa->pxa_addr, pxa->pxa_size, 0, &bh))
- return (0);
-
- /* Make sure the UART is enabled */
- bus_space_write_1(bt, bh, com_ier, IER_EUART);
-
- rv = comprobe1(bt, bh);
- bus_space_unmap(bt, bh, pxa->pxa_size);
-
- return (rv);
-}
-
-void
-pxauart_attach(struct device *parent, struct device *self, void *aux)
-{
- struct com_softc *sc = (struct com_softc *)self;
- struct pxaip_attach_args *pxa = aux;
-
- sc->sc_iot = &pxa2x0_a4x_bs_tag; /* XXX: This sucks */
- sc->sc_iobase = pxa->pxa_addr;
- sc->sc_frequency = PXA2X0_COM_FREQ;
- sc->sc_uarttype = COM_UART_PXA2X0;
-
-#if 0
- if (com_is_console(sc->sc_iot, sc->sc_iobase, &sc->sc_ioh) == 0 &&
- bus_space_map(sc->sc_iot, sc->sc_iobase, pxa->pxa_size, 0,
- &sc->sc_ioh)) {
- printf(": can't map registers\n");
- return;
- }
-#endif
- bus_space_map(sc->sc_iot, sc->sc_iobase, pxa->pxa_size, 0, &sc->sc_ioh);
-
- com_attach_subr(sc);
-
- (void)pxa2x0_intr_establish(pxa->pxa_intr, IPL_TTY, comintr,
- sc, sc->sc_dev.dv_xname);
-}
-
-int
-pxauart_activate(struct device *self, int act)
-{
- struct com_softc *sc = (struct com_softc *)self;
- bus_space_tag_t iot = sc->sc_iot;
- bus_space_handle_t ioh = sc->sc_ioh;
- struct tty *tp = sc->sc_tty;
-
- switch (act) {
- case DVACT_SUSPEND:
-#ifdef __zaurus__
- if (sc->enabled && ISSET(sc->sc_hwflags, COM_HW_SIR))
- scoop_set_irled(0);
-#endif
- break;
- case DVACT_RESUME:
- if (sc->enabled) {
- sc->sc_initialize = 1;
- comparam(tp, &tp->t_termios);
- bus_space_write_1(iot, ioh, com_ier, sc->sc_ier);
-
- if (ISSET(sc->sc_hwflags, COM_HW_SIR)) {
-#ifdef __zaurus__
- scoop_set_irled(1);
-#endif
- bus_space_write_1(iot, ioh, com_isr,
- ISR_RECV);
- }
- }
- break;
- }
- return 0;
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_dma.c b/sys/arch/arm/xscale/pxa2x0_dma.c
deleted file mode 100644
index adc0a287d52..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_dma.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: pxa2x0_dma.c,v 1.4 2008/05/15 22:17:08 brad Exp $ */
-/* $NetBSD: pxa2x0_dma.c,v 1.3 2003/08/07 16:58:35 bsh Exp $ */
-
-/*
- * Copyright (c) 2002 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Genetec Corporation.
- * 4. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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.
- */
-
-/*
- * bus dma tag for PXA2[15]0 processor.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-
-#include <uvm/uvm_extern.h>
-
-#define _ARM32_BUS_DMA_PRIVATE
-#include <machine/bus.h>
-
-struct arm32_bus_dma_tag pxa2x0_bus_dma_tag = {
- 0,
- 0,
- NULL,
- _bus_dmamap_create,
- _bus_dmamap_destroy,
- _bus_dmamap_load,
- _bus_dmamap_load_mbuf,
- _bus_dmamap_load_uio,
- _bus_dmamap_load_raw,
- _bus_dmamap_unload,
- _bus_dmamap_sync,
- _bus_dmamem_alloc,
- _bus_dmamem_free,
- _bus_dmamem_map,
- _bus_dmamem_unmap,
- _bus_dmamem_mmap,
-};
-
diff --git a/sys/arch/arm/xscale/pxa2x0_dmac.c b/sys/arch/arm/xscale/pxa2x0_dmac.c
deleted file mode 100644
index 60bce8ac1ae..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_dmac.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/* $OpenBSD: pxa2x0_dmac.c,v 1.4 2012/12/05 23:20:11 deraadt Exp $ */
-
-/*
- * Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * DMA Controller Handler for the Intel PXA2X0 processor.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/evcount.h>
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/intr.h>
-#include <machine/lock.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_dmac.h>
-
-typedef void (*pxadmac_intrhandler)(void *);
-
-struct pxadmac_softc {
- struct device sc_dev;
- bus_space_tag_t sc_bust;
- bus_space_handle_t sc_bush;
- void *sc_ih;
- int sc_nchan;
- int sc_npri;
- pxadmac_intrhandler sc_intrhandlers[DMAC_N_CHANNELS_PXA27X];
- void *sc_intrargs[DMAC_N_CHANNELS_PXA27X];
-};
-
-int pxadmac_intr(void *);
-
-/*
- * DMAC autoconf glue
- */
-int pxadmac_match(struct device *, void *, void *);
-void pxadmac_attach(struct device *, struct device *, void *);
-
-struct cfattach pxadmac_ca = {
- sizeof(struct pxadmac_softc), pxadmac_match, pxadmac_attach
-};
-
-struct cfdriver pxadmac_cd = {
- NULL, "pxadmac", DV_DULL
-};
-
-static struct pxadmac_softc *pxadmac_softc = NULL;
-
-int
-pxadmac_match(struct device *parent, void *cf, void *aux)
-{
- struct pxaip_attach_args *pxa = aux;
-
- if (pxadmac_softc != NULL || pxa->pxa_addr != PXA2X0_DMAC_BASE)
- return (0);
-
- return (1);
-}
-
-void
-pxadmac_attach(struct device *parent, struct device *self, void *args)
-{
- struct pxadmac_softc *sc = (struct pxadmac_softc *)self;
- struct pxaip_attach_args *pxa = args;
- bus_size_t bus_size;
-
- sc->sc_bust = pxa->pxa_iot;
-
- printf(": DMA Controller\n");
-
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA27X) {
- sc->sc_nchan = DMAC_N_CHANNELS_PXA27X;
- sc->sc_npri = DMAC_N_PRIORITIES_PXA27X;
- bus_size = PXA27X_DMAC_SIZE;
- } else {
- sc->sc_nchan = DMAC_N_CHANNELS;
- sc->sc_npri = DMAC_N_PRIORITIES;
- bus_size = PXA2X0_DMAC_SIZE;
- }
-
- if (bus_space_map(sc->sc_bust, pxa->pxa_addr, bus_size, 0,
- &sc->sc_bush)) {
- printf("%s: Can't map registers!\n", sc->sc_dev.dv_xname);
- return;
- }
-
- sc->sc_ih = pxa2x0_intr_establish(pxa->pxa_intr, IPL_BIO,
- pxadmac_intr, sc, "pxadmac");
- if (sc->sc_ih == NULL) {
- printf(": unable to establish interrupt\n");
- bus_space_unmap(sc->sc_bust, sc->sc_bush, bus_size);
- return;
- }
-
- pxadmac_softc = sc;
-}
-
-/* Perform non-descriptor based DMA to a FIFO */
-int
-pxa2x0_dma_to_fifo(int periph, int chan, bus_addr_t fifo_addr, int width,
- int burstsize, bus_addr_t src_addr, int length, void (*intr)(void *),
- void *intrarg)
-{
- struct pxadmac_softc *sc = pxadmac_softc;
- uint32_t cmd;
-
- if (periph < 0 || periph > 63 || periph == 23) {
- printf("pxa2x0_dma_to_fifo: bogus peripheral %d", periph);
- return EINVAL;
- }
-
- if (chan < 0 || chan >= sc->sc_nchan) {
- printf("pxa2x0_dma_to_fifo: bogus dma channel %d", chan);
- return EINVAL;
- }
-
- if (length < 0 || length > DCMD_LENGTH_MASK) {
- printf("pxa2x0_dma_to_fifo: bogus length %d", length);
- return EINVAL;
- }
-
- cmd = (length & DCMD_LENGTH_MASK) | DCMD_INCSRCADDR | DCMD_FLOWTRG
- | DCMD_ENDIRQEN;
-
- switch (width) {
- case 1:
- cmd |= DCMD_WIDTH_1;
- break;
- case 4:
- cmd |= DCMD_WIDTH_4;
- break;
- default:
- printf("pxa2x0_dma_to_fifo: bogus width %d", width);
- return EINVAL;
- }
-
- switch (burstsize) {
- case 8:
- cmd |= DCMD_SIZE_8;
- break;
- case 16:
- cmd |= DCMD_SIZE_16;
- break;
- case 32:
- cmd |= DCMD_SIZE_32;
- break;
- default:
- printf("pxa2x0_dma_to_fifo: bogus burstsize %d", burstsize);
- return EINVAL;
- }
-
- /* XXX: abort anything already in progress, hopefully nothing. */
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DCSR(chan),
- DCSR_NODESCFETCH);
-
- /* Save handler for interrupt-on-completion. */
- sc->sc_intrhandlers[chan] = intr;
- sc->sc_intrargs[chan] = intrarg;
-
- /* Map peripheral to channel for flow control setup. */
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DRCMR(periph),
- chan | DRCMR_MAPVLD);
-
- /* Setup transfer addresses. */
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DDADR(chan),
- DDADR_STOP);
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DSADR(chan),
- src_addr);
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DTADR(chan),
- fifo_addr);
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DCMD(chan),
- cmd);
-
- /* Start the transfer. */
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DCSR(chan),
- DCSR_RUN | DCSR_NODESCFETCH);
-
- return 0;
-}
-
-/* Perform non-descriptor based DMA from a FIFO */
-int
-pxa2x0_dma_from_fifo(int periph, int chan, bus_addr_t fifo_addr, int width,
- int burstsize, bus_addr_t trg_addr, int length, void (*intr)(void *),
- void *intrarg)
-{
- struct pxadmac_softc *sc = pxadmac_softc;
- uint32_t cmd;
-
- if (periph < 0 || periph > 63 || periph == 23) {
- printf("pxa2x0_dma_from_fifo: bogus peripheral %d", periph);
- return EINVAL;
- }
-
- if (chan < 0 || chan >= sc->sc_nchan) {
- printf("pxa2x0_dma_from_fifo: bogus dma channel %d", chan);
- return EINVAL;
- }
-
- if (length < 0 || length > DCMD_LENGTH_MASK) {
- printf("pxa2x0_dma_from_fifo: bogus length %d", length);
- return EINVAL;
- }
-
- cmd = (length & DCMD_LENGTH_MASK) | DCMD_INCTRGADDR | DCMD_FLOWSRC
- | DCMD_ENDIRQEN;
-
- switch (width) {
- case 1:
- cmd |= DCMD_WIDTH_1;
- break;
- case 4:
- cmd |= DCMD_WIDTH_4;
- break;
- default:
- printf("pxa2x0_dma_from_fifo: bogus width %d", width);
- return EINVAL;
- }
-
- switch (burstsize) {
- case 8:
- cmd |= DCMD_SIZE_8;
- break;
- case 16:
- cmd |= DCMD_SIZE_16;
- break;
- case 32:
- cmd |= DCMD_SIZE_32;
- break;
- default:
- printf("pxa2x0_dma_from_fifo: bogus burstsize %d", burstsize);
- return EINVAL;
- }
-
- /* XXX: abort anything already in progress, hopefully nothing. */
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DCSR(chan),
- DCSR_NODESCFETCH);
-
- /* Save handler for interrupt-on-completion. */
- sc->sc_intrhandlers[chan] = intr;
- sc->sc_intrargs[chan] = intrarg;
-
- /* Map peripheral to channel for flow control setup. */
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DRCMR(periph),
- chan | DRCMR_MAPVLD);
-
- /* Setup transfer addresses. */
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DDADR(chan),
- DDADR_STOP);
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DSADR(chan),
- fifo_addr);
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DTADR(chan),
- trg_addr);
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DCMD(chan),
- cmd);
-
- /* Start the transfer. */
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DCSR(chan),
- DCSR_RUN | DCSR_NODESCFETCH);
-
- return 0;
-}
-
-int
-pxadmac_intr(void *v)
-{
- struct pxadmac_softc *sc = v;
- u_int32_t dint, dcsr;
- int chan;
-
- /* Interrupt for us? */
- dint = bus_space_read_4(sc->sc_bust, sc->sc_bush, DMAC_DINT);
- if (!dint)
- return 0;
-
- /* Process individual channels and run handlers. */
- /* XXX: this does not respect priority order for channels. */
- for (chan = 0; dint != 0 && chan < 32; chan++) {
- /* Don't ack channels that weren't ready at call time. */
- if ((dint & (1 << chan)) == 0)
- continue;
- dint &= ~(1 << chan);
-
- /* Acknowledge individual channel interrupt. */
- dcsr = bus_space_read_4(sc->sc_bust, sc->sc_bush,
- DMAC_DCSR(chan));
- bus_space_write_4(sc->sc_bust, sc->sc_bush, DMAC_DCSR(chan),
- dcsr & 0x7C80021F);
-
- /* Call the registered handler. */
- if (sc->sc_intrhandlers[chan])
- sc->sc_intrhandlers[chan](sc->sc_intrargs[chan]);
- }
-
- return 1;
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_dmac.h b/sys/arch/arm/xscale/pxa2x0_dmac.h
deleted file mode 100644
index 840965896b1..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_dmac.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $OpenBSD: pxa2x0_dmac.h,v 1.2 2006/04/04 11:37:05 pascoe Exp $ */
-
-/*
- * Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _PXA2X0_DMAC_H
-#define _PXA2X0_DMAC_H
-
-int pxa2x0_dma_to_fifo(int periph, int chan, bus_addr_t fifo_addr, int width,
- int burstsize, bus_addr_t src_addr, int length, void (*intr)(void *),
- void *intrarg);
-
-int pxa2x0_dma_from_fifo(int periph, int chan, bus_addr_t fifo_addr, int width,
- int burstsize, bus_addr_t trg_addr, int length, void (*intr)(void *),
- void *intrarg);
-
-#endif /* _PXA2X0_DMAC_H */
diff --git a/sys/arch/arm/xscale/pxa2x0_gpio.c b/sys/arch/arm/xscale/pxa2x0_gpio.c
deleted file mode 100644
index 5c86d1425af..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_gpio.c
+++ /dev/null
@@ -1,776 +0,0 @@
-/* $OpenBSD: pxa2x0_gpio.c,v 1.25 2016/01/31 00:14:50 jsg Exp $ */
-/* $NetBSD: pxa2x0_gpio.c,v 1.2 2003/07/15 00:24:55 lukem Exp $ */
-
-/*
- * Copyright 2003 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Steve C. Woodford for Wasabi Systems, Inc.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/evcount.h>
-
-#include <machine/intr.h>
-#include <machine/bus.h>
-
-#include <arm/cpufunc.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-struct gpio_irq_handler {
- struct gpio_irq_handler *gh_next;
- int (*gh_func)(void *);
- void *gh_arg;
- int gh_spl;
- u_int gh_gpio;
- int gh_level;
- int gh_irq;
- struct evcount gh_count;
-};
-
-struct pxagpio_softc {
- struct device sc_dev;
- bus_space_tag_t sc_bust;
- bus_space_handle_t sc_bush;
- void *sc_irqcookie[4];
- u_int32_t sc_mask[3];
-#ifdef PXAGPIO_HAS_GPION_INTRS
- struct gpio_irq_handler *sc_handlers[GPIO_NPINS];
- int sc_minipl;
- int sc_maxipl;
-#else
- struct gpio_irq_handler *sc_handlers[2];
-#endif
- int npins;
- int pxa27x_pins;
-};
-
-int pxagpio_match(struct device *, void *, void *);
-void pxagpio_attach(struct device *, struct device *, void *);
-
-#ifdef __NetBSD__
-CFATTACH_DECL(pxagpio, sizeof(struct pxagpio_softc),
- pxagpio_match, pxagpio_attach, NULL, NULL);
-#else
-struct cfattach pxagpio_ca = {
- sizeof (struct pxagpio_softc), pxagpio_match, pxagpio_attach
-};
-
-struct cfdriver pxagpio_cd = {
- NULL, "pxagpio", DV_DULL
-};
-
-#endif
-
-static struct pxagpio_softc *pxagpio_softc;
-static vaddr_t pxagpio_regs;
-#define GPIO_BOOTSTRAP_REG(reg) \
- (*((volatile u_int32_t *)(pxagpio_regs + (reg))))
-
-void pxa2x0_gpio_set_intr_level(u_int, int);
-int pxagpio_intr0(void *);
-int pxagpio_intr1(void *);
-#ifdef PXAGPIO_HAS_GPION_INTRS
-int pxagpio_dispatch(struct pxagpio_softc *, int);
-int pxagpio_intrN(void *);
-int pxagpio_intrlow(void *);
-void pxa2x0_gpio_intr_fixup(int minipl, int maxipl);
-#endif
-u_int32_t pxagpio_reg_read(struct pxagpio_softc *sc, int reg);
-void pxagpio_reg_write(struct pxagpio_softc *sc, int reg, u_int32_t val);
-
-u_int32_t
-pxagpio_reg_read(struct pxagpio_softc *sc, int reg)
-{
- if (__predict_true(sc != NULL))
- return (bus_space_read_4(sc->sc_bust, sc->sc_bush, reg));
- else
- if (pxagpio_regs)
- return (GPIO_BOOTSTRAP_REG(reg));
- panic("pxagpio_reg_read: not bootstrapped");
-}
-
-void
-pxagpio_reg_write(struct pxagpio_softc *sc, int reg, u_int32_t val)
-{
- if (__predict_true(sc != NULL))
- bus_space_write_4(sc->sc_bust, sc->sc_bush, reg, val);
- else
- if (pxagpio_regs)
- GPIO_BOOTSTRAP_REG(reg) = val;
- else
- panic("pxagpio_reg_write: not bootstrapped");
- return;
-}
-
-int
-pxagpio_match(struct device *parent, void *cf, void *aux)
-{
- struct pxaip_attach_args *pxa = aux;
-
- if (pxagpio_softc != NULL || pxa->pxa_addr != PXA2X0_GPIO_BASE)
- return (0);
-
- pxa->pxa_size = PXA2X0_GPIO_SIZE;
-
- return (1);
-}
-
-void
-pxagpio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct pxagpio_softc *sc = (struct pxagpio_softc *)self;
- struct pxaip_attach_args *pxa = aux;
-
- sc->sc_bust = pxa->pxa_iot;
-
- printf(": GPIO Controller\n");
-
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA27X) {
- sc->npins = GPIO_NPINS;
- sc->pxa27x_pins = 1;
- } else {
- sc->npins = GPIO_NPINS_25x;
- sc->pxa27x_pins = 0;
- }
-
- if (bus_space_map(sc->sc_bust, pxa->pxa_addr, pxa->pxa_size, 0,
- &sc->sc_bush)) {
- printf("%s: Can't map registers!\n", sc->sc_dev.dv_xname);
- return;
- }
-
- memset(sc->sc_handlers, 0, sizeof(sc->sc_handlers));
-
- /*
- * Disable all GPIO interrupts
- */
- pxagpio_reg_write(sc, GPIO_GRER0, 0);
- pxagpio_reg_write(sc, GPIO_GRER1, 0);
- pxagpio_reg_write(sc, GPIO_GRER2, 0);
- pxagpio_reg_write(sc, GPIO_GRER3, 0);
- pxagpio_reg_write(sc, GPIO_GFER0, 0);
- pxagpio_reg_write(sc, GPIO_GFER1, 0);
- pxagpio_reg_write(sc, GPIO_GFER2, 0);
- pxagpio_reg_write(sc, GPIO_GFER3, 0);
- pxagpio_reg_write(sc, GPIO_GEDR0, ~0);
- pxagpio_reg_write(sc, GPIO_GEDR1, ~0);
- pxagpio_reg_write(sc, GPIO_GEDR2, ~0);
- pxagpio_reg_write(sc, GPIO_GEDR3, ~0);
-
-#ifdef PXAGPIO_HAS_GPION_INTRS
- sc->sc_minipl = IPL_NONE;
- sc->sc_maxipl = IPL_NONE;
-#endif
-
- sc->sc_irqcookie[0] = sc->sc_irqcookie[1] = NULL;
-
- pxagpio_softc = sc;
-}
-
-void
-pxa2x0_gpio_bootstrap(vaddr_t gpio_regs)
-{
-
- pxagpio_regs = gpio_regs;
-}
-
-void *
-pxa2x0_gpio_intr_establish(u_int gpio, int level, int spl, int (*func)(void *),
- void *arg, const char *name)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- struct gpio_irq_handler *gh;
- u_int32_t bit;
-
-#ifdef DEBUG
-#ifdef PXAGPIO_HAS_GPION_INTRS
- if (gpio >= sc->npins)
- panic("pxa2x0_gpio_intr_establish: bad pin number: %d", gpio);
-#else
- if (gpio > 1)
- panic("pxa2x0_gpio_intr_establish: bad pin number: %d", gpio);
-#endif
-#endif
-
- if (GPIO_FN_IS_OUT(pxa2x0_gpio_get_function(gpio)) != GPIO_IN)
- panic("pxa2x0_gpio_intr_establish: Pin %d not GPIO_IN", gpio);
-
- gh = (struct gpio_irq_handler *)malloc(sizeof(struct gpio_irq_handler),
- M_DEVBUF, M_NOWAIT);
-
- gh->gh_func = func;
- gh->gh_arg = arg;
- gh->gh_spl = spl;
- gh->gh_gpio = gpio;
- gh->gh_irq = gpio+32;
- gh->gh_level = level;
- evcount_attach(&gh->gh_count, name, &gh->gh_irq);
-
- gh->gh_next = sc->sc_handlers[gpio];
- sc->sc_handlers[gpio] = gh;
-
- if (gpio == 0) {
- KDASSERT(sc->sc_irqcookie[0] == NULL);
- sc->sc_irqcookie[0] = pxa2x0_intr_establish(PXA2X0_INT_GPIO0,
- spl, pxagpio_intr0, sc, NULL);
- KDASSERT(sc->sc_irqcookie[0]);
- } else if (gpio == 1) {
- KDASSERT(sc->sc_irqcookie[1] == NULL);
- sc->sc_irqcookie[1] = pxa2x0_intr_establish(PXA2X0_INT_GPIO1,
- spl, pxagpio_intr1, sc, NULL);
- KDASSERT(sc->sc_irqcookie[1]);
- } else {
-#ifdef PXAGPIO_HAS_GPION_INTRS
- int minipl, maxipl;
-
- if (sc->sc_maxipl == IPL_NONE || spl > sc->sc_maxipl) {
- maxipl = spl;
- } else {
- maxipl = sc->sc_maxipl;
- }
-
-
- if (sc->sc_minipl == IPL_NONE || spl < sc->sc_minipl) {
- minipl = spl;
- } else {
- minipl = sc->sc_minipl;
- }
- pxa2x0_gpio_intr_fixup(minipl, maxipl);
-#endif
- }
-
- bit = GPIO_BIT(gpio);
- sc->sc_mask[GPIO_BANK(gpio)] |= bit;
-
- pxa2x0_gpio_set_intr_level(gpio, gh->gh_level);
-
- return (gh);
-}
-
-void
-pxa2x0_gpio_intr_disestablish(void *cookie)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- struct gpio_irq_handler *gh = cookie;
- u_int32_t bit, reg;
-
- evcount_detach(&gh->gh_count);
-
- bit = GPIO_BIT(gh->gh_gpio);
-
- reg = pxagpio_reg_read(sc, GPIO_REG(GPIO_GFER0, gh->gh_gpio));
- reg &= ~bit;
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GFER0, gh->gh_gpio), reg);
- reg = pxagpio_reg_read(sc, GPIO_REG(GPIO_GRER0, gh->gh_gpio));
- reg &= ~bit;
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GRER0, gh->gh_gpio), reg);
-
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GEDR0, gh->gh_gpio), bit);
-
- sc->sc_mask[GPIO_BANK(gh->gh_gpio)] &= ~bit;
- sc->sc_handlers[gh->gh_gpio] = NULL;
-
- if (gh->gh_gpio == 0) {
- pxa2x0_intr_disestablish(sc->sc_irqcookie[0]);
- sc->sc_irqcookie[0] = NULL;
- } else if (gh->gh_gpio == 1) {
- pxa2x0_intr_disestablish(sc->sc_irqcookie[1]);
- sc->sc_irqcookie[1] = NULL;
- } else {
-#ifdef PXAGPIO_HAS_GPION_INTRS
- int i, minipl, maxipl, ipl;
- minipl = IPL_HIGH;
- maxipl = IPL_NONE;
- for (i = 2; i < sc->npins; i++) {
- if (sc->sc_handlers[i] != NULL) {
- ipl = sc->sc_handlers[i]->gh_spl;
- if (minipl > ipl)
- minipl = ipl;
-
- if (maxipl < ipl)
- maxipl = ipl;
- }
- }
- pxa2x0_gpio_intr_fixup(minipl, maxipl);
-#endif /* PXAGPIO_HAS_GPION_INTRS */
- }
-
- free(gh, M_DEVBUF, 0);
-}
-
-#ifdef PXAGPIO_HAS_GPION_INTRS
-void
-pxa2x0_gpio_intr_fixup(int minipl, int maxipl)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- int save = disable_interrupts(PSR_I);
-
- if (maxipl == IPL_NONE && minipl == IPL_HIGH) {
- /* no remaining interrupts */
- if (sc->sc_irqcookie[2])
- pxa2x0_intr_disestablish(sc->sc_irqcookie[2]);
- sc->sc_irqcookie[2] = NULL;
- if (sc->sc_irqcookie[3])
- pxa2x0_intr_disestablish(sc->sc_irqcookie[3]);
- sc->sc_irqcookie[3] = NULL;
- sc->sc_minipl = IPL_NONE;
- sc->sc_maxipl = IPL_NONE;
- restore_interrupts(save);
- return;
- }
-
- if (sc->sc_maxipl == IPL_NONE || maxipl > sc->sc_maxipl) {
- if (sc->sc_irqcookie[2])
- pxa2x0_intr_disestablish(sc->sc_irqcookie[2]);
-
- sc->sc_maxipl = maxipl;
- sc->sc_irqcookie[2] =
- pxa2x0_intr_establish(PXA2X0_INT_GPION,
- maxipl, pxagpio_intrN, sc, NULL);
-
- if (sc->sc_irqcookie[2] == NULL) {
- printf("%s: failed to hook main "
- "GPIO interrupt\n",
- sc->sc_dev.dv_xname);
- /* XXX - panic? */
- }
- }
- if (sc->sc_minipl == IPL_NONE || minipl < sc->sc_minipl) {
- if (sc->sc_irqcookie[3])
- pxa2x0_intr_disestablish(sc->sc_irqcookie[3]);
-
- sc->sc_minipl = minipl;
- sc->sc_irqcookie[3] =
- pxa2x0_intr_establish(PXA2X0_INT_GPION,
- sc->sc_minipl, pxagpio_intrlow, sc, NULL);
-
- if (sc->sc_irqcookie[3] == NULL) {
- printf("%s: failed to hook main "
- "GPIO interrupt\n",
- sc->sc_dev.dv_xname);
- /* XXX - panic? */
- }
- }
- restore_interrupts(save);
-}
-#endif /* PXAGPIO_HAS_GPION_INTRS */
-
-const char *
-pxa2x0_gpio_intr_string(void *cookie)
-{
- static char irqstr[32];
- struct gpio_irq_handler *gh = cookie;
-
- if (gh == NULL)
- snprintf(irqstr, sizeof irqstr, "couldn't establish interrupt");
- else
- snprintf(irqstr, sizeof irqstr, "irq %d", gh->gh_irq);
- return(irqstr);
-}
-
-
-int
-pxagpio_intr0(void *arg)
-{
- struct pxagpio_softc *sc = arg;
- int ret;
-
-#ifdef DIAGNOSTIC
- if (sc->sc_handlers[0] == NULL) {
- printf("%s: stray GPIO#0 edge interrupt\n",
- sc->sc_dev.dv_xname);
- return (0);
- }
-#endif
-
- bus_space_write_4(sc->sc_bust, sc->sc_bush, GPIO_REG(GPIO_GEDR0, 0),
- GPIO_BIT(0));
-
- ret = (sc->sc_handlers[0]->gh_func)(sc->sc_handlers[0]->gh_arg);
- if (ret != 0)
- sc->sc_handlers[0]->gh_count.ec_count++;
- return ret;
-}
-
-int
-pxagpio_intr1(void *arg)
-{
- struct pxagpio_softc *sc = arg;
- int ret;
-
-#ifdef DIAGNOSTIC
- if (sc->sc_handlers[1] == NULL) {
- printf("%s: stray GPIO#1 edge interrupt\n",
- sc->sc_dev.dv_xname);
- return (0);
- }
-#endif
-
- bus_space_write_4(sc->sc_bust, sc->sc_bush, GPIO_REG(GPIO_GEDR0, 1),
- GPIO_BIT(1));
-
- ret = (sc->sc_handlers[1]->gh_func)(sc->sc_handlers[1]->gh_arg);
- if (ret != 0)
- sc->sc_handlers[1]->gh_count.ec_count++;
- return ret;
-}
-
-#ifdef PXAGPIO_HAS_GPION_INTRS
-int
-pxagpio_dispatch(struct pxagpio_softc *sc, int gpio_base)
-{
- struct gpio_irq_handler **ghp, *gh;
- int i, s, nhandled, handled, pins;
- u_int32_t gedr, mask;
- int bank;
-
- /* Fetch bitmap of pending interrupts on this GPIO bank */
- gedr = pxagpio_reg_read(sc, GPIO_REG(GPIO_GEDR0, gpio_base));
-
- /* Don't handle GPIO 0/1 here */
- if (gpio_base == 0)
- gedr &= ~(GPIO_BIT(0) | GPIO_BIT(1));
-
- /* Bail early if there are no pending interrupts in this bank */
- if (gedr == 0)
- return (0);
-
- /* Acknowledge pending interrupts. */
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GEDR0, gpio_base), gedr);
-
- bank = GPIO_BANK(gpio_base);
-
- /*
- * We're only interested in those for which we have a handler
- * registered
- */
-#ifdef DEBUG
- if ((gedr & sc->sc_mask[bank]) == 0) {
- printf("%s: stray GPIO interrupt. Bank %d, GEDR 0x%08x, mask 0x%08x\n",
- sc->sc_dev.dv_xname, bank, gedr, sc->sc_mask[bank]);
- return (1); /* XXX: Pretend we dealt with it */
- }
-#endif
-
- gedr &= sc->sc_mask[bank];
- ghp = &sc->sc_handlers[gpio_base];
- if (sc->pxa27x_pins == 1)
- pins = (gpio_base < 96) ? 32 : 25;
- else
- pins = (gpio_base < 64) ? 32 : 17;
- handled = 0;
-
- for (i = 0, mask = 1; i < pins && gedr; i++, ghp++, mask <<= 1) {
- if ((gedr & mask) == 0)
- continue;
- gedr &= ~mask;
-
- if ((gh = *ghp) == NULL) {
- printf("%s: unhandled GPIO interrupt. GPIO#%d\n",
- sc->sc_dev.dv_xname, gpio_base + i);
- continue;
- }
-
- s = _splraise(gh->gh_spl);
- do {
- nhandled = (gh->gh_func)(gh->gh_arg);
- if (nhandled != 0)
- gh->gh_count.ec_count++;
- handled |= nhandled;
- gh = gh->gh_next;
- } while (gh != NULL);
- splx(s);
- }
-
- return (handled);
-}
-
-int
-pxagpio_intrN(void *arg)
-{
- struct pxagpio_softc *sc = arg;
- int handled;
-
- handled = pxagpio_dispatch(sc, 0);
- handled |= pxagpio_dispatch(sc, 32);
- handled |= pxagpio_dispatch(sc, 64);
- handled |= pxagpio_dispatch(sc, 96);
-
- return (handled);
-}
-
-int
-pxagpio_intrlow(void *arg)
-{
- /* dummy */
- return 0;
-}
-#endif /* PXAGPIO_HAS_GPION_INTRS */
-
-u_int
-pxa2x0_gpio_get_function(u_int gpio)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- u_int32_t rv, io;
-
- if (__predict_true(sc != NULL))
- KDASSERT(gpio < sc->npins);
-
- rv = pxagpio_reg_read(sc, GPIO_FN_REG(gpio)) >> GPIO_FN_SHIFT(gpio);
- rv = GPIO_FN(rv);
-
- io = pxagpio_reg_read(sc, GPIO_REG(GPIO_GPDR0, gpio));
- if (io & GPIO_BIT(gpio))
- rv |= GPIO_OUT;
-
- io = pxagpio_reg_read(sc, GPIO_REG(GPIO_GPLR0, gpio));
- if (io & GPIO_BIT(gpio))
- rv |= GPIO_SET;
-
- return (rv);
-}
-
-u_int
-pxa2x0_gpio_set_function(u_int gpio, u_int fn)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- u_int32_t rv, bit;
- u_int oldfn;
-
- if (__predict_true(sc != NULL))
- KDASSERT(gpio < sc->npins);
-
- oldfn = pxa2x0_gpio_get_function(gpio);
-
- if (GPIO_FN(fn) == GPIO_FN(oldfn) &&
- GPIO_FN_IS_OUT(fn) == GPIO_FN_IS_OUT(oldfn)) {
- /*
- * The pin's function is not changing.
- * For Alternate Functions and GPIO input, we can just
- * return now.
- * For GPIO output pins, check the initial state is
- * the same.
- *
- * Return 'fn' instead of 'oldfn' so the caller can
- * reliably detect that we didn't change anything.
- * (The initial state might be different for non-
- * GPIO output pins).
- */
- if (!GPIO_IS_GPIO_OUT(fn) ||
- GPIO_FN_IS_SET(fn) == GPIO_FN_IS_SET(oldfn))
- return (fn);
- }
-
- /*
- * See section 4.1.3.7 of the PXA2x0 Developer's Manual for
- * the correct procedure for changing GPIO pin functions.
- */
-
- bit = GPIO_BIT(gpio);
-
- /*
- * 1. Configure the correct set/clear state of the pin
- */
- if (GPIO_FN_IS_SET(fn))
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GPSR0, gpio), bit);
- else
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GPCR0, gpio), bit);
-
- /*
- * 2. Configure the pin as an input or output as appropriate
- */
- rv = pxagpio_reg_read(sc, GPIO_REG(GPIO_GPDR0, gpio)) & ~bit;
- if (GPIO_FN_IS_OUT(fn))
- rv |= bit;
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GPDR0, gpio), rv);
-
- /*
- * 3. Configure the pin's function
- */
- bit = GPIO_FN_MASK << GPIO_FN_SHIFT(gpio);
- fn = GPIO_FN(fn) << GPIO_FN_SHIFT(gpio);
- rv = pxagpio_reg_read(sc, GPIO_FN_REG(gpio)) & ~bit;
- pxagpio_reg_write(sc, GPIO_FN_REG(gpio), rv | fn);
-
- return (oldfn);
-}
-
-/*
- * Quick function to read pin value
- */
-int
-pxa2x0_gpio_get_bit(u_int gpio)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- int bit;
-
- bit = GPIO_BIT(gpio);
- if (pxagpio_reg_read(sc, GPIO_REG(GPIO_GPLR0, gpio)) & bit)
- return 1;
- else
- return 0;
-}
-
-/*
- * Quick function to set pin to 1
- */
-void
-pxa2x0_gpio_set_bit(u_int gpio)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- int bit;
-
- bit = GPIO_BIT(gpio);
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GPSR0, gpio), bit);
-}
-
-/*
- * Quick function to set pin to 0
- */
-void
-pxa2x0_gpio_clear_bit(u_int gpio)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- int bit;
-
- bit = GPIO_BIT(gpio);
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GPCR0, gpio), bit);
-}
-
-/*
- * Quick function to change pin direction
- */
-void
-pxa2x0_gpio_set_dir(u_int gpio, int dir)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- int bit;
- u_int32_t reg;
-
- bit = GPIO_BIT(gpio);
-
- reg = pxagpio_reg_read(sc, GPIO_REG(GPIO_GPDR0, gpio)) & ~bit;
- if (GPIO_FN_IS_OUT(dir))
- reg |= bit;
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GPDR0, gpio), reg);
-}
-
-/*
- * Quick function to clear interrupt status on a pin
- * GPIO pins may be toggle in an interrupt and we dont want
- * extra spurious interrupts to occur.
- * Suppose this causes a slight race if a key is pressed while
- * the interrupt handler is running. (yes this is for the keyboard driver)
- */
-void
-pxa2x0_gpio_clear_intr(u_int gpio)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- int bit;
-
- bit = GPIO_BIT(gpio);
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GEDR0, gpio), bit);
-}
-
-/*
- * Quick function to mask (disable) a GPIO interrupt
- */
-void
-pxa2x0_gpio_intr_mask(void *v)
-{
- struct gpio_irq_handler *gh = v;
-
- pxa2x0_gpio_set_intr_level(gh->gh_gpio, IPL_NONE);
-}
-
-/*
- * Quick function to unmask (enable) a GPIO interrupt
- */
-void
-pxa2x0_gpio_intr_unmask(void *v)
-{
- struct gpio_irq_handler *gh = v;
-
- pxa2x0_gpio_set_intr_level(gh->gh_gpio, gh->gh_level);
-}
-
-/*
- * Configure the edge sensitivity of interrupt pins
- */
-void
-pxa2x0_gpio_set_intr_level(u_int gpio, int level)
-{
- struct pxagpio_softc *sc = pxagpio_softc;
- u_int32_t bit;
- u_int32_t gfer;
- u_int32_t grer;
- int s;
-
- s = splhigh();
-
- bit = GPIO_BIT(gpio);
- gfer = pxagpio_reg_read(sc, GPIO_REG(GPIO_GFER0, gpio));
- grer = pxagpio_reg_read(sc, GPIO_REG(GPIO_GRER0, gpio));
-
- switch (level) {
- case IST_NONE:
- gfer &= ~bit;
- grer &= ~bit;
- break;
- case IST_EDGE_FALLING:
- gfer |= bit;
- grer &= ~bit;
- break;
- case IST_EDGE_RISING:
- gfer &= ~bit;
- grer |= bit;
- break;
- case IST_EDGE_BOTH:
- gfer |= bit;
- grer |= bit;
- break;
- default:
- panic("pxa2x0_gpio_set_intr_level: bad level: %d", level);
- break;
- }
-
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GFER0, gpio), gfer);
- pxagpio_reg_write(sc, GPIO_REG(GPIO_GRER0, gpio), grer);
-
- splx(s);
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_gpio.h b/sys/arch/arm/xscale/pxa2x0_gpio.h
deleted file mode 100644
index bab08809bb4..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_gpio.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: pxa2x0_gpio.h,v 1.6 2009/08/22 02:54:50 mk Exp $ */
-/* $wasabi$ */
-
-/*
- * Copyright 2003 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Steve C. Woodford for Wasabi Systems, Inc.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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 _PXA2X0_GPIO_H
-#define _PXA2X0_GPIO_H
-
-/*
- * If you want to fiddle with GPIO registers before the
- * driver has been autoconfigured (e.g. from initarm()),
- * call this function with the virtual address of the
- * GPIO controller's registers
- */
-void pxa2x0_gpio_bootstrap(vaddr_t);
-
-/*
- * GPIO pin function query/manipulation functions
- */
-u_int pxa2x0_gpio_get_function(u_int);
-u_int pxa2x0_gpio_set_function(u_int, u_int);
-int pxa2x0_gpio_get_bit(u_int gpio);
-void pxa2x0_gpio_set_bit(u_int gpio);
-void pxa2x0_gpio_clear_bit(u_int gpio);
-void pxa2x0_gpio_set_dir(u_int gpio, int dir);
-void pxa2x0_gpio_clear_intr(u_int gpio);
-
-/*
- * Establish/Disestablish interrupt handlers for GPIO pins
- */
-void *pxa2x0_gpio_intr_establish(u_int, int, int, int (*)(void *), void *,
- const char *);
-void pxa2x0_gpio_intr_disestablish(void *);
-const char *pxa2x0_gpio_intr_string(void *);
-void pxa2x0_gpio_intr_mask(void *);
-void pxa2x0_gpio_intr_unmask(void *);
-
-#endif /* _PXA2X0_GPIO_H */
diff --git a/sys/arch/arm/xscale/pxa2x0_i2c.c b/sys/arch/arm/xscale/pxa2x0_i2c.c
deleted file mode 100644
index 014cc9c82bb..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_i2c.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/* $OpenBSD: pxa2x0_i2c.c,v 1.2 2005/05/26 03:52:07 pascoe Exp $ */
-
-/*
- * Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_i2c.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-#define I2C_RETRY_COUNT 10
-
-int
-pxa2x0_i2c_attach_sub(struct pxa2x0_i2c_softc *sc)
-{
- if (bus_space_map(sc->sc_iot, PXA2X0_I2C_BASE,
- PXA2X0_I2C_SIZE, 0, &sc->sc_ioh)) {
- sc->sc_size = 0;
- return EIO;
- }
- bus_space_barrier(sc->sc_iot, sc->sc_ioh, 0, sc->sc_size,
- BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
-
- /*
- * Configure the alternate functions. The _IN is arbitrary, as the
- * direction is managed by the I2C unit when comms are in progress.
- */
- pxa2x0_gpio_set_function(117, GPIO_ALT_FN_1_IN); /* SCL */
- pxa2x0_gpio_set_function(118, GPIO_ALT_FN_1_IN); /* SDA */
-
- pxa2x0_i2c_init(sc);
-
- return 0;
-}
-
-int
-pxa2x0_i2c_detach_sub(struct pxa2x0_i2c_softc *sc)
-{
- if (sc->sc_size) {
- bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_size);
- sc->sc_size = 0;
- }
- pxa2x0_clkman_config(CKEN_I2C, 0);
-
- return 0;
-}
-
-void
-pxa2x0_i2c_init(struct pxa2x0_i2c_softc *sc)
-{
- pxa2x0_i2c_open(sc);
- pxa2x0_i2c_close(sc);
-}
-
-void
-pxa2x0_i2c_open(struct pxa2x0_i2c_softc *sc)
-{
- /* Enable the clock to the standard I2C unit. */
- pxa2x0_clkman_config(CKEN_I2C, 1);
-}
-
-void
-pxa2x0_i2c_close(struct pxa2x0_i2c_softc *sc)
-{
- /* Reset and disable the standard I2C unit. */
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2C_ICR, ICR_UR);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2C_ISAR, 0);
- delay(1);
- pxa2x0_clkman_config(CKEN_I2C, 0);
-}
-
-int
-pxa2x0_i2c_read(struct pxa2x0_i2c_softc *sc, u_char slave, u_char *valuep)
-{
- u_int32_t rv;
- int timeout;
- int tries = I2C_RETRY_COUNT;
- bus_space_tag_t iot = sc->sc_iot;
- bus_space_handle_t ioh = sc->sc_ioh;
-
-retry:
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_UR);
- bus_space_write_4(iot, ioh, I2C_ISAR, 0x00);
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE | ISR_IRF);
- delay(1);
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_IUE | ICR_SCLE);
-
- /* Write slave device address. */
- bus_space_write_4(iot, ioh, I2C_IDBR, (slave<<1) | 0x1);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_START);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_STOP);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ITE) == 0) {
- if (timeout-- == 0)
- goto err;
- delay(1);
- }
-
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
-
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_START);
-
- /* Read data value. */
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv |
- (ICR_STOP | ICR_ACKNAK));
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_IRF) == 0) {
- if (timeout-- == 0)
- goto err;
- delay(1);
- }
-
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_IRF);
-
- rv = bus_space_read_4(iot, ioh, I2C_IDBR);
- *valuep = (u_char)rv;
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv &
- ~(ICR_STOP | ICR_ACKNAK));
-
- return (0);
-err:
- if (tries-- >= 0)
- goto retry;
-
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_UR);
- bus_space_write_4(iot, ioh, I2C_ISAR, 0x00);
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE | ISR_IRF);
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_IUE | ICR_SCLE);
-
- return (-EIO);
-}
-
-int
-pxa2x0_i2c_write(struct pxa2x0_i2c_softc *sc, u_char slave, u_char value)
-{
- u_int32_t rv;
- int timeout;
- int tries = I2C_RETRY_COUNT;
- bus_space_tag_t iot = sc->sc_iot;
- bus_space_handle_t ioh = sc->sc_ioh;
-
-retry:
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_UR);
- bus_space_write_4(iot, ioh, I2C_ISAR, 0x00);
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
- delay(1);
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_IUE | ICR_SCLE);
-
- /* Write slave device address. */
- bus_space_write_4(iot, ioh, I2C_IDBR, (slave<<1));
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_START);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_STOP);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ITE) == 0) {
- if (timeout-- == 0)
- goto err;
- delay(1);
- }
- if ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ACKNAK) != 0)
- goto err;
-
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
-
- /* Write data. */
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_START);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_STOP);
- bus_space_write_4(iot, ioh, I2C_IDBR, value);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ITE) == 0) {
- if (timeout-- == 0)
- goto err;
- delay(1);
- }
- if ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ACKNAK) != 0)
- goto err;
-
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
-
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_STOP);
-
- return (0);
-err:
- if (tries-- >= 0)
- goto retry;
-
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_UR);
- bus_space_write_4(iot, ioh, I2C_ISAR, 0x00);
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_IUE | ICR_SCLE);
-
- return (-EIO);
-}
-
-int
-pxa2x0_i2c_write_2(struct pxa2x0_i2c_softc *sc, u_char slave, u_short value)
-{
- u_int32_t rv;
- int timeout;
- int tries = I2C_RETRY_COUNT;
- bus_space_tag_t iot = sc->sc_iot;
- bus_space_handle_t ioh = sc->sc_ioh;
-
-retry:
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_UR);
- bus_space_write_4(iot, ioh, I2C_ISAR, 0x00);
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
- delay(1);
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_IUE | ICR_SCLE);
-
- /* Write slave device address. */
- bus_space_write_4(iot, ioh, I2C_IDBR, (slave<<1));
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_START);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_STOP);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ITE) == 0) {
- if (timeout-- == 0)
- goto err;
- delay(1);
- }
- if ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ACKNAK) != 0)
- goto err;
-
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
-
- /* Write upper 8 bits of data. */
- bus_space_write_4(iot, ioh, I2C_IDBR, (value >> 8) & 0xff);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_START);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_STOP);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ITE) == 0) {
- if (timeout-- == 0)
- goto err;
- delay(1);
- }
- if ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ACKNAK) != 0)
- goto err;
-
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
-
- /* Write lower 8 bits of data. */
- bus_space_write_4(iot, ioh, I2C_IDBR, value & 0xff);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_START);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_STOP);
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv | ICR_TB);
-
- timeout = 10000;
- while ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ITE) == 0) {
- if (timeout-- == 0)
- goto err;
- delay(1);
- }
- if ((bus_space_read_4(iot, ioh, I2C_ISR) & ISR_ACKNAK) != 0)
- goto err;
-
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
-
- rv = bus_space_read_4(iot, ioh, I2C_ICR);
- bus_space_write_4(iot, ioh, I2C_ICR, rv & ~ICR_STOP);
-
- return (0);
-err:
- if (tries-- >= 0)
- goto retry;
-
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_UR);
- bus_space_write_4(iot, ioh, I2C_ISAR, 0x00);
- bus_space_write_4(iot, ioh, I2C_ISR, ISR_ITE);
- bus_space_write_4(iot, ioh, I2C_ICR, ICR_IUE | ICR_SCLE);
-
- return (-EIO);
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_i2c.h b/sys/arch/arm/xscale/pxa2x0_i2c.h
deleted file mode 100644
index fb5c9144515..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_i2c.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: pxa2x0_i2c.h,v 1.2 2005/05/26 03:52:07 pascoe Exp $ */
-
-/*
- * Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _PXA2X0_I2C_H_
-#define _PXA2X0_I2C_H_
-
-#include <machine/bus.h>
-
-struct pxa2x0_i2c_softc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_size_t sc_size;
-};
-
-int pxa2x0_i2c_attach_sub(struct pxa2x0_i2c_softc *);
-int pxa2x0_i2c_detach_sub(struct pxa2x0_i2c_softc *);
-void pxa2x0_i2c_init(struct pxa2x0_i2c_softc *);
-void pxa2x0_i2c_open(struct pxa2x0_i2c_softc *);
-void pxa2x0_i2c_close(struct pxa2x0_i2c_softc *);
-int pxa2x0_i2c_read(struct pxa2x0_i2c_softc *sc, u_char, u_char *);
-int pxa2x0_i2c_write(struct pxa2x0_i2c_softc *, u_char, u_char);
-int pxa2x0_i2c_write_2(struct pxa2x0_i2c_softc *, u_char, u_short);
-
-#endif
diff --git a/sys/arch/arm/xscale/pxa2x0_i2s.c b/sys/arch/arm/xscale/pxa2x0_i2s.c
deleted file mode 100644
index ccefc84081b..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_i2s.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/* $OpenBSD: pxa2x0_i2s.c,v 1.8 2014/07/12 18:44:41 tedu Exp $ */
-
-/*
- * Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-#include <arm/xscale/pxa2x0_i2s.h>
-#include <arm/xscale/pxa2x0_dmac.h>
-
-struct pxa2x0_i2s_dma {
- struct pxa2x0_i2s_dma *next;
- caddr_t addr;
- size_t size;
- bus_dmamap_t map;
- bus_dma_segment_t seg;
-};
-
-void
-pxa2x0_i2s_init(struct pxa2x0_i2s_softc *sc)
-{
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2S_SACR0, SACR0_RST);
- delay(100);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2S_SACR0,
- SACR0_BCKD | SACR0_SET_TFTH(7) | SACR0_SET_RFTH(7));
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2S_SACR1, 0);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2S_SADR, 0);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2S_SADIV, sc->sc_sadiv);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2S_SACR0,
- SACR0_BCKD | SACR0_SET_TFTH(7) | SACR0_SET_RFTH(7) | SACR0_ENB);
-}
-
-int
-pxa2x0_i2s_attach_sub(struct pxa2x0_i2s_softc *sc)
-{
- if (bus_space_map(sc->sc_iot, PXA2X0_I2S_BASE, PXA2X0_I2S_SIZE, 0,
- &sc->sc_ioh)) {
- sc->sc_size = 0;
- return 1;
- }
- sc->sc_sadiv = SADIV_3_058MHz;
-
- bus_space_barrier(sc->sc_iot, sc->sc_ioh, 0, sc->sc_size,
- BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
-
- pxa2x0_gpio_set_function(28, GPIO_ALT_FN_1_OUT); /* I2S_BITCLK */
- pxa2x0_gpio_set_function(113, GPIO_ALT_FN_1_OUT); /* I2S_SYSCLK */
- pxa2x0_gpio_set_function(31, GPIO_ALT_FN_1_OUT); /* I2S_SYNC */
- pxa2x0_gpio_set_function(30, GPIO_ALT_FN_1_OUT); /* I2S_SDATA_OUT */
- pxa2x0_gpio_set_function(29, GPIO_ALT_FN_2_IN); /* I2S_SDATA_IN */
-
- pxa2x0_i2s_init(sc);
-
- return 0;
-}
-
-void pxa2x0_i2s_open(struct pxa2x0_i2s_softc *sc)
-{
- sc->sc_open++;
- pxa2x0_clkman_config(CKEN_I2S, 1);
-}
-
-void pxa2x0_i2s_close(struct pxa2x0_i2s_softc *sc)
-{
- pxa2x0_clkman_config(CKEN_I2S, 0);
- sc->sc_open--;
-}
-
-int
-pxa2x0_i2s_detach_sub(struct pxa2x0_i2s_softc *sc)
-{
- if (sc->sc_size > 0) {
- bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_size);
- sc->sc_size = 0;
- }
- pxa2x0_clkman_config(CKEN_I2S, 0);
-
- return (0);
-}
-
-void pxa2x0_i2s_write(struct pxa2x0_i2s_softc *sc, u_int32_t data)
-{
- if (! sc->sc_open)
- return;
-
- /* Clear intr and underrun bit if set. */
- if (bus_space_read_4(sc->sc_iot, sc->sc_ioh, I2S_SASR0) & SASR0_TUR)
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2S_SAICR, SAICR_TUR);
-
- /* Wait for transmit fifo to have space. */
- while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, I2S_SASR0) & SASR0_TNF)
- == 0)
- ; /* nothing */
-
- /* Queue data */
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2S_SADR, data);
-}
-
-void
-pxa2x0_i2s_setspeed(struct pxa2x0_i2s_softc *sc, u_long *argp)
-{
- /*
- * The available speeds are in the following table.
- * Keep the speeds in increasing order.
- */
- typedef struct {
- int speed;
- int div;
- } speed_struct;
- u_long arg = *argp;
-
- static speed_struct speed_table[] = {
- {8000, SADIV_513_25kHz},
- {11025, SADIV_702_75kHz},
- {16000, SADIV_1_026MHz},
- {22050, SADIV_1_405MHz},
- {44100, SADIV_2_836MHz},
- {48000, SADIV_3_058MHz},
- };
-
- int i, n, selected = -1;
-
- n = sizeof(speed_table) / sizeof(speed_struct);
-
- if (arg < speed_table[0].speed)
- selected = 0;
- if (arg > speed_table[n - 1].speed)
- selected = n - 1;
-
- for (i = 1; selected == -1 && i < n; i++) {
- if (speed_table[i].speed == arg)
- selected = i;
- else if (speed_table[i].speed > arg) {
- int diff1, diff2;
-
- diff1 = arg - speed_table[i - 1].speed;
- diff2 = speed_table[i].speed - arg;
- if (diff1 < diff2)
- selected = i - 1;
- else
- selected = i;
- }
- }
-
- if (selected == -1)
- selected = 0;
-
- *argp = speed_table[selected].speed;
-
- sc->sc_sadiv = speed_table[selected].div;
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, I2S_SADIV, sc->sc_sadiv);
-}
-
-void *
-pxa2x0_i2s_allocm(void *hdl, int direction, size_t size, int type, int flags)
-{
- struct device *sc_dev = hdl;
- struct pxa2x0_i2s_softc *sc =
- (struct pxa2x0_i2s_softc *)((struct device *)hdl + 1);
- struct pxa2x0_i2s_dma *p;
- int error;
- int rseg;
-
- p = malloc(sizeof(*p), type, flags);
- if (!p)
- return 0;
-
- p->size = size;
- if ((error = bus_dmamem_alloc(sc->sc_dmat, size, NBPG, 0, &p->seg, 1,
- &rseg, BUS_DMA_NOWAIT)) != 0) {
- printf("%s: unable to allocate dma, error = %d\n",
- sc_dev->dv_xname, error);
- goto fail_alloc;
- }
-
- if ((error = bus_dmamem_map(sc->sc_dmat, &p->seg, rseg, size, &p->addr,
- BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) {
- printf("%s: unable to map dma, error = %d\n",
- sc_dev->dv_xname, error);
- goto fail_map;
- }
-
- if ((error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0,
- BUS_DMA_NOWAIT, &p->map)) != 0) {
- printf("%s: unable to create dma map, error = %d\n",
- sc_dev->dv_xname, error);
- goto fail_create;
- }
-
- if ((error = bus_dmamap_load(sc->sc_dmat, p->map, p->addr, size, NULL,
- BUS_DMA_NOWAIT)) != 0) {
- printf("%s: unable to load dma map, error = %d\n",
- sc_dev->dv_xname, error);
- goto fail_load;
- }
-
- p->next = sc->sc_dmas;
- sc->sc_dmas = p;
-
- return p->addr;
-
-fail_load:
- bus_dmamap_destroy(sc->sc_dmat, p->map);
-fail_create:
- bus_dmamem_unmap(sc->sc_dmat, p->addr, size);
-fail_map:
- bus_dmamem_free(sc->sc_dmat, &p->seg, 1);
-fail_alloc:
- free(p, type, 0);
- return 0;
-}
-
-void
-pxa2x0_i2s_freem(void *hdl, void *ptr, int type)
-{
- struct pxa2x0_i2s_softc *sc =
- (struct pxa2x0_i2s_softc *)((struct device *)hdl + 1);
- struct pxa2x0_i2s_dma **pp, *p;
-
- for (pp = &(sc->sc_dmas); (p = *pp) != NULL; pp = &p->next)
- if (p->addr == ptr) {
- bus_dmamap_unload(sc->sc_dmat, p->map);
- bus_dmamap_destroy(sc->sc_dmat, p->map);
- bus_dmamem_unmap(sc->sc_dmat, p->addr, p->size);
- bus_dmamem_free(sc->sc_dmat, &p->seg, 1);
-
- *pp = p->next;
- free(p, type, 0);
- return;
- }
-
- panic("pxa2x0_i2s_freem: trying to free unallocated memory");
-}
-
-paddr_t
-pxa2x0_i2s_mappage(void *hdl, void *mem, off_t off, int prot)
-{
- struct pxa2x0_i2s_softc *sc =
- (struct pxa2x0_i2s_softc *)((struct device *)hdl + 1);
- struct pxa2x0_i2s_dma *p;
-
- if (off < 0)
- return -1;
-
- for (p = sc->sc_dmas; p && p->addr != mem; p = p->next)
- ;
- if (!p)
- return -1;
-
- if (off > p->size)
- return -1;
-
- return bus_dmamem_mmap(sc->sc_dmat, &p->seg, 1, off, prot,
- BUS_DMA_WAITOK);
-}
-
-int
-pxa2x0_i2s_round_blocksize(void *hdl, int bs)
-{
- /* Enforce individual DMA block size limit */
- if (bs > DCMD_LENGTH_MASK)
- return (DCMD_LENGTH_MASK & ~0x03);
-
- return (bs + 0x03) & ~0x03; /* 32-bit multiples */
-}
-
-size_t
-pxa2x0_i2s_round_buffersize(void *hdl, int direction, size_t bufsize)
-{
- return bufsize;
-}
-
-int
-pxa2x0_i2s_start_output(struct pxa2x0_i2s_softc *sc, void *block, int bsize,
- void (*intr)(void *), void *intrarg)
-{
- struct pxa2x0_i2s_dma *p;
- int offset;
-
- /* Find mapping which contains block completely */
- for (p = sc->sc_dmas; p && (((caddr_t)block < p->addr) ||
- ((caddr_t)block + bsize > p->addr + p->size)); p = p->next)
- ; /* Nothing */
-
- if (!p) {
- printf("pxa2x0_i2s_start_output: request with bad start "
- "address: %p, size: %d)\n", block, bsize);
- return ENXIO;
- }
-
- /* Offset into block to use in mapped block */
- offset = (caddr_t)block - p->addr;
-
- /* Start DMA */
- pxa2x0_dma_to_fifo(3, 1, 0x40400080, 4, 32,
- p->map->dm_segs[0].ds_addr + offset, bsize, intr, intrarg);
-
- return 0;
-}
-
-int
-pxa2x0_i2s_start_input(struct pxa2x0_i2s_softc *sc, void *block, int bsize,
- void (*intr)(void *), void *intrarg)
-{
- struct pxa2x0_i2s_dma *p;
- int offset;
-
- /* Find mapping which contains block completely */
- for (p = sc->sc_dmas; p && (((caddr_t)block < p->addr) ||
- ((caddr_t)block + bsize > p->addr + p->size)); p = p->next)
- ; /* Nothing */
-
- if (!p) {
- printf("pxa2x0_i2s_start_input: request with bad start "
- "address: %p, size: %d)\n", block, bsize);
- return ENXIO;
- }
-
- /* Offset into block to use in mapped block */
- offset = (caddr_t)block - p->addr;
-
- /* Start DMA */
- pxa2x0_dma_from_fifo(2, 2, 0x40400080, 4, 32,
- p->map->dm_segs[0].ds_addr + offset, bsize, intr, intrarg);
-
- return 0;
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_i2s.h b/sys/arch/arm/xscale/pxa2x0_i2s.h
deleted file mode 100644
index 09aed24746d..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_i2s.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: pxa2x0_i2s.h,v 1.3 2006/04/04 11:45:40 pascoe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _PXA2X0_I2S_H_
-#define _PXA2X0_I2S_H_
-
-#include <machine/bus.h>
-
-struct pxa2x0_i2s_dma;
-
-struct pxa2x0_i2s_softc {
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_size_t sc_size;
- bus_dma_tag_t sc_dmat;
-
- int sc_open;
- u_int32_t sc_sadiv;
-
- struct pxa2x0_i2s_dma *sc_dmas;
-};
-
-void pxa2x0_i2s_init(struct pxa2x0_i2s_softc *sc);
-int pxa2x0_i2s_attach_sub(struct pxa2x0_i2s_softc *);
-int pxa2x0_i2s_detach_sub(struct pxa2x0_i2s_softc *);
-void pxa2x0_i2s_open(struct pxa2x0_i2s_softc *);
-void pxa2x0_i2s_close(struct pxa2x0_i2s_softc *);
-void pxa2x0_i2s_write(struct pxa2x0_i2s_softc *, u_int32_t);
-
-void pxa2x0_i2s_setspeed(struct pxa2x0_i2s_softc *, u_long *);
-
-void * pxa2x0_i2s_allocm(void *, int, size_t, int, int);
-void pxa2x0_i2s_freem(void *, void *, int);
-paddr_t pxa2x0_i2s_mappage(void *, void *, off_t, int);
-int pxa2x0_i2s_round_blocksize(void *, int);
-size_t pxa2x0_i2s_round_buffersize(void *, int, size_t);
-
-int pxa2x0_i2s_start_output(struct pxa2x0_i2s_softc *, void *, int,
- void (*)(void *), void *);
-int pxa2x0_i2s_start_input(struct pxa2x0_i2s_softc *, void *, int,
- void (*)(void *), void *);
-
-#endif
diff --git a/sys/arch/arm/xscale/pxa2x0_intr.c b/sys/arch/arm/xscale/pxa2x0_intr.c
deleted file mode 100644
index 9c959b19c04..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_intr.c
+++ /dev/null
@@ -1,711 +0,0 @@
-/* $OpenBSD: pxa2x0_intr.c,v 1.28 2016/04/03 10:29:41 jsg Exp $ */
-/* $NetBSD: pxa2x0_intr.c,v 1.5 2003/07/15 00:24:55 lukem Exp $ */
-
-/*
- * Copyright (c) 2002 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Genetec Corporation.
- * 4. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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.
- */
-
-/*
- * IRQ handler for the Intel PXA2X0 processor.
- * It has integrated interrupt controller.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/evcount.h>
-#include <sys/queue.h>
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_intr.h>
-#include <arm/sa11x0/sa11x0_var.h>
-
-/*
- * INTC autoconf glue
- */
-int pxaintc_match(struct device *, void *, void *);
-void pxaintc_attach(struct device *, struct device *, void *);
-
-#ifdef __NetBSD__
-CFATTACH_DECL(pxaintc, sizeof(struct device),
- pxaintc_match, pxaintc_attach, NULL, NULL);
-#else
-struct cfattach pxaintc_ca = {
- sizeof(struct device), pxaintc_match, pxaintc_attach
-};
-
-struct cfdriver pxaintc_cd = {
- NULL, "pxaintc", DV_DULL
-};
-
-#endif
-
-static int pxaintc_attached;
-
-int pxa2x0_stray_interrupt(void *);
-void pxa2x0_init_interrupt_masks(void);
-
-/*
- * interrupt dispatch table.
- */
-#if 1
-#define MULTIPLE_HANDLERS_ON_ONE_IRQ
-#endif
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
-struct intrhand {
- TAILQ_ENTRY(intrhand) ih_list; /* link on intrq list */
- int (*ih_func)(void *); /* handler */
- void *ih_arg; /* arg for handler */
- char *ih_name;
- struct evcount ih_count;
- int ih_irq;
- int ih_level;
-};
-#endif
-
-static struct intrhandler{
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- TAILQ_HEAD(,intrhand) list;
-#else
- pxa2x0_irq_handler_t func;
- char *name;
- void *arg; /* NULL for stackframe */
- int ih_irq;
- struct evcount ih_count;
-#endif
-} handler[ICU_LEN];
-
-volatile int softint_pending;
-volatile int current_spl_level;
-/* interrupt masks for each level */
-int pxa2x0_imask[NIPL];
-static int extirq_level[ICU_LEN];
-
-
-int
-pxaintc_match(struct device *parent, void *cf, void *aux)
-{
- struct pxaip_attach_args *pxa = aux;
-
- if (pxaintc_attached || pxa->pxa_addr != PXA2X0_INTCTL_BASE)
- return (0);
-
- return (1);
-}
-
-void
-pxaintc_attach(struct device *parent, struct device *self, void *args)
-{
- int i;
-
- pxaintc_attached = 1;
-
- printf(": Interrupt Controller\n");
-
-#define SAIPIC_ICCR 0x14
-
- write_icu(SAIPIC_ICCR, 1);
- write_icu(SAIPIC_MR, 0);
-
- for(i = 0; i < sizeof handler / sizeof handler[0]; ++i){
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- TAILQ_INIT(&handler[i].list);
- extirq_level[i] = IPL_NONE;
-#else
- handler[i].name = "stray";
- handler[i].func = pxa2x0_stray_interrupt;
- handler[i].arg = (void *)(u_int32_t) i;
- extirq_level[i] = IPL_HIGH;
-#endif
-
- }
-
- pxa2x0_init_interrupt_masks();
-
- _splraise(IPL_HIGH);
- enable_interrupts(PSR_I);
-}
-
-/*
- * Invoked very early on from the board-specific initarm(), in order to
- * inform us the virtual address of the interrupt controller's registers.
- */
-vaddr_t pxaic_base;
-void
-pxa2x0_intr_bootstrap(vaddr_t addr)
-{
-
- pxaic_base = addr;
-}
-
-/*
- * PXA27x has MSL interface and SSP3 interrupts [0,1], USIM interface
- * and SSP2 interrupts [15,16]. PXA255 has bits [0..6,15] reserved and
- * bit [16] network SSP interrupt. We don't need any of those, so we
- * map software interrupts to bits [0..1,15..16]. Sadly there are no
- * four contiguous bits safe enough to use on both processors.
- */
-#define SI_TO_IRQBIT(si) ((si) < 2 ? 1U<<(si) : 1U<<(15-2+(si)))
-
-/*
- * Map a software interrupt queue to an interrupt priority level.
- */
-static const int si_to_ipl[SI_NQUEUES] = {
- IPL_SOFT, /* SI_SOFT */
- IPL_SOFTCLOCK, /* SI_SOFTCLOCK */
- IPL_SOFTNET, /* SI_SOFTNET */
- IPL_SOFTTTY, /* SI_SOFTTTY */
-};
-
-/*
- * called from irq_entry.
- */
-void
-pxa2x0_irq_handler(void *arg)
-{
- struct clockframe *frame = arg;
- uint32_t irqbits;
- int irqno;
- int saved_spl_level;
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- struct intrhand *ih;
-#endif
-
- saved_spl_level = current_spl_level;
-
- /* get pending IRQs */
- irqbits = read_icu(SAIPIC_IP);
-
- while ((irqno = find_first_bit(irqbits)) >= 0) {
- /* XXX: Should we handle IRQs in priority order? */
-
- /* raise spl to stop interrupts of lower priorities */
- if (saved_spl_level < extirq_level[irqno])
- pxa2x0_setipl(extirq_level[irqno]);
-
- /* Enable interrupt */
- enable_interrupts(PSR_I);
-
-#ifndef MULTIPLE_HANDLERS_ON_ONE_IRQ
- (* handler[irqno].func)(
- handler[irqno].arg == 0
- ? frame : handler[irqno].arg );
- handler[irqno].ih_count.ec_count++;
-#else
- TAILQ_FOREACH(ih, &handler[irqno].list, ih_list) {
- if ((ih->ih_func)( ih->ih_arg == 0
- ? frame : ih->ih_arg))
- ih->ih_count.ec_count++;
- }
-#endif
-
- /* Disable interrupt */
- disable_interrupts(PSR_I);
-
- irqbits &= ~(1<<irqno);
- }
-
- /* restore spl to that was when this interrupt happen */
- pxa2x0_setipl(saved_spl_level);
-
- if(softint_pending & pxa2x0_imask[current_spl_level])
- pxa2x0_do_pending();
-}
-
-int
-pxa2x0_stray_interrupt(void *cookie)
-{
- int irqno = (int)cookie;
- printf("stray interrupt %d\n", irqno);
-
- if (PXA2X0_IRQ_MIN <= irqno && irqno < ICU_LEN){
- int save = disable_interrupts(PSR_I);
- write_icu(SAIPIC_MR,
- read_icu(SAIPIC_MR) & ~(1U<<irqno));
- restore_interrupts(save);
- }
-
- return 0;
-}
-
-
-
-/*
- * Interrupt Mask Handling
- */
-
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
-void pxa2x0_update_intr_masks(void);
-
-void
-pxa2x0_update_intr_masks()
-#else
-void pxa2x0_update_intr_masks(int irqno, int level);
-
-void
-pxa2x0_update_intr_masks(int irqno, int irqlevel)
-#endif
-{
- int psw;
-
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- int irq;
-#ifdef DEBUG
- int level;
-#endif
- struct intrhand *ih;
- psw = disable_interrupts(PSR_I);
-
- /* First figure out which levels each IRQ uses. */
- for (irq = 0; irq < ICU_LEN; irq++) {
- int i;
- int max = IPL_NONE;
- int min = IPL_HIGH;
- TAILQ_FOREACH(ih, &handler[irq].list, ih_list) {
- if (ih->ih_level > max)
- max = ih->ih_level;
-
- if (ih->ih_level < min)
- min = ih->ih_level;
- }
-
- extirq_level[irq] = max;
-
- if (min == IPL_HIGH)
- min = IPL_NONE;
-
- /* Enable interrupt at lower level */
- for(i = 0; i < min; ++i)
- pxa2x0_imask[i] |= (1 << irq);
-
- /* Disable interrupt at upper level */
- for( ; i < NIPL; ++i)
- pxa2x0_imask[i] &= ~(1 << irq);
- }
-
- /* fixup */
- pxa2x0_imask[IPL_NONE] |=
- SI_TO_IRQBIT(SI_SOFT) |
- SI_TO_IRQBIT(SI_SOFTCLOCK) |
- SI_TO_IRQBIT(SI_SOFTNET) |
- SI_TO_IRQBIT(SI_SOFTTTY);
- pxa2x0_imask[IPL_SOFT] |=
- SI_TO_IRQBIT(SI_SOFTCLOCK) |
- SI_TO_IRQBIT(SI_SOFTNET) |
- SI_TO_IRQBIT(SI_SOFTTTY);
- pxa2x0_imask[IPL_SOFTCLOCK] |=
- SI_TO_IRQBIT(SI_SOFTNET) |
- SI_TO_IRQBIT(SI_SOFTTTY);
- pxa2x0_imask[IPL_SOFTNET] |=
- SI_TO_IRQBIT(SI_SOFTTTY);
- pxa2x0_imask[IPL_SOFTTTY] |=
- 0;
-#else
- int level; /* debug */
- int mask = 1U<<irqno;
- int i;
- psw = disable_interrupts(PSR_I);
-
- for(i = 0; i < irqlevel; ++i)
- pxa2x0_imask[i] |= mask; /* Enable interrupt at lower level */
-
- for( ; i < NIPL; ++i)
- pxa2x0_imask[i] &= ~mask; /* Disable interrupt at upper level */
-#endif
-
- /*
- * Enforce a hierarchy that gives "slow" device (or devices with
- * limited input buffer space/"real-time" requirements) a better
- * chance at not dropping data.
- */
- pxa2x0_imask[IPL_BIO] &= pxa2x0_imask[IPL_SOFTNET];
- pxa2x0_imask[IPL_NET] &= pxa2x0_imask[IPL_BIO];
- pxa2x0_imask[IPL_SOFTTTY] &= pxa2x0_imask[IPL_NET];
- pxa2x0_imask[IPL_TTY] &= pxa2x0_imask[IPL_SOFTTTY];
-
- /*
- * splvm() blocks all interrupts that use the kernel memory
- * allocation facilities.
- */
- pxa2x0_imask[IPL_VM] &= pxa2x0_imask[IPL_TTY];
-
- /*
- * Audio devices are not allowed to perform memory allocation
- * in their interrupt routines, and they have fairly "real-time"
- * requirements, so give them a high interrupt priority.
- */
- pxa2x0_imask[IPL_AUDIO] &= pxa2x0_imask[IPL_VM];
-
- /*
- * splclock() must block anything that uses the scheduler.
- */
- pxa2x0_imask[IPL_CLOCK] &= pxa2x0_imask[IPL_AUDIO];
-
- /*
- * splhigh() must block "everything".
- */
- pxa2x0_imask[IPL_HIGH] &= pxa2x0_imask[IPL_STATCLOCK];
-
-#ifdef DEBUG
- for (level = IPL_NONE; level < NIPL; level++) {
- printf("imask %d, %x\n", level, pxa2x0_imask[level]);
- }
-#endif
-
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- for (irq = 0; irq < ICU_LEN; irq++) {
- int max_irq = IPL_NONE;
- TAILQ_FOREACH(ih, &handler[irq].list, ih_list) {
- if (ih->ih_level > max_irq)
- max_irq = ih->ih_level;
- }
- extirq_level[irq] = max_irq;
- }
-#endif
-
- write_icu(SAIPIC_MR, pxa2x0_imask[current_spl_level]);
-
- restore_interrupts(psw);
-}
-
-
-void
-pxa2x0_init_interrupt_masks(void)
-{
-
- memset(pxa2x0_imask, 0, sizeof(pxa2x0_imask));
-
- /*
- * IPL_NONE has soft interrupts enabled only, at least until
- * hardware handlers are installed.
- */
- pxa2x0_imask[IPL_NONE] =
- SI_TO_IRQBIT(SI_SOFT) |
- SI_TO_IRQBIT(SI_SOFTCLOCK) |
- SI_TO_IRQBIT(SI_SOFTNET) |
- SI_TO_IRQBIT(SI_SOFTTTY);
-
- /*
- * Initialize the soft interrupt masks to block themselves.
- */
- pxa2x0_imask[IPL_SOFT] = ~SI_TO_IRQBIT(SI_SOFT);
- pxa2x0_imask[IPL_SOFTCLOCK] = ~SI_TO_IRQBIT(SI_SOFTCLOCK);
- pxa2x0_imask[IPL_SOFTNET] = ~SI_TO_IRQBIT(SI_SOFTNET);
- pxa2x0_imask[IPL_SOFTTTY] = ~SI_TO_IRQBIT(SI_SOFTTTY);
-
- pxa2x0_imask[IPL_SOFT] &= pxa2x0_imask[IPL_NONE];
-
- /*
- * splsoftclock() is the only interface that users of the
- * generic software interrupt facility have to block their
- * soft intrs, so splsoftclock() must also block IPL_SOFT.
- */
- pxa2x0_imask[IPL_SOFTCLOCK] &= pxa2x0_imask[IPL_SOFT];
-
- /*
- * splsoftnet() must also block splsoftclock(), since we don't
- * want timer-driven network events to occur while we're
- * processing incoming packets.
- */
- pxa2x0_imask[IPL_SOFTNET] &= pxa2x0_imask[IPL_SOFTCLOCK];
-}
-
-void
-pxa2x0_do_pending(void)
-{
- int oldirqstate, spl_save;
-
- oldirqstate = disable_interrupts(PSR_I);
-
- spl_save = current_spl_level;
-
-#define DO_SOFTINT(si,ipl) \
- if ((softint_pending & pxa2x0_imask[current_spl_level]) & \
- SI_TO_IRQBIT(si)) { \
- softint_pending &= ~SI_TO_IRQBIT(si); \
- if (current_spl_level < ipl) \
- pxa2x0_setipl(ipl); \
- restore_interrupts(oldirqstate); \
- softintr_dispatch(si); \
- oldirqstate = disable_interrupts(PSR_I); \
- pxa2x0_setipl(spl_save); \
- }
-
- do {
- DO_SOFTINT(SI_SOFTTTY,IPL_SOFTTTY);
- DO_SOFTINT(SI_SOFTNET, IPL_SOFTNET);
- DO_SOFTINT(SI_SOFTCLOCK, IPL_SOFTCLOCK);
- DO_SOFTINT(SI_SOFT, IPL_SOFT);
- } while( softint_pending & pxa2x0_imask[current_spl_level] );
-
- restore_interrupts(oldirqstate);
-}
-
-#undef splx
-void
-splx(int ipl)
-{
-
- pxa2x0_splx(ipl);
-}
-
-#undef _splraise
-int
-_splraise(int ipl)
-{
-
- return pxa2x0_splraise(ipl);
-}
-
-#undef _spllower
-int
-_spllower(int ipl)
-{
-
- return pxa2x0_spllower(ipl);
-}
-
-#undef _setsoftintr
-void
-_setsoftintr(int si)
-{
-
- return pxa2x0_setsoftintr(si);
-}
-
-void *
-pxa2x0_intr_establish(int irqno, int level,
- int (*func)(void *), void *arg, const char *name)
-{
- int psw;
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- struct intrhand *ih;
-#else
- struct intrhandler *ih;
-#endif
-
- if (irqno < PXA2X0_IRQ_MIN || irqno >= ICU_LEN)
- panic("intr_establish: bogus irq number %d", irqno);
-
- psw = disable_interrupts(PSR_I);
-
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- /* no point in sleeping unless someone can free memory. */
- ih = (struct intrhand *)malloc(sizeof *ih, M_DEVBUF,
- cold ? M_NOWAIT : M_WAITOK);
- if (ih == NULL)
- panic("intr_establish: can't malloc handler info");
- ih->ih_func = func;
- ih->ih_arg = arg;
- ih->ih_level = level;
- ih->ih_irq = irqno;
-
- TAILQ_INSERT_TAIL(&handler[irqno].list, ih, ih_list);
-#else
- ih = &handler[irqno];
- ih->arg = arg;
- ih->func = func;
- ih->name = name;
- ih->ih_irq = irqno;
- extirq_level[irqno] = level;
-#endif
-
- if (name != NULL)
- evcount_attach(&ih->ih_count, name, &ih->ih_irq);
-
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- pxa2x0_update_intr_masks();
-#else
- pxa2x0_update_intr_masks(irqno, level);
-#endif
-
- restore_interrupts(psw);
-
- return (ih);
-}
-
-void
-pxa2x0_intr_disestablish(void *cookie)
-{
-
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- int psw;
- struct intrhand *ih = cookie;
- int irqno = ih->ih_irq;
-
- psw = disable_interrupts(PSR_I);
- TAILQ_REMOVE(&handler[irqno].list, ih, ih_list);
-
- free(ih, M_DEVBUF, 0);
-
- pxa2x0_update_intr_masks();
-
- restore_interrupts(psw);
-#else
- struct intrhandler *lhandler = cookie;
- int irqno;
- int psw;
- struct intrhandler *ih;
- irqno = lhandler - handler;
-
- if (irqno < PXA2X0_IRQ_MIN || irqno >= ICU_LEN)
- panic("intr_disestablish: bogus irq number %d", irqno);
-
- psw = disable_interrupts(PSR_I);
-
- ih = &handler[irqno];
- if (ih->name != NULL)
- evcount_detach(&ih->ih_count);
-
- ih->arg = (void *) irqno;
- ih->func = pxa2x0_stray_interrupt;
- ih->name = "stray";
- extirq_level[irqno] = IPL_HIGH;
- pxa2x0_update_intr_masks(irqno, IPL_HIGH);
-
- restore_interrupts(psw);
-#endif
-}
-
-/*
- * Glue for drivers of sa11x0 compatible integrated logic.
- */
-void *
-sa11x0_intr_establish(sa11x0_chipset_tag_t ic, int irq, int type, int level,
- int (*ih_fun)(void *), void *ih_arg, const char *name)
-{
-
- return pxa2x0_intr_establish(irq, level, ih_fun, ih_arg, name);
-}
-
-void
-pxa2x0_setipl(int new)
-{
- u_int32_t intr_mask;
-
- intr_mask = pxa2x0_imask[new];
- current_spl_level = new;
- write_icu( SAIPIC_MR, intr_mask );
-}
-
-
-void
-pxa2x0_splx(int new)
-{
- int psw;
-
- psw = disable_interrupts(PSR_I);
- pxa2x0_setipl(new);
- restore_interrupts(psw);
-
- /* If there are pending software interrupts, process them. */
- if (softint_pending & pxa2x0_imask[current_spl_level])
- pxa2x0_do_pending();
-}
-
-
-int
-pxa2x0_splraise(int ipl)
-{
- int old, psw;
-
- old = current_spl_level;
- if( ipl > current_spl_level ){
- psw = disable_interrupts(PSR_I);
- pxa2x0_setipl(ipl);
- restore_interrupts(psw);
- }
-
- return (old);
-}
-
-int
-pxa2x0_spllower(int ipl)
-{
- int old = current_spl_level;
- int psw = disable_interrupts(PSR_I);
- pxa2x0_splx(ipl);
- restore_interrupts(psw);
- return(old);
-}
-
-void
-pxa2x0_setsoftintr(int si)
-{
- softint_pending |= SI_TO_IRQBIT(si);
-
- /* Process unmasked pending soft interrupts. */
- if ( softint_pending & pxa2x0_imask[current_spl_level] )
- pxa2x0_do_pending();
-}
-
-const char *
-pxa2x0_intr_string(void *cookie)
-{
-#ifdef MULTIPLE_HANDLERS_ON_ONE_IRQ
- struct intrhand *ih = cookie;
-#else
- struct intrhandler *lhandler = cookie;
-#endif
- static char irqstr[32];
-
- if (ih == NULL)
- snprintf(irqstr, sizeof irqstr, "couldn't establish interrupt");
- else
- snprintf(irqstr, sizeof irqstr, "irq %d", ih->ih_irq);
-
- return irqstr;
-}
-
-#ifdef DIAGNOSTIC
-void
-pxa2x0_splassert_check(int wantipl, const char *func)
-{
- int oldipl = current_spl_level, psw;
-
- if (oldipl < wantipl) {
- splassert_fail(wantipl, oldipl, func);
- /*
- * If the splassert_ctl is set to not panic, raise the ipl
- * in a feeble attempt to reduce damage.
- */
- psw = disable_interrupts(PSR_I);
- pxa2x0_setipl(wantipl);
- restore_interrupts(psw);
- }
-}
-#endif
diff --git a/sys/arch/arm/xscale/pxa2x0_intr.h b/sys/arch/arm/xscale/pxa2x0_intr.h
deleted file mode 100644
index 71478df5872..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_intr.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $OpenBSD: pxa2x0_intr.h,v 1.14 2014/03/29 18:09:28 guenther Exp $ */
-/* $NetBSD: pxa2x0_intr.h,v 1.4 2003/07/05 06:53:08 dogcow Exp $ */
-
-/* Derived from i80321_intr.h */
-
-/*
- * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Jason R. Thorpe for Wasabi Systems, Inc.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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 _PXA2X0_INTR_H_
-#define _PXA2X0_INTR_H_
-
-#define ARM_IRQ_HANDLER _C_LABEL(pxa2x0_irq_handler)
-
-#ifndef _LOCORE
-
-#include <arm/armreg.h>
-#include <arm/cpufunc.h>
-#include <arm/softintr.h>
-
-extern vaddr_t pxaic_base; /* Shared with pxa2x0_irq.S */
-#define read_icu(offset) (*(volatile uint32_t *)(pxaic_base+(offset)))
-#define write_icu(offset,value) \
- (*(volatile uint32_t *)(pxaic_base+(offset))=(value))
-
-extern volatile int current_spl_level;
-extern volatile int softint_pending;
-extern int pxa2x0_imask[];
-void pxa2x0_do_pending(void);
-
-void pxa2x0_setipl(int new);
-void pxa2x0_splx(int new);
-int pxa2x0_splraise(int ipl);
-int pxa2x0_spllower(int ipl);
-void pxa2x0_setsoftintr(int si);
-
-
-/*
- * An useful function for interrupt handlers.
- * XXX: This shouldn't be here.
- */
-static __inline int
-find_first_bit( uint32_t bits )
-{
- int count;
-
- /* since CLZ is available only on ARMv5, this isn't portable
- * to all ARM CPUs. This file is for PXA2[15]0 processor.
- */
- asm( "clz %0, %1" : "=r" (count) : "r" (bits) );
- return 31-count;
-}
-
-
-int _splraise(int);
-int _spllower(int);
-void splx(int);
-void _setsoftintr(int);
-
-/*
- * This function *MUST* be called very early on in a port's
- * initarm() function, before ANY spl*() functions are called.
- *
- * The parameter is the virtual address of the PXA2x0's Interrupt
- * Controller registers.
- */
-void pxa2x0_intr_bootstrap(vaddr_t);
-
-void pxa2x0_irq_handler(void *);
-void *pxa2x0_intr_establish(int irqno, int level, int (*func)(void *),
- void *cookie, const char *name);
-void pxa2x0_intr_disestablish(void *cookie);
-const char *pxa2x0_intr_string(void *cookie);
-
-#ifdef DIAGNOSTIC
-/*
- * Although this function is implemented in MI code, it must be in this MD
- * header because we don't want this header to include MI includes.
- */
-void splassert_fail(int, int, const char *);
-extern int splassert_ctl;
-void pxa2x0_splassert_check(int, const char *);
-#define splassert(__wantipl) do { \
- if (splassert_ctl > 0) { \
- pxa2x0_splassert_check(__wantipl, __func__); \
- } \
-} while (0)
-#define splsoftassert(wantipl) splassert(wantipl)
-#else
-#define splassert(wantipl) do { /* nothing */ } while (0)
-#define splsoftassert(wantipl) do { /* nothing */ } while (0)
-#endif
-
-#endif /* ! _LOCORE */
-
-#endif /* _PXA2X0_INTR_H_ */
diff --git a/sys/arch/arm/xscale/pxa2x0_lcd.c b/sys/arch/arm/xscale/pxa2x0_lcd.c
deleted file mode 100644
index 9238889c8e4..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_lcd.c
+++ /dev/null
@@ -1,869 +0,0 @@
-/* $OpenBSD: pxa2x0_lcd.c,v 1.27 2016/01/31 00:14:50 jsg Exp $ */
-/* $NetBSD: pxa2x0_lcd.c,v 1.8 2003/10/03 07:24:05 bsh Exp $ */
-
-/*
- * Copyright (c) 2002 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Genetec Corporation.
- * 4. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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.
- */
-
-/*
- * Support PXA2[15]0's integrated LCD controller.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h> /* for cold */
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <arm/cpufunc.h>
-
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0_lcd.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-/*
- * Console variables. These are necessary since console is setup very early,
- * before devices get attached.
- */
-struct {
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- bus_dma_tag_t dma_tag;
- const struct lcd_panel_geometry *geometry;
- struct pxa2x0_lcd_screen scr;
-} pxa2x0_lcd_console;
-
-int lcdintr(void *);
-void pxa2x0_lcd_geometry(bus_space_tag_t, bus_space_handle_t,
- const struct lcd_panel_geometry *);
-void pxa2x0_lcd_initialize(bus_space_tag_t, bus_space_handle_t,
- const struct lcd_panel_geometry *, void (*)(u_int, int));
-int pxa2x0_lcd_new_screen(struct pxa2x0_lcd_softc *,
- struct pxa2x0_lcd_screen *, int);
-void pxa2x0_lcd_setup_console(struct pxa2x0_lcd_softc *,
- const struct pxa2x0_wsscreen_descr *);
-void pxa2x0_lcd_setup_rasops(struct rasops_info *,
- struct pxa2x0_wsscreen_descr *,
- const struct lcd_panel_geometry *);
-void pxa2x0_lcd_start_dma(bus_space_tag_t, bus_space_handle_t,
- struct pxa2x0_lcd_screen *);
-void pxa2x0_lcd_stop_dma(bus_space_tag_t, bus_space_handle_t);
-
-/*
- * Setup display geometry parameters.
- */
-void
-pxa2x0_lcd_geometry(bus_space_tag_t iot, bus_space_handle_t ioh,
- const struct lcd_panel_geometry *info)
-{
- int lines;
- uint32_t ccr0;
-
- ccr0 = LCCR0_IMASK;
- if (info->panel_info & LCDPANEL_ACTIVE)
- ccr0 |= LCCR0_PAS; /* active mode */
- if ((info->panel_info & (LCDPANEL_DUAL | LCDPANEL_ACTIVE))
- == LCDPANEL_DUAL)
- ccr0 |= LCCR0_SDS; /* dual panel */
- if (info->panel_info & LCDPANEL_MONOCHROME)
- ccr0 |= LCCR0_CMS;
- /* XXX - Zaurus C3000 */
- ccr0 |= LCCR0_LDDALT |
- LCCR0_OUC |
- LCCR0_CMDIM |
- LCCR0_RDSTM;
-
- bus_space_write_4(iot, ioh, LCDC_LCCR0, ccr0);
-
- bus_space_write_4(iot, ioh, LCDC_LCCR1,
- (info->panel_width - 1)
- | ((info->hsync_pulse_width - 1) << 10)
- | ((info->end_line_wait - 1) << 16)
- | ((info->beg_line_wait - 1) << 24));
-
- if (info->panel_info & LCDPANEL_DUAL)
- lines = info->panel_height / 2 + info->extra_lines;
- else
- lines = info->panel_height + info->extra_lines;
-
- bus_space_write_4(iot, ioh, LCDC_LCCR2,
- (lines - 1)
- | (info->vsync_pulse_width << 10)
- | (info->end_frame_wait << 16)
- | (info->beg_frame_wait << 24));
-
- bus_space_write_4(iot, ioh, LCDC_LCCR3,
- (info->pixel_clock_div << 0)
- | (info->ac_bias << 8)
- | ((info->panel_info &
- (LCDPANEL_VSP | LCDPANEL_HSP | LCDPANEL_PCP | LCDPANEL_OEP))
- << 20)
- | (4 << 24) /* 16bpp */
- | ((info->panel_info & LCDPANEL_DPC) ? (1 << 27) : 0)
- );
-}
-
-/*
- * Initialize the LCD controller.
- */
-void
-pxa2x0_lcd_initialize(bus_space_tag_t iot, bus_space_handle_t ioh,
- const struct lcd_panel_geometry *geom, void (*clkman)(u_int, int))
-{
- int nldd;
- u_int32_t lccr0, lscr;
-
- /* Check if LCD is enabled before programming, it should not
- * be enabled while it is being reprogrammed, therefore disable
- * it first.
- */
- lccr0 = bus_space_read_4(iot, ioh, LCDC_LCCR0);
- if (lccr0 & LCCR0_ENB) {
- lccr0 |= LCCR0_LDM;
- bus_space_write_4(iot, ioh, LCDC_LCCR0, lccr0);
- lccr0 = bus_space_read_4(iot, ioh, LCDC_LCCR0); /* paranoia */
- lccr0 |= LCCR0_DIS;
- bus_space_write_4(iot, ioh, LCDC_LCCR0, lccr0);
- do {
- lscr = bus_space_read_4(iot, ioh, LCDC_LCSR);
- } while (!(lscr & LCSR_LDD));
- }
-
- /* enable clock */
- (*clkman)(CKEN_LCD, 1);
-
- bus_space_write_4(iot, ioh, LCDC_LCCR0, LCCR0_IMASK);
-
- /*
- * setup GP[77:58] for LCD
- */
- /* Always use [FLP]CLK, ACBIAS */
- pxa2x0_gpio_set_function(74, GPIO_ALT_FN_2_OUT);
- pxa2x0_gpio_set_function(75, GPIO_ALT_FN_2_OUT);
- pxa2x0_gpio_set_function(76, GPIO_ALT_FN_2_OUT);
- pxa2x0_gpio_set_function(77, GPIO_ALT_FN_2_OUT);
-
- if ((geom->panel_info & LCDPANEL_ACTIVE) ||
- ((geom->panel_info & (LCDPANEL_MONOCHROME|LCDPANEL_DUAL)) ==
- LCDPANEL_DUAL)) {
- /* active and color dual panel need L_DD[15:0] */
- nldd = 16;
- } else if ((geom->panel_info & LCDPANEL_DUAL) ||
- !(geom->panel_info & LCDPANEL_MONOCHROME)) {
- /* dual or color need L_DD[7:0] */
- nldd = 8;
- } else {
- /* Otherwise just L_DD[3:0] */
- nldd = 4;
- }
-
- while (nldd--)
- pxa2x0_gpio_set_function(58 + nldd, GPIO_ALT_FN_2_OUT);
-
- pxa2x0_lcd_geometry(iot, ioh, geom);
-}
-
-/*
- * Common driver attachment code.
- */
-void
-pxa2x0_lcd_attach_sub(struct pxa2x0_lcd_softc *sc,
- struct pxaip_attach_args *pxa, struct pxa2x0_wsscreen_descr *descr,
- const struct lcd_panel_geometry *geom, int console)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int error;
-
- sc->n_screens = 0;
- LIST_INIT(&sc->screens);
-
- /* map controller registers if not console */
- if (console != 0) {
- iot = pxa2x0_lcd_console.iot;
- ioh = pxa2x0_lcd_console.ioh;
- } else {
- iot = pxa->pxa_iot;
- error = bus_space_map(iot, PXA2X0_LCDC_BASE, PXA2X0_LCDC_SIZE,
- 0, &ioh);
- if (error) {
- printf(": failed to map registers %d", error);
- return;
- }
- }
-
- sc->iot = iot;
- sc->ioh = ioh;
- sc->dma_tag = &pxa2x0_bus_dma_tag;
-
- sc->ih = pxa2x0_intr_establish(17, IPL_BIO, lcdintr, sc,
- sc->dev.dv_xname);
- if (sc->ih == NULL)
- printf("%s: unable to establish interrupt at irq %d",
- sc->dev.dv_xname, 17);
-
- sc->geometry = geom;
-
- if (console != 0) {
- /* complete console attachment */
- pxa2x0_lcd_setup_console(sc, descr);
- } else {
- struct rasops_info dummy;
-
- pxa2x0_lcd_initialize(iot, ioh, geom, pxa2x0_clkman_config);
-
- /*
- * Initialize a dummy rasops_info to compute fontsize and
- * the screen size in chars.
- */
- bzero(&dummy, sizeof(dummy));
- pxa2x0_lcd_setup_rasops(&dummy, descr, geom);
- }
-}
-
-/*
- * Interrupt handler.
- */
-int
-lcdintr(void *arg)
-{
- struct pxa2x0_lcd_softc *sc = arg;
- bus_space_tag_t iot = sc->iot;
- bus_space_handle_t ioh = sc->ioh;
-
- static uint32_t status;
-
- status = bus_space_read_4(iot, ioh, LCDC_LCSR);
- /* Clear sticky status bits */
- bus_space_write_4(iot, ioh, LCDC_LCSR, status);
-
- return 1;
-}
-
-/*
- * Enable DMA to cause the display to be refreshed periodically.
- * This brings the screen to life...
- */
-void
-pxa2x0_lcd_start_dma(bus_space_tag_t iot, bus_space_handle_t ioh,
- struct pxa2x0_lcd_screen *scr)
-{
- uint32_t tmp;
- int val, save;
-
- save = disable_interrupts(PSR_I);
-
- switch (scr->depth) {
- case 1: val = 0; break;
- case 2: val = 1; break;
- case 4: val = 2; break;
- case 8: val = 3; break;
- case 16:
- /* FALLTHROUGH */
- default:
- val = 4; break;
- }
-
- tmp = bus_space_read_4(iot, ioh, LCDC_LCCR3);
- bus_space_write_4(iot, ioh, LCDC_LCCR3,
- (tmp & ~LCCR3_BPP) | (val << LCCR3_BPP_SHIFT));
-
- bus_space_write_4(iot, ioh, LCDC_FDADR0,
- scr->depth == 16 ? scr->dma_desc_pa :
- scr->dma_desc_pa + 2 * sizeof (struct lcd_dma_descriptor));
- bus_space_write_4(iot, ioh, LCDC_FDADR1,
- scr->dma_desc_pa + 1 * sizeof (struct lcd_dma_descriptor));
-
- /* clear status */
- bus_space_write_4(iot, ioh, LCDC_LCSR, 0);
-
- delay(1000); /* ??? */
-
- /* Enable LCDC */
- tmp = bus_space_read_4(iot, ioh, LCDC_LCCR0);
- /*tmp &= ~LCCR0_SFM;*/
- bus_space_write_4(iot, ioh, LCDC_LCCR0, tmp | LCCR0_ENB);
-
- restore_interrupts(save);
-}
-
-/*
- * Disable screen refresh.
- */
-void
-pxa2x0_lcd_stop_dma(bus_space_tag_t iot, bus_space_handle_t ioh)
-{
-
- /* Stop LCD DMA after current frame */
- bus_space_write_4(iot, ioh, LCDC_LCCR0,
- LCCR0_DIS |
- bus_space_read_4(iot, ioh, LCDC_LCCR0));
-
- /* wait for disabling done.
- XXX: use interrupt. */
- while (LCCR0_ENB &
- bus_space_read_4(iot, ioh, LCDC_LCCR0))
- ;
-
- bus_space_write_4(iot, ioh, LCDC_LCCR0,
- ~LCCR0_DIS &
- bus_space_read_4(iot, ioh, LCDC_LCCR0));
-}
-
-#define _rgb(r,g,b) (((r)<<11) | ((g)<<5) | b)
-#define rgb(r,g,b) _rgb((r)>>1,g,(b)>>1)
-
-#define L 0x1f /* low intensity */
-#define H 0x3f /* high intensity */
-
-static uint16_t basic_color_map[] = {
- rgb( 0, 0, 0), /* black */
- rgb( L, 0, 0), /* red */
- rgb( 0, L, 0), /* green */
- rgb( L, L, 0), /* brown */
- rgb( 0, 0, L), /* blue */
- rgb( L, 0, L), /* magenta */
- rgb( 0, L, L), /* cyan */
- rgb( 0x31,0x31,0x31), /* white */
-
- rgb( L, L, L), /* black */
- rgb( H, 0, 0), /* red */
- rgb( 0, H, 0), /* green */
- rgb( H, H, 0), /* brown */
- rgb( 0, 0, H), /* blue */
- rgb( H, 0, H), /* magenta */
- rgb( 0, H, H), /* cyan */
- rgb( H, H, H)
-};
-
-#undef H
-#undef L
-
-static void
-init_palette(uint16_t *buf, int depth)
-{
- int i;
-
- /* convert RGB332 to RGB565 */
- switch (depth) {
- case 8:
- case 4:
-#if 0
- for (i = 0; i <= 255; ++i) {
- buf[i] = ((9 * ((i >> 5) & 0x07)) << 11) |
- ((9 * ((i >> 2) & 0x07)) << 5) |
- ((21 * (i & 0x03)) / 2);
- }
-#else
- memcpy(buf, basic_color_map, sizeof basic_color_map);
- for (i = 16; i < (1 << depth); ++i)
- buf[i] = 0xffff;
-#endif
- break;
- case 16:
- /* palette is not needed */
- break;
- default:
- /* other depths are not supported */
- break;
- }
-}
-
-/*
- * Create and initialize a new screen buffer.
- */
-int
-pxa2x0_lcd_new_screen(struct pxa2x0_lcd_softc *sc,
- struct pxa2x0_lcd_screen *scr, int depth)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- bus_dma_tag_t dma_tag;
- const struct lcd_panel_geometry *geometry;
- int width, height;
- bus_size_t size;
- int error, palette_size;
- int busdma_flag = (cold ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
- struct lcd_dma_descriptor *desc;
- paddr_t buf_pa, desc_pa;
-
- if (sc != NULL) {
- iot = sc->iot;
- ioh = sc->ioh;
- dma_tag = sc->dma_tag;
- geometry = sc->geometry;
- } else {
- /* We are creating the console screen. */
- iot = pxa2x0_lcd_console.iot;
- ioh = pxa2x0_lcd_console.ioh;
- dma_tag = pxa2x0_lcd_console.dma_tag;
- geometry = pxa2x0_lcd_console.geometry;
- }
-
- width = geometry->panel_width;
- height = geometry->panel_height;
- palette_size = 0;
-
- switch (depth) {
- case 1:
- case 2:
- case 4:
- case 8:
- palette_size = (1 << depth) * sizeof (uint16_t);
- /* FALLTHROUGH */
- case 16:
- size = roundup(width, 4) * depth / 8 * height;
- break;
- default:
- printf("%s: Unknown depth (%d)\n",
- sc != NULL ? sc->dev.dv_xname : "console", depth);
- return (EINVAL);
- }
-
- bzero(scr, sizeof *scr);
-
- scr->nsegs = 0;
- scr->depth = depth;
- scr->buf_size = size;
- scr->buf_va = NULL;
- size = roundup(size, 16) + 3 * sizeof (struct lcd_dma_descriptor)
- + palette_size;
-
- error = bus_dmamem_alloc(dma_tag, size, 16, 0,
- scr->segs, 1, &(scr->nsegs), busdma_flag);
- if (error != 0 || scr->nsegs != 1) {
- /* XXX: Actually we can handle nsegs > 1 case by means
- of multiple DMA descriptors for a panel. It would
- make code here a bit hairy */
- if (error == 0)
- error = E2BIG;
- goto bad;
- }
-
- error = bus_dmamem_map(dma_tag, scr->segs, scr->nsegs,
- size, (caddr_t *)&(scr->buf_va), busdma_flag | BUS_DMA_COHERENT);
- if (error != 0)
- goto bad;
-
- memset(scr->buf_va, 0, scr->buf_size);
-
- /* map memory for DMA */
- if (bus_dmamap_create(dma_tag, 1024 * 1024 * 2, 1,
- 1024 * 1024 * 2, 0, busdma_flag, &scr->dma))
- goto bad;
- error = bus_dmamap_load(dma_tag, scr->dma,
- scr->buf_va, size, NULL, busdma_flag);
- if (error != 0) {
- goto bad;
- }
-
- buf_pa = scr->segs[0].ds_addr;
- desc_pa = buf_pa + roundup(size, PAGE_SIZE) - 3 * sizeof *desc;
-
- /* make descriptors at the top of mapped memory */
- desc = (struct lcd_dma_descriptor *)
- ((caddr_t)(scr->buf_va) + roundup(size, PAGE_SIZE) -
- 3 * sizeof *desc);
-
- desc[0].fdadr = desc_pa;
- desc[0].fsadr = buf_pa;
- desc[0].ldcmd = scr->buf_size;
-
- if (palette_size) {
- init_palette((uint16_t *)((char *)desc - palette_size), depth);
-
- desc[2].fdadr = desc_pa; /* chain to panel 0 */
- desc[2].fsadr = desc_pa - palette_size;
- desc[2].ldcmd = palette_size | LDCMD_PAL;
- }
-
- if (geometry->panel_info & LCDPANEL_DUAL) {
- /* Dual panel */
- desc[1].fdadr = desc_pa + sizeof *desc;
- desc[1].fsadr = buf_pa + scr->buf_size / 2;
- desc[0].ldcmd = desc[1].ldcmd = scr->buf_size / 2;
-
- }
-
-#if 0
- desc[0].ldcmd |= LDCMD_SOFINT;
- desc[1].ldcmd |= LDCMD_SOFINT;
-#endif
-
- scr->dma_desc = desc;
- scr->dma_desc_pa = desc_pa;
- scr->map_size = size; /* used when unmap this. */
-
- if (sc != NULL) {
- LIST_INSERT_HEAD(&(sc->screens), scr, link);
- sc->n_screens++;
- }
-
- return (0);
-
- bad:
- if (scr->buf_va)
- bus_dmamem_unmap(dma_tag, scr->buf_va, size);
- if (scr->nsegs)
- bus_dmamem_free(dma_tag, scr->segs, scr->nsegs);
- return (error);
-}
-
-/*
- * Initialize rasops for a screen, as well as struct wsscreen_descr if this
- * is the first screen creation.
- */
-void
-pxa2x0_lcd_setup_rasops(struct rasops_info *rinfo,
- struct pxa2x0_wsscreen_descr *descr,
- const struct lcd_panel_geometry *geom)
-{
-
- rinfo->ri_flg = descr->flags;
- rinfo->ri_depth = descr->depth;
- rinfo->ri_width = geom->panel_width;
- rinfo->ri_height = geom->panel_height;
- rinfo->ri_stride = rinfo->ri_width * rinfo->ri_depth / 8;
-#ifdef notyet
- rinfo->ri_wsfcookie = -1; /* XXX */
-#endif
-
- /* swap B and R */
- if (descr->depth == 16) {
- rinfo->ri_rnum = 5;
- rinfo->ri_rpos = 11;
- rinfo->ri_gnum = 6;
- rinfo->ri_gpos = 5;
- rinfo->ri_bnum = 5;
- rinfo->ri_bpos = 0;
- }
-
- if (descr->c.nrows == 0) {
- /* get rasops to compute screen size the first time */
- rasops_init(rinfo, 100, 100);
- } else
-#ifndef __zaurus__
- rasops_init(rinfo, descr->c.nrows, descr->c.ncols);
-#else
- /* XXX swap rows/cols for second call because of rotation */
- rasops_init(rinfo, descr->c.ncols, descr->c.nrows);
-#endif
-
- descr->c.nrows = rinfo->ri_rows;
- descr->c.ncols = rinfo->ri_cols;
- descr->c.capabilities = rinfo->ri_caps;
- descr->c.textops = &rinfo->ri_ops;
-}
-
-/*
- * Early console attachment.
- * This initializes the LCD, then creates and displays a screen buffer.
- * This screen will be accounted for in the softc when the lcd device attaches.
- */
-int
-pxa2x0_lcd_cnattach(struct pxa2x0_wsscreen_descr *descr,
- const struct lcd_panel_geometry *geom, void (*clkman)(u_int, int))
-{
- struct rasops_info *ri;
- long defattr;
- int error;
-
- /* map controller registers */
- pxa2x0_lcd_console.iot = &pxa2x0_bs_tag;
- error = bus_space_map(pxa2x0_lcd_console.iot,
- PXA2X0_LCDC_BASE, PXA2X0_LCDC_SIZE, 0, &pxa2x0_lcd_console.ioh);
- if (error != 0)
- return (error);
-
- pxa2x0_lcd_console.dma_tag = &pxa2x0_bus_dma_tag;
- pxa2x0_lcd_console.geometry = geom;
-
- pxa2x0_lcd_initialize(pxa2x0_lcd_console.iot, pxa2x0_lcd_console.ioh,
- pxa2x0_lcd_console.geometry, clkman);
-
- error = pxa2x0_lcd_new_screen(NULL, &pxa2x0_lcd_console.scr,
- descr->depth);
- if (error != 0)
- return (error);
-
- ri = &pxa2x0_lcd_console.scr.rinfo;
- ri->ri_hw = (void *)&pxa2x0_lcd_console.scr;
- ri->ri_bits = pxa2x0_lcd_console.scr.buf_va;
- pxa2x0_lcd_setup_rasops(ri, descr, pxa2x0_lcd_console.geometry);
-
- /* assumes 16 bpp */
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
-
- pxa2x0_lcd_start_dma(pxa2x0_lcd_console.iot, pxa2x0_lcd_console.ioh,
- &pxa2x0_lcd_console.scr);
-
- wsdisplay_cnattach(&descr->c, ri, ri->ri_ccol, ri->ri_crow, defattr);
-
- return (0);
-}
-
-/*
- * Do the necessary accounting to bring the console variables in the softc.
- */
-void
-pxa2x0_lcd_setup_console(struct pxa2x0_lcd_softc *sc,
- const struct pxa2x0_wsscreen_descr *descr)
-{
- struct pxa2x0_lcd_screen *scr = &pxa2x0_lcd_console.scr;
-
- /*
- * Register the console screen as if it had been created
- * when the lcd device attached.
- */
- LIST_INSERT_HEAD(&(sc->screens), &pxa2x0_lcd_console.scr, link);
- sc->n_screens++;
- sc->active = scr;
-}
-
-/*
- * wsdisplay accessops
- */
-
-int
-pxa2x0_lcd_show_screen(void *v, void *cookie, int waitok,
- void (*cb)(void *, int, int), void *cbarg)
-{
- struct pxa2x0_lcd_softc *sc = v;
- struct rasops_info *ri = cookie;
- struct pxa2x0_lcd_screen *scr = ri->ri_hw, *old;
-
- old = sc->active;
- if (old == scr)
- return 0;
-
- if (old)
- pxa2x0_lcd_stop_dma(sc->iot, sc->ioh);
-
- pxa2x0_lcd_start_dma(sc->iot, sc->ioh, scr);
-
- sc->active = scr;
- return 0;
-}
-
-int
-pxa2x0_lcd_alloc_screen(void *v, const struct wsscreen_descr *_type,
- void **cookiep, int *curxp, int *curyp, long *attrp)
-{
- struct pxa2x0_lcd_softc *sc = v;
- struct pxa2x0_lcd_screen *scr;
- struct rasops_info *ri;
- struct pxa2x0_wsscreen_descr *type =
- (struct pxa2x0_wsscreen_descr *)_type;
- int error;
-
- scr = malloc(sizeof *scr, M_DEVBUF, (cold ? M_NOWAIT : M_WAITOK));
- if (scr == NULL)
- return (ENOMEM);
-
- error = pxa2x0_lcd_new_screen(sc, scr, type->depth);
- if (error != 0) {
- free(scr, M_DEVBUF, 0);
- return (error);
- }
-
- /*
- * initialize raster operation for this screen.
- */
- ri = &scr->rinfo;
- ri->ri_hw = (void *)scr;
- ri->ri_bits = scr->buf_va;
- pxa2x0_lcd_setup_rasops(ri, type, sc->geometry);
-
- /* assumes 16 bpp */
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
-
- *cookiep = ri;
- *curxp = 0;
- *curyp = 0;
-
- return 0;
-}
-
-void
-pxa2x0_lcd_free_screen(void *v, void *cookie)
-{
- struct pxa2x0_lcd_softc *sc = v;
- struct rasops_info *ri = cookie;
- struct pxa2x0_lcd_screen *scr = ri->ri_hw;
-
- LIST_REMOVE(scr, link);
- sc->n_screens--;
- if (scr == sc->active) {
- /* at first, we need to stop LCD DMA */
- sc->active = NULL;
-
-#ifdef DEBUG
- printf("lcd_free on active screen\n");
-#endif
-
- pxa2x0_lcd_stop_dma(sc->iot, sc->ioh);
- }
-
- if (scr->buf_va)
- bus_dmamem_unmap(sc->dma_tag, scr->buf_va, scr->map_size);
-
- if (scr->nsegs > 0)
- bus_dmamem_free(sc->dma_tag, scr->segs, scr->nsegs);
-
- free(scr, M_DEVBUF, 0);
-}
-
-int
-pxa2x0_lcd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct pxa2x0_lcd_softc *sc = v;
- struct wsdisplay_fbinfo *wsdisp_info;
- struct pxa2x0_lcd_screen *scr = sc->active; /* ??? */
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_PXALCD; /* XXX */
- break;
-
- case WSDISPLAYIO_GINFO:
- wsdisp_info = (struct wsdisplay_fbinfo *)data;
-
- wsdisp_info->height = sc->geometry->panel_height;
- wsdisp_info->width = sc->geometry->panel_width;
- wsdisp_info->depth = 16; /* XXX */
- wsdisp_info->cmsize = 0;
- break;
-
- case WSDISPLAYIO_GETSUPPORTEDDEPTH:
- *(u_int *)data = WSDISPLAYIO_DEPTH_16;
- break;
-
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
- return EINVAL; /* XXX Colormap */
-
- case WSDISPLAYIO_SVIDEO:
- case WSDISPLAYIO_GVIDEO:
- break;
-
- case WSDISPLAYIO_GCURPOS:
- case WSDISPLAYIO_SCURPOS:
- case WSDISPLAYIO_GCURMAX:
- case WSDISPLAYIO_GCURSOR:
- case WSDISPLAYIO_SCURSOR:
- default:
- return -1; /* not implemented */
-
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = scr->rinfo.ri_stride;
- break;
- }
- return (0);
-}
-
-paddr_t
-pxa2x0_lcd_mmap(void *v, off_t offset, int prot)
-{
- struct pxa2x0_lcd_softc *sc = v;
- struct pxa2x0_lcd_screen *screen = sc->active; /* ??? */
-
- if ((offset & PAGE_MASK) != 0)
- return (-1);
-
- if (screen == NULL)
- return (-1);
-
- if (offset < 0 ||
- offset >= screen->rinfo.ri_stride * screen->rinfo.ri_height)
- return (-1);
-
- return (bus_dmamem_mmap(sc->dma_tag, screen->segs, screen->nsegs,
- offset, prot, BUS_DMA_WAITOK | BUS_DMA_COHERENT));
-}
-
-int
-pxa2x0_lcd_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
-{
- struct pxa2x0_lcd_softc *sc = v;
- struct pxa2x0_lcd_screen *screen = sc->active;
-
- if (screen == NULL)
- return ENXIO;
-
- return rasops_load_font(&screen->rinfo, emulcookie, font);
-}
-
-int
-pxa2x0_lcd_list_font(void *v, struct wsdisplay_font *font)
-{
- struct pxa2x0_lcd_softc *sc = v;
- struct pxa2x0_lcd_screen *screen = sc->active;
-
- if (screen == NULL)
- return ENXIO;
-
- return rasops_list_font(&screen->rinfo, font);
-}
-
-void
-pxa2x0_lcd_suspend(struct pxa2x0_lcd_softc *sc)
-{
-
- if (sc->active != NULL) {
- pxa2x0_lcd_stop_dma(sc->iot, sc->ioh);
-
- pxa2x0_clkman_config(CKEN_LCD, 0);
- }
-}
-
-void
-pxa2x0_lcd_resume(struct pxa2x0_lcd_softc *sc)
-{
-
- if (sc->active != NULL) {
- pxa2x0_lcd_initialize(sc->iot, sc->ioh, sc->geometry,
- pxa2x0_clkman_config);
- pxa2x0_lcd_start_dma(sc->iot, sc->ioh, sc->active);
- }
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_lcd.h b/sys/arch/arm/xscale/pxa2x0_lcd.h
deleted file mode 100644
index a9823521b7e..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_lcd.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: pxa2x0_lcd.h,v 1.12 2013/10/21 10:36:10 miod Exp $ */
-/* $NetBSD: pxa2x0_lcd.h,v 1.2 2003/06/17 09:43:14 bsh Exp $ */
-/*
- * Copyright (c) 2002 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Genetec Corporation.
- * 4. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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 _ARM_XSCALE_PXA2X0_LCD_H
-#define _ARM_XSCALE_PXA2X0_LCD_H
-
-#include <dev/rasops/rasops.h>
-#include <machine/bus.h>
-
-/* LCD Controller */
-
-struct lcd_dma_descriptor {
- uint32_t fdadr; /* next frame descriptor */
- uint32_t fsadr; /* frame start address */
- uint32_t fidr; /* frame ID */
- uint32_t ldcmd; /* DMA command */
-#define LDCMD_PAL (1U<<26) /* Palette buffer */
-#define LDCMD_SOFINT (1U<<22) /* Start of Frame interrupt */
-#define LDCMD_EOFINT (1U<<21) /* End of Frame interrupt */
-};
-
-
-struct pxa2x0_lcd_screen {
- LIST_ENTRY(pxa2x0_lcd_screen) link;
-
- /* Frame buffer */
- bus_dmamap_t dma;
- bus_dma_segment_t segs[1];
- int nsegs;
- size_t buf_size;
- size_t map_size;
- void *buf_va;
- int depth;
-
- /* DMA frame descriptor */
- struct lcd_dma_descriptor *dma_desc;
- paddr_t dma_desc_pa;
-
- /* rasterop */
- struct rasops_info rinfo;
-};
-
-struct pxa2x0_lcd_softc {
- struct device dev;
- /* control register */
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- bus_dma_tag_t dma_tag;
-
- const struct lcd_panel_geometry *geometry;
-
- int n_screens;
- LIST_HEAD(, pxa2x0_lcd_screen) screens;
- struct pxa2x0_lcd_screen *active;
-
- void *ih; /* interrupt handler */
-};
-
-struct lcd_panel_geometry {
- short panel_width;
- short panel_height;
- short extra_lines;
-
- short panel_info;
-#define LCDPANEL_VSP (1<<0) /* L_FCLK pin is active low */
-#define LCDPANEL_HSP (1<<1) /* L_LCLK pin is active low */
-#define LCDPANEL_PCP (1<<2) /* use L_PCLK falling edge */
-#define LCDPANEL_OEP (1<<3) /* L_BIAS pin is active low */
-#define LCDPANEL_DPC (1<<4) /* double pixel clock mode */
-
-#define LCDPANEL_DUAL (1<<5) /* Dual or single */
-#define LCDPANEL_SINGLE 0
-#define LCDPANEL_ACTIVE (1<<6) /* Active or Passive */
-#define LCDPANEL_PASSIVE 0
-#define LCDPANEL_MONOCHROME (1<<7) /* depth=1 */
-
- short pixel_clock_div; /* pixel clock divider */
- short ac_bias; /* AC bias pin frequency */
-
- short hsync_pulse_width; /* Horizontal sync pulse width */
- short beg_line_wait; /* beginning of line wait (BLW) */
- short end_line_wait; /* end of line pxel wait (ELW) */
-
- short vsync_pulse_width; /* vertical sync pulse width */
- short beg_frame_wait; /* beginning of frame wait (BFW) */
- short end_frame_wait; /* end of frame wait (EFW) */
-};
-
-/*
- * we need bits-per-pixel value to configure wsdisplay screen
- */
-struct pxa2x0_wsscreen_descr {
- struct wsscreen_descr c; /* standard descriptor */
- int depth; /* bits per pixel */
- int flags; /* rasops flags */
-};
-
-void pxa2x0_lcd_attach_sub(struct pxa2x0_lcd_softc *,
- struct pxaip_attach_args *, struct pxa2x0_wsscreen_descr *,
- const struct lcd_panel_geometry *, int);
-int pxa2x0_lcd_cnattach(struct pxa2x0_wsscreen_descr *,
- const struct lcd_panel_geometry *, void (*)(u_int, int));
-
-int pxa2x0_lcd_alloc_screen(void *, const struct wsscreen_descr *,
- void **, int *, int *, long *);
-void pxa2x0_lcd_free_screen(void *, void *);
-int pxa2x0_lcd_ioctl(void *, u_long, caddr_t, int, struct proc *);
-int pxa2x0_lcd_load_font(void *, void *, struct wsdisplay_font *);
-int pxa2x0_lcd_list_font(void *, struct wsdisplay_font *);
-paddr_t pxa2x0_lcd_mmap(void *, off_t, int);
-int pxa2x0_lcd_show_screen(void *, void *, int, void (*)(void *, int, int),
- void *);
-
-void pxa2x0_lcd_power(int, void *);
-void pxa2x0_lcd_suspend(struct pxa2x0_lcd_softc *);
-void pxa2x0_lcd_resume(struct pxa2x0_lcd_softc *);
-
-#endif /* _ARM_XSCALE_PXA2X0_LCD_H */
diff --git a/sys/arch/arm/xscale/pxa2x0_mmc.c b/sys/arch/arm/xscale/pxa2x0_mmc.c
deleted file mode 100644
index 26c4bdd9c02..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_mmc.c
+++ /dev/null
@@ -1,692 +0,0 @@
-/* $OpenBSD: pxa2x0_mmc.c,v 1.13 2016/05/05 11:01:08 kettenis Exp $ */
-
-/*
- * Copyright (c) 2007 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * MMC/SD/SDIO controller driver for Intel PXA27x processors
- *
- * Power management is beyond control of the processor's SD/SDIO/MMC
- * block, so this driver depends on the attachment driver to provide
- * us with some callback functions via the "tag" member in our softc.
- * Bus power management calls are then dispatched to the attachment
- * driver.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-
-#include <machine/bus.h>
-
-#include <arch/arm/xscale/pxa2x0_gpio.h>
-#include <arch/arm/xscale/pxa2x0reg.h>
-#include <arch/arm/xscale/pxa2x0var.h>
-#include <arch/arm/xscale/pxammcvar.h>
-
-#include <dev/sdmmc/sdmmcchip.h>
-#include <dev/sdmmc/sdmmcreg.h>
-#include <dev/sdmmc/sdmmcvar.h>
-
-/* GPIO pins */
-#define PXAMMC_MMCLK 32
-#define PXAMMC_MMCMD 112
-#define PXAMMC_MMDAT0 92
-#define PXAMMC_MMDAT1 109
-#define PXAMMC_MMDAT2 110
-#define PXAMMC_MMDAT3 111
-
-int pxammc_host_reset(sdmmc_chipset_handle_t);
-u_int32_t pxammc_host_ocr(sdmmc_chipset_handle_t);
-int pxammc_host_maxblklen(sdmmc_chipset_handle_t);
-int pxammc_card_detect(sdmmc_chipset_handle_t);
-int pxammc_bus_power(sdmmc_chipset_handle_t, u_int32_t);
-int pxammc_bus_clock(sdmmc_chipset_handle_t, int, int);
-void pxammc_exec_command(sdmmc_chipset_handle_t, struct sdmmc_command *);
-void pxammc_clock_stop(struct pxammc_softc *);
-void pxammc_clock_start(struct pxammc_softc *);
-int pxammc_card_intr(void *);
-int pxammc_intr(void *);
-static inline void pxammc_intr_cmd(struct pxammc_softc *);
-static inline void pxammc_intr_data(struct pxammc_softc *);
-void pxammc_intr_done(struct pxammc_softc *);
-
-#define CSR_READ_1(sc, reg) \
- bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, (reg))
-#define CSR_WRITE_1(sc, reg, val) \
- bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
-#define CSR_READ_4(sc, reg) \
- bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg))
-#define CSR_WRITE_4(sc, reg, val) \
- bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
-#define CSR_SET_4(sc, reg, bits) \
- CSR_WRITE_4((sc), (reg), CSR_READ_4((sc), (reg)) | (bits))
-#define CSR_CLR_4(sc, reg, bits) \
- CSR_WRITE_4((sc), (reg), CSR_READ_4((sc), (reg)) & ~(bits))
-
-struct sdmmc_chip_functions pxammc_functions = {
- /* host controller reset */
- pxammc_host_reset,
- /* host controller capabilities */
- pxammc_host_ocr,
- pxammc_host_maxblklen,
- /* card detection */
- pxammc_card_detect,
- /* bus power and clock frequency */
- pxammc_bus_power,
- pxammc_bus_clock,
- NULL,
- /* command execution */
- pxammc_exec_command
-};
-
-struct cfdriver pxammc_cd = {
- NULL, "pxammc", DV_DULL
-};
-
-#ifdef SDMMC_DEBUG
-int sdhcdebug = 0; /* XXX must be named sdhcdebug for sdmmc.c */
-#define DPRINTF(n,s) do { if ((n) <= sdhcdebug) printf s; } while (0)
-#else
-#define DPRINTF(n,s) do {} while (0)
-#endif
-
-int
-pxammc_match(void)
-{
- return (cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA27X;
-}
-
-void
-pxammc_attach(struct pxammc_softc *sc, void *aux)
-{
- struct pxaip_attach_args *pxa = aux;
- struct sdmmcbus_attach_args saa;
- int s;
-
- /* Enable the clocks to the MMC controller. */
- pxa2x0_clkman_config(CKEN_MMC, 1);
-
- sc->sc_iot = pxa->pxa_sa.sa_iot;
- if (bus_space_map(sc->sc_iot, PXA2X0_MMC_BASE, PXA2X0_MMC_SIZE, 0,
- &sc->sc_ioh) != 0) {
- printf(": can't map regs\n");
- goto fail;
- }
-
- /*
- * Establish the card detection and MMC interrupt handlers and
- * mask all interrupts until we are prepared to handle them.
- */
- s = splsdmmc();
-
- pxa2x0_gpio_set_function(sc->sc_gpio_detect, GPIO_IN);
- sc->sc_card_ih = pxa2x0_gpio_intr_establish(sc->sc_gpio_detect,
- IST_EDGE_BOTH, IPL_SDMMC, pxammc_card_intr, sc, "mmccd");
- if (sc->sc_card_ih == NULL) {
- splx(s);
- printf(": can't establish card interrupt\n");
- goto fail;
- }
- pxa2x0_gpio_intr_mask(sc->sc_card_ih);
-
- sc->sc_ih = pxa2x0_intr_establish(PXA2X0_INT_MMC, IPL_SDMMC,
- pxammc_intr, sc, sc->sc_dev.dv_xname);
- if (sc->sc_ih == NULL) {
- splx(s);
- printf(": can't establish MMC interrupt\n");
- goto fail;
- }
- CSR_WRITE_4(sc, MMC_I_MASK, 0xffffffff);
-
- splx(s);
-
- printf(": MMC/SD/SDIO controller\n");
-
- /*
- * Configure the GPIO pins. In SD/MMC mode, all pins except
- * MMCLK are bidirectional and the direction is controlled in
- * hardware without our assistence.
- */
- pxa2x0_gpio_set_function(PXAMMC_MMCLK, GPIO_ALT_FN_2_OUT);
- pxa2x0_gpio_set_function(PXAMMC_MMCMD, GPIO_ALT_FN_1_IN);
- pxa2x0_gpio_set_function(PXAMMC_MMDAT0, GPIO_ALT_FN_1_IN);
- pxa2x0_gpio_set_function(PXAMMC_MMDAT1, GPIO_ALT_FN_1_IN);
- pxa2x0_gpio_set_function(PXAMMC_MMDAT2, GPIO_ALT_FN_1_IN);
- pxa2x0_gpio_set_function(PXAMMC_MMDAT3, GPIO_ALT_FN_1_IN);
-
- /*
- * Reset the host controller and unmask normal interrupts.
- */
- (void)pxammc_host_reset(sc);
-
- /*
- * Attach the generic sdmmc bus driver.
- */
- bzero(&saa, sizeof saa);
- saa.saa_busname = "sdmmc";
- saa.sct = &pxammc_functions;
- saa.sch = sc;
- saa.flags = SMF_STOP_AFTER_MULTIPLE;
- saa.max_xfer = 1;
-
- sc->sc_sdmmc = config_found(&sc->sc_dev, &saa, NULL);
- if (sc->sc_sdmmc == NULL) {
- printf("%s: can't attach bus\n", sc->sc_dev.dv_xname);
- goto fail;
- }
-
- /* Enable card detection interrupt. */
- pxa2x0_gpio_intr_unmask(sc->sc_card_ih);
- return;
-
-fail:
- if (sc->sc_ih != NULL) {
- pxa2x0_intr_disestablish(sc->sc_ih);
- sc->sc_ih = NULL;
- }
- if (sc->sc_card_ih != NULL) {
- pxa2x0_gpio_intr_disestablish(sc->sc_card_ih);
- sc->sc_card_ih = NULL;
- }
- if (sc->sc_ioh != 0) {
- bus_space_unmap(sc->sc_iot, sc->sc_ioh, PXA2X0_MMC_SIZE);
- sc->sc_ioh = 0;
- }
- pxa2x0_clkman_config(CKEN_MMC, 0);
-}
-
-int
-pxammc_host_reset(sdmmc_chipset_handle_t sch)
-{
- struct pxammc_softc *sc = sch;
- int s = splsdmmc();
-
- /* Make sure to initialize the card before the next command. */
- CLR(sc->sc_flags, PMF_CARD_INITED);
-
- /* Disable SPI mode (we don't support SPI). */
- CSR_WRITE_4(sc, MMC_SPI, 0);
-
- /* Set response timeout to maximum. */
- CSR_WRITE_4(sc, MMC_RESTO, 0x7f);
-
- /* Enable all interrupts. */
- CSR_WRITE_4(sc, MMC_I_MASK, 0);
-
- splx(s);
- return 0;
-}
-
-int
-pxammc_host_maxblklen(sdmmc_chipset_handle_t sch)
-{
- return 2048;
-}
-
-u_int32_t
-pxammc_host_ocr(sdmmc_chipset_handle_t sch)
-{
- struct pxammc_softc *sc = sch;
-
- if (sc->tag.get_ocr != NULL)
- return sc->tag.get_ocr(sc->tag.cookie);
-
- DPRINTF(0,("%s: driver lacks get_ocr() function\n",
- sc->sc_dev.dv_xname));
- return ENXIO;
-}
-
-int
-pxammc_card_detect(sdmmc_chipset_handle_t sch)
-{
- struct pxammc_softc *sc = sch;
- return !pxa2x0_gpio_get_bit(sc->sc_gpio_detect);
-}
-
-int
-pxammc_bus_power(sdmmc_chipset_handle_t sch, u_int32_t ocr)
-{
- struct pxammc_softc *sc = sch;
-
- /*
- * Bus power management is beyond control of the SD/SDIO/MMC
- * block of the PXA2xx processors, so we have to hand this
- * task off to the attachment driver.
- */
- if (sc->tag.set_power != NULL)
- return sc->tag.set_power(sc->tag.cookie, ocr);
-
- DPRINTF(0,("%s: driver lacks set_power() function\n",
- sc->sc_dev.dv_xname));
- return ENXIO;
-}
-
-int
-pxammc_bus_clock(sdmmc_chipset_handle_t sch, int freq, int timing)
-{
- struct pxammc_softc *sc = sch;
- int actfreq = 19500; /* KHz */
- int div = 0;
- int s;
-
- s = splsdmmc();
-
- /* Stop the clock and wait for the interrupt. */
- pxammc_clock_stop(sc);
-
- /* Just stop the clock. */
- if (freq == 0) {
- splx(s);
- return 0;
- }
-
- /*
- * PXA27x Errata...
- *
- * <snip>
- * E40. SDIO: SDIO Devices Not Working at 19.5 Mbps
- *
- * SD/SDIO controller can only support up to 9.75 Mbps data
- * transfer rate for SDIO card.
- * </snip>
- *
- * If we don't limit the frequency, CRC errors will be
- * reported by the controller after we set the bus speed.
- * XXX slow down incrementally.
- */
- if (freq > 9750)
- freq = 9750;
-
- /*
- * Pick the smallest divider that produces a frequency not
- * more than `freq' KHz.
- */
- while (div < 7) {
- if (actfreq <= freq)
- break;
- actfreq /= 2;
- div++;
- }
- if (div == 7) {
- splx(s);
- printf("%s: unsupported bus frequency of %d KHz\n",
- sc->sc_dev.dv_xname, freq);
- return -1;
- }
-
- DPRINTF(1,("pxammc_bus_clock freq=%d actfreq=%d div=%d\n",
- freq, actfreq, div));
- sc->sc_clkdiv = div;
- pxammc_clock_start(sc);
- splx(s);
- return 0;
-}
-
-void
-pxammc_exec_command(sdmmc_chipset_handle_t sch,
- struct sdmmc_command *cmd)
-{
- struct pxammc_softc *sc = sch;
- u_int32_t cmdat;
- int timo;
- int s;
-
- DPRINTF(1,("%s: cmd %u arg=%#x data=%#x dlen=%d flags=%#x "
- "proc=\"%s\"\n", sc->sc_dev.dv_xname, cmd->c_opcode,
- cmd->c_arg, cmd->c_data, cmd->c_datalen, cmd->c_flags,
- curproc ? curproc->p_comm : ""));
-
- s = splsdmmc();
-
- /* Stop the bus clock (MMCLK). [15.8.3] */
- pxammc_clock_stop(sc);
-
- /* Set the command and argument. */
- CSR_WRITE_4(sc, MMC_CMD, cmd->c_opcode);
- CSR_WRITE_4(sc, MMC_ARGH, (cmd->c_arg >> 16) & 0xffff);
- CSR_WRITE_4(sc, MMC_ARGL, cmd->c_arg & 0xffff);
-
- /* Set response characteristics for this command. */
- if (!ISSET(cmd->c_flags, SCF_RSP_PRESENT))
- cmdat = CMDAT_RESPONSE_FORMAT_NO;
- else if (ISSET(cmd->c_flags, SCF_RSP_136))
- cmdat = CMDAT_RESPONSE_FORMAT_R2;
- else if (!ISSET(cmd->c_flags, SCF_RSP_CRC))
- cmdat = CMDAT_RESPONSE_FORMAT_R3;
- else
- cmdat = CMDAT_RESPONSE_FORMAT_R1;
-
- if (ISSET(cmd->c_flags, SCF_RSP_BSY))
- cmdat |= CMDAT_BUSY;
-
- if (!ISSET(cmd->c_flags, SCF_CMD_READ))
- cmdat |= CMDAT_WRITE;
-
- /* Fragment the data into proper blocks. */
- if (cmd->c_datalen > 0) {
- int blklen = MIN(cmd->c_datalen, cmd->c_blklen);
- int numblk = cmd->c_datalen / blklen;
-
- if (cmd->c_datalen % blklen > 0) {
- /* XXX: Split this command. (1.7.4) */
- printf("%s: data not a multiple of %d bytes\n",
- sc->sc_dev.dv_xname, blklen);
- cmd->c_error = EINVAL;
- splx(s);
- return;
- }
-
- CSR_WRITE_4(sc, MMC_BLKLEN, blklen);
- CSR_WRITE_4(sc, MMC_NUMBLK, numblk);
-
- /* Enable data interrupts. */
- CSR_CLR_4(sc, MMC_I_MASK,
- MMC_I_RXFIFO_RD_REQ | MMC_I_TXFIFO_WR_REQ |
- MMC_I_DAT_ERR);
-
- cmd->c_resid = cmd->c_datalen;
- cmd->c_buf = cmd->c_data;
-
- cmdat |= CMDAT_DATA_EN;
- } else {
- cmd->c_resid = 0;
- cmd->c_buf = NULL;
- }
-
- /*
- * "After reset, the MMC card must be initialized by sending
- * 80 clocks to it on the MMCLK signal." [15.4.3.2]
- */
- if (!ISSET(sc->sc_flags, PMF_CARD_INITED)) {
- DPRINTF(1,("%s: first command\n", sc->sc_dev.dv_xname));
- cmdat |= CMDAT_INIT;
- SET(sc->sc_flags, PMF_CARD_INITED);
- }
-
- /* Begin the transfer and start the bus clock. */
- CSR_WRITE_4(sc, MMC_CMDAT, cmdat);
- pxammc_clock_start(sc);
-
- /* Wait for it to complete (in no more than 2 seconds). */
- CSR_CLR_4(sc, MMC_I_MASK, MMC_I_END_CMD_RES | MMC_I_RES_ERR);
- timo = 2;
- sc->sc_cmd = cmd;
- do { tsleep(sc, PWAIT, "mmcmd", hz); }
- while (sc->sc_cmd == cmd && timo-- > 0);
-
- /* If it completed in time, SCF_ITSDONE is already set. */
- if (sc->sc_cmd == cmd) {
- sc->sc_cmd = NULL;
- cmd->c_error = ETIMEDOUT;
- SET(cmd->c_flags, SCF_ITSDONE);
- }
- splx(s);
-}
-
-void
-pxammc_clock_stop(struct pxammc_softc *sc)
-{
- if (ISSET(CSR_READ_4(sc, MMC_STAT), STAT_CLK_EN)) {
- CSR_CLR_4(sc, MMC_I_MASK, MMC_I_CLK_IS_OFF);
- CSR_WRITE_4(sc, MMC_STRPCL, STRPCL_STOP);
- while (ISSET(CSR_READ_4(sc, MMC_STAT), STAT_CLK_EN))
- tsleep(sc, PWAIT, "mmclk", 0);
- }
-}
-
-void
-pxammc_clock_start(struct pxammc_softc *sc)
-{
- CSR_WRITE_4(sc, MMC_CLKRT, sc->sc_clkdiv);
- CSR_WRITE_4(sc, MMC_STRPCL, STRPCL_START);
-}
-
-int
-pxammc_card_intr(void *arg)
-{
- struct pxammc_softc *sc = arg;
-
- DPRINTF(1,("%s: card intr\n", sc->sc_dev.dv_xname));
-
- /* Scan for inserted or removed cards. */
- sdmmc_needs_discover(sc->sc_sdmmc);
-
- return 1;
-}
-
-int
-pxammc_intr(void *arg)
-{
- struct pxammc_softc *sc = arg;
- int status;
-#ifdef DIAGNOSTIC
- int wstatus;
-#endif
-
-#define MMC_I_REG_STR "\20\001DATADONE\002PRGDONE\003ENDCMDRES" \
- "\004STOPCMD\005CLKISOFF\006RXFIFO\007TXFIFO" \
- "\011DATERR\012RESERR\014SDIO"
-
-#ifdef DIAGNOSTIC
- wstatus =
-#endif
- status = CSR_READ_4(sc, MMC_I_REG) & ~CSR_READ_4(sc, MMC_I_MASK);
- DPRINTF(1,("%s: intr %b\n", sc->sc_dev.dv_xname, status,
- MMC_I_REG_STR));
-
- /*
- * Notify the process waiting in pxammc_clock_stop() when
- * the clock has really stopped.
- */
- if (ISSET(status, MMC_I_CLK_IS_OFF)) {
- DPRINTF(2,("%s: clock is now off\n", sc->sc_dev.dv_xname));
- wakeup(sc);
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_CLK_IS_OFF);
- CLR(status, MMC_I_CLK_IS_OFF);
- }
-
- if (sc->sc_cmd == NULL)
- goto end;
-
- if (ISSET(status, MMC_I_RES_ERR)) {
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_RES_ERR);
- CLR(status, MMC_I_RES_ERR | MMC_I_END_CMD_RES);
- sc->sc_cmd->c_error = ENOEXEC;
- pxammc_intr_done(sc);
- goto end;
- }
-
- if (ISSET(status, MMC_I_END_CMD_RES)) {
- pxammc_intr_cmd(sc);
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_END_CMD_RES);
- CLR(status, MMC_I_END_CMD_RES);
- /* ignore programming done condition */
- if (ISSET(status, MMC_I_PRG_DONE)) {
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_PRG_DONE);
- CLR(status, MMC_I_PRG_DONE);
- }
- if (sc->sc_cmd == NULL)
- goto end;
- }
-
- if (ISSET(status, MMC_I_DAT_ERR)) {
- sc->sc_cmd->c_error = EIO;
- pxammc_intr_done(sc);
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_DAT_ERR);
- CLR(status, MMC_I_DAT_ERR);
- /* ignore transmission done condition */
- if (ISSET(status, MMC_I_DATA_TRAN_DONE)) {
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_DATA_TRAN_DONE);
- CLR(status, MMC_I_DATA_TRAN_DONE);
- }
- goto end;
- }
-
- if (ISSET(status, MMC_I_DATA_TRAN_DONE)) {
- pxammc_intr_done(sc);
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_DATA_TRAN_DONE);
- CLR(status, MMC_I_DATA_TRAN_DONE);
- }
-
- if (ISSET(status, MMC_I_TXFIFO_WR_REQ | MMC_I_RXFIFO_RD_REQ)) {
- pxammc_intr_data(sc);
- CLR(status, MMC_I_TXFIFO_WR_REQ | MMC_I_RXFIFO_RD_REQ);
- }
-
-end:
- /* Avoid further unhandled interrupts. */
- if (status != 0) {
-#ifdef DIAGNOSTIC
- printf("%s: unhandled interrupt %b out of %b\n",
- sc->sc_dev.dv_xname, status, MMC_I_REG_STR,
- wstatus, MMC_I_REG_STR);
-#endif
- CSR_SET_4(sc, MMC_I_MASK, status);
- }
-
- return 1;
-}
-
-static inline void
-pxammc_intr_cmd(struct pxammc_softc *sc)
-{
- struct sdmmc_command *cmd = sc->sc_cmd;
- u_int32_t status;
- int i;
-
-#define MMC_STAT_STR "\20\001READ_TIME_OUT\002TIMEOUT_RESPONSE" \
- "\003CRC_WRITE_ERROR\004CRC_READ_ERROR" \
- "\005SPI_READ_ERROR_TOKEN\006RES_CRC_ERR" \
- "\007XMIT_FIFO_EMPTY\010RECV_FIFO_FULL" \
- "\011CLK_EN\012FLASH_ERR\013SPI_WR_ERR" \
- "\014DATA_TRAN_DONE\015PRG_DONE\016END_CMD_RES" \
- "\017RD_STALLED\020SDIO_INT\021SDIO_SUSPEND_ACK"
-
-#define STAT_ERR (STAT_READ_TIME_OUT | STAT_TIMEOUT_RESPONSE | \
- STAT_CRC_WRITE_ERROR | STAT_CRC_READ_ERROR | \
- STAT_SPI_READ_ERROR_TOKEN | STAT_RES_CRC_ERR)
-
- if (ISSET(cmd->c_flags, SCF_RSP_136)) {
- for (i = 3; i >= 0; i--) {
- u_int32_t h = CSR_READ_4(sc, MMC_RES) & 0xffff;
- u_int32_t l = CSR_READ_4(sc, MMC_RES) & 0xffff;
- cmd->c_resp[i] = (h << 16) | l;
- }
- cmd->c_error = 0;
- } else if (ISSET(cmd->c_flags, SCF_RSP_PRESENT)) {
- /*
- * Grrr... The processor manual is not clear about
- * the layout of the response FIFO. It just states
- * that the FIFO is 16 bits wide, has a depth of 8,
- * and that the CRC is not copied into the FIFO.
- *
- * A 16-bit word in the FIFO is filled from highest
- * to lowest bit as the response comes in. The two
- * start bits and the 6 command index bits are thus
- * stored in the upper 8 bits of the first 16-bit
- * word that we read back from the FIFO.
- *
- * Since the sdmmc(4) framework expects the host
- * controller to discard the first 8 bits of the
- * response, what we must do is discard the upper
- * byte of the first 16-bit word.
- */
- u_int32_t h = CSR_READ_4(sc, MMC_RES) & 0xffff;
- u_int32_t m = CSR_READ_4(sc, MMC_RES) & 0xffff;
- u_int32_t l = CSR_READ_4(sc, MMC_RES) & 0xffff;
- cmd->c_resp[0] = h << 24 | m << 8 | l >> 8;
- for (i = 1; i < 4; i++)
- cmd->c_resp[i] = 0;
- cmd->c_error = 0;
- }
-
- status = CSR_READ_4(sc, MMC_STAT);
-
- if (!ISSET(cmd->c_flags, SCF_RSP_PRESENT))
- status &= ~STAT_TIMEOUT_RESPONSE;
-
- /* XXX only for R6, not for R2 */
- if (!ISSET(cmd->c_flags, SCF_RSP_IDX))
- status &= ~STAT_RES_CRC_ERR;
-
- if (ISSET(status, STAT_TIMEOUT_RESPONSE))
- cmd->c_error = ETIMEDOUT;
- else if (ISSET(status, STAT_ERR))
- cmd->c_error = EIO;
-
- if (cmd->c_error || cmd->c_datalen < 1)
- pxammc_intr_done(sc);
-}
-
-static inline void
-pxammc_intr_data(struct pxammc_softc *sc)
-{
- struct sdmmc_command *cmd = sc->sc_cmd;
- int n;
-
- n = MIN(32, cmd->c_resid);
- cmd->c_resid -= n;
-
- DPRINTF(2,("%s: cmd %p resid %d\n", sc->sc_dev.dv_xname,
- cmd, cmd->c_resid));
-
- if (ISSET(cmd->c_flags, SCF_CMD_READ)) {
- while (n-- > 0)
- *cmd->c_buf++ = CSR_READ_1(sc, MMC_RXFIFO);
-
- if (cmd->c_resid > 0)
- CSR_CLR_4(sc, MMC_I_MASK, MMC_I_RXFIFO_RD_REQ);
- else {
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_RXFIFO_RD_REQ);
- CSR_CLR_4(sc, MMC_I_MASK, MMC_I_DATA_TRAN_DONE);
- }
- } else {
- int short_xfer = (n != 0 && n != 32);
-
- while (n-- > 0)
- CSR_WRITE_1(sc, MMC_TXFIFO, *cmd->c_buf++);
- if (short_xfer)
- CSR_WRITE_4(sc, MMC_PRTBUF, 1);
-
- if (cmd->c_resid > 0)
- CSR_CLR_4(sc, MMC_I_MASK, MMC_I_TXFIFO_WR_REQ);
- else {
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_TXFIFO_WR_REQ);
- CSR_CLR_4(sc, MMC_I_MASK, MMC_I_DATA_TRAN_DONE);
- }
- }
-}
-
-/*
- * Wake up the process sleeping in pxammc_exec_command().
- */
-void
-pxammc_intr_done(struct pxammc_softc *sc)
-{
- DPRINTF(1,("%s: status %b\n", sc->sc_dev.dv_xname,
- CSR_READ_4(sc, MMC_STAT), MMC_STAT_STR));
-
- CSR_SET_4(sc, MMC_I_MASK, MMC_I_TXFIFO_WR_REQ |
- MMC_I_RXFIFO_RD_REQ | MMC_I_DATA_TRAN_DONE |
- MMC_I_END_CMD_RES | MMC_I_RES_ERR | MMC_I_DAT_ERR);
-
- SET(sc->sc_cmd->c_flags, SCF_ITSDONE);
- sc->sc_cmd = NULL;
- wakeup(sc);
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_mutex.c b/sys/arch/arm/xscale/pxa2x0_mutex.c
deleted file mode 100644
index 6952105a8d6..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_mutex.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $OpenBSD: pxa2x0_mutex.c,v 1.2 2009/08/13 13:24:55 weingart Exp $ */
-
-/*
- * Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``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/param.h>
-#include <sys/mutex.h>
-#include <sys/systm.h>
-
-#include <machine/intr.h>
-
-#ifdef MULTIPROCESSOR
-#error This code needs work
-#endif
-
-/*
- * Single processor systems don't need any mutexes, but they need the spl
- * raising semantics of the mutexes.
- */
-void
-mtx_init(struct mutex *mtx, int wantipl)
-{
- mtx->mtx_oldipl = 0;
- mtx->mtx_wantipl = wantipl;
- mtx->mtx_lock = 0;
-}
-
-void
-mtx_enter(struct mutex *mtx)
-{
- if (mtx->mtx_wantipl != IPL_NONE)
- mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl);
-
- MUTEX_ASSERT_UNLOCKED(mtx);
- mtx->mtx_lock = 1;
-}
-
-int
-mtx_enter_try(struct mutex *mtx)
-{
- if (mtx->mtx_wantipl != IPL_NONE)
- mtx->mtx_oldipl = _splraise(mtx->mtx_wantipl);
-
- MUTEX_ASSERT_UNLOCKED(mtx);
- mtx->mtx_lock = 1;
- return 1;
-}
-
-void
-mtx_leave(struct mutex *mtx)
-{
- MUTEX_ASSERT_LOCKED(mtx);
- mtx->mtx_lock = 0;
- if (mtx->mtx_wantipl != IPL_NONE)
- splx(mtx->mtx_oldipl);
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_ohci.c b/sys/arch/arm/xscale/pxa2x0_ohci.c
deleted file mode 100644
index fd9db77c406..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_ohci.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* $OpenBSD: pxa2x0_ohci.c,v 1.26 2014/05/19 13:11:31 mpi Exp $ */
-
-/*
- * Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/timeout.h>
-
-#include <machine/intr.h>
-#include <machine/bus.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdivar.h>
-#include <dev/usb/usb_mem.h>
-
-#include <dev/usb/ohcireg.h>
-#include <dev/usb/ohcivar.h>
-
-int pxaohci_match(struct device *, void *, void *);
-void pxaohci_attach(struct device *, struct device *, void *);
-int pxaohci_detach(struct device *, int);
-int pxaohci_activate(struct device *, int);
-
-struct pxaohci_softc {
- struct ohci_softc sc;
- void *sc_ih;
-};
-
-void pxaohci_enable(struct pxaohci_softc *);
-void pxaohci_disable(struct pxaohci_softc *);
-
-struct cfattach pxaohci_ca = {
- sizeof (struct pxaohci_softc), pxaohci_match, pxaohci_attach,
- pxaohci_detach, ohci_activate
-};
-
-int
-pxaohci_match(struct device *parent, void *match, void *aux)
-{
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) != CPU_ID_PXA27X)
- return (0);
-
- return (1);
-}
-
-void
-pxaohci_attach(struct device *parent, struct device *self, void *aux)
-{
- struct pxaohci_softc *sc = (struct pxaohci_softc *)self;
- struct pxaip_attach_args *pxa = aux;
- usbd_status r;
-
- sc->sc.iot = pxa->pxa_iot;
- sc->sc.sc_bus.dmatag = pxa->pxa_dmat;
- sc->sc_ih = NULL;
- sc->sc.sc_size = 0;
-
- /* Map I/O space */
- if (bus_space_map(sc->sc.iot, PXA2X0_USBHC_BASE, PXA2X0_USBHC_SIZE, 0,
- &sc->sc.ioh)) {
- printf(": cannot map mem space\n");
- return;
- }
- sc->sc.sc_size = PXA2X0_USBHC_SIZE;
-
- /* XXX copied from ohci_pci.c. needed? */
- bus_space_barrier(sc->sc.iot, sc->sc.ioh, 0, sc->sc.sc_size,
- BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
-
- /* start the usb clock */
- pxa2x0_clkman_config(CKEN_USBHC, 1);
- pxaohci_enable(sc);
-
- /* Disable interrupts, so we don't get any spurious ones. */
- bus_space_write_4(sc->sc.iot, sc->sc.ioh, OHCI_INTERRUPT_DISABLE,
- OHCI_MIE);
-
- sc->sc_ih = pxa2x0_intr_establish(PXA2X0_INT_USBH1, IPL_USB,
- ohci_intr, &sc->sc, sc->sc.sc_bus.bdev.dv_xname);
- if (sc->sc_ih == NULL) {
- printf(": unable to establish interrupt\n");
- pxaohci_disable(sc);
- pxa2x0_clkman_config(CKEN_USBHC, 0);
- bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
- sc->sc.sc_size = 0;
- return;
- }
-
- strlcpy(sc->sc.sc_vendor, "PXA27x", sizeof(sc->sc.sc_vendor));
-
- if (ohci_checkrev(&sc->sc) != USBD_NORMAL_COMPLETION)
- goto unsupported;
-
- r = ohci_init(&sc->sc);
- if (r != USBD_NORMAL_COMPLETION) {
- printf("%s: init failed, error=%d\n",
- sc->sc.sc_bus.bdev.dv_xname, r);
-unsupported:
- pxa2x0_intr_disestablish(sc->sc_ih);
- sc->sc_ih = NULL;
- pxaohci_disable(sc);
- pxa2x0_clkman_config(CKEN_USBHC, 0);
- bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
- sc->sc.sc_size = 0;
- return;
- }
-
- config_found(self, &sc->sc.sc_bus, usbctlprint);
-}
-
-int
-pxaohci_detach(struct device *self, int flags)
-{
- struct pxaohci_softc *sc = (struct pxaohci_softc *)self;
- int rv;
-
- rv = ohci_detach(self, flags);
- if (rv)
- return (rv);
-
- if (sc->sc_ih != NULL) {
- pxa2x0_intr_disestablish(sc->sc_ih);
- sc->sc_ih = NULL;
- }
-
- pxaohci_disable(sc);
-
- /* stop clock */
- pxa2x0_clkman_config(CKEN_USBHC, 0);
-
- if (sc->sc.sc_size) {
- bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
- sc->sc.sc_size = 0;
- }
-
- return (0);
-}
-
-
-int
-pxaohci_activate(struct device *self, int act)
-{
- struct pxaohci_softc *sc = (struct pxaohci_softc *)self;
-
- switch (act) {
- case DVACT_SUSPEND:
- sc->sc.sc_bus.use_polling++;
- ohci_activate((struct device *)&sc->sc, act);
- pxa2x0_clkman_config(CKEN_USBHC, 0);
- sc->sc.sc_bus.use_polling--;
- break;
- case DVACT_RESUME:
- sc->sc.sc_bus.use_polling++;
- pxa2x0_clkman_config(CKEN_USBHC, 1);
- pxaohci_enable(sc);
- ohci_activate((struct device *)&sc->sc, act);
- sc->sc.sc_bus.use_polling--;
- break;
- }
- return 0;
-}
-
-void
-pxaohci_enable(struct pxaohci_softc *sc)
-{
- u_int32_t hr;
-
- /* Full host reset */
- hr = bus_space_read_4(sc->sc.iot, sc->sc.ioh, USBHC_HR);
- bus_space_write_4(sc->sc.iot, sc->sc.ioh, USBHC_HR,
- (hr & USBHC_HR_MASK) | USBHC_HR_FHR);
-
- DELAY(USBHC_RST_WAIT);
-
- hr = bus_space_read_4(sc->sc.iot, sc->sc.ioh, USBHC_HR);
- bus_space_write_4(sc->sc.iot, sc->sc.ioh, USBHC_HR,
- (hr & USBHC_HR_MASK) & ~(USBHC_HR_FHR));
-
- /* Force system bus interface reset */
- hr = bus_space_read_4(sc->sc.iot, sc->sc.ioh, USBHC_HR);
- bus_space_write_4(sc->sc.iot, sc->sc.ioh, USBHC_HR,
- (hr & USBHC_HR_MASK) | USBHC_HR_FSBIR);
-
- while (bus_space_read_4(sc->sc.iot, sc->sc.ioh, USBHC_HR) & \
- USBHC_HR_FSBIR)
- DELAY(3);
-
- /* Enable the ports (physically only one, only enable that one?) */
- hr = bus_space_read_4(sc->sc.iot, sc->sc.ioh, USBHC_HR);
- bus_space_write_4(sc->sc.iot, sc->sc.ioh, USBHC_HR,
- (hr & USBHC_HR_MASK) & ~(USBHC_HR_SSE));
- hr = bus_space_read_4(sc->sc.iot, sc->sc.ioh, USBHC_HR);
- bus_space_write_4(sc->sc.iot, sc->sc.ioh, USBHC_HR,
- (hr & USBHC_HR_MASK) & ~(USBHC_HR_SSEP2));
-}
-
-void
-pxaohci_disable(struct pxaohci_softc *sc)
-{
- u_int32_t hr;
-
- /* Full host reset */
- hr = bus_space_read_4(sc->sc.iot, sc->sc.ioh, USBHC_HR);
- bus_space_write_4(sc->sc.iot, sc->sc.ioh, USBHC_HR,
- (hr & USBHC_HR_MASK) | USBHC_HR_FHR);
-
- DELAY(USBHC_RST_WAIT);
-
- hr = bus_space_read_4(sc->sc.iot, sc->sc.ioh, USBHC_HR);
- bus_space_write_4(sc->sc.iot, sc->sc.ioh, USBHC_HR,
- (hr & USBHC_HR_MASK) & ~(USBHC_HR_FHR));
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_pcic.c b/sys/arch/arm/xscale/pxa2x0_pcic.c
deleted file mode 100644
index 530720f0c45..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_pcic.c
+++ /dev/null
@@ -1,515 +0,0 @@
-/* $OpenBSD: pxa2x0_pcic.c,v 1.20 2014/04/03 10:17:34 mpi Exp $ */
-
-/*
- * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/kthread.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <dev/pcmcia/pcmciareg.h>
-#include <dev/pcmcia/pcmciavar.h>
-#include <dev/pcmcia/pcmciachip.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-#include <arm/xscale/pxapcicvar.h>
-
-int pxapcic_print(void *, const char *);
-int pxapcic_submatch(struct device *, void *, void *);
-
-void pxapcic_create_event_thread(void *);
-void pxapcic_event_thread(void *);
-void pxapcic_event_process(struct pxapcic_socket *);
-void pxapcic_attach_card(struct pxapcic_socket *);
-void pxapcic_detach_card(struct pxapcic_socket *, int);
-int pxapcic_intr(void *);
-
-int pxapcic_mem_alloc(pcmcia_chipset_handle_t, bus_size_t,
- struct pcmcia_mem_handle *);
-void pxapcic_mem_free(pcmcia_chipset_handle_t,
- struct pcmcia_mem_handle *);
-int pxapcic_mem_map(pcmcia_chipset_handle_t, int, bus_addr_t,
- bus_size_t, struct pcmcia_mem_handle *, bus_size_t *, int *);
-void pxapcic_mem_unmap(pcmcia_chipset_handle_t, int);
-
-int pxapcic_io_alloc(pcmcia_chipset_handle_t, bus_addr_t,
- bus_size_t, bus_size_t, struct pcmcia_io_handle *);
-void pxapcic_io_free(pcmcia_chipset_handle_t,
- struct pcmcia_io_handle *);
-int pxapcic_io_map(pcmcia_chipset_handle_t, int,
- bus_addr_t, bus_size_t, struct pcmcia_io_handle *, int *);
-void pxapcic_io_unmap(pcmcia_chipset_handle_t, int);
-
-void *pxapcic_intr_establish(pcmcia_chipset_handle_t,
- struct pcmcia_function *, int, int (*)(void *), void *, char *);
-void pxapcic_intr_disestablish(pcmcia_chipset_handle_t, void *);
-const char *pxapcic_intr_string(pcmcia_chipset_handle_t, void *);
-
-void pxapcic_socket_setup(struct pxapcic_socket *);
-void pxapcic_socket_enable(pcmcia_chipset_handle_t);
-void pxapcic_socket_disable(pcmcia_chipset_handle_t);
-
-struct cfdriver pxapcic_cd = {
- NULL, "pxapcic", DV_DULL
-};
-
-/*
- * PCMCIA chipset methods
- */
-struct pcmcia_chip_functions pxapcic_pcmcia_functions = {
- pxapcic_mem_alloc,
- pxapcic_mem_free,
- pxapcic_mem_map,
- pxapcic_mem_unmap,
-
- pxapcic_io_alloc,
- pxapcic_io_free,
- pxapcic_io_map,
- pxapcic_io_unmap,
-
- pxapcic_intr_establish,
- pxapcic_intr_disestablish,
- pxapcic_intr_string,
-
- pxapcic_socket_enable,
- pxapcic_socket_disable,
-};
-
-/*
- * PCMCIA Helpers
- */
-
-int
-pxapcic_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size,
- struct pcmcia_mem_handle *pmh)
-{
- struct pxapcic_socket *so = pch;
-
- /* All we need is the bus space tag */
- memset(pmh, 0, sizeof(*pmh));
- pmh->memt = so->sc->sc_iot;
- return (0);
-}
-
-void
-pxapcic_mem_free(pcmcia_chipset_handle_t pch, struct pcmcia_mem_handle *pmh)
-{
-}
-
-int
-pxapcic_mem_map(pcmcia_chipset_handle_t pch, int kind, bus_addr_t card_addr,
- bus_size_t size, struct pcmcia_mem_handle *pmh, bus_size_t *offsetp,
- int *windowp)
-{
- struct pxapcic_socket *so = pch;
- int error;
- bus_addr_t pa;
-
- pa = trunc_page(card_addr);
- *offsetp = card_addr - pa;
- size = round_page(card_addr + size) - pa;
- pmh->realsize = size;
-
-#define PXA2X0_SOCKET_OFFSET (PXA2X0_PCMCIA_SLOT1-PXA2X0_PCMCIA_SLOT0)
-#define PXAPCIC_ATTR_OFFSET 0x08000000
-#define PXAPCIC_COMMON_OFFSET 0x0C000000
-
- pa += PXA2X0_PCMCIA_SLOT0;
- pa += PXA2X0_SOCKET_OFFSET * so->socket;
-
- switch (kind & ~PCMCIA_WIDTH_MEM_MASK) {
- case PCMCIA_MEM_ATTR:
- pa += PXAPCIC_ATTR_OFFSET;
- break;
- case PCMCIA_MEM_COMMON:
- pa += PXAPCIC_COMMON_OFFSET;
- break;
- default:
- panic("pxapcic_mem_map: bogus kind");
- }
-
- error = bus_space_map(so->sc->sc_iot, pa, size, 0, &pmh->memh);
- if (! error)
- *windowp = (int)pmh->memh;
- return (error);
-}
-
-void
-pxapcic_mem_unmap(pcmcia_chipset_handle_t pch, int window)
-{
- struct pxapcic_socket *so = pch;
-
- bus_space_unmap(so->sc->sc_iot, (bus_addr_t)window, 4096); /* XXX */
-}
-
-int
-pxapcic_io_alloc(pcmcia_chipset_handle_t pch, bus_addr_t start,
- bus_size_t size, bus_size_t align, struct pcmcia_io_handle *pih)
-{
- struct pxapcic_socket *so = pch;
- int error;
- bus_addr_t pa;
-
- memset(pih, 0, sizeof(*pih));
- pih->iot = so->sc->sc_iot;
- pih->addr = start;
- pih->size = size;
-
- pa = pih->addr;
- pa += PXA2X0_PCMCIA_SLOT0;
- pa += PXA2X0_SOCKET_OFFSET * so->socket;
-
-#if 0
- printf("pxapcic_io_alloc: %x %x\n", (unsigned int)pa,
- (unsigned int)size);
-#endif
- /* XXX Are we ignoring alignment constraints? */
- error = bus_space_map(so->sc->sc_iot, pa, size, 0, &pih->ioh);
-
- return (error);
-}
-
-void
-pxapcic_io_free(pcmcia_chipset_handle_t pch, struct pcmcia_io_handle *pih)
-{
- struct pxapcic_socket *so = pch;
-
- bus_space_unmap(so->sc->sc_iot, pih->ioh, pih->size);
-}
-
-int
-pxapcic_io_map(pcmcia_chipset_handle_t pch, int width, bus_addr_t offset,
- bus_size_t size, struct pcmcia_io_handle *pih, int *windowp)
-{
- return (0);
-}
-
-void pxapcic_io_unmap(pcmcia_chipset_handle_t pch, int window)
-{
-}
-
-void *
-pxapcic_intr_establish(pcmcia_chipset_handle_t pch,
- struct pcmcia_function *pf, int ipl, int (*fct)(void *), void *arg,
- char *name)
-{
- struct pxapcic_socket *so = pch;
- /* XXX need to check if something should be done here */
-
- return (pxa2x0_gpio_intr_establish(so->irqpin, IST_EDGE_FALLING,
- ipl, fct, arg, name));
-}
-
-void
-pxapcic_intr_disestablish(pcmcia_chipset_handle_t pch, void *ih)
-{
- pxa2x0_gpio_intr_disestablish(ih);
-}
-
-const char *
-pxapcic_intr_string(pcmcia_chipset_handle_t pch, void *ih)
-{
- return (pxa2x0_gpio_intr_string(ih));
-}
-
-void
-pxapcic_socket_enable(pcmcia_chipset_handle_t pch)
-{
- struct pxapcic_socket *so = pch;
- int i;
-
- /* Power down the card and socket before setting the voltage. */
- so->pcictag->write(so, PXAPCIC_CARD_POWER, PXAPCIC_POWER_OFF);
- so->pcictag->set_power(so, PXAPCIC_POWER_OFF);
-
- /*
- * Wait 300ms until power fails (Tpf). Then, wait 100ms since
- * we are changing Vcc (Toff).
- */
- delay((300 + 100) * 1000);
-
- /* Power up the socket and card at appropriate voltage. */
- if (so->power_capability & PXAPCIC_POWER_5V) {
- so->pcictag->set_power(so, PXAPCIC_POWER_5V);
- so->pcictag->write(so, PXAPCIC_CARD_POWER,
- PXAPCIC_POWER_5V);
- } else {
- so->pcictag->set_power(so, PXAPCIC_POWER_3V);
- so->pcictag->write(so, PXAPCIC_CARD_POWER,
- PXAPCIC_POWER_3V);
- }
-
- /*
- * Wait 100ms until power raise (Tpr) and 20ms to become
- * stable (Tsu(Vcc)).
- *
- * Some machines require some more time to be settled
- * (another 200ms is added here).
- */
- delay((100 + 20 + 200) * 1000);
-
- /* Hold RESET at least 10us. */
- so->pcictag->write(so, PXAPCIC_CARD_RESET, 1);
- delay(10);
- /* XXX wrong, but lets TE-CF100 cards work for some reason. */
- delay(3000);
- so->pcictag->write(so, PXAPCIC_CARD_RESET, 0);
-
- /* Wait 20ms as per PC Card standard (r2.01) section 4.3.6. */
- delay(20000);
-
- /* Wait for the card to become ready. */
- for (i = 0; i < 10000; i++) {
- if (so->pcictag->read(so, PXAPCIC_CARD_READY))
- break;
- delay(500);
-#ifdef PCICDEBUG
- if ((i>5000) && (i%100 == 99))
- printf(".");
-#endif
- }
-}
-
-void
-pxapcic_socket_disable(pcmcia_chipset_handle_t pch)
-{
- struct pxapcic_socket *so = pch;
-
-#ifdef PCICDEBUG
- printf("pxapcic_socket_disable: socket %d\n", so->socket);
-#endif
-
- /* Power down the card and socket. */
- so->pcictag->write(so, PXAPCIC_CARD_POWER, PXAPCIC_POWER_OFF);
- so->pcictag->set_power(so, PXAPCIC_POWER_OFF);
-}
-
-/*
- * Attachment and initialization
- */
-
-int
-pxapcic_print(void *aux, const char *name)
-{
- return (UNCONF);
-}
-
-int
-pxapcic_submatch(struct device *parent, void *match, void *aux)
-{
- struct cfdata *cf = match;
-
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
-}
-
-void
-pxapcic_attach(struct pxapcic_softc *sc,
- void (*socket_setup_hook)(struct pxapcic_socket *))
-{
- struct pcmciabus_attach_args paa;
- struct pxapcic_socket *so;
- int i;
-
- printf(": %d slot%s\n", sc->sc_nslots, sc->sc_nslots==1 ? "" : "s");
-
- if (bus_space_map(sc->sc_iot, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE,
- 0, &sc->sc_memctl_ioh)) {
- printf("%s: failed to map MEMCTL\n", sc->sc_dev.dv_xname);
- return;
- }
-
- /* Clear CIT (card present) and set NOS correctly. */
- bus_space_write_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR,
- sc->sc_nslots == 2 ? MECR_NOS : 0);
-
- /* zaurus: configure slot 1 first to make internal drive be wd0. */
- for (i = sc->sc_nslots-1; i >= 0; i--) {
- so = &sc->sc_socket[i];
- so->sc = sc;
- so->socket = i;
- so->flags = 0;
-
- socket_setup_hook(so);
-
- paa.paa_busname = "pcmcia";
- paa.pct = (pcmcia_chipset_tag_t)&pxapcic_pcmcia_functions;
- paa.pch = (pcmcia_chipset_handle_t)so;
- paa.iobase = 0;
- paa.iosize = 0x4000000;
-
- so->pcmcia = config_found_sm(&sc->sc_dev, &paa,
- pxapcic_print, pxapcic_submatch);
-
- pxa2x0_gpio_set_function(sc->sc_irqpin[i], GPIO_IN);
- pxa2x0_gpio_set_function(sc->sc_irqcfpin[i], GPIO_IN);
-
- /* Card slot interrupt */
- so->irq = pxa2x0_gpio_intr_establish(sc->sc_irqcfpin[i],
- IST_EDGE_BOTH, IPL_BIO /* XXX */, pxapcic_intr, so,
- sc->sc_dev.dv_xname);
-
- /* GPIO pin for interrupt */
- so->irqpin = sc->sc_irqpin[i];
-
-#ifdef DO_CONFIG_PENDING
- config_pending_incr();
-#endif
- kthread_create_deferred(pxapcic_create_event_thread, so);
- }
-}
-
-/*
- * Card slot interrupt handling
- */
-
-int
-pxapcic_intr(void *arg)
-{
- struct pxapcic_socket *so = arg;
-
- so->pcictag->clear_intr(so);
- wakeup(so);
- return (1);
-}
-
-/*
- * Event management
- */
-
-void
-pxapcic_create_event_thread(void *arg)
-{
- struct pxapcic_socket *sock = arg;
- struct pxapcic_softc *sc = sock->sc;
- char name[MAXCOMLEN+1];
- u_int cs;
-
- /* If there's a card there, attach it. */
- cs = sock->pcictag->read(sock, PXAPCIC_CARD_STATUS);
- if (cs == PXAPCIC_CARD_VALID)
- pxapcic_attach_card(sock);
-
- snprintf(name, sizeof name, "%s-%d", sc->sc_dev.dv_xname, sock->socket);
- if (kthread_create(pxapcic_event_thread, sock, &sock->event_thread,
- name))
- printf("%s: unable to create event thread for %s\n",
- sc->sc_dev.dv_xname, sock->socket ? "1" : "0");
-#ifdef DO_CONFIG_PENDING
- config_pending_decr();
-#endif
-}
-
-void
-pxapcic_event_thread(void *arg)
-{
- struct pxapcic_socket *sock = arg;
- u_int cs;
- int present;
-
- while (sock->sc->sc_shutdown == 0) {
-
- (void) tsleep(sock, PWAIT, "pxapcicev", 0);
-
- /* sleep .25s to avoid chattering interrupts */
- (void) tsleep((caddr_t)sock, PWAIT,
- "pxapcicss", hz/4);
-
- cs = sock->pcictag->read(sock, PXAPCIC_CARD_STATUS);
-
- present = sock->flags & PXAPCIC_FLAG_CARDP;
-
- if ((cs == PXAPCIC_CARD_VALID) == (present == 1))
- continue; /* state unchanged */
-
- /* XXX Do both? */
- pxapcic_event_process(sock);
- }
-
- sock->event_thread = NULL;
-
- /* In case parent is waiting for us to exit. */
- wakeup(sock->sc);
-
- kthread_exit(0);
-}
-
-void
-pxapcic_event_process(struct pxapcic_socket *sock)
-{
- u_int cs;
-
- cs = sock->pcictag->read(sock, PXAPCIC_CARD_STATUS);
-
- if (cs == PXAPCIC_CARD_VALID) {
- if (!(sock->flags & PXAPCIC_FLAG_CARDP))
- pxapcic_attach_card(sock);
- } else {
- if ((sock->flags & PXAPCIC_FLAG_CARDP))
- pxapcic_detach_card(sock, DETACH_FORCE);
- }
-}
-
-void
-pxapcic_attach_card(struct pxapcic_socket *h)
-{
- struct pxapcic_softc *sc = h->sc;
- u_int32_t rv;
-
- if (h->flags & PXAPCIC_FLAG_CARDP)
- panic("pcic_attach_card: already attached");
- h->flags |= PXAPCIC_FLAG_CARDP;
-
- /* Set CIT if any card is present. */
- rv = bus_space_read_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR);
- bus_space_write_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR,
- rv | MECR_CIT);
-
- /* call the MI attach function */
- pcmcia_card_attach(h->pcmcia);
-}
-
-void
-pxapcic_detach_card(struct pxapcic_socket *h, int flags)
-{
- struct pxapcic_softc *sc = h->sc;
- u_int32_t rv;
- int i;
-
- if (h->flags & PXAPCIC_FLAG_CARDP) {
- h->flags &= ~PXAPCIC_FLAG_CARDP;
-
- /* call the MI detach function */
- pcmcia_card_detach(h->pcmcia, flags);
- }
-
- /* Clear CIT if no other card is present. */
- for (i = 0; i < sc->sc_nslots; i++)
- if (sc->sc_socket[i].flags & PXAPCIC_FLAG_CARDP)
- return;
- rv = bus_space_read_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR);
- bus_space_write_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR,
- rv & ~MECR_CIT);
-}
diff --git a/sys/arch/arm/xscale/pxa2x0_space.c b/sys/arch/arm/xscale/pxa2x0_space.c
deleted file mode 100644
index f7c3aae7ad3..00000000000
--- a/sys/arch/arm/xscale/pxa2x0_space.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/* $OpenBSD: pxa2x0_space.c,v 1.5 2014/11/16 12:30:56 deraadt Exp $ */
-/* $NetBSD: pxa2x0_space.c,v 1.5 2004/06/07 19:45:22 nathanw Exp $ */
-
-/*
- * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Jason R. Thorpe for Wasabi Systems, Inc.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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.
- */
-/*
- * Copyright (c) 1997 Mark Brinicombe.
- * Copyright (c) 1997 Causality Limited.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Ichiro FUKUHARA.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * 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 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.
- */
-
-/*
- * bus_space functions for Intel PXA2[51]0 application processor.
- * Derived from i80321_space.c.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-
-/* Prototypes for all the bus_space structure functions */
-bs_protos(pxa2x0);
-bs_protos(generic);
-bs_protos(generic_armv4);
-bs_protos(bs_notimpl);
-
-struct bus_space pxa2x0_bs_tag = {
- /* cookie */
- (void *) 0,
-
- /* mapping/unmapping */
- pxa2x0_bs_map,
- pxa2x0_bs_unmap,
- pxa2x0_bs_subregion,
-
- /* allocation/deallocation */
- pxa2x0_bs_alloc, /* not implemented */
- pxa2x0_bs_free, /* not implemented */
-
- /* get kernel virtual address */
- pxa2x0_bs_vaddr,
-
- /* mmap */
- bs_notimpl_bs_mmap,
-
- /* barrier */
- pxa2x0_bs_barrier,
-
- /* read (single) */
- generic_bs_r_1,
- generic_armv4_bs_r_2,
- generic_bs_r_4,
- bs_notimpl_bs_r_8,
-
- /* read multiple */
- generic_bs_rm_1,
- generic_armv4_bs_rm_2,
- generic_bs_rm_4,
- bs_notimpl_bs_rm_8,
-
- /* read region */
- generic_bs_rr_1,
- generic_armv4_bs_rr_2,
- generic_bs_rr_4,
- bs_notimpl_bs_rr_8,
-
- /* write (single) */
- generic_bs_w_1,
- generic_armv4_bs_w_2,
- generic_bs_w_4,
- bs_notimpl_bs_w_8,
-
- /* write multiple */
- generic_bs_wm_1,
- generic_armv4_bs_wm_2,
- generic_bs_wm_4,
- bs_notimpl_bs_wm_8,
-
- /* write region */
- generic_bs_wr_1,
- generic_armv4_bs_wr_2,
- generic_bs_wr_4,
- bs_notimpl_bs_wr_8,
-
- /* set multiple */
- bs_notimpl_bs_sm_1,
- bs_notimpl_bs_sm_2,
- bs_notimpl_bs_sm_4,
- bs_notimpl_bs_sm_8,
-
- /* set region */
- generic_bs_sr_1,
- generic_armv4_bs_sr_2,
- bs_notimpl_bs_sr_4,
- bs_notimpl_bs_sr_8,
-
- /* copy */
- bs_notimpl_bs_c_1,
- generic_armv4_bs_c_2,
- bs_notimpl_bs_c_4,
- bs_notimpl_bs_c_8,
-};
-
-int
-pxa2x0_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
- int flag, bus_space_handle_t *bshp)
-{
- u_long startpa, endpa, pa;
- vaddr_t va;
- pt_entry_t *pte;
-
- if ((u_long)bpa > (u_long)KERNEL_BASE) {
- /* Some IO registers (ex. UART ports for console)
- are mapped to fixed address by board specific
- routine. */
- *bshp = bpa;
- return(0);
- }
-
- startpa = trunc_page(bpa);
- endpa = round_page(bpa + size);
-
- /* XXX use extent manager to check duplicate mapping */
-
- va = uvm_km_valloc(kernel_map, endpa - startpa);
- if (! va)
- return(ENOMEM);
-
- *bshp = (bus_space_handle_t)(va + (bpa - startpa));
-
- for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
- pmap_kenter_pa(va, pa, PROT_READ | PROT_WRITE);
- if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) {
- pte = vtopte(va);
- *pte &= ~L2_S_CACHE_MASK;
- PTE_SYNC(pte);
- /* XXX: pmap_kenter_pa() also does PTE_SYNC(). a bit of
- * waste.
- */
- }
- }
- pmap_update(pmap_kernel());
-
- return(0);
-}
-
-void
-pxa2x0_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
-{
-
- if (bsh > (u_long)KERNEL_BASE)
- return;
-
- uvm_km_free(kernel_map, bsh, size);
-}
-
-
-int
-pxa2x0_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
- bus_size_t size, bus_space_handle_t *nbshp)
-{
-
- *nbshp = bsh + offset;
- return (0);
-}
-
-void
-pxa2x0_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
- bus_size_t len, int flags)
-{
-
- /* Nothing to do. */
-}
-
-void *
-pxa2x0_bs_vaddr(void *t, bus_space_handle_t bsh)
-{
-
- return ((void *)bsh);
-}
-
-
-int
-pxa2x0_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
- bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags,
- bus_addr_t *bpap, bus_space_handle_t *bshp)
-{
-
- panic("pxa2x0_io_bs_alloc(): not implemented");
-}
-
-void
-pxa2x0_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
-{
-
- panic("pxa2x0_io_bs_free(): not implemented");
-}
-
diff --git a/sys/arch/arm/xscale/pxa2x0reg.h b/sys/arch/arm/xscale/pxa2x0reg.h
deleted file mode 100644
index 9595049f156..00000000000
--- a/sys/arch/arm/xscale/pxa2x0reg.h
+++ /dev/null
@@ -1,895 +0,0 @@
-/* $OpenBSD: pxa2x0reg.h,v 1.31 2009/09/09 12:14:39 marex Exp $ */
-/* $NetBSD: pxa2x0reg.h,v 1.4 2003/06/11 20:43:01 scw Exp $ */
-
-/*
- * Copyright (c) 2002 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Genetec Corporation.
- * 4. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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.
- */
-
-
-/*
- * Intel PXA2[15]0 processor is XScale based integrated CPU
- *
- * Reference:
- * Intel(r) PXA250 and PXA210 Application Processors
- * Developer's Manual
- * (278522-001.pdf)
- *
- * Intel PXA 27x Processor Family Developers Manual (280000-002)
- */
-#ifndef _ARM_XSCALE_PXA2X0REG_H_
-#define _ARM_XSCALE_PXA2X0REG_H_
-
-/* Borrow some register definitions from sa11x0 */
-#include <arm/sa11x0/sa11x0_reg.h>
-
-#ifndef _LOCORE
-#include <sys/types.h> /* for uint32_t */
-#endif
-
-/*
- * Chip select domains
- */
-#define PXA2X0_CS0_START 0x00000000
-#define PXA2X0_CS1_START 0x04000000
-#define PXA2X0_CS2_START 0x08000000
-#define PXA2X0_CS3_START 0x0c000000
-#define PXA2X0_CS4_START 0x10000000
-#define PXA2X0_CS5_START 0x14000000
-
-#define PXA2X0_PCMCIA_SLOT0 0x20000000
-#define PXA2X0_PCMCIA_SLOT1 0x30000000
-
-#define PXA2X0_PERIPH_START 0x40000000
-/* #define PXA2X0_MEMCTL_START 0x48000000 */
-#define PXA2X0_PERIPH_END 0x480fffff
-
-#define PXA2X0_SDRAM0_START 0xa0000000
-#define PXA2X0_SDRAM1_START 0xa4000000
-#define PXA2X0_SDRAM2_START 0xa8000000
-#define PXA2X0_SDRAM3_START 0xac000000
-#define PXA2X0_SDRAM_BANKS 4
-#define PXA2X0_SDRAM_BANK_SIZE 0x04000000
-
-/*
- * Physical address of integrated peripherals
- */
-
-#define PXA2X0_DMAC_BASE 0x40000000
-#define PXA2X0_DMAC_SIZE 0x300
-#define PXA27X_DMAC_SIZE 0x0400
-#define PXA2X0_FFUART_BASE 0x40100000 /* Full Function UART */
-#define PXA2X0_BTUART_BASE 0x40200000 /* Bluetooth UART */
-#define PXA2X0_I2C_BASE 0x40300000 /* I2C Bus Interface Unit */
-#define PXA2X0_I2C_SIZE 0x16a4
-#define PXA2X0_I2S_BASE 0x40400000 /* Inter-IC Sound Controller */
-#define PXA2X0_I2S_SIZE 0x0084
-#define PXA2X0_AC97_BASE 0x40500000 /* AC '97 Controller */
-#define PXA2X0_AC97_SIZE 0x0600
-#define PXA2X0_USBDC_BASE 0x40600000 /* USB Client Controller */
-#define PXA2X0_USBDC_SIZE 0x0460
-#define PXA2X0_STUART_BASE 0x40700000 /* Standard UART */
-#define PXA2X0_ICP_BASE 0x40800000
-#define PXA2X0_RTC_BASE 0x40900000
-#define PXA2X0_RTC_SIZE 0x10
-#define PXA2X0_OST_BASE 0x40a00000 /* OS Timer */
-#define PXA2X0_OST_SIZE 0x24
-#define PXA2X0_PWM0_BASE 0x40b00000
-#define PXA2X0_PWM1_BASE 0x40c00000
-#define PXA2X0_INTCTL_BASE 0x40d00000 /* Interrupt controller */
-#define PXA2X0_INTCTL_SIZE 0x20
-#define PXA2X0_GPIO_BASE 0x40e00000
-#define PXA2X0_GPIO_SIZE 0x70
-#define PXA2X0_POWMAN_BASE 0x40f00000 /* Power management */
-#define PXA2X0_POWMAN_SIZE 0x1a4 /* incl. PI2C unit */
-#define PXA2X0_SSP_BASE 0x41000000 /* SSP serial port */
-#define PXA2X0_SSP1_BASE 0x41700000 /* PXA270 */
-#define PXA2X0_SSP2_BASE 0x41900000 /* PXA270 */
-#define PXA2X0_SSP_SIZE 0x40
-#define PXA2X0_MMC_BASE 0x41100000 /* MultiMediaCard/SD/SDIO */
-#define PXA2X0_MMC_SIZE 0x50
-#define PXA2X0_CLKMAN_BASE 0x41300000 /* Clock Manager */
-#define PXA2X0_CLKMAN_SIZE 12
-#define PXA2X0_LCDC_BASE 0x44000000 /* LCD Controller */
-#define PXA2X0_LCDC_SIZE 0x220
-#define PXA2X0_MEMCTL_BASE 0x48000000 /* Memory Controller */
-#define PXA2X0_MEMCTL_SIZE 0x84
-#define PXA2X0_USBHC_BASE 0x4c000000 /* USB Host Controller */
-#define PXA2X0_USBHC_SIZE 0x70
-#define PXA2X0_KPC_BASE 0x41500000 /* Keypad Controller */
-#define PXA2X0_KPC_SIZE 0x50
-
-/* width of interrupt controller */
-#define ICU_LEN 32 /* but some are not used */
-#define ICU_INT_HWMASK 0xffffff0f
-#define PXA2X0_IRQ_MIN 1
-
-/*
- * [0..1,15..16] are used as soft intrs by SI_TO_IRQBIT,
- * and [4..6] are not likely to be used by us.
- */
-#define PXA2X0_INT_USBH2 2 /* USB host (all other events) */
-#define PXA2X0_INT_USBH1 3 /* USB host (OHCI) */
-#define PXA2X0_INT_KPC 4
-#define PXA2X0_INT_OST 7 /* OS timers */
-#define PXA2X0_INT_GPIO0 8
-#define PXA2X0_INT_GPIO1 9
-#define PXA2X0_INT_GPION 10 /* IRQ from GPIO[2..80] */
-#define PXA2X0_INT_USB 11
-#define PXA2X0_INT_PMU 12
-#define PXA2X0_INT_I2S 13
-#define PXA2X0_INT_AC97 14
-#define PXA2X0_INT_LCD 17
-#define PXA2X0_INT_I2C 18
-#define PXA2X0_INT_ICP 19
-#define PXA2X0_INT_STUART 20
-#define PXA2X0_INT_BTUART 21
-#define PXA2X0_INT_FFUART 22
-#define PXA2X0_INT_MMC 23
-#define PXA2X0_INT_SSP 24
-#define PXA2X0_INT_DMA 25
-#define PXA2X0_INT_OST0 26
-#define PXA2X0_INT_OST1 27
-#define PXA2X0_INT_OST2 28
-#define PXA2X0_INT_OST3 29
-#define PXA2X0_INT_RTCHZ 30
-#define PXA2X0_INT_ALARM 31 /* RTC Alarm interrupt */
-
-/* Interrupt Controller similar to SA11x0's, but not exactly the same. */
-#define INTCTL_ICIP 0x00
-#define INTCTL_ICMR 0x04
-#define INTCTL_ICLR 0x08
-#define INTCTL_ICFP 0x0c
-#define INTCTL_ICPR 0x10
-#define INTCTL_ICCR 0x14
-#define ICCR_DIM (1<<0)
-
-/* DMAC */
-#define DMAC_N_CHANNELS 16
-#define DMAC_N_CHANNELS_PXA27X 32
-#define DMAC_N_PRIORITIES 3
-#define DMAC_N_PRIORITIES_PXA27X 4
-
-#define DMAC_DCSR(n) ((n)*4)
-#define DCSR_BUSERRINTR (1<<0) /* bus error interrupt */
-#define DCSR_STARTINR (1<<1) /* start interrupt */
-#define DCSR_ENDINTR (1<<2) /* end interrupt */
-#define DCSR_STOPSTATE (1<<3) /* channel is not running */
-#define DCSR_REQPEND (1<<8) /* request pending */
-#define DCSR_STOPIRQEN (1<<29) /* stop interrupt enable */
-#define DCSR_NODESCFETCH (1<<30) /* no-descriptor fetch mode */
-#define DCSR_RUN (1<<31)
-#define DMAC_DINT 0x00f0 /* DMA interrupt */
-#define DMAC_DINT_MASK 0xffffu
-#define DMAC_DRCMR(n) (0x100+(n)*4) /* Channel map register */
-#define DRCMR_CHLNUM 0x0f /* channel number */
-#define DRCMR_MAPVLD (1<<7) /* map valid */
-#define DMAC_DDADR(n) (0x0200+(n)*16)
-#define DDADR_STOP (1<<0)
-#define DMAC_DSADR(n) (0x0204+(n)*16)
-#define DMAC_DTADR(n) (0x0208+(n)*16)
-#define DMAC_DCMD(n) (0x020c+(n)*16)
-#define DCMD_LENGTH_MASK 0x1fff
-#define DCMD_WIDTH_SHIFT 14
-#define DCMD_WIDTH_0 (0<<DCMD_WIDTH_SHIFT) /* for mem-to-mem transfer*/
-#define DCMD_WIDTH_1 (1<<DCMD_WIDTH_SHIFT)
-#define DCMD_WIDTH_2 (2<<DCMD_WIDTH_SHIFT)
-#define DCMD_WIDTH_4 (3<<DCMD_WIDTH_SHIFT)
-#define DCMD_SIZE_SHIFT 16
-#define DCMD_SIZE_8 (1<<DCMD_SIZE_SHIFT)
-#define DCMD_SIZE_16 (2<<DCMD_SIZE_SHIFT)
-#define DCMD_SIZE_32 (3<<DCMD_SIZE_SHIFT)
-#define DCMD_LITTLE_ENDIAN (0<<18)
-#define DCMD_ENDIRQEN (1<<21)
-#define DCMD_STARTIRQEN (1<<22)
-#define DCMD_FLOWTRG (1<<28) /* flow control by target */
-#define DCMD_FLOWSRC (1<<29) /* flow control by source */
-#define DCMD_INCTRGADDR (1<<30) /* increment target address */
-#define DCMD_INCSRCADDR (1<<31) /* increment source address */
-
-#ifndef __ASSEMBLER__
-/* DMA descriptor */
-struct pxa2x0_dma_desc {
- volatile uint32_t dd_ddadr;
-#define DMAC_DESC_LAST 0x1
- volatile uint32_t dd_dsadr;
- volatile uint32_t dd_dtadr;
- volatile uint32_t dd_dcmd; /* command and length */
-};
-#endif
-
-/* UART */
-#define PXA2X0_COM_FREQ 14745600L
-
-/* I2C */
-#define I2C_IBMR 0x1680 /* Bus monitor register */
-#define I2C_IDBR 0x1688 /* Data buffer */
-#define I2C_ICR 0x1690 /* Control register */
-#define ICR_START (1<<0)
-#define ICR_STOP (1<<1)
-#define ICR_ACKNAK (1<<2)
-#define ICR_TB (1<<3)
-#define ICR_MA (1<<4)
-#define ICR_SCLE (1<<5) /* PXA270? */
-#define ICR_IUE (1<<6) /* PXA270? */
-#define ICR_UR (1<<14) /* PXA270? */
-#define ICR_FM (1<<15) /* PXA270? */
-#define I2C_ISR 0x1698 /* Status register */
-#define ISR_ACKNAK (1<<1)
-#define ISR_ITE (1<<6)
-#define ISR_IRF (1<<7)
-#define I2C_ISAR 0x16a0 /* Slave address */
-
-/* Power Manager */
-#define POWMAN_PMCR 0x00
-#define POWMAN_PSSR 0x04 /* Sleep Status register */
-#define PSSR_SSS (1<<0) /* Software Sleep Status */
-#define PSSR_BFS (1<<1) /* Battery Fault Status */
-#define PSSR_VFS (1<<2) /* VCC Fault Status */
-#define PSSR_STS (1<<3) /* Standby Mode Status */
-#define PSSR_PH (1<<4) /* Peripheral Control Hold */
-#define PSSR_RDH (1<<5) /* Read Disable Hold */
-#define PSSR_OTGPH (1<<6) /* OTG Peripheral Control Hold */
-#define POWMAN_PSPR 0x08
-#define POWMAN_PWER 0x0c
-#define POWMAN_PRER 0x10
-#define POWMAN_PFER 0x14
-#define POWMAN_PEDR 0x18
-#define POWMAN_PCFR 0x1c /* General Configuration register */
-#define PCFR_OPDE (1<<0)
-#define PCFR_GPR_EN (1<<4) /* PXA270 */
-#define PCFR_PI2C_EN (1<<6) /* PXA270 */
-#define PCFR_GP_ROD (1<<8) /* PXA270 */
-#define PCFR_FVC (1<<10) /* PXA270 */
-#define POWMAN_PGSR0 0x20 /* GPIO Sleep State register */
-#define POWMAN_PGSR1 0x24
-#define POWMAN_PGSR2 0x28
-#define POWMAN_PGSR3 0x2c /* PXA270 */
-#define POWMAN_RCSR 0x30 /* Reset Controller Status register */
-#define RCSR_HWR (1<<0)
-#define RCSR_WDR (1<<1)
-#define RCSR_SMR (1<<2)
-#define RCSR_GPR (1<<3)
-#define POWMAN_PSLR 0x34 /* PXA270 */
-#define POWMAN_PKWR 0x50 /* PXA270 */
-#define POWMAN_PKSR 0x54 /* PXA270 */
-
-/* Power Manager I2C unit */
-#define POWMAN_PIDBR 0x188
-#define POWMAN_PICR 0x190
-#define PICR_START ICR_START
-#define PICR_STOP ICR_STOP
-#define PICR_ACKNAK ICR_ACKNAK
-#define PICR_TB ICR_TB
-#define PICR_SCLE (1<<5) /* PXA270? */
-#define PICR_IUE (1<<6) /* PXA270? */
-#define PICR_UR (1<<14) /* PXA270? */
-#define POWMAN_PISR 0x198
-#define PISR_ACKNAK (1<<1)
-#define PISR_ITE (1<<6)
-#define PISR_IRF (1<<7)
-#define POWMAN_PISAR 0x1a0
-
-/* Clock Manager */
-#define CLKMAN_CCCR 0x00 /* Core Clock Configuration */
-#define CCCR_CPDIS (1<<31) /* PXA270 */
-#define CCCR_A (1<<25) /* PXA270 */
-#define CCCR_TURBO_X1 (2<<7)
-#define CCCR_TURBO_X15 (3<<7) /* x 1.5 */
-#define CCCR_TURBO_X2 (4<<7)
-#define CCCR_TURBO_X25 (5<<7) /* x 2.5 */
-#define CCCR_TURBO_X3 (6<<7) /* x 3.0 */
-/* PXA255 */
-#define CCCR_RUN_X1 (1<<5)
-#define CCCR_RUN_X2 (2<<5)
-#define CCCR_RUN_X4 (3<<5)
-#define CCCR_MEM_X27 (1<<0) /* x27, 99.53MHz */
-#define CCCR_MEM_X32 (2<<0) /* x32, 117,96MHz */
-#define CCCR_MEM_X36 (3<<0) /* x26, 132.71MHz */
-#define CCCR_MEM_X40 (4<<0) /* x27, 99.53MHz */
-#define CCCR_MEM_X45 (5<<0) /* x27, 99.53MHz */
-#define CCCR_MEM_X9 (0x1f<<0) /* x9, 33.2MHz */
-/* PXA27x: L is the core run frequency to 13MHz oscillator ratio. */
-#define CCCR_RUN_X7 (7<<0) /* 91MHz, 91MHz mem, 91MHz LCD */
-#define CCCR_RUN_X8 (8<<0) /* 104MHz, 104MHz mem, 52MHz LCD */
-#define CCCR_RUN_X16 (16<<0) /* 208MHz, 104/208MHz mem, 104MHz LCD */
-
-#define CLKMAN_CKEN 0x04 /* Clock Enable Register */
-#define CLKMAN_OSCC 0x08 /* Oscillator Configuration Register */
-
-#define CCCR_N_SHIFT 7
-#define CCCR_N_MASK (0x07<<CCCR_N_SHIFT)
-#define CCCR_M_SHIFT 5
-#define CCCR_M_MASK (0x03<<CCCR_M_SHIFT)
-#define CCCR_L_MASK 0x1f
-
-#define CKEN_PWM0 (1<<0)
-#define CKEN_PWM1 (1<<1)
-#define CKEN_AC97 (1<<2)
-#define CKEN_SSP (1<<3)
-#define CKEN_STUART (1<<5)
-#define CKEN_FFUART (1<<6)
-#define CKEN_BTUART (1<<7)
-#define CKEN_I2S (1<<8)
-#define CKEN_USBHC (1<<10)
-#define CKEN_USBDC (1<<11)
-#define CKEN_MMC (1<<12)
-#define CKEN_FICP (1<<13)
-#define CKEN_I2C (1<<14)
-#define CKEN_PI2C (1<<15) /* PXA270? */
-#define CKEN_LCD (1<<16)
-#define CKEN_KEY (1<<19) /* PXA270? */
-#define CKEN_MEM (1<<22) /* PXA270? */
-#define CKEN_AC97CC (1<<31) /* PXA27x */
-
-#define OSCC_OOK (1<<0) /* 32.768KHz oscillator status */
-#define OSCC_OON (1<<1) /* 32.768KHz oscillator */
-
-/*
- * RTC
- */
-#define RTC_RCNR 0x0000 /* count register */
-#define RTC_RTAR 0x0004 /* alarm register */
-#define RTC_RTSR 0x0008 /* status register */
-#define RTSR_AL (1<<0)
-#define RTSR_HZ (1<<1)
-#define RTSR_ALE (1<<2)
-#define RTC_RTTR 0x000c /* trim register */
-/*
- * GPIO
- */
-#define GPIO_GPLR0 0x00 /* Level reg [31:0] */
-#define GPIO_GPLR1 0x04 /* Level reg [63:32] */
-#define GPIO_GPLR2 0x08 /* Level reg [80:64] PXA 270 [95:64] */
-
-#define GPIO_GPDR0 0x0c /* dir reg [31:0] */
-#define GPIO_GPDR1 0x10 /* dir reg [63:32] */
-#define GPIO_GPDR2 0x14 /* dir reg [80:64] PXA 270 [95:64] */
-
-#define GPIO_GPSR0 0x18 /* set reg [31:0] */
-#define GPIO_GPSR1 0x1c /* set reg [63:32] */
-#define GPIO_GPSR2 0x20 /* set reg [80:64] PXA 270 [95:64] */
-
-#define GPIO_GPCR0 0x24 /* clear reg [31:0] */
-#define GPIO_GPCR1 0x28 /* clear reg [63:32] */
-#define GPIO_GPCR2 0x2c /* clear reg [80:64] PXA 270 [95:64] */
-
-#define GPIO_GPER0 0x30 /* rising edge [31:0] */
-#define GPIO_GPER1 0x34 /* rising edge [63:32] */
-#define GPIO_GPER2 0x38 /* rising edge [80:64] PXA 270 [95:64] */
-
-#define GPIO_GRER0 0x30 /* rising edge [31:0] */
-#define GPIO_GRER1 0x34 /* rising edge [63:32] */
-#define GPIO_GRER2 0x38 /* rising edge [80:64] PXA 270 [95:64] */
-
-#define GPIO_GFER0 0x3c /* falling edge [31:0] */
-#define GPIO_GFER1 0x40 /* falling edge [63:32] */
-#define GPIO_GFER2 0x44 /* falling edge [80:64] PXA 270 [95:64] */
-
-#define GPIO_GEDR0 0x48 /* edge detect [31:0] */
-#define GPIO_GEDR1 0x4c /* edge detect [63:32] */
-#define GPIO_GEDR2 0x50 /* edge detect [80:64] PXA 270 [95:64] */
-
-#define GPIO_GAFR0_L 0x54 /* alternate function [15:0] */
-#define GPIO_GAFR0_U 0x58 /* alternate function [31:16] */
-#define GPIO_GAFR1_L 0x5c /* alternate function [47:32] */
-#define GPIO_GAFR1_U 0x60 /* alternate function [63:48] */
-#define GPIO_GAFR2_L 0x64 /* alternate function [79:64] */
-#define GPIO_GAFR2_U 0x68 /* alternate function [80] PXA 270 [95:80] */
-
-#define GPIO_GAFR3_L 0x6C /* alternate function PXA 270 [111:96] */
-#define GPIO_GAFR3_U 0x70 /* alternate function PXA 270 [120:112] */
-
-#define GPIO_GPLR3 0x100 /* Level PXA 270 [120:96] */
-#define GPIO_GPDR3 0x10C /* dir reg PXA 270 [120:96] */
-#define GPIO_GPSR3 0x118 /* set reg PXA 270 [120:96] */
-#define GPIO_GPCR3 0x124 /* clear reg PXA 270 [120:96] */
-#define GPIO_GRER3 0x130 /* rising edge PXA 270 [120:96] */
-#define GPIO_GFER3 0x13c /* falling edge PXA 270 [120:96] */
-#define GPIO_GEDR3 0x148 /* edge detect PXA270 [120:96] */
-
-#define GPIO_REG(r, pin) ((r) + \
- ((pin > 95) ? GPIO_GPLR3 : (((pin) / 32) * 4)))
-#define GPIO_BANK(pin) ((pin) / 32)
-#define GPIO_BIT(pin) (1u << ((pin) & 0x1f))
-#define GPIO_FN_REG(pin) (GPIO_GAFR0_L + (((pin) / 16) * 4))
-#define GPIO_FN_SHIFT(pin) ((pin & 0xf) * 2)
-
-#define GPIO_IN 0x00 /* Regular GPIO input pin */
-#define GPIO_OUT 0x10 /* Regular GPIO output pin */
-#define GPIO_ALT_FN_1_IN 0x01 /* Alternate function 1 input */
-#define GPIO_ALT_FN_1_OUT 0x11 /* Alternate function 1 output */
-#define GPIO_ALT_FN_2_IN 0x02 /* Alternate function 2 input */
-#define GPIO_ALT_FN_2_OUT 0x12 /* Alternate function 2 output */
-#define GPIO_ALT_FN_3_IN 0x03 /* Alternate function 3 input */
-#define GPIO_ALT_FN_3_OUT 0x13 /* Alternate function 3 output */
-#define GPIO_SET 0x20 /* Initial state is Set */
-#define GPIO_CLR 0x00 /* Initial state is Clear */
-
-#define GPIO_FN_MASK 0x03
-#define GPIO_FN_IS_OUT(n) ((n) & GPIO_OUT)
-#define GPIO_FN_IS_SET(n) ((n) & GPIO_SET)
-#define GPIO_FN(n) ((n) & GPIO_FN_MASK)
-#define GPIO_IS_GPIO(n) (GPIO_FN(n) == 0)
-#define GPIO_IS_GPIO_IN(n) (((n) & (GPIO_FN_MASK|GPIO_OUT)) == GPIO_IN)
-#define GPIO_IS_GPIO_OUT(n) (((n) & (GPIO_FN_MASK|GPIO_OUT)) == GPIO_OUT)
-
-#define GPIO_NPINS_25x 85
-#define GPIO_NPINS 121
-
-/*
- * memory controller
- */
-
-#define MEMCTL_MDCNFG 0x0000
-#define MDCNFG_DE0 (1<<0)
-#define MDCNFG_DE1 (1<<1)
-#define MDCNFD_DWID01_SHIFT 2
-#define MDCNFD_DCAC01_SHIFT 3
-#define MDCNFD_DRAC01_SHIFT 5
-#define MDCNFD_DNB01_SHIFT 7
-#define MDCNFG_DE2 (1<<16)
-#define MDCNFG_DE3 (1<<17)
-#define MDCNFD_DWID23_SHIFT 18
-#define MDCNFD_DCAC23_SHIFT 19
-#define MDCNFD_DRAC23_SHIFT 21
-#define MDCNFD_DNB23_SHIFT 23
-
-#define MDCNFD_DWID_MASK 0x1
-#define MDCNFD_DCAC_MASK 0x3
-#define MDCNFD_DRAC_MASK 0x3
-#define MDCNFD_DNB_MASK 0x1
-
-#define MEMCTL_MDREFR 0x04 /* refresh control register */
-#define MDREFR_DRI 0xfff
-#define MDREFR_E0PIN (1<<12)
-#define MDREFR_K0RUN (1<<13) /* SDCLK0 enable */
-#define MDREFR_K0DB2 (1<<14) /* SDCLK0 1/2 freq */
-#define MDREFR_E1PIN (1<<15)
-#define MDREFR_K1RUN (1<<16) /* SDCLK1 enable */
-#define MDREFR_K1DB2 (1<<17) /* SDCLK1 1/2 freq */
-#define MDREFR_K2RUN (1<<18) /* SDCLK2 enable */
-#define MDREFR_K2DB2 (1<<19) /* SDCLK2 1/2 freq */
-#define MDREFR_APD (1<<20) /* Auto Power Down */
-#define MDREFR_SLFRSH (1<<22) /* Self Refresh */
-#define MDREFR_K0FREE (1<<23) /* SDCLK0 free run */
-#define MDREFR_K1FREE (1<<24) /* SDCLK1 free run */
-#define MDREFR_K2FREE (1<<25) /* SDCLK2 free run */
-
-#define MEMCTL_MSC0 0x08 /* Asynchronous Static memory Control CS[01] */
-#define MEMCTL_MSC1 0x0c /* Asynchronous Static memory Control CS[23] */
-#define MEMCTL_MSC2 0x10 /* Asynchronous Static memory Control CS[45] */
-#define MSC_RBUFF_SHIFT 15 /* return data buffer */
-#define MSC_RBUFF (1<<MSC_RBUFF_SHIFT)
-#define MSC_RRR_SHIFT 12 /* recovery time */
-#define MSC_RRR (7<<MSC_RRR_SHIFT)
-#define MSC_RDN_SHIFT 8 /* ROM delay next access */
-#define MSC_RDN (0x0f<<MSC_RDN_SHIFT)
-#define MSC_RDF_SHIFT 4 /* ROM delay first access*/
-#define MSC_RDF (0x0f<<MSC_RDF_SHIFT)
-#define MSC_RBW_SHIFT 3 /* 32/16 bit bus */
-#define MSC_RBW (1<<MSC_RBW_SHIFT)
-#define MSC_RT_SHIFT 0 /* type */
-#define MSC_RT (7<<MSC_RT_SHIFT)
-#define MSC_RT_NONBURST 0
-#define MSC_RT_SRAM 1
-#define MSC_RT_BURST4 2
-#define MSC_RT_BURST8 3
-#define MSC_RT_VLIO 4
-
-/* expansion memory timing configuration */
-#define MEMCTL_MCMEM(n) (0x28+4*(n))
-#define MEMCTL_MCATT(n) (0x30+4*(n))
-#define MEMCTL_MCIO(n) (0x38+4*(n))
-
-#define MC_HOLD_SHIFT 14
-#define MC_ASST_SHIFT 7
-#define MC_SET_SHIFT 0
-#define MC_TIMING_VAL(hold,asst,set) (((hold)<<MC_HOLD_SHIFT)| \
- ((asst)<<MC_ASST_SHIFT)|((set)<<MC_SET_SHIFT))
-
-#define MEMCTL_MECR 0x14 /* Expansion memory configuration */
-#define MECR_NOS (1<<0) /* Number of sockets */
-#define MECR_CIT (1<<1) /* Card-is-there */
-
-#define MEMCTL_MDMRS 0x0040
-
-#define MEMCTL_ARB_CNTRL 0x0048 /* System Bus Arbiter */
-
-/*
- * LCD Controller
- */
-#define LCDC_LCCR0 0x000 /* Controller Control Register 0 */
-#define LCCR0_ENB (1U<<0) /* LCD Controller Enable */
-#define LCCR0_CMS (1U<<1) /* Color/Mono select */
-#define LCCR0_SDS (1U<<2) /* Single/Dual -panel */
-#define LCCR0_LDM (1U<<3) /* LCD Disable Done Mask */
-#define LCCR0_SFM (1U<<4) /* Start of Frame Mask */
-#define LCCR0_IUM (1U<<5) /* Input FIFO Underrun Mask */
-#define LCCR0_EFM (1U<<6) /* End of Frame Mask */
-#define LCCR0_PAS (1U<<7) /* Passive/Active Display select */
-#define LCCR0_DPD (1U<<9) /* Double-Pixel Data pin mode */
-#define LCCR0_DIS (1U<<10) /* LCD Disable */
-#define LCCR0_QDM (1U<<11) /* LCD Quick Disable Mask */
-#define LCCR0_BM (1U<<20) /* Branch Mask */
-#define LCCR0_OUM (1U<<21) /* Output FIFO Underrun Mask */
-/* PXA270 */
-#define LCCR0_LCDT (1U<<22) /* LCD Panel Type */
-#define LCCR0_RDSTM (1U<<23) /* Read Status Interrupt Mask */
-#define LCCR0_CMDIM (1U<<24) /* Command Interrupt Mask */
-#define LCCR0_OUC (1U<<25) /* Overlay Underlay Control */
-#define LCCR0_LDDALT (1U<<26) /* LDD Alternate Mapping Control Bit */
-
-#define LCCR0_IMASK (LCCR0_LDM|LCCR0_SFM|LCCR0_IUM|LCCR0_EFM|LCCR0_QDM|LCCR0_BM|LCCR0_OUM)
-
-
-#define LCDC_LCCR1 0x004 /* Controller Control Register 1 */
-#define LCDC_LCCR2 0x008 /* Controller Control Register 2 */
-#define LCDC_LCCR3 0x00c /* Controller Control Register 2 */
-#define LCCR3_BPP_SHIFT 24 /* Bits per pixel */
-#define LCCR3_BPP (0x07<<LCCR3_BPP_SHIFT)
-#define LCDC_FBR0 0x020 /* DMA ch0 frame branch register */
-#define LCDC_FBR1 0x024 /* DMA ch1 frame branch register */
-#define LCDC_LCSR 0x038 /* controller status register */
-#define LCSR_LDD (1U<<0) /* LCD disable done */
-#define LCSR_SOF (1U<<1) /* Start of frame */
-#define LCDC_LIIDR 0x03c /* controller interrupt ID Register */
-#define LCDC_TRGBR 0x040 /* TMED RGB Speed Register */
-#define LCDC_TCR 0x044 /* TMED Control Register */
-#define LCDC_FDADR0 0x200 /* DMA ch0 frame descriptor address */
-#define LCDC_FSADR0 0x204 /* DMA ch0 frame source address */
-#define LCDC_FIDR0 0x208 /* DMA ch0 frame ID register */
-#define LCDC_LDCMD0 0x20c /* DMA ch0 command register */
-#define LCDC_FDADR1 0x210 /* DMA ch1 frame descriptor address */
-#define LCDC_FSADR1 0x214 /* DMA ch1 frame source address */
-#define LCDC_FIDR1 0x218 /* DMA ch1 frame ID register */
-#define LCDC_LDCMD1 0x21c /* DMA ch1 command register */
-
-/*
- * MMC/SD controller
- */
-#define MMC_STRPCL 0x00 /* start/stop MMC clock */
-#define STRPCL_NOOP 0
-#define STRPCL_STOP 1 /* stop MMC clock */
-#define STRPCL_START 2 /* start MMC clock */
-#define MMC_STAT 0x04 /* status register */
-#define STAT_READ_TIME_OUT (1<<0)
-#define STAT_TIMEOUT_RESPONSE (1<<1)
-#define STAT_CRC_WRITE_ERROR (1<<2)
-#define STAT_CRC_READ_ERROR (1<<3)
-#define STAT_SPI_READ_ERROR_TOKEN (1<<4)
-#define STAT_RES_CRC_ERR (1<<5)
-#define STAT_XMIT_FIFO_EMPTY (1<<6) /* (PXA27x: reserved) */
-#define STAT_RECV_FIFO_FULL (1<<7) /* (PXA27x: reserved) */
-#define STAT_CLK_EN (1<<8)
-#define STAT_DATA_TRAN_DONE (1<<11)
-#define STAT_PRG_DONE (1<<12)
-#define STAT_END_CMD_RES (1<<13)
-#define MMC_CLKRT 0x08 /* MMC clock rate */
-#define CLKRT_20M 0
-#define CLKRT_10M 1
-#define CLKRT_5M 2
-#define CLKRT_2_5M 3
-#define CLKRT_1_25M 4
-#define CLKRT_625K 5
-#define CLKRT_312K 6
-#define MMC_SPI 0x0c /* SPI mode control */
-#define SPI_EN (1<<0) /* enable SPI mode */
-#define SPI_CRC_ON (1<<1) /* enable CRC generation */
-#define SPI_CS_EN (1<<2) /* Enable CS[01] */
-#define SPI_CS_ADDRESS (1<<3) /* CS0/CS1 */
-#define MMC_CMDAT 0x10 /* command/response/data */
-#define CMDAT_RESPONSE_FORMAT 0x03
-#define CMDAT_RESPONSE_FORMAT_NO 0 /* no response */
-#define CMDAT_RESPONSE_FORMAT_R1 1 /* R1, R1b, R4, R5, R5b, R6 */
-#define CMDAT_RESPONSE_FORMAT_R2 2
-#define CMDAT_RESPONSE_FORMAT_R3 3
-#define CMDAT_DATA_EN (1<<2)
-#define CMDAT_WRITE (1<<3) /* 1=write 0=read operation */
-#define CMDAT_STREAM_BLOCK (1<<4) /* stream mode */
-#define CMDAT_BUSY (1<<5) /* busy signal is expected */
-#define CMDAT_INIT (1<<6) /* precede command with 80 clocks */
-#define CMDAT_MMC_DMA_EN (1<<7) /* DMA enable */
-#define MMC_RESTO 0x14 /* expected response time out */
-#define MMC_RDTO 0x18 /* expected data read time out */
-#define MMC_BLKLEN 0x1c /* block length of data transaction */
-#define MMC_NUMBLK 0x20 /* number of blocks (block mode) */
-#define MMC_PRTBUF 0x24 /* partial MMC_TXFIFO written */
-#define PRTBUF_BUF_PART_FULL (1<<0) /* buffer partially full */
-#define MMC_I_MASK 0x28 /* interrupt mask */
-#define MMC_I_REG 0x2c /* interrupt register */
-#define MMC_I_DATA_TRAN_DONE (1<<0)
-#define MMC_I_PRG_DONE (1<<1)
-#define MMC_I_END_CMD_RES (1<<2)
-#define MMC_I_STOP_CMD (1<<3)
-#define MMC_I_CLK_IS_OFF (1<<4)
-#define MMC_I_RXFIFO_RD_REQ (1<<5)
-#define MMC_I_TXFIFO_WR_REQ (1<<6)
-#define MMC_I_DAT_ERR (1<<8) /* PXA27x */
-#define MMC_I_RES_ERR (1<<9) /* PXA27x */
-#define MMC_I_SDIO_INT (1<<11) /* PXA27x */
-#define MMC_CMD 0x30 /* index of current command */
-#define MMC_ARGH 0x34 /* MSW part of the current command arg */
-#define MMC_ARGL 0x38 /* LSW part of the current command arg */
-#define MMC_RES 0x3c /* response FIFO */
-#define MMC_RXFIFO 0x40 /* receive FIFO */
-#define MMC_TXFIFO 0x44 /* transmit FIFO */
-
-
-/*
- * Inter-IC Sound (I2S) Controller
- */
-#define I2S_SACR0 0x0000 /* Serial Audio Global Control */
-#define SACR0_ENB (1<<0) /* Enable I2S Function */
-#define SACR0_BCKD (1<<2) /* I/O Direction of I2S_BITCLK */
-#define SACR0_RST (1<<3) /* FIFO Reset */
-#define SACR0_EFWR (1<<4) /* Special-Purpose FIFO W/R Func */
-#define SACR0_STRF (1<<5) /* Select TX or RX FIFO */
-#define SACR0_TFTH_MASK (0xf<<8) /* Trans FIFO Intr/DMA Trig Thresh */
-#define SACR0_RFTH_MASK (0xf<<12) /* Recv FIFO Intr/DMA Trig Thresh */
-#define SACR0_SET_TFTH(x) (((x) & 0xf)<<8)
-#define SACR0_SET_RFTH(x) (((x) & 0xf)<<12)
-#define I2S_SACR1 0x0004 /* Serial Audio I2S/MSB-Justified Control */
-#define SACR1_AMSL (1<<0) /* Specify Alt Mode (I2S or MSB) */
-#define SACR1_DREC (1<<3) /* Disable Recording Func */
-#define SACR1_DRPL (1<<4) /* Disable Replay Func */
-#define SACR1_ENLBF (1<<5) /* Enable Interface Loopback Func */
-#define I2S_SASR0 0x000c /* Serial Audio I2S/MSB-Justified Status */
-#define SASR0_TNF (1<<0) /* Transmit FIFO Not Full */
-#define SASR0_RNE (1<<1) /* Recv FIFO Not Empty */
-#define SASR0_BSY (1<<2) /* I2S Busy */
-#define SASR0_TFS (1<<3) /* Trans FIFO Service Request */
-#define SASR0_RFS (1<<4) /* Recv FIFO Service Request */
-#define SASR0_TUR (1<<5) /* Trans FIFO Underrun */
-#define SASR0_ROR (1<<6) /* Recv FIFO Overrun */
-#define SASR0_I2SOFF (1<<7) /* I2S Controller Off */
-#define SASR0_TFL_MASK (0xf<<8) /* Trans FIFO Level */
-#define SASR0_RFL_MASK (0xf<<12) /* Recv FIFO Level */
-#define SASR0_GET_TFL(x) (((x) & 0xf) >> 8)
-#define SASR0_GET_RFL(x) (((x) & 0xf) >> 12)
-#define I2S_SAIMR 0x0014 /* Serial Audio Interrupt Mask */
-#define SAIMR_TFS (1<<3) /* Enable TX FIFO Service Req Intr */
-#define SAIMR_RFS (1<<4) /* Enable RX FIFO Service Req Intr */
-#define SAIMR_TUR (1<<5) /* Enable TX FIFO Underrun Intr */
-#define SAIMR_ROR (1<<6) /* Enable RX FIFO Overrun Intr */
-#define I2S_SAICR 0x0018 /* Serial Audio Interrupt Clear */
-#define SAICR_TUR (1<<5) /* Clear Intr and SASR0_TUR */
-#define SAICR_ROR (1<<6) /* Clear Intr and SASR0_ROR */
-#define I2S_SADIV 0x0060 /* Audio Clock Divider */
-#define SADIV_MASK 0x7f
-#define SADIV_3_058MHz 0x0c /* 3.058 MHz */
-#define SADIV_2_836MHz 0x0d /* 2.836 MHz */
-#define SADIV_1_405MHz 0x1a /* 1.405 MHz */
-#define SADIV_1_026MHz 0x24 /* 1.026 MHz */
-#define SADIV_702_75kHz 0x34 /* 702.75 kHz */
-#define SADIV_513_25kHz 0x48 /* 513.25 kHz */
-#define I2S_SADR 0x0080 /* Serial Audio Data Register */
-#define SADR_DTL (0xffff<<0) /* Left Data Sample */
-#define SADR_DTH (0xffff<<16) /* Right Data Sample */
-
-/*
- * AC '97 Controller
- */
-#define AC97_POCR 0x0000 /* PCM Out Control Register */
-#define POCR_FSRIE (1<<1) /* FIFO Service Request Intr Enable */
-#define POCR_FEIE (1<<3) /* FIFO Error Intr Enable */
-#define AC97_PCMICR 0x0004 /* PCM In Control Register */
-#define PCMICR_FSRIE (1<<1) /* FIFO Service Request Intr Enable */
-#define PCMICR_FEIE (1<<3) /* FIFO Error Intr Enable */
-#define AC97_MCCR 0x0008 /* Microphone In Control Register */
-#define MCCR_FSRIE (1<<1) /* FIFO Service Request Intr Enable */
-#define MCCR_FEIE (1<<3) /* FIFO Error Intr Enable */
-#define AC97_GCR 0x000c /* Global Control Register */
-#define GCR_GPI_IE (1<<0) /* Codec GPI Interrupt Enable */
-#define GCR_nCRST (1<<1) /* AC '97 Cold Reset */
-#define GCR_WRST (1<<2) /* AC '97 Warm Reset */
-#define GCR_ACOFF (1<<3) /* AC-Link Shut Off */
-#define GCR_PRES_IE (1<<4) /* Primary Resume Intr Enable */
-#define GCR_SRES_IE (1<<5) /* Secondary Resume Intr Enable */
-#define GCR_PRDY_IE (1<<8) /* Primary Ready Intr Enable */
-#define GCR_SRDY_IE (1<<9) /* Secondary Ready Intr Enable */
-#define GCR_SDONE_IE (1<<18) /* Status Done Intr Enable */
-#define GCR_CDONE_IE (1<<19) /* Command Done Intr Enable */
-#define GCR_nDMAEN (1<<24) /* DMA Enable (PXA27x) */
-#define AC97_POSR 0x0010 /* PCM Out Status Register */
-#define POSR_FSR (1<<2) /* FIFO Service Request */
-#define POSR_FIFOE (1<<4) /* FIFO Error */
-#define AC97_PCMISR 0x0014 /* PCM In Status Register */
-#define PCMISR_FSR (1<<2) /* FIFO Service Request */
-#define PCMISR_ECC (1<<3) /* DMA End of Chain Intr */
-#define PCMISR_FIFOE (1<<4) /* FIFO Error */
-#define AC97_MCSR 0x0018 /* Microphone In Status Register */
-#define MCSR_FSR (1<<2) /* FIFO Service Request */
-#define MCSR_ECC (1<<3) /* DMA End of Chain Intr */
-#define MCSR_FIFOE (1<<4) /* FIFO Error */
-#define AC97_GSR 0x001c /* Global Status Register */
-#define GSR_GSCI (1<<0) /* Codec GPI Status Change Intr */
-#define GSR_MIINT (1<<1) /* Modem-In Intr */
-#define GSR_MOINT (1<<2) /* Modem-Out Intr */
-#define GSR_ACOFFD (1<<3) /* AC-link Shut Off Done */
-#define GSR_PIINT (1<<5) /* PCM-In Intr */
-#define GSR_POINT (1<<6) /* PCM-Out Intr */
-#define GSR_MCINT (1<<7) /* Mic-In Intr */
-#define GSR_PCRDY (1<<8) /* Primay Codec Ready */
-#define GSR_SCRDY (1<<9) /* Secondary Codec Ready */
-#define GSR_PRESINT (1<<10) /* Primary Resume Intr */
-#define GSR_SRESINT (1<<11) /* Secondary Resume Intr */
-#define GSR_B1S12 (1<<12) /* Bit 1 of Slot 12 */
-#define GSR_B2S12 (1<<13) /* Bit 2 of Slot 12 */
-#define GSR_B3S12 (1<<14) /* Bit 3 of Slot 12 */
-#define GSR_RCS (1<<15) /* Read Completion Status */
-#define GSR_SDONE (1<<18) /* Status Done */
-#define GSR_CDONE (1<<19) /* Command Done */
-#define AC97_CAR 0x0020 /* Codec Access Register */
-#define CAR_CAIP (1<<0) /* Codec Access In Progress */
-/* 0x0024 to 0x003c is reserved */
-#define AC97_PCDR 0x0040 /* PCM Data Register */
-#define PCDR_PCML (0xffff<<0) /* PCM Left Channel Data */
-#define PCDR_PCMR (0xffff<<16) /* PCM Right Channel Data */
-/* 0x0044 to 0x005c is reserved */
-#define AC97_MCDR 0x0060 /* Microphone In Data Register */
-#define MCDR_MCDAT (0xffff<<0) /* Mic-In Data */
-/* 0x0064 to 0x00fc is reserved */
-#define AC97_MOCR 0x0100 /* Modem Out Control Register */
-#define MOCR_FSRIE (1<<1) /* FIFO Service Request Intr Enable */
-#define MOCR_FEIE (1<<3) /* FIFO Error Intr Enable */
-/* 0x0104 is reserved */
-#define AC97_MICR 0x0108 /* Modem In Control Register */
-#define MICR_FSRIE (1<<1) /* FIFO Service Request Intr Enable */
-#define MICR_FEIE (1<<3) /* FIFO Error Intr Enable */
-/* 0x010c is reserved */
-#define AC97_MOSR 0x0110 /* Modem Out Status Register */
-#define MOSR_FSR (1<<2) /* FIFO Service Request */
-#define MOSR_FIFOE (1<<2) /* FIFO Error */
-/* 0x0114 is reserved */
-#define AC97_MISR 0x0118 /* Modem In Status Register */
-#define MOSR_FSR (1<<2) /* FIFO Service Request */
-#define MOSR_EOC (1<<2) /* DMA End of Chain Intr */
-#define MOSR_FIFOE (1<<2) /* FIFO Error */
-/* 0x011c to 0x013c is reserved */
-#define AC97_MODR 0x0140 /* Modem Data Register */
-#define MODR_MODAT (0xffff<<0) /* Modem Data */
-/* 0x0144 to 0x01fc is reserved */
-
-#define AC97_PRIAUDIO 0x0200 /* Primary Audio Codec Registers */
-#define AC97_SECAUDIO 0x0300 /* Secondary Audio Codec Registers */
-#define AC97_PRIMODEM 0x0400 /* Primary Modem Codec Registers */
-#define AC97_SECMODEM 0x0500 /* Secondary modem Codec Registers */
-
-/*
- * USB device controller differs between pxa255 and pxa27x, defined separately
- */
-
-/*
- * USB Host Controller
- */
-#define USBHC_STAT 0x0060 /* UHC Status Register */
-#define USBHC_STAT_RWUE (1<<7) /* HCI Remote Wake-Up Event */
-#define USBHC_STAT_HBA (1<<8) /* HCI Buffer Active */
-#define USBHC_STAT_HTA (1<<10) /* HCI Transfer Abort */
-#define USBHC_STAT_UPS1 (1<<11) /* USB Power Sense Port 1 */
-#define USBHC_STAT_UPS2 (1<<12) /* USB Power Sense Port 2 */
-#define USBHC_STAT_UPRI (1<<13) /* USB Port Resume Interrupt */
-#define USBHC_STAT_SBTAI (1<<14) /* System Bus Target Abort Interrupt */
-#define USBHC_STAT_SBMAI (1<<15) /* System Bus Master Abort Interrupt */
-#define USBHC_STAT_UPS3 (1<<16) /* USB Power Sense Port 3 */
-#define USBHC_STAT_MASK (USBHC_STAT_RWUE | USBHC_STAT_HBA | \
- USBHC_STAT_HTA | USBHC_STAT_UPS1 | USBHC_STAT_UPS2 | USBHC_STAT_UPRI | \
- USBHC_STAT_SBTAI | USBHC_STAT_SBMAI | USBHC_STAT_UPS3)
-#define USBHC_HR 0x0064 /* UHC Reset Register */
-#define USBHC_HR_FSBIR (1<<0) /* Force System Bus Interface Reset */
-#define USBHC_HR_FHR (1<<1) /* Force Host Controller Reset */
-#define USBHC_HR_CGR (1<<2) /* Clock Generation Reset */
-#define USBHC_HR_SSDC (1<<3) /* Simulation Scale Down Clock */
-#define USBHC_HR_UIT (1<<4) /* USB Interrupt Test */
-#define USBHC_HR_SSE (1<<5) /* Sleep Standby Enable */
-#define USBHC_HR_PSPL (1<<6) /* Power Sense Polarity Low */
-#define USBHC_HR_PCPL (1<<7) /* Power Control Polarity Low */
-#define USBHC_HR_SSEP1 (1<<9) /* Sleep Standby Enable for Port 1 */
-#define USBHC_HR_SSEP2 (1<<10) /* Sleep Standby Enable for Port 2 */
-#define USBHC_HR_SSEP3 (1<<11) /* Sleep Standby Enable for Port 3 */
-#define USBHC_HR_MASK (USBHC_HR_FSBIR | USBHC_HR_FHR | \
- USBHC_HR_CGR | USBHC_HR_SSDC | USBHC_HR_UIT | USBHC_HR_SSE | \
- USBHC_HR_PSPL | USBHC_HR_PCPL | USBHC_HR_SSEP1 | USBHC_HR_SSEP2 | \
- USBHC_HR_SSEP3)
-#define USBHC_HIE 0x0068 /* UHC Interrupt Enable Register */
-#define USBHC_HIE_RWIE (1<<7) /* HCI Remote Wake-Up */
-#define USBHC_HIE_HBAIE (1<<8) /* HCI Buffer Active */
-#define USBHC_HIE_TAIE (1<<10) /* HCI Interface Transfer Abort */
-#define USBHC_HIE_UPS1IE (1<<11) /* USB Power Sense Port 1 */
-#define USBHC_HIE_UPS2IE (1<<12) /* USB Power Sense Port 2 */
-#define USBHC_HIE_UPRIE (1<<13) /* USB Port Resume */
-#define USBHC_HIE_UPS3IE (1<<14) /* USB Power Sense Port 3 */
-#define USBHC_HIE_MASK (USBHC_HIE_RWIE | USBHC_HIE_HBAIE | \
- USBHC_HIE_TAIE | USBHC_HIE_UPS1IE | USBHC_HIE_UPS2IE | USBHC_HIE_UPRIE | \
- USBHC_HIE_UPS3IE)
-#define USBHC_HIT 0x006C /* UHC Interrupt Test Register */
-#define USBHC_HIT_RWUT (1<<7) /* HCI Remote Wake-Up */
-#define USBHC_HIT_BAT (1<<8) /* HCI Buffer Active */
-#define USBHC_HIT_IRQT (1<<9) /* Normal OHC */
-#define USBHC_HIT_TAT (1<<10) /* HCI Interface Transfer Abort */
-#define USBHC_HIT_UPS1T (1<<11) /* USB Power Sense Port 1 */
-#define USBHC_HIT_UPS2T (1<<12) /* USB Power Sense Port 2 */
-#define USBHC_HIT_UPRT (1<<13) /* USB Port Resume */
-#define USBHC_HIT_STAT (1<<14) /* System Bus Target Abort */
-#define USBHC_HIT_SMAT (1<<15) /* System Bus Master Abort */
-#define USBHC_HIT_UPS3T (1<<16) /* USB Power Sense Port 3 */
-#define USBHC_HIT_MASK (USBHC_HIT_RWUT | USBHC_HIT_BAT | \
- USBHC_HIT_IRQT | USBHC_HIT_TAT | USBHC_HIT_UPS1T | USBHC_HIT_UPS2T | \
- USBHC_HIT_UPRT | USBHC_HIT_STAT | USBHC_HIT_SMAT | USBHC_HIT_UPS3T)
-#define USBHC_RST_WAIT 10000 /* usecs to wait for reset */
-
-/* OS Timer */
-#define OST_OSMR0 0x0000 /* Match 0 */
-#define OST_OSMR1 0x0004 /* Match 1 */
-#define OST_OSMR2 0x0008 /* Match 2 */
-#define OST_OSMR3 0x000c /* Match 3 */
-#define OST_OSCR0 0x0010 /* Counter 0 */
-
-#define OST_OSCR4 0x0040 /* Counter 4 */
-#define OST_OMCR4 0x00c0 /* Counter 4 match control */
-#define OST_OSMR4 0x0080 /* Counter 4 match */
-#define OST_OSCR5 0x0044 /* Counter 5 */
-#define OST_OMCR5 0x00c4 /* Counter 5 match control */
-#define OST_OSMR5 0x0084 /* Counter 4 match */
-
-#define OST_OSSR 0x0014 /* Status (all counters) */
-#define OST_OWER 0x0018 /* Watchdog Enable */
-#define OWER_WME (1<<0)
-#define OST_OIER 0x001c /* Interrupt Enable */
-#define OIER_E3 (1<<3)
-
-/* Synchronous Serial Protocol (SSP) serial ports */
-#define SSP_SSCR0 0x00
-#define SSP_SSCR1 0x04
-#define SSP_SSSR 0x08
-#define SSSR_TNF (1<<2)
-#define SSSR_RNE (1<<3)
-#define SSP_SSDR 0x10
-
-/* KPC */
-#define KPC_KPC 0x00
-#define KPC_MIE (1<<11)
-#define KPC_ME (1<<12)
-#define KPC_MS(n) ((n & 0xff) << 13)
-#define KPC_IMKP (1<<21)
-#define KPC_MI (1<<22)
-#define KPC_MKCN(n) ((n & 0x7) << 23)
-#define KPC_MKRN(n) ((n & 0x7) << 26)
-#define KPC_ASACT (1<<29)
-#define KPC_KPAS 0x20
-#define KPAS_CP (0xf<<0)
-#define KPAS_RP (0xf<<4)
-#define KPAS_MUKP (0x1f<<26)
-#define KPAS_SO (1<<31)
-#define KPC_KPKDI 0x48
-
-#endif /* _ARM_XSCALE_PXA2X0REG_H_ */
diff --git a/sys/arch/arm/xscale/pxa2x0var.h b/sys/arch/arm/xscale/pxa2x0var.h
deleted file mode 100644
index 018d4849dbb..00000000000
--- a/sys/arch/arm/xscale/pxa2x0var.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $OpenBSD: pxa2x0var.h,v 1.5 2005/05/27 21:10:05 uwe Exp $ */
-/* $NetBSD: pxa2x0var.h,v 1.2 2003/06/05 13:48:28 scw Exp $ */
-
-/*
- * Copyright (c) 2002 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Genetec Corporation.
- * 4. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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 _ARM_XSCALE_PXA2X0VAR_H_
-#define _ARM_XSCALE_PXA2X0VAR_H_
-
-#include <arm/sa11x0/sa11x0_var.h>
-
-/* PXA2X0's integrated peripheral bus. */
-
-typedef int (* pxa2x0_irq_handler_t)(void *);
-
-struct pxaip_attach_args {
- struct sa11x0_attach_args pxa_sa;
- bus_dma_tag_t pxa_dmat;
- int pxa_index; /* to specify device by index number */
-
-#define pxa_iot pxa_sa.sa_iot
-#define pxa_addr pxa_sa.sa_addr
-#define pxa_size pxa_sa.sa_size
-#define pxa_intr pxa_sa.sa_intr
-};
-
-#define cf_addr cf_loc[0]
-#define cf_size cf_loc[1]
-#define cf_intr cf_loc[2]
-#define cf_index cf_loc[3]
-
-
-extern struct bus_space pxa2x0_bs_tag;
-extern struct arm32_bus_dma_tag pxa2x0_bus_dma_tag;
-extern struct bus_space pxa2x0_a4x_bs_tag;
-
-/* misc. */
-extern void pxa2x0_fcs_init(void);
-extern void pxa2x0_freq_change(int);
-extern void pxa2x0_turbo_mode(int);
-extern int pxa2x0_i2c_master_tx( int, uint8_t *, int );
-
-/*
- * Probe the memory controller to determine which SDRAM banks
- * are populated, and what size SDRAM is present in each bank.
- *
- * This routine should be called from a port's initarm()
- * function, with the first parameter set to the address
- * of the memory controller's registers.
- */
-extern void pxa2x0_probe_sdram(vaddr_t, paddr_t *, psize_t *);
-
-/*
- * Configure one or more clock enables in the Clock Manager's
- * CKEN register.
- */
-extern void pxa2x0_clkman_config(u_int, int);
-
-/*
- * Get/set the Real Time Clock's counter and alarm registers.
- */
-extern void pxa2x0_rtc_setalarm(u_int32_t);
-extern u_int32_t pxa2x0_rtc_getalarm(void);
-extern u_int32_t pxa2x0_rtc_getsecs(void);
-
-#endif /* _ARM_XSCALE_PXA2X0VAR_H_ */
diff --git a/sys/arch/arm/xscale/pxammcvar.h b/sys/arch/arm/xscale/pxammcvar.h
deleted file mode 100644
index e80ea71cf61..00000000000
--- a/sys/arch/arm/xscale/pxammcvar.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $OpenBSD: pxammcvar.h,v 1.2 2009/09/03 21:40:29 marex Exp $ */
-
-/*
- * Copyright (c) 2007 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <machine/bus.h>
-
-struct pxammc_tag {
- void *cookie;
- u_int32_t (*get_ocr)(void *);
- int (*set_power)(void *, u_int32_t);
-};
-
-struct pxammc_softc {
- struct device sc_dev; /* base device */
- struct pxammc_tag tag; /* attachment driver functions */
- bus_space_tag_t sc_iot; /* register space tag */
- bus_space_handle_t sc_ioh; /* register space handle */
- struct device *sc_sdmmc; /* generic sdmmc bus device */
- void *sc_card_ih; /* card interrupt handle */
- void *sc_ih; /* MMC interrupt handle */
- int sc_flags; /* driver state flags */
-#define PMF_CARD_INITED 0x0001 /* card init sequence sent */
- int sc_clkdiv; /* current clock divider */
- struct sdmmc_command * volatile sc_cmd; /* command in progress */
- int sc_gpio_detect; /* card detect GPIO */
-};
-
-int pxammc_match(void);
-void pxammc_attach(struct pxammc_softc *, void *);
diff --git a/sys/arch/arm/xscale/pxapcicvar.h b/sys/arch/arm/xscale/pxapcicvar.h
deleted file mode 100644
index a1bbe29dff5..00000000000
--- a/sys/arch/arm/xscale/pxapcicvar.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: pxapcicvar.h,v 1.7 2005/12/14 15:08:51 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-struct pxapcic_socket {
- struct pxapcic_softc *sc;
- int socket; /* socket number */
- struct device *pcmcia;
- struct proc *event_thread;
-
- int flags;
- int power_capability; /* PXAPCIC_POWER_3V | PXAPCIC_POWER_5V */
-
- int irqpin;
- void *irq;
-
- void *pcictag_cookie; /* opaque data for pcictag functions */
- struct pxapcic_tag *pcictag;
-};
-
-/* event */
-#define PXAPCIC_EVENT_INSERTION 0
-#define PXAPCIC_EVENT_REMOVAL 1
-
-/* flags */
-#define PXAPCIC_FLAG_CARDD 0
-#define PXAPCIC_FLAG_CARDP 1
-
-struct pxapcic_tag {
- u_int (*read)(struct pxapcic_socket *, int);
- void (*write)(struct pxapcic_socket *, int, u_int);
- void (*set_power)(struct pxapcic_socket *, int);
- void (*clear_intr)(struct pxapcic_socket *);
- void *(*intr_establish)(struct pxapcic_socket *, int,
- int (*)(void *), void *);
- void (*intr_disestablish)(struct pxapcic_socket *, void *);
- const char *(*intr_string)(struct pxapcic_socket *);
-};
-
-/* pcictag registers and their values */
-#define PXAPCIC_CARD_STATUS 0
-#define PXAPCIC_CARD_INVALID 0
-#define PXAPCIC_CARD_VALID 1
-#define PXAPCIC_CARD_READY 1
-#define PXAPCIC_CARD_POWER 2
-#define PXAPCIC_POWER_OFF 0
-#define PXAPCIC_POWER_3V 1
-#define PXAPCIC_POWER_5V 2
-#define PXAPCIC_CARD_RESET 3
-
-struct pxapcic_softc {
- struct device sc_dev;
- struct pxapcic_socket sc_socket[2];
-
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_memctl_ioh;
-
- void *sc_irq;
- int sc_shutdown;
- int sc_nslots;
- int sc_irqpin[2];
- int sc_irqcfpin[2];
-};
-
-void pxapcic_attach(struct pxapcic_softc *,
- void (*socket_setup_hook)(struct pxapcic_socket *));
-int pxapcic_intr(void *);
diff --git a/sys/arch/zaurus/Makefile b/sys/arch/zaurus/Makefile
deleted file mode 100644
index 2c51e8c73bd..00000000000
--- a/sys/arch/zaurus/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-# $OpenBSD: Makefile,v 1.9 2016/05/31 18:37:04 tedu Exp $
-
-S= ${.CURDIR}/../..
-KFILE= GENERIC
-.if exists(conf/GENERIC.MP)
-KFILE= GENERIC.MP
-.endif
-TDIRS= ${_arch} include
-TAGS= ${.CURDIR}/tags
-
-NOPROG=
-NOMAN=
-NOOBJ=
-SUBDIR= stand
-
-# config the fattest kernel we can find into a temporary dir
-# to create a Makefile. Then use make to pull some variables
-# out and push them into the sub-shell to expand the paths,
-# and finally run ctags.
-tags::
- TDIR=`mktemp -d /tmp/_tagXXXXXXXXXX` || exit 1; \
- eval "S=${S}" && \
- config -s ${S} -b $${TDIR} ${.CURDIR}/conf/${KFILE} && \
- eval "_arch=\"`make -V _arch -f $${TDIR}/Makefile`\"" && \
- eval "_mach=\"`make -V _mach -f $${TDIR}/Makefile`\"" && \
- eval "_machdir=\$S/arch/$${_mach}" && \
- eval "_archdir=\$S/arch/$${_arch}" && \
- eval "HFILES=\"`find $S \( -path $S/arch -o -path $S/stand -o -path $S/lib/libsa -o -path $S/lib/libkern/arch \) -prune -o -name '*.h'; find $${_machdir} $${_archdir} $S/lib/libkern/arch/$${_arch} \( -name boot -o -name stand \) -prune -o -name '*.h'`\"" && \
- eval "SFILES=\"`make -V SFILES -f $${TDIR}/Makefile`\"" && \
- eval "CFILES=\"`make -V CFILES -f $${TDIR}/Makefile`\"" && \
- eval "AFILES=\"`make -V AFILES -f $${TDIR}/Makefile`\"" && \
- ctags -wd -f ${TAGS} $${CFILES} $${HFILES} && \
- egrep "^[_A-Z]*ENTRY[_A-Z]*\(.*\)" $${SFILES} $${AFILES} | \
- sed "s;\\([^:]*\\):\\([^(]*\\)(\\([^, )]*\\)\\(.*\\);\\3 \\1 /^\\2(\\3\\4$$/;" \
- >> ${TAGS} && \
- sort -o ${TAGS} ${TAGS} && \
- rm -rf $${TDIR}
-
-links:
- -for i in conf ${TDIRS}; do \
- (cd $$i && rm -f tags; ln -s tags tags); done
-
-obj: _SUBDIRUSE
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/zaurus/compile/.cvsignore b/sys/arch/zaurus/compile/.cvsignore
deleted file mode 100644
index b72af3039e6..00000000000
--- a/sys/arch/zaurus/compile/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-GENERIC
-RAMDISK
diff --git a/sys/arch/zaurus/conf/GENERIC b/sys/arch/zaurus/conf/GENERIC
deleted file mode 100644
index 4d68c6aedae..00000000000
--- a/sys/arch/zaurus/conf/GENERIC
+++ /dev/null
@@ -1,229 +0,0 @@
-# $OpenBSD: GENERIC,v 1.103 2016/06/28 04:41:37 jmatthew 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 zaurus arm
-include "../../../conf/GENERIC"
-maxusers 32 # estimated number of users
-
-options ARM32
-options PXAGPIO_HAS_GPION_INTRS
-
-makeoptions KERNEL_BASE_PHYS="0xa0200000"
-makeoptions KERNEL_BASE_VIRT="0xc0200000"
-
-# CPU options
-options CPU_XSCALE_PXA2X0 # Support the XScale core
-#options XSCALE_CACHE_WRITE_THROUGH
-options XSCALE_CACHE_WRITE_BACK
-makeoptions CPUFLAGS="-mcpu=xscale"
-
-option WSDISPLAY_COMPAT_USL # VT handling
-option WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11
-option WSDISPLAY_DEFAULTSCREENS=2 # initial number of text consoles
-
-option USBVERBOSE
-
-config bsd swap generic
-
-# The main bus device
-mainbus0 at root
-cpu0 at mainbus?
-pxaip0 at mainbus?
-
-pxaintc0 at pxaip? # interrupt controller
-pxagpio0 at pxaip? # GPIO controller
-pxadmac0 at pxaip? # DMA controller
-pxaost0 at pxaip? addr 0x40a00000 size 0x20
-
-# PCMCIA/CF socket and GPIO controllers
-scoop0 at pxaip?
-scoop1 at pxaip?
-
-# touch screen
-zts0 at pxaip?
-wsmouse* at zts? mux 0
-
-# keyboard
-zkbd0 at pxaip?
-wskbd* at zkbd? mux 1
-
-# USB controllers
-pxaudc0 at pxaip? # USB Device Controller
-ohci0 at pxaip? # Open Host Controller
-
-# USB function support
-usbf* at pxaudc? # USB logical device
-cdcef* at usbf? # CDC ethernet function
-
-# USB bus support
-usb* at ohci?
-
-# USB devices
-uhub* at usb? # USB Root Hub
-uhub* at uhub? # USB Hub
-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?
-uipaq* at uhub? # iPAQ serial adapter
-ucom* at uipaq?
-uchcom* at uhub? # WinChipHead CH341/340 serial
-ucom* at uchcom?
-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
-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 devices
-upl* at uhub? # Prolific PL2301/PL2302 host-to-host
-ugl* at uhub? # Genesys Logic GL620A-USB host-to-host
-udav* at uhub? # Davicom DM9601 based Ethernet
-ural* at uhub? # Ralink RT2500USB
-rum* at uhub? # Ralink RT2501USB/RT2601USB
-run* at uhub? # Ralink RT2700U/RT2800U/RT3000U
-zyd* at uhub? # Zydas ZD1211
-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
-ugen* at uhub? # USB Generic driver
-udcf* at uhub? # Gude Expert mouseCLOCK
-umbg* at uhub? # Meinberg Funkuhren USB5131
-uow* at uhub? # Maxim/Dallas DS2490 1-Wire adapter
-onewire* at uow?
-utwitch* at uhidev? # YUREX BBU sensor
-
-scsibus* at scsi?
-sd* at scsibus? # SCSI disk drives
-#st* at scsibus? # SCSI tape drives
-cd* at scsibus? # SCSI CD-ROM drives
-#ch* at scsibus? # SCSI autochangers
-#uk* at scsibus? # unknown SCSI
-
-# integrated 16550 UARTs
-options COM_PXA2X0
-com0 at pxaip? addr 0x40100000 intr 22 # Full Function UART
-com1 at pxaip? addr 0x40200000 intr 21 # BlueTooth UART
-com2 at pxaip? addr 0x40700000 intr 20 # Standard UART (for IrDA)
-
-# integrated PCMCIA/CF controller
-pxapcic0 at pxaip?
-
-# PCMCIA bus support
-pcmcia* at pxapcic?
-
-# PCMCIA (CF) devices
-com* at pcmcia? # PCMCIA modems/serial ports
-wi* at pcmcia? # WaveLAN IEEE 802.11DS
-malo* at pcmcia? # Marvell 88W8385
-ne* at pcmcia? # PCMCIA based NE2000 ethernet
-wdc* at pcmcia? # hard disk controller
-#cfxga* at pcmcia? # VoyagerVGA frame buffer
-#wsdisplay* at cfxga?
-
-# IDE hard drives
-wd* at wdc? flags 0x0000
-
-# Media Independent Interface (mii) drivers
-exphy* at mii? # 3Com internal PHYs
-inphy* at mii? # Intel 82555 PHYs
-iophy* at mii? # Intel 82553 PHYs
-icsphy* at mii? # ICS 1890 PHYs
-lxtphy* at mii? # Level1 LXT970 PHYs
-nsphy* at mii? # NS and compatible PHYs
-nsphyter* at mii? # NS and compatible PHYs
-qsphy* at mii? # Quality Semi QS6612 PHYs
-sqphy* at mii? # Seeq 8x220 PHYs
-rlphy* at mii? # Realtek 8139 internal PHYs
-mtdphy* at mii? # Myson MTD972 PHYs
-#dcphy* at mii? # Digital Clone PHYs
-acphy* at mii? # Altima AC101 PHYs
-amphy* at mii? # AMD 79C873 PHYs
-tqphy* at mii? # TDK 78Q212x PHYs
-bmtphy* at mii? # Broadcom 10/100 PHYs
-#brgphy* at mii? # Broadcom Gigabit PHYs
-eephy* at mii? # Marvell 88E1000 series PHY
-#xmphy* at mii? # XaQti XMAC-II PHYs
-nsgphy* at mii? # NS gigabit PHYs
-urlphy* at mii? # Realtek RTL8150L internal PHY
-rgephy* at mii? # Realtek 8169S/8110S PHY
-#ciphy* at mii? # Cicada CS8201 10/100/1000 copper PHY
-ukphy* at mii? # "unknown" PHYs
-
-lcd0 at pxaip? # LCD
-wsdisplay* at lcd? console ?
-zssp0 at pxaip? # ADC, touch screen, backlight
-apm0 at pxaip? # APM emulation
-
-zaudio0 at pxaip? # Zaurus I2S/I2C sound
-audio* at zaudio?
-zrc0 at pxaip? # Zaurus remote control
-wskbd* at zrc? mux 1
-flash0 at pxaip? # NAND flash memory
-
-pxammc0 at pxaip? # MMC/SD/SDIO controller
-sdmmc* at pxammc? # SD/MMC bus
-
-# USB Video
-uvideo* at uhub?
-video* at uvideo?
-
-utvfu* at uhub? # Fushicai Audio-Video Grabber
-video* at utvfu?
-audio* at utvfu?
-
-# 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 wsmux 2 # mouse & keyboard multiplexor
-pseudo-device hotplug 1 # devices hot plugging
diff --git a/sys/arch/zaurus/conf/Makefile.zaurus b/sys/arch/zaurus/conf/Makefile.zaurus
deleted file mode 100644
index 29eb7b4dad7..00000000000
--- a/sys/arch/zaurus/conf/Makefile.zaurus
+++ /dev/null
@@ -1,175 +0,0 @@
-# $OpenBSD: Makefile.zaurus,v 1.55 2016/04/29 12:44:53 mpi Exp $
-
-# For instructions on building kernels consult the config(8) and options(4)
-# manual pages.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-# DEBUG is set to -g by config if debugging is requested (config -g).
-# PROF is set to -pg by config if profiling is requested (config -p).
-
-.include <bsd.own.mk>
-
-SIZE?= size
-STRIP?= strip
-
-# source tree is located via $S relative to the compilation directory
-.ifndef S
-S!= cd ../../../..; pwd
-.endif
-
-_machdir?= $S/arch/${_mach}
-_archdir?= $S/arch/${_arch}
-
-INCLUDES= -nostdinc -I$S -I. -I$S/arch
-CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
-CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
- -Wno-main -Wno-uninitialized \
- -Wframe-larger-than=2047
-
-CMACHFLAGS= -ffreestanding -msoft-float # -march=armv4 -mtune=strongarm
-CMACHFLAGS+= -fno-builtin-printf -fno-builtin-snprintf \
- -fno-builtin-vsnprintf -fno-builtin-log \
- -fno-builtin-log2 -fno-builtin-malloc ${NOPIE_FLAGS}
-.if ${IDENT:M-DNO_PROPOLICE}
-CMACHFLAGS+= -fno-stack-protector
-.endif
-
-COPTS?= -O2
-CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
-AFLAGS= -D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS}
-LINKFLAGS= -T ldscript --warn-common -nopie
-
-.if ${IDENT:M-DDDB_STRUCT}
-DB_STRUCTINFO= db_structinfo.h
-.else
-DB_STRUCTINFO=
-.endif
-
-HOSTCC?= ${CC}
-HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
-HOSTED_CFLAGS= ${CFLAGS}
-HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
-
-NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $<
-NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-
-%OBJS
-
-%CFILES
-
-%SFILES
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-# ${SYSTEM_LD_HEAD}
-# ${SYSTEM_LD} swapxxx.o
-# ${SYSTEM_LD_TAIL}
-SYSTEM_HEAD= ${_mach}_start.o locore.o param.o ioconf.o
-SYSTEM_OBJ= ${SYSTEM_HEAD} ${OBJS}
-SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= @rm -f $@
-SYSTEM_LD_HEAD+=; \
- cat ${_archdir}/conf/ldscript.head ${_archdir}/conf/ldscript.tail | \
- sed -e 's/@KERNEL_BASE_PHYS@/${KERNEL_BASE_PHYS}/' \
- -e 's/@KERNEL_BASE_VIRT@/${KERNEL_BASE_VIRT}/' > ldscript
-
-SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \
- ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS}
-SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
-
-DEBUG?=
-.if ${DEBUG} == "-g"
-STRIPFLAGS= -S
-SYSTEM_LD_TAIL+=; \
- echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \
- echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
- ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
-.else
-LINKFLAGS+= -S
-.endif
-
-%LOAD
-
-# cc's -MD puts the source and output paths in the dependency file;
-# since those are temp files here we need to fix it up. It also
-# puts the file in /tmp, so we use -MF to put it in the current
-# directory as assym.P and then generate assym.d from it with a
-# good target name
-assym.h: $S/kern/genassym.sh Makefile \
- ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf
- cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \
- sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} -MF assym.P > assym.h.tmp
- sed '1s/.*/assym.h: \\/' assym.P > assym.d
- sort -u assym.h.tmp > assym.h
-
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${NORMAL_C}
-
-mcount.o: $S/lib/libkern/mcount.c Makefile
- ${NORMAL_C_NOP}
-
-ioconf.o: ioconf.c
- ${NORMAL_C}
-
-vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-
-clean::
- rm -f eddep *bsd *bsd.gdb tags *.[dio] [a-z]*.s \
- [Ee]rrs linterrs assym.h ${DB_STRUCTINFO}
-
-lint:
- @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
- ${CFILES} ioconf.c param.c | \
- grep -v 'static function .* unused'
-
-depend:
- @touch $@
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.pl
- ${CC} ${CFLAGS} ${CPPFLAGS} -MT $@ -gstabs -c $S/ddb/db_structinfo.c
- objdump -g db_structinfo.o | perl $S/ddb/parse_structinfo.pl > $@
- rm -f db_structinfo.o
-
-${_mach}_start.o: ${_machdir}/${_mach}/${_mach}_start.S
-locore.o: ${_archdir}/${_arch}/locore.S assym.h
-in_cksum_arm.o fiq_subr.o bcopyinout.o copystr.o sigcode.o: assym.h
-vectors.o cpuswitch.o exception.o bcopy_page.o irq_dispatch.o: assym.h
-zaurus_start.o: assym.h
-
-# The install target can be redefined by putting a
-# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
-MACHINE_NAME!= uname -n
-install: install-kernel-${MACHINE_NAME}
-.if !target(install-kernel-${MACHINE_NAME}})
-install-kernel-${MACHINE_NAME}:
- cmp -s bsd /bsd || ln -f /bsd /obsd
- cp bsd /nbsd
- mv /nbsd /bsd
-.endif
-
-# pull in the dependency information
-.if !empty(DB_STRUCTINFO) && !exists(${DB_STRUCTINFO})
- ${SYSTEM_OBJ}: ${DB_STRUCTINFO}
-.endif
-.ifnmake clean
-. for o in ${SYSTEM_OBJ} assym.h ${DB_STRUCTINFO}
-. if exists(${o:R}.d)
-. include "${o:R}.d"
-. elif exists($o)
- .PHONY: $o
-. endif
-. endfor
-.endif
-
-%RULES
diff --git a/sys/arch/zaurus/conf/RAMDISK b/sys/arch/zaurus/conf/RAMDISK
deleted file mode 100644
index 5fd3f586de2..00000000000
--- a/sys/arch/zaurus/conf/RAMDISK
+++ /dev/null
@@ -1,127 +0,0 @@
-# $OpenBSD: RAMDISK,v 1.54 2016/06/28 04:41:37 jmatthew Exp $
-
-machine zaurus arm
-maxusers 4
-
-option TIMEZONE=0
-option DST=0
-option SMALL_KERNEL
-option NO_PROPOLICE
-option BOOT_CONFIG
-
-option MINIROOTSIZE=5120
-option RAMDISK_HOOKS
-
-option FFS
-option CD9660
-option MSDOSFS
-option INET6
-option EXT2FS
-option CRYPTO
-
-option ARM32
-option PXAGPIO_HAS_GPION_INTRS
-
-makeoptions KERNEL_BASE_PHYS="0xa0200000"
-makeoptions KERNEL_BASE_VIRT="0xc0200000"
-
-option CPU_XSCALE_PXA2X0
-#option XSCALE_CACHE_WRITE_THROUGH
-option XSCALE_CACHE_WRITE_BACK
-makeoptions CPUFLAGS="-mcpu=xscale"
-
-config bsd root on rd0a swap on rd0b
-
-mainbus0 at root
-cpu0 at mainbus?
-pxaip0 at mainbus?
-pxaintc0 at pxaip? # interrupt controller
-pxagpio0 at pxaip?
-scoop0 at pxaip?
-scoop1 at pxaip?
-pxaost0 at pxaip? addr 0x40a00000 size 0x20
-
-lcd0 at pxaip?
-wsdisplay* at lcd? console ?
-zssp0 at pxaip? # ADC, touch screen, backlight
-zts0 at pxaip? # touch screen
-wsmouse* at zts? mux 0
-zkbd0 at pxaip?
-wskbd* at zkbd? mux 1
-pxaudc0 at pxaip? # USB Device Controller
-
-ohci0 at pxaip?
-usbf* at pxaudc? # USB logical device
-cdcef* at usbf? # CDC ethernet function
-usb* at ohci?
-
-uhub* at usb?
-uhub* at uhub?
-uhidev* at uhub?
-uhid* at uhidev? # USB Generic HID devices
-ukbd* at uhidev? # USB HID Keyboard devices
-wskbd* at ukbd? mux 1
-aue* at uhub? # ADMtek AN986 Pegasus Ethernet
-axe* at uhub? # ASIX Electronics AX88172 USB Ethernet
-axen* at uhub? # ASIX Electronics AX88179 USB Ethernet
-cdce* at uhub? # CDC Ethernet
-cue* at uhub? # CATC USB-EL1201A based Ethernet
-kue* at uhub? # Kawasaki KL5KUSB101B based Ethernet
-smsc* at uhub? # SMSC LAN95xx Ethernet
-udav* at uhub? # Davicom DM9601 based Ethernet
-ural* at uhub? # Ralink RT2500
-url* at uhub? # Realtek RTL8150L based adapters
-ure* at uhub? # Realtek RTL8152 based adapters
-wi* at uhub? # WaveLAN IEEE 802.11DS
-upl* at uhub? # Prolific PL2301/PL2302 host-to-host
-ugl* at uhub? # Genesys Logic GL620USB-A host-to-host
-umass* at uhub?
-
-pxammc0 at pxaip? # MMC/SD/SDIO controller
-sdmmc* at pxammc? # SD/MMC bus
-softraid0 at root
-
-scsibus* at scsi?
-sd* at scsibus?
-cd* at scsibus?
-
-option COM_PXA2X0
-com0 at pxaip? addr 0x40100000 intr 22 # Full Function UART
-com1 at pxaip? addr 0x40200000 intr 21 # BlueTooth UART
-com2 at pxaip? addr 0x40700000 intr 20 # Standard UART (for IrDA)
-
-pxapcic0 at pxaip?
-pcmcia* at pxapcic?
-wi* at pcmcia?
-ne* at pcmcia?
-wdc* at pcmcia?
-wd* at wdc? flags 0x0000
-
-exphy* at mii? # 3Com internal PHYs
-inphy* at mii? # Intel 82555 PHYs
-iophy* at mii? # Intel 82553 PHYs
-icsphy* at mii? # ICS 1890 PHYs
-lxtphy* at mii? # Level1 LXT970 PHYs
-nsphy* at mii? # NS and compatible PHYs
-nsphyter* at mii? # NS and compatible PHYs
-qsphy* at mii? # Quality Semi QS6612 PHYs
-sqphy* at mii? # Seeq 8x220 PHYs
-rlphy* at mii? # Realtek 8139 internal PHYs
-mtdphy* at mii? # Myson MTD972 PHYs
-acphy* at mii? # Altima AC101 PHYs
-amphy* at mii? # AMD 79C873 PHYs
-tqphy* at mii? # TDK 78Q212x PHYs
-bmtphy* at mii? # Broadcom 10/100 PHYs
-eephy* at mii? # Marvell 88E1000 series PHY
-nsgphy* at mii? # NS gigabit PHYs
-urlphy* at mii? # Realtek RTL8150L internal PHY
-rgephy* at mii? # Realtek 8169S/8110S PHY
-ukphy* at mii? # "unknown" PHYs
-
-apm0 at pxaip? # APM emulation
-
-pseudo-device wsmux 2
-pseudo-device loop 1
-pseudo-device bpfilter 1
-pseudo-device rd 1
-pseudo-device bio 1
diff --git a/sys/arch/zaurus/conf/files.zaurus b/sys/arch/zaurus/conf/files.zaurus
deleted file mode 100644
index b805fb9ab7b..00000000000
--- a/sys/arch/zaurus/conf/files.zaurus
+++ /dev/null
@@ -1,120 +0,0 @@
-# $OpenBSD: files.zaurus,v 1.32 2016/01/08 15:54:13 jcs Exp $
-#
-# First try for arm-specific configuration info
-#
-
-maxpartitions 16
-maxusers 2 8 64
-
-major {wd = 16}
-major {sd = 24}
-major {cd = 26}
-major {rd = 18}
-
-file arch/arm/arm/conf.c
-
-file arch/zaurus/zaurus/zaurus_machdep.c
-
-#
-# Machine-independent SCSI drivers
-#
-include "scsi/files.scsi"
-include "dev/atapiscsi/files.atapiscsi"
-
-# CPU support and integrated peripherals
-include "arch/arm/xscale/files.pxa2x0"
-
-# LCD frame buffer
-attach lcd at pxaip with lcd_pxaip
-file arch/zaurus/zaurus/zaurus_lcd.c lcd_pxaip
-
-# GPIO keyboard
-device zkbd: wskbddev
-attach zkbd at pxaip
-file arch/zaurus/dev/zaurus_kbd.c zkbd
-
-# 16-bit GPIO controller
-device scoop
-attach scoop at pxaip
-file arch/zaurus/dev/zaurus_scoop.c scoop
-
-# PCMCIA/CF socket controller
-attach pxapcic at pxaip with pxapcic_scoop
-file arch/zaurus/dev/scoop_pcic.c pxapcic_scoop
-
-# SD/MMC socket controller
-attach pxammc at pxaip with pxammc_scoop
-file arch/zaurus/dev/scoop_mmc.c pxammc_scoop
-
-# Dedicated SSP unit for ADC, touch screen, and backlight
-device zssp
-attach zssp at pxaip
-file arch/zaurus/dev/zaurus_ssp.c zssp
-
-# Power manager and APM emulation
-attach apm at pxaip with apm_pxaip
-file arch/zaurus/dev/zaurus_apm.c apm_pxaip
-
-# Zaurus touchpad
-device zts: wsmousedev
-attach zts at pxaip
-file arch/zaurus/dev/zts.c zts
-
-# Zaurus sound
-device zaudio: audio, i2s, i2c
-attach zaudio at pxaip
-file arch/zaurus/dev/zaurus_audio.c zaudio
-
-# Zaurus remote control
-device zrc: wskbddev
-attach zrc at pxaip
-file arch/zaurus/dev/zaurus_remote.c zrc
-
-# NAND flash pseudo-disk device (Xilinx NAND flash controller)
-device flash: disk
-attach flash at pxaip with flash_pxaip
-file arch/zaurus/dev/zaurus_flash.c flash_pxaip
-
-#
-# Machine-independent ATA drivers
-#
-include "dev/ata/files.ata"
-
-# Generic MD files
-file arch/zaurus/zaurus/autoconf.c
-
-file arch/arm/arm/disksubr.c disk
-
-# ARM FPE
-file arch/arm/fpe-arm/armfpe_glue.S armfpe
-file arch/arm/fpe-arm/armfpe_init.c armfpe
-file arch/arm/fpe-arm/armfpe.s armfpe
-
-# Include WSCONS stuff
-include "dev/wscons/files.wscons"
-include "dev/rasops/files.rasops"
-include "dev/wsfont/files.wsfont"
-
-#
-# Machine-independent HID support
-#
-include "dev/hid/files.hid"
-
-# Include USB stuff
-include "dev/usb/files.usb"
-
-attach pxaudc at pxaip with pxaudc_zaurus
-file arch/zaurus/dev/zaurus_udc.c pxaudc_zaurus
-
-# Media Independent Interface (mii)
-include "dev/mii/files.mii"
-
-#
-# Machine-independent SD/MMC drivers
-#
-include "dev/sdmmc/files.sdmmc"
-
-#
-# Machine-independent 1-Wire drivers
-#
-include "dev/onewire/files.onewire"
diff --git a/sys/arch/zaurus/dev/scoop_mmc.c b/sys/arch/zaurus/dev/scoop_mmc.c
deleted file mode 100644
index 3af95d7a84d..00000000000
--- a/sys/arch/zaurus/dev/scoop_mmc.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $OpenBSD: scoop_mmc.c,v 1.2 2009/09/03 21:40:29 marex Exp $ */
-
-/*
- * Copyright (c) 2007 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Attachment driver for pxammc(4) on Zaurus */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-
-#include <dev/sdmmc/sdmmcreg.h>
-
-#include <machine/machine_reg.h>
-
-#include <arch/arm/xscale/pxammcvar.h>
-#include <arch/zaurus/dev/zaurus_scoopvar.h>
-
-int scoop_mmc_match(struct device *, void *, void *);
-void scoop_mmc_attach(struct device *, struct device *, void *);
-
-struct cfattach pxammc_scoop_ca = {
- sizeof(struct pxammc_softc), scoop_mmc_match,
- scoop_mmc_attach
-};
-
-u_int32_t scoop_mmc_get_ocr(void *);
-int scoop_mmc_set_power(void *, u_int32_t);
-
-int
-scoop_mmc_match(struct device *parent, void *match, void *aux)
-{
- return pxammc_match();
-}
-
-void
-scoop_mmc_attach(struct device *parent, struct device *self, void *aux)
-{
- struct pxammc_softc *sc = (struct pxammc_softc *)self;
-
- sc->tag.cookie = (void *)sc;
- sc->tag.get_ocr = scoop_mmc_get_ocr;
- sc->tag.set_power = scoop_mmc_set_power;
-
- sc->sc_gpio_detect = GPIO_MMC_DETECT;
-
- pxammc_attach(sc, aux);
-}
-
-u_int32_t
-scoop_mmc_get_ocr(void *cookie)
-{
- return MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V;
-}
-
-int
-scoop_mmc_set_power(void *cookie, u_int32_t ocr)
-{
- if (ISSET(ocr, MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V)) {
- scoop_set_sdmmc_power(1);
- return 0;
- } else if (ocr != 0) {
- printf("scoop_mmc_set_power: unsupported OCR (%#x)\n", ocr);
- return EINVAL;
- } else {
- scoop_set_sdmmc_power(0);
- return 0;
- }
-}
diff --git a/sys/arch/zaurus/dev/scoop_pcic.c b/sys/arch/zaurus/dev/scoop_pcic.c
deleted file mode 100644
index c0672c5e61c..00000000000
--- a/sys/arch/zaurus/dev/scoop_pcic.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/* $OpenBSD: scoop_pcic.c,v 1.5 2014/05/08 21:17:01 miod Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <arch/arm/xscale/pxa2x0var.h>
-#include <arch/arm/xscale/pxapcicvar.h>
-
-#include <machine/machine_reg.h>
-#include <machine/zaurus_var.h>
-
-#include <zaurus/dev/zaurus_scoopreg.h>
-
-int scoop_pcic_match(struct device *, void *, void *);
-void scoop_pcic_attach(struct device *, struct device *, void *);
-void scoop_pcic_socket_setup(struct pxapcic_socket *);
-
-struct cfattach pxapcic_scoop_ca = {
- sizeof(struct pxapcic_softc), scoop_pcic_match,
- scoop_pcic_attach
-};
-
-u_int scoop_pcic_read(struct pxapcic_socket *, int);
-void scoop_pcic_write(struct pxapcic_socket *, int, u_int);
-void scoop_pcic_set_power(struct pxapcic_socket *, int);
-void scoop_pcic_clear_intr(struct pxapcic_socket *);
-
-struct pxapcic_tag scoop_pcic_functions = {
- scoop_pcic_read,
- scoop_pcic_write,
- scoop_pcic_set_power,
- scoop_pcic_clear_intr,
- 0, /* intr_establish */
- 0, /* intr_disestablish */
- 0 /* intr_string */
-};
-
-int
-scoop_pcic_match(struct device *parent, void *cf, void *aux)
-{
- return (ZAURUS_ISC860 || ZAURUS_ISC3000);
-}
-
-void
-scoop_pcic_attach(struct device *parent, struct device *self, void *aux)
-{
- struct pxapcic_softc *sc = (struct pxapcic_softc *)self;
- struct pxaip_attach_args *pxa = aux;
-
- sc->sc_iot = pxa->pxa_iot;
-
- if (ZAURUS_ISC860) {
- sc->sc_nslots = 1;
- sc->sc_irqpin[0] = C860_CF0_IRQ;
- sc->sc_irqcfpin[0] = C860_CF0_IRQ_PIN;
- } else if (ZAURUS_ISC3000) {
- sc->sc_nslots = 2;
- sc->sc_irqpin[0] = C3000_CF0_IRQ;
- sc->sc_irqcfpin[0] = C3000_CF0_IRQ_PIN;
- sc->sc_irqpin[1] = C3000_CF1_IRQ;
- sc->sc_irqcfpin[1] = C3000_CF1_IRQ_PIN;
- }
-
- pxapcic_attach(sc, &scoop_pcic_socket_setup);
-}
-
-void
-scoop_pcic_socket_setup(struct pxapcic_socket *so)
-{
- struct pxapcic_softc *sc;
- bus_addr_t pa;
- bus_size_t size = SCOOP_SIZE;
- bus_space_tag_t iot;
- bus_space_handle_t scooph;
- int error;
-
- sc = so->sc;
- iot = sc->sc_iot;
-
- if (so->socket == 0)
- pa = C3000_SCOOP0_BASE;
- else if (so->socket == 1)
- pa = C3000_SCOOP1_BASE;
- else
- panic("%s: invalid CF slot %d", sc->sc_dev.dv_xname,
- so->socket);
- error = bus_space_map(iot, trunc_page(pa), round_page(size),
- 0, &scooph);
- if (error)
- panic("%s: can't map memory %lx for scoop",
- sc->sc_dev.dv_xname, pa);
- scooph += pa - trunc_page(pa);
-
- bus_space_write_2(iot, scooph, SCOOP_IMR,
- SCP_IMR_UNKN0 | SCP_IMR_UNKN1);
-
- /* setup */
- bus_space_write_2(iot, scooph, SCOOP_MCR, 0x0100);
- bus_space_write_2(iot, scooph, SCOOP_CDR, 0x0000);
- bus_space_write_2(iot, scooph, SCOOP_CPR, 0x0000);
- bus_space_write_2(iot, scooph, SCOOP_IMR, 0x0000);
- bus_space_write_2(iot, scooph, SCOOP_IRM, 0x00ff);
- bus_space_write_2(iot, scooph, SCOOP_ISR, 0x0000);
- bus_space_write_2(iot, scooph, SCOOP_IRM, 0x0000);
-
- /* C3000 */
- if (so->socket == 1) {
- bus_space_write_2(iot, scooph, SCOOP_CPR, 0x80c1);
- bus_space_write_2(iot, scooph, SCOOP_IMR, 0x00c4);
- bus_space_write_2(iot, scooph, SCOOP_MCR, 0x0111);
- } else {
- bus_space_write_2(iot, scooph, SCOOP_CPR,
- SCP_CPR_PWR|SCP_CPR_5V);
- }
-
- bus_space_write_2(iot, scooph, SCOOP_IMR, 0x00ce);
- bus_space_write_2(iot, scooph, SCOOP_MCR, 0x0111);
-
- /* C3000 */
- so->power_capability = PXAPCIC_POWER_3V;
- if (so->socket == 0)
- so->power_capability |= PXAPCIC_POWER_5V;
-
- so->pcictag_cookie = (void *)scooph;
- so->pcictag = &scoop_pcic_functions;
-}
-
-u_int
-scoop_pcic_read(struct pxapcic_socket *so, int reg)
-{
- bus_space_tag_t iot = so->sc->sc_iot;
- bus_space_handle_t ioh = (bus_space_handle_t)so->pcictag_cookie;
- u_int16_t csr;
-
- csr = bus_space_read_2(iot, ioh, SCOOP_CSR);
-
- switch (reg) {
- case PXAPCIC_CARD_STATUS:
- if (csr & SCP_CSR_MISSING)
- return (PXAPCIC_CARD_INVALID);
- else
- return (PXAPCIC_CARD_VALID);
-
- case PXAPCIC_CARD_READY:
- return ((bus_space_read_2(iot, ioh, SCOOP_CSR) &
- SCP_CSR_READY) != 0);
-
- default:
- panic("scoop_pcic_read: bogus register");
- }
-}
-
-void
-scoop_pcic_write(struct pxapcic_socket *so, int reg, u_int val)
-{
- bus_space_tag_t iot = so->sc->sc_iot;
- bus_space_handle_t ioh = (bus_space_handle_t)so->pcictag_cookie;
- u_int16_t newval;
- int s;
-
- s = splhigh();
-
- switch (reg) {
- case PXAPCIC_CARD_POWER:
- newval = bus_space_read_2(iot, ioh, SCOOP_CPR);
- newval &= ~(SCP_CPR_PWR | SCP_CPR_3V | SCP_CPR_5V);
-
- if (val == PXAPCIC_POWER_3V)
- newval |= (SCP_CPR_PWR | SCP_CPR_3V);
- else if (val == PXAPCIC_POWER_5V)
- newval |= (SCP_CPR_PWR | SCP_CPR_5V);
-
- bus_space_write_2(iot, ioh, SCOOP_CPR, newval);
- break;
-
- case PXAPCIC_CARD_RESET:
- bus_space_write_2(iot, ioh, SCOOP_CCR,
- val ? SCP_CCR_RESET : 0);
- break;
-
- default:
- panic("scoop_pcic_write: bogus register");
- }
-
- splx(s);
-}
-
-void
-scoop_pcic_set_power(struct pxapcic_socket *so, int pwr)
-{
- bus_space_tag_t iot = so->sc->sc_iot;
- bus_space_handle_t ioh = (bus_space_handle_t)so->pcictag_cookie;
- u_int16_t reg;
- int s;
-
- s = splhigh();
-
- switch (pwr) {
- case PXAPCIC_POWER_OFF:
-#if 0
- /* XXX does this disable power to both sockets? */
- reg = bus_space_read_2(iot, ioh, SCOOP_GPWR);
- bus_space_write_2(iot, ioh, SCOOP_GPWR,
- reg & ~(1 << SCOOP0_CF_POWER_C3000));
-#endif
- break;
-
- case PXAPCIC_POWER_3V:
- case PXAPCIC_POWER_5V:
- /* XXX */
- if (so->socket == 0) {
- reg = bus_space_read_2(iot, ioh, SCOOP_GPWR);
- bus_space_write_2(iot, ioh, SCOOP_GPWR,
- reg | (1 << SCOOP0_CF_POWER_C3000));
- }
- break;
-
- default:
- splx(s);
- panic("scoop_pcic_set_power: bogus power state");
- }
-
- splx(s);
-}
-
-void
-scoop_pcic_clear_intr(struct pxapcic_socket *so)
-{
- bus_space_tag_t iot = so->sc->sc_iot;
- bus_space_handle_t ioh = (bus_space_handle_t)so->pcictag_cookie;
-
- bus_space_write_2(iot, ioh, SCOOP_IRM, 0x00ff);
- bus_space_write_2(iot, ioh, SCOOP_ISR, 0x0000);
- bus_space_write_2(iot, ioh, SCOOP_IRM, 0x0000);
-}
diff --git a/sys/arch/zaurus/dev/zaurus_apm.c b/sys/arch/zaurus/dev/zaurus_apm.c
deleted file mode 100644
index a0c2e1685d6..00000000000
--- a/sys/arch/zaurus/dev/zaurus_apm.c
+++ /dev/null
@@ -1,731 +0,0 @@
-/* $OpenBSD: zaurus_apm.c,v 1.34 2015/09/28 18:36:36 deraadt Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/timeout.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/sysctl.h>
-#include <sys/mutex.h>
-#include <sys/reboot.h>
-#include <sys/rwlock.h>
-#include <dev/rndvar.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_apm.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-#include <zaurus/dev/zaurus_scoopvar.h>
-#include <zaurus/dev/zaurus_sspvar.h>
-void zssp_init(void); /* XXX */
-
-#include <zaurus/dev/zaurus_apm.h>
-
-#include <dev/wscons/wsdisplayvar.h>
-
-#include "wsdisplay.h"
-
-#if defined(APMDEBUG)
-#define DPRINTF(x) printf x
-#else
-#define DPRINTF(x) /**/
-#endif
-
-struct zapm_softc {
- struct pxa2x0_apm_softc sc;
- struct timeout sc_poll;
- struct timeval sc_lastbattchk;
- int sc_suspended;
- int sc_ac_on;
- int sc_charging;
- int sc_discharging;
- int sc_batt_full;
- int sc_batt_volt;
- u_int sc_event;
-};
-
-int apm_match(struct device *, void *, void *);
-void apm_attach(struct device *, struct device *, void *);
-int apm_activate(struct device *, int);
-
-struct cfattach apm_pxaip_ca = {
- sizeof (struct zapm_softc), apm_match, apm_attach,
- NULL, apm_activate
-};
-extern struct cfdriver apm_cd;
-
-/* MAX1111 command word */
-#define MAXCTRL_PD0 (1<<0)
-#define MAXCTRL_PD1 (1<<1)
-#define MAXCTRL_SGL (1<<2)
-#define MAXCTRL_UNI (1<<3)
-#define MAXCTRL_SEL_SHIFT 4
-#define MAXCTRL_STR (1<<7)
-
-/* MAX1111 ADC channels */
-#define BATT_THM 2
-#define BATT_AD 4
-#define JK_VAD 6
-
-/* battery-related GPIO pins */
-#define GPIO_AC_IN_C3000 115 /* 0=AC connected */
-#define GPIO_CHRG_CO_C3000 101 /* 1=battery full */
-#define GPIO_BATT_COVER_C3000 90 /* 0=unlocked */
-
-/*
- * Battery-specific information
- */
-
-struct battery_threshold {
- int bt_volt;
- int bt_life;
- int bt_state;
-};
-
-struct battery_info {
- int bi_minutes; /* 100% life time */
- const struct battery_threshold *bi_thres;
-};
-
-const struct battery_threshold zaurus_battery_life_c3000[] = {
-#if 0
- {224, 125, APM_BATT_HIGH}, /* XXX unverified */
-#endif
- {194, 100, APM_BATT_HIGH},
- {188, 75, APM_BATT_HIGH},
- {184, 50, APM_BATT_HIGH},
- {180, 25, APM_BATT_LOW},
- {178, 5, APM_BATT_LOW},
- {0, 0, APM_BATT_CRITICAL},
-};
-
-const struct battery_info zaurus_battery_c3000 = {
- 180 /* minutes; pessimistic estimate */,
- zaurus_battery_life_c3000
-};
-
-const struct battery_info *zaurus_main_battery = &zaurus_battery_c3000;
-
-/* Restart charging this many times before accepting BATT_FULL. */
-#define MIN_BATT_FULL 2
-
-/* Discharge 100 ms before reading the voltage if AC is connected. */
-#define DISCHARGE_TIMEOUT (hz / 10)
-
-/* Check battery voltage and "kick charging" every minute. */
-const struct timeval zapm_battchkrate = { 60, 0 };
-
-/* Prototypes */
-
-int zapm_acintr(void *);
-int zapm_bcintr(void *);
-int zapm_ac_on(void);
-int max1111_adc_value(int);
-int max1111_adc_value_avg(int, int);
-#if 0
-int zapm_jkvad_voltage(void);
-int zapm_batt_temp(void);
-#endif
-int zapm_batt_volt(void);
-int zapm_batt_state(int);
-int zapm_batt_life(int);
-int zapm_batt_minutes(int);
-void zapm_enable_charging(struct zapm_softc *, int);
-int zapm_charge_complete(struct zapm_softc *);
-void zapm_poll(void *);
-int zapm_get_event(struct pxa2x0_apm_softc *, u_int *);
-void zapm_power_info(struct pxa2x0_apm_softc *, struct apm_power_info *);
-void zapm_suspend(struct pxa2x0_apm_softc *);
-int zapm_resume(struct pxa2x0_apm_softc *);
-void pxa2x0_setperf(int);
-int pxa2x0_cpuspeed(int *);
-
-
-int
-apm_match(struct device *parent, void *match, void *aux)
-{
- return (1);
-}
-
-void
-apm_attach(struct device *parent, struct device *self, void *aux)
-{
- struct zapm_softc *sc = (struct zapm_softc *)self;
-
- pxa2x0_gpio_set_function(GPIO_AC_IN_C3000, GPIO_IN);
- pxa2x0_gpio_set_function(GPIO_CHRG_CO_C3000, GPIO_IN);
- pxa2x0_gpio_set_function(GPIO_BATT_COVER_C3000, GPIO_IN);
-
- (void)pxa2x0_gpio_intr_establish(GPIO_AC_IN_C3000,
- IST_EDGE_BOTH, IPL_BIO, zapm_acintr, sc, "apm_ac");
- (void)pxa2x0_gpio_intr_establish(GPIO_BATT_COVER_C3000,
- IST_EDGE_BOTH, IPL_BIO, zapm_bcintr, sc, "apm_bc");
-
- sc->sc_event = APM_NOEVENT;
- sc->sc.sc_get_event = zapm_get_event;
- sc->sc.sc_power_info = zapm_power_info;
- sc->sc.sc_suspend = zapm_suspend;
- sc->sc.sc_resume = zapm_resume;
-
- timeout_set(&sc->sc_poll, &zapm_poll, sc);
-
- /* Get initial battery voltage. */
- zapm_enable_charging(sc, 0);
- if (zapm_ac_on()) {
- /* C3000: discharge 100 ms when AC is on. */
- scoop_discharge_battery(1);
- delay(100000);
- }
- sc->sc_batt_volt = zapm_batt_volt();
- scoop_discharge_battery(0);
-
- pxa2x0_apm_attach_sub(&sc->sc);
-
- cpu_setperf = pxa2x0_setperf;
- cpu_cpuspeed = pxa2x0_cpuspeed;
-}
-
-int
-apm_activate(struct device *self, int act)
-{
- struct zapm_softc *sc = (struct zapm_softc *)self;
- int ret = 0;
-
- switch (act) {
- case DVACT_POWERDOWN:
- zapm_enable_charging(sc, 0);
- break;
- }
-
- return (ret);
-}
-
-int
-zapm_acintr(void *v)
-{
- zapm_poll(v);
- return (1);
-}
-
-int
-zapm_bcintr(void *v)
-{
- zapm_poll(v);
- return (1);
-}
-
-int
-zapm_ac_on(void)
-{
- return (!pxa2x0_gpio_get_bit(GPIO_AC_IN_C3000));
-}
-
-int
-max1111_adc_value(int chan)
-{
-
- return ((int)zssp_ic_send(ZSSP_IC_MAX1111, MAXCTRL_PD0 |
- MAXCTRL_PD1 | MAXCTRL_SGL | MAXCTRL_UNI |
- (chan << MAXCTRL_SEL_SHIFT) | MAXCTRL_STR));
-}
-
-/* XXX simplify */
-int
-max1111_adc_value_avg(int chan, int pause)
-{
- int val[5];
- int i, j, k, x;
- int sum = 0;
-
- for (i = 0; i < 5; i++) {
- val[i] = max1111_adc_value(chan);
- if (i != 4)
- delay(pause * 1000);
- }
-
- x = val[0];
- j = 0;
- for (i = 1; i < 5; i++) {
- if (x < val[i]) {
- x = val[i];
- j = i;
- }
- }
-
- x = val[4];
- k = 4;
- for (i = 3; i >= 0; i--) {
- if (x > val[i]) {
- x = val[i];
- k = i;
- }
- }
-
- for (i = 0; i < 5; i++) {
- if (i == j || i == k)
- continue;
- sum += val[i];
- }
-
- return (sum / 3);
-}
-
-#if 0
-/*
- * Return the voltage available for charging. This will be zero,
- * unless A/C power is connected.
- */
-int
-zapm_jkvad_voltage(void)
-{
-
- return (max1111_adc_value_avg(JK_VAD, 10));
-}
-
-int
-zapm_batt_temp(void)
-{
- int temp;
-
- scoop_battery_temp_adc(1);
- delay(10000);
- temp = max1111_adc_value_avg(BATT_THM, 1);
- scoop_battery_temp_adc(0);
-
- return (temp);
-}
-#endif
-
-int
-zapm_batt_volt(void)
-{
-
- return (max1111_adc_value_avg(BATT_AD, 10));
-}
-
-int
-zapm_batt_state(int volt)
-{
- const struct battery_threshold *bthr;
- int i;
-
- bthr = zaurus_main_battery->bi_thres;
-
- for (i = 0; bthr[i].bt_volt > 0; i++)
- if (bthr[i].bt_volt <= volt)
- break;
-
- return (bthr[i].bt_state);
-}
-
-int
-zapm_batt_life(int volt)
-{
- const struct battery_threshold *bthr;
- int i;
-
- bthr = zaurus_main_battery->bi_thres;
-
- for (i = 0; bthr[i].bt_volt > 0; i++)
- if (bthr[i].bt_volt <= volt)
- break;
-
- if (i == 0)
- return (bthr[i].bt_life);
-
- return (bthr[i].bt_life +
- ((volt - bthr[i].bt_volt) * 100) /
- (bthr[i-1].bt_volt - bthr[i].bt_volt) *
- (bthr[i-1].bt_life - bthr[i].bt_life) / 100);
-}
-
-int
-zapm_batt_minutes(int life)
-{
-
- return (zaurus_main_battery->bi_minutes * life / 100);
-}
-
-void
-zapm_enable_charging(struct zapm_softc *sc, int enable)
-{
-
- scoop_discharge_battery(0);
- scoop_charge_battery(enable, 0);
- scoop_led_set(SCOOP_LED_ORANGE, enable);
-}
-
-/*
- * Return non-zero if the charge complete signal indicates that the
- * battery is fully charged. Restart charging to clear this signal.
- */
-int
-zapm_charge_complete(struct zapm_softc *sc)
-{
-
- if (sc->sc_charging && sc->sc_batt_full < MIN_BATT_FULL) {
- if (pxa2x0_gpio_get_bit(GPIO_CHRG_CO_C3000) != 0) {
- if (++sc->sc_batt_full < MIN_BATT_FULL) {
- DPRINTF(("battery almost full\n"));
- zapm_enable_charging(sc, 0);
- delay(15000);
- zapm_enable_charging(sc, 1);
- }
- } else if (sc->sc_batt_full > 0) {
- /* false alarm */
- sc->sc_batt_full = 0;
- zapm_enable_charging(sc, 0);
- delay(15000);
- zapm_enable_charging(sc, 1);
- }
- }
-
- return (sc->sc_batt_full >= MIN_BATT_FULL);
-}
-
-/*
- * Poll power-management related GPIO inputs, update battery life
- * in softc, and/or control battery charging.
- */
-void
-zapm_poll(void *v)
-{
- struct zapm_softc *sc = v;
- int ac_on;
- int bc_lock;
- int charging;
- int volt;
- int s;
-
- s = splhigh();
-
- /* Check positition of battery compartment lock switch. */
- bc_lock = pxa2x0_gpio_get_bit(GPIO_BATT_COVER_C3000) ? 1 : 0;
-
- /* Stop discharging. */
- if (sc->sc_discharging) {
- sc->sc_discharging = 0;
- volt = zapm_batt_volt();
- ac_on = zapm_ac_on();
- charging = 0;
- DPRINTF(("zapm_poll: discharge off volt %d\n", volt));
- } else {
- ac_on = zapm_ac_on();
- charging = sc->sc_charging;
- volt = sc->sc_batt_volt;
- }
-
- /* Start or stop charging as necessary. */
- if (ac_on && bc_lock) {
- if (charging) {
- if (zapm_charge_complete(sc)) {
- DPRINTF(("zapm_poll: batt full\n"));
- charging = 0;
- zapm_enable_charging(sc, 0);
- }
- } else if (!zapm_charge_complete(sc)) {
- charging = 1;
- volt = zapm_batt_volt();
- zapm_enable_charging(sc, 1);
- DPRINTF(("zapm_poll: start charging volt %d\n", volt));
- }
- } else {
- if (charging) {
- charging = 0;
- zapm_enable_charging(sc, 0);
- timerclear(&sc->sc_lastbattchk);
- DPRINTF(("zapm_poll: stop charging\n"));
- }
- sc->sc_batt_full = 0;
- }
-
- /*
- * Restart charging once in a while. Discharge a few milliseconds
- * before updating the voltage in our softc if A/C is connected.
- */
- if (bc_lock && ratecheck(&sc->sc_lastbattchk, &zapm_battchkrate)) {
- if (sc->sc_suspended) {
- DPRINTF(("zapm_poll: suspended %lu %lu\n",
- sc->sc_lastbattchk.tv_sec,
- pxa2x0_rtc_getsecs()));
- if (charging) {
- zapm_enable_charging(sc, 0);
- delay(15000);
- zapm_enable_charging(sc, 1);
- pxa2x0_rtc_setalarm(pxa2x0_rtc_getsecs() +
- zapm_battchkrate.tv_sec + 1);
- }
- } else if (ac_on && sc->sc_batt_full == 0) {
- DPRINTF(("zapm_poll: discharge on\n"));
- if (charging)
- zapm_enable_charging(sc, 0);
- sc->sc_discharging = 1;
- scoop_discharge_battery(1);
- timeout_add(&sc->sc_poll, DISCHARGE_TIMEOUT);
- } else if (!ac_on) {
- volt = zapm_batt_volt();
- DPRINTF(("zapm_poll: volt %d\n", volt));
- }
- }
-
- /* Update the cached power state in our softc. */
- if (ac_on != sc->sc_ac_on || charging != sc->sc_charging ||
- volt != sc->sc_batt_volt) {
- sc->sc_ac_on = ac_on;
- sc->sc_charging = charging;
- sc->sc_batt_volt = volt;
- if (sc->sc_event == APM_NOEVENT)
- sc->sc_event = APM_POWER_CHANGE;
- }
-
- /* Detect battery low conditions. */
- if (!ac_on) {
- if (zapm_batt_life(volt) < 5)
- sc->sc_event = APM_BATTERY_LOW;
- if (zapm_batt_state(volt) == APM_BATT_CRITICAL)
- sc->sc_event = APM_CRIT_SUSPEND_REQ;
- }
-
-#ifdef APMDEBUG
- if (sc->sc_event != APM_NOEVENT)
- DPRINTF(("zapm_poll: power event %d\n", sc->sc_event));
-#endif
- splx(s);
-}
-
-/*
- * apm_thread() calls this routine approximately once per second.
- */
-int
-zapm_get_event(struct pxa2x0_apm_softc *pxa_sc, u_int *typep)
-{
- struct zapm_softc *sc = (struct zapm_softc *)pxa_sc;
- int s;
-
- s = splsoftclock();
-
- /* Don't interfere with discharging. */
- if (sc->sc_discharging)
- *typep = sc->sc_event;
- else if (sc->sc_event == APM_NOEVENT) {
- zapm_poll(sc);
- *typep = sc->sc_event;
- }
- sc->sc_event = APM_NOEVENT;
-
- splx(s);
- return (*typep == APM_NOEVENT);
-}
-
-/*
- * Return power status to the generic APM driver.
- */
-void
-zapm_power_info(struct pxa2x0_apm_softc *pxa_sc, struct apm_power_info *power)
-{
- struct zapm_softc *sc = (struct zapm_softc *)pxa_sc;
- int s;
- int ac_on;
- int volt;
- int charging;
-
- s = splsoftclock();
- ac_on = sc->sc_ac_on;
- volt = sc->sc_batt_volt;
- charging = sc->sc_charging;
- splx(s);
-
- power->ac_state = ac_on ? APM_AC_ON : APM_AC_OFF;
- if (charging)
- power->battery_state = APM_BATT_CHARGING;
- else
- power->battery_state = zapm_batt_state(volt);
-
- power->battery_life = zapm_batt_life(volt);
- power->minutes_left = zapm_batt_minutes(power->battery_life);
-}
-
-/*
- * Called before suspending when all ca_activate functions are done.
- */
-void
-zapm_suspend(struct pxa2x0_apm_softc *pxa_sc)
-{
- struct zapm_softc *sc = (struct zapm_softc *)pxa_sc;
-
- config_suspend_all(DVACT_QUIESCE);
- bufq_quiesce();
-
- /* Poll in suspended mode and forget the discharge timeout. */
- sc->sc_suspended = 1;
- timeout_del(&sc->sc_poll);
-
- /* Make sure charging is enabled and RTC alarm is set. */
- timerclear(&sc->sc_lastbattchk);
-
- zapm_poll(sc);
-
-#if 0
- pxa2x0_rtc_setalarm(pxa2x0_rtc_getsecs() + 5);
-#endif
- pxa2x0_wakeup_config(PXA2X0_WAKEUP_ALL, 1);
-}
-
-/*
- * Called after wake-up from suspend with interrupts still disabled,
- * before any ca_activate functions are done.
- */
-int
-zapm_resume(struct pxa2x0_apm_softc *pxa_sc)
-{
- struct zapm_softc *sc = (struct zapm_softc *)pxa_sc;
- int a, b;
- u_int wsrc;
- int wakeup = 0;
-
- /* C3000 */
- a = pxa2x0_gpio_get_bit(97) ? 1 : 0;
- b = pxa2x0_gpio_get_bit(96) ? 2 : 0;
-
- wsrc = pxa2x0_wakeup_status();
-
- /* Resume only if the lid is not closed. */
- if ((a | b) != 3 && (wsrc & PXA2X0_WAKEUP_POWERON) != 0) {
- int timeout = 100; /* 10 ms */
- /* C3000 */
- while (timeout-- > 0 && pxa2x0_gpio_get_bit(95) != 0) {
- if (timeout == 0) {
- wakeup = 1;
- break;
- }
- delay(100);
- }
- }
-
- /* Initialize the SSP unit before using the MAX1111 again. */
- zssp_init();
-
- zapm_poll(sc);
-
- if (wakeup) {
- /* Resume normal polling. */
- sc->sc_suspended = 0;
-
- pxa2x0_rtc_setalarm(0);
- } else {
-#if 0
- DPRINTF(("zapm_resume: suspended %lu %lu\n",
- sc->sc_lastbattchk.tv_sec, pxa2x0_rtc_getsecs()));
- pxa2x0_rtc_setalarm(pxa2x0_rtc_getsecs() + 5);
-#endif
- }
-
- return (wakeup);
-}
-
-void
-zapm_poweroff(void)
-{
- struct pxa2x0_apm_softc *sc;
- int s;
-
- KASSERT(apm_cd.cd_ndevs > 0 && apm_cd.cd_devs[0] != NULL);
- sc = apm_cd.cd_devs[0];
-
-#if NWSDISPLAY > 0
- wsdisplay_suspend();
-#endif /* NWSDISPLAY > 0 */
-
- s = splhigh();
- cold = 2;
- config_suspend_all(DVACT_SUSPEND);
-
- suspend_randomness();
-
- /* XXX
- * Flag to disk drivers that they should "power down" the disk
- * when we get to DVACT_POWERDOWN.
- */
- boothowto |= RB_POWERDOWN;
- config_suspend_all(DVACT_POWERDOWN);
- boothowto &= ~RB_POWERDOWN;
-
- /* XXX enable charging during suspend */
-
- /* XXX keep power LED state during suspend */
-
- /* XXX do the same thing for GPIO 43 (BTTXD) */
-
- /* XXX scoop power down */
-
- /* XXX set PGSRn and GPDRn */
-
- pxa2x0_wakeup_config(PXA2X0_WAKEUP_ALL, 1);
-
- do {
- pxa2x0_apm_sleep(sc);
- } while (!zapm_resume(sc));
-
- zapm_restart();
-
- /* NOTREACHED */
- cold = 0;
- config_suspend_all(DVACT_RESUME);
- splx(s);
-
- resume_randomness(NULL, 0); /* force RNG upper level reseed */
- bufq_restart();
-
- config_suspend_all(DVACT_WAKEUP);
-
-#if NWSDISPLAY > 0
- wsdisplay_resume();
-#endif /* NWSDISPLAY > 0 */
-}
-
-/*
- * Do a GPIO reset, immediately causing the processor to begin the normal
- * boot sequence. See 2.7 Reset in the PXA27x Developer's Manual for the
- * summary of effects of this kind of reset.
- */
-void
-zapm_restart(void)
-{
- if (apm_cd.cd_ndevs > 0 && apm_cd.cd_devs[0] != NULL) {
- struct pxa2x0_apm_softc *sc = apm_cd.cd_devs[0];
- int rv;
-
- /*
- * Reduce the ROM Delay Next Access and ROM Delay First
- * Access times for synchronous flash connected to nCS1.
- */
- rv = bus_space_read_4(sc->sc_iot, sc->sc_memctl_ioh,
- MEMCTL_MSC0);
- if ((rv & 0xffff0000) == 0x7ff00000)
- bus_space_write_4(sc->sc_iot, sc->sc_memctl_ioh,
- MEMCTL_MSC0, (rv & 0xffff) | 0x7ee00000);
- }
-
- /* External reset circuit presumably asserts nRESET_GPIO. */
- pxa2x0_gpio_set_function(89, GPIO_OUT | GPIO_SET);
- delay(1000000);
-}
diff --git a/sys/arch/zaurus/dev/zaurus_apm.h b/sys/arch/zaurus/dev/zaurus_apm.h
deleted file mode 100644
index 8310239a18c..00000000000
--- a/sys/arch/zaurus/dev/zaurus_apm.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: zaurus_apm.h,v 1.1 2005/04/11 03:21:03 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-void zapm_poweroff(void);
-void zapm_restart(void);
diff --git a/sys/arch/zaurus/dev/zaurus_audio.c b/sys/arch/zaurus/dev/zaurus_audio.c
deleted file mode 100644
index 8d83c91a27d..00000000000
--- a/sys/arch/zaurus/dev/zaurus_audio.c
+++ /dev/null
@@ -1,792 +0,0 @@
-/* $OpenBSD: zaurus_audio.c,v 1.19 2015/05/11 06:46:21 ratchov Exp $ */
-
-/*
- * Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * TODO:
- * - record support
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/timeout.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/fcntl.h>
-#include <sys/audioio.h>
-
-#include <machine/intr.h>
-#include <machine/bus.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_i2c.h>
-#include <arm/xscale/pxa2x0_i2s.h>
-#include <arm/xscale/pxa2x0_dmac.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-#include <zaurus/dev/zaurus_scoopvar.h>
-#include <dev/i2c/wm8750reg.h>
-#include <dev/audio_if.h>
-
-#define WM8750_ADDRESS 0x1B
-#define SPKR_VOLUME 112
-
-#define wm8750_write(sc, reg, val) pxa2x0_i2c_write_2(&sc->sc_i2c, \
- WM8750_ADDRESS, (((reg) << 9) | ((val) & 0x1ff)))
-
-int zaudio_match(struct device *, void *, void *);
-void zaudio_attach(struct device *, struct device *, void *);
-int zaudio_detach(struct device *, int);
-int zaudio_activate(struct device *, int);
-void zaudio_pintr(void *);
-void zaudio_rintr(void *);
-
-#define ZAUDIO_OP_SPKR 0
-#define ZAUDIO_OP_HP 1
-
-#define ZAUDIO_JACK_STATE_OUT 0
-#define ZAUDIO_JACK_STATE_IN 1
-#define ZAUDIO_JACK_STATE_INS 2
-#define ZAUDIO_JACK_STATE_REM 3
-
-/* GPIO pins */
-#define GPIO_HP_IN_C3000 116
-
-struct zaudio_volume {
- u_int8_t left;
- u_int8_t right;
-};
-
-struct zaudio_softc {
- struct device sc_dev;
-
- /* i2s device softc */
- /* NB: pxa2x0_i2s requires this to be the second struct member */
- struct pxa2x0_i2s_softc sc_i2s;
-
- /* i2c device softc */
- struct pxa2x0_i2c_softc sc_i2c;
-
- int sc_playing;
-
- struct zaudio_volume sc_volume[2];
- char sc_unmute[2];
-
- int sc_state;
- int sc_icount;
- struct timeout sc_to;
- void (*sc_pintr)(void *);
- void *sc_parg;
-};
-
-struct cfattach zaudio_ca = {
- sizeof(struct zaudio_softc), zaudio_match, zaudio_attach,
- zaudio_detach, zaudio_activate
-};
-
-struct cfdriver zaudio_cd = {
- NULL, "zaudio", DV_DULL
-};
-
-struct audio_device wm8750_device = {
- "WM8750",
- "1.0",
- "wm"
-};
-
-void zaudio_init(struct zaudio_softc *);
-int zaudio_jack_intr(void *);
-void zaudio_jack(void *);
-void zaudio_standby(struct zaudio_softc *);
-void zaudio_update_volume(struct zaudio_softc *, int);
-void zaudio_update_mutes(struct zaudio_softc *);
-void zaudio_play_setup(struct zaudio_softc *);
-int zaudio_open(void *, int);
-void zaudio_close(void *);
-int zaudio_query_encoding(void *, struct audio_encoding *);
-int zaudio_set_params(void *, int, int, struct audio_params *,
- struct audio_params *);
-int zaudio_halt_output(void *);
-int zaudio_halt_input(void *);
-int zaudio_getdev(void *, struct audio_device *);
-int zaudio_set_port(void *, struct mixer_ctrl *);
-int zaudio_get_port(void *, struct mixer_ctrl *);
-int zaudio_query_devinfo(void *, struct mixer_devinfo *);
-int zaudio_get_props(void *);
-int zaudio_start_output(void *, void *, int, void (*)(void *), void *);
-int zaudio_start_input(void *, void *, int, void (*)(void *), void *);
-
-struct audio_hw_if wm8750_hw_if = {
- zaudio_open,
- zaudio_close,
- NULL /* zaudio_drain */,
- zaudio_query_encoding,
- zaudio_set_params,
- pxa2x0_i2s_round_blocksize,
- NULL /* zaudio_commit_settings */,
- NULL /* zaudio_init_output */,
- NULL /* zaudio_init_input */,
- zaudio_start_output,
- zaudio_start_input,
- zaudio_halt_output,
- zaudio_halt_input,
- NULL /* zaudio_speaker_ctl */,
- zaudio_getdev,
- NULL /* zaudio_setfd */,
- zaudio_set_port,
- zaudio_get_port,
- zaudio_query_devinfo,
- pxa2x0_i2s_allocm,
- pxa2x0_i2s_freem,
- pxa2x0_i2s_round_buffersize,
- pxa2x0_i2s_mappage,
- zaudio_get_props,
- NULL /* zaudio_trigger_output */,
- NULL /* zaudio_trigger_input */,
- NULL
-};
-
-static const unsigned short playback_registers[][2] = {
- /* Unmute DAC */
- { ADCDACCTL_REG, 0x000 },
-
- /* 16 bit audio words */
- { AUDINT_REG, AUDINT_SET_FORMAT(2) },
-
- /* Enable thermal protection, power */
- { ADCTL1_REG, ADCTL1_TSDEN | ADCTL1_SET_VSEL(3) },
-
- /* Enable speaker driver, DAC oversampling */
- { ADCTL2_REG, ADCTL2_ROUT2INV | ADCTL2_DACOSR },
-
- /* Set DAC voltage references */
- { PWRMGMT1_REG, PWRMGMT1_SET_VMIDSEL(1) | PWRMGMT1_VREF },
-
- /* Direct DACs to output mixers */
- { LOUTMIX1_REG, LOUTMIX1_LD2LO },
- { ROUTMIX2_REG, ROUTMIX2_RD2RO },
-
- /* End of list */
- { 0xffff, 0xffff }
-};
-
-int
-zaudio_match(struct device *parent, void *match, void *aux)
-{
- return (1);
-}
-
-void
-zaudio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct zaudio_softc *sc = (struct zaudio_softc *)self;
- struct pxaip_attach_args *pxa = aux;
- int err;
-
- sc->sc_i2s.sc_iot = pxa->pxa_iot;
- sc->sc_i2s.sc_dmat = pxa->pxa_dmat;
- sc->sc_i2s.sc_size = PXA2X0_I2S_SIZE;
- if (pxa2x0_i2s_attach_sub(&sc->sc_i2s)) {
- printf(": unable to attach I2S\n");
- goto fail_i2s;
- }
-
- sc->sc_i2c.sc_iot = pxa->pxa_iot;
- sc->sc_i2c.sc_size = PXA2X0_I2C_SIZE;
- if (pxa2x0_i2c_attach_sub(&sc->sc_i2c)) {
- printf(": unable to attach I2C\n");
- goto fail_i2c;
- }
-
- /* Check for an I2C response from the wm8750 */
- pxa2x0_i2c_open(&sc->sc_i2c);
- err = wm8750_write(sc, RESET_REG, 0);
- pxa2x0_i2c_close(&sc->sc_i2c);
-
- if (err) {
- printf(": codec failed to respond\n");
- goto fail_probe;
- }
- delay(100);
-
- /* Speaker on, headphones off by default. */
- sc->sc_volume[ZAUDIO_OP_SPKR].left = 240;
- sc->sc_unmute[ZAUDIO_OP_SPKR] = 1;
- sc->sc_volume[ZAUDIO_OP_HP].left = 180;
- sc->sc_volume[ZAUDIO_OP_HP].right = 180;
- sc->sc_unmute[ZAUDIO_OP_HP] = 0;
-
- /* Configure headphone jack state change handling. */
- timeout_set(&sc->sc_to, zaudio_jack, sc);
- pxa2x0_gpio_set_function(GPIO_HP_IN_C3000, GPIO_IN);
- (void)pxa2x0_gpio_intr_establish(GPIO_HP_IN_C3000,
- IST_EDGE_BOTH, IPL_BIO, zaudio_jack_intr, sc, "hpjk");
-
- zaudio_init(sc);
-
- printf(": I2C, I2S, WM8750 Audio\n");
-
- audio_attach_mi(&wm8750_hw_if, sc, &sc->sc_dev);
-
- return;
-
-fail_probe:
- pxa2x0_i2c_detach_sub(&sc->sc_i2c);
-fail_i2c:
- pxa2x0_i2s_detach_sub(&sc->sc_i2s);
-fail_i2s:
- ;
-}
-
-int
-zaudio_detach(struct device *self, int flags)
-{
- struct zaudio_softc *sc = (struct zaudio_softc *)self;
-
- pxa2x0_i2c_detach_sub(&sc->sc_i2c);
- pxa2x0_i2s_detach_sub(&sc->sc_i2s);
-
- return (0);
-}
-
-int
-zaudio_activate(struct device *self, int act)
-{
- struct zaudio_softc *sc = (struct zaudio_softc *)self;
-
- switch (act) {
- case DVACT_SUSPEND:
- timeout_del(&sc->sc_to);
- zaudio_standby(sc);
- break;
- case DVACT_RESUME:
- pxa2x0_i2s_init(&sc->sc_i2s);
- pxa2x0_i2c_init(&sc->sc_i2c);
- zaudio_init(sc);
- break;
- }
- return 0;
-}
-
-void
-zaudio_init(struct zaudio_softc *sc)
-{
- pxa2x0_i2c_open(&sc->sc_i2c);
-
- /* Reset the codec */
- wm8750_write(sc, RESET_REG, 0);
- delay(100);
-
- /* Switch to standby power only */
- wm8750_write(sc, PWRMGMT1_REG, PWRMGMT1_SET_VMIDSEL(2));
- wm8750_write(sc, PWRMGMT2_REG, 0);
-
- /* Configure digital interface for I2S */
- wm8750_write(sc, AUDINT_REG, AUDINT_SET_FORMAT(2));
-
- /* Initialise volume levels */
- zaudio_update_volume(sc, ZAUDIO_OP_SPKR);
- zaudio_update_volume(sc, ZAUDIO_OP_HP);
- scoop_set_headphone(0);
-
- pxa2x0_i2c_close(&sc->sc_i2c);
-
- /* Assume that the jack state has changed. */
- zaudio_jack(sc);
-
-}
-
-int
-zaudio_jack_intr(void *v)
-{
- struct zaudio_softc *sc = v;
-
- if (!timeout_triggered(&sc->sc_to))
- zaudio_jack(sc);
-
- return (1);
-}
-
-void
-zaudio_jack(void *v)
-{
- struct zaudio_softc *sc = v;
-
- switch (sc->sc_state) {
- case ZAUDIO_JACK_STATE_OUT:
- if (pxa2x0_gpio_get_bit(GPIO_HP_IN_C3000)) {
- sc->sc_state = ZAUDIO_JACK_STATE_INS;
- sc->sc_icount = 0;
- }
- break;
- case ZAUDIO_JACK_STATE_INS:
- if (sc->sc_icount++ > 2) {
- if (pxa2x0_gpio_get_bit(GPIO_HP_IN_C3000)) {
- sc->sc_state = ZAUDIO_JACK_STATE_IN;
- sc->sc_unmute[ZAUDIO_OP_SPKR] = 0;
- sc->sc_unmute[ZAUDIO_OP_HP] = 1;
- goto update_mutes;
- } else
- sc->sc_state = ZAUDIO_JACK_STATE_OUT;
- }
- break;
- case ZAUDIO_JACK_STATE_IN:
- if (!pxa2x0_gpio_get_bit(GPIO_HP_IN_C3000)) {
- sc->sc_state = ZAUDIO_JACK_STATE_REM;
- sc->sc_icount = 0;
- }
- break;
- case ZAUDIO_JACK_STATE_REM:
- if (sc->sc_icount++ > 2) {
- if (!pxa2x0_gpio_get_bit(GPIO_HP_IN_C3000)) {
- sc->sc_state = ZAUDIO_JACK_STATE_OUT;
- sc->sc_unmute[ZAUDIO_OP_SPKR] = 1;
- sc->sc_unmute[ZAUDIO_OP_HP] = 0;
- goto update_mutes;
- } else
- sc->sc_state = ZAUDIO_JACK_STATE_IN;
- }
- break;
- }
-
- timeout_add(&sc->sc_to, hz/4);
- return;
-
-update_mutes:
- timeout_del(&sc->sc_to);
-
- if (sc->sc_playing) {
- pxa2x0_i2c_open(&sc->sc_i2c);
- zaudio_update_mutes(sc);
- pxa2x0_i2c_close(&sc->sc_i2c);
- }
-}
-
-void
-zaudio_standby(struct zaudio_softc *sc)
-{
- pxa2x0_i2c_open(&sc->sc_i2c);
-
- /* Switch codec to standby power only */
- wm8750_write(sc, PWRMGMT1_REG, PWRMGMT1_SET_VMIDSEL(2));
- wm8750_write(sc, PWRMGMT2_REG, 0);
-
- scoop_set_headphone(0);
-
- pxa2x0_i2c_close(&sc->sc_i2c);
-}
-
-void
-zaudio_update_volume(struct zaudio_softc *sc, int output)
-{
- switch(output) {
- case ZAUDIO_OP_SPKR:
- wm8750_write(sc, LOUT2VOL_REG, LOUT2VOL_LO2VU | LOUT2VOL_LO2ZC |
- LOUT2VOL_SET_LOUT2VOL(sc->sc_volume[ZAUDIO_OP_SPKR
- ].left >> 1));
- wm8750_write(sc, ROUT2VOL_REG, ROUT2VOL_RO2VU | ROUT2VOL_RO2ZC |
- ROUT2VOL_SET_ROUT2VOL(sc->sc_volume[ZAUDIO_OP_SPKR
- ].left >> 1));
- break;
- case ZAUDIO_OP_HP:
- wm8750_write(sc, LOUT1VOL_REG, LOUT1VOL_LO1VU | LOUT1VOL_LO1ZC |
- LOUT1VOL_SET_LOUT1VOL(sc->sc_volume[ZAUDIO_OP_HP
- ].left >> 1));
- wm8750_write(sc, ROUT1VOL_REG, ROUT1VOL_RO1VU | ROUT1VOL_RO1ZC |
- ROUT1VOL_SET_ROUT1VOL(sc->sc_volume[ZAUDIO_OP_HP
- ].right >> 1));
- break;
- }
-}
-
-void
-zaudio_update_mutes(struct zaudio_softc *sc)
-{
- unsigned short val;
-
- val = PWRMGMT2_DACL | PWRMGMT2_DACR;
-
- if (sc->sc_unmute[ZAUDIO_OP_SPKR])
- val |= PWRMGMT2_LOUT2 | PWRMGMT2_ROUT2;
-
- if (sc->sc_unmute[ZAUDIO_OP_HP])
- val |= PWRMGMT2_LOUT1 | PWRMGMT2_ROUT1;
-
- wm8750_write(sc, PWRMGMT2_REG, val);
-
- scoop_set_headphone(sc->sc_unmute[ZAUDIO_OP_HP]);
-}
-
-void
-zaudio_play_setup(struct zaudio_softc *sc)
-{
- int i = 0;
-
- pxa2x0_i2c_open(&sc->sc_i2c);
-
- /* Program the codec with playback settings */
- while (playback_registers[i][0] != 0xffff) {
- wm8750_write(sc, playback_registers[i][0],
- playback_registers[i][1]);
- i++;
- }
- zaudio_update_mutes(sc);
-
- pxa2x0_i2c_close(&sc->sc_i2c);
-}
-
-int
-zaudio_open(void *hdl, int flags)
-{
- struct zaudio_softc *sc = hdl;
-
- /* can't record yet */
- if (flags & FREAD)
- return (ENXIO);
-
- /* Power on the I2S bus and codec */
- pxa2x0_i2s_open(&sc->sc_i2s);
-
- return 0;
-}
-
-void
-zaudio_close(void *hdl)
-{
- struct zaudio_softc *sc = hdl;
-
- /* Power off the I2S bus and codec */
- pxa2x0_i2s_close(&sc->sc_i2s);
-}
-
-int
-zaudio_query_encoding(void *hdl, struct audio_encoding *aep)
-{
- switch (aep->index) {
- case 0:
- strlcpy(aep->name, AudioEslinear_le, sizeof(aep->name));
- aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
- aep->precision = 16;
- aep->flags = 0;
- break;
- default:
- return (EINVAL);
- }
- aep->bps = AUDIO_BPS(aep->precision);
- aep->msb = 1;
- return (0);
-}
-
-int
-zaudio_set_params(void *hdl, int setmode, int usemode,
- struct audio_params *play, struct audio_params *rec)
-{
- struct zaudio_softc *sc = hdl;
-
- if (setmode & AUMODE_PLAY) {
- play->precision = 16;
- play->channels = 2;
- play->encoding = AUDIO_ENCODING_SLINEAR_LE;
- play->bps = AUDIO_BPS(play->precision);
- play->msb = 1;
-
- pxa2x0_i2s_setspeed(&sc->sc_i2s, &play->sample_rate);
- }
-
-#if RECORD_XXX_NOT_YET
- if (setmode & AUMODE_RECORD) {
- rec->precision = 16;
- rec->channels = 2;
- rec->encoding = AUDIO_ENCODING_SLINEAR_LE;
- rec->bps = AUDIO_BPS(rec->precision);
- rec->msb = 1;
-
- pxa2x0_i2s_setspeed(sc, &rec->sample_rate);
- }
-#endif
-
- return (0);
-}
-
-int
-zaudio_halt_output(void *hdl)
-{
- struct zaudio_softc *sc = hdl;
-
- /* XXX forcibly stop output DMA? */
-
- mtx_enter(&audio_lock);
- zaudio_standby(sc);
- sc->sc_playing = 0;
- mtx_leave(&audio_lock);
-
- return 0;
-}
-
-int
-zaudio_halt_input(void *hdl)
-{
- /* struct zaudio_softc *sc = hdl; */
-
- return 0;
-}
-
-int
-zaudio_getdev(void *hdl, struct audio_device *ret)
-{
- /* struct zaudio_softc *sc = hdl; */
-
- *ret = wm8750_device;
- return 0;
-}
-
-#define ZAUDIO_SPKR_LVL 0
-#define ZAUDIO_SPKR_MUTE 1
-#define ZAUDIO_HP_LVL 2
-#define ZAUDIO_HP_MUTE 3
-#define ZAUDIO_OUTPUT_CLASS 4
-
-int
-zaudio_set_port(void *hdl, struct mixer_ctrl *mc)
-{
- struct zaudio_softc *sc = hdl;
- int error = EINVAL, s;
-
- s = splbio();
- pxa2x0_i2c_open(&sc->sc_i2c);
-
- switch (mc->dev) {
- case ZAUDIO_SPKR_LVL:
- if (mc->type != AUDIO_MIXER_VALUE)
- break;
- if (mc->un.value.num_channels == 1)
- sc->sc_volume[ZAUDIO_OP_SPKR].left =
- mc->un.value.level[AUDIO_MIXER_LEVEL_MONO];
- else
- break;
- zaudio_update_volume(sc, ZAUDIO_OP_SPKR);
- error = 0;
- break;
- case ZAUDIO_SPKR_MUTE:
- if (mc->type != AUDIO_MIXER_ENUM)
- break;
- sc->sc_unmute[ZAUDIO_OP_SPKR] = mc->un.ord ? 1 : 0;
- zaudio_update_mutes(sc);
- error = 0;
- break;
- case ZAUDIO_HP_LVL:
- if (mc->type != AUDIO_MIXER_VALUE)
- break;
- if (mc->un.value.num_channels == 1) {
- sc->sc_volume[ZAUDIO_OP_HP].left =
- mc->un.value.level[AUDIO_MIXER_LEVEL_MONO];
- sc->sc_volume[ZAUDIO_OP_HP].right =
- mc->un.value.level[AUDIO_MIXER_LEVEL_MONO];
- } else if (mc->un.value.num_channels == 2) {
- sc->sc_volume[ZAUDIO_OP_HP].left =
- mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT];
- sc->sc_volume[ZAUDIO_OP_HP].right =
- mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT];
- }
- else
- break;
- zaudio_update_volume(sc, ZAUDIO_OP_HP);
- error = 0;
- break;
- case ZAUDIO_HP_MUTE:
- if (mc->type != AUDIO_MIXER_ENUM)
- break;
- sc->sc_unmute[ZAUDIO_OP_HP] = mc->un.ord ? 1 : 0;
- zaudio_update_mutes(sc);
- error = 0;
- break;
- }
-
- pxa2x0_i2c_close(&sc->sc_i2c);
- splx(s);
-
- return error;
-}
-
-int
-zaudio_get_port(void *hdl, struct mixer_ctrl *mc)
-{
- struct zaudio_softc *sc = hdl;
- int error = EINVAL;
-
- switch (mc->dev) {
- case ZAUDIO_SPKR_LVL:
- if (mc->type != AUDIO_MIXER_VALUE)
- break;
- if (mc->un.value.num_channels == 1)
- mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] =
- sc->sc_volume[ZAUDIO_OP_SPKR].left;
- else
- break;
- error = 0;
- break;
- case ZAUDIO_SPKR_MUTE:
- if (mc->type != AUDIO_MIXER_ENUM)
- break;
- mc->un.ord = sc->sc_unmute[ZAUDIO_OP_SPKR] ? 1 : 0;
- error = 0;
- break;
- case ZAUDIO_HP_LVL:
- if (mc->type != AUDIO_MIXER_VALUE)
- break;
- if (mc->un.value.num_channels == 1)
- mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] =
- sc->sc_volume[ZAUDIO_OP_HP].left;
- else if (mc->un.value.num_channels == 2) {
- mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] =
- sc->sc_volume[ZAUDIO_OP_HP].left;
- mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] =
- sc->sc_volume[ZAUDIO_OP_HP].right;
- }
- else
- break;
- error = 0;
- break;
- case ZAUDIO_HP_MUTE:
- if (mc->type != AUDIO_MIXER_ENUM)
- break;
- mc->un.ord = sc->sc_unmute[ZAUDIO_OP_HP] ? 1 : 0;
- error = 0;
- break;
- }
-
- return error;
-}
-
-int
-zaudio_query_devinfo(void *hdl, struct mixer_devinfo *di)
-{
- /* struct zaudio_softc *sc = hdl; */
-
- switch (di->index) {
- case ZAUDIO_SPKR_LVL:
- di->type = AUDIO_MIXER_VALUE;
- di->mixer_class = ZAUDIO_OUTPUT_CLASS;
- di->prev = AUDIO_MIXER_LAST;
- di->next = ZAUDIO_SPKR_MUTE;
- strlcpy(di->label.name, AudioNspeaker,
- sizeof(di->label.name));
- strlcpy(di->un.v.units.name, AudioNvolume,
- sizeof(di->un.v.units.name));
- di->un.v.num_channels = 1;
- break;
- case ZAUDIO_SPKR_MUTE:
- di->type = AUDIO_MIXER_ENUM;
- di->mixer_class = ZAUDIO_OUTPUT_CLASS;
- di->prev = ZAUDIO_SPKR_LVL;
- di->next = AUDIO_MIXER_LAST;
- goto mute;
- case ZAUDIO_HP_LVL:
- di->type = AUDIO_MIXER_VALUE;
- di->mixer_class = ZAUDIO_OUTPUT_CLASS;
- di->prev = AUDIO_MIXER_LAST;
- di->next = ZAUDIO_HP_MUTE;
- strlcpy(di->label.name, AudioNheadphone,
- sizeof(di->label.name));
- di->un.v.num_channels = 1;
- strlcpy(di->un.v.units.name, AudioNvolume,
- sizeof(di->un.v.units.name));
- break;
- case ZAUDIO_HP_MUTE:
- di->type = AUDIO_MIXER_ENUM;
- di->mixer_class = ZAUDIO_OUTPUT_CLASS;
- di->prev = ZAUDIO_HP_LVL;
- di->next = AUDIO_MIXER_LAST;
-mute:
- strlcpy(di->label.name, AudioNmute, sizeof(di->label.name));
- di->un.e.num_mem = 2;
- strlcpy(di->un.e.member[0].label.name, AudioNon,
- sizeof(di->un.e.member[0].label.name));
- di->un.e.member[0].ord = 0;
- strlcpy(di->un.e.member[1].label.name, AudioNoff,
- sizeof(di->un.e.member[1].label.name));
- di->un.e.member[1].ord = 1;
- break;
- case ZAUDIO_OUTPUT_CLASS:
- di->type = AUDIO_MIXER_CLASS;
- di->mixer_class = ZAUDIO_OUTPUT_CLASS;
- di->prev = AUDIO_MIXER_LAST;
- di->next = AUDIO_MIXER_LAST;
- strlcpy(di->label.name, AudioCoutputs,
- sizeof(di->label.name));
- break;
- default:
- return ENXIO;
- }
-
- return 0;
-}
-
-int
-zaudio_get_props(void *hdl)
-{
- return AUDIO_PROP_MMAP | AUDIO_PROP_INDEPENDENT | AUDIO_PROP_FULLDUPLEX;
-}
-
-void
-zaudio_pintr(void *hdl)
-{
- struct zaudio_softc *sc = hdl;
-
- mtx_enter(&audio_lock);
- sc->sc_pintr(sc->sc_parg);
- mtx_leave(&audio_lock);
-}
-
-/*
- * called by interrupt code-path, don't lock
- */
-int
-zaudio_start_output(void *hdl, void *block, int bsize, void (*intr)(void *),
- void *intrarg)
-{
- struct zaudio_softc *sc = hdl;
- int err;
-
- /* Power up codec if we are not already playing. */
- if (!sc->sc_playing) {
- sc->sc_playing = 1;
- zaudio_play_setup(sc);
- }
-
- /* Start DMA via I2S */
- sc->sc_pintr = intr;
- sc->sc_parg = intrarg;
- err = pxa2x0_i2s_start_output(&sc->sc_i2s, block, bsize, zaudio_pintr, sc);
- if (err) {
- zaudio_standby(sc);
- sc->sc_playing = 0;
- }
- return err;
-}
-
-/*
- * called by interrupt code-path, don't lock
- */
-int
-zaudio_start_input(void *hdl, void *block, int bsize, void (*intr)(void *),
- void *intrarg)
-{
- return ENXIO;
-}
diff --git a/sys/arch/zaurus/dev/zaurus_flash.c b/sys/arch/zaurus/dev/zaurus_flash.c
deleted file mode 100644
index 32a12999e90..00000000000
--- a/sys/arch/zaurus/dev/zaurus_flash.c
+++ /dev/null
@@ -1,908 +0,0 @@
-/* $OpenBSD: zaurus_flash.c,v 1.14 2015/09/27 10:12:09 semarie Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Samsung NAND flash controlled by some unspecified CPLD device.
- */
-
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/disk.h>
-#include <sys/disklabel.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/systm.h>
-
-#include <dev/flashvar.h>
-#include <dev/rndvar.h>
-
-#include <machine/zaurus_var.h>
-
-#include <arch/arm/xscale/pxa2x0var.h>
-
-#define DEBUG
-#ifdef DEBUG
-#define DPRINTF(x) printf x
-#else
-#define DPRINTF(x)
-#endif
-
-/* CPLD register definitions */
-#define CPLD_REG_ECCLPLB 0x00
-#define CPLD_REG_ECCLPUB 0x04
-#define CPLD_REG_ECCCP 0x08
-#define CPLD_REG_ECCCNTR 0x0c
-#define CPLD_REG_ECCCLRR 0x10
-#define CPLD_REG_FLASHIO 0x14
-#define CPLD_REG_FLASHCTL 0x18
-#define FLASHCTL_NCE0 (1<<0)
-#define FLASHCTL_CLE (1<<1)
-#define FLASHCTL_ALE (1<<2)
-#define FLASHCTL_NWP (1<<3)
-#define FLASHCTL_NCE1 (1<<4)
-#define FLASHCTL_RYBY (1<<5)
-#define FLASHCTL_NCE (FLASHCTL_NCE0|FLASHCTL_NCE1)
-
-/* CPLD register accesses */
-#define CPLD_READ(sc, r) \
- bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, (r))
-#define CPLD_WRITE(sc, r, v) \
- bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, (r), (v))
-#define CPLD_SET(sc, r, v) \
- CPLD_WRITE((sc), (r), CPLD_READ((sc), (r)) | (v))
-#define CPLD_CLR(sc, r, v) \
- CPLD_WRITE((sc), (r), CPLD_READ((sc), (r)) & ~(v))
-#define CPLD_SETORCLR(sc, r, m, v) \
- ((v) ? CPLD_SET((sc), (r), (m)) : CPLD_CLR((sc), (r), (m)))
-
-/* Offsets into OOB data. */
-#define OOB_JFFS2_ECC0 0
-#define OOB_JFFS2_ECC1 1
-#define OOB_JFFS2_ECC2 2
-#define OOB_JFFS2_ECC3 3
-#define OOB_JFFS2_ECC4 6
-#define OOB_JFFS2_ECC5 7
-#define OOB_LOGADDR_0_LO 8
-#define OOB_LOGADDR_0_HI 9
-#define OOB_LOGADDR_1_LO 10
-#define OOB_LOGADDR_1_HI 11
-#define OOB_LOGADDR_2_LO 12
-#define OOB_LOGADDR_2_HI 13
-
-/*
- * Structure for managing logical blocks in a partition; allocated on
- * first use of each partition on a "safe" flash device.
- */
-struct zflash_safe {
- dev_t sp_dev;
- u_long sp_pblks; /* physical block count */
- u_long sp_lblks; /* logical block count */
- u_int16_t *sp_phyuse; /* physical block usage */
- u_int *sp_logmap; /* logical to physical */
- u_int sp_pnext; /* next physical block */
-};
-
-struct zflash_softc {
- struct flash_softc sc_flash;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- int sc_ioobbadblk;
- int sc_ioobpostbadblk;
- struct zflash_safe *sc_safe[MAXPARTITIONS];
-};
-
-int zflashmatch(struct device *, void *, void *);
-void zflashattach(struct device *, struct device *, void *);
-int zflashdetach(struct device *, int);
-
-u_int8_t zflash_reg8_read(void *, int);
-int zflash_regx_read_page(void *, caddr_t, caddr_t);
-void zflash_reg8_write(void *, int, u_int8_t);
-int zflash_regx_write_page(void *, caddr_t, caddr_t);
-void zflash_default_disklabel(void *, dev_t, struct disklabel *);
-int zflash_safe_strategy(void *, struct buf *);
-
-int zflash_safe_start(struct zflash_softc *, dev_t);
-void zflash_safe_stop(struct zflash_softc *, dev_t);
-
-struct cfattach flash_pxaip_ca = {
- sizeof(struct zflash_softc), zflashmatch, zflashattach,
- zflashdetach
-};
-
-struct flash_ctl_tag zflash_ctl_tag = {
- zflash_reg8_read,
- zflash_regx_read_page,
- zflash_reg8_write,
- zflash_regx_write_page,
- zflash_default_disklabel,
- zflash_safe_strategy
-};
-
-int
-zflashmatch(struct device *parent, void *match, void *aux)
-{
- /* XXX call flashprobe(), yet to be implemented */
- return ZAURUS_ISC3000;
-}
-
-void
-zflashattach(struct device *parent, struct device *self, void *aux)
-{
- struct zflash_softc *sc = (struct zflash_softc *)self;
- struct pxaip_attach_args *pxa = aux;
- bus_addr_t addr = pxa->pxa_addr;
- bus_size_t size = pxa->pxa_size;
-
- sc->sc_iot = pxa->pxa_iot;
-
- if ((int)addr == -1 || (int)size == 0) {
- addr = 0x0c000000;
- size = 0x00001000;
- }
-
- if (bus_space_map(sc->sc_iot, addr, size, 0, &sc->sc_ioh) != 0) {
- printf(": failed to map controller\n");
- return;
- }
-
- /* Disable and write-protect the chip. */
- CPLD_WRITE(sc, CPLD_REG_FLASHCTL, FLASHCTL_NCE);
-
- flashattach(&sc->sc_flash, &zflash_ctl_tag, sc);
-
- switch (sc->sc_flash.sc_flashdev->id) {
- case FLASH_DEVICE_SAMSUNG_K9F2808U0C: /* C3000 */
- sc->sc_ioobpostbadblk = 4;
- sc->sc_ioobbadblk = 5;
- break;
- case FLASH_DEVICE_SAMSUNG_K9F1G08U0A: /* C3100 */
- sc->sc_ioobpostbadblk = 4;
- sc->sc_ioobbadblk = 0;
- break;
- }
-}
-
-int
-zflashdetach(struct device *self, int flags)
-{
- struct zflash_softc *sc = (struct zflash_softc *)self;
- int part;
-
- for (part = 0; part < MAXPARTITIONS; part++)
- zflash_safe_stop(sc, part);
-
- return (flashdetach(self, flags));
-}
-
-u_int8_t
-zflash_reg8_read(void *arg, int reg)
-{
- struct zflash_softc *sc = arg;
- u_int8_t value;
-
- switch (reg) {
- case FLASH_REG_DATA:
- value = CPLD_READ(sc, CPLD_REG_FLASHIO);
- break;
- case FLASH_REG_READY:
- value = (CPLD_READ(sc, CPLD_REG_FLASHCTL) &
- FLASHCTL_RYBY) != 0;
- break;
- default:
-#ifdef DIAGNOSTIC
- printf("%s: read from pseudo-register %02x\n",
- sc->sc_flash.sc_dev.dv_xname, reg);
-#endif
- value = 0;
- break;
- }
- return value;
-}
-
-void
-zflash_reg8_write(void *arg, int reg, u_int8_t value)
-{
- struct zflash_softc *sc = arg;
-
- switch (reg) {
- case FLASH_REG_DATA:
- case FLASH_REG_COL:
- case FLASH_REG_ROW:
- case FLASH_REG_CMD:
- CPLD_WRITE(sc, CPLD_REG_FLASHIO, value);
- break;
- case FLASH_REG_ALE:
- CPLD_SETORCLR(sc, CPLD_REG_FLASHCTL, FLASHCTL_ALE, value);
- break;
- case FLASH_REG_CLE:
- CPLD_SETORCLR(sc, CPLD_REG_FLASHCTL, FLASHCTL_CLE, value);
- break;
- case FLASH_REG_CE:
- CPLD_SETORCLR(sc, CPLD_REG_FLASHCTL, FLASHCTL_NCE, !value);
- break;
- case FLASH_REG_WP:
- CPLD_SETORCLR(sc, CPLD_REG_FLASHCTL, FLASHCTL_NWP, !value);
- break;
-#ifdef DIAGNOSTIC
- default:
- printf("%s: write to pseudo-register %02x\n",
- sc->sc_flash.sc_dev.dv_xname, reg);
-#endif
- }
-}
-
-int
-zflash_regx_read_page(void *arg, caddr_t data, caddr_t oob)
-{
- struct zflash_softc *sc = arg;
-
- if (oob == NULL || sc->sc_flash.sc_flashdev->pagesize != 512) {
- flash_reg8_read_page(&sc->sc_flash, data, oob);
- return 0;
- }
-
- flash_reg8_read_page(&sc->sc_flash, data, oob);
-
- oob[OOB_JFFS2_ECC0] = 0xff;
- oob[OOB_JFFS2_ECC1] = 0xff;
- oob[OOB_JFFS2_ECC2] = 0xff;
- oob[OOB_JFFS2_ECC3] = 0xff;
- oob[OOB_JFFS2_ECC4] = 0xff;
- oob[OOB_JFFS2_ECC5] = 0xff;
- return 0;
-}
-
-int
-zflash_regx_write_page(void *arg, caddr_t data, caddr_t oob)
-{
- struct zflash_softc *sc = arg;
- int i;
-
- if (oob == NULL || sc->sc_flash.sc_flashdev->pagesize != 512) {
- flash_reg8_write_page(&sc->sc_flash, data, oob);
- return 0;
- }
-
- if (oob[OOB_JFFS2_ECC0] != 0xff || oob[OOB_JFFS2_ECC1] != 0xff ||
- oob[OOB_JFFS2_ECC2] != 0xff || oob[OOB_JFFS2_ECC3] != 0xff ||
- oob[OOB_JFFS2_ECC4] != 0xff || oob[OOB_JFFS2_ECC5] != 0xff) {
-#ifdef DIAGNOSTIC
- printf("%s: non-FF ECC bytes in OOB data\n",
- sc->sc_flash.sc_dev.dv_xname);
-#endif
- return EINVAL;
- }
-
- CPLD_WRITE(sc, CPLD_REG_ECCCLRR, 0x00);
- for (i = 0; i < sc->sc_flash.sc_flashdev->pagesize / 2; i++)
- flash_reg8_write(&sc->sc_flash, FLASH_REG_DATA, data[i]);
-
- oob[OOB_JFFS2_ECC0] = ~CPLD_READ(sc, CPLD_REG_ECCLPUB);
- oob[OOB_JFFS2_ECC1] = ~CPLD_READ(sc, CPLD_REG_ECCLPLB);
- oob[OOB_JFFS2_ECC2] = (~CPLD_READ(sc, CPLD_REG_ECCCP) << 2) | 0x03;
-
- if (CPLD_READ(sc, CPLD_REG_ECCCNTR) != 0) {
- printf("%s: ECC failed\n", sc->sc_flash.sc_dev.dv_xname);
- oob[OOB_JFFS2_ECC0] = 0xff;
- oob[OOB_JFFS2_ECC1] = 0xff;
- oob[OOB_JFFS2_ECC2] = 0xff;
- return EIO;
- }
-
- CPLD_WRITE(sc, CPLD_REG_ECCCLRR, 0x00);
- for (; i < sc->sc_flash.sc_flashdev->pagesize; i++)
- flash_reg8_write(&sc->sc_flash, FLASH_REG_DATA, data[i]);
-
- oob[OOB_JFFS2_ECC3] = ~CPLD_READ(sc, CPLD_REG_ECCLPUB);
- oob[OOB_JFFS2_ECC4] = ~CPLD_READ(sc, CPLD_REG_ECCLPLB);
- oob[OOB_JFFS2_ECC5] = (~CPLD_READ(sc, CPLD_REG_ECCCP) << 2) | 0x03;
-
- if (CPLD_READ(sc, CPLD_REG_ECCCNTR) != 0) {
- printf("%s: ECC failed\n", sc->sc_flash.sc_dev.dv_xname);
- oob[OOB_JFFS2_ECC0] = 0xff;
- oob[OOB_JFFS2_ECC1] = 0xff;
- oob[OOB_JFFS2_ECC2] = 0xff;
- oob[OOB_JFFS2_ECC3] = 0xff;
- oob[OOB_JFFS2_ECC4] = 0xff;
- oob[OOB_JFFS2_ECC5] = 0xff;
- return EIO;
- }
-
- for (i = 0; i < sc->sc_flash.sc_flashdev->oobsize; i++)
- flash_reg8_write(&sc->sc_flash, FLASH_REG_DATA, oob[i]);
-
- oob[OOB_JFFS2_ECC0] = 0xff;
- oob[OOB_JFFS2_ECC1] = 0xff;
- oob[OOB_JFFS2_ECC2] = 0xff;
- oob[OOB_JFFS2_ECC3] = 0xff;
- oob[OOB_JFFS2_ECC4] = 0xff;
- oob[OOB_JFFS2_ECC5] = 0xff;
- return 0;
-}
-
-/*
- * A default disklabel with only one RAW_PART spanning the whole
- * device is passed to us. We add the partitions besides RAW_PART.
- */
-void
-zflash_default_disklabel(void *arg, dev_t dev, struct disklabel *lp)
-{
- struct zflash_softc *sc = arg;
- long bsize = sc->sc_flash.sc_flashdev->pagesize;
-
- switch (sc->sc_flash.sc_flashdev->id) {
- case FLASH_DEVICE_SAMSUNG_K9F2808U0C:
- DL_SETPSIZE(&lp->d_partitions[8], 7*1024*1024 / bsize);
- DL_SETPSIZE(&lp->d_partitions[9], 5*1024*1024 / bsize);
- DL_SETPSIZE(&lp->d_partitions[10], 4*1024*1024 / bsize);
- break;
- case FLASH_DEVICE_SAMSUNG_K9F1G08U0A:
- DL_SETPSIZE(&lp->d_partitions[8], 7*1024*1024 / bsize);
- DL_SETPSIZE(&lp->d_partitions[9], 32*1024*1024 / bsize);
- DL_SETPSIZE(&lp->d_partitions[10], 89*1024*1024 / bsize);
- break;
- default:
- return;
- }
-
- /* The "smf" partition uses logical addressing. */
- DL_SETPOFFSET(&lp->d_partitions[8], 0);
- lp->d_partitions[8].p_fstype = FS_OTHER;
-
- /* The "root" partition uses physical addressing. */
- DL_SETPSIZE(&lp->d_partitions[9], DL_GETPSIZE(&lp->d_partitions[8]));
- lp->d_partitions[9].p_fstype = FS_OTHER;
-
- /* The "home" partition uses physical addressing. */
- DL_SETPOFFSET(&lp->d_partitions[10],
- DL_GETPOFFSET(&lp->d_partitions[9]) + DL_GETPSIZE(&lp->d_partitions[9]));
- lp->d_partitions[10].p_fstype = FS_OTHER;
- lp->d_npartitions = MAXPARTITIONS;
-
- lp->d_version = 1;
- /* Re-calculate the checksum. */
- lp->d_checksum = dkcksum(lp);
-}
-
-/*
- * Sharp's access strategy for bad blocks management and wear-leveling.
- */
-
-#define PHYUSE_STATUS(v) ((v) & 0x00ff)
-#define P_BADBLOCK 0x0000
-#define P_POSTBADBLOCK 0x00f0
-#define P_NORMALBLOCK 0x00ff
-#define PHYUSE_WRITTEN(v) ((v) & 0xff00)
-#define P_DUST 0x0000
-#define P_LOGICAL 0x0100
-#define P_JFFS2 0x0300
-
-void zflash_write_strategy(struct zflash_softc *, struct buf *,
- struct zflash_safe *, u_int, u_int);
-u_int zflash_safe_next_block(struct zflash_safe *);
-
-u_char zflash_oob_status_decode(u_char);
-u_int16_t zflash_oob_status(struct zflash_softc *, u_char *);
-u_int zflash_oob_logno(struct zflash_softc *, u_char *);
-void zflash_oob_set_status(struct zflash_softc *, u_char *, u_int16_t);
-void zflash_oob_set_logno(struct zflash_softc *, u_char *, u_int);
-
-int
-zflash_safe_strategy(void *arg, struct buf *bp)
-{
- struct zflash_softc *sc = arg;
- struct zflash_safe *sp;
- u_int logno;
- u_int blkofs;
- u_int blkno;
- int error;
- int part;
- int i;
-
- /* Initialize logical blocks management on the fly. */
- /* XXX toss everything when the disklabel has changed. */
- if ((error = zflash_safe_start(sc, bp->b_dev)) != 0) {
- bp->b_error = error;
- bp->b_flags |= B_ERROR;
- return 0;
- }
-
- part = flashpart(bp->b_dev);
- sp = sc->sc_safe[part];
-
- logno = bp->b_blkno / (sc->sc_flash.sc_flashdev->blkpages *
- sc->sc_flash.sc_flashdev->pagesize / DEV_BSIZE);
- blkofs = bp->b_blkno % (sc->sc_flash.sc_flashdev->blkpages *
- sc->sc_flash.sc_flashdev->pagesize / DEV_BSIZE);
-
- /* If exactly at end of logical flash, return EOF, else error. */
- if (logno == sp->sp_lblks && blkofs == 0) {
- bp->b_resid = bp->b_bcount;
- return 0;
- } else if (logno >= sp->sp_lblks) {
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- return 0;
- }
-
- /* Writing is more complicated, so handle it separately. */
- if ((bp->b_flags & B_READ) == 0) {
- flash_chip_enable(&sc->sc_flash);
- zflash_write_strategy(sc, bp, sp, logno, blkofs);
- flash_chip_disable(&sc->sc_flash);
- return 0;
- }
-
- /* Get the physical flash block number for this logical one. */
- blkno = sp->sp_logmap[logno];
-
- /* Unused logical blocks read as all 0xff. */
- if ((bp->b_flags & B_READ) != 0 && blkno == UINT_MAX) {
- for (i = 0; i < sc->sc_flash.sc_flashdev->pagesize; i++)
- ((u_char *)bp->b_data)[i] = 0xff;
- bp->b_resid = bp->b_bcount -
- sc->sc_flash.sc_flashdev->pagesize;
- return 0;
- }
-
- /* Update the block number in the buffer with the physical one. */
- bp->b_blkno = blkno * (sc->sc_flash.sc_flashdev->blkpages *
- sc->sc_flash.sc_flashdev->pagesize / DEV_BSIZE) + blkofs;
-
- /* Process the modified transfer buffer normally. */
- return 1;
-}
-
-void
-zflash_write_strategy(struct zflash_softc *sc, struct buf *bp,
- struct zflash_safe *sp, u_int logno, u_int logofs)
-{
- size_t bufsize;
- u_char *buf = NULL;
- size_t oobsize;
- u_char *oob = NULL;
- u_int oblkno;
- u_int nblkno;
- int error;
-
- /* Not efficient, but we always transfer one page for now. */
- if (bp->b_bcount < sc->sc_flash.sc_flashdev->pagesize) {
- bp->b_error = EINVAL;
- goto bad;
- }
-
- /* Allocate a temporary buffer for one flash block. */
- bufsize = sc->sc_flash.sc_flashdev->blkpages *
- sc->sc_flash.sc_flashdev->pagesize;
- buf = (u_char *)malloc(bufsize, M_DEVBUF, M_NOWAIT);
- if (buf == NULL) {
- bp->b_error = ENOMEM;
- goto bad;
- }
-
- /* Allocate a temporary buffer for one spare area. */
- oobsize = sc->sc_flash.sc_flashdev->oobsize;
- oob = (u_char *)malloc(oobsize, M_DEVBUF, M_NOWAIT);
- if (oob == NULL) {
- bp->b_error = ENOMEM;
- goto bad;
- }
-
- /* Read the old logical block into the temporary buffer. */
- oblkno = sp->sp_logmap[logno];
- if (oblkno != UINT_MAX) {
- error = flash_chip_read_block(&sc->sc_flash, oblkno, buf);
- if (error != 0) {
- bp->b_error = error;
- goto bad;
- }
- } else
- /* Unused logical blocks read as all 0xff. */
- memset(buf, 0xff, bufsize);
-
- /* Transfer the page into the logical block buffer. */
- bcopy(bp->b_data, buf + logofs * sc->sc_flash.sc_flashdev->pagesize,
- sc->sc_flash.sc_flashdev->pagesize);
-
- /* Generate OOB data for the spare area of this logical block. */
- memset(oob, 0xff, oobsize);
- zflash_oob_set_status(sc, oob, P_NORMALBLOCK);
- zflash_oob_set_logno(sc, oob, logno);
-
- while (1) {
- /* Search for a free physical block. */
- nblkno = zflash_safe_next_block(sp);
- if (nblkno == UINT_MAX) {
- printf("%s: no spare block, giving up on logical"
- " block %u\n", sc->sc_flash.sc_dev.dv_xname,
- logno);
- bp->b_error = ENOSPC;
- goto bad;
- }
-
-#if 0
- DPRINTF(("%s: moving logical block %u from physical %u to %u\n",
- sc->sc_flash.sc_dev.dv_xname, logno, oblkno, nblkno));
-#endif
-
- /* Erase the free physical block. */
- if (flash_chip_erase_block(&sc->sc_flash, nblkno) != 0) {
- printf("%s: can't erase block %u, retrying\n",
- sc->sc_flash.sc_dev.dv_xname, nblkno);
- sp->sp_phyuse[nblkno] = P_POSTBADBLOCK | P_DUST;
- continue;
- }
-
- /* Write the logical block to the free physical block. */
- if (flash_chip_write_block(&sc->sc_flash, nblkno, buf, oob)) {
- printf("%s: can't write block %u, retrying\n",
- sc->sc_flash.sc_dev.dv_xname, nblkno);
- goto trynext;
- }
-
- /* Yeah, we re-wrote that logical block! */
- break;
- trynext:
- sp->sp_phyuse[nblkno] = P_POSTBADBLOCK | P_DUST;
- (void)flash_chip_erase_block(&sc->sc_flash, nblkno);
- }
-
- /* Map the new physical block. */
- sp->sp_logmap[logno] = nblkno;
- sp->sp_phyuse[nblkno] = PHYUSE_STATUS(sp->sp_phyuse[nblkno])
- | P_LOGICAL;
-
- /* Erase the old physical block. */
- if (oblkno != UINT_MAX) {
- sp->sp_phyuse[oblkno] = PHYUSE_STATUS(sp->sp_phyuse[oblkno])
- | P_DUST;
- error = flash_chip_erase_block(&sc->sc_flash, oblkno);
- if (error != 0) {
- printf("%s: can't erase old block %u\n",
- sc->sc_flash.sc_dev.dv_xname, oblkno);
- bp->b_error = error;
- goto bad;
- }
- }
-
- bp->b_resid = bp->b_bcount - sc->sc_flash.sc_flashdev->pagesize;
- free(oob, M_DEVBUF, oobsize);
- free(buf, M_DEVBUF, bufsize);
- return;
-bad:
- bp->b_flags |= B_ERROR;
- free(oob, M_DEVBUF, oobsize);
- free(buf, M_DEVBUF, bufsize);
-}
-
-int
-zflash_safe_start(struct zflash_softc *sc, dev_t dev)
-{
- u_char oob[FLASH_MAXOOBSIZE];
- struct disklabel *lp = sc->sc_flash.sc_dk.dk_label;
- struct zflash_safe *sp;
- u_int16_t *phyuse;
- u_int *logmap;
- u_int blksect;
- u_int blkno;
- u_int logno;
- u_int unusable;
- int part;
-
- part = flashpart(dev);
- if (sc->sc_safe[part] != NULL)
- return 0;
-
- /* We can only handle so much OOB data here. */
- if (sc->sc_flash.sc_flashdev->oobsize > FLASH_MAXOOBSIZE)
- return EIO;
-
- /* Safe partitions must start on a flash block boundary. */
- blksect = (sc->sc_flash.sc_flashdev->blkpages *
- sc->sc_flash.sc_flashdev->pagesize) / lp->d_secsize;
- if (DL_GETPOFFSET(&lp->d_partitions[part]) % blksect)
- return EIO;
-
- sp = malloc(sizeof(*sp), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (sp == NULL)
- return ENOMEM;
-
- sp->sp_dev = dev;
-
- sp->sp_pblks = DL_GETPSIZE(&lp->d_partitions[part]) / blksect;
- sp->sp_lblks = sp->sp_pblks;
-
- /* Try to reserve a number of spare physical blocks. */
- switch (sc->sc_flash.sc_flashdev->id) {
- case FLASH_DEVICE_SAMSUNG_K9F2808U0C:
- sp->sp_lblks -= 24; /* C3000 */
- break;
- case FLASH_DEVICE_SAMSUNG_K9F1G08U0A:
- sp->sp_lblks -= 4; /* C3100 */
- break;
- }
-
- DPRINTF(("pblks %lu lblks %lu\n", sp->sp_pblks, sp->sp_lblks));
-
- /* Next physical block to use; randomize for wear-leveling. */
- sp->sp_pnext = arc4random_uniform(sp->sp_pblks);
-
- /* Allocate physical block usage map. */
- phyuse = (u_int16_t *)malloc(sp->sp_pblks * sizeof(u_int16_t),
- M_DEVBUF, M_NOWAIT);
- if (phyuse == NULL) {
- free(sp, M_DEVBUF, 0);
- return ENOMEM;
- }
- sp->sp_phyuse = phyuse;
-
- /* Allocate logical to physical block map. */
- logmap = (u_int *)malloc(sp->sp_lblks * sizeof(u_int),
- M_DEVBUF, M_NOWAIT);
- if (logmap == NULL) {
- free(phyuse, M_DEVBUF, 0);
- free(sp, M_DEVBUF, 0);
- return ENOMEM;
- }
- sp->sp_logmap = logmap;
-
- /* Initialize the physical and logical block maps. */
- for (blkno = 0; blkno < sp->sp_pblks; blkno++)
- phyuse[blkno] = P_BADBLOCK | P_DUST;
- for (blkno = 0; blkno < sp->sp_lblks; blkno++)
- logmap[blkno] = UINT_MAX;
-
- /* Update physical block usage map with real data. */
- unusable = 0;
- flash_chip_enable(&sc->sc_flash);
- for (blkno = 0; blkno < sp->sp_pblks; blkno++) {
- long pageno;
-
- pageno = blkno * sc->sc_flash.sc_flashdev->blkpages;
- if (flash_chip_read_oob(&sc->sc_flash, pageno, oob) != 0) {
- DPRINTF(("blkno %u: can't read oob data\n", blkno));
- phyuse[blkno] = P_POSTBADBLOCK | P_DUST;
- unusable++;
- continue;
- }
-
- phyuse[blkno] = zflash_oob_status(sc, oob);
- if (PHYUSE_STATUS(phyuse[blkno]) != P_NORMALBLOCK) {
- DPRINTF(("blkno %u: badblock status %x\n", blkno,
- PHYUSE_STATUS(phyuse[blkno])));
- phyuse[blkno] |= P_DUST;
- unusable++;
- continue;
- }
-
- logno = zflash_oob_logno(sc, oob);
- if (logno == UINT_MAX) {
- DPRINTF(("blkno %u: can't read logno\n", blkno));
- phyuse[blkno] |= P_JFFS2;
- unusable++;
- continue;
- }
-
- if (logno == USHRT_MAX) {
- phyuse[blkno] |= P_DUST;
- /* Block is usable and available. */
- continue;
- }
-
- if (logno >= sp->sp_lblks) {
- DPRINTF(("blkno %u: logno %u too big\n", blkno,
- logno));
- phyuse[blkno] |= P_JFFS2;
- unusable++;
- continue;
- }
-
- if (logmap[logno] == UINT_MAX) {
- phyuse[blkno] |= P_LOGICAL;
- logmap[logno] = blkno;
- } else {
- /* Duplicate logical block! */
- DPRINTF(("blkno %u: duplicate logno %u\n", blkno,
- logno));
- phyuse[blkno] |= P_DUST;
- }
- }
- flash_chip_disable(&sc->sc_flash);
-
- if (unusable > 0)
- printf("%s: %u unusable blocks\n",
- sc->sc_flash.sc_dev.dv_xname, unusable);
-
- sc->sc_safe[part] = sp;
- return 0;
-}
-
-void
-zflash_safe_stop(struct zflash_softc *sc, dev_t dev)
-{
- struct zflash_safe *sp;
- int part;
-
- part = flashpart(dev);
- if (sc->sc_safe[part] == NULL)
- return;
-
- sp = sc->sc_safe[part];
- free(sp->sp_phyuse, M_DEVBUF, 0);
- free(sp->sp_logmap, M_DEVBUF, 0);
- free(sp, M_DEVBUF, 0);
- sc->sc_safe[part] = NULL;
-}
-
-u_int
-zflash_safe_next_block(struct zflash_safe *sp)
-{
- u_int blkno;
-
- for (blkno = sp->sp_pnext; blkno < sp->sp_pblks; blkno++)
- if (sp->sp_phyuse[blkno] == (P_NORMALBLOCK|P_DUST)) {
- sp->sp_pnext = blkno + 1;
- return blkno;
- }
-
- for (blkno = 0; blkno < sp->sp_pnext; blkno++)
- if (sp->sp_phyuse[blkno] == (P_NORMALBLOCK|P_DUST)) {
- sp->sp_pnext = blkno + 1;
- return blkno;
- }
-
- return UINT_MAX;
-}
-
-/*
- * Correct single bit errors in the block's status byte.
- */
-u_char
-zflash_oob_status_decode(u_char status)
-{
- u_char bit;
- int count;
-
- /* Speed-up. */
- if (status == 0xff)
- return 0xff;
-
- /* Count the number of bits set in the byte. */
- for (count = 0, bit = 0x01; bit != 0x00; bit <<= 1)
- if ((status & bit) != 0)
- count++;
-
- return (count > 6) ? 0xff : 0x00;
-}
-
-/*
- * Decode the block's status byte into a value for the phyuse map.
- */
-u_int16_t
-zflash_oob_status(struct zflash_softc *sc, u_char *oob)
-{
- u_char status;
-
- status = zflash_oob_status_decode(oob[sc->sc_ioobbadblk]);
- if (status != 0xff)
- return P_BADBLOCK;
-
- status = zflash_oob_status_decode(oob[sc->sc_ioobpostbadblk]);
- if (status != 0xff)
- return P_POSTBADBLOCK;
-
- return P_NORMALBLOCK;
-}
-
-/*
- * Extract the 16-bit logical block number corresponding to a physical
- * block from the physical block's OOB data.
- */
-u_int
-zflash_oob_logno(struct zflash_softc *sc, u_char *oob)
-{
- int idx_lo, idx_hi;
- u_int16_t word;
- u_int16_t bit;
- int parity;
-
- /* Find a matching pair of high and low bytes. */
- if (oob[OOB_LOGADDR_0_LO] == oob[OOB_LOGADDR_1_LO] &&
- oob[OOB_LOGADDR_0_HI] == oob[OOB_LOGADDR_1_HI]) {
- idx_lo = OOB_LOGADDR_0_LO;
- idx_hi = OOB_LOGADDR_0_HI;
- } else if (oob[OOB_LOGADDR_1_LO] == oob[OOB_LOGADDR_2_LO] &&
- oob[OOB_LOGADDR_1_HI] == oob[OOB_LOGADDR_2_HI]) {
- idx_lo = OOB_LOGADDR_1_LO;
- idx_hi = OOB_LOGADDR_1_HI;
- } else if (oob[OOB_LOGADDR_2_LO] == oob[OOB_LOGADDR_0_LO] &&
- oob[OOB_LOGADDR_2_HI] == oob[OOB_LOGADDR_0_HI]) {
- idx_lo = OOB_LOGADDR_2_LO;
- idx_hi = OOB_LOGADDR_2_HI;
- } else
- /* Block's OOB data may be invalid. */
- return UINT_MAX;
-
- word = ((u_int16_t)oob[idx_lo] << 0) |
- ((u_int16_t)oob[idx_hi] << 8);
-
- /* Check for parity error in the logical block number. */
- for (parity = 0, bit = 0x0001; bit != 0x0000; bit <<= 1)
- if ((word & bit) != 0)
- parity++;
- if ((parity & 1) != 0)
- return UINT_MAX;
-
- /* No logical block number assigned to this block? */
- if (word == USHRT_MAX)
- return word;
-
- /* Return the validated logical block number. */
- return (word & 0x07fe) >> 1;
-}
-
-void
-zflash_oob_set_status(struct zflash_softc *sc, u_char *oob, u_int16_t phyuse)
-{
- switch (PHYUSE_STATUS(phyuse)) {
- case P_NORMALBLOCK:
- oob[sc->sc_ioobbadblk] = 0xff;
- oob[sc->sc_ioobpostbadblk] = 0xff;
- break;
- case P_BADBLOCK:
- oob[sc->sc_ioobbadblk] = 0x00;
- oob[sc->sc_ioobpostbadblk] = 0x00;
- break;
- case P_POSTBADBLOCK:
- oob[sc->sc_ioobbadblk] = 0xff;
- oob[sc->sc_ioobpostbadblk] = 0x00;
- break;
- }
-}
-
-void
-zflash_oob_set_logno(struct zflash_softc *sc, u_char *oob, u_int logno)
-{
- u_int16_t word;
- u_int16_t bit;
- u_char lo;
- u_char hi;
- int parity = 0;
-
- /* Why do we set the most significant bit? */
- word = ((logno & 0x03ff) << 1) | 0x1000;
-
- /* Calculate the parity. */
- for (bit = 0x0001; bit != 0x0000; bit <<= 1)
- if ((word & bit) != 0)
- parity++;
- if ((parity & 1) != 0)
- word |= 0x0001;
-
- lo = word & 0x00ff;
- hi = (word & 0xff00) >> 8;
-
- oob[OOB_LOGADDR_0_LO] = lo;
- oob[OOB_LOGADDR_0_HI] = hi;
- oob[OOB_LOGADDR_1_LO] = lo;
- oob[OOB_LOGADDR_1_HI] = hi;
- oob[OOB_LOGADDR_2_LO] = lo;
- oob[OOB_LOGADDR_2_HI] = hi;
-}
diff --git a/sys/arch/zaurus/dev/zaurus_kbd.c b/sys/arch/zaurus/dev/zaurus_kbd.c
deleted file mode 100644
index a110b651304..00000000000
--- a/sys/arch/zaurus/dev/zaurus_kbd.c
+++ /dev/null
@@ -1,545 +0,0 @@
-/* $OpenBSD: zaurus_kbd.c,v 1.36 2014/07/11 08:18:31 guenther Exp $ */
-/*
- * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/timeout.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wskbdvar.h>
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-
-#include <zaurus/dev/zaurus_kbdmap.h>
-
-#include "apm.h"
-
-const int
-gpio_sense_pins_c3000[] = {
- 12,
- 17,
- 91,
- 34,
- 36,
- 38,
- 39,
- -1
-};
-
-const int
-gpio_strobe_pins_c3000[] = {
- 88,
- 23,
- 24,
- 25,
- 26,
- 27,
- 52,
- 103,
- 107,
- -1,
- 108,
- 114
-};
-
-const int stuck_keys[] = {
- 7,
- 15,
- 23,
- 31
-};
-
-
-#define REP_DELAY1 400
-#define REP_DELAYN 100
-
-struct zkbd_softc {
- struct device sc_dev;
-
- const int *sc_sense_array;
- const int *sc_strobe_array;
- int sc_nsense;
- int sc_nstrobe;
-
- short sc_onkey_pin;
- short sc_sync_pin;
- short sc_swa_pin;
- short sc_swb_pin;
- char *sc_okeystate;
- char *sc_keystate;
- char sc_hinge; /* 0=open, 1=nonsense, 2=backwards, 3=closed */
- char sc_maxkbdcol;
-
- struct timeout sc_roll_to;
-
- /* console stuff */
- int sc_polling;
- int sc_pollUD;
- int sc_pollkey;
-
- /* wskbd bits */
- struct device *sc_wskbddev;
- int sc_rawkbd;
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- const char *sc_xt_keymap;
-#define MAXKEYS 20
-#endif
-};
-
-struct zkbd_softc *zkbd_dev; /* XXX */
-
-int zkbd_match(struct device *, void *, void *);
-void zkbd_attach(struct device *, struct device *, void *);
-int zkbd_activate(struct device *, int);
-
-int zkbd_irq(void *v);
-void zkbd_poll(void *v);
-int zkbd_on(void *v);
-int zkbd_sync(void *v);
-int zkbd_hinge(void *v);
-
-int zkbd_modstate;
-
-struct cfattach zkbd_ca = {
- sizeof(struct zkbd_softc), zkbd_match, zkbd_attach, NULL,
- zkbd_activate
-};
-
-struct cfdriver zkbd_cd = {
- NULL, "zkbd", DV_DULL
-};
-
-int zkbd_enable(void *, int);
-void zkbd_set_leds(void *, int);
-int zkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
-
-struct wskbd_accessops zkbd_accessops = {
- zkbd_enable,
- zkbd_set_leds,
- zkbd_ioctl,
-};
-
-void zkbd_cngetc(void *, u_int *, int *);
-void zkbd_cnpollc(void *, int);
-
-struct wskbd_consops zkbd_consops = {
- zkbd_cngetc,
- zkbd_cnpollc,
-};
-
-struct wskbd_mapdata zkbd_keymapdata = {
- zkbd_keydesctab,
- KB_US | KB_DEFAULT,
-};
-
-
-
-int
-zkbd_match(struct device *parent, void *cf, void *aux)
-{
- return 1;
-}
-
-
-void
-zkbd_attach(struct device *parent, struct device *self, void *aux)
-{
- struct zkbd_softc *sc = (struct zkbd_softc *)self;
- struct wskbddev_attach_args a;
- int pin, i;
- extern int glass_console;
-
- zkbd_dev = sc;
- sc->sc_polling = 0;
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- sc->sc_rawkbd = 0;
-#endif
- /* Determine which system we are - XXX */
-
- if (1 /* C3000 */) {
- sc->sc_sense_array = gpio_sense_pins_c3000;
- sc->sc_strobe_array = gpio_strobe_pins_c3000;
- sc->sc_nsense = sizeof(gpio_sense_pins_c3000)/sizeof(int);
- sc->sc_nstrobe = sizeof(gpio_strobe_pins_c3000)/sizeof(int);
- sc->sc_maxkbdcol = 10;
- sc->sc_onkey_pin = 95;
- sc->sc_sync_pin = 16;
- sc->sc_swa_pin = 97;
- sc->sc_swb_pin = 96;
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- sc->sc_xt_keymap = xt_keymap;
-#endif
- } /* XXX */
-
- sc->sc_okeystate = malloc(sc->sc_nsense * sc->sc_nstrobe,
- M_DEVBUF, M_NOWAIT | M_ZERO);
-
- sc->sc_keystate = malloc(sc->sc_nsense * sc->sc_nstrobe,
- M_DEVBUF, M_NOWAIT | M_ZERO);
-
- /* set all the strobe bits */
- for (i = 0; i < sc->sc_nstrobe; i++) {
- pin = sc->sc_strobe_array[i];
- if (pin == -1) {
- continue;
- }
- pxa2x0_gpio_set_function(pin, GPIO_SET|GPIO_OUT);
- }
- /* set all the sense bits */
- for (i = 0; i < sc->sc_nsense; i++) {
- pin = sc->sc_sense_array[i];
- if (pin == -1) {
- continue;
- }
- pxa2x0_gpio_set_function(pin, GPIO_IN);
- pxa2x0_gpio_intr_establish(pin, IST_EDGE_BOTH, IPL_TTY,
- zkbd_irq, sc, sc->sc_dev.dv_xname);
- }
- pxa2x0_gpio_intr_establish(sc->sc_onkey_pin, IST_EDGE_BOTH, IPL_TTY,
- zkbd_on, sc, sc->sc_dev.dv_xname);
- pxa2x0_gpio_intr_establish(sc->sc_sync_pin, IST_EDGE_RISING, IPL_TTY,
- zkbd_sync, sc, sc->sc_dev.dv_xname);
- pxa2x0_gpio_intr_establish(sc->sc_swa_pin, IST_EDGE_BOTH, IPL_TTY,
- zkbd_hinge, sc, sc->sc_dev.dv_xname);
- pxa2x0_gpio_intr_establish(sc->sc_swb_pin, IST_EDGE_BOTH, IPL_TTY,
- zkbd_hinge, sc, sc->sc_dev.dv_xname);
-
- if (glass_console) {
- wskbd_cnattach(&zkbd_consops, sc, &zkbd_keymapdata);
- a.console = 1;
- } else {
- a.console = 0;
- }
-
- a.keymap = &zkbd_keymapdata;
- a.accessops = &zkbd_accessops;
- a.accesscookie = sc;
-
- printf("\n");
-
- zkbd_hinge(sc); /* to initialize sc_hinge */
-
- sc->sc_wskbddev = config_found(self, &a, wskbddevprint);
-
- timeout_set(&(sc->sc_roll_to), zkbd_poll, sc);
-}
-
-/* XXX only deal with keys that can be pressed when display is open? */
-/* XXX are some not in the array? */
-/* handle keypress interrupt */
-int
-zkbd_irq(void *v)
-{
- zkbd_poll(v);
-
- return 1;
-}
-
-void
-zkbd_poll(void *v)
-{
- struct zkbd_softc *sc = v;
- int i, j, col, pin, type, keysdown = 0, s;
- int stuck;
- int keystate;
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- int ncbuf = 0, c;
- char cbuf[MAXKEYS * 2];
-#endif
-
- s = spltty();
-
- /* discharge all */
- for (i = 0; i < sc->sc_nstrobe; i++) {
- pin = sc->sc_strobe_array[i];
- if (pin != -1) {
- pxa2x0_gpio_clear_bit(pin);
- pxa2x0_gpio_set_dir(pin, GPIO_IN);
- }
- }
-
- delay (10);
- for(col = 0; col < sc->sc_nstrobe; col++) {
- if (sc->sc_strobe_array[i] == -1)
- continue;
-
- pin = sc->sc_strobe_array[col];
-
- /* activate_col */
- pxa2x0_gpio_set_bit(pin);
- pxa2x0_gpio_set_dir(pin, GPIO_OUT);
-
- /* wait activate delay */
- delay(10);
-
- /* read row */
- for (i = 0; i < sc->sc_nsense; i++) {
- int bit;
-
- if (sc->sc_sense_array[i] == -1)
- continue;
-
- bit = pxa2x0_gpio_get_bit(sc->sc_sense_array[i]);
- if (bit && sc->sc_hinge && col < sc->sc_maxkbdcol)
- continue;
- sc->sc_keystate[i + (col * sc->sc_nsense)] = bit;
- }
-
- /* reset_col */
- pxa2x0_gpio_set_dir(pin, GPIO_IN);
- /* wait discharge delay */
- delay(10);
- }
- /* charge all */
- for (i = 0; i < sc->sc_nstrobe; i++) {
- pin = sc->sc_strobe_array[i];
- if (pin != -1) {
- pxa2x0_gpio_set_bit(pin);
- pxa2x0_gpio_set_dir(pin, GPIO_OUT);
- }
- }
-
- /* force the irqs to clear as we have just played with them. */
- for (i = 0; i < sc->sc_nsense; i++)
- if (sc->sc_sense_array[i] != -1)
- pxa2x0_gpio_clear_intr(sc->sc_sense_array[i]);
-
- /* process after resetting interrupt */
-
- zkbd_modstate = (
- (sc->sc_keystate[84] ? (1 << 0) : 0) | /* shift */
- (sc->sc_keystate[93] ? (1 << 1) : 0) | /* Fn */
- (sc->sc_keystate[14] ? (1 << 2) : 0)); /* 'alt' */
-
- for (i = 0; i < (sc->sc_nsense * sc->sc_nstrobe); i++) {
- stuck = 0;
- /* extend xt_keymap to do this faster. */
- /* ignore 'stuck' keys' */
- for (j = 0; j < sizeof(stuck_keys)/sizeof(stuck_keys[0]); j++) {
- if (stuck_keys[j] == i) {
- stuck = 1 ;
- break;
- }
- }
- if (stuck)
- continue;
- keystate = sc->sc_keystate[i];
-
- keysdown |= keystate; /* if any keys held */
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- if (sc->sc_polling == 0 && sc->sc_rawkbd) {
- if ((keystate) || (sc->sc_okeystate[i] != keystate)) {
- c = sc->sc_xt_keymap[i];
- if (c & 0x80) {
- cbuf[ncbuf++] = 0xe0;
- }
- cbuf[ncbuf] = c & 0x7f;
- if (!keystate)
- cbuf[ncbuf] |= 0x80;
- ncbuf++;
- sc->sc_okeystate[i] = keystate;
- }
- }
-#endif
-
- if ((!sc->sc_rawkbd) && (sc->sc_okeystate[i] != keystate)) {
-
- type = keystate ? WSCONS_EVENT_KEY_DOWN :
- WSCONS_EVENT_KEY_UP;
-
- if (sc->sc_polling) {
- sc->sc_pollkey = i;
- sc->sc_pollUD = type;
- } else {
- wskbd_input(sc->sc_wskbddev, type, i);
- }
-
- sc->sc_okeystate[i] = keystate;
- }
- }
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- if (sc->sc_polling == 0 && sc->sc_rawkbd)
- wskbd_rawinput(sc->sc_wskbddev, cbuf, ncbuf);
-#endif
- if (keysdown)
- timeout_add(&(sc->sc_roll_to), hz * REP_DELAYN / 1000 / 2);
- else
- timeout_del(&(sc->sc_roll_to)); /* always cancel? */
-
- splx(s);
-}
-
-#if NAPM > 0
-extern int allowpowerdown;
-extern int apm_suspends;
-static int zkbdondown; /* on key is pressed */
-static struct timeval zkbdontv = { 0, 0 }; /* last on key event */
-const struct timeval zkbdhalttv = { 3, 0 }; /* 3s for safe shutdown */
-const struct timeval zkbdsleeptv = { 0, 250000 }; /* .25s for suspend */
-extern int lid_suspend;
-#endif
-
-int
-zkbd_on(void *v)
-{
-#if NAPM > 0
- struct zkbd_softc *sc = v;
- int down = pxa2x0_gpio_get_bit(sc->sc_onkey_pin) ? 1 : 0;
-
- /*
- * Change run mode depending on how long the key is held down.
- * Ignore the key if it gets pressed while the lid is closed.
- *
- * Keys can bounce and we have to work around missed interrupts.
- * Only the second edge is detected upon exit from sleep mode.
- */
- if (down) {
- if (sc->sc_hinge == 3) {
- zkbdondown = 0;
- } else {
- microuptime(&zkbdontv);
- zkbdondown = 1;
- }
- } else if (zkbdondown) {
- if (ratecheck(&zkbdontv, &zkbdhalttv)) {
- if (allowpowerdown == 1) {
- allowpowerdown = 0;
- prsignal(initprocess, SIGUSR2);
- }
- } else if (ratecheck(&zkbdontv, &zkbdsleeptv)) {
- apm_suspends++;
- }
- zkbdondown = 0;
- }
-#endif
- return 1;
-}
-
-int
-zkbd_sync(void *v)
-{
- return 1;
-}
-
-int
-zkbd_hinge(void *v)
-{
- struct zkbd_softc *sc = v;
- int a = pxa2x0_gpio_get_bit(sc->sc_swa_pin) ? 1 : 0;
- int b = pxa2x0_gpio_get_bit(sc->sc_swb_pin) ? 2 : 0;
- extern void lcd_blank(int);
-
- sc->sc_hinge = a | b;
-
- if (sc->sc_hinge == 3) {
-#if NAPM > 0
- if (lid_suspend)
- apm_suspends++;
-#endif
- lcd_blank(1);
- } else
- lcd_blank(0);
-
-
- return 1;
-}
-
-int
-zkbd_enable(void *v, int on)
-{
- return 0;
-}
-
-void
-zkbd_set_leds(void *v, int on)
-{
-}
-
-int
-zkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- struct zkbd_softc *sc = v;
-#endif
-
- switch (cmd) {
-
- case WSKBDIO_GTYPE:
- *(int *)data = WSKBD_TYPE_ZAURUS;
- return 0;
- case WSKBDIO_SETLEDS:
- return 0;
- case WSKBDIO_GETLEDS:
- *(int *)data = 0;
- return 0;
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- case WSKBDIO_SETMODE:
- sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
- return (0);
-#endif
-
- }
- /* kbdioctl(...); */
-
- return -1;
-}
-
-/* implement polling for zaurus_kbd */
-void
-zkbd_cngetc(void *v, u_int *type, int *data)
-{
- struct zkbd_softc *sc = zkbd_dev;
- sc->sc_pollkey = -1;
- sc->sc_pollUD = -1;
- sc->sc_polling = 1;
- while (sc->sc_pollkey == -1) {
- zkbd_poll(zkbd_dev);
- DELAY(10000); /* XXX */
- }
- sc->sc_polling = 0;
- *data = sc->sc_pollkey;
- *type = sc->sc_pollUD;
-}
-
-void
-zkbd_cnpollc(void *v, int on)
-{
-}
-
-int
-zkbd_activate(struct device *self, int act)
-{
- switch (act) {
- case DVACT_SUSPEND:
- zkbd_hinge(self);
- break;
- case DVACT_RESUME:
- zkbd_hinge(self);
- break;
- }
- return 0;
-}
diff --git a/sys/arch/zaurus/dev/zaurus_kbdmap.h b/sys/arch/zaurus/dev/zaurus_kbdmap.h
deleted file mode 100644
index c5b699938e1..00000000000
--- a/sys/arch/zaurus/dev/zaurus_kbdmap.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* $OpenBSD: zaurus_kbdmap.h,v 1.19 2005/05/10 08:26:12 espie Exp $ */
-
-/*
- * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#define KC(n) KS_KEYCODE(n)
-#include <dev/wscons/wskbdraw.h>
-
-static const keysym_t zkbd_keydesc_us[] = {
- KC(0), KS_Control_L,
- KC(2), KS_Tab, KS_Tab, KS_Caps_Lock,
- KC(3), KS_Cmd_Screen1, KS_f2, /* Addr, */
- KC(4), KS_Cmd_Screen0, KS_f1, /* Cal, */
- KC(5), KS_Cmd_Screen2, KS_f3, /* Mail, */
- KC(6), KS_Cmd_Screen3, KS_f4, /* Home, */
- KC(8), KS_1, KS_exclam,
- KC(9), KS_2, KS_quotedbl,
- KC(10), KS_q,
- KC(11), KS_w, KS_W, KS_asciicircum,
- KC(12), KS_a,
- KC(13), KS_z,
- KC(14), KS_Cmd, KS_Alt_L,
- KC(16), KS_Cmd_BrightnessDown, KS_3, KS_numbersign,
- KC(17), KS_Cmd_BrightnessUp, KS_4, KS_dollar,
- KC(18), KS_e, KS_E, KS_equal,
- KC(19), KS_s,
- KC(20), KS_d, KS_D, KS_grave,
- KC(21), KS_x,
- /* KC(22), ^/t (right japanese) */
- KC(24), KS_5, KS_percent,
- KC(25), KS_r, KS_R, KS_plus,
- KC(26), KS_t, KS_T, KS_bracketleft,
- KC(27), KS_f, KS_F, KS_backslash,
- KC(28), KS_c,
- KC(29), KS_minus, KS_minus, KS_at,
- KC(30), KS_Cmd_Debugger,KS_Escape, /* Cancel */
- KC(32), KS_6, KS_ampersand,
- KC(33), KS_y, KS_Y, KS_bracketright,
- KC(34), KS_g, KS_G, KS_semicolon,
- KC(35), KS_v,
- KC(36), KS_b, KS_B, KS_underscore,
- KC(37), KS_space,
- KC(38), KS_KP_Enter, /* ok */
- KC(40), KS_7, KS_apostrophe,
- KC(41), KS_8, KS_parenleft,
- KC(42), KS_u, KS_U, KS_braceleft,
- KC(43), KS_h, KS_H, KS_colon,
- KC(44), KS_n,
- KC(45), KS_comma, KS_slash, KS_less,
- KC(46), KS_Cmd_Screen4, KS_f5, /* Menu, */
- KC(48), KS_9, KS_parenright,
- KC(49), KS_i, KS_I, KS_braceright,
- KC(50), KS_j, KS_J, KS_asterisk,
- KC(51), KS_m,
- KC(52), KS_period, KS_question, KS_greater,
- KC(54), KS_KP_Left, KS_KP_Left, KS_Home, /* left, */
- KC(56), KS_0, KS_asciitilde,
- KC(57), KS_o,
- KC(58), KS_k,
- KC(59), KS_l, KS_L, KS_bar,
- KC(61), KS_KP_Up, KS_KP_Up, KS_Prior, /* up, */
- KC(62), KS_KP_Down, KS_KP_Down, KS_Next, /* down, */
- KC(64), KS_Delete, KS_BackSpace,
- KC(65), KS_p,
- KC(68), KS_Return,
- KC(70), KS_KP_Right, KS_KP_Right, KS_End, /* right, */
- KC(80), KS_KP_Right, /* OK, (ext) */
- KC(81), KS_KP_Down, /* tog left, */
- KC(83), KS_Shift_R,
- KC(84), KS_Shift_L,
- KC(88), KS_KP_Left, /* cancel (ext), */
- KC(89), KS_KP_Up, /* tog right, */
- KC(93), KS_Mode_switch /* Fn */
-};
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-static const char xt_keymap[] = {
- /* KC(0), */ RAWKEY_Control_L,/* KS_Control_L, */
- /* KC(1), */ RAWKEY_Null, /* NC */
- /* KC(2), */ RAWKEY_Tab, /* KS_Tab, KS_Tab, KS_Caps_Lock, */
- /* KC(3), */ RAWKEY_f2, /* KS_Cmd_Screen1, KS_f2, Addr, */
- /* KC(4), */ RAWKEY_f1, /* KS_Cmd_Screen0, KS_f1, Cal, */
- /* KC(5), */ RAWKEY_f3, /* KS_Cmd_Screen2, KS_f3, Mail, */
- /* KC(6), */ RAWKEY_f4, /* KS_Cmd_Screen3, KS_f4, Home, */
- /* KC(7), */ RAWKEY_Null, /* NC */
- /* KC(8), */ RAWKEY_1, /* KS_1, KS_exclam, */
- /* KC(9), */ RAWKEY_2, /* KS_2, KS_quotedbl, */
- /* KC(10), */ RAWKEY_q, /* KS_q, */
- /* KC(11), */ RAWKEY_w, /* KS_w, KS_W, KS_asciicircum, */
- /* KC(12), */ RAWKEY_a, /* KS_a, */
- /* KC(13), */ RAWKEY_z, /* KS_z, */
- /* KC(14), */ RAWKEY_Alt_L, /* KS_Cmd, KS_Alt_L, */
- /* KC(15), */ RAWKEY_Null, /* NC */
- /* KC(16), */ RAWKEY_3, /* KS_3, KS_numbersign, */
- /* KC(17), */ RAWKEY_4, /* KS_4, KS_dollar, */
- /* KC(18), */ RAWKEY_e, /* KS_e, KS_E, KS_equal, */
- /* KC(19), */ RAWKEY_s, /* KS_s, */
- /* KC(20), */ RAWKEY_d, /* KS_d, KS_D, KS_grave, */
- /* KC(21), */ RAWKEY_x, /* KS_x, */
- /* KC(22), */ RAWKEY_Null, /* ^/t (right japanese) */
- /* KC(23), */ RAWKEY_Null, /* NC */
- /* KC(24), */ RAWKEY_5, /* KS_5, KS_percent, */
- /* KC(25), */ RAWKEY_r, /* KS_r, KS_R, KS_plus, */
- /* KC(26), */ RAWKEY_t, /* KS_t, KS_T, KS_bracketleft, */
- /* KC(27), */ RAWKEY_f, /* KS_f, KS_F, KS_backslash, */
- /* KC(28), */ RAWKEY_c, /* KS_c, */
- /* KC(29), */ RAWKEY_minus, /* KS_minus, KS_minus, KS_at, */
- /* KC(30), */ RAWKEY_Escape, /* KS_Escape, Cancel */
- /* KC(31), */ RAWKEY_Null, /* NC */
- /* KC(32), */ RAWKEY_6, /* KS_6, KS_ampersand, */
- /* KC(33), */ RAWKEY_y, /* KS_y, KS_Y, KS_bracketright, */
- /* KC(34), */ RAWKEY_g, /* KS_g, KS_G, KS_semicolon, */
- /* KC(35), */ RAWKEY_v, /* KS_v, */
- /* KC(36), */ RAWKEY_b, /* KS_b, KS_B, KS_underscore, */
- /* KC(37), */ RAWKEY_space, /* KS_space, */
- /* KC(38), */ RAWKEY_KP_Enter, /* KS_KP_Enter, ok */
- /* KC(39), */ RAWKEY_Null, /* NC */
- /* KC(40), */ RAWKEY_7, /* KS_7, KS_apostrophe, */
- /* KC(41), */ RAWKEY_8, /* KS_8, KS_parenleft, */
- /* KC(42), */ RAWKEY_u, /* KS_u, KS_U, KS_braceleft, */
- /* KC(43), */ RAWKEY_h, /* KS_h, KS_H, KS_colon, */
- /* KC(44), */ RAWKEY_n, /* KS_n, */
- /* KC(45), */ RAWKEY_comma, /* KS_comma, KS_slash, KS_less, */
- /* KC(46), */ RAWKEY_f5, /* KS_Cmd_Screen4, KS_f5, Menu, */
- /* KC(47), */ RAWKEY_Null, /* NC */
- /* KC(48), */ RAWKEY_9, /* KS_9, KS_parenright, */
- /* KC(49), */ RAWKEY_i, /* KS_i, KS_I, KS_braceright, */
- /* KC(50), */ RAWKEY_j, /* KS_j, KS_J, KS_asterisk, */
- /* KC(51), */ RAWKEY_m, /* KS_m, */
- /* KC(52), */ RAWKEY_period, /* KS_period, KS_question, KS_greater, */
- /* KC(53), */ RAWKEY_Null, /* NC */
- /* KC(54), */ RAWKEY_Left, /* KS_KP_Left, left, */
- /* KC(55), */ RAWKEY_Null, /* NC */
- /* KC(56), */ RAWKEY_0, /* KS_0, KS_asciitilde, */
- /* KC(57), */ RAWKEY_o, /* KS_o, */
- /* KC(58), */ RAWKEY_k, /* KS_k, */
- /* KC(59), */ RAWKEY_l, /* KS_l, KS_L, KS_bar, */
- /* KC(60), */ RAWKEY_Null, /* NC */
- /* KC(61), */ RAWKEY_Up, /* KS_KP_Up, up, */
- /* KC(62), */ RAWKEY_Down, /* KS_KP_Down, down, */
- /* KC(63), */ RAWKEY_Null, /* NC */
- /* KC(64), */ RAWKEY_BackSpace, /* KS_Delete, KS_BackSpace, */
- /* KC(65), */ RAWKEY_p, /* KS_p, */
- /* KC(66), */ RAWKEY_Null, /* NC */
- /* KC(67), */ RAWKEY_Null, /* NC */
- /* KC(68), */ RAWKEY_Return, /* KS_Return, */
- /* KC(69), */ RAWKEY_Null, /* NC */
- /* KC(70), */ RAWKEY_Right, /* KS_KP_Right, right, */
- /* KC(71), */ RAWKEY_Null, /* NC */
- /* KC(72), */ RAWKEY_Null, /* NC */
- /* KC(73), */ RAWKEY_Null, /* NC */
- /* KC(74), */ RAWKEY_Null, /* NC */
- /* KC(75), */ RAWKEY_Null, /* NC */
- /* KC(76), */ RAWKEY_Null, /* NC */
- /* KC(77), */ RAWKEY_Null, /* NC */
- /* KC(78), */ RAWKEY_Null, /* NC */
- /* KC(79), */ RAWKEY_Null, /* NC */
- /* KC(80), */ RAWKEY_Right, /* KS_KP_Right, OK, (ext) */
- /* KC(81), */ RAWKEY_Down, /* KS_KP_Down, tog left, */
- /* KC(82), */ RAWKEY_Null, /* NC */
- /* KC(83), */ RAWKEY_Shift_R, /* KS_Shift_R, */
- /* KC(84), */ RAWKEY_Shift_L, /* KS_Shift_L, */
- /* KC(85), */ RAWKEY_Null, /* NC */
- /* KC(86), */ RAWKEY_Null, /* NC */
- /* KC(87), */ RAWKEY_Null, /* NC */
- /* KC(88), */ RAWKEY_Left, /* KS_KP_Left, cancel (ext), */
- /* KC(89), */ RAWKEY_Up, /* KS_KP_Up, tog right, */
- /* KC(90), */ RAWKEY_Null, /* NC */
- /* KC(91), */ RAWKEY_Null, /* NC */
- /* KC(92), */ RAWKEY_Null, /* NC */
- /* KC(93), */ RAWKEY_Alt_R, /* KS_Mode_switch Fn */
-};
-#endif
-
-#define KBD_MAP(name, base, map) \
- { name, base, sizeof(map)/sizeof(keysym_t), map }
-
-static const struct wscons_keydesc zkbd_keydesctab[] = {
- KBD_MAP(KB_US, 0, zkbd_keydesc_us),
- {0, 0, 0, 0}
-};
-
-#undef KBD_MAP
-#undef KC
diff --git a/sys/arch/zaurus/dev/zaurus_remote.c b/sys/arch/zaurus/dev/zaurus_remote.c
deleted file mode 100644
index ae12c08b23c..00000000000
--- a/sys/arch/zaurus/dev/zaurus_remote.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/* $OpenBSD: zaurus_remote.c,v 1.2 2014/01/26 17:48:08 miod Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/limits.h>
-#include <sys/timeout.h>
-#include <sys/systm.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wskbdraw.h>
-#include <dev/wscons/wskbdvar.h>
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-
-#include <machine/intr.h>
-#include <machine/zaurus_var.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-#include <zaurus/dev/zaurus_scoopvar.h>
-#include <zaurus/dev/zaurus_sspvar.h>
-
-#define RESCAN_INTERVAL (hz/100)
-
-#define KEY_RELEASE 0 /* button release */
-#define KEY_VOL_DOWN 1
-#define KEY_MUTE 2
-#define KEY_REWIND 3
-#define KEY_VOL_UP 4
-#define KEY_FORWARD 5
-#define KEY_PLAY 6
-#define KEY_STOP 7
-#define KEY_EARPHONE 8
-
-#ifdef DEBUG
-static const char *zrc_keyname[] = {
- "(release)", "volume down", "mute", "rewind", "volume up",
- "forward", "play", "stop", "(earphone)"
-};
-#endif
-
-struct zrc_akey {
- int min; /* minimum ADC value or INT_MIN */
- int key; /* remote control key number */
-};
-
-/* Values match the resistors in the CE-RH2 remote control. */
-static const struct zrc_akey zrc_akeytab_c3000[] = {
- { 238, KEY_RELEASE },
- { 202, KEY_VOL_DOWN },
- { 168, KEY_MUTE },
- { 135, KEY_REWIND },
- { 105, KEY_VOL_UP },
- { 74, KEY_FORWARD },
- { 42, KEY_PLAY },
- { 12, KEY_STOP },
- { INT_MIN, KEY_EARPHONE }
-};
-
-static const struct zrc_akey *zrc_akeytab = zrc_akeytab_c3000;
-
-struct zrc_softc {
- struct device sc_dev;
- struct timeout sc_to;
- void *sc_ih;
- int sc_key; /* being scanned */
- int sc_scans; /* rescan counter */
- int sc_noise; /* discard if too noisy? */
- int sc_keydown; /* currently pressed key */
- struct device *sc_wskbddev;
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- int sc_rawkbd;
-#endif
-};
-
-int zrc_match(struct device *, void *, void *);
-void zrc_attach(struct device *, struct device *, void *);
-
-int zrc_intr(void *);
-void zrc_timeout(void *);
-int zrc_scan(void);
-void zrc_input(struct zrc_softc *, int, int);
-
-struct cfattach zrc_ca = {
- sizeof(struct zrc_softc), zrc_match, zrc_attach
-};
-
-struct cfdriver zrc_cd = {
- NULL, "zrc", DV_DULL
-};
-
-int zrc_enable(void *, int);
-void zrc_set_leds(void *, int);
-int zrc_ioctl(void *, u_long, caddr_t, int, struct proc *);
-
-struct wskbd_accessops zrc_accessops = {
- zrc_enable,
- zrc_set_leds,
- zrc_ioctl,
-};
-
-#define KC(n) KS_KEYCODE(n)
-
-/* XXX what keys should be generated in translated mode? */
-static const keysym_t zrc_keydesc[] = {
- KC(KEY_VOL_DOWN), KS_minus,
- KC(KEY_MUTE), KS_m,
- KC(KEY_REWIND), KS_b,
- KC(KEY_VOL_UP), KS_plus,
- KC(KEY_FORWARD), KS_f,
- KC(KEY_PLAY), KS_p,
- KC(KEY_STOP), KS_s,
-};
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-#define RAWKEY_AudioRewind 0xa0
-#define RAWKEY_AudioForward 0xa1
-#define RAWKEY_AudioPlay 0xa2
-#define RAWKEY_AudioStop 0xa3
-static const keysym_t zrc_xt_keymap[] = {
- /* KC(KEY_RELEASE), */ RAWKEY_Null,
- /* KC(KEY_VOL_DOWN), */ RAWKEY_AudioLower,
- /* KC(KEY_MUTE), */ RAWKEY_AudioMute,
- /* KC(KEY_REWIND), */ RAWKEY_AudioRewind,
- /* KC(KEY_VOL_UP), */ RAWKEY_AudioRaise,
- /* KC(KEY_FORWARD), */ RAWKEY_AudioForward,
- /* KC(KEY_PLAY), */ RAWKEY_AudioPlay,
- /* KC(KEY_STOP), */ RAWKEY_AudioStop,
-};
-#endif
-
-static const struct wscons_keydesc zrc_keydesctab[] = {
- {KB_US, 0, sizeof(zrc_keydesc)/sizeof(keysym_t), zrc_keydesc},
- {0, 0, 0, 0}
-};
-
-struct wskbd_mapdata zrc_keymapdata = {
- zrc_keydesctab, KB_US | KB_DEFAULT
-};
-
-
-int
-zrc_match(struct device *parent, void *match, void *aux)
-{
- return (ZAURUS_ISC3000);
-}
-
-void
-zrc_attach(struct device *parent, struct device *self, void *aux)
-{
- struct zrc_softc *sc = (struct zrc_softc *)self;
- struct wskbddev_attach_args a;
-
- /* Configure remote control interrupt handling. */
- timeout_set(&sc->sc_to, zrc_timeout, sc);
- pxa2x0_gpio_set_function(C3000_RC_IRQ_PIN, GPIO_IN);
- sc->sc_ih = pxa2x0_gpio_intr_establish(C3000_RC_IRQ_PIN,
- IST_EDGE_BOTH, IPL_BIO, zrc_intr, sc, "zrc");
-
- /* Enable the pullup while waiting for an interrupt. */
- scoop_akin_pullup(1);
-
- sc->sc_keydown = KEY_RELEASE;
-
- printf(": CE-RH2 remote control\n");
-
- a.console = 0;
- a.keymap = &zrc_keymapdata;
- a.accessops = &zrc_accessops;
- a.accesscookie = sc;
-
- sc->sc_wskbddev = config_found(self, &a, wskbddevprint);
-}
-
-int
-zrc_intr(void *v)
-{
- struct zrc_softc *sc = v;
-
- /* just return if remote control isn't present */
-
- pxa2x0_gpio_intr_mask(sc->sc_ih);
- scoop_akin_pullup(0);
- sc->sc_key = zrc_scan();
- sc->sc_scans = 0;
- sc->sc_noise = 0;
- timeout_add(&sc->sc_to, RESCAN_INTERVAL);
- return (1);
-}
-
-void
-zrc_timeout(void *v)
-{
- struct zrc_softc *sc = v;
- int key;
-
- key = zrc_scan();
- switch (sc->sc_scans) {
- case 0:
- case 1:
- case 2:
- /* wait for a stable read */
- if (sc->sc_key == key)
- sc->sc_scans++;
- else {
- sc->sc_key = key;
- sc->sc_scans = 0;
- sc->sc_noise++;
- }
- timeout_add(&sc->sc_to, RESCAN_INTERVAL);
- break;
- case 3:
- /* generate key press event */
- if (sc->sc_key != key) {
- key = sc->sc_key;
- sc->sc_noise++;
- }
- sc->sc_scans++;
- switch (key) {
- case KEY_EARPHONE:
- case KEY_RELEASE:
- sc->sc_scans = 6;
- break;
- default:
-#ifdef DEBUG
- printf("%s pressed (%d noise)\n", zrc_keyname[key],
- sc->sc_noise);
-#endif
- sc->sc_keydown = key;
- sc->sc_noise = 0;
- zrc_input(sc, key, 1);
- break;
- }
- timeout_add(&sc->sc_to, RESCAN_INTERVAL);
- break;
- case 4:
- case 5:
- /* wait for key release, permit noise */
- if (sc->sc_key == key) {
- if (sc->sc_scans == 5)
- sc->sc_noise++;
- sc->sc_scans = 4;
- } else
- sc->sc_scans++;
- timeout_add(&sc->sc_to, RESCAN_INTERVAL);
- break;
- case 6:
- /* generate key release event */
- if (sc->sc_keydown != KEY_RELEASE) {
- zrc_input(sc, sc->sc_keydown, 0);
-#ifdef DEBUG
- printf("%s released (%d noise)\n",
- zrc_keyname[sc->sc_keydown], sc->sc_noise);
-#endif
- sc->sc_keydown = KEY_RELEASE;
- }
- /* FALLTHROUGH */
- default:
- /* unmask interrupt again */
- timeout_del(&sc->sc_to);
- sc->sc_scans = 7;
- scoop_akin_pullup(1);
- pxa2x0_gpio_intr_unmask(sc->sc_ih);
- }
-}
-
-int
-zrc_scan(void)
-{
- int val;
- int i;
-
-/* XXX MAX1111 command word - also appears in zaurus_apm.c */
-#define MAXCTRL_PD0 (1<<0)
-#define MAXCTRL_PD1 (1<<1)
-#define MAXCTRL_SGL (1<<2)
-#define MAXCTRL_UNI (1<<3)
-#define MAXCTRL_SEL_SHIFT 4
-#define MAXCTRL_STR (1<<7)
-
-#define C3000_ADCCH_ZRC 0
- val = zssp_read_max1111(MAXCTRL_PD0 | MAXCTRL_PD1 | MAXCTRL_SGL |
- MAXCTRL_UNI | (C3000_ADCCH_ZRC << MAXCTRL_SEL_SHIFT) |
- MAXCTRL_STR);
- for (i = 0; zrc_akeytab[i].min != INT_MIN; i++)
- if (val >= zrc_akeytab[i].min)
- break;
- return (zrc_akeytab[i].key);
-}
-
-void
-zrc_input(struct zrc_softc *sc, int key, int down)
-{
- u_int type = down ? WSCONS_EVENT_KEY_DOWN : WSCONS_EVENT_KEY_UP;
- int s;
-
- s = spltty();
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- if (sc->sc_rawkbd) {
- int c;
- u_char cbuf[2];
- int ncbuf = 0;
-
- c = zrc_xt_keymap[key];
- if (c & 0x80)
- cbuf[ncbuf++] = 0xe0;
- cbuf[ncbuf] = c & 0x7f;
-
- if (!down)
- cbuf[ncbuf] |= 0x80;
- ncbuf++;
-
- wskbd_rawinput(sc->sc_wskbddev, cbuf, ncbuf);
- } else
-#endif
- wskbd_input(sc->sc_wskbddev, type, key);
-
- splx(s);
-}
-
-int
-zrc_enable(void *v, int on)
-{
- return (0);
-}
-
-void
-zrc_set_leds(void *v, int on)
-{
-}
-
-int
-zrc_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- struct zrc_softc *sc = v;
-#endif
-
- switch (cmd) {
- case WSKBDIO_GTYPE:
- *(int *)data = WSKBD_TYPE_ZAURUS;
- return (0);
- case WSKBDIO_SETLEDS:
- return (0);
- case WSKBDIO_GETLEDS:
- *(int *)data = 0;
- return (0);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- case WSKBDIO_SETMODE:
- sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
- return (0);
-#endif
- }
- return (-1);
-}
diff --git a/sys/arch/zaurus/dev/zaurus_scoop.c b/sys/arch/zaurus/dev/zaurus_scoop.c
deleted file mode 100644
index f14c644c22d..00000000000
--- a/sys/arch/zaurus/dev/zaurus_scoop.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/* $OpenBSD: zaurus_scoop.c,v 1.21 2010/09/07 16:21:41 deraadt Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/disk.h>
-#include <sys/timeout.h>
-#include <sys/gpio.h>
-
-#include <machine/bus.h>
-
-#include <arm/xscale/pxa2x0var.h>
-
-#include <machine/machine_reg.h>
-#include <machine/zaurus_var.h>
-
-#include <zaurus/dev/zaurus_scoopreg.h>
-#include <zaurus/dev/zaurus_scoopvar.h>
-
-struct scoop_softc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- u_int16_t sc_gpwr; /* GPIO state before suspend */
- int sc_suspended;
-};
-
-int scoopmatch(struct device *, void *, void *);
-void scoopattach(struct device *, struct device *, void *);
-int scoop_activate(struct device *, int);
-
-struct cfattach scoop_ca = {
- sizeof (struct scoop_softc), scoopmatch, scoopattach, NULL,
- scoop_activate
-};
-
-struct cfdriver scoop_cd = {
- NULL, "scoop", DV_DULL
-};
-
-enum card {
- SD_CARD,
- CF_CARD /* socket 0 (external) */
-};
-
-int scoop_gpio_pin_read(struct scoop_softc *sc, int);
-void scoop_gpio_pin_write(struct scoop_softc *sc, int, int);
-void scoop_gpio_pin_ctl(struct scoop_softc *sc, int, int);
-void scoop0_set_card_power(enum card, int);
-
-struct timeout scoop_checkdisk;
-void scoop_timeout(void *);
-
-int
-scoopmatch(struct device *parent, void *match, void *aux)
-{
- struct cfdata *cf = match;
-
- /*
- * Only C3000-like models are known to have two SCOOPs.
- */
- if (ZAURUS_ISC3000)
- return (cf->cf_unit < 2);
-
- return (cf->cf_unit == 0);
-}
-
-void
-scoopattach(struct device *parent, struct device *self, void *aux)
-{
- struct pxaip_attach_args *pxa = aux;
- struct scoop_softc *sc = (struct scoop_softc *)self;
- bus_addr_t addr;
- bus_size_t size;
-
- sc->sc_iot = pxa->pxa_iot;
-
- if (pxa->pxa_addr != -1)
- addr = pxa->pxa_addr;
- else if (sc->sc_dev.dv_unit == 0)
- addr = C3000_SCOOP0_BASE;
- else
- addr = C3000_SCOOP1_BASE;
-
- size = pxa->pxa_size < SCOOP_SIZE ? SCOOP_SIZE : pxa->pxa_size;
-
- if (bus_space_map(sc->sc_iot, addr, size, 0, &sc->sc_ioh) != 0) {
- printf(": failed to map %s\n", sc->sc_dev.dv_xname);
- return;
- }
-
- if (ZAURUS_ISC3000 && sc->sc_dev.dv_unit == 1) {
- scoop_gpio_pin_ctl(sc, SCOOP1_AKIN_PULLUP, GPIO_PIN_OUTPUT);
- scoop_gpio_pin_write(sc, SCOOP1_AKIN_PULLUP, GPIO_PIN_LOW);
- } else if (!ZAURUS_ISC3000) {
- scoop_gpio_pin_ctl(sc, SCOOP0_AKIN_PULLUP, GPIO_PIN_OUTPUT);
- scoop_gpio_pin_write(sc, SCOOP0_AKIN_PULLUP, GPIO_PIN_LOW);
- }
-
- if (sc->sc_dev.dv_unit == 0)
- timeout_set(&scoop_checkdisk, scoop_timeout, sc);
-
- printf(": PCMCIA/GPIO controller\n");
-}
-
-int
-scoop_gpio_pin_read(struct scoop_softc *sc, int pin)
-{
- u_int16_t rv;
- u_int16_t bit = (1 << pin);
-
- rv = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR);
- return (rv & bit) != 0 ? 1 : 0;
-}
-
-void
-scoop_gpio_pin_write(struct scoop_softc *sc, int pin, int level)
-{
- u_int16_t rv;
- u_int16_t bit = (1 << pin);
- int s;
-
- s = splhigh();
- rv = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR);
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
- level == GPIO_PIN_LOW ? (rv & ~bit) : (rv | bit));
- splx(s);
-}
-
-void
-scoop_gpio_pin_ctl(struct scoop_softc *sc, int pin, int flags)
-{
- u_int16_t rv;
- u_int16_t bit = (1 << pin);
-
- rv = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPCR);
- switch (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) {
- case GPIO_PIN_INPUT:
- rv &= ~bit;
- break;
- case GPIO_PIN_OUTPUT:
- rv |= bit;
- break;
- }
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPCR, rv);
-}
-
-/*
- * Turn the LCD background light and contrast signal on or off.
- */
-void
-scoop_set_backlight(int on, int cont)
-{
-
- if (scoop_cd.cd_ndevs > 1 && scoop_cd.cd_devs[1] != NULL) {
- /* C3000 */
- scoop_gpio_pin_write(scoop_cd.cd_devs[1],
- SCOOP1_BACKLIGHT_CONT, !cont);
- scoop_gpio_pin_write(scoop_cd.cd_devs[1],
- SCOOP1_BACKLIGHT_ON, on);
- }
-#if 0
- else if (scoop_cd.cd_ndevs > 0 && scoop_cd.cd_devs[0] != NULL) {
- scoop_gpio_pin_write(scoop_cd.cd_devs[0],
- SCOOP0_BACKLIGHT_CONT, cont);
- }
-#endif
-}
-
-/*
- * Turn the infrared LED on or off (must be on while transmitting).
- */
-void
-scoop_set_irled(int on)
-{
- if (scoop_cd.cd_ndevs > 1 && scoop_cd.cd_devs[1] != NULL)
- /* IR_ON is inverted */
- scoop_gpio_pin_write(scoop_cd.cd_devs[1],
- SCOOP1_IR_ON, !on);
-}
-
-/*
- * Turn the green and orange LEDs on or off. If the orange LED is on,
- * then it is wired to indicate if A/C is connected. The green LED has
- * no such predefined function.
- */
-void
-scoop_led_set(int led, int on)
-{
-
- if (scoop_cd.cd_ndevs > 0 && scoop_cd.cd_devs[0] != NULL) {
- if ((led & SCOOP_LED_GREEN) != 0)
- scoop_gpio_pin_write(scoop_cd.cd_devs[0],
- SCOOP0_LED_GREEN, on);
- if (scoop_cd.cd_ndevs > 1 && (led & SCOOP_LED_ORANGE) != 0)
- scoop_gpio_pin_write(scoop_cd.cd_devs[0],
- SCOOP0_LED_ORANGE_C3000, on);
- }
-}
-
-/*
- * Enable or disable the headphone output connection.
- */
-void
-scoop_set_headphone(int on)
-{
- if (scoop_cd.cd_ndevs < 1 || scoop_cd.cd_devs[0] == NULL)
- return;
-
- scoop_gpio_pin_ctl(scoop_cd.cd_devs[0], SCOOP0_MUTE_L,
- GPIO_PIN_OUTPUT);
- scoop_gpio_pin_ctl(scoop_cd.cd_devs[0], SCOOP0_MUTE_R,
- GPIO_PIN_OUTPUT);
-
- if (on) {
- scoop_gpio_pin_write(scoop_cd.cd_devs[0], SCOOP0_MUTE_L,
- GPIO_PIN_HIGH);
- scoop_gpio_pin_write(scoop_cd.cd_devs[0], SCOOP0_MUTE_R,
- GPIO_PIN_HIGH);
- } else {
- scoop_gpio_pin_write(scoop_cd.cd_devs[0], SCOOP0_MUTE_L,
- GPIO_PIN_LOW);
- scoop_gpio_pin_write(scoop_cd.cd_devs[0], SCOOP0_MUTE_R,
- GPIO_PIN_LOW);
- }
-}
-
-/*
- * Enable or disable 3.3V power to the SD/MMC card slot.
- */
-void
-scoop_set_sdmmc_power(int on)
-{
- scoop0_set_card_power(SD_CARD, on ? SCP_CPR_SD_3V : SCP_CPR_OFF);
-}
-
-/*
- * The Card Power Register of the first SCOOP unit controls the power
- * for the first CompactFlash slot and the SD/MMC card slot as well.
- */
-void
-scoop0_set_card_power(enum card slot, int new_cpr)
-{
- struct scoop_softc *sc = scoop_cd.cd_devs[0];
- u_int16_t cpr;
-
- cpr = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_CPR);
- if (new_cpr & SCP_CPR_VOLTAGE_MSK) {
- if (slot == CF_CARD)
- cpr |= SCP_CPR_5V;
- else if (slot == SD_CARD)
- cpr |= SCP_CPR_SD_3V;
-
- scoop_gpio_pin_write(sc, SCOOP0_CF_POWER_C3000, 1);
- if (!ISSET(cpr, SCP_CPR_5V) && !ISSET(cpr, SCP_CPR_SD_3V))
- delay(5000);
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_CPR,
- cpr | new_cpr);
- } else {
- if (slot == CF_CARD)
- cpr &= ~SCP_CPR_5V;
- else if (slot == SD_CARD)
- cpr &= ~SCP_CPR_SD_3V;
-
- if (!ISSET(cpr, SCP_CPR_5V) && !ISSET(cpr, SCP_CPR_SD_3V)) {
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_CPR,
- SCP_CPR_OFF);
- delay(1000);
- scoop_gpio_pin_write(sc, SCOOP0_CF_POWER_C3000, 0);
- } else
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_CPR,
- cpr | new_cpr);
- }
-}
-
-/*
- * Turn on pullup resistor while not reading the remote control.
- */
-void
-scoop_akin_pullup(int enable)
-{
- if (scoop_cd.cd_ndevs > 1 && scoop_cd.cd_devs[1] != NULL)
- scoop_gpio_pin_write(scoop_cd.cd_devs[1],
- SCOOP1_AKIN_PULLUP, enable);
- else
- scoop_gpio_pin_write(scoop_cd.cd_devs[0],
- SCOOP0_AKIN_PULLUP, enable);
-}
-
-void
-scoop_battery_temp_adc(int enable)
-{
-
- if (scoop_cd.cd_ndevs > 0 && scoop_cd.cd_devs[0] != NULL)
- scoop_gpio_pin_write(scoop_cd.cd_devs[0],
- SCOOP0_ADC_TEMP_ON_C3000, enable);
-}
-
-void
-scoop_charge_battery(int enable, int voltage_high)
-{
-
- if (scoop_cd.cd_ndevs > 0 && scoop_cd.cd_devs[0] != NULL) {
- scoop_gpio_pin_write(scoop_cd.cd_devs[0],
- SCOOP0_JK_B_C3000, voltage_high);
- scoop_gpio_pin_write(scoop_cd.cd_devs[0],
- SCOOP0_CHARGE_OFF_C3000, !enable);
- }
-}
-
-void
-scoop_discharge_battery(int enable)
-{
-
- if (scoop_cd.cd_ndevs > 0 && scoop_cd.cd_devs[0] != NULL)
- scoop_gpio_pin_write(scoop_cd.cd_devs[0],
- SCOOP0_JK_A_C3000, enable);
-}
-
-/* XXX */
-void scoop_check_mcr(void);
-void
-scoop_check_mcr(void)
-{
- struct scoop_softc *sc;
-
- /* C3000 */
- if (scoop_cd.cd_ndevs > 1 && scoop_cd.cd_devs[1] != NULL) {
-
- sc = scoop_cd.cd_devs[0];
- if ((bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_MCR) &
- 0x100) == 0)
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_MCR,
- 0x0101);
-
- sc = scoop_cd.cd_devs[1];
- if ((bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_MCR) &
- 0x100) == 0)
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_MCR,
- 0x0101);
- }
-}
-
-void
-scoop_suspend(void)
-{
- struct scoop_softc *sc;
- u_int32_t rv;
-
- scoop_check_mcr();
-
- if (scoop_cd.cd_ndevs > 0 && scoop_cd.cd_devs[0] != NULL) {
- sc = scoop_cd.cd_devs[0];
- sc->sc_gpwr = bus_space_read_2(sc->sc_iot, sc->sc_ioh,
- SCOOP_GPWR);
- /* C3000 */
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
- sc->sc_gpwr & ~((1<<SCOOP0_MUTE_L) | (1<<SCOOP0_MUTE_R) |
- (1<<SCOOP0_JK_A_C3000) | (1<<SCOOP0_ADC_TEMP_ON_C3000) |
- (1<<SCOOP0_LED_GREEN)));
- }
-
- /* C3000 */
- if (scoop_cd.cd_ndevs > 1 && scoop_cd.cd_devs[1] != NULL) {
- sc = scoop_cd.cd_devs[1];
- sc->sc_gpwr = bus_space_read_2(sc->sc_iot, sc->sc_ioh,
- SCOOP_GPWR);
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
- sc->sc_gpwr & ~((1<<SCOOP1_RESERVED_4) |
- (1<<SCOOP1_RESERVED_5) | (1<<SCOOP1_RESERVED_6) |
- (1<<SCOOP1_BACKLIGHT_CONT) | (1<<SCOOP1_BACKLIGHT_ON) |
- (1<<SCOOP1_MIC_BIAS)));
- rv = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR);
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
- rv | ((1<<SCOOP1_IR_ON) | (1<<SCOOP1_RESERVED_3)));
- }
-}
-
-void
-scoop_resume(void)
-{
- struct scoop_softc *sc;
-
- scoop_check_mcr();
-
- if (scoop_cd.cd_ndevs > 0 && scoop_cd.cd_devs[0] != NULL) {
- sc = scoop_cd.cd_devs[0];
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
- sc->sc_gpwr);
- }
-
- if (scoop_cd.cd_ndevs > 1 && scoop_cd.cd_devs[1] != NULL) {
- sc = scoop_cd.cd_devs[1];
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
- sc->sc_gpwr);
- }
-}
-
-void
-scoop_timeout(void *v)
-{
- extern struct disklist_head disklist;
- struct scoop_softc *sc = v;
- static struct disk *dk;
- static int state = 0;
-
- if (dk == NULL) {
- TAILQ_FOREACH(dk, &disklist, dk_link) {
- if (dk->dk_name &&
- strcmp(dk->dk_name, "wd0") == 0)
- break;
- }
- }
-
- if (sc->sc_suspended)
- state = -1;
- else if (dk) {
- int newstate = (dk->dk_busy ? 1 : 0);
-
- if (newstate != state) {
- state = newstate;
- scoop_led_set(SCOOP_LED_GREEN, newstate);
- }
- }
- timeout_add(&scoop_checkdisk, hz/25);
-}
-
-int
-scoop_activate(struct device *self, int act)
-{
- struct scoop_softc *sc = (struct scoop_softc *)self;
-
- switch (act) {
- case DVACT_SUSPEND:
- /*
- * Nothing should use the scoop from this point on.
- * No timeouts, no interrupts (even though interrupts
- * are still enabled). scoop_timeout() respects the
- * sc_suspended flag.
- */
- if (sc->sc_dev.dv_unit == 0) {
- sc->sc_suspended = 1;
- scoop_suspend();
- }
- break;
- case DVACT_RESUME:
- if (sc->sc_dev.dv_unit == 0) {
- scoop_resume();
- sc->sc_suspended = 0;
- }
- break;
- }
- return 0;
-}
diff --git a/sys/arch/zaurus/dev/zaurus_scoopreg.h b/sys/arch/zaurus/dev/zaurus_scoopreg.h
deleted file mode 100644
index b5a87619883..00000000000
--- a/sys/arch/zaurus/dev/zaurus_scoopreg.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $OpenBSD: zaurus_scoopreg.h,v 1.8 2007/03/18 20:50:23 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#define SCOOP_SIZE 0x2c
-
-/* registers and values */
-
-#define SCOOP_MCR 0x00
-#define SCP_MCR_IOCARD 0x0010
-#define SCOOP_CDR 0x04 /* card detect register */
-#define SCP_CDR_DETECT 0x0002
-#define SCOOP_CSR 0x08 /* card status register */
-#define SCP_CSR_READY 0x0002
-#define SCP_CSR_MISSING 0x0004
-#define SCP_CSR_WPROT 0x0008
-#define SCP_CSR_BVD1 0x0010
-#define SCP_CSR_BVD2 0x0020
-#define SCP_CSR_3V 0x0040
-#define SCP_CSR_PWR 0x0080
-#define SCOOP_CPR 0x0c /* card power register */
-#define SCP_CPR_OFF 0x0000
-#define SCP_CPR_3V 0x0001 /* 3V for CF card */
-#define SCP_CPR_5V 0x0002 /* 5V for CF card */
-#define SCP_CPR_SD_3V 0x0004 /* 3.3V for SD/MMC card */
-#define SCP_CPR_VOLTAGE_MSK 0x0007
-#define SCP_CPR_PWR 0x0080
-#define SCOOP_CCR 0x10 /* card control register */
-#define SCP_CCR_RESET 0x0080
-#define SCOOP_IRR 0x14 /* XXX for pcic: bit 0x4 role is? */
-#define SCOOP_IRM 0x14
-#define SCOOP_IMR 0x18
-#define SCP_IMR_READY 0x0002
-#define SCP_IMR_DETECT 0x0004
-#define SCP_IMR_WRPROT 0x0008
-#define SCP_IMR_STSCHG 0x0010
-#define SCP_IMR_BATWARN 0x0020
-#define SCP_IMR_UNKN0 0x0040
-#define SCP_IMR_UNKN1 0x0080
-#define SCOOP_ISR 0x1c
-#define SCOOP_GPCR 0x20 /* GPIO pin direction (R/W) */
-#define SCOOP_GPWR 0x24 /* GPIO pin output level (R/W) */
-#define SCOOP_GPRR 0x28 /* GPIO pin input level (R) */
-
-/* GPIO bits */
-
-#define SCOOP0_LED_GREEN 1
-#define SCOOP0_JK_B_C3000 2
-#define SCOOP0_CHARGE_OFF_C3000 3
-#define SCOOP0_MUTE_L 4
-#define SCOOP0_MUTE_R 5
-#define SCOOP0_AKIN_PULLUP 6
-#define SCOOP0_CF_POWER_C3000 6
-#define SCOOP0_APM_ON 7
-#define SCOOP0_LED_ORANGE_C3000 7
-#define SCOOP0_BACKLIGHT_CONT 8
-#define SCOOP0_JK_A_C3000 8
-#define SCOOP0_MIC_BIAS 9
-#define SCOOP0_ADC_TEMP_ON_C3000 9
-
-#define SCOOP1_IR_ON 1
-#define SCOOP1_AKIN_PULLUP 2
-#define SCOOP1_RESERVED_3 3
-#define SCOOP1_RESERVED_4 4
-#define SCOOP1_RESERVED_5 5
-#define SCOOP1_RESERVED_6 6
-#define SCOOP1_BACKLIGHT_CONT 7
-#define SCOOP1_BACKLIGHT_ON 8
-#define SCOOP1_MIC_BIAS 9
diff --git a/sys/arch/zaurus/dev/zaurus_scoopvar.h b/sys/arch/zaurus/dev/zaurus_scoopvar.h
deleted file mode 100644
index 2f5d1c78851..00000000000
--- a/sys/arch/zaurus/dev/zaurus_scoopvar.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $OpenBSD: zaurus_scoopvar.h,v 1.11 2007/03/18 20:50:23 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#define SCOOP_LED_GREEN (1<<0)
-#define SCOOP_LED_ORANGE (1<<1)
-
-void scoop_set_backlight(int, int);
-void scoop_set_irled(int);
-void scoop_led_set(int, int);
-void scoop_battery_temp_adc(int);
-void scoop_charge_battery(int, int);
-void scoop_discharge_battery(int);
-void scoop_check_mcr(void);
-void scoop_set_headphone(int);
-void scoop_set_sdmmc_power(int);
-void scoop_akin_pullup(int);
-void scoop_suspend(void);
-void scoop_resume(void);
diff --git a/sys/arch/zaurus/dev/zaurus_ssp.c b/sys/arch/zaurus/dev/zaurus_ssp.c
deleted file mode 100644
index 31282237ae2..00000000000
--- a/sys/arch/zaurus/dev/zaurus_ssp.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/* $OpenBSD: zaurus_ssp.c,v 1.8 2010/09/07 16:21:41 deraadt Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-#include <zaurus/dev/zaurus_sspvar.h>
-
-#define GPIO_ADS7846_CS_C3000 14 /* SSP SFRM */
-#define GPIO_MAX1111_CS_C3000 20
-#define GPIO_TG_CS_C3000 53
-
-#define SSCR0_ADS7846_C3000 0x06ab
-#define SSCR0_LZ9JG18 0x01ab
-#define SSCR0_MAX1111 0x0387
-
-struct zssp_softc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
-};
-
-int zssp_match(struct device *, void *, void *);
-void zssp_attach(struct device *, struct device *, void *);
-void zssp_init(void);
-int zssp_activate(struct device *, int);
-
-int zssp_read_max1111(u_int32_t);
-u_int32_t zssp_read_ads7846(u_int32_t);
-void zssp_write_lz9jg18(u_int32_t);
-
-struct cfattach zssp_ca = {
- sizeof (struct zssp_softc), zssp_match, zssp_attach, NULL,
- zssp_activate
-};
-
-struct cfdriver zssp_cd = {
- NULL, "zssp", DV_DULL
-};
-
-int
-zssp_match(struct device *parent, void *match, void *aux)
-{
- return 1;
-}
-
-void
-zssp_attach(struct device *parent, struct device *self, void *aux)
-{
- struct zssp_softc *sc = (struct zssp_softc *)self;
-
- sc->sc_iot = &pxa2x0_bs_tag;
- if (bus_space_map(sc->sc_iot, PXA2X0_SSP1_BASE, PXA2X0_SSP_SIZE,
- 0, &sc->sc_ioh)) {
- printf(": can't map bus space\n");
- return;
- }
-
- printf("\n");
-
- zssp_init();
-}
-
-/*
- * Initialize the dedicated SSP unit and disable all chip selects.
- * This function is called with interrupts disabled.
- */
-void
-zssp_init(void)
-{
- struct zssp_softc *sc;
-
- KASSERT(zssp_cd.cd_ndevs > 0 && zssp_cd.cd_devs[0] != NULL);
- sc = (struct zssp_softc *)zssp_cd.cd_devs[0];
-
- pxa2x0_clkman_config(CKEN_SSP, 1);
-
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, SSCR0_LZ9JG18);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR1, 0);
-
- pxa2x0_gpio_set_function(GPIO_ADS7846_CS_C3000, GPIO_OUT|GPIO_SET);
- pxa2x0_gpio_set_function(GPIO_MAX1111_CS_C3000, GPIO_OUT|GPIO_SET);
- pxa2x0_gpio_set_function(GPIO_TG_CS_C3000, GPIO_OUT|GPIO_SET);
-}
-
-int
-zssp_activate(struct device *self, int act)
-{
- switch (act) {
- case DVACT_SUSPEND:
- break;
- case DVACT_RESUME:
- zssp_init();
- break;
- }
- return 0;
-}
-
-/*
- * Transmit a single data word to one of the ICs, keep the chip selected
- * afterwards, and don't wait for data to be returned in SSDR. Interrupts
- * must be held off until zssp_ic_stop() gets called.
- */
-void
-zssp_ic_start(int ic, u_int32_t data)
-{
- struct zssp_softc *sc;
-
- KASSERT(zssp_cd.cd_ndevs > 0 && zssp_cd.cd_devs[0] != NULL);
- sc = (struct zssp_softc *)zssp_cd.cd_devs[0];
-
- /* disable other ICs */
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, 0);
- if (ic != ZSSP_IC_ADS7846)
- pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000);
- if (ic != ZSSP_IC_LZ9JG18)
- pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000);
- if (ic != ZSSP_IC_MAX1111)
- pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000);
-
- /* activate the chosen one */
- switch (ic) {
- case ZSSP_IC_ADS7846:
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0,
- SSCR0_ADS7846_C3000);
- pxa2x0_gpio_clear_bit(GPIO_ADS7846_CS_C3000);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR, data);
- while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR)
- & SSSR_TNF) != SSSR_TNF)
- /* poll */;
- break;
- case ZSSP_IC_LZ9JG18:
- pxa2x0_gpio_clear_bit(GPIO_TG_CS_C3000);
- break;
- case ZSSP_IC_MAX1111:
- pxa2x0_gpio_clear_bit(GPIO_MAX1111_CS_C3000);
- break;
- }
-}
-
-/*
- * Read the last value from SSDR and deactivate all chip-selects.
- */
-u_int32_t
-zssp_ic_stop(int ic)
-{
- struct zssp_softc *sc;
- u_int32_t rv;
-
- KASSERT(zssp_cd.cd_ndevs > 0 && zssp_cd.cd_devs[0] != NULL);
- sc = (struct zssp_softc *)zssp_cd.cd_devs[0];
-
- switch (ic) {
- case ZSSP_IC_ADS7846:
- /* read result of last command */
- while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR)
- & SSSR_RNE) != SSSR_RNE)
- /* poll */;
- rv = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR);
- break;
- case ZSSP_IC_LZ9JG18:
- case ZSSP_IC_MAX1111:
- /* last value received is irrelevant or undefined */
- default:
- rv = 0;
- break;
- }
-
- pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000);
- pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000);
- pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000);
-
- return (rv);
-}
-
-/*
- * Activate one of the chip-select lines, transmit one word value in
- * each direction, and deactivate the chip-select again.
- */
-u_int32_t
-zssp_ic_send(int ic, u_int32_t data)
-{
-
- switch (ic) {
- case ZSSP_IC_MAX1111:
- return (zssp_read_max1111(data));
- case ZSSP_IC_ADS7846:
- return (zssp_read_ads7846(data));
- case ZSSP_IC_LZ9JG18:
- zssp_write_lz9jg18(data);
- return 0;
- default:
- printf("zssp_ic_send: invalid IC %d\n", ic);
- return 0;
- }
-}
-
-int
-zssp_read_max1111(u_int32_t cmd)
-{
- struct zssp_softc *sc;
- int voltage[2];
- int i;
- int s;
-
- KASSERT(zssp_cd.cd_ndevs > 0 && zssp_cd.cd_devs[0] != NULL);
- sc = (struct zssp_softc *)zssp_cd.cd_devs[0];
-
- s = splhigh();
-
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, 0);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, SSCR0_MAX1111);
-
- pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000);
- pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000);
- pxa2x0_gpio_clear_bit(GPIO_MAX1111_CS_C3000);
-
- delay(1);
-
- /* Send the command word and read a dummy word back. */
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR, cmd);
- while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR)
- & SSSR_TNF) != SSSR_TNF)
- /* poll */;
- /* XXX is this delay necessary? */
- delay(1);
- while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR)
- & SSSR_RNE) != SSSR_RNE)
- /* poll */;
- i = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR);
-
- for (i = 0; i < 2; i++) {
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR, 0);
- while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR)
- & SSSR_TNF) != SSSR_TNF)
- /* poll */;
- /* XXX again, is this delay necessary? */
- delay(1);
- while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR)
- & SSSR_RNE) != SSSR_RNE)
- /* poll */;
- voltage[i] = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- SSP_SSDR);
- }
-
- pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000);
- pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000);
- pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000);
-
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, 0);
-
- /* XXX no idea what this means, but it's what Linux would do. */
- if ((voltage[0] & 0xc0) != 0 || (voltage[1] & 0x3f) != 0)
- voltage[0] = -1;
- else
- voltage[0] = ((voltage[0] << 2) & 0xfc) |
- ((voltage[1] >> 6) & 0x03);
-
- splx(s);
- return voltage[0];
-}
-
-/* XXX - only does CS_ADS7846 */
-u_int32_t
-zssp_read_ads7846(u_int32_t cmd)
-{
- struct zssp_softc *sc;
-
- sc = (struct zssp_softc *)zssp_cd.cd_devs[0];
- unsigned int cr0;
- int s;
- u_int32_t val;
-
- if (zssp_cd.cd_ndevs < 1 || zssp_cd.cd_devs[0] == NULL) {
- printf("zssp_read_ads7846: not configured\n");
- return 0;
- }
- sc = (struct zssp_softc *)zssp_cd.cd_devs[0];
-
- s = splhigh();
- if (1) {
- cr0 = SSCR0_ADS7846_C3000;
- } else {
- cr0 = 0x00ab;
- }
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, 0);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, cr0);
-
- pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000);
- pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000);
- pxa2x0_gpio_clear_bit(GPIO_ADS7846_CS_C3000);
-
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR, cmd);
-
- while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR)
- & SSSR_TNF) != SSSR_TNF)
- /* poll */;
-
- delay(1);
-
- while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR)
- & SSSR_RNE) != SSSR_RNE)
- /* poll */;
-
- val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR);
-
- pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000); /* deselect */
-
- splx(s);
-
- return val;
-}
-
-void
-zssp_write_lz9jg18(u_int32_t data)
-{
- int s;
- int sclk_pin, sclk_fn;
- int sfrm_pin, sfrm_fn;
- int txd_pin, txd_fn;
- int rxd_pin, rxd_fn;
- int i;
-
- /* XXX this creates a DAC command from a backlight duty value. */
- data = 0x40 | (data & 0x1f);
-
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA27X) {
- /* C3000 */
- sclk_pin = 19;
- sfrm_pin = 14;
- txd_pin = 87;
- rxd_pin = 86;
- } else {
- sclk_pin = 23;
- sfrm_pin = 24;
- txd_pin = 25;
- rxd_pin = 26;
- }
-
- s = splhigh();
-
- sclk_fn = pxa2x0_gpio_get_function(sclk_pin);
- sfrm_fn = pxa2x0_gpio_get_function(sfrm_pin);
- txd_fn = pxa2x0_gpio_get_function(txd_pin);
- rxd_fn = pxa2x0_gpio_get_function(rxd_pin);
-
- pxa2x0_gpio_set_function(sfrm_pin, GPIO_OUT | GPIO_SET);
- pxa2x0_gpio_set_function(sclk_pin, GPIO_OUT | GPIO_CLR);
- pxa2x0_gpio_set_function(txd_pin, GPIO_OUT | GPIO_CLR);
- pxa2x0_gpio_set_function(rxd_pin, GPIO_IN);
-
- pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000);
- pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000);
- pxa2x0_gpio_clear_bit(GPIO_TG_CS_C3000);
-
- delay(10);
-
- for (i = 0; i < 8; i++) {
- if (data & 0x80)
- pxa2x0_gpio_set_bit(txd_pin);
- else
- pxa2x0_gpio_clear_bit(txd_pin);
- delay(10);
- pxa2x0_gpio_set_bit(sclk_pin);
- delay(10);
- pxa2x0_gpio_clear_bit(sclk_pin);
- delay(10);
- data <<= 1;
- }
-
- pxa2x0_gpio_clear_bit(txd_pin);
- pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000);
-
- pxa2x0_gpio_set_function(sclk_pin, sclk_fn);
- pxa2x0_gpio_set_function(sfrm_pin, sfrm_fn);
- pxa2x0_gpio_set_function(txd_pin, txd_fn);
- pxa2x0_gpio_set_function(rxd_pin, rxd_fn);
-
- splx(s);
-}
diff --git a/sys/arch/zaurus/dev/zaurus_sspvar.h b/sys/arch/zaurus/dev/zaurus_sspvar.h
deleted file mode 100644
index 9bb4a36d28f..00000000000
--- a/sys/arch/zaurus/dev/zaurus_sspvar.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $OpenBSD: zaurus_sspvar.h,v 1.3 2005/04/08 21:58:49 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#define ZSSP_IC_MAX1111 1 /* temperature/voltage ADC */
-#define ZSSP_IC_LZ9JG18 2 /* LCD backlight controller */
-#define ZSSP_IC_ADS7846 3 /* touch screen controller */
-
-void zssp_ic_start(int, u_int32_t);
-u_int32_t zssp_ic_send(int, u_int32_t);
-u_int32_t zssp_ic_stop(int);
-
-int zssp_read_max1111(u_int32_t);
-void zssp_write_lz9jg18(u_int32_t);
diff --git a/sys/arch/zaurus/dev/zaurus_udc.c b/sys/arch/zaurus/dev/zaurus_udc.c
deleted file mode 100644
index 7c2f7558b91..00000000000
--- a/sys/arch/zaurus/dev/zaurus_udc.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* $OpenBSD: zaurus_udc.c,v 1.3 2013/10/24 22:40:10 aalm Exp $ */
-/*
- * Copyright (c) 2009 Marek Vasut <marex@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Attachment driver for pxaudc(4) on Zaurus */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/timeout.h>
-
-#include <dev/sdmmc/sdmmcreg.h>
-#include <machine/machine_reg.h>
-#include <machine/zaurus_var.h>
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdivar.h>
-#include <dev/usb/usbf.h>
-#include <dev/usb/usbfvar.h>
-
-#include <arch/arm/xscale/pxa2x0_gpio.h>
-#include <arch/arm/xscale/pxa27x_udc.h>
-
-int zaurus_udc_match(struct device *, void *, void *);
-void zaurus_udc_attach(struct device *, struct device *, void *);
-int zaurus_udc_detach(struct device *, int);
-int zaurus_udc_activate(struct device *, int);
-int zaurus_udc_is_host(void);
-
-struct cfattach pxaudc_zaurus_ca = {
- sizeof(struct pxaudc_softc),
- zaurus_udc_match,
- zaurus_udc_attach,
- zaurus_udc_detach,
- zaurus_udc_activate
-};
-
-int
-zaurus_udc_match(struct device *parent, void *match, void *aux)
-{
- return pxaudc_match();
-}
-
-int
-zaurus_udc_is_host(void)
-{
- return !(pxa2x0_gpio_get_bit(GPIO_USB_DETECT) ||
- pxa2x0_gpio_get_bit(GPIO_USB_DEVICE));
-}
-
-void
-zaurus_udc_attach(struct device *parent, struct device *self, void *aux)
-{
- struct pxaudc_softc *sc = (struct pxaudc_softc *)self;
-
-
- sc->sc_gpio_detect = GPIO_USB_DETECT;
- sc->sc_gpio_pullup = GPIO_USB_PULLUP;
- sc->sc_gpio_pullup_inv = 0;
- sc->sc_is_host = zaurus_udc_is_host;
-
- /* Platform specific GPIO configuration */
- pxa2x0_gpio_set_function(GPIO_USB_DETECT, GPIO_IN);
- pxa2x0_gpio_set_function(GPIO_USB_DEVICE, GPIO_IN);
- pxa2x0_gpio_set_function(GPIO_USB_PULLUP, GPIO_OUT);
-
- pxa2x0_gpio_set_function(45, GPIO_OUT);
- pxa2x0_gpio_set_function(40, GPIO_OUT);
- pxa2x0_gpio_set_function(39, GPIO_IN);
- pxa2x0_gpio_set_function(38, GPIO_IN);
- pxa2x0_gpio_set_function(37, GPIO_OUT);
- pxa2x0_gpio_set_function(36, GPIO_IN);
- pxa2x0_gpio_set_function(34, GPIO_IN);
- pxa2x0_gpio_set_function(89, GPIO_OUT);
- pxa2x0_gpio_set_function(120, GPIO_OUT);
-
- pxaudc_attach(sc, aux);
-}
-
-int
-zaurus_udc_detach(struct device *self, int flags)
-{
- struct pxaudc_softc *sc = (struct pxaudc_softc *)self;
-
- return pxaudc_detach(sc, flags);
-}
-
-int
-zaurus_udc_activate(struct device *self, int act)
-{
- struct pxaudc_softc *sc = (struct pxaudc_softc *)self;
-
- return pxaudc_activate(sc, act);
-}
diff --git a/sys/arch/zaurus/dev/zts.c b/sys/arch/zaurus/dev/zts.c
deleted file mode 100644
index 7cf51ebeceb..00000000000
--- a/sys/arch/zaurus/dev/zts.c
+++ /dev/null
@@ -1,610 +0,0 @@
-/* $OpenBSD: zts.c,v 1.17 2016/06/05 20:15:54 bru Exp $ */
-/*
- * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/timeout.h>
-#include <sys/kernel.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-
-#include <zaurus/dev/zaurus_sspvar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsmousevar.h>
-
-#include <dev/wscons/wsdisplayvar.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_lcd.h>
-
-#ifdef ZTS_DEBUG
-#define DPRINTF(x) do { printf x; } while (0)
-#else
-#define DPRINTF(x)
-#endif
-
-/*
- * ADS784x touch screen controller
- */
-#define ADSCTRL_PD0_SH 0 /* PD0 bit */
-#define ADSCTRL_PD1_SH 1 /* PD1 bit */
-#define ADSCTRL_DFR_SH 2 /* SER/DFR bit */
-#define ADSCTRL_MOD_SH 3 /* Mode bit */
-#define ADSCTRL_ADR_SH 4 /* Address setting */
-#define ADSCTRL_STS_SH 7 /* Start bit */
-
-#define GPIO_TP_INT_C3K 11
-#define GPIO_HSYNC_C3K 22
-
-#define POLL_TIMEOUT_RATE0 ((hz * 150)/1000)
-#define POLL_TIMEOUT_RATE1 (hz / 100) /* XXX every tick */
-
-#define CCNT_HS_400_VGA_C3K 6250 /* 15.024us */
-
-struct tsscale {
- int minx, maxx;
- int miny, maxy;
- int swapxy;
- int resx, resy;
-} zts_scale = {
- /* C3000 */
- 209, 3620, 312, 3780, 0, 640, 480
-};
-
-int zts_match(struct device *, void *, void *);
-void zts_attach(struct device *, struct device *, void *);
-int zts_activate(struct device *, int);
-int zts_enable(void *);
-void zts_disable(void *);
-void zts_poll(void *);
-int zts_irq(void *);
-int zts_ioctl(void *, u_long, caddr_t, int, struct proc *);
-
-struct zts_softc {
- struct device sc_dev;
- struct timeout sc_ts_poll;
- void *sc_gh;
- int sc_enabled;
- int sc_running;
- int sc_buttons; /* button emulation ? */
- struct device *sc_wsmousedev;
- int sc_oldx;
- int sc_oldy;
- int sc_rawmode;
-
- struct tsscale sc_tsscale;
-};
-
-struct cfattach zts_ca = {
- sizeof(struct zts_softc), zts_match, zts_attach, NULL,
- zts_activate
-};
-
-struct cfdriver zts_cd = {
- NULL, "zts", DV_DULL
-};
-
-int
-zts_match(struct device *parent, void *cf, void *aux)
-{
- return 1;
-}
-
-const struct wsmouse_accessops zts_accessops = {
- zts_enable,
- zts_ioctl,
- zts_disable
-};
-
-void
-zts_attach(struct device *parent, struct device *self, void *aux)
-{
- struct zts_softc *sc = (struct zts_softc *)self;
- struct wsmousedev_attach_args a;
-
- timeout_set(&sc->sc_ts_poll, zts_poll, sc);
-
- /* Initialize ADS7846 Difference Reference mode */
- (void)zssp_ic_send(ZSSP_IC_ADS7846,
- (1<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH));
- delay(5000);
- (void)zssp_ic_send(ZSSP_IC_ADS7846,
- (3<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH));
- delay(5000);
- (void)zssp_ic_send(ZSSP_IC_ADS7846,
- (4<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH));
- delay(5000);
- (void)zssp_ic_send(ZSSP_IC_ADS7846,
- (5<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH));
- delay(5000);
-
- a.accessops = &zts_accessops;
- a.accesscookie = sc;
- printf("\n");
-
- /* Copy the default scalue values to each softc */
- bcopy(&zts_scale, &sc->sc_tsscale, sizeof(sc->sc_tsscale));
-
- sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint);
-}
-
-int
-zts_enable(void *v)
-{
- struct zts_softc *sc = v;
-
- if (sc->sc_enabled)
- return EBUSY;
-
- timeout_del(&sc->sc_ts_poll);
-
- pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_IN);
-
- /* XXX */
- if (sc->sc_gh == NULL)
- sc->sc_gh = pxa2x0_gpio_intr_establish(GPIO_TP_INT_C3K,
- IST_EDGE_FALLING, IPL_TTY, zts_irq, sc,
- sc->sc_dev.dv_xname);
- else
- pxa2x0_gpio_intr_unmask(sc->sc_gh);
-
- /* enable interrupts */
- sc->sc_enabled = 1;
- sc->sc_running = 1;
- sc->sc_buttons = 0;
-
- return 0;
-}
-
-void
-zts_disable(void *v)
-{
- struct zts_softc *sc = v;
-
- timeout_del(&sc->sc_ts_poll);
-
- if (sc->sc_gh != NULL) {
-#if 0
- pxa2x0_gpio_intr_disestablish(sc->sc_gh);
- sc->sc_gh = NULL;
-#endif
- }
-
- /* disable interrupts */
- sc->sc_enabled = 0;
- sc->sc_running = 0;
-}
-
-int
-zts_activate(struct device *self, int act)
-{
- struct zts_softc *sc = (struct zts_softc *)self;
-
- switch (act) {
- case DVACT_SUSPEND:
- if (sc->sc_enabled == 0)
- break;
- sc->sc_running = 0;
-#if 0
- pxa2x0_gpio_intr_disestablish(sc->sc_gh);
-#endif
- timeout_del(&sc->sc_ts_poll);
-
- pxa2x0_gpio_intr_mask(sc->sc_gh);
-
- /* Turn off reference voltage but leave ADC on. */
- (void)zssp_ic_send(ZSSP_IC_ADS7846, (1 << ADSCTRL_PD1_SH) |
- (1 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH));
-
- pxa2x0_gpio_set_function(GPIO_TP_INT_C3K,
- GPIO_OUT | GPIO_SET);
- break;
-
- case DVACT_RESUME:
- if (sc->sc_enabled == 0)
- break;
- pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_IN);
- pxa2x0_gpio_intr_mask(sc->sc_gh);
-
- /* Enable automatic low power mode. */
- (void)zssp_ic_send(ZSSP_IC_ADS7846,
- (4 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH));
-
-#if 0
- sc->sc_gh = pxa2x0_gpio_intr_establish(GPIO_TP_INT_C3K,
- IST_EDGE_FALLING, IPL_TTY, zts_irq, sc,
- sc->sc_dev.dv_xname);
-#else
- pxa2x0_gpio_intr_unmask(sc->sc_gh);
-#endif
- sc->sc_running = 1;
- break;
- }
- return 0;
-}
-
-struct zts_pos {
- int x;
- int y;
- int z; /* touch pressure */
-};
-
-#define NSAMPLES 3
-struct zts_pos zts_samples[NSAMPLES];
-int ztsavgloaded = 0;
-
-int zts_readpos(struct zts_pos *);
-void zts_avgpos(struct zts_pos *);
-
-#define HSYNC() \
- do { \
- while (pxa2x0_gpio_get_bit(GPIO_HSYNC_C3K) == 0); \
- while (pxa2x0_gpio_get_bit(GPIO_HSYNC_C3K) != 0); \
- } while (0)
-
-int pxa2x0_ccnt_enable(int);
-u_int32_t pxa2x0_read_ccnt(void);
-u_int32_t zts_sync_ads784x(int, int, u_int32_t);
-void zts_sync_send(u_int32_t);
-
-int
-pxa2x0_ccnt_enable(int on)
-{
- u_int32_t rv;
-
- on = on ? 0x1 : 0x0;
- __asm volatile("mrc p14, 0, %0, c0, c1, 0" : "=r" (rv));
- __asm volatile("mcr p14, 0, %0, c0, c1, 0" : : "r" (on));
- return ((int)(rv & 0x1));
-}
-
-u_int32_t
-pxa2x0_read_ccnt(void)
-{
- u_int32_t rv;
-
- __asm volatile("mrc p14, 0, %0, c1, c1, 0" : "=r" (rv));
- return (rv);
-}
-
-/*
- * Communicate synchronously with the ADS784x touch screen controller.
- */
-u_int32_t
-zts_sync_ads784x(int dorecv/* XXX */, int dosend/* XXX */, u_int32_t cmd)
-{
- int ccen;
- u_int32_t rv;
-
- /* XXX poll hsync only if LCD is enabled */
-
- /* start clock counter */
- ccen = pxa2x0_ccnt_enable(1);
-
- HSYNC();
-
- if (dorecv)
- /* read SSDR and disable ADS784x */
- rv = zssp_ic_stop(ZSSP_IC_ADS7846);
- else
- rv = 0;
-
- if (dosend)
- zts_sync_send(cmd);
-
- /* stop clock counter */
- pxa2x0_ccnt_enable(ccen);
-
- return (rv);
-}
-
-void
-zts_sync_send(u_int32_t cmd)
-{
- u_int32_t tck;
- u_int32_t a, b;
-
- /* XXX */
- tck = CCNT_HS_400_VGA_C3K - 151;
-
- /* send dummy command; discard SSDR */
- (void)zssp_ic_send(ZSSP_IC_ADS7846, cmd);
-
- /* wait for refresh */
- HSYNC();
-
- /* wait after refresh */
- a = pxa2x0_read_ccnt();
- b = pxa2x0_read_ccnt();
- while ((b - a) < tck)
- b = pxa2x0_read_ccnt();
-
- /* send the actual command; keep ADS784x enabled */
- zssp_ic_start(ZSSP_IC_ADS7846, cmd);
-}
-
-int
-zts_readpos(struct zts_pos *pos)
-{
- int cmd;
- int t0, t1;
- int down;
-
- /* XXX */
- pxa2x0_gpio_set_function(GPIO_HSYNC_C3K, GPIO_IN);
-
- /* check that pen is down */
- cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) |
- (3 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH);
-
- t0 = zssp_ic_send(ZSSP_IC_ADS7846, cmd);
- down = !(t0 < 10);
- if (down == 0)
- goto out;
-
- /* Y */
- cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) |
- (1 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH);
-
- (void)zts_sync_ads784x(0, 1, cmd);
-
- /* Y */
- cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) |
- (1 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH);
-
- (void)zts_sync_ads784x(1, 1, cmd);
-
- /* X */
- cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) |
- (5 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH);
-
- pos->y = zts_sync_ads784x(1, 1, cmd);
-
- /* T0 */
- cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) |
- (3 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH);
-
- pos->x = zts_sync_ads784x(1, 1, cmd);
-
- /* T1 */
- cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) |
- (4 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH);
-
- t0 = zts_sync_ads784x(1, 1, cmd);
- t1 = zts_sync_ads784x(1, 0, cmd);
-
- /* check that pen is still down */
- /* XXX pressure sensitivity varies with X or what? */
- if (t0 == 0 || (pos->x * (t1 - t0) / t0) >= 15000)
- down = 0;
- pos->z = down;
-
-out:
- /* Enable automatic low power mode. */
- cmd = (4 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH);
- (void)zssp_ic_send(ZSSP_IC_ADS7846, cmd);
-
- return (down);
-}
-
-#define NAVGSAMPLES (NSAMPLES < 3 ? NSAMPLES : 3)
-void
-zts_avgpos(struct zts_pos *pos)
-{
- struct zts_pos *tpp = zts_samples;
- int diff[NAVGSAMPLES];
- int mindiff, mindiffv;
- int n;
- int i;
- static int tail;
-
- if (ztsavgloaded < NAVGSAMPLES) {
- tpp[(tail + ztsavgloaded) % NSAMPLES] = *pos;
- ztsavgloaded++;
- return;
- }
-
- tpp[tail] = *pos;
- tail = (tail+1) % NSAMPLES;
-
- /* X */
- i = tail;
- for (n = 0 ; n < NAVGSAMPLES; n++) {
- int alt;
- alt = (i+1) % NSAMPLES;
- diff[n] = tpp[i].x - tpp[alt].x;
- if (diff[n] < 0)
- diff[n] = - diff[n]; /* ABS */
- i = alt;
- }
- mindiffv = diff[0];
- mindiff = 0;
- for (n = 1; n < NAVGSAMPLES; n++) {
- if (diff[n] < mindiffv) {
- mindiffv = diff[n];
- mindiff = n;
- }
- }
- pos->x = (tpp[(tail + mindiff) % NSAMPLES].x +
- tpp[(tail + mindiff + 1) % NSAMPLES].x) / 2;
-
- /* Y */
- i = tail;
- for (n = 0 ; n < NAVGSAMPLES; n++) {
- int alt;
- alt = (i+1) % NSAMPLES;
- diff[n] = tpp[i].y - tpp[alt].y;
- if (diff[n] < 0)
- diff[n] = - diff[n]; /* ABS */
- i = alt;
- }
- mindiffv = diff[0];
- mindiff = 0;
- for (n = 1; n < NAVGSAMPLES; n++) {
- if (diff[n] < mindiffv) {
- mindiffv = diff[n];
- mindiff = n;
- }
- }
- pos->y = (tpp[(tail + mindiff) % NSAMPLES].y +
- tpp[(tail + mindiff + 1) % NSAMPLES].y) / 2;
-}
-
-void
-zts_poll(void *v)
-{
- int s;
-
- s = spltty();
- (void)zts_irq(v);
- splx(s);
-}
-
-#define TS_STABLE 8
-int
-zts_irq(void *v)
-{
- struct zts_softc *sc = v;
- struct zts_pos tp;
- int s;
- int pindown;
- int down;
- extern int zkbd_modstate;
-
- if (!sc->sc_running)
- return 0;
-
- s = splhigh();
- pindown = pxa2x0_gpio_get_bit(GPIO_TP_INT_C3K) ? 0 : 1;
- if (pindown) {
- pxa2x0_gpio_intr_mask(sc->sc_gh);
- timeout_add(&sc->sc_ts_poll, POLL_TIMEOUT_RATE1);
- }
-
- down = zts_readpos(&tp);
-
- if (!pindown) {
- pxa2x0_gpio_intr_unmask(sc->sc_gh);
- timeout_add(&sc->sc_ts_poll, POLL_TIMEOUT_RATE0);
- ztsavgloaded = 0;
- }
- pxa2x0_gpio_clear_intr(GPIO_TP_INT_C3K);
- splx(s);
-
- if (down) {
- zts_avgpos(&tp);
- if (!sc->sc_rawmode &&
- (sc->sc_tsscale.maxx - sc->sc_tsscale.minx) != 0 &&
- (sc->sc_tsscale.maxy - sc->sc_tsscale.miny) != 0) {
- /* Scale down to the screen resolution. */
- tp.x = ((tp.x - sc->sc_tsscale.minx) *
- sc->sc_tsscale.resx) /
- (sc->sc_tsscale.maxx - sc->sc_tsscale.minx);
- tp.y = ((tp.y - sc->sc_tsscale.miny) *
- sc->sc_tsscale.resy) /
- (sc->sc_tsscale.maxy - sc->sc_tsscale.miny);
- }
- }
-
- if (zkbd_modstate != 0 && down) {
- if(zkbd_modstate & (1 << 1)) {
- /* Fn */
- down = 2;
- }
- if(zkbd_modstate & (1 << 2)) {
- /* 'Alt' */
- down = 4;
- }
- }
- if (!down) {
- /* x/y values are not reliable when pen is up */
- tp.x = sc->sc_oldx;
- tp.y = sc->sc_oldy;
- }
-
- if (down || sc->sc_buttons != down) {
- DPRINTF(("%s: tp.z = %d, tp.x = %d, tp.y = %d\n",
- sc->sc_dev.dv_xname, tp.z, tp.x, tp.y));
-
- wsmouse_buttons(sc->sc_wsmousedev, down);
- wsmouse_position(sc->sc_wsmousedev, tp.x, tp.y);
- wsmouse_input_sync(sc->sc_wsmousedev);
- sc->sc_buttons = down;
- sc->sc_oldx = tp.x;
- sc->sc_oldy = tp.y;
- }
-
- return 1;
-}
-
-int
-zts_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- int error = 0;
- struct zts_softc *sc = v;
- struct wsmouse_calibcoords *wsmc = (struct wsmouse_calibcoords *)data;
-
- DPRINTF(("zts_ioctl(%d, '%c', %d)\n",
- IOCPARM_LEN(cmd), IOCGROUP(cmd), cmd & 0xff));
-
- switch (cmd) {
- case WSMOUSEIO_SCALIBCOORDS:
- if (!(wsmc->minx >= 0 && wsmc->maxx >= 0 &&
- wsmc->miny >= 0 && wsmc->maxy >= 0 &&
- wsmc->resx >= 0 && wsmc->resy >= 0 &&
- wsmc->minx < 32768 && wsmc->maxx < 32768 &&
- wsmc->miny < 32768 && wsmc->maxy < 32768 &&
- (wsmc->maxx - wsmc->minx) != 0 &&
- (wsmc->maxy - wsmc->miny) != 0 &&
- wsmc->resx < 32768 && wsmc->resy < 32768 &&
- wsmc->swapxy >= 0 && wsmc->swapxy <= 1 &&
- wsmc->samplelen >= 0 && wsmc->samplelen <= 1))
- return (EINVAL);
-
- sc->sc_tsscale.minx = wsmc->minx;
- sc->sc_tsscale.maxx = wsmc->maxx;
- sc->sc_tsscale.miny = wsmc->miny;
- sc->sc_tsscale.maxy = wsmc->maxy;
- sc->sc_tsscale.swapxy = wsmc->swapxy;
- sc->sc_tsscale.resx = wsmc->resx;
- sc->sc_tsscale.resy = wsmc->resy;
- sc->sc_rawmode = wsmc->samplelen;
- break;
- case WSMOUSEIO_GCALIBCOORDS:
- wsmc->minx = sc->sc_tsscale.minx;
- wsmc->maxx = sc->sc_tsscale.maxx;
- wsmc->miny = sc->sc_tsscale.miny;
- wsmc->maxy = sc->sc_tsscale.maxy;
- wsmc->swapxy = sc->sc_tsscale.swapxy;
- wsmc->resx = sc->sc_tsscale.resx;
- wsmc->resy = sc->sc_tsscale.resy;
- wsmc->samplelen = sc->sc_rawmode;
- break;
- case WSMOUSEIO_GTYPE:
- *(u_int *)data = WSMOUSE_TYPE_TPANEL;
- break;
- default:
- error = ENOTTY;
- break;
- }
-
- return (error);
-}
diff --git a/sys/arch/zaurus/include/_float.h b/sys/arch/zaurus/include/_float.h
deleted file mode 100644
index 38fb9c08646..00000000000
--- a/sys/arch/zaurus/include/_float.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:45 deraadt Exp $ */
-
-#include <arm/_float.h>
diff --git a/sys/arch/zaurus/include/_types.h b/sys/arch/zaurus/include/_types.h
deleted file mode 100644
index 62c4840fe0b..00000000000
--- a/sys/arch/zaurus/include/_types.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: _types.h,v 1.7 2012/11/05 19:39:34 miod Exp $ */
-
-#ifndef _MACHINE__TYPES_H_
-#define _MACHINE__TYPES_H_
-
-#include <arm/_types.h>
-
-#endif
diff --git a/sys/arch/zaurus/include/apmvar.h b/sys/arch/zaurus/include/apmvar.h
deleted file mode 100644
index e6d66f0d168..00000000000
--- a/sys/arch/zaurus/include/apmvar.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* $OpenBSD: apmvar.h,v 1.2 2010/02/02 06:19:28 kevlo Exp $ */
-#include <arm/apmvar.h>
diff --git a/sys/arch/zaurus/include/asm.h b/sys/arch/zaurus/include/asm.h
deleted file mode 100644
index f903110011e..00000000000
--- a/sys/arch/zaurus/include/asm.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: asm.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: asm.h,v 1.3 2001/11/25 15:55:54 thorpej Exp $ */
-
-#include <arm/asm.h>
diff --git a/sys/arch/zaurus/include/atomic.h b/sys/arch/zaurus/include/atomic.h
deleted file mode 100644
index 2cdf06fcd23..00000000000
--- a/sys/arch/zaurus/include/atomic.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: atomic.h,v 1.5 2011/03/23 16:54:37 pirofti Exp $ */
-
-/* Public Domain */
-
-#ifndef _MACHINE_ATOMIC_H_
-#define _MACHINE_ATOMIC_H_
-
-#include <arm/atomic.h>
-
-#endif /* _MACHINE_ATOMIC_H_ */
diff --git a/sys/arch/zaurus/include/bootconfig.h b/sys/arch/zaurus/include/bootconfig.h
deleted file mode 100644
index 6e9e95dd59b..00000000000
--- a/sys/arch/zaurus/include/bootconfig.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $OpenBSD: bootconfig.h,v 1.2 2011/09/20 22:02:13 miod Exp $ */
-/* $NetBSD: bootconfig.h,v 1.2 2001/06/21 22:08:28 chris Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe
- * for the NetBSD Project.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * 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 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.
- *
- * boot configuration structures
- *
- * Created : 12/09/94
- *
- * Based on kate/boot/bootconfig.h
- */
-
-#if defined(_KERNEL)
-
-typedef struct _PhysMem {
- u_int address;
- u_int pages;
-} PhysMem;
-
-#define DRAM_BLOCKS 1
-
-typedef struct _BootConfig {
- PhysMem dram[DRAM_BLOCKS];
- u_int dramblocks;
-} BootConfig;
-
-extern BootConfig bootconfig;
-#define MAX_BOOT_STRING 255
-
-extern char *boot_args;
-extern char *boot_file;
-#endif /* _KERNEL */
-
-/* End of bootconfig.h */
diff --git a/sys/arch/zaurus/include/bus.h b/sys/arch/zaurus/include/bus.h
deleted file mode 100644
index 9f40a4cfa47..00000000000
--- a/sys/arch/zaurus/include/bus.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: bus.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: bus.h,v 1.3 2001/11/25 15:55:55 thorpej Exp $ */
-
-#include <arm/bus.h>
diff --git a/sys/arch/zaurus/include/cdefs.h b/sys/arch/zaurus/include/cdefs.h
deleted file mode 100644
index 6b8c9457831..00000000000
--- a/sys/arch/zaurus/include/cdefs.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: cdefs.h,v 1.2 2005/11/24 20:46:49 deraadt Exp $ */
-
-#include <arm/cdefs.h>
diff --git a/sys/arch/zaurus/include/conf.h b/sys/arch/zaurus/include/conf.h
deleted file mode 100644
index 87b4a7dda5d..00000000000
--- a/sys/arch/zaurus/include/conf.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* $OpenBSD: conf.h,v 1.8 2011/03/23 16:54:37 pirofti Exp $ */
-/* $NetBSD: conf.h,v 1.8 2002/02/10 12:26:03 chris Exp $ */
-
-#ifndef _MACHINE_CONF_H_
-#define _MACHINE_CONF_H_
-
-#include <sys/conf.h>
-
-/*
- * ZAURUS specific device includes go in here
- */
-
-#define CONF_HAVE_APM
-
-#include <arm/conf.h>
-
-#endif /* _MACHINE_CONF_H_ */
diff --git a/sys/arch/zaurus/include/cpu.h b/sys/arch/zaurus/include/cpu.h
deleted file mode 100644
index b5b491a79f7..00000000000
--- a/sys/arch/zaurus/include/cpu.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: cpu.h,v 1.3 2001/11/25 15:55:55 thorpej Exp $ */
-
-#include <arm/cpu.h>
diff --git a/sys/arch/zaurus/include/db_machdep.h b/sys/arch/zaurus/include/db_machdep.h
deleted file mode 100644
index 45324563408..00000000000
--- a/sys/arch/zaurus/include/db_machdep.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: db_machdep.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: db_machdep.h,v 1.3 2001/11/25 15:55:55 thorpej Exp $ */
-
-#include <arm/db_machdep.h>
diff --git a/sys/arch/zaurus/include/disklabel.h b/sys/arch/zaurus/include/disklabel.h
deleted file mode 100644
index 0c0642c339a..00000000000
--- a/sys/arch/zaurus/include/disklabel.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: disklabel.h,v 1.2 2007/06/17 00:27:28 deraadt Exp $ */
-
-#include <arm/disklabel.h>
diff --git a/sys/arch/zaurus/include/endian.h b/sys/arch/zaurus/include/endian.h
deleted file mode 100644
index 81a63fd780c..00000000000
--- a/sys/arch/zaurus/include/endian.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: endian.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: endian.h,v 1.3 2001/11/25 15:55:56 thorpej Exp $ */
-
-#include <arm/endian.h>
diff --git a/sys/arch/zaurus/include/exec.h b/sys/arch/zaurus/include/exec.h
deleted file mode 100644
index d0fc20e447d..00000000000
--- a/sys/arch/zaurus/include/exec.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: exec.h,v 1.2 2006/10/02 17:45:33 miod Exp $ */
-/* public domain */
-#include <arm/exec.h>
diff --git a/sys/arch/zaurus/include/fenv.h b/sys/arch/zaurus/include/fenv.h
deleted file mode 100644
index 00c039216d2..00000000000
--- a/sys/arch/zaurus/include/fenv.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <arm/fenv.h>
diff --git a/sys/arch/zaurus/include/fp.h b/sys/arch/zaurus/include/fp.h
deleted file mode 100644
index 2a8d6cc460c..00000000000
--- a/sys/arch/zaurus/include/fp.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: fp.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: fp.h,v 1.3 2001/11/25 15:55:56 thorpej Exp $ */
-
-#include <arm/fp.h>
diff --git a/sys/arch/zaurus/include/frame.h b/sys/arch/zaurus/include/frame.h
deleted file mode 100644
index d96c1961dda..00000000000
--- a/sys/arch/zaurus/include/frame.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: frame.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: frame.h,v 1.1 2001/06/08 22:23:00 chris Exp $ */
-
-#include <arm/frame.h>
diff --git a/sys/arch/zaurus/include/ieee.h b/sys/arch/zaurus/include/ieee.h
deleted file mode 100644
index ed711e4e217..00000000000
--- a/sys/arch/zaurus/include/ieee.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: ieee.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: ieee.h,v 1.3 2001/11/25 15:55:56 thorpej Exp $ */
-
-#include <arm/ieee.h>
diff --git a/sys/arch/zaurus/include/ieeefp.h b/sys/arch/zaurus/include/ieeefp.h
deleted file mode 100644
index 3b0165dc66a..00000000000
--- a/sys/arch/zaurus/include/ieeefp.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: ieeefp.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: ieeefp.h,v 1.3 2001/11/25 15:55:56 thorpej Exp $ */
-
-#include <arm/ieeefp.h>
diff --git a/sys/arch/zaurus/include/intr.h b/sys/arch/zaurus/include/intr.h
deleted file mode 100644
index ba3253da140..00000000000
--- a/sys/arch/zaurus/include/intr.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* $OpenBSD: intr.h,v 1.12 2015/09/19 02:13:05 jsg Exp $ */
-/* $NetBSD: intr.h,v 1.12 2003/06/16 20:00:59 thorpej Exp $ */
-
-/*
- * Copyright (c) 2001, 2003 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Jason R. Thorpe for Wasabi Systems, Inc.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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 _MACHINE_INTR_H_
-#define _MACHINE_INTR_H_
-
-#ifdef _KERNEL
-
-/* Interrupt priority "levels". */
-#define IPL_NONE 0 /* nothing */
-#define IPL_SOFT 1 /* generic software interrupts */
-#define IPL_SOFTCLOCK 2 /* software clock interrupt */
-#define IPL_SOFTNET 3 /* software network interrupt */
-#define IPL_BIO 4 /* block I/O */
-#define IPL_NET 5 /* network */
-#define IPL_SOFTTTY 6 /* software serial interrupt */
-#define IPL_TTY 7 /* terminals */
-#define IPL_VM 8 /* memory allocation */
-#define IPL_AUDIO 9 /* audio device */
-#define IPL_CLOCK 10 /* clock interrupt */
-#define IPL_STATCLOCK 11 /* statistics clock interrupt */
-#define IPL_SCHED 12 /* everything */
-#define IPL_HIGH 12 /* everything */
-
-#define NIPL 13
-
-/* Interrupt priority "flags". */
-#define IPL_MPSAFE 0 /* no "mpsafe" interrupts */
-
-/* Interrupt sharing types. */
-#define IST_NONE 0 /* none */
-#define IST_PULSE 1 /* pulsed */
-#define IST_EDGE 2 /* edge-triggered */
-#define IST_LEVEL 3 /* level-triggered */
-
-#define IST_LEVEL_LOW IST_LEVEL
-#define IST_LEVEL_HIGH 4
-#define IST_EDGE_FALLING IST_EDGE
-#define IST_EDGE_RISING 5
-#define IST_EDGE_BOTH 6
-
-#ifndef _LOCORE
-
-#include <sys/device.h>
-#include <sys/queue.h>
-
-#define splhigh() _splraise(IPL_HIGH)
-#define splsoft() _splraise(IPL_SOFT)
-#define splsoftclock() _splraise(IPL_SOFTCLOCK)
-#define splsoftnet() _splraise(IPL_SOFTNET)
-#define splbio() _splraise(IPL_BIO)
-#define splnet() _splraise(IPL_NET)
-#define spltty() _splraise(IPL_TTY)
-#define splvm() _splraise(IPL_VM)
-#define splaudio() _splraise(IPL_AUDIO)
-#define splclock() _splraise(IPL_CLOCK)
-#define splstatclock() _splraise(IPL_STATCLOCK)
-#define splserial() _splraise(IPL_SERIAL)
-
-#define spl0() _spllower(IPL_NONE)
-
-#define splsched() splhigh()
-#define spllock() splhigh()
-
-void intr_barrier(void *);
-
-#endif /* ! _LOCORE */
-
-#include <arm/xscale/pxa2x0_intr.h>
-
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_INTR_H_ */
-
diff --git a/sys/arch/zaurus/include/limits.h b/sys/arch/zaurus/include/limits.h
deleted file mode 100644
index c3a60dbab4e..00000000000
--- a/sys/arch/zaurus/include/limits.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: limits.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: limits.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
-
-#include <arm/limits.h>
diff --git a/sys/arch/zaurus/include/loadfile_machdep.h b/sys/arch/zaurus/include/loadfile_machdep.h
deleted file mode 100644
index ae23c457f0c..00000000000
--- a/sys/arch/zaurus/include/loadfile_machdep.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $OpenBSD: loadfile_machdep.h,v 1.4 2015/07/17 20:44:39 miod Exp $ */
-/* $NetBSD: loadfile_machdep.h,v 1.1 1999/04/29 03:17:12 tsubai Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * 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.
- */
-
-#define BOOT_ELF
-#define ELFSIZE 32
-
-#define LOAD_KERNEL LOAD_ALL
-#define COUNT_KERNEL COUNT_ALL
-
-#define LOADADDR(a) ((((u_long)(a)) + offset)&0xfffffff)
-#define ALIGNENTRY(a) ((u_long)(a))
-#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
-#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
-#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
-#define PROGRESS(a) (void) printf a
-#define ALLOC(a) alloc(a)
-#define FREE(a, b) free(a, b)
-
-void run_loadfile(u_long *, int);
diff --git a/sys/arch/zaurus/include/lock.h b/sys/arch/zaurus/include/lock.h
deleted file mode 100644
index 8d51954acb2..00000000000
--- a/sys/arch/zaurus/include/lock.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: lock.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: lock.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
-
-#include <arm/lock.h>
diff --git a/sys/arch/zaurus/include/machine_reg.h b/sys/arch/zaurus/include/machine_reg.h
deleted file mode 100644
index f679a87ccb8..00000000000
--- a/sys/arch/zaurus/include/machine_reg.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $OpenBSD: machine_reg.h,v 1.4 2015/12/24 05:50:15 mmcc Exp $ */
-/* $NetBSD: lubbock_reg.h,v 1.1 2003/06/18 10:51:15 bsh Exp $ */
-
-/*
- * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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 _ZAURUS_REG_H
-#define _ZAURUS_REG_H
-
-#include <arm/xscale/pxa2x0reg.h>
-
-/*
- * Logical mapping for onboard/integrated peripherals
- */
-#define ZAURUS_IO_AREA_VBASE 0xfd000000
-#define ZAURUS_GPIO_VBASE 0xfd000000
-#define ZAURUS_CLKMAN_VBASE 0xfd100000
-#define ZAURUS_INTCTL_VBASE 0xfd200000
-#define ZAURUS_SCOOP0_VBASE 0xfd300000
-#define ZAURUS_SCOOP1_VBASE 0xfd400000
-#define ZAURUS_VBASE_FREE 0xfd500000
-/* FFUART, BTUART and/or STUART are mapped to this area when
- used for console or kgdb port */
-
-#define ioreg_read(a) (*(volatile unsigned *)(a))
-#define ioreg_write(a,v) (*(volatile unsigned *)(a)=(v))
-
-#define ioreg16_read(a) (*(volatile uint16_t *)(a))
-#define ioreg16_write(a,v) (*(volatile uint16_t *)(a)=(v))
-
-#define ioreg8_read(a) (*(volatile uint8_t *)(a))
-#define ioreg8_write(a,v) (*(volatile uint8_t *)(a)=(v))
-
-/*
- * Magic numbers for the C860 (PXA255) and C3000 (PXA27x).
- */
-
-/* physical addresses of companion chips */
-#define C3000_SCOOP0_BASE 0x10800000 /* XXX same as C860 */
-#define C3000_SCOOP1_BASE 0x08800040
-
-/* processor IRQ numbers */
-#define C860_CF0_IRQ 17
-#define C3000_CF0_IRQ 105
-#define C3000_CF1_IRQ 106
-
-/* processor GPIO pins */
-#define C860_CF0_IRQ_PIN 14
-#define C3000_RC_IRQ_PIN 13 /* remote control */
-#define C3000_CF0_IRQ_PIN 94
-#define C3000_CF1_IRQ_PIN 93
-#define GPIO_USB_DEVICE 35 /* indicate connection type */
-#define GPIO_USB_DETECT 41 /* connection interrupt */
-#define GPIO_USB_PULLUP 45 /* show/hide device presence */
-#define GPIO_HP_IN_C3000 116 /* headphone jack */
-#define GPIO_MMC_DETECT 9 /* card detect */
-
-#endif /* _ZAURUS_REG_H */
diff --git a/sys/arch/zaurus/include/mutex.h b/sys/arch/zaurus/include/mutex.h
deleted file mode 100644
index 8f734b03a83..00000000000
--- a/sys/arch/zaurus/include/mutex.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: mutex.h,v 1.2 2007/12/05 16:08:06 deraadt Exp $ */
-/* public domain */
-#include <arm/mutex.h>
diff --git a/sys/arch/zaurus/include/param.h b/sys/arch/zaurus/include/param.h
deleted file mode 100644
index e7a26920266..00000000000
--- a/sys/arch/zaurus/include/param.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: param.h,v 1.6 2013/03/23 16:12:28 deraadt Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name "RiscBSD" nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``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 RISCBSD 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 _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#include <arm/param.h>
-
-#define _MACHINE zaurus
-#define MACHINE "zaurus"
-
-#ifndef MSGBUFSIZE
-#define MSGBUFSIZE (1 * PAGE_SIZE)
-#endif
-
-#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/zaurus/include/pcb.h b/sys/arch/zaurus/include/pcb.h
deleted file mode 100644
index 63455769a68..00000000000
--- a/sys/arch/zaurus/include/pcb.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: pcb.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: pcb.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
-
-#include <arm/pcb.h>
diff --git a/sys/arch/zaurus/include/pio.h b/sys/arch/zaurus/include/pio.h
deleted file mode 100644
index e34d5fecf16..00000000000
--- a/sys/arch/zaurus/include/pio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: pio.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: pio.h,v 1.3 2001/12/07 23:09:33 chris Exp $ */
-
-#include <arm/pio.h>
diff --git a/sys/arch/zaurus/include/pmap.h b/sys/arch/zaurus/include/pmap.h
deleted file mode 100644
index fd34a3faf73..00000000000
--- a/sys/arch/zaurus/include/pmap.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: pmap.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: pmap.h,v 1.2 2001/11/23 17:29:01 thorpej Exp $ */
-
-#include <arm/pmap.h>
diff --git a/sys/arch/zaurus/include/proc.h b/sys/arch/zaurus/include/proc.h
deleted file mode 100644
index e9eea6e2344..00000000000
--- a/sys/arch/zaurus/include/proc.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: proc.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: proc.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
-
-#include <arm/proc.h>
diff --git a/sys/arch/zaurus/include/profile.h b/sys/arch/zaurus/include/profile.h
deleted file mode 100644
index 00ae54f7809..00000000000
--- a/sys/arch/zaurus/include/profile.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: profile.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: profile.h,v 1.3 2001/11/25 15:55:57 thorpej Exp $ */
-
-#include <arm/profile.h>
diff --git a/sys/arch/zaurus/include/ptrace.h b/sys/arch/zaurus/include/ptrace.h
deleted file mode 100644
index 3bfe7543665..00000000000
--- a/sys/arch/zaurus/include/ptrace.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: ptrace.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: ptrace.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
-
-#include <arm/ptrace.h>
diff --git a/sys/arch/zaurus/include/reg.h b/sys/arch/zaurus/include/reg.h
deleted file mode 100644
index fc06d65ede7..00000000000
--- a/sys/arch/zaurus/include/reg.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: reg.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: reg.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
-
-#include <arm/reg.h>
diff --git a/sys/arch/zaurus/include/reloc.h b/sys/arch/zaurus/include/reloc.h
deleted file mode 100644
index 3443c31ae4b..00000000000
--- a/sys/arch/zaurus/include/reloc.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* $OpenBSD: reloc.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-#include <arm/reloc.h>
diff --git a/sys/arch/zaurus/include/setjmp.h b/sys/arch/zaurus/include/setjmp.h
deleted file mode 100644
index 2dc2a0d57be..00000000000
--- a/sys/arch/zaurus/include/setjmp.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: setjmp.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: setjmp.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
-
-#include <arm/setjmp.h>
diff --git a/sys/arch/zaurus/include/signal.h b/sys/arch/zaurus/include/signal.h
deleted file mode 100644
index eb777b91da0..00000000000
--- a/sys/arch/zaurus/include/signal.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: signal.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: signal.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
-
-#include <arm/signal.h>
diff --git a/sys/arch/zaurus/include/spinlock.h b/sys/arch/zaurus/include/spinlock.h
deleted file mode 100644
index 76c99ed16d7..00000000000
--- a/sys/arch/zaurus/include/spinlock.h
+++ /dev/null
@@ -1,7 +0,0 @@
-
-/* $OpenBSD: spinlock.h,v 1.4 2011/03/23 16:54:37 pirofti Exp $ */
-#ifndef _MACHINE_SPINLOCK_H_
-#define _MACHINE_SPINLOCK_H_
-#include <arm/spinlock.h>
-#endif /* _MACHINE_SPINLOCK_H_ */
-
diff --git a/sys/arch/zaurus/include/stdarg.h b/sys/arch/zaurus/include/stdarg.h
deleted file mode 100644
index c7626e16c9b..00000000000
--- a/sys/arch/zaurus/include/stdarg.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: stdarg.h,v 1.2 2005/01/02 19:43:07 drahn Exp $ */
-/* $NetBSD: stdarg.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
-
-#include <arm/stdarg.h>
diff --git a/sys/arch/zaurus/include/sysarch.h b/sys/arch/zaurus/include/sysarch.h
deleted file mode 100644
index 3fcdaf85729..00000000000
--- a/sys/arch/zaurus/include/sysarch.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: sysarch.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: sysarch.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
-
-#include <arm/sysarch.h>
diff --git a/sys/arch/zaurus/include/tcb.h b/sys/arch/zaurus/include/tcb.h
deleted file mode 100644
index 2f01dd6f598..00000000000
--- a/sys/arch/zaurus/include/tcb.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <arm/tcb.h>
diff --git a/sys/arch/zaurus/include/trap.h b/sys/arch/zaurus/include/trap.h
deleted file mode 100644
index bbcaa1b8aa4..00000000000
--- a/sys/arch/zaurus/include/trap.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: trap.h,v 1.1 2004/12/31 00:04:35 drahn Exp $ */
-/* $NetBSD: trap.h,v 1.3 2001/11/25 15:55:58 thorpej Exp $ */
-
-#include <arm/trap.h>
diff --git a/sys/arch/zaurus/include/vmparam.h b/sys/arch/zaurus/include/vmparam.h
deleted file mode 100644
index 14bce788891..00000000000
--- a/sys/arch/zaurus/include/vmparam.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.8 2015/06/24 21:35:01 miod Exp $ */
-/* $NetBSD: vmparam.h,v 1.23 2003/05/22 05:47:07 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 _MACHINE_VMPARAM_H_
-#define _MACHINE_VMPARAM_H_
-
-#define ARM_KERNEL_BASE 0xc0000000U
-
-#include <arm/vmparam.h>
-
-#ifdef _KERNEL
-/*
- * Address space constants
- */
-
-/*
- * The line between user space and kernel space
- * Mappings >= KERNEL_BASE are constant across all processes
- */
-#define KERNEL_BASE ARM_KERNEL_BASE
-
-#define VM_KERNEL_SPACE_SIZE 0x10000000
-
-/*
- * Override the default pager_map size, there's not enough KVA.
- */
-#define PAGER_MAP_SIZE (4 * 1024 * 1024)
-
-/*
- * Size of User Raw I/O map
- */
-
-#define USRIOSIZE 300
-
-/* virtual sizes (bytes) for various kernel submaps */
-
-#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
-
-/*
- * max number of non-contig chunks of physical RAM you can have
- */
-
-#define VM_PHYSSEG_MAX 1
-#define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM
-
-/*
- * this indicates that we can't add RAM to the VM system after the
- * vm system is init'd.
- */
-
-#define VM_PHYSSEG_NOADD
-
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_VMPARAM_H_ */
diff --git a/sys/arch/zaurus/include/zaurus_var.h b/sys/arch/zaurus/include/zaurus_var.h
deleted file mode 100644
index a0a8c78bd6f..00000000000
--- a/sys/arch/zaurus/include/zaurus_var.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: zaurus_var.h,v 1.5 2008/11/25 14:55:44 drahn Exp $ */
-/* $NetBSD: lubbock_var.h,v 1.1 2003/06/18 10:51:15 bsh Exp $ */
-
-/*
- * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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 _EVBARM_ZAURUS_VAR_H
-#define _EVBARM_ZAURUS_VAR_H
-
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-#include <machine/machine_reg.h>
-
-#ifdef _KERNEL
-
-#define ZAURUS_C860 0xC0860
-#define ZAURUS_C3000 0xC3000
-
-extern int zaurusmod;
-
-#define ZAURUS_ISC860 (zaurusmod == ZAURUS_C860)
-#define ZAURUS_ISC3000 (zaurusmod == ZAURUS_C3000)
-
-#endif
-
-#endif /* _EVBARM_ZAURUS_VAR_H */
diff --git a/sys/arch/zaurus/stand/Makefile b/sys/arch/zaurus/stand/Makefile
deleted file mode 100644
index b2552b72449..00000000000
--- a/sys/arch/zaurus/stand/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $OpenBSD: Makefile,v 1.6 2005/11/04 01:02:31 uwe Exp $
-
-SUBDIR= zboot
-
-.if ${MACHINE} == "zaurus"
-SUBDIR+= zbsdmod
-.endif
-
-.include <bsd.subdir.mk>
diff --git a/sys/arch/zaurus/stand/Makefile.inc b/sys/arch/zaurus/stand/Makefile.inc
deleted file mode 100644
index 0027bf96033..00000000000
--- a/sys/arch/zaurus/stand/Makefile.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.2 2005/11/04 01:02:31 uwe Exp $
-
-BINDIR= /usr/mdec
diff --git a/sys/arch/zaurus/stand/zboot/Makefile b/sys/arch/zaurus/stand/zboot/Makefile
deleted file mode 100644
index 10c590513c5..00000000000
--- a/sys/arch/zaurus/stand/zboot/Makefile
+++ /dev/null
@@ -1,54 +0,0 @@
-# $OpenBSD: Makefile,v 1.18 2016/07/30 03:25:49 guenther Exp $
-
-MAN= boot.8
-MANSUBDIR=zaurus
-
-.if ${MACHINE} == "zaurus"
-PROG= zboot
-LDFLAGS+=-nostdlib -Bstatic -nopie -znorelro
-INSTALL_STRIP=
-
-SRCS= crt0.c
-
-S= ${.CURDIR}/../../../..
-
-CLEANFILES+= arm machine
-.if !make(libdep) && !make(sadep) && !make(salibdir) && !make(obj)
-.BEGIN:
- @([ X$(S) = X -o -h arm ] || ln -s $(S)/arch/arm/include arm)
- @([ X$(S) = X -o -h machine ] || ln -s $(S)/arch/zaurus/include machine)
-.endif
-
-# stand/boot
-SRCS+= boot.c cmd.c vars.c bootarg.c conf.c
-
-# libsa
-SRCS+= close.c closeall.c cons.c ctime.c disklabel.c dkcksum.c fstat.c \
- lseek.c memcmp.c memcpy.c memset.c open.c printf.c read.c \
- readdir.c snprintf.c stat.c strerror.c strtol.c ufs.c
-
-.PATH: ${S}/lib/libkern/arch/arm ${S}/lib/libkern
-SRCS+= getchar.c putchar.c strcmp.c strlcpy.c strlen.c strncmp.c strncpy.c \
- write.c ashrdi3.c divsi3.S divdi3.c moddi3.c qdivrem.c
-
-# local overrides and additions
-SRCS+= alloc.c devopen.c diskprobe.c exec.c exit.c loadfile.c \
- machdep.c termios.c unixcons.c unixdev.c unixsys.S
-
-.PATH: ${S}/stand/boot
-.PATH: ${S}/lib/libsa
-
-${PROG}: ${OBJS} ${LIBSA}
- ${LD} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBSA}
-
-.else
-NOPROG=
-.endif
-
-.include <bsd.prog.mk>
-
-AFLAGS+=-D_LOCORE
-CPPFLAGS+=-D_STANDALONE
-CPPFLAGS+=-I${S}/stand/boot -I${S}/lib/libsa -I. -I${.CURDIR} -I${S}
-CFLAGS+=-fno-stack-protector -fno-builtin -fpack-struct -fno-pie
-AFLAGS+= -fno-pie
diff --git a/sys/arch/zaurus/stand/zboot/alloc.c b/sys/arch/zaurus/stand/zboot/alloc.c
deleted file mode 100644
index d6f34e0dff5..00000000000
--- a/sys/arch/zaurus/stand/zboot/alloc.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* $OpenBSD: alloc.c,v 1.3 2016/03/14 23:08:05 krw Exp $ */
-/* $NetBSD: alloc.c,v 1.6 1997/02/04 18:36:33 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Christopher G. Demetriou. All rights reserved.
- * Copyright (c) 1996
- * Matthias Drochner. All rights reserved.
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * The Mach Operating System project at Carnegie-Mellon University.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * @(#)alloc.c 8.1 (Berkeley) 6/11/93
- *
- *
- * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Author: Alessandro Forin
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * Dynamic memory allocator.
- *
- * Compile options:
- *
- * ALLOC_TRACE enable tracing of allocations/deallocations
- *
- * ALLOC_FIRST_FIT use a first-fit allocation algorithm, rather than
- * the default best-fit algorithm.
- *
- * HEAP_LIMIT heap limit address (defaults to "no limit").
- *
- * HEAP_START start address of heap (defaults to '&end').
- *
- * DEBUG enable debugging sanity checks.
- */
-
-#include <sys/param.h>
-
-/*
- * Each block actually has ALIGN(unsigned) + ALIGN(size) bytes allocated
- * to it, as follows:
- *
- * 0 ... (sizeof(unsigned) - 1)
- * allocated or unallocated: holds size of user-data part of block.
- *
- * sizeof(unsigned) ... (ALIGN(sizeof(unsigned)) - 1)
- * allocated: unused
- * unallocated: depends on packing of struct fl
- *
- * ALIGN(sizeof(unsigned)) ... (ALIGN(sizeof(unsigned)) + ALIGN(data size) - 1)
- * allocated: user data
- * unallocated: depends on packing of struct fl
- *
- * 'next' is only used when the block is unallocated (i.e. on the free list).
- * However, note that ALIGN(sizeof(unsigned)) + ALIGN(data size) must
- * be at least 'sizeof(struct fl)', so that blocks can be used as structures
- * when on the free list.
- */
-
-#include <lib/libsa/stand.h>
-
-struct fl {
- unsigned size;
- struct fl *next;
-} *freelist = NULL;
-
-static char heap[4 * 1024 * 1024];
-#define HEAP_START (heap)
-#define HEAP_LIMIT (&heap[sizeof(heap)])
-
-#ifdef HEAP_START
-static char *top = (char *)HEAP_START;
-#else
-extern char end[];
-static char *top = end;
-#endif
-
-void *
-alloc(unsigned int size)
-{
- struct fl **f = &freelist, **bestf = NULL;
-#ifndef ALLOC_FIRST_FIT
- unsigned bestsize = 0xffffffff; /* greater than any real size */
-#endif
- char *help;
- int failed;
-
-#ifdef ALLOC_TRACE
- printf("alloc(%u)", size);
-#endif
-
-#ifdef ALLOC_FIRST_FIT
- while (*f != NULL && (*f)->size < size)
- f = &((*f)->next);
- bestf = f;
- failed = (*bestf == NULL);
-#else
- /* scan freelist */
- while (*f) {
- if ((*f)->size >= size) {
- if ((*f)->size == size) /* exact match */
- goto found;
-
- if ((*f)->size < bestsize) {
- /* keep best fit */
- bestf = f;
- bestsize = (*f)->size;
- }
- }
- f = &((*f)->next);
- }
-
- /* no match in freelist if bestsize unchanged */
- failed = (bestsize == 0xffffffff);
-#endif
-
- if (failed) { /* nothing found */
- /*
- * allocate from heap, keep chunk len in
- * first word
- */
- help = top;
-
- /* make _sure_ the region can hold a struct fl. */
- if (size < ALIGN(sizeof (struct fl *)))
- size = ALIGN(sizeof (struct fl *));
- top += ALIGN(sizeof(unsigned)) + ALIGN(size);
-#ifdef HEAP_LIMIT
- if (top > (char *)HEAP_LIMIT)
- panic("heap full (0x%lx+%u)", help, size);
-#endif
- *(unsigned *)help = ALIGN(size);
-#ifdef ALLOC_TRACE
- printf("=%p\n", help + ALIGN(sizeof(unsigned)));
-#endif
- return(help + ALIGN(sizeof(unsigned)));
- }
-
- /* we take the best fit */
- f = bestf;
-
-#ifndef ALLOC_FIRST_FIT
-found:
-#endif
- /* remove from freelist */
- help = (char *)*f;
- *f = (*f)->next;
-#ifdef ALLOC_TRACE
- printf("=%p (origsize %u)\n", help + ALIGN(sizeof(unsigned)),
- *(unsigned *)help);
-#endif
- return(help + ALIGN(sizeof(unsigned)));
-}
-
-void
-free(void *ptr, unsigned int size)
-{
- struct fl *f;
-
- if (ptr == NULL)
- return;
-
- f = (struct fl *)((char *)ptr - ALIGN(sizeof(unsigned)));
-
-#ifdef ALLOC_TRACE
- printf("free(%p, %u) (origsize %u)\n", ptr, size, f->size);
-#endif
-#ifdef DEBUG
- if (size > f->size)
- printf("free %u bytes @%p, should be <=%u\n",
- size, ptr, f->size);
-#ifdef HEAP_START
- if (ptr < (void *)HEAP_START)
-#else
- if (ptr < (void *)end)
-#endif
- printf("free: %lx before start of heap.\n", (u_long)ptr);
-
-#ifdef HEAP_LIMIT
- if (ptr > (void *)HEAP_LIMIT)
- printf("free: %lx beyond end of heap.\n", (u_long)ptr);
-#endif
-#endif /* DEBUG */
- /* put into freelist */
- f->next = freelist;
- freelist = f;
-}
diff --git a/sys/arch/zaurus/stand/zboot/boot.8 b/sys/arch/zaurus/stand/zboot/boot.8
deleted file mode 100644
index 8bd43f33fe3..00000000000
--- a/sys/arch/zaurus/stand/zboot/boot.8
+++ /dev/null
@@ -1,387 +0,0 @@
-.\" $OpenBSD: boot.8,v 1.14 2015/11/01 21:26:48 jmc Exp $
-.\"
-.\" Copyright (c) 1997-2001 Michael Shalayeff
-.\" 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 OR HIS RELATIVES 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 MIND, 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.
-.\"
-.\"
-.Dd $Mdocdate: November 1 2015 $
-.Dt BOOT 8 zaurus
-.Os
-.Sh NAME
-.Nm boot ,
-.Nm boot.conf
-.Nd zaurus-specific second-stage bootstrap
-.Sh DESCRIPTION
-The main purpose of this program is to load the system kernel while dealing
-with the peculiarities of the zaurus machine.
-.Pp
-As described in
-.Xr boot_zaurus 8 ,
-this program is loaded by the primary bootstrap loader and provides a
-convenient way to load the kernel.
-This program acts as an enhanced boot monitor for zaurus systems, providing
-a common interface for the kernel to start from.
-.Pp
-Basic operations include:
-.Pp
-.Bl -bullet -compact
-.It
-Detecting and switching between multiple consoles.
-.It
-Loading kernels from any device supported by the primary bootstrap loader.
-.\" .It
-.\" Loading kernels compressed by
-.\" .Xr gzip 1 .
-.It
-Passing system parameters queried from the primary bootstrap loader to the
-kernel.
-.It
-Providing an interactive command line.
-.El
-.Pp
-The sequence of its operation is as follows: initialization,
-parsing the configuration file, then an interactive command line.
-While at the command line you have 5 seconds to type any commands, if needed.
-If time expires, the kernel will be loaded according to
-the current variable settings (see the
-.Nm set
-command).
-Each time a kernel load fails, the timeout is increased by one second.
-The sequence of
-.Nm
-operations is as follows:
-.Bl -enum
-.It
-Probe for console devices, which includes the (default) LCD+Keyboard
-console
-.Pq Li cn0
-and up to three serial consoles
-.Pf ( Li com0
-through
-.Li com2 )
-connected to the serial ports.
-Display messages to the default console about the devices found.
-.\" .It
-.\" Detect memory.
-.\" Conventional memory is detected by querying the BIOS.
-.\" Extended memory is detected by probing page-by-page through the address
-.\" space, rather than asking the BIOS; many BIOS's cannot report larger than
-.\" 64M of memory.
-.\" All memory found is reported to the default console device.
-.It
-Probe for disk devices, and select the first disk with an i386-compatible
-MBR and a valid
-.Ox
-primary partition.
-.It
-If the file
-.Pa /etc/boot.conf
-exists on the root filesystem on the selected disk, open and parse it.
-Lines beginning with the
-.Sq #
-character,
-as well as whitespace at the beginning of lines,
-are ignored.
-The file may contain any commands
-.Nm
-accepts at the interactive prompt.
-Though default settings usually suffice, they can be changed here.
-.\" XXX CHECK_SKIP_CONF is not defined...
-.\" .Pp
-.\" .Pa boot.conf
-.\" processing can be skipped by holding down either Control key as
-.\" .Nm
-.\" starts.
-.It
-The header line
-.Pp
-.Dl >> OpenBSD/zaurus BOOT [x.xx]
-.Pp
-is displayed to the active console, where
-.Ar x.xx
-is the version number of the
-.Nm
-program, followed by the
-.Pp
-.Dl boot>
-.Pp
-prompt, which means you are in interactive mode and may enter commands.
-If you do not,
-.Nm
-will proceed to load the kernel with the current parameters after the
-timeout period has expired.
-.El
-.Pp
-By default,
-.Nm
-attempts to load the kernel executable
-.Pa /bsd .
-If it fails to find the kernel and no alternative kernel image has
-been specified, the system will be unable to boot.
-.Sh COMMANDS
-The following commands are accepted at the
-.Nm
-prompt:
-.Bl -tag -width shorten
-.It boot Op Ar image Op Fl acds
-Boots the kernel image specified by
-.Ar image
-with any options given.
-Image specification consists of a pair
-.Ar device : Ns Ar filename ;
-either or both can be omitted (`:' is not needed if both are omitted),
-in which case values from
-.Nm
-variables will be used.
-.Pp
-When selecting the
-.Ar device
-to boot from,
-.Nm
-makes no distinction between SCSI and IDE type drives;
-they are detected as
-.Sq hd
-devices.
-Therefore, to boot kernel
-.Pa /bsd
-from slice
-.Sq a
-on the first hard drive
-.Pq irrespective of device type ,
-specify
-.Dq boot hd0a:/bsd .
-.Pp
-.Em Note:
-Normally, the internal hard disk is designated by the
-.Ar device
-name
-.Sq hd0 .
-If a CF hard disk is present in the socket when the system starts,
-the internal hard disk is instead designated by the prefix
-.Sq hd1 ,
-and
-.Sq hd0
-will access the CF hard disk.
-.Bl -tag -width _a_
-.It Fl a
-Causes the kernel to ask for the
-.Nm root
-device to use.
-.It Fl c
-Causes the kernel to go into
-.Xr boot_config 8
-before performing
-.Xr autoconf 4
-procedures.
-.It Fl d
-Causes the kernel to drop into
-.Xr ddb 4
-at the earliest convenient point.
-.It Fl s
-Causes the kernel to boot single-user.
-.El
-.It clear
-Clears the console screen.
-This is useful if your bootstrap console doesn't scroll the screen
-automatically when the cursor is in the bottom line.
-.It echo Op Ar args
-Displays
-.Ar args
-on the console device.
-.It help
-Prints a list of available commands and machine dependent
-commands, if any.
-.It ls Op Ar directory
-Prints contents of the specified
-.Ar directory
-in long format including: attributes and file type, owner, group,
-size, filename.
-.It reboot
-.\" Reboots the machine by initiating a warm boot procedure.
-Returns control to the primary bootstrap loader.
-.It set Op Ar varname Op Ar value
-If invoked without arguments, prints a list of variables and their values.
-If only
-.Ar varname
-is specified, displays contents of that variable.
-If
-.Ar varname
-and
-.Ar value
-are both specified, sets that variable to the given value.
-Variables include:
-.Pp
-.Bl -tag -compact -width boothow
-.It Nm addr
-Address at which to load the kernel.
-.It Nm debug
-Debug flag if
-.Nm
-was compiled with DEBUG defined.
-.It Nm device
-Boot device name (e.g.,
-.\" .Li fd0a ,
-.Li hd0a ) .
-.It Nm howto
-Options to pass to the loaded kernel.
-.It Nm image
-File name containing the kernel image.
-.It Nm timeout
-Number of seconds boot will wait for human intervention before
-booting the default kernel image.
-.It Nm tty
-Active console device name (e.g.,
-.Li cn0 ,
-.Li com0 ,
-.Li com1 ) .
-.El
-.It stty Op Ar device Op Ar speed
-Displays or sets the
-.Ar speed
-for a console
-.Ar device .
-If changing the baudrate for the currently active console,
-.Nm
-offers you five seconds of grace time before committing the change
-to allow you to change your terminal's speed to match.
-If changing speed
-.Em not
-for the active console, the baudrate is set for the
-.Em next
-time you switch to a serial console.
-.Pp
-The default baudrate is 9600bps.
-.It time
-Displays system time and date.
-.El
-.Sh UPDATING BOOTBLOCKS
-Since the bootblocks actually live in a Linux flash filesystem, a
-rather obtuse method must currently be used to upgrade them.
-.Pp
-.Bl -enum -offset indent -compact
-.It
-Place
-.Pa zboot
-and
-.Pa zbsdmod.o
-onto an MS-DOS filesystem on a CF card, and then insert into the Zaurus.
-.It
-Remove power from the Zaurus.
-.It
-Unplug the battery.
-.It
-Start holding down the
-.Sq b
-and
-.Sq d
-keys.
-.It
-Wait 30 seconds, then re-insert the battery and power up the Zaurus.
-.It
-When you see text start to appear on the Zaurus, release the
-.Sq b
-and
-.Sq d
-keys.
-.It
-Login as root and perform the following steps:
-.Bd -literal -offset indent
-# mount /dev/mtdblock2 /tmp
-# cp /mnt/cf/z* /tmp/home/etc/rc.d
-# reboot
-.Ed
-.Pp
-An SD card with an MS-DOS filesystem may be used instead, in which case
-the Linux pathname will be
-.Pa /mnt/card
-instead of
-.Pa /mnt/cf .
-.El
-.Sh FILES
-.Bl -tag -width /usr/mdec/zbsdmod.o -compact
-.It Pa /usr/mdec/zbsdmod.o
-kernel module for the primary bootstrap loader that must be
-loaded before the system bootstrap
-.It Pa /usr/mdec/zboot
-system bootstrap
-.It Pa /etc/boot.conf
-system bootstrap's startup file
-.It Pa /bsd
-kernel image
-.It Pa /bsd.rd
-kernel image for installation/recovery
-.El
-.Sh EXAMPLES
-Boot the default kernel:
-.Pp
-.Dl boot> boot
-.Pp
-Remove the 5 second pause at boot-time permanently, causing
-.Nm
-to load the kernel immediately without prompting:
-.Pp
-.Dl # echo \&"boot\&" > /etc/boot.conf
-.Pp
-Use serial console.
-A null modem cable should connect the specified serial port to a terminal.
-Useful for debugging.
-.Pp
-.Dl boot> set tty com0
-.Pp
-Invoke the serial console at every boot:
-.Pp
-.Dl # echo \&"set tty com0\&" > /etc/boot.conf
-.Pp
-Boot the kernel named
-.Pa /bsd
-from the second hard disk in
-.Dq User Kernel Configuration
-mode (see
-.Xr boot_config 8 ) .
-This mechanism allows for the explicit enabling and disabling of devices
-during the current boot sequence, as well as the modification
-of device parameters.
-Once booted, such changes can be made permanent by using
-.Xr config 8 Ns 's
-.Fl e
-option.
-.Pp
-.Dl boot> boot hd1a:/bsd -c
-.Sh SEE ALSO
-.\" .Xr gzip 1 ,
-.Xr autoconf 4 ,
-.Xr ddb 4 ,
-.Xr boot_config 8 ,
-.Xr boot_zaurus 8 ,
-.Xr fdisk 8 ,
-.\" .Xr installboot 8 ,
-.Xr reboot 8
-.Sh HISTORY
-This program was written by Michael Shalayeff for
-.Ox 2.1 ,
-and adapted to zaurus by Uwe Stuehler for
-.Ox 3.7 .
-.Sh BUGS
-Non-IDE disks cannot be used to load /etc/boot.conf or
-the kernel from them.
diff --git a/sys/arch/zaurus/stand/zboot/compat_linux.h b/sys/arch/zaurus/stand/zboot/compat_linux.h
deleted file mode 100644
index dc6c79cc93a..00000000000
--- a/sys/arch/zaurus/stand/zboot/compat_linux.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* $OpenBSD: compat_linux.h,v 1.10 2016/03/02 15:14:44 naddy Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* This file must be included late, for redefinitions to take effect. */
-
-#ifndef _LOCORE
-
-#define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1)))
-#define OFFSET_MAX INT_LIMIT(long long)
-#define OFFT_OFFSET_MAX INT_LIMIT(long)
-
-#undef O_RDONLY
-#undef O_WRONLY
-#undef O_RDWR
-#undef SEEK_SET
-#undef SEEK_CUR
-
-#define O_RDONLY 0x0000
-#define O_WRONLY 0x0001
-#define O_RDWR 0x0002
-#define SEEK_SET 0
-#define SEEK_CUR 1
-
-#define LINUX_EOVERFLOW 75
-
-struct linux_stat {
- unsigned short lst_dev;
- unsigned short pad1;
- unsigned long lst_ino;
- unsigned short lst_mode;
- unsigned short lst_nlink;
- unsigned short lst_uid;
- unsigned short lst_gid;
- unsigned short lst_rdev;
- unsigned short pad2;
- long lst_size;
- unsigned long lst_blksize;
- unsigned long lst_blocks;
- long lst_atime;
- unsigned long unused1;
- long lst_mtime;
- unsigned long unused2;
- long lst_ctime;
- unsigned long unused3;
- unsigned long unused4;
- unsigned long unused5;
-};
-
-struct termios {
- unsigned long c_iflag;
- unsigned long c_oflag;
- unsigned long c_cflag;
- unsigned long c_lflag;
- unsigned char c_line;
- unsigned char c_cc[19];
-};
-
-#define IGNBRK 0x0000001
-#define BRKINT 0x0000002
-#define PARMRK 0x0000008
-#define ISTRIP 0x0000020
-#define INLCR 0x0000040
-#define IGNCR 0x0000080
-#define ICRNL 0x0000100
-#define IXON 0x0000400
-#define IMAXBEL 0x0002000
-
-#define OPOST 0x0000001
-
-#define ISIG 0x00000001
-#define ICANON 0x00000002
-#define ECHO 0x00000008
-#define ECHONL 0x00000040
-#define IEXTEN 0x00008000
-
-#define CBAUD 0x0000100f
-#define B0 0x00000000
-#define B50 0x00000001
-#define B75 0x00000002
-#define B110 0x00000003
-#define B134 0x00000004
-#define B150 0x00000005
-#define B200 0x00000006
-#define B300 0x00000007
-#define B600 0x00000008
-#define B1200 0x00000009
-#define B1800 0x0000000a
-#define B2400 0x0000000b
-#define B4800 0x0000000c
-#define B9600 0x0000000d
-#define B19200 0x0000000e
-#define B38400 0x0000000f
-#define B57600 0x00001001
-#define B115200 0x00001002
-#define B230400 0x00001003
-
-#define CSIZE 0x00000030
-#define PARENB 0x00000100
-#define CS8 0x00000030
-
-#define TIOCGETA (('T' << 8) | 1)
-#define TIOCSETA (('T' << 8) | 2)
-#define TIOCSETAW (('T' << 8) | 3)
-#define TIOCSETAF (('T' << 8) | 4)
-
-#define TCSANOW 0
-#define TCSADRAIN 1
-#define TCSAFLUSH 2
-
-typedef unsigned int speed_t;
-
-void cfmakeraw(struct termios *);
-int cfsetspeed(struct termios *, speed_t);
-int tcgetattr(int, struct termios *);
-int tcsetattr(int, int, struct termios *);
-
-#endif /* !_LOCORE */
-
-/* linux/asm/unistd.h */
-#define __NR_SYSCALL_BASE 0x900000
-#define __NR_exit (__NR_SYSCALL_BASE+1)
-#define __NR_read (__NR_SYSCALL_BASE+3)
-#define __NR_write (__NR_SYSCALL_BASE+4)
-#define __NR_open (__NR_SYSCALL_BASE+5)
-#define __NR_close (__NR_SYSCALL_BASE+6)
-#define __NR_time (__NR_SYSCALL_BASE+13)
-#define __NR_lseek32 (__NR_SYSCALL_BASE+19)
-#define __NR_ioctl (__NR_SYSCALL_BASE+54)
-#define __NR_stat (__NR_SYSCALL_BASE+106)
-#define __NR_syscall (__NR_SYSCALL_BASE+113)
-#define __NR_select (__NR_SYSCALL_BASE+142)
-
-#undef SYS_select
-#define SYS_select __NR_select
diff --git a/sys/arch/zaurus/stand/zboot/conf.c b/sys/arch/zaurus/stand/zboot/conf.c
deleted file mode 100644
index fae16527e06..00000000000
--- a/sys/arch/zaurus/stand/zboot/conf.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $OpenBSD: conf.c,v 1.9 2014/07/20 19:33:54 tobias Exp $ */
-
-/*
- * Copyright (c) 1996 Michael Shalayeff
- * 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 REGENTS 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/param.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <libsa.h>
-#include <lib/libsa/ufs.h>
-#ifdef notdef
-#include <lib/libsa/cd9660.h>
-#include <lib/libsa/fat.h>
-#include <lib/libsa/nfs.h>
-#include <lib/libsa/tftp.h>
-#include <lib/libsa/netif.h>
-#endif
-#include "unixdev.h"
-#include <dev/cons.h>
-
-const char version[] = "2.10";
-int debug = 1;
-
-void (*zaurus_probe1[])(void) = {
- cninit
-};
-void (*zaurus_probe2[])(void) = {
- diskprobe
-};
-
-struct zaurus_boot_probes probe_list[] = {
- { "probing", zaurus_probe1, nitems(zaurus_probe1) },
- { "disk", zaurus_probe2, nitems(zaurus_probe2) }
-};
-int nibprobes = nitems(probe_list);
-
-
-void (*sa_cleanup)(void) = NULL;
-
-struct fs_ops file_system[] = {
- { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek,
- ufs_stat, ufs_readdir },
-#ifdef notdef
- { fat_open, fat_close, fat_read, fat_write, fat_seek,
- fat_stat, fat_readdir },
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek,
- nfs_stat, nfs_readdir },
- { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
- cd9660_stat, cd9660_readdir },
-#endif
-#ifdef _TEST
- { null_open, null_close, null_read, null_write, null_seek,
- null_stat, null_readdir }
-#endif
-};
-int nfsys = nitems(file_system);
-
-struct devsw devsw[] = {
- { "UNIX", unixstrategy, unixopen, unixclose, unixioctl },
-#if 0
- { "TFTP", tftpstrategy, tftpopen, tftpclose, tftpioctl },
-#endif
-};
-int ndevs = nitems(devsw);
-
-#ifdef notdef
-struct netif_driver *netif_drivers[] = {
- NULL
-};
-int n_netif_drivers = nitems(netif_drivers);
-#endif
-
-struct consdev constab[] = {
- { cn_probe, cn_init, cn_getc, cn_putc },
- { com_probe, com_init, com_getc, com_putc },
- { NULL }
-};
-struct consdev *cn_tab = constab;
diff --git a/sys/arch/zaurus/stand/zboot/crt0.c b/sys/arch/zaurus/stand/zboot/crt0.c
deleted file mode 100644
index 189bff0bd51..00000000000
--- a/sys/arch/zaurus/stand/zboot/crt0.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* $OpenBSD: crt0.c,v 1.1 2005/04/16 17:22:44 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-void _start(void) asm("_start");
-
-void
-_start(void)
-{
- boot(0);
-}
diff --git a/sys/arch/zaurus/stand/zboot/devopen.c b/sys/arch/zaurus/stand/zboot/devopen.c
deleted file mode 100644
index 70eb707c4c6..00000000000
--- a/sys/arch/zaurus/stand/zboot/devopen.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.12 2014/07/13 09:26:08 jasper Exp $ */
-
-/*
- * Copyright (c) 1996-1999 Michael Shalayeff
- * 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 OR HIS RELATIVES 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 MIND, 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/param.h>
-#include <sys/disklabel.h>
-#include <dev/cons.h>
-#include "libsa.h"
-#include <stand/boot/cmd.h>
-
-/* XXX use slot for 'rd' for 'hd' pseudo-device */
-const char bdevs[][4] = {
- "wd", "", "fd", "", "sd", "st", "cd", "",
- "", "", "", "", "", "", "", "", "", "hd", ""
-
-};
-const int nbdevs = nitems(bdevs);
-
-const char cdevs[][4] = {
- "cn", "", "", "", "", "", "", "",
- "", "", "", "", "com"
-};
-const int ncdevs = nitems(cdevs);
-
-/* pass dev_t to the open routines */
-int
-devopen(struct open_file *f, const char *fname, char **file)
-{
- struct devsw *dp = devsw;
- register int i, rc = 1;
-
- *file = (char *)fname;
-
-#ifdef DEBUG
- if (debug)
- printf("devopen:");
-#endif
-
- for (i = 0; i < ndevs && rc != 0; dp++, i++) {
-#ifdef DEBUG
- if (debug)
- printf(" %s: ", dp->dv_name);
-#endif
- if ((rc = (*dp->dv_open)(f, file)) == 0) {
- f->f_dev = dp;
- return 0;
- }
-#ifdef DEBUG
- else if (debug)
- printf("%d", rc);
-#endif
-
- }
-#ifdef DEBUG
- if (debug)
- putchar('\n');
-#endif
-
- if ((f->f_flags & F_NODEV) == 0)
- f->f_dev = dp;
-
- return rc;
-}
-
-void
-devboot(dev_t bootdev, char *p)
-{
- dev_t unit = 0; /* XXX */
-
- *p++ = 'h';
- *p++ = 'd';
- *p++ = '0' + unit;
- *p++ = 'a';
- *p = '\0';
-}
-
-char ttyname_buf[8];
-
-char *
-ttyname(int fd)
-{
- snprintf(ttyname_buf, sizeof ttyname_buf, "%s%d",
- cdevs[major(cn_tab->cn_dev)], minor(cn_tab->cn_dev));
-
- return ttyname_buf;
-}
-
-dev_t
-ttydev(char *name)
-{
- int i, unit = -1;
- char *no = name + strlen(name) - 1;
-
- while (no >= name && *no >= '0' && *no <= '9')
- unit = (unit < 0 ? 0 : (unit * 10)) + *no-- - '0';
- if (no < name || unit < 0)
- return NODEV;
- for (i = 0; i < ncdevs; i++)
- if (strncmp(name, cdevs[i], no - name + 1) == 0)
- return (makedev(i, unit));
- return NODEV;
-}
diff --git a/sys/arch/zaurus/stand/zboot/disk.h b/sys/arch/zaurus/stand/zboot/disk.h
deleted file mode 100644
index 9308972b483..00000000000
--- a/sys/arch/zaurus/stand/zboot/disk.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $OpenBSD: disk.h,v 1.1 2005/05/24 20:38:20 uwe Exp $ */
-
-/*
- * Copyright (c) 1997 Tobias Weingartner
- * 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 REGENTS 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 _DISKPROBE_H
-#define _DISKPROBE_H
-
-#include <sys/queue.h>
-
-/* XXX snatched from <i386/biosdev.h> */
-#if 1
-/* Info about disk from the bios, plus the mapping from
- * BIOS numbers to BSD major (driver?) number.
- *
- * Also, do not bother with BIOSN*() macros, just parcel
- * the info out, and use it like this. This makes for less
- * of a dependance on BIOSN*() macros having to be the same
- * across /boot, /bsd, and userland.
- */
-#define BOOTARG_DISKINFO 1
-typedef struct _bios_diskinfo {
- /* BIOS section */
- int bios_number; /* BIOS number of drive (or -1) */
- u_int bios_cylinders; /* BIOS cylinders */
- u_int bios_heads; /* BIOS heads */
- u_int bios_sectors; /* BIOS sectors */
- int bios_edd; /* EDD support */
-
- /* BSD section */
- dev_t bsd_dev; /* BSD device */
-
- /* Checksum section */
- u_int32_t checksum; /* Checksum for drive */
-
- /* Misc. flags */
- u_int32_t flags;
-#define BDI_INVALID 0x00000001 /* I/O error during checksumming */
-#define BDI_GOODLABEL 0x00000002 /* Had SCSI or ST506/ESDI disklabel */
-#define BDI_BADLABEL 0x00000004 /* Had another disklabel */
-#define BDI_EL_TORITO 0x00000008 /* 2,048-byte sectors */
-#define BDI_PICKED 0x80000000 /* kernel-only: cksum matched */
-
-} bios_diskinfo_t;
-
-#define BOOTARG_CKSUMLEN 3 /* u_int32_t */
-#endif /* 1 */
-
-/* All the info on a disk we've found */
-struct diskinfo {
- bios_diskinfo_t bios_info;
- struct disklabel disklabel;
-
- dev_t bsddev, bootdev;
-
- TAILQ_ENTRY(diskinfo) list;
-};
-TAILQ_HEAD(disklist_lh, diskinfo);
-
-/* diskprobe.c */
-struct diskinfo *dkdevice(dev_t, dev_t);
-void bios_devpath(int, int, char *);
-char *bios_getdiskinfo(int, bios_diskinfo_t *);
-int bios_getdospart(bios_diskinfo_t *);
-char *bios_getdisklabel(bios_diskinfo_t *, struct disklabel *);
-void dump_diskinfo(void);
-
-#endif /* _DISKPROBE_H */
diff --git a/sys/arch/zaurus/stand/zboot/diskprobe.c b/sys/arch/zaurus/stand/zboot/diskprobe.c
deleted file mode 100644
index 8abd24f805e..00000000000
--- a/sys/arch/zaurus/stand/zboot/diskprobe.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/* $OpenBSD: diskprobe.c,v 1.5 2014/07/12 21:03:38 tedu Exp $ */
-
-/*
- * Copyright (c) 1997 Tobias Weingartner
- * 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 REGENTS 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.
- *
- */
-
-/* We want the disk type names from disklabel.h */
-#undef DKTYPENAMES
-
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/reboot.h>
-#include <sys/disklabel.h>
-#include <stand/boot/bootarg.h>
-#if 0
-#include <machine/biosvar.h>
-#endif
-#include <lib/libz/zlib.h>
-#include "disk.h"
-#if 0
-#include "biosdev.h"
-#endif
-#include "libsa.h"
-
-#define MAX_CKSUMLEN MAXBSIZE / DEV_BSIZE /* Max # of blks to cksum */
-
-/* Disk spin-up wait timeout. */
-static u_int timeout = 10;
-
-/* Local Prototypes */
-static void hardprobe(void);
-
-/* List of disk devices we found/probed */
-struct disklist_lh disklist;
-
-/*
- * Probe for all hard disks.
- */
-static void
-hardprobe(void)
-{
- struct diskinfo *dip;
- int i, order[] = { 0x80, 0x82 }; /* XXX probe disks in this order */
- u_int bsdunit, type;
- u_int scsi = 0, ide = 0;
- u_int disk = 0;
-
- /* Hard disks */
- for (i = 0; i < sizeof(order) / sizeof(order[0]); i++) {
- dip = alloc(sizeof(struct diskinfo));
- bzero(dip, sizeof(*dip));
-
- if (bios_getdiskinfo(order[i], &dip->bios_info) != NULL) {
- free(dip, 0);
- continue;
- }
-
- printf("hd%u", disk++);
-
- /* Try to find the label, to figure out device type. */
- if (bios_getdisklabel(&dip->bios_info, &dip->disklabel)
- == NULL) {
- printf("*");
- bsdunit = ide++;
- type = 0; /* XXX let it be IDE */
- } else {
- /* Best guess */
- switch (dip->disklabel.d_type) {
- case DTYPE_SCSI:
- type = 4;
- bsdunit = scsi++;
- dip->bios_info.flags |= BDI_GOODLABEL;
- break;
-
- case DTYPE_ESDI:
- case DTYPE_ST506:
- type = 0;
- bsdunit = ide++;
- dip->bios_info.flags |= BDI_GOODLABEL;
- break;
-
- default:
- dip->bios_info.flags |= BDI_BADLABEL;
- type = 0; /* XXX Suggest IDE */
- bsdunit = ide++;
- }
- }
-
- dip->bios_info.checksum = 0; /* just in case */
- /* Fill out best we can. */
- dip->bios_info.bsd_dev =
- MAKEBOOTDEV(type, 0, 0, bsdunit, RAW_PART);
-
- /* Add to queue of disks. */
- TAILQ_INSERT_TAIL(&disklist, dip, list);
-
- printf(" ");
- }
-}
-
-/* Probe for all BIOS supported disks */
-u_int32_t bios_cksumlen;
-void
-diskprobe(void)
-{
- struct diskinfo *dip;
- int i;
-
- /* These get passed to kernel */
- bios_diskinfo_t *bios_diskinfo;
-
- /* Init stuff */
- TAILQ_INIT(&disklist);
-
- /* Do probes */
- hardprobe();
-
-#if 0
- /* Checksumming of hard disks */
- for (i = 0; disksum(i++) && i < MAX_CKSUMLEN; )
- ;
- bios_cksumlen = i;
-
- /* Get space for passing bios_diskinfo stuff to kernel */
- for (i = 0, dip = TAILQ_FIRST(&disklist); dip;
- dip = TAILQ_NEXT(dip, list))
- i++;
- bios_diskinfo = alloc(++i * sizeof(bios_diskinfo_t));
-
- /* Copy out the bios_diskinfo stuff */
- for (i = 0, dip = TAILQ_FIRST(&disklist); dip;
- dip = TAILQ_NEXT(dip, list))
- bios_diskinfo[i++] = dip->bios_info;
-
- bios_diskinfo[i++].bios_number = -1;
- /* Register for kernel use */
- addbootarg(BOOTARG_CKSUMLEN, sizeof(u_int32_t), &bios_cksumlen);
- addbootarg(BOOTARG_DISKINFO, i * sizeof(bios_diskinfo_t),
- bios_diskinfo);
-#endif
-}
-
-/*
- * Find info on the disk given by major + unit number.
- */
-struct diskinfo *
-dkdevice(dev_t maj, dev_t unit)
-{
- struct diskinfo *dip;
-
- for (dip = TAILQ_FIRST(&disklist); dip;
- dip = TAILQ_NEXT(dip, list)) {
- /* XXX skip non-matching entries according to maj. */
-
- if (unit-- == 0)
- return dip;
- }
-
- return NULL;
-}
-
-/*
- * Find the Linux device path that corresponds to the given "BIOS" disk,
- * where 0x80 corresponds to /dev/hda, 0x81 to /dev/hdb, and so on.
- */
-void
-bios_devpath(int dev, int part, char *p)
-{
- *p++ = '/';
- *p++ = 'd';
- *p++ = 'e';
- *p++ = 'v';
- *p++ = '/';
- if ((dev & 0x80) != 0)
- *p++ = 'h';
- else
- *p++ = 'f';
- *p++ = 'd';
- *p++ = 'a' + (dev & 0x7f);
- if (part != -1)
- *p++ = '1' + part;
- *p = '\0';
-}
-
-/*
- * Fill out a bios_diskinfo_t for this device.
- */
-char *
-bios_getdiskinfo(int dev, bios_diskinfo_t *bdi)
-{
- static char path[PATH_MAX];
- struct linux_stat sb;
- char *p;
-
- bzero(bdi, sizeof *bdi);
- bdi->bios_number = -1;
-
- bios_devpath(dev, -1, path);
-
- if (ustat(path, &sb) != 0)
- return "no device node";
-
- bdi->bios_number = dev;
-
- if (bios_getdospart(bdi) < 0)
- return "no OpenBSD partition";
-
- return 0;
-}
-
-int
-bios_getdospart(bios_diskinfo_t *bdi)
-{
- char path[PATH_MAX];
- char buf[DEV_BSIZE];
- struct dos_partition *dp;
- int fd;
- u_int part;
- size_t rsize;
-
- bios_devpath(bdi->bios_number, -1, path);
-
- /*
- * Give disk devices some time to become ready when the first open
- * fails. Even when open succeeds the disk is sometimes not ready.
- */
- if ((fd = uopen(path, O_RDONLY)) == -1 && errno == ENXIO) {
- int t;
-
- while (fd == -1 && timeout > 0) {
- timeout--;
- sleep(1);
- fd = uopen(path, O_RDONLY);
- }
- if (fd != -1)
- sleep(2);
- }
- if (fd == -1)
- return -1;
-
- /* Read the disk's MBR. */
- if (unixstrategy((void *)fd, F_READ, DOSBBSECTOR,
- DEV_BSIZE, buf, &rsize) != 0 || rsize != DEV_BSIZE) {
- uclose(fd);
- errno = EIO;
- return -1;
- }
-
- /* Find OpenBSD primary partition in the disk's MBR. */
- dp = (struct dos_partition *)&buf[DOSPARTOFF];
- for (part = 0; part < NDOSPART; part++)
- if (dp[part].dp_typ == DOSPTYP_OPENBSD)
- break;
- if (part == NDOSPART) {
- uclose(fd);
- errno = ERDLAB;
- return -1;
- }
- uclose(fd);
-
- return part;
-}
-
-char *
-bios_getdisklabel(bios_diskinfo_t *bdi, struct disklabel *label)
-{
- char path[PATH_MAX];
- char buf[DEV_BSIZE];
- int part;
- int fd;
- size_t rsize;
-
- part = bios_getdospart(bdi);
- if (part < 0)
- return "no OpenBSD partition";
-
- bios_devpath(bdi->bios_number, part, path);
-
- /* Test if the OpenBSD partition has a valid disklabel. */
- if ((fd = uopen(path, O_RDONLY)) != -1) {
- char *msg = "failed to read disklabel";
-
- if (unixstrategy((void *)fd, F_READ, LABELSECTOR,
- DEV_BSIZE, buf, &rsize) == 0 && rsize == DEV_BSIZE)
- msg = getdisklabel(buf, label);
- uclose(fd);
- /* Don't wait for other disks if this label is ok. */
- if (msg == NULL)
- timeout = 0;
- return (msg);
- }
-
- return "failed to open partition";
-}
diff --git a/sys/arch/zaurus/stand/zboot/exec.c b/sys/arch/zaurus/stand/zboot/exec.c
deleted file mode 100644
index d256f6e386b..00000000000
--- a/sys/arch/zaurus/stand/zboot/exec.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* $OpenBSD: exec.c,v 1.2 2005/01/10 21:10:57 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "libsa.h"
-#include <lib/libsa/loadfile.h>
-
-void
-run_loadfile(u_long *marks, int howto)
-{
- panic("run_loadfile");
-}
diff --git a/sys/arch/zaurus/stand/zboot/exit.c b/sys/arch/zaurus/stand/zboot/exit.c
deleted file mode 100644
index a64edf462f4..00000000000
--- a/sys/arch/zaurus/stand/zboot/exit.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: exit.c,v 1.5 2011/04/07 15:12:03 drahn Exp $ */
-/* $NetBSD: exit.c,v 1.11 1996/12/01 20:22:19 pk Exp $ */
-
-/*-
- * Copyright (c) 1993 John Brezak
- * 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.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 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/stdarg.h>
-
-#include "libsa.h"
-
-/* unixcons.c */
-extern struct termios tioc;
-extern int tioc_valid;
-extern __dead void uexit(int);
-
-__dead void
-panic(const char *fmt, ...)
-{
- extern void closeall(void);
- va_list ap;
- static int paniced;
-
- if (!paniced) {
- paniced = 1;
- closeall();
- }
-
- va_start(ap, fmt);
- vprintf(fmt, ap);
- printf("\n");
- va_end(ap);
-#if 0
- _rtt();
-#else
- uexit(0);
-#endif
- /*NOTREACHED*/
-}
-
-void
-exit(void)
-{
- if (tioc_valid)
- (void)tcsetattr(0, TCSADRAIN, &tioc);
- uexit(0);
-}
diff --git a/sys/arch/zaurus/stand/zboot/libsa.h b/sys/arch/zaurus/stand/zboot/libsa.h
deleted file mode 100644
index b0c4064eeeb..00000000000
--- a/sys/arch/zaurus/stand/zboot/libsa.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $OpenBSD: libsa.h,v 1.3 2005/05/24 20:38:20 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <lib/libsa/stand.h>
-
-#include "compat_linux.h"
-
-#define EXEC_ELF
-
-#define DEFAULT_KERNEL_ADDRESS 0xa0200000
-
-struct zaurus_boot_probes {
- char *name;
- void (**probes)(void);
- int count;
-};
-
-void diskprobe(void);
-
-extern const char bdevs[][4];
-extern const int nbdevs;
-
-extern struct zaurus_boot_probes probe_list[];
-extern int nibprobes;
-#if 0
-extern void (*devboot_p)(dev_t, char *);
-#endif
-
-extern int debug;
diff --git a/sys/arch/zaurus/stand/zboot/loadfile.c b/sys/arch/zaurus/stand/zboot/loadfile.c
deleted file mode 100644
index b7551c9cc89..00000000000
--- a/sys/arch/zaurus/stand/zboot/loadfile.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */
-/* $OpenBSD: loadfile.c,v 1.6 2013/10/17 15:54:11 deraadt Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center and by Christos Zoulas.
- *
- * 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.
- */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef _STANDALONE
-#include <lib/libkern/libkern.h>
-#include <lib/libsa/stand.h>
-#else
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <err.h>
-#endif
-
-#include <sys/param.h>
-#include <sys/exec.h>
-
-#include "compat_linux.h"
-#include "pathnames.h"
-#include <lib/libsa/loadfile.h>
-#include <stand/boot/cmd.h>
-
-#define BOOT_ZBOOT
-
-#ifdef BOOT_ELF
-#include <sys/exec_elf.h>
-static int elf_exec(int, Elf_Ehdr *, u_long *, int);
-#endif
-#ifdef BOOT_ZBOOT
-#include <dev/cons.h> /* XXX */
-static int zboot_exec(int, u_long *, int);
-#endif
-
-/*
- * Open 'filename', read in program and and return 0 if ok 1 on error.
- * Fill in marks
- */
-int
-loadfile(const char *fname, u_long *marks, int flags)
-{
- union {
-#ifdef BOOT_ELF
- Elf_Ehdr elf;
-#endif
- } hdr;
- ssize_t nr;
- int fd, rval;
-
- /* Open the file. */
- if ((fd = open(fname, 0)) < 0) {
- WARN(("open %s", fname ? fname : "<default>"));
- return -1;
- }
-
- /* Read the exec header. */
- if ((nr = read(fd, &hdr, sizeof(hdr))) != sizeof(hdr)) {
- WARN(("read header"));
- goto err;
- }
-
-#ifdef BOOT_ELF
- if (memcmp(hdr.elf.e_ident, ELFMAG, SELFMAG) == 0 &&
- hdr.elf.e_ident[EI_CLASS] == ELFCLASS) {
-#ifdef BOOT_ZBOOT
- rval = zboot_exec(fd, marks, flags);
-#else
- rval = elf_exec(fd, &hdr.elf, marks, flags);
-#endif
- } else
-#endif
- {
- rval = 1;
- errno = EFTYPE;
- WARN(("%s", fname ? fname : "<default>"));
- }
-
- if (rval == 0) {
- PROGRESS(("=0x%lx\n", marks[MARK_END] - marks[MARK_START]));
- return fd;
- }
-err:
- (void)close(fd);
- return -1;
-}
-
-#ifdef BOOT_ELF
-static int
-elf_exec(int fd, Elf_Ehdr *elf, u_long *marks, int flags)
-{
- Elf_Shdr *shp;
- Elf_Phdr *phdr;
- Elf_Off off;
- int i;
- size_t sz;
- int first;
- int havesyms;
- paddr_t minp = ~0, maxp = 0, pos = 0;
- paddr_t offset = marks[MARK_START], shpp, elfp;
-
- sz = elf->e_phnum * sizeof(Elf_Phdr);
- phdr = ALLOC(sz);
-
- if (lseek(fd, elf->e_phoff, SEEK_SET) == -1) {
- WARN(("lseek phdr"));
- FREE(phdr, sz);
- return 1;
- }
- if (read(fd, phdr, sz) != sz) {
- WARN(("read program headers"));
- FREE(phdr, sz);
- return 1;
- }
-
- for (first = 1, i = 0; i < elf->e_phnum; i++) {
-
- if (phdr[i].p_type != PT_LOAD ||
- (phdr[i].p_flags & (PF_W|PF_R|PF_X)) == 0)
- continue;
-
-#define IS_TEXT(p) (p.p_flags & PF_X)
-#define IS_DATA(p) ((p.p_flags & PF_X) == 0)
-#define IS_BSS(p) (p.p_filesz < p.p_memsz)
- /*
- * XXX: Assume first address is lowest
- */
- if ((IS_TEXT(phdr[i]) && (flags & LOAD_TEXT)) ||
- (IS_DATA(phdr[i]) && (flags & LOAD_DATA))) {
-
- /* Read in segment. */
- PROGRESS(("%s%lu", first ? "" : "+",
- (u_long)phdr[i].p_filesz));
-
- if (lseek(fd, phdr[i].p_offset, SEEK_SET) == -1) {
- WARN(("lseek text"));
- FREE(phdr, sz);
- return 1;
- }
- if (READ(fd, phdr[i].p_vaddr, phdr[i].p_filesz) !=
- phdr[i].p_filesz) {
- WARN(("read text"));
- FREE(phdr, sz);
- return 1;
- }
- first = 0;
-
- }
- if ((IS_TEXT(phdr[i]) && (flags & (LOAD_TEXT|COUNT_TEXT))) ||
- (IS_DATA(phdr[i]) && (flags & (LOAD_DATA|COUNT_TEXT)))) {
- pos = phdr[i].p_vaddr;
- if (minp > pos)
- minp = pos;
- pos += phdr[i].p_filesz;
- if (maxp < pos)
- maxp = pos;
- }
-
- /* Zero out bss. */
- if (IS_BSS(phdr[i]) && (flags & LOAD_BSS)) {
- PROGRESS(("+%lu",
- (u_long)(phdr[i].p_memsz - phdr[i].p_filesz)));
- BZERO((phdr[i].p_vaddr + phdr[i].p_filesz),
- phdr[i].p_memsz - phdr[i].p_filesz);
- }
- if (IS_BSS(phdr[i]) && (flags & (LOAD_BSS|COUNT_BSS))) {
- pos += phdr[i].p_memsz - phdr[i].p_filesz;
- if (maxp < pos)
- maxp = pos;
- }
- }
- FREE(phdr, sz);
-
- /*
- * Copy the ELF and section headers.
- */
- elfp = maxp = roundup(maxp, sizeof(long));
- if (flags & (LOAD_HDR|COUNT_HDR))
- maxp += sizeof(Elf_Ehdr);
-
- if (flags & (LOAD_SYM|COUNT_SYM)) {
- if (lseek(fd, elf->e_shoff, SEEK_SET) == -1) {
- WARN(("lseek section headers"));
- return 1;
- }
- sz = elf->e_shnum * sizeof(Elf_Shdr);
- shp = ALLOC(sz);
-
- if (read(fd, shp, sz) != sz) {
- WARN(("read section headers"));
- return 1;
- }
-
- shpp = maxp;
- maxp += roundup(sz, sizeof(long));
-
- /*
- * Now load the symbol sections themselves. Make sure the
- * sections are aligned. Don't bother with string tables if
- * there are no symbol sections.
- */
- off = roundup((sizeof(Elf_Ehdr) + sz), sizeof(long));
-
- for (havesyms = i = 0; i < elf->e_shnum; i++)
- if (shp[i].sh_type == SHT_SYMTAB)
- havesyms = 1;
-
- for (first = 1, i = 0; i < elf->e_shnum; i++) {
- if (shp[i].sh_type == SHT_SYMTAB ||
- shp[i].sh_type == SHT_STRTAB) {
- if (havesyms && (flags & LOAD_SYM)) {
- PROGRESS(("%s%ld", first ? " [" : "+",
- (u_long)shp[i].sh_size));
- if (lseek(fd, shp[i].sh_offset,
- SEEK_SET) == -1) {
- WARN(("lseek symbols"));
- FREE(shp, sz);
- return 1;
- }
- if (READ(fd, maxp, shp[i].sh_size) !=
- shp[i].sh_size) {
- WARN(("read symbols"));
- FREE(shp, sz);
- return 1;
- }
- }
- maxp += roundup(shp[i].sh_size,
- sizeof(long));
- shp[i].sh_offset = off;
- off += roundup(shp[i].sh_size, sizeof(long));
- first = 0;
- }
- }
- if (flags & LOAD_SYM) {
- BCOPY(shp, shpp, sz);
-
- if (havesyms && first == 0)
- PROGRESS(("]"));
- }
- FREE(shp, sz);
- }
-
- /*
- * Frob the copied ELF header to give information relative
- * to elfp.
- */
- if (flags & LOAD_HDR) {
- elf->e_phoff = 0;
- elf->e_shoff = sizeof(Elf_Ehdr);
- elf->e_phentsize = 0;
- elf->e_phnum = 0;
- BCOPY(elf, elfp, sizeof(*elf));
- }
-
- marks[MARK_START] = LOADADDR(minp);
- marks[MARK_ENTRY] = LOADADDR(elf->e_entry);
- marks[MARK_NSYM] = 1; /* XXX: Kernel needs >= 0 */
- marks[MARK_SYM] = LOADADDR(elfp);
- marks[MARK_END] = LOADADDR(maxp);
- return 0;
-}
-#endif /* BOOT_ELF */
-
-#ifdef BOOT_ZBOOT
-static int
-zboot_exec(int fd, u_long *marks, int flags)
-{
- char buf[512];
- char *p;
- int tofd;
- int sz;
- int i;
-
- /* XXX cheating here by assuming that Xboot() was called before. */
-
- tofd = uopen(_PATH_ZBOOT, O_WRONLY);
- if (tofd == -1) {
- printf("%s: can't open (errno %d)\n", _PATH_ZBOOT, errno);
- return 1;
- }
-
- p = cmd.path;
- for (; *p != '\0'; p++)
- if (*p == ':') {
- strlcpy(buf, p+1, sizeof(buf));
- break;
- }
- if (*p == '\0')
- strlcpy(buf, cmd.path, sizeof(buf));
-
- p = buf;
- for (; *p == '/'; p++)
- ;
-
- sz = strlen(p);
- if (uwrite(tofd, p, sz) != sz) {
- printf("zboot_exec: argument write error\n");
- goto err;
- }
-
- buf[0] = ' ';
- buf[1] = '-';
- if (uwrite(tofd, buf, 2) != 2) {
- printf("zboot_exec: argument write error\n");
- goto err;
- }
-
- i = (cmd.argc > 1 && cmd.argv[1][0] != '-') ? 2 : 1;
- for (; i < cmd.argc; i++) {
- p = cmd.argv[i];
- if (*p == '-')
- p++;
- sz = strlen(p);
- if (uwrite(tofd, p, sz) != sz) {
- printf("zboot_exec: argument write error\n");
- goto err;
- }
- }
-
- /* Select UART unit for serial console. */
- if (cn_tab && major(cn_tab->cn_dev) == 12) {
- buf[0] = '0' + minor(cn_tab->cn_dev);
- if (uwrite(tofd, buf, 1) != 1) {
- printf("zboot_exec: argument write error\n");
- goto err;
- }
- }
-
- /* Commit boot arguments. */
- uclose(tofd);
-
- tofd = uopen(_PATH_ZBOOT, O_WRONLY);
- if (tofd == -1) {
- printf("%s: can't open (errno %d)\n", _PATH_ZBOOT, errno);
- return 1;
- }
-
- if (lseek(fd, 0, SEEK_SET) != 0) {
- printf("%s: seek error\n", _PATH_ZBOOT);
- goto err;
- }
-
- while ((sz = read(fd, buf, sizeof(buf))) == sizeof(buf)) {
- if ((sz = uwrite(tofd, buf, sz)) != sizeof(buf)) {
- printf("%s: write error\n", _PATH_ZBOOT);
- goto err;
- }
- }
-
- if (sz < 0) {
- printf("zboot_exec: read error\n");
- goto err;
- }
-
- if (sz >= 0 && uwrite(tofd, buf, sz) != sz) {
- printf("zboot_exec: write error\n");
- goto err;
- }
-
- uclose(tofd);
- return 0;
-
-err:
- uclose(tofd);
- return 1;
-}
-#endif /* BOOT_ZBOOT */
diff --git a/sys/arch/zaurus/stand/zboot/machdep.c b/sys/arch/zaurus/stand/zboot/machdep.c
deleted file mode 100644
index e0a38d66eee..00000000000
--- a/sys/arch/zaurus/stand/zboot/machdep.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.4 2005/05/24 20:38:20 uwe Exp $ */
-
-/*
- * Copyright (c) 2004 Tom Cosgrove
- * Copyright (c) 1997-1999 Michael Shalayeff
- * 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 OR HIS RELATIVES 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 MIND, 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 "libsa.h"
-
-char _alloc_heap[4 * 1024 * 1024];
-
-void
-machdep(void)
-{
- int i, j;
- struct zaurus_boot_probes *pr;
-
- /*
- * The list of probe routines is now in conf.c.
- */
- for (i = 0; i < nibprobes; i++) {
- pr = &probe_list[i];
- if (pr != NULL) {
- printf("%s: ", pr->name);
-
- for (j = 0; j < pr->count; j++)
- (*(pr->probes)[j])();
- printf("\n");
- }
- }
-}
diff --git a/sys/arch/zaurus/stand/zboot/pathnames.h b/sys/arch/zaurus/stand/zboot/pathnames.h
deleted file mode 100644
index 2c80cd92958..00000000000
--- a/sys/arch/zaurus/stand/zboot/pathnames.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $OpenBSD: pathnames.h,v 1.3 2005/01/14 08:10:16 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#define _PATH_ZBOOT "/proc/zboot"
diff --git a/sys/arch/zaurus/stand/zboot/termios.c b/sys/arch/zaurus/stand/zboot/termios.c
deleted file mode 100644
index e35d760be25..00000000000
--- a/sys/arch/zaurus/stand/zboot/termios.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $OpenBSD: termios.c,v 1.3 2016/03/02 15:14:44 naddy Exp $ */
-
-/*-
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 "libsa.h"
-
-/* Linux-specific line speed handling from linux_termios.c */
-
-static speed_t linux_speeds[] = {
- 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
- 9600, 19200, 38400, 57600, 115200, 230400
-};
-
-static const int linux_spmasks[] = {
- B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800,
- B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400
-};
-
-int
-cfsetspeed(struct termios *t, speed_t speed)
-{
- int mask;
- int i;
-
- mask = B9600; /* XXX default value should this be 0? */
- for (i = 0; i < sizeof (linux_speeds) / sizeof (speed_t); i++) {
- if (speed == linux_speeds[i]) {
- mask = linux_spmasks[i];
- break;
- }
- }
- t->c_cflag &= ~CBAUD;
- t->c_cflag |= mask;
-
- return (0);
-}
-
-void
-cfmakeraw(struct termios *t)
-{
- t->c_iflag &= ~(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
- t->c_oflag &= ~OPOST;
- t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
- t->c_cflag &= ~(CSIZE|PARENB);
- t->c_cflag |= CS8;
-}
-
-int
-tcgetattr(int fd, struct termios *t)
-{
- return (uioctl(fd, TIOCGETA, t));
-}
-
-/* This function differs slightly from tcsetattr() in libc. */
-int
-tcsetattr(int fd, int action, struct termios *t)
-{
- switch (action) {
- case TCSANOW:
- action = TIOCSETA;
- break;
- case TCSADRAIN:
- action = TIOCSETAW;
- break;
- case TCSAFLUSH:
- action = TIOCSETAF;
- break;
- default:
- errno = EINVAL;
- return (-1);
- }
- return (uioctl(fd, action, t));
-}
diff --git a/sys/arch/zaurus/stand/zboot/unixcons.c b/sys/arch/zaurus/stand/zboot/unixcons.c
deleted file mode 100644
index c6502ac41f8..00000000000
--- a/sys/arch/zaurus/stand/zboot/unixcons.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* $OpenBSD: unixcons.c,v 1.2 2008/01/23 16:37:57 jsing Exp $ */
-
-/*
- * Copyright (c) 1997-1999 Michael Shalayeff
- * 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 OR HIS RELATIVES 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 MIND, 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/types.h>
-#include <dev/cons.h>
-#include "libsa.h"
-#include "unixdev.h"
-
-struct termios tioc;
-int tioc_valid = 0;
-
-#define NCOM 3
-const char *compath[NCOM] = {
- "/dev/ttyS0", /* com0 */
- "/dev/ttyS2", /* com1 */
- "/dev/ttyS1" /* com2 */
-};
-
-int com_fd = -1; /* open serial port */
-int com_speed = 9600; /* default speed is 9600 baud */
-
-/* Local prototypes */
-void common_putc(dev_t, int);
-int common_getc(dev_t);
-
-
-void
-common_putc(dev_t dev, int c)
-{
- /* Always send to stdout. */
- (void)uwrite(1, &c, 1);
-
- /* Copy to serial if open. */
- if (com_fd != -1)
- (void)uwrite(com_fd, &c, 1);
-}
-
-int
-common_getc(dev_t dev)
-{
- struct timeval tv;
- fd_set fdset;
- int fd, nfds, n;
- char c;
-
- while (1) {
- tv.tv_sec = 0;
- tv.tv_usec = 10000;
- FD_ZERO(&fdset);
-
- /* Always read from stdin. */
- fd = 0;
- nfds = 1;
- FD_SET(fd, &fdset);
-
- /* Read from serial if open. */
- if (com_fd != -1) {
- nfds = com_fd+1;
- FD_SET(com_fd, &fdset);
- }
-
- n = uselect(nfds, &fdset, NULL, NULL, &tv);
- if ((dev & 0x80) != 0)
- return (n > 0);
-
- if (n > 0)
- break;
- }
-
- for (fd = 0; fd < nfds; fd++)
- if (FD_ISSET(fd, &fdset))
- break;
-
- return (uread(fd, &c, 1) < 1 ? -1 : c);
-}
-
-
-void
-cn_probe(struct consdev *cn)
-{
- cn->cn_pri = CN_MIDPRI;
- cn->cn_dev = makedev(0,0);
- printf("cn%d ", minor(cn->cn_dev));
-}
-
-void
-cn_init(struct consdev *cn)
-{
- struct termios t;
-
- if (!tioc_valid && tcgetattr(0, &t) == 0) {
- tioc = t;
- tioc_valid = 1;
- cfmakeraw(&t);
- (void)tcsetattr(0, TCSAFLUSH, &t);
- }
-}
-
-void
-cn_putc(dev_t dev, int c)
-{
- common_putc(dev, c);
-}
-
-int
-cn_getc(dev_t dev)
-{
- return (common_getc(dev));
-}
-
-
-void
-com_probe(struct consdev *cn)
-{
- int i;
- struct linux_stat sb;
-
- for (i = 0; i < NCOM; i++) {
- if (ustat(compath[i], &sb) != 0)
- continue;
- printf("com%d ", i);
- }
-
- cn->cn_pri = CN_LOWPRI;
- /* XXX from arm/conf.c */
- cn->cn_dev = makedev(12, 0);
-}
-
-void
-com_init(struct consdev *cn)
-{
- struct termios t;
- int unit = minor(cn->cn_dev);
-
- if (unit >= NCOM)
- return;
-
- if (com_fd != -1)
- uclose(com_fd);
-
- com_fd = uopen(compath[unit], O_RDWR);
- if (com_fd == -1)
- return;
-
- if (tcgetattr(com_fd, &t) == 0) {
- cfmakeraw(&t);
- cfsetspeed(&t, (speed_t)com_speed);
- (void)tcsetattr(com_fd, TCSAFLUSH, &t);
- }
-}
-
-void
-com_putc(dev_t dev, int c)
-{
- common_putc(dev, c);
-}
-
-int
-com_getc(dev_t dev)
-{
- return (common_getc(dev));
-}
-
-
-int
-cnspeed(dev_t dev, int sp)
-{
- if (major(dev) == 12) /* comN */
- return (comspeed(dev, sp));
-
- /* cn0 or anything else */
- return (9600);
-}
-
-/* call with sp == 0 to query the current speed */
-int
-comspeed(dev_t dev, int sp)
-{
- struct termios t;
-
- if (sp <= 0)
- return (com_speed);
-
- /* check if the new speed is a valid baud rate */
- if (cfsetspeed(&t, (speed_t)sp) != 0)
- sp = com_speed;
-
- if (cn_tab && cn_tab->cn_dev == dev && com_speed != sp) {
- printf("com%d: changing speed to %d baud in 5 seconds, "
- "change your terminal to match!\n\a",
- minor(dev), sp);
- sleep(5);
- if (com_fd != -1 && tcgetattr(com_fd, &t) == 0) {
- (void)cfsetspeed(&t, (speed_t)sp);
- (void)tcsetattr(com_fd, TCSAFLUSH, &t);
- }
- printf("\n");
- }
-
- if (com_speed != sp) {
- printf("com%d: %d baud\n", minor(dev), sp);
- com_speed = sp;
- }
-
- return (com_speed);
-}
diff --git a/sys/arch/zaurus/stand/zboot/unixdev.c b/sys/arch/zaurus/stand/zboot/unixdev.c
deleted file mode 100644
index a3a0ade2376..00000000000
--- a/sys/arch/zaurus/stand/zboot/unixdev.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* $OpenBSD: unixdev.c,v 1.8 2015/09/18 13:40:45 miod Exp $ */
-
-/*
- * Copyright (c) 1996-1998 Michael Shalayeff
- * 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 REGENTS 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/param.h>
-#include <sys/reboot.h>
-#include <sys/disklabel.h>
-#include <sys/syscall.h>
-#include <sys/time.h>
-#define open uopen
-#include <sys/fcntl.h>
-#include <dev/cons.h>
-#undef open
-#include "disk.h"
-#include "libsa.h"
-#include "unixdev.h"
-
-int
-unixstrategy(void *devdata, int rw, daddr32_t blk, size_t size, void *buf,
- size_t *rsize)
-{
- int rc = 0;
- off_t off;
-
-#ifdef UNIX_DEBUG
- printf("unixstrategy: %s %d bytes @ %d\n",
- (rw==F_READ?"reading":"writing"), size, blk);
-#endif
-
- off = (off_t)blk * DEV_BSIZE;
- if ((rc = ulseek((int)devdata, off, SEEK_SET)) >= 0)
- rc = (rw==F_READ) ? uread((int)devdata, buf, size) :
- uwrite((int)devdata, buf, size);
-
- if (rc >= 0) {
- *rsize = (size_t)rc;
- rc = 0;
- } else
- rc = errno;
-
- return rc;
-}
-
-int
-unixopen(struct open_file *f, ...)
-{
- va_list ap;
- char path[PATH_MAX];
- char *cp, **file;
- dev_t maj, unit, part, bsd_dev;
- struct diskinfo *dip;
-
- va_start(ap, f);
- cp = *(file = va_arg(ap, char **));
- va_end(ap);
-
-#ifdef UNIX_DEBUG
- if (debug)
- printf("unixopen: %s\n", cp);
-#endif
-
- f->f_devdata = NULL;
- /* Search for device specification. */
- if (strlen(cp) < 4)
- return ENOENT;
- cp += 2;
- if (cp[2] != ':') {
- if (cp[3] != ':')
- return ENOENT;
- else
- cp++;
- }
-
- for (maj = 0;
- maj < nbdevs && strncmp(*file, bdevs[maj], cp - *file) != 0;
- maj++)
- ;
- if (maj >= nbdevs) {
- printf("Unknown device: ");
- for (cp = *file; *cp != ':'; cp++)
- putchar(*cp);
- putchar('\n');
- return EADAPT;
- }
-
- /* Get unit. */
- if ('0' <= *cp && *cp <= '9')
- unit = *cp++ - '0';
- else {
- printf("Bad unit number\n");
- return EUNIT;
- }
-
- /* Get partition. */
- if ('a' <= *cp && *cp <= 'p')
- part = *cp++ - 'a';
- else {
- printf("Bad partition id\n");
- return EPART;
- }
-
- cp++; /* skip ':' */
- if (*cp != 0)
- *file = cp;
- else
- f->f_flags |= F_RAW;
-
- /* Find device. */
- dip = dkdevice(maj, unit);
- if (dip == (struct diskinfo *)NULL)
- return ENOENT;
-
- /* Fix up bootdev. */
- bsd_dev = dip->bios_info.bsd_dev;
- dip->bsddev = MAKEBOOTDEV(B_TYPE(bsd_dev), B_ADAPTOR(bsd_dev),
- B_CONTROLLER(bsd_dev), unit, part);
- dip->bootdev = MAKEBOOTDEV(B_TYPE(bsd_dev), B_ADAPTOR(bsd_dev),
- B_CONTROLLER(bsd_dev), B_UNIT(bsd_dev), part);
-
- /* Try for disklabel again (might be removable media). */
- if (dip->bios_info.flags & BDI_BADLABEL) {
- const char *st = bios_getdisklabel(&dip->bios_info,
- &dip->disklabel);
-#ifdef UNIX_DEBUG
- if (debug && st)
- printf("%s\n", st);
-#endif
- if (!st) {
- dip->bios_info.flags &= ~BDI_BADLABEL;
- dip->bios_info.flags |= BDI_GOODLABEL;
- } else
- return ERDLAB;
- }
-
- part = bios_getdospart(&dip->bios_info);
- bios_devpath(dip->bios_info.bios_number, part, path);
- f->f_devdata = (void *)uopen(path, O_RDONLY);
- if ((int)f->f_devdata == -1)
- return errno;
-
- return 0;
-}
-
-int
-unixclose(struct open_file *f)
-{
- return uclose((int)f->f_devdata);
-}
-
-int
-unixioctl(struct open_file *f, u_long cmd, void *data)
-{
- return uioctl((int)f->f_devdata, cmd, data);
-}
-
-off_t
-ulseek(int fd, off_t off, int wh)
-{
- extern long ulseek32(int, long, int);
- off_t r;
-
- /* XXX only SEEK_SET is used, so anything else can fail for now. */
-
- if (wh == SEEK_SET) {
- if (ulseek32(fd, 0, SEEK_SET) != 0)
- return -1;
- while (off > OFFT_OFFSET_MAX) {
- off -= OFFT_OFFSET_MAX;
- if (ulseek32(fd, OFFT_OFFSET_MAX, SEEK_CUR) < 0 &&
- errno != LINUX_EOVERFLOW)
- return -1;
- }
- r = ulseek32(fd, (long)off, SEEK_CUR);
- if (r == -1 && errno == LINUX_EOVERFLOW)
- r = off;
- } else
- r = ulseek32(fd, (long)off, wh);
-
- return r;
-}
-
-time_t
-getsecs(void)
-{
- return (time_t)syscall(__NR_time, NULL);
-}
-
-unsigned int
-sleep(unsigned int seconds)
-{
- unsigned int start;
-
- start = getsecs();
- while (getsecs() - start < seconds)
- ;
-
- return (0);
-}
diff --git a/sys/arch/zaurus/stand/zboot/unixdev.h b/sys/arch/zaurus/stand/zboot/unixdev.h
deleted file mode 100644
index 59935b8a746..00000000000
--- a/sys/arch/zaurus/stand/zboot/unixdev.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $OpenBSD: unixdev.h,v 1.2 2011/03/13 00:13:53 deraadt Exp $ */
-
-/*
- * Copyright (c) 1996 Michael Shalayeff
- * 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 REGENTS 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.
- *
- */
-
-/* unixdev.c */
-int unixstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int unixopen(struct open_file *, ...);
-int unixclose(struct open_file *);
-int unixioctl(struct open_file *, u_long, void *);
-
-/* unixcons.c */
-void cn_probe(struct consdev *);
-void cn_init(struct consdev *);
-void cn_putc(dev_t, int);
-int cn_getc(dev_t);
-void com_probe(struct consdev *);
-void com_init(struct consdev *);
-void com_putc(dev_t, int);
-int com_getc(dev_t);
-int comspeed(dev_t, int);
-
-/* unixsys.S */
-int uopen(const char *, int, ...);
-int uread(int, void *, size_t);
-int uwrite(int, void *, size_t);
-int uioctl(int, u_long, char *);
-int uclose(int);
-off_t ulseek(int, off_t, int);
-void uexit(int) __attribute__((noreturn));
-int uselect(int, fd_set *, fd_set *, fd_set *, struct timeval *);
-int syscall(int, ...);
-int __syscall(quad_t, ...);
diff --git a/sys/arch/zaurus/stand/zboot/unixsys.S b/sys/arch/zaurus/stand/zboot/unixsys.S
deleted file mode 100644
index eb8a6284f9c..00000000000
--- a/sys/arch/zaurus/stand/zboot/unixsys.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $OpenBSD: unixsys.S,v 1.6 2005/05/24 20:38:20 uwe Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <machine/asm.h>
-
-#include "compat_linux.h"
-
- .text
-
-#define RSYSCALL(x) \
- ENTRY(u##x); \
- swi __NR_##x; \
- b 1f
-
-RSYSCALL(exit)
-RSYSCALL(read)
-RSYSCALL(write)
-RSYSCALL(open)
-RSYSCALL(close)
-RSYSCALL(lseek32)
-RSYSCALL(ioctl)
-RSYSCALL(stat)
-
-1:
- cmn r0, #4096
- movcc pc, lr
- rsb r0, r0, #0
- ldr r1, .Lerrno /* XXX clobbers arg1 */
- str r0, [r1]
- mvn r0, #0
- mov pc, lr
-
-.Lerrno:
- .word errno
-
-/* XXX only works for up to four arguments. */
-ENTRY(syscall)
- swi __NR_syscall
- b 1b
-
-ENTRY(uselect)
- str r4, [sp, #-4]!
- ldr r4, [sp, #4]
- swi __NR_select
- ldr r4, [sp], #4
- cmn r0, #4096
- movcc pc, lr
- rsb r0, r0, #0
- str r1, [sp, #-4]!
- ldr r1, .Lerrno
- str r0, [r1]
- ldr r1, [sp], #4
- mvn r0, #0
- mov pc, lr
-
-.data
-
- .global errno
-errno:
- .word 0
diff --git a/sys/arch/zaurus/stand/zbsdmod/Makefile b/sys/arch/zaurus/stand/zbsdmod/Makefile
deleted file mode 100644
index eabe11a9e0a..00000000000
--- a/sys/arch/zaurus/stand/zbsdmod/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# $OpenBSD: Makefile,v 1.6 2016/07/30 03:25:49 guenther Exp $
-
-OBJS= zbsdmod.o
-SRCS= zbsdmod.c
-NOMAN=
-
-all: ${OBJS}
-
-clean:
- rm -f zbsdmod.o
-
-.include <bsd.prog.mk>
-
-afterinstall:
- ${INSTALL} ${INSTALL_COPY} -o root -g wheel -m 644 \
- ${OBJS} ${DESTDIR}${BINDIR}
-
-CFLAGS= -fno-stack-protector -Wall
-CFLAGS+= -DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
-CPPFLAGS= -I${.CURDIR}/../include -fno-pie
-LDFLAGS+= -nopie -znorelro
diff --git a/sys/arch/zaurus/stand/zbsdmod/compat_linux.h b/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
deleted file mode 100644
index 6aa373aa748..00000000000
--- a/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $OpenBSD: compat_linux.h,v 1.8 2011/03/13 00:13:53 deraadt Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#if 0
-
-/* Define these unconditionally to get the .modinfo section. */
-#undef __KERNEL__
-#undef MODULE
-#define __KERNEL__
-#define MODULE
-
-/* Standard headers for Linux LKMs */
-#include <linux/kernel.h>
-#include <linux/modsetver.h>
-#include <linux/module.h>
-
-/*
- * Include Linux 2.4.x headers.
- */
-#include <linux/elf.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/pagemap.h>
-#include <linux/file.h>
-#include <linux/slab.h>
-#include <asm/mach/map.h>
-
-#else
-
-/*
- * Declare the things that we need from the Linux headers.
- */
-
-#define IS_ERR(ptr) ((unsigned long)(ptr) > (unsigned long)-1000L)
-
-#define MKDEV(ma,mi) ((ma)<<8 | (mi))
-
-#define S_IFBLK 0060000
-#define S_IFCHR 0020000
-
-struct file;
-struct inode;
-
-typedef long loff_t;
-
-/* BSD headers */
-#include <sys/types.h>
-#include <sys/exec_elf.h>
-#include <errno.h>
-
-struct file_operations {
- struct module *owner;
- void (*llseek) (void);
- ssize_t (*read) (struct file *, char *, size_t, loff_t *);
- ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
- void (*readdir) (void);
- void (*poll) (void);
- void (*ioctl) (void);
- void (*mmap) (void);
- int (*open) (struct inode *, struct file *);
- void (*flush) (void);
- int (*release) (struct inode *, struct file *);
- void (*fsync) (void);
- void (*fasync) (void);
- void (*lock) (void);
- void (*readv) (void);
- void (*writev) (void);
- void (*sendpage) (void);
- void (*get_unmapped_area)(void);
-#ifdef MAGIC_ROM_PTR
- void (*romptr) (void);
-#endif /* MAGIC_ROM_PTR */
-};
-
-extern struct file * open_exec(const char *);
-extern void fput(struct file *);
-extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
-extern int memcmp(const void *, const void *, size_t);
-extern int register_chrdev(unsigned int, const char *, struct file_operations *);
-extern int unregister_chrdev(unsigned int, const char *);
-extern void printk(const char *, ...)
- __attribute__((__format__(printf, 1, 2)));
-extern void *memcpy(void *, const void *, size_t);
-
-/* Linux LKM support */
-static const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
-"kernel_version=" UTS_RELEASE;
-#if 1 /* def MODVERSIONS */
-static const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
-"using_checksums=1";
-#endif
-
-/* procfs support */
-struct proc_dir_entry {
- unsigned short low_ino;
- unsigned short namelen;
- const char *name;
- unsigned short mode;
- unsigned short nlink;
- unsigned short uid;
- unsigned short gid;
- unsigned long size;
- void *proc_iops; /* inode operations */
- struct file_operations * proc_fops;
- void *get_info;
- struct module *owner;
- struct proc_dir_entry *next, *parent, *subdir;
- void *data;
- void *read_proc;
- void *write_proc;
- volatile int count;
- int deleted;
- unsigned short rdev;
-};
-extern struct proc_dir_entry proc_root;
-extern struct proc_dir_entry *proc_mknod(const char*, unsigned short,
- struct proc_dir_entry*, unsigned short);
-extern void remove_proc_entry(const char *, struct proc_dir_entry *);
-
-#endif
diff --git a/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c b/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
deleted file mode 100644
index 0cc12e4d533..00000000000
--- a/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/* $OpenBSD: zbsdmod.c,v 1.12 2016/03/14 23:08:05 krw Exp $ */
-
-/*
- * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Zaurus OpenBSD bootstrap loader.
- */
-
-#include "compat_linux.h"
-
-#define BOOTARGS_BUFSIZ 256
-#define BOOTARGS_MAGIC 0x4f425344
-
-#define ZBOOTDEV_MAJOR 99
-#define ZBOOTDEV_MODE 0222
-#define ZBOOTDEV_NAME "zboot"
-#define ZBOOTMOD_NAME "zbsdmod"
-
-/* Prototypes */
-void elf32bsdboot(void);
-int init_module(void);
-void cleanup_module(void);
-
-ssize_t zbsdmod_write(struct file *, const char *, size_t, loff_t *);
-int zbsdmod_open(struct inode *, struct file *);
-int zbsdmod_close(struct inode *, struct file *);
-
-static struct file_operations fops = {
- 0, /* struct module *owner */
- 0, /* lseek */
- 0, /* read */
- zbsdmod_write, /* write */
- 0, /* readdir */
- 0, /* poll */
- 0, /* ioctl */
- 0, /* mmap */
- zbsdmod_open, /* open */
- 0, /* flush */
- zbsdmod_close, /* release */
- 0, /* sync */
- 0, /* async */
- 0, /* check media change */
- 0, /* revalidate */
- 0, /* lock */
-};
-
-static int isopen;
-static loff_t position;
-
-/* Outcast local variables to avoid stack usage in elf32bsdboot(). */
-static int cpsr;
-static unsigned int sz;
-static int i;
-static vaddr_t minv, maxv, posv;
-static vaddr_t elfv, shpv;
-static int *addr;
-static vaddr_t *esymp;
-static Elf_Shdr *shp;
-static Elf_Off off;
-static int havesyms;
-
-/* The maximum size of a kernel image is restricted to 5MB. */
-static int bsdimage[1310720]; /* XXX use kmalloc() */
-static char bootargs[BOOTARGS_BUFSIZ];
-
-/*
- * Boot the loaded BSD kernel image, or return if an error is found.
- * Part of this routine is borrowed from sys/lib/libsa/loadfile.c.
- */
-void
-elf32bsdboot(void)
-{
-
-#define elf ((Elf32_Ehdr *)bsdimage)
-#define phdr ((Elf32_Phdr *)((char *)elf + elf->e_phoff))
-
- if (memcmp(elf->e_ident, ELFMAG, SELFMAG) != 0 ||
- elf->e_ident[EI_CLASS] != ELFCLASS32)
- return;
-
- minv = (vaddr_t)~0;
- maxv = (vaddr_t)0;
- posv = (vaddr_t)0;
- esymp = 0;
-
- /*
- * Get min and max addresses used by the loaded kernel.
- */
- for (i = 0; i < elf->e_phnum; i++) {
-
- if (phdr[i].p_type != PT_LOAD ||
- (phdr[i].p_flags & (PF_W|PF_R|PF_X)) == 0)
- continue;
-
-#define IS_TEXT(p) (p.p_flags & PF_X)
-#define IS_DATA(p) ((p.p_flags & PF_X) == 0)
-#define IS_BSS(p) (p.p_filesz < p.p_memsz)
- /*
- * XXX: Assume first address is lowest
- */
- if (IS_TEXT(phdr[i]) || IS_DATA(phdr[i])) {
- posv = phdr[i].p_vaddr;
- if (minv > posv)
- minv = posv;
- posv += phdr[i].p_filesz;
- if (maxv < posv)
- maxv = posv;
- }
- if (IS_DATA(phdr[i]) && IS_BSS(phdr[i])) {
- posv += phdr[i].p_memsz;
- if (maxv < posv)
- maxv = posv;
- }
- /*
- * 'esym' is the first word in the .data section,
- * and marks the end of the symbol table.
- */
- if (IS_DATA(phdr[i]) && !IS_BSS(phdr[i]))
- esymp = (vaddr_t *)phdr[i].p_vaddr;
- }
-
- __asm__ volatile ("mrs %0, cpsr" : "=r" (cpsr));
- cpsr |= 0xc0; /* set FI */
- __asm__ volatile ("msr cpsr_c, %0" :: "r" (cpsr));
-
- /*
- * Copy the boot arguments.
- */
- sz = BOOTARGS_BUFSIZ;
- while (sz > 0) {
- sz--;
- ((char *)minv - BOOTARGS_BUFSIZ)[sz] = bootargs[sz];
- }
-
- /*
- * Set up pointers to copied ELF and section headers.
- */
-#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
- elfv = maxv = roundup(maxv, sizeof(long));
- maxv += sizeof(Elf_Ehdr);
-
- sz = elf->e_shnum * sizeof(Elf_Shdr);
- shp = (Elf_Shdr *)((vaddr_t)elf + elf->e_shoff);
- shpv = maxv;
- maxv += roundup(sz, sizeof(long));
-
- /*
- * Now load the symbol sections themselves. Make sure the
- * sections are aligned, and offsets are relative to the
- * copied ELF header. Don't bother with string tables if
- * there are no symbol sections.
- */
- off = roundup((sizeof(Elf_Ehdr) + sz), sizeof(long));
- for (havesyms = i = 0; i < elf->e_shnum; i++)
- if (shp[i].sh_type == SHT_SYMTAB)
- havesyms = 1;
- for (i = 0; i < elf->e_shnum; i++) {
- if (shp[i].sh_type == SHT_SYMTAB ||
- shp[i].sh_type == SHT_STRTAB) {
- if (havesyms) {
- sz = shp[i].sh_size;
- while (sz > 0) {
- sz--;
- ((char *)maxv)[sz] =
- ((char *)elf +
- shp[i].sh_offset)[sz];
- }
- }
- maxv += roundup(shp[i].sh_size, sizeof(long));
- shp[i].sh_offset = off;
- off += roundup(shp[i].sh_size, sizeof(long));
- }
- }
-
- /*
- * Copy the ELF and section headers.
- */
- sz = sizeof(Elf_Ehdr);
- while (sz > 0) {
- sz--;
- ((char *)elfv)[sz] = ((char *)elf)[sz];
- }
- sz = elf->e_shnum * sizeof(Elf_Shdr);
- while (sz > 0) {
- sz--;
- ((char *)shpv)[sz] = ((char *)shp)[sz];
- }
-
- /*
- * Frob the copied ELF header to give information relative
- * to elfv.
- */
- ((Elf_Ehdr *)elfv)->e_phoff = 0;
- ((Elf_Ehdr *)elfv)->e_shoff = sizeof(Elf_Ehdr);
- ((Elf_Ehdr *)elfv)->e_phentsize = 0;
- ((Elf_Ehdr *)elfv)->e_phnum = 0;
-
- /*
- * Tell locore.S where the symbol table ends, and arrange
- * to skip esym when loading the data section.
- */
- if (esymp != 0)
- *esymp = (vaddr_t)maxv;
- for (i = 0; esymp != 0 && i < elf->e_phnum; i++) {
- if (phdr[i].p_type != PT_LOAD ||
- (phdr[i].p_flags & (PF_W|PF_R|PF_X)) == 0)
- continue;
- if (phdr[i].p_vaddr == (vaddr_t)esymp) {
- phdr[i].p_vaddr = (vaddr_t)((char *)phdr[i].p_vaddr + sizeof(long));
- phdr[i].p_offset = (vaddr_t)((char *)phdr[i].p_offset + sizeof(long));
- phdr[i].p_filesz -= sizeof(long);
- break;
- }
- }
-
- /*
- * Load text and data.
- */
- for (i = 0; i < elf->e_phnum; i++) {
-
- if (phdr[i].p_type != PT_LOAD ||
- (phdr[i].p_flags & (PF_W|PF_R|PF_X)) == 0)
- continue;
-
- if (IS_TEXT(phdr[i]) || IS_DATA(phdr[i])) {
- sz = phdr[i].p_filesz;
- while (sz > 0) {
- sz--;
- ((char *)phdr[i].p_vaddr)[sz] =
- (((char *)elf) + phdr[i].p_offset)[sz];
- }
- }
- }
-
- addr = (int *)(elf->e_entry);
- __asm__ volatile (
- "mov r0, %0;"
- "mov r2, #0;"
- "mov r1, #(0x00000010 | 0x00000020);"
- "mcr 15, 0, r1, c1, c0, 0;"
- "mcr 15, 0, r2, c8, c7, 0 /* nail I+D TLB on ARMv4 and greater */;"
- "mov pc, r0" :: "r"(addr) : "r0","r1","r2");
-}
-
-/*
- * Initialize the LKM.
- */
-int
-init_module()
-{
- struct proc_dir_entry *entry;
- int rc;
-
- rc = register_chrdev(ZBOOTDEV_MAJOR, ZBOOTDEV_NAME, &fops);
- if (rc != 0) {
- printk("%s: register_chrdev(%d, ...): error %d\n",
- ZBOOTMOD_NAME, ZBOOTDEV_MAJOR, -rc);
- return 1;
- }
-
- entry = proc_mknod(ZBOOTDEV_NAME, ZBOOTDEV_MODE | S_IFCHR,
- &proc_root, MKDEV(ZBOOTDEV_MAJOR, 0));
- if (entry == NULL) {
- (void)unregister_chrdev(ZBOOTDEV_MAJOR, ZBOOTDEV_NAME);
- return 1;
- }
-
- printk("%s: OpenBSD/" MACHINE " bootstrap device is %d,0\n",
- ZBOOTMOD_NAME, ZBOOTDEV_MAJOR);
-
- return 0;
-}
-
-/*
- * Cleanup - undo whatever init_module did.
- */
-void
-cleanup_module()
-{
-
- (void)unregister_chrdev(ZBOOTDEV_MAJOR, ZBOOTDEV_NAME);
- remove_proc_entry(ZBOOTDEV_NAME, &proc_root);
-
- printk("%s: OpenBSD/" MACHINE " bootstrap device unloaded\n",
- ZBOOTMOD_NAME);
-}
-
-
-ssize_t
-zbsdmod_write(struct file *f, const char *buf, size_t len, loff_t *offp)
-{
-
- if (len < 1)
- return 0;
-
- if (*offp + len >= sizeof(bsdimage))
- return EFBIG;
-
- memcpy(((char *)bsdimage) + *offp, buf, len);
-
- *offp += len;
- if (*offp > position)
- position = *offp;
-
- return len;
-}
-
-int
-zbsdmod_open(struct inode *ino, struct file *f)
-{
-
- /* XXX superuser check */
-
- if (isopen)
- return -EBUSY;
-
- isopen = 1;
- position = 0;
-
- return 0;
-}
-
-int
-zbsdmod_close(struct inode *ino, struct file *f)
-{
-
- if (isopen) {
- if (position > 0) {
- printk("%s: loaded %ld bytes\n", ZBOOTDEV_NAME,
- position);
-
- if (position < BOOTARGS_BUFSIZ) {
- *(int *)bootargs = BOOTARGS_MAGIC;
- bootargs[position + sizeof(int)] = '\0';
- memcpy(bootargs + sizeof(int), bsdimage,
- position);
- } else {
-#ifndef _TEST
- elf32bsdboot();
- printk("%s: boot failed\n", ZBOOTDEV_NAME);
-#else
- printk("/* boot() */\n");
-#endif
- }
- }
- isopen = 0;
- return 0;
- }
-
- return -EBUSY;
-}
diff --git a/sys/arch/zaurus/zaurus/autoconf.c b/sys/arch/zaurus/zaurus/autoconf.c
deleted file mode 100644
index d71f98470e7..00000000000
--- a/sys/arch/zaurus/zaurus/autoconf.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.16 2016/06/08 17:24:44 tedu Exp $ */
-/* $NetBSD: autoconf.c,v 1.2 2001/09/05 16:17:36 matt Exp $ */
-
-/*
- * Copyright (c) 1994-1998 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe for
- * the NetBSD project.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * 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 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.
- *
- * RiscBSD kernel project
- *
- * autoconf.c
- *
- * Autoconfiguration functions
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/disklabel.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/timeout.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bootconfig.h>
-#include <machine/intr.h>
-#include <dev/cons.h>
-
-struct device *bootdv = NULL;
-
-void dumpconf(void);
-
-/*
- * Now that we are fully operational, we can checksum the
- * disks, and using some heuristics, hopefully are able to
- * always determine the correct root disk.
- */
-void
-diskconf()
-{
- extern struct timeout scoop_checkdisk;
- dev_t tmpdev;
-
-#if 0
- /*
- * Configure root, swap, and dump area. This is
- * currently done by running the same checksum
- * algorithm over all known disks, as was done in
- * /boot. Then we basically fixup the *dev vars
- * from the info we gleaned from this.
- */
- dkcsumattach();
-#endif
-
- /*
- * XXX
- * zaurus bootblocks currently pass in "bsd" instead of
- * "device:bsd", or any such thing, making this a real pain.
- */
- if (bootdv == NULL)
- bootdv = parsedisk("wd0a", strlen("wd0a"), 0, &tmpdev);
- if (bootdv == NULL)
- printf("boot device: lookup '%s' failed.\n", boot_file);
- else
- printf("boot device: %s\n", bootdv->dv_xname);
-
- setroot(bootdv, 0, RB_USERREQ);
- dumpconf();
-
- timeout_add(&scoop_checkdisk, hz/25);
-}
-
-void
-device_register(struct device *dev, void *aux)
-{
-}
-
-/*
- * void cpu_configure()
- *
- * Configure all the root devices
- * The root devices are expected to configure their own children
- */
-void
-cpu_configure(void)
-{
- softintr_init();
-
- /*
- * Since various PCI interrupts could be routed via the ICU
- * (for PCI devices in the bridge) we need to set up the ICU
- * now so that these interrupts can be established correctly
- * i.e. This is a hack.
- */
-
- config_rootfound("mainbus", NULL);
-
- /*
- * We can not know which is our root disk, defer
- * until we can checksum blocks to figure it out.
- */
- cold = 0;
-
- /* Time to start taking interrupts so lets open the flood gates .... */
- (void)spl0();
-
-}
-
-struct nam2blk nam2blk[] = {
- { "wd", 16 },
- { "sd", 24 },
- { "cd", 26 },
- { "rd", 18 },
- { "vnd", 19 },
- { NULL, -1 }
-};
diff --git a/sys/arch/zaurus/zaurus/genassym.cf b/sys/arch/zaurus/zaurus/genassym.cf
deleted file mode 100644
index 679dcad021f..00000000000
--- a/sys/arch/zaurus/zaurus/genassym.cf
+++ /dev/null
@@ -1 +0,0 @@
-# $OpenBSD: genassym.cf,v 1.1 2010/04/26 22:11:38 deraadt Exp $
diff --git a/sys/arch/zaurus/zaurus/zaurus_lcd.c b/sys/arch/zaurus/zaurus/zaurus_lcd.c
deleted file mode 100644
index 18220260ca1..00000000000
--- a/sys/arch/zaurus/zaurus/zaurus_lcd.c
+++ /dev/null
@@ -1,416 +0,0 @@
-/* $OpenBSD: zaurus_lcd.c,v 1.28 2013/12/06 21:03:05 deraadt Exp $ */
-/* $NetBSD: lubbock_lcd.c,v 1.1 2003/08/09 19:38:53 bsh Exp $ */
-
-/*
- * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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.
- */
-
-/*
- * LCD driver for Sharp Zaurus (based on the Intel Lubbock driver).
- *
- * Controlling LCD is almost completely done through PXA2X0's
- * integrated LCD controller. Codes for it is arm/xscale/pxa2x0_lcd.c.
- *
- * Codes in this file provide platform specific things including:
- * LCD on/off switch and backlight brightness
- * LCD panel geometry
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-
-#include <dev/cons.h>
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wscons_callbacks.h>
-
-#include <machine/bus.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0_lcd.h>
-
-#include <zaurus/dev/zaurus_scoopvar.h>
-#include <zaurus/dev/zaurus_sspvar.h>
-
-#include <dev/rasops/rasops.h>
-
-int lcd_match(struct device *, void *, void *);
-void lcd_attach(struct device *, struct device *, void *);
-int lcd_activate(struct device *, int);
-int lcd_cnattach(void (*)(u_int, int));
-
-/*
- * wsdisplay glue
- */
-struct pxa2x0_wsscreen_descr
-lcd_bpp16_screen = {
- {
- "std"
- },
- 16, /* bits per pixel */
- RI_ROTATE_CW /* quarter clockwise rotation */
-};
-
-static const struct wsscreen_descr *lcd_scr_descr[] = {
- &lcd_bpp16_screen.c
-};
-
-const struct wsscreen_list lcd_screen_list = {
- sizeof lcd_scr_descr / sizeof lcd_scr_descr[0], lcd_scr_descr
-};
-
-int lcd_ioctl(void *, u_long, caddr_t, int, struct proc *);
-int lcd_show_screen(void *, void *, int,
- void (*)(void *, int, int), void *);
-void lcd_burner(void *, u_int, u_int);
-
-int lcd_param(struct pxa2x0_lcd_softc *, u_long, struct wsdisplay_param *);
-
-const struct wsdisplay_accessops lcd_accessops = {
- .ioctl = lcd_ioctl,
- .mmap = pxa2x0_lcd_mmap,
- .alloc_screen = pxa2x0_lcd_alloc_screen,
- .free_screen = pxa2x0_lcd_free_screen,
- .show_screen = lcd_show_screen,
- .load_font = pxa2x0_lcd_load_font,
- .list_font = pxa2x0_lcd_list_font,
- .burn_screen = lcd_burner
-};
-
-struct cfattach lcd_pxaip_ca = {
- sizeof (struct pxa2x0_lcd_softc), lcd_match, lcd_attach, NULL,
- lcd_activate
-};
-
-struct cfdriver lcd_cd = {
- NULL, "lcd", DV_DULL
-};
-
-#define CURRENT_DISPLAY &sharp_zaurus_C3000
-
-const struct lcd_panel_geometry sharp_zaurus_C3000 =
-{
- 480, /* Width */
- 640, /* Height */
- 0, /* No extra lines */
-
- LCDPANEL_ACTIVE | LCDPANEL_VSP | LCDPANEL_HSP,
- 1, /* clock divider */
- 0, /* AC bias pin freq */
-
- 0x28, /* horizontal sync pulse width */
- 0x2e, /* BLW */
- 0x7d, /* ELW */
-
- 2, /* vertical sync pulse width */
- 1, /* BFW */
- 0, /* EFW */
-};
-
-struct sharp_lcd_backlight {
- int duty; /* LZ9JG18 DAC value */
- int cont; /* BACKLIGHT_CONT signal */
- int on; /* BACKLIGHT_ON signal */
-};
-
-#define CURRENT_BACKLIGHT sharp_zaurus_C3000_bl
-
-const struct sharp_lcd_backlight sharp_zaurus_C3000_bl[] = {
- { 0x00, 0, 0 }, /* 0: Off */
- { 0x00, 0, 1 }, /* 1: 0% */
- { 0x01, 0, 1 }, /* 2: 20% */
- { 0x07, 0, 1 }, /* 3: 40% */
- { 0x01, 1, 1 }, /* 4: 60% */
- { 0x07, 1, 1 }, /* 5: 80% */
- { 0x11, 1, 1 }, /* 6: 100% */
- { -1, -1, -1 } /* 7: Invalid */
-};
-
-int lcd_max_brightness(void);
-int lcd_get_brightness(void);
-void lcd_set_brightness(int);
-void lcd_set_brightness_internal(int);
-int lcd_get_backlight(void);
-void lcd_set_backlight(int);
-void lcd_blank(int);
-
-int
-lcd_match(struct device *parent, void *cf, void *aux)
-{
- return 1;
-}
-
-void
-lcd_attach(struct device *parent, struct device *self, void *aux)
-{
- struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)self;
- struct wsemuldisplaydev_attach_args aa;
- extern int glass_console;
-
- printf("\n");
-
- pxa2x0_lcd_attach_sub(sc, aux, &lcd_bpp16_screen, CURRENT_DISPLAY,
- glass_console);
-
- aa.console = glass_console;
- aa.scrdata = &lcd_screen_list;
- aa.accessops = &lcd_accessops;
- aa.accesscookie = sc;
- aa.defaultscreens = 0;
-
- (void)config_found(self, &aa, wsemuldisplaydevprint);
-
- /* Start with approximately 40% of full brightness. */
- lcd_set_brightness(3);
-}
-
-int
-lcd_cnattach(void (*clkman)(u_int, int))
-{
- return
- (pxa2x0_lcd_cnattach(&lcd_bpp16_screen, CURRENT_DISPLAY, clkman));
-}
-
-/*
- * wsdisplay accessops overrides
- */
-
-int
-lcd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- struct pxa2x0_lcd_softc *sc = v;
- int res = EINVAL;
-
- switch (cmd) {
- case WSDISPLAYIO_GETPARAM:
- case WSDISPLAYIO_SETPARAM:
- res = lcd_param(sc, cmd, (struct wsdisplay_param *)data);
- break;
- }
-
- if (res == EINVAL)
- res = pxa2x0_lcd_ioctl(v, cmd, data, flag, p);
-
- return res;
-}
-
-void
-lcd_burner(void *v, u_int on, u_int flags)
-{
-
- lcd_set_brightness(on ? lcd_get_brightness() : 0);
-}
-
-int
-lcd_show_screen(void *v, void *cookie, int waitok,
- void (*cb)(void *, int, int), void *cbarg)
-{
- int rc;
-
- if ((rc = pxa2x0_lcd_show_screen(v, cookie, waitok, cb, cbarg)) != 0)
- return (rc);
-
- /* Turn on LCD */
- lcd_burner(v, 1, 0);
-
- return (0);
-}
-
-/*
- * wsdisplay I/O controls
- */
-
-int
-lcd_param(struct pxa2x0_lcd_softc *sc, u_long cmd,
- struct wsdisplay_param *dp)
-{
- int res = EINVAL;
-
- switch (dp->param) {
- case WSDISPLAYIO_PARAM_BACKLIGHT:
- if (cmd == WSDISPLAYIO_GETPARAM) {
- dp->min = 0;
- dp->max = 1;
- dp->curval = lcd_get_backlight();
- res = 0;
- } else if (cmd == WSDISPLAYIO_SETPARAM) {
- lcd_set_backlight(dp->curval);
- res = 0;
- }
- break;
-
- case WSDISPLAYIO_PARAM_CONTRAST:
- /* unsupported */
- res = ENOTTY;
- break;
-
- case WSDISPLAYIO_PARAM_BRIGHTNESS:
- if (cmd == WSDISPLAYIO_GETPARAM) {
- dp->min = 1;
- dp->max = lcd_max_brightness();
- dp->curval = lcd_get_brightness();
- res = 0;
- } else if (cmd == WSDISPLAYIO_SETPARAM) {
- lcd_set_brightness(dp->curval);
- res = 0;
- }
- break;
- }
-
- return res;
-}
-
-/*
- * LCD backlight
- */
-
-static int lcdbrightnesscurval = 1;
-static int lcdislit = 1;
-static int lcdisblank = 0;
-
-int
-lcd_max_brightness(void)
-{
- int i;
-
- for (i = 0; CURRENT_BACKLIGHT[i].duty != -1; i++)
- ;
- return i - 1;
-}
-
-int
-lcd_get_brightness(void)
-{
-
- return lcdbrightnesscurval;
-}
-
-void
-lcd_set_brightness(int newval)
-{
- int max;
-
- max = lcd_max_brightness();
- if (newval < 0)
- newval = 0;
- else if (newval > max)
- newval = max;
-
- if (lcd_get_backlight() && !lcdisblank)
- lcd_set_brightness_internal(newval);
-
- if (newval > 0)
- lcdbrightnesscurval = newval;
-}
-
-void
-lcd_set_brightness_internal(int newval)
-{
- static int curval = 1;
- int i;
-
- /*
- * It appears that the C3000 backlight can draw too much power if we
- * switch it from a low to a high brightness. Increasing brightness
- * in steps avoids this issue.
- */
- if (newval > curval) {
- for (i = curval + 1; i <= newval; i++) {
- (void)zssp_ic_send(ZSSP_IC_LZ9JG18,
- CURRENT_BACKLIGHT[i].duty);
- scoop_set_backlight(CURRENT_BACKLIGHT[i].on,
- CURRENT_BACKLIGHT[i].cont);
- delay(5000);
- }
- } else {
- (void)zssp_ic_send(ZSSP_IC_LZ9JG18,
- CURRENT_BACKLIGHT[newval].duty);
- scoop_set_backlight(CURRENT_BACKLIGHT[newval].on,
- CURRENT_BACKLIGHT[newval].cont);
- }
-
- curval = newval;
-}
-
-int
-lcd_get_backlight(void)
-{
-
- return lcdislit;
-}
-
-void
-lcd_set_backlight(int on)
-{
-
- if (!on) {
- lcd_set_brightness(0);
- lcdislit = 0;
- } else {
- lcdislit = 1;
- lcd_set_brightness(lcd_get_brightness());
- }
-}
-
-void
-lcd_blank(int blank)
-{
-
- if (blank) {
- lcd_set_brightness(0);
- lcdisblank = 1;
- } else {
- lcdisblank = 0;
- lcd_set_brightness(lcd_get_brightness());
- }
-}
-
-int
-lcd_activate(struct device *self, int act)
-{
- struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)self;
- int ret = 0;
-
- switch (act) {
- case DVACT_SUSPEND:
- lcd_set_brightness(0);
- pxa2x0_lcd_suspend(sc);
- break;
- case DVACT_RESUME:
- pxa2x0_lcd_resume(sc);
- lcd_set_brightness(lcd_get_brightness());
- break;
- default:
- ret = config_activate_children(self, act);
- break;
- }
- return (ret);
-}
diff --git a/sys/arch/zaurus/zaurus/zaurus_machdep.c b/sys/arch/zaurus/zaurus/zaurus_machdep.c
deleted file mode 100644
index 8c3b6ea9a80..00000000000
--- a/sys/arch/zaurus/zaurus/zaurus_machdep.c
+++ /dev/null
@@ -1,1334 +0,0 @@
-/* $OpenBSD: zaurus_machdep.c,v 1.61 2016/08/14 13:29:22 jsg Exp $ */
-/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
-
-/*
- * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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.
- *
- * Machine dependant functions for kernel setup for
- * Intel DBPXA250 evaluation board (a.k.a. Lubbock).
- * Based on iq80310_machhdep.c
- */
-/*
- * Copyright (c) 2001 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Jason R. Thorpe for Wasabi Systems, Inc.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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.
- */
-
-/*
- * Copyright (c) 1997,1998 Mark Brinicombe.
- * Copyright (c) 1997,1998 Causality Limited.
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe
- * for the NetBSD Project.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * 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 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.
- *
- * Machine dependant functions for kernel setup for Intel IQ80310 evaluation
- * boards using RedBoot firmware.
- */
-
-/*
- * DIP switches:
- *
- * S19: no-dot: set RB_KDB. enter kgdb session.
- * S20: no-dot: set RB_SINGLE. don't go multi user mode.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/exec.h>
-#include <sys/proc.h>
-#include <sys/msgbuf.h>
-#include <sys/reboot.h>
-#include <sys/termios.h>
-#include <sys/kcore.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <sys/conf.h>
-#include <sys/queue.h>
-#include <dev/cons.h>
-#include <sys/socket.h>
-
-#include <machine/db_machdep.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_extern.h>
-#ifdef KGDB
-#include <sys/kgdb.h>
-#endif
-
-#include <net/if.h>
-
-#include <machine/bootconfig.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <arm/kcore.h>
-#include <arm/undefined.h>
-#include <arm/machdep.h>
-
-#include <arm/xscale/pxa2x0reg.h>
-#include <arm/xscale/pxa2x0var.h>
-#include <arm/xscale/pxa2x0_gpio.h>
-#include <machine/machine_reg.h>
-#include <machine/zaurus_var.h>
-
-#include <zaurus/dev/zaurus_scoopreg.h>
-
-#include "apm.h"
-#if NAPM > 0
-#include <zaurus/dev/zaurus_apm.h>
-#endif
-
-#include "wsdisplay.h"
-
-/* Kernel text starts 2MB in from the bottom of the kernel address space. */
-#define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00200000)
-#define KERNEL_VM_BASE (KERNEL_BASE + 0x04000000)
-#define KERNEL_VM_SIZE VM_KERNEL_SPACE_SIZE
-
-/*
- * Address to call from cpu_reset() to reset the machine.
- * This is machine architecture dependant as it varies depending
- * on where the ROM appears when you turn the MMU off.
- */
-
-u_int cpu_reset_address = 0;
-
-/* Define various stack sizes in pages */
-#define IRQ_STACK_SIZE 1
-#define ABT_STACK_SIZE 1
-#define UND_STACK_SIZE 1
-
-int zaurusmod;
-
-BootConfig bootconfig; /* Boot config storage */
-char *boot_args = NULL;
-char *boot_file = NULL;
-
-paddr_t physical_start;
-paddr_t physical_freestart;
-paddr_t physical_freeend;
-paddr_t physical_end;
-u_int free_pages;
-int physmem = 0;
-
-/*int debug_flags;*/
-#ifndef PMAP_STATIC_L1S
-int max_processes = 64; /* Default number */
-#endif /* !PMAP_STATIC_L1S */
-
-/* Physical and virtual addresses for some global pages */
-pv_addr_t systempage;
-pv_addr_t irqstack;
-pv_addr_t undstack;
-pv_addr_t abtstack;
-extern pv_addr_t kernelstack;
-pv_addr_t minidataclean;
-
-paddr_t msgbufphys;
-
-extern u_int data_abort_handler_address;
-extern u_int prefetch_abort_handler_address;
-extern u_int undefined_handler_address;
-
-#ifdef PMAP_DEBUG
-extern int pmap_debug_level;
-#endif
-
-#define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */
-#define KERNEL_PT_KERNEL 1 /* Page table for mapping kernel */
-#define KERNEL_PT_KERNEL_NUM 32
-#define KERNEL_PT_VMDATA (KERNEL_PT_KERNEL+KERNEL_PT_KERNEL_NUM)
- /* Page tables for mapping kernel VM */
-#define KERNEL_PT_VMDATA_NUM 8 /* start with 32MB of KVM */
-#define NUM_KERNEL_PTS (KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
-
-pv_addr_t kernel_pt_table[NUM_KERNEL_PTS];
-
-extern struct user *proc0paddr;
-
-/*
- * safepri is a safe priority for sleep to set for a spin-wait
- * during autoconfiguration or after a panic.
- */
-int safepri = 0;
-
-/* Prototypes */
-
-#define BOOT_STRING_MAGIC 0x4f425344
-
-char bootargs[MAX_BOOT_STRING];
-void process_kernel_args(char *);
-
-void consinit(void);
-void early_clkman(u_int, int);
-void kgdb_port_init(void);
-void change_clock(uint32_t v);
-
-bs_protos(bs_notimpl);
-
-#include "com.h"
-#if NCOM > 0
-#include <dev/ic/comvar.h>
-#include <dev/ic/comreg.h>
-#endif
-
-#ifndef CONSPEED
-#define CONSPEED B9600 /* What RedBoot uses */
-#endif
-#ifndef CONMODE
-#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
-#endif
-
-int comcnspeed = CONSPEED;
-int comcnmode = CONMODE;
-
-
-/*
- * void boot(int howto)
- *
- * Reboots the system
- *
- * Deal with any syncing, unmounting, dumping and shutdown hooks,
- * then reset the CPU.
- */
-__dead void
-boot(int howto)
-{
- extern int lid_suspend;
-
- if ((howto & RB_POWERDOWN) != 0)
- lid_suspend = 0;
-
- if (cold) {
- if ((howto & RB_USERREQ) == 0)
- howto |= RB_HALT;
- goto haltsys;
- }
-
- /*
- * If RB_NOSYNC was not specified sync the discs.
- * Note: Unless cold is set to 1 here, syslogd will die during the
- * unmount. It looks like syslogd is getting woken up only to find
- * that it cannot page part of the binary in as the filesystem has
- * been unmounted.
- */
- if ((howto & RB_NOSYNC) == 0)
- bootsync(howto);
-
- if_downall();
-
- uvm_shutdown();
- splhigh();
- cold = 1;
-
- if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
- dumpsys();
-
-haltsys:
- config_suspend_all(DVACT_POWERDOWN);
-
- /* Make sure IRQ's are disabled */
- IRQdisable;
-
- if ((howto & RB_HALT) != 0) {
-#if NAPM > 0
- if ((howto & RB_POWERDOWN) != 0) {
-
- printf("\nAttempting to power down...\n");
- delay(6000000);
- zapm_poweroff();
- }
-#endif
-
- printf("The operating system has halted.\n");
- printf("Please press any key to reboot.\n\n");
- cnpollc(1);
- cngetc();
- cnpollc(0);
- }
-
- printf("rebooting...\n");
- delay(6000000);
-#if NAPM > 0
- zapm_restart();
-#endif
- printf("reboot failed; spinning\n");
- for (;;) ;
- /* NOTREACHED */
-}
-
-static __inline
-pd_entry_t *
-read_ttb(void)
-{
- long ttb;
-
- __asm volatile("mrc p15, 0, %0, c2, c0, 0" : "=r" (ttb));
-
-
- return (pd_entry_t *)(ttb & ~((1<<14)-1));
-}
-
-/*
- * Mapping table for core kernel memory. These areas are mapped in
- * init time at fixed virtual address with section mappings.
- */
-struct l1_sec_map {
- vaddr_t va;
- vaddr_t pa;
- vsize_t size;
- int flags;
-} l1_sec_table[] = {
- {
- ZAURUS_GPIO_VBASE,
- PXA2X0_GPIO_BASE,
- PXA2X0_GPIO_SIZE,
- PTE_NOCACHE,
- },
- {
- ZAURUS_CLKMAN_VBASE,
- PXA2X0_CLKMAN_BASE,
- PXA2X0_CLKMAN_SIZE,
- PTE_NOCACHE,
- },
- {
- ZAURUS_INTCTL_VBASE,
- PXA2X0_INTCTL_BASE,
- PXA2X0_INTCTL_SIZE,
- PTE_NOCACHE,
- },
- {
- ZAURUS_SCOOP0_VBASE,
- C3000_SCOOP0_BASE,
- SCOOP_SIZE,
- PTE_NOCACHE,
- },
- {
- ZAURUS_SCOOP1_VBASE,
- trunc_page(C3000_SCOOP1_BASE),
- round_page(SCOOP_SIZE),
- PTE_NOCACHE,
- },
- {0, 0, 0, 0,}
-};
-
-static void
-map_io_area(paddr_t pagedir)
-{
- int loop;
-
- /*
- * Map devices we can map w/ section mappings.
- */
- loop = 0;
- while (l1_sec_table[loop].size) {
- vsize_t sz;
-
-#define VERBOSE_INIT_ARM
-#ifdef VERBOSE_INIT_ARM
- printf("%08lx -> %08lx @ %08lx\n", l1_sec_table[loop].pa,
- l1_sec_table[loop].pa + l1_sec_table[loop].size - 1,
- l1_sec_table[loop].va);
-#endif
- for (sz = 0; sz < l1_sec_table[loop].size; sz += L1_S_SIZE)
- pmap_map_section(pagedir, l1_sec_table[loop].va + sz,
- l1_sec_table[loop].pa + sz,
- PROT_READ | PROT_WRITE,
- l1_sec_table[loop].flags);
- ++loop;
- }
-}
-
-/*
- * simple memory mapping function used in early bootstrap stage
- * before pmap is initialized.
- * size and cacheability are ignored and map one section with nocache.
- */
-static vaddr_t section_free = ZAURUS_VBASE_FREE;
-
-static int
-bootstrap_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
- int flags, bus_space_handle_t *bshp)
-{
- u_long startpa;
- vaddr_t va;
- pd_entry_t *pagedir = read_ttb();
- /* This assumes PA==VA for page directory */
-
- va = section_free;
- section_free += L1_S_SIZE;
-
- startpa = trunc_page(bpa);
- pmap_map_section((vaddr_t)pagedir, va, startpa,
- PROT_READ | PROT_WRITE, PTE_NOCACHE);
- cpu_tlb_flushD();
-
- *bshp = (bus_space_handle_t)(va + (bpa - startpa));
-
- return(0);
-}
-
-static void
-copy_io_area_map(pd_entry_t *new_pd)
-{
- pd_entry_t *cur_pd = read_ttb();
- vaddr_t va;
-
- for (va = ZAURUS_IO_AREA_VBASE;
- (cur_pd[va>>L1_S_SHIFT] & L1_TYPE_MASK) == L1_TYPE_S;
- va += L1_S_SIZE) {
-
- new_pd[va>>L1_S_SHIFT] = cur_pd[va>>L1_S_SHIFT];
- if (va == (0 - L1_S_SIZE))
- break; /* STUPID */
-
- }
-}
-
-/* XXX tidy up! */
-void green_on(int virt);
-void
-green_on(int virt)
-{
- /* clobber green led p */
- volatile u_int16_t *p;
- if (virt)
- p = (u_int16_t *)(ZAURUS_SCOOP0_VBASE+SCOOP_GPWR);
- else
- p = (u_int16_t *)(C3000_SCOOP0_BASE+SCOOP_GPWR);
-
- *p = *p | (1<<SCOOP0_LED_GREEN);
-}
-void irda_on(int virt);
-void
-irda_on(int virt)
-{
- /* clobber IrDA led p */
- volatile u_int16_t *p;
- /* XXX scoop1 registers are not page-aligned! */
- int ofs = C3000_SCOOP1_BASE - trunc_page(C3000_SCOOP1_BASE);
-
- if (virt)
- p = (u_int16_t *)(ZAURUS_SCOOP1_VBASE+ofs+SCOOP_GPWR);
- else
- p = (u_int16_t *)(C3000_SCOOP1_BASE+SCOOP_GPWR);
-
- *p = *p & ~(1<<SCOOP1_IR_ON);
-}
-
-#if 0
-void sysprobe(void);
-void
-sysprobe(void)
-{
- u_int32_t *p;
-
- p = (void *)0x48000014; /* MECR */
- printf("MECR %x\n", *p);
-
- p = (void *)0x48000028; /* MCMEM0 */
- printf("MCMEM0 %x\n", *p);
- p = (void *)0x4800002C; /* MCMEM1 */
- printf("MCMEM1 %x\n", *p);
-
- p = (void *)0x48000030; /* MCATTx */
- printf("MCATT0 %x\n", *p);
- p = (void *)0x48000034; /* MCATTx */
- printf("MCATT1 %x\n", *p);
-
- p = (void *)0x48000038; /* MCIOx */
- printf("MCIO0 %x\n", *p);
- p = (void *)0x4800003C; /* MCIOx */
- printf("MCIO1 %x\n", *p);
-}
-#endif
-
-/*
- * u_int initarm(...)
- *
- * Initial entry point on startup. This gets called before main() is
- * entered.
- * It should be responsible for setting up everything that must be
- * in place when main is called.
- * This includes
- * Taking a copy of the boot configuration structure.
- * Initialising the physical console so characters can be printed.
- * Setting up page tables for the kernel
- * Relocating the kernel to the bottom of physical memory
- */
-u_int
-initarm(void *arg0, void *arg1, void *arg2)
-{
- extern vaddr_t xscale_cache_clean_addr;
- extern cpu_kcore_hdr_t cpu_kcore_hdr;
- int loop;
- int loop1;
- u_int l1pagetable;
- pv_addr_t kernel_l1pt;
- paddr_t memstart;
- psize_t memsize;
- extern u_int32_t esym; /* &_end if no symbols are loaded */
-
-#if 0
- int led_data = 0;
-#endif
-#ifdef DIAGNOSTIC
- extern vsize_t xscale_minidata_clean_size; /* used in KASSERT */
-#endif
- /* early bus_space_map support */
- struct bus_space tmp_bs_tag;
- int (*map_func_save)(void *, bus_addr_t, bus_size_t, int,
- bus_space_handle_t *);
-
-
-#if 0
- /* XXX */
- /* start 32.768KHz OSC */
- ioreg_write(PXA2X0_CLKMAN_BASE + 0x08, 2);
-#endif
-
- /*
- * Heads up ... Setup the CPU / MMU / TLB functions
- */
- if (set_cpufuncs())
- panic("cpu not recognized!");
-
- /* Get ready for splfoo() */
- pxa2x0_intr_bootstrap(PXA2X0_INTCTL_BASE);
-
-#if 0
- /* Calibrate the delay loop. */
-#endif
-
- /*
- * Okay, RedBoot has provided us with the following memory map:
- *
- * Physical Address Range Description
- * ----------------------- ----------------------------------
- * 0x00000000 - 0x01ffffff flash Memory (32MB)
- * 0x04000000 - 0x05ffffff Application flash Memory (32MB)
- * 0x08000000 - 0x080000ff I/O baseboard registers
- * 0x0a000000 - 0x0a0fffff SRAM (1MB)
- * 0x0c000000 - 0x0c0fffff Ethernet Controller
- * 0x0e000000 - 0x0e0fffff Ethernet Controller (Attribute)
- * 0x10000000 - 0x103fffff SA-1111 Companion Chip
- * 0x14000000 - 0x17ffffff Expansion Card (64MB)
- * 0x40000000 - 0x480fffff Processor Registers
- * 0xa0000000 - 0xa3ffffff SDRAM Bank 0 (64MB)
- *
- *
- * Virtual Address Range X C B Description
- * ----------------------- - - - ----------------------------------
- * 0x00000000 - 0x00003fff N Y Y SDRAM
- * 0x00004000 - 0x000fffff N Y N Boot ROM
- * 0x00100000 - 0x01ffffff N N N Application Flash
- * 0x04000000 - 0x05ffffff N N N Exp Application Flash
- * 0x08000000 - 0x080fffff N N N I/O baseboard registers
- * 0x0a000000 - 0x0a0fffff N N N SRAM
- * 0x40000000 - 0x480fffff N N N Processor Registers
- * 0xa0000000 - 0xa000ffff N Y N RedBoot SDRAM
- * 0xa0017000 - 0xa3ffffff Y Y Y SDRAM
- * 0xc0000000 - 0xcfffffff Y Y Y Cache Flush Region
- * (done by this routine)
- * 0xfd000000 - 0xfd0000ff N N N I/O baseboard registers
- * 0xfd100000 - 0xfd2fffff N N N Processor Registers.
- * 0xfd200000 - 0xfd2fffff N N N 0x10800000 registers
- *
- * The first level page table is at 0xa0004000. There are also
- * 2 second-level tables at 0xa0008000 and 0xa0008400.
- *
- */
-
- {
- /*
- * Tweak RedBoot's pagetable so that we can access to
- * some registers at same VA before and after installing
- * our page table.
- */
- paddr_t ttb = (paddr_t)read_ttb();
-
- map_io_area(ttb);
- cpu_tlb_flushD();
- }
-
- /*
- * Examine the boot args string for options we need to know about
- * now.
- */
- /* XXX should really be done after setting up the console, but we
- * XXX need to parse the console selection flags right now. */
- process_kernel_args((char *)0xa0200000 - MAX_BOOT_STRING - 1);
-
- /*
- * This test will work for now but has to be revised when support
- * for other models is added.
- */
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA27X)
- zaurusmod = ZAURUS_C3000;
- else
- zaurusmod = ZAURUS_C860;
-
- /* setup GPIO for BTUART, in case bootloader doesn't take care of it */
- pxa2x0_gpio_bootstrap(ZAURUS_GPIO_VBASE);
-#if 0
- pxa2x0_gpio_set_function(42, GPIO_ALT_FN_1_IN);
- pxa2x0_gpio_set_function(43, GPIO_ALT_FN_2_OUT);
- pxa2x0_gpio_set_function(44, GPIO_ALT_FN_1_IN);
- pxa2x0_gpio_set_function(45, GPIO_ALT_FN_2_OUT);
-
- /* FFUART */
- pxa2x0_gpio_set_function(34, GPIO_ALT_FN_1_IN);
- pxa2x0_gpio_set_function(39, GPIO_ALT_FN_2_OUT);
- pxa2x0_gpio_set_function(35, GPIO_ALT_FN_1_IN);
- pxa2x0_gpio_set_function(40, GPIO_ALT_FN_2_OUT);
- pxa2x0_gpio_set_function(41, GPIO_ALT_FN_2_OUT);
-
- /* STUART */
- pxa2x0_gpio_set_function(46, GPIO_ALT_FN_2_IN);
- pxa2x0_gpio_set_function(47, GPIO_ALT_FN_1_OUT);
-#endif
-
- /* tell com to drive STUART in slow infrared mode */
- comsiraddr = (bus_addr_t)PXA2X0_STUART_BASE;
-
-#if 1
- /* turn on clock to UART block.
- XXX this should not be necessary, consinit() will do it */
- early_clkman(CKEN_FFUART | CKEN_BTUART | CKEN_STUART, 1);
-#endif
-
- green_on(0);
-
- /*
- * Temporarily replace bus_space_map() functions so that
- * console devices can get mapped.
- *
- * Note that this relies upon the fact that both regular
- * and a4x bus_space tags use the same map function.
- */
- tmp_bs_tag = pxa2x0_bs_tag;
- tmp_bs_tag.bs_map = bootstrap_bs_map;
- map_func_save = pxa2x0_bs_tag.bs_map;
- pxa2x0_a4x_bs_tag.bs_map = pxa2x0_bs_tag.bs_map = bootstrap_bs_map;
-
- /* setup a serial console for very early boot */
- consinit();
-#ifdef KGDB
- kgdb_port_init();
-#endif
-
- /* Talk to the user */
- printf("\nOpenBSD/zaurus booting ...\n");
-
- {
- /* XXX - all Zaurus have this for now, fix memory sizing */
- memstart = 0xa0000000;
- memsize = 0x04000000; /* 64MB */
- }
-
-#if 0
- {
- volatile int *p;
- char *membase;
- char *memmax;
- int chunksize = 0x02000000;
- printf("probing memory");
-
- membase = (char *)0xa0000000;
- memmax = (char *)0xc0000000;
- for (p = (int *)membase;
- p < (int *)memmax;
- p = (int *) (((char *)p) + chunksize)) {
- printf ("cbase %p\n", p);
- p[0] = 0x12345678;
- p[1] = 0x12345678;
- if ((p[0] != 0x12345678) || (p[1] != 0x12345678))
- break;
- }
- memsize = ((char *)p) - membase;
-
- printf("probing memory done found memsize %d\n", memsize);
- }
-#else
-#endif
-
-#define DEBUG
-#ifdef DEBUG
- printf("initarm: Configuring system ...\n");
-#endif
-
- /* Fake bootconfig structure for the benefit of pmap.c */
- /* XXX must make the memory description h/w independant */
- bootconfig.dramblocks = 1;
- bootconfig.dram[0].address = memstart;
- bootconfig.dram[0].pages = memsize / PAGE_SIZE;
-
- /*
- * Set up the variables that define the availablilty of
- * physical memory. For now, we're going to set
- * physical_freestart to 0xa0200000 (where the kernel
- * was loaded), and allocate the memory we need downwards.
- * If we get too close to the page tables that RedBoot
- * set up, we will panic. We will update physical_freestart
- * and physical_freeend later to reflect what pmap_bootstrap()
- * wants to see.
- *
- * XXX pmap_bootstrap() needs an enema.
- */
- physical_start = bootconfig.dram[0].address;
- physical_end = physical_start + (bootconfig.dram[0].pages * PAGE_SIZE);
-
- physical_freestart = 0xa0009000UL;
- physical_freeend = 0xa0200000UL;
-
- physmem = (physical_end - physical_start) / PAGE_SIZE;
-
-#ifdef DEBUG
- /* Tell the user about the memory */
- printf("physmemory: %d pages at 0x%08lx -> 0x%08lx\n", physmem,
- physical_start, physical_end - 1);
-#endif
-
- /*
- * Okay, the kernel starts 2MB in from the bottom of physical
- * memory. We are going to allocate our bootstrap pages downwards
- * from there.
- *
- * We need to allocate some fixed page tables to get the kernel
- * going. We allocate one page directory and a number of page
- * tables and store the physical addresses in the kernel_pt_table
- * array.
- *
- * The kernel page directory must be on a 16K boundary. The page
- * tables must be on 4K bounaries. What we do is allocate the
- * page directory on the first 16K boundary that we encounter, and
- * the page tables on 4K boundaries otherwise. Since we allocate
- * at least 3 L2 page tables, we are guaranteed to encounter at
- * least one 16K aligned region.
- */
-
-#ifdef VERBOSE_INIT_ARM
- printf("Allocating page tables\n");
-#endif
-
- free_pages = (physical_freeend - physical_freestart) / PAGE_SIZE;
-
-#ifdef VERBOSE_INIT_ARM
- printf("freestart = 0x%08lx, free_pages = %d (0x%08x)\n",
- physical_freestart, free_pages, free_pages);
-#endif
-
- /* Define a macro to simplify memory allocation */
-#define valloc_pages(var, np) \
- alloc_pages((var).pv_pa, (np)); \
- (var).pv_va = KERNEL_BASE + (var).pv_pa - physical_start;
-
-#define alloc_pages(var, np) \
- physical_freeend -= ((np) * PAGE_SIZE); \
- if (physical_freeend < physical_freestart) \
- panic("initarm: out of memory"); \
- (var) = physical_freeend; \
- free_pages -= (np); \
- memset((char *)(var), 0, ((np) * PAGE_SIZE));
-
- loop1 = 0;
- kernel_l1pt.pv_pa = 0;
- for (loop = 0; loop <= NUM_KERNEL_PTS; ++loop) {
- /* Are we 16KB aligned for an L1 ? */
- if (((physical_freeend - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) == 0
- && kernel_l1pt.pv_pa == 0) {
- valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);
- } else {
- valloc_pages(kernel_pt_table[loop1],
- L2_TABLE_SIZE / PAGE_SIZE);
- ++loop1;
- }
- }
-
- /* This should never be able to happen but better confirm that. */
- if (!kernel_l1pt.pv_pa || (kernel_l1pt.pv_pa & (L1_TABLE_SIZE-1)) != 0)
- panic("initarm: Failed to align the kernel page directory");
-
- /*
- * Allocate a page for the system page mapped to V0x00000000
- * This page will just contain the system vectors and can be
- * shared by all processes.
- */
- alloc_pages(systempage.pv_pa, 1);
-
- /* Allocate stacks for all modes */
- valloc_pages(irqstack, IRQ_STACK_SIZE);
- valloc_pages(abtstack, ABT_STACK_SIZE);
- valloc_pages(undstack, UND_STACK_SIZE);
- valloc_pages(kernelstack, UPAGES);
-
- /* Allocate enough pages for cleaning the Mini-Data cache. */
- KASSERT(xscale_minidata_clean_size <= PAGE_SIZE);
- valloc_pages(minidataclean, 1);
-
-#ifdef VERBOSE_INIT_ARM
- printf("IRQ stack: p0x%08lx v0x%08lx\n", irqstack.pv_pa,
- irqstack.pv_va);
- printf("ABT stack: p0x%08lx v0x%08lx\n", abtstack.pv_pa,
- abtstack.pv_va);
- printf("UND stack: p0x%08lx v0x%08lx\n", undstack.pv_pa,
- undstack.pv_va);
- printf("SVC stack: p0x%08lx v0x%08lx\n", kernelstack.pv_pa,
- kernelstack.pv_va);
-#endif
-
- /*
- * XXX Defer this to later so that we can reclaim the memory
- * XXX used by the RedBoot page tables.
- */
- alloc_pages(msgbufphys, round_page(MSGBUFSIZE) / PAGE_SIZE);
-
- /*
- * Ok we have allocated physical pages for the primary kernel
- * page tables
- */
-
-#ifdef VERBOSE_INIT_ARM
- printf("Creating L1 page table at 0x%08lx\n", kernel_l1pt.pv_pa);
-#endif
-
- /*
- * Now we start construction of the L1 page table
- * We start by mapping the L2 page tables into the L1.
- * This means that we can replace L1 mappings later on if necessary
- */
- l1pagetable = kernel_l1pt.pv_pa;
-
- /* Map the L2 pages tables in the L1 page table */
- pmap_link_l2pt(l1pagetable, 0x00000000,
- &kernel_pt_table[KERNEL_PT_SYS]);
-
- for (loop = 0; loop < KERNEL_PT_KERNEL_NUM; loop++)
- pmap_link_l2pt(l1pagetable, KERNEL_BASE + loop * 0x00400000,
- &kernel_pt_table[KERNEL_PT_KERNEL + loop]);
-
- for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; loop++)
- pmap_link_l2pt(l1pagetable, KERNEL_VM_BASE + loop * 0x00400000,
- &kernel_pt_table[KERNEL_PT_VMDATA + loop]);
-
- /* update the top of the kernel VM */
- pmap_curmaxkvaddr =
- KERNEL_VM_BASE + (KERNEL_PT_VMDATA_NUM * 0x00400000);
-
-#ifdef VERBOSE_INIT_ARM
- printf("Mapping kernel\n");
-#endif
-
- /* Now we fill in the L2 pagetable for the kernel static code/data
- * and the symbol table. */
- {
- extern char etext[];
- size_t textsize = (u_int32_t) etext - KERNEL_TEXT_BASE;
- size_t totalsize = esym - KERNEL_TEXT_BASE;
- u_int logical;
-
- textsize = (textsize + PGOFSET) & ~PGOFSET;
- totalsize = (totalsize + PGOFSET) & ~PGOFSET;
-
- logical = 0x00200000; /* offset of kernel in RAM */
-
- /* Update dump information */
- cpu_kcore_hdr.kernelbase = KERNEL_BASE;
- cpu_kcore_hdr.kerneloffs = logical;
- cpu_kcore_hdr.staticsize = totalsize;
-
- logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
- physical_start + logical, textsize,
- PROT_READ | PROT_WRITE, PTE_CACHE);
- pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
- physical_start + logical, totalsize - textsize,
- PROT_READ | PROT_WRITE, PTE_CACHE);
- }
-
-#ifdef VERBOSE_INIT_ARM
- printf("Constructing L2 page tables\n");
-#endif
-
- /* Map the stack pages */
- pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa,
- IRQ_STACK_SIZE * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
- pmap_map_chunk(l1pagetable, abtstack.pv_va, abtstack.pv_pa,
- ABT_STACK_SIZE * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
- pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa,
- UND_STACK_SIZE * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
- pmap_map_chunk(l1pagetable, kernelstack.pv_va, kernelstack.pv_pa,
- UPAGES * PAGE_SIZE, PROT_READ | PROT_WRITE, PTE_CACHE);
-
- pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
- L1_TABLE_SIZE, PROT_READ | PROT_WRITE, PTE_PAGETABLE);
-
- for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) {
- pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va,
- kernel_pt_table[loop].pv_pa, L2_TABLE_SIZE,
- PROT_READ | PROT_WRITE, PTE_PAGETABLE);
- }
-
- /* Map the Mini-Data cache clean area. */
- xscale_setup_minidata(l1pagetable, minidataclean.pv_va,
- minidataclean.pv_pa);
-
- /* Map the vector page. */
-#if 1
- /* MULTI-ICE requires that page 0 is NC/NB so that it can download the
- * cache-clean code there. */
- pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
- PROT_READ | PROT_WRITE, PTE_NOCACHE);
-#else
- pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
- PROT_READ | PROT_WRITE, PTE_CACHE);
-#endif
-
- /*
- * map integrated peripherals at same address in l1pagetable
- * so that we can continue to use console.
- */
- copy_io_area_map((pd_entry_t *)l1pagetable);
-
- /*
- * Give the XScale global cache clean code an appropriately
- * sized chunk of unmapped VA space starting at 0xff000000
- * (our device mappings end before this address).
- */
- xscale_cache_clean_addr = 0xff000000U;
-
- /*
- * Now we have the real page tables in place so we can switch to them.
- * Once this is done we will be running with the REAL kernel page
- * tables.
- */
-
- /*
- * Update the physical_freestart/physical_freeend/free_pages
- * variables.
- */
- {
- physical_freestart = physical_start +
- (((esym + PGOFSET) & ~PGOFSET) - KERNEL_BASE);
- physical_freeend = physical_end;
- free_pages =
- (physical_freeend - physical_freestart) / PAGE_SIZE;
- }
-
- /* be a client to all domains */
- cpu_domains(0x55555555);
- /* Switch tables */
-#ifdef VERBOSE_INIT_ARM
- printf("freestart = 0x%08lx, free_pages = %d (0x%x)\n",
- physical_freestart, free_pages, free_pages);
- printf("switching to new L1 page table @%#lx...", kernel_l1pt.pv_pa);
-#endif
-
- /* set new intc register address so that splfoo() doesn't
- touch illegal address. */
- pxa2x0_intr_bootstrap(ZAURUS_INTCTL_VBASE);
-
- cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
- setttb(kernel_l1pt.pv_pa);
- cpu_tlb_flushID();
- cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2));
-
- /*
- * Moved from cpu_startup() as data_abort_handler() references
- * this during uvm init
- */
- proc0paddr = (struct user *)kernelstack.pv_va;
- proc0.p_addr = proc0paddr;
-
-#ifdef VERBOSE_INIT_ARM
- printf("bootstrap done.\n");
-#endif
-
- arm32_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL);
-
- /*
- * Pages were allocated during the secondary bootstrap for the
- * stacks for different CPU modes.
- * We must now set the r13 registers in the different CPU modes to
- * point to these stacks.
- * Since the ARM stacks use STMFD etc. we must set r13 to the top end
- * of the stack memory.
- */
-#ifdef VERBOSE_INIT_ARM
- printf("init subsystems: stacks ");
-#endif
-
- set_stackptr(PSR_IRQ32_MODE,
- irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE);
- set_stackptr(PSR_ABT32_MODE,
- abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE);
- set_stackptr(PSR_UND32_MODE,
- undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE);
-
- /*
- * Well we should set a data abort handler.
- * Once things get going this will change as we will need a proper
- * handler.
- * Until then we will use a handler that just panics but tells us
- * why.
- * Initialisation of the vectors will just panic on a data abort.
- * This just fills in a slightly better one.
- */
-#ifdef VERBOSE_INIT_ARM
- printf("vectors ");
-#endif
- data_abort_handler_address = (u_int)data_abort_handler;
- prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
- undefined_handler_address = (u_int)undefinedinstruction_bounce;
-
- /* Initialise the undefined instruction handlers */
-#ifdef VERBOSE_INIT_ARM
- printf("undefined ");
-#endif
- undefined_init();
-
- /* Load memory into UVM. */
-#ifdef VERBOSE_INIT_ARM
- printf("page ");
-#endif
- uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */
- uvm_page_physload(atop(physical_freestart), atop(physical_freeend),
- atop(physical_freestart), atop(physical_freeend), 0);
-
- /* Boot strap pmap telling it where the kernel page table is */
-#ifdef VERBOSE_INIT_ARM
- printf("pmap ");
-#endif
- pmap_bootstrap((pd_entry_t *)kernel_l1pt.pv_va, KERNEL_VM_BASE,
- KERNEL_VM_BASE + KERNEL_VM_SIZE);
-
- /* Update dump information */
- cpu_kcore_hdr.pmap_kernel_l1 = (u_int32_t)pmap_kernel()->pm_l1;
- cpu_kcore_hdr.pmap_kernel_l2 = (u_int32_t)&(pmap_kernel()->pm_l2);
-
-#ifdef KGDB
- if (boothowto & RB_KDB) {
- kgdb_debug_init = 1;
- kgdb_connect(1);
- }
-#endif
-
- /*
- * Restore proper bus_space operation, now that pmap is initialized.
- */
- pxa2x0_a4x_bs_tag.bs_map = pxa2x0_bs_tag.bs_map = map_func_save;
-
-#ifdef DDB
- db_machine_init();
-
- /* Firmware doesn't load symbols. */
- ddb_init();
-
- if (boothowto & RB_KDB)
- Debugger();
-#endif
-
- cpu_setup();
-
- /* We return the new stack pointer address */
- return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
-}
-
-const char *console = "glass";
-
-void
-process_kernel_args(char *args)
-{
- char *cp = args;
-
- if (cp == NULL || *(int *)cp != BOOT_STRING_MAGIC) {
- boothowto = RB_AUTOBOOT;
- return;
- }
-
- /* Eat the cookie */
- *(int *)cp = 0;
- cp += sizeof(int);
-
- boothowto = 0;
-
- /* Make a local copy of the bootargs */
- strncpy(bootargs, cp, MAX_BOOT_STRING - sizeof(int));
-
- cp = bootargs;
- boot_file = bootargs;
-
- /* Skip the kernel image filename */
- while (*cp != ' ' && *cp != 0)
- ++cp;
-
- if (*cp != 0)
- *cp++ = 0;
-
- while (*cp == ' ')
- ++cp;
-
- boot_args = cp;
-
- printf("bootfile: %s\n", boot_file);
- printf("bootargs: %s\n", boot_args);
-
- /* Setup pointer to boot flags */
- while (*cp != '-')
- if (*cp++ == '\0')
- return;
-
- for (;*++cp;) {
- int fl;
-
- fl = 0;
- switch(*cp) {
- case 'a':
- fl |= RB_ASKNAME;
- break;
- case 'c':
- fl |= RB_CONFIG;
- break;
- case 'd':
- fl |= RB_KDB;
- break;
- case 's':
- fl |= RB_SINGLE;
- break;
- /* XXX undocumented console switching flags */
- case '0':
- console = "ffuart";
- break;
- case '1':
- console = "btuart";
- break;
- case '2':
- console = "stuart";
- break;
- default:
- printf("unknown option `%c'\n", *cp);
- break;
- }
- boothowto |= fl;
- }
-}
-
-#ifdef KGDB
-#ifndef KGDB_DEVNAME
-#define KGDB_DEVNAME "ffuart"
-#endif
-const char kgdb_devname[] = KGDB_DEVNAME;
-
-#if (NCOM > 0)
-#ifndef KGDB_DEVMODE
-#define KGDB_DEVMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
-#endif
-int comkgdbmode = KGDB_DEVMODE;
-#endif /* NCOM */
-
-#endif /* KGDB */
-
-void
-consinit(void)
-{
-#if NCOM > 0
- static int consinit_called = 0;
- paddr_t paddr;
- u_int cken = 0;
-
- if (consinit_called != 0)
- return;
-
- consinit_called = 1;
-
-#ifdef KGDB
- if (strcmp(kgdb_devname, console) == 0) {
- /* port is reserved for kgdb */
- } else
-#endif
- if (strcmp(console, "ffuart") == 0) {
- paddr = PXA2X0_FFUART_BASE;
- cken = CKEN_FFUART;
- } else if (strcmp(console, "btuart") == 0) {
- paddr = PXA2X0_BTUART_BASE;
- cken = CKEN_BTUART;
- } else if (strcmp(console, "stuart") == 0) {
- paddr = PXA2X0_STUART_BASE;
- cken = CKEN_STUART;
- irda_on(0);
- }
- if (cken != 0 && comcnattach(&pxa2x0_a4x_bs_tag, paddr, comcnspeed,
- PXA2X0_COM_FREQ, comcnmode) == 0) {
- early_clkman(cken, 1);
- }
-#endif /* NCOM */
-}
-
-#ifdef KGDB
-void
-kgdb_port_init(void)
-{
-#if (NCOM > 0) && defined(COM_PXA2X0)
- paddr_t paddr;
- u_int cken;
-
- if (strcmp(kgdb_devname, "ffuart") == 0) {
- paddr = PXA2X0_FFUART_BASE;
- cken = CKEN_FFUART;
- } else if (strcmp(kgdb_devname, "btuart") == 0) {
- paddr = PXA2X0_BTUART_BASE;
- cken = CKEN_BTUART;
- } else if (strcmp(kgdb_devname, "stuart") == 0) {
- paddr = PXA2X0_STUART_BASE;
- cken = CKEN_STUART;
- irda_on(0);
- } else
- return;
-
- if (com_kgdb_attach_pxa2x0(&pxa2x0_a4x_bs_tag, paddr,
- kgdb_rate, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comkgdbmode) == 0) {
- early_clkman(cken, 1);
- }
-#endif
-}
-#endif
-
-/* same as pxa2x0_clkman, but before autoconf */
-void
-early_clkman(u_int clk, int enable)
-{
- u_int32_t rv;
-
- rv = ioreg_read(ZAURUS_CLKMAN_VBASE + CLKMAN_CKEN);
- if (enable)
- rv |= clk;
- else
- rv &= ~clk;
- ioreg_write(ZAURUS_CLKMAN_VBASE + CLKMAN_CKEN, rv);
-}
-
-int glass_console = 0;
-
-void
-board_startup(void)
-{
- extern int lcd_cnattach(void (*)(u_int, int));
- extern bus_addr_t comconsaddr;
-
-#if NWSDISPLAY > 0
- /*
- * Try to attach the display console now that VM services
- * are available.
- */
-
- if ((cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA27X) {
- if (strcmp(console, "glass") == 0) {
- printf("attempting to switch console to lcd screen\n");
- glass_console = 1;
- }
- if (glass_console == 1 && lcd_cnattach(early_clkman) == 0) {
- /*
- * Kill the existing serial console.
- * XXX need to bus_space_unmap resources and disable
- * clocks...
- */
- comconsaddr = 0;
-
- /*
- * Display the copyright notice again on the new console
- */
- extern const char copyright[];
- printf("%s\n", copyright);
- }
- }
-#endif
-
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
-}
diff --git a/sys/arch/zaurus/zaurus/zaurus_start.S b/sys/arch/zaurus/zaurus/zaurus_start.S
deleted file mode 100644
index 8727992471f..00000000000
--- a/sys/arch/zaurus/zaurus/zaurus_start.S
+++ /dev/null
@@ -1,178 +0,0 @@
-/* $OpenBSD: zaurus_start.S,v 1.4 2016/04/25 04:46:57 jsg Exp $ */
-/* $NetBSD: lubbock_start.S,v 1.1 2003/06/18 10:51:15 bsh Exp $ */
-
-/*
- * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
- * Written by Hiroyuki Bessho for Genetec Corporation.
- *
- * 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.
- * 3. The name of Genetec Corporation may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
- * 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 <machine/asm.h>
-#include <arm/sysreg.h>
-#include <arm/armreg.h>
-#include <arm/pte.h>
-
-#undef DOMAIN_CLIENT /* XXX */
-#include "assym.h"
-
-#ifndef SDRAM_START
-#define SDRAM_START 0xa0000000
-#endif
-
-/*
- * CPWAIT -- Canonical method to wait for CP15 update.
- * NOTE: Clobbers the specified temp reg.
- * copied from arm/arm/cpufunc_asm_xscale.S
- * XXX: better be in a common header file.
- */
-#define CPWAIT_BRANCH \
- sub pc, pc, #4
-
-#define CPWAIT(tmp) \
- mrc CP15_TTBR0(tmp) /* arbitrary read of CP15 */ ;\
- mov tmp, tmp /* wait for it to complete */ ;\
- CPWAIT_BRANCH /* branch to next insn */
-
-/*
- * Kernel start routine for DBPXA250 (Lubbock)
- * this code is excuted at the very first after the kernel is loaded
- * by RedBoot.
- */
- .text
-
- .global _C_LABEL(zaurus_start)
-_C_LABEL(zaurus_start):
- /* Are we running on ROM ? */
- cmp pc, #0x06000000
- bhi zaurus_start_ram
-
- /* move me to RAM
- * XXX: we can use memcpy if it is PIC
- */
- ldr r1, Lcopy_size
- adr r0, _C_LABEL(zaurus_start)
- add r1, r1, #3
- mov r1, r1, LSR #2
- mov r2, #SDRAM_START
- add r2, r2, #0x00200000
- mov r4, r2
-
-5: ldr r3,[r0],#4
- str r3,[r2],#4
- subs r1,r1,#1
- bhi 5b
-
- cmp pc, r5
- /* Jump to RAM */
- ldr r0, Lstart_off
-
- blo 1f
- /* if we were running out of virtual mapped space, disable mmu */
- mov r2, #0
- mov r1, #(CPU_CONTROL_32BP_ENABLE | CPU_CONTROL_32BD_ENABLE)
- mcr 15, 0, r1, c1, c0, 0
- mcrne 15, 0, r2, c8, c7, 0 /* nail I+D TLB on ARMv4 and greater */
-
-1:
- add pc, r4, r0
-
-Lcopy_size: .word _edata-_C_LABEL(zaurus_start)
-Lstart_off: .word zaurus_start_ram-_C_LABEL(zaurus_start)
-
-zaurus_start_ram:
- /*
- * Kernel is loaded in SDRAM (0xa0200000..), and is expected to run
- * in VA 0xc0200000..
- */
-
- mrc CP15_TTBR0(r0) /* get ttb prepared by redboot */
- adr r4, mmu_init_table2
-
-#define BUILD_STARTUP_PAGETABLE
-#ifdef BUILD_STARTUP_PAGETABLE
- mrc CP15_SCTLR(r2)
- mov r2, #0
- tst r2, #CPU_CONTROL_MMU_ENABLE /* we already have a page table? */
- bne 3f
-
- /* build page table from scratch */
- ldr r0, Lstartup_pagetable
- adr r4, mmu_init_table
- b 3f
-
-2:
- str r3, [r0, r2]
- add r2, r2, #4
- add r3, r3, #(L1_S_SIZE)
- adds r1, r1, #-1
- bhi 2b
-3:
- ldmia r4!, {r1,r2,r3} /* # of sections, PA|attr, VA */
- cmp r1, #0
- bne 2b
-#endif
-
- mcr CP15_TTBR0(r0) /* Set TTB */
- mcr CP15_TLBIALL(r0) /* Flush TLB */
-
- /* Set the Domain Access register. Very important! */
- mov r0, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
- mcr CP15_DACR(r0)
-
- /* Enable MMU */
- mrc CP15_SCTLR(r0)
- orr r0, r0, #CPU_CONTROL_MMU_ENABLE
- mcr CP15_SCTLR(r0)
- CPWAIT(r0)
-
- /* Jump to kernel code in TRUE VA */
- adr r0, Lstart
- ldr pc, [r0]
-
-Lstart:
- .word start
-
-#define MMU_INIT(va,pa,n_sec,attr) \
- .word n_sec ; \
- .word 4*((va)>>L1_S_SHIFT) ; \
- .word (pa)|(attr) ;
-
-#ifdef BUILD_STARTUP_PAGETABLE
-#ifndef STARTUP_PAGETABLE_ADDR
-#define STARTUP_PAGETABLE_ADDR 0xa0004000
-#endif
-Lstartup_pagetable: .word STARTUP_PAGETABLE_ADDR
-mmu_init_table:
- /* fill all table VA==PA */
- MMU_INIT(0x00000000, 0x00000000, 1<<(32-L1_S_SHIFT), L1_TYPE_S|L1_S_AP(AP_KRW))
- /* map SDRAM VA==PA, WT cacheable */
- MMU_INIT(SDRAM_START, SDRAM_START, 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
-#endif
-mmu_init_table2:
- /* map VA 0xc0000000..0xc3ffffff to PA 0xa0000000..0xa3ffffff */
- MMU_INIT(0xc0000000, SDRAM_START, 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
-
- .word 0 /* end of table */
diff --git a/sys/dev/microcode/atmel/Makefile b/sys/dev/microcode/atmel/Makefile
index 3288d05ee55..4d68d04536a 100644
--- a/sys/dev/microcode/atmel/Makefile
+++ b/sys/dev/microcode/atmel/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.22 2016/08/10 14:27:17 deraadt Exp $
+# $OpenBSD: Makefile,v 1.23 2016/09/03 13:37:44 guenther Exp $
NOPROG=
NOMAN=
@@ -11,7 +11,7 @@ CC=${HOSTCC}
${MACHINE} == "hppa" || ${MACHINE} == "i386" || \
${MACHINE} == "landisk" || ${MACHINE} == "loongson" || \
${MACHINE} == "octeon" || ${MACHINE} == "sgi" || \
- ${MACHINE} == "sparc64" || ${MACHINE} == "zaurus")
+ ${MACHINE} == "sparc64")
FIRM= atu-intersil-int atu-intersil-ext \
atu-rfmd-int atu-rfmd-ext \
diff --git a/sys/dev/microcode/kue/Makefile b/sys/dev/microcode/kue/Makefile
index f4525e26531..7fe9c0e1bf9 100644
--- a/sys/dev/microcode/kue/Makefile
+++ b/sys/dev/microcode/kue/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.15 2016/08/10 14:27:17 deraadt Exp $
+# $OpenBSD: Makefile,v 1.16 2016/09/03 13:37:44 guenther Exp $
NOPROG=
NOMAN=
@@ -11,7 +11,7 @@ CC=${HOSTCC}
${MACHINE} == "hppa" || ${MACHINE} == "i386" || \
${MACHINE} == "landisk" || ${MACHINE} == "loongson" || \
${MACHINE} == "octeon" || ${MACHINE} == "sgi" || \
- ${MACHINE} == "sparc64" || ${MACHINE} == "zaurus")
+ ${MACHINE} == "sparc64")
FIRM= kue
diff --git a/sys/dev/microcode/rum/Makefile b/sys/dev/microcode/rum/Makefile
index 994274d4e27..377048b3765 100644
--- a/sys/dev/microcode/rum/Makefile
+++ b/sys/dev/microcode/rum/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.15 2016/08/10 14:27:17 deraadt Exp $
+# $OpenBSD: Makefile,v 1.16 2016/09/03 13:37:45 guenther Exp $
NOPROG=
NOMAN=
@@ -11,7 +11,7 @@ CC=${HOSTCC}
${MACHINE} == "hppa" || ${MACHINE} == "i386" || \
${MACHINE} == "landisk" || ${MACHINE} == "loongson" || \
${MACHINE} == "octeon" || ${MACHINE} == "sgi" || \
- ${MACHINE} == "sparc64" || ${MACHINE} == "zaurus")
+ ${MACHINE} == "sparc64")
FIRM= rum-rt2573 run-rt2870 run-rt3071
diff --git a/sys/dev/microcode/symbol/Makefile b/sys/dev/microcode/symbol/Makefile
index 16bfb8fbe74..54b3109d2a3 100644
--- a/sys/dev/microcode/symbol/Makefile
+++ b/sys/dev/microcode/symbol/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.12 2016/09/01 10:40:38 tedu Exp $
+# $OpenBSD: Makefile,v 1.13 2016/09/03 13:37:45 guenther Exp $
NOPROG=
NOMAN=
@@ -8,7 +8,7 @@ CC=${HOSTCC}
.if (${MACHINE} == "i386") || (${MACHINE} == "amd64") || \
(${MACHINE} == "macppc") || \
(${MACHINE} == "sparc64") || (${MACHINE} == "hppa") || \
- (${MACHINE} == "sgi") || (${MACHINE} == "zaurus")
+ (${MACHINE} == "sgi")
afterinstall:
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
diff --git a/sys/dev/microcode/tusb3410/Makefile b/sys/dev/microcode/tusb3410/Makefile
index 9909aa2cd89..071e880d020 100644
--- a/sys/dev/microcode/tusb3410/Makefile
+++ b/sys/dev/microcode/tusb3410/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.9 2016/08/10 14:27:17 deraadt Exp $
+# $OpenBSD: Makefile,v 1.10 2016/09/03 13:37:45 guenther Exp $
NOPROG=
NOMAN=
@@ -11,7 +11,7 @@ CC=${HOSTCC}
${MACHINE} == "hppa" || ${MACHINE} == "i386" || \
${MACHINE} == "landisk" || ${MACHINE} == "loongson" || \
${MACHINE} == "octeon" || ${MACHINE} == "sgi" || \
- ${MACHINE} == "sparc64" || ${MACHINE} == "zaurus")
+ ${MACHINE} == "sparc64")
FIRM= tusb3410
diff --git a/sys/dev/microcode/udl/Makefile b/sys/dev/microcode/udl/Makefile
index 67939419450..75787277e54 100644
--- a/sys/dev/microcode/udl/Makefile
+++ b/sys/dev/microcode/udl/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.8 2016/08/10 14:27:17 deraadt Exp $
+# $OpenBSD: Makefile,v 1.9 2016/09/03 13:37:45 guenther Exp $
NOPROG=
NOMAN=
@@ -11,7 +11,7 @@ CC=${HOSTCC}
${MACHINE} == "hppa" || ${MACHINE} == "i386" || \
${MACHINE} == "landisk" || ${MACHINE} == "loongson" || \
${MACHINE} == "octeon" || ${MACHINE} == "sgi" || \
- ${MACHINE} == "sparc64" || ${MACHINE} == "zaurus")
+ ${MACHINE} == "sparc64")
FIRM= udl_huffman
diff --git a/sys/dev/microcode/zydas/Makefile b/sys/dev/microcode/zydas/Makefile
index 7da7e298363..e6b129b86b3 100644
--- a/sys/dev/microcode/zydas/Makefile
+++ b/sys/dev/microcode/zydas/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.14 2016/08/10 14:27:17 deraadt Exp $
+# $OpenBSD: Makefile,v 1.15 2016/09/03 13:37:45 guenther Exp $
NOPROG=
NOMAN=
@@ -11,7 +11,7 @@ CC=${HOSTCC}
${MACHINE} == "hppa" || ${MACHINE} == "i386" || \
${MACHINE} == "landisk" || ${MACHINE} == "loongson" || \
${MACHINE} == "octeon" || ${MACHINE} == "sgi" || \
- ${MACHINE} == "sparc64" || ${MACHINE} == "zaurus")
+ ${MACHINE} == "sparc64")
FIRM= zd1211 zd1211b
diff --git a/sys/dev/usb/files.usb b/sys/dev/usb/files.usb
index 4448282c06f..efa13748f09 100644
--- a/sys/dev/usb/files.usb
+++ b/sys/dev/usb/files.usb
@@ -1,4 +1,4 @@
-# $OpenBSD: files.usb,v 1.129 2016/06/27 11:42:47 jmatthew Exp $
+# $OpenBSD: files.usb,v 1.130 2016/09/03 13:37:45 guenther Exp $
# $NetBSD: files.usb,v 1.16 2000/02/14 20:29:54 augustss Exp $
#
# Config file and device description for machine-independent USB code.
@@ -10,7 +10,7 @@ attach usb at usbus
file dev/usb/usb.c usb needs-flag
file dev/usb/usbdi.c usb
file dev/usb/usbdi_util.c usb
-file dev/usb/usb_mem.c usb | usbf
+file dev/usb/usb_mem.c usb
file dev/usb/usb_subr.c usb
file dev/usb/usb_quirks.c usb
@@ -412,17 +412,6 @@ device umb: ifnet, ifmedia
attach umb at uhub
file dev/usb/if_umb.c umb
-# USB logical device
-device usbf {}
-attach usbf at usbdev
-file dev/usb/usbf.c usbf needs-flag
-file dev/usb/usbf_subr.c usbf
-
-# Communication Device Class Ethernet function
-device cdcef {}
-attach cdcef at usbf
-file dev/usb/if_cdcef.c cdcef
-
# Atheros AR5005UG/AR5005UX
device uath: ether, ifnet, ifmedia, wlan, firmload
attach uath at uhub
diff --git a/sys/dev/usb/if_cdcef.c b/sys/dev/usb/if_cdcef.c
deleted file mode 100644
index be6a73487e8..00000000000
--- a/sys/dev/usb/if_cdcef.c
+++ /dev/null
@@ -1,557 +0,0 @@
-/* $OpenBSD: if_cdcef.c,v 1.43 2016/04/13 11:03:37 mpi Exp $ */
-
-/*
- * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org>
- * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * USB Communication Device Class Ethernet Emulation Model function driver
- * (counterpart of the host-side cdce(4) driver)
- */
-#include <bpfilter.h>
-
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/socket.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/timeout.h>
-
-#include <net/if.h>
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbf.h>
-#include <dev/usb/usbcdc.h>
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#endif
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-
-#define CDCEF_VENDOR_ID 0x0001
-#define CDCEF_PRODUCT_ID 0x0001
-#define CDCEF_DEVICE_CODE 0x0100
-#define CDCEF_VENDOR_STRING "OpenBSD.org"
-#define CDCEF_PRODUCT_STRING "CDC Ethernet Emulation"
-#define CDCEF_SERIAL_STRING "1.00"
-
-#define CDCEF_BUFSZ 1600
-
-
-struct cdcef_softc {
- struct usbf_function sc_dev;
- struct usbf_config *sc_config;
- struct usbf_interface *sc_iface;
- struct usbf_endpoint *sc_ep_in;
- struct usbf_endpoint *sc_ep_out;
- struct usbf_pipe *sc_pipe_in;
- struct usbf_pipe *sc_pipe_out;
- struct usbf_xfer *sc_xfer_in;
- struct usbf_xfer *sc_xfer_out;
- void *sc_buffer_in;
- void *sc_buffer_out;
-
- struct timeout start_to;
-
- struct mbuf *sc_xmit_mbuf;
-
- struct arpcom sc_arpcom;
-#define GET_IFP(sc) (&(sc)->sc_arpcom.ac_if)
-
- int sc_rxeof_errors;
- int sc_listening;
-};
-
-int cdcef_match(struct device *, void *, void *);
-void cdcef_attach(struct device *, struct device *, void *);
-
-usbf_status cdcef_do_request(struct usbf_function *,
- usb_device_request_t *, void **);
-
-void cdcef_start(struct ifnet *);
-
-void cdcef_txeof(struct usbf_xfer *, void *,
- usbf_status);
-void cdcef_rxeof(struct usbf_xfer *, void *,
- usbf_status);
-int cdcef_ioctl(struct ifnet *ifp, u_long command, caddr_t data);
-void cdcef_watchdog(struct ifnet *ifp);
-void cdcef_init(struct cdcef_softc *);
-void cdcef_stop(struct cdcef_softc *);
-int cdcef_encap(struct cdcef_softc *sc, struct mbuf *m, int idx);
-struct mbuf * cdcef_newbuf(void);
-void cdcef_start_timeout (void *);
-
-struct cfattach cdcef_ca = {
- sizeof(struct cdcef_softc), cdcef_match, cdcef_attach
-};
-
-struct cfdriver cdcef_cd = {
- NULL, "cdcef", DV_IFNET
-};
-
-struct usbf_function_methods cdcef_methods = {
- NULL, /* set_config */
- cdcef_do_request
-};
-
-#ifndef CDCEF_DEBUG
-#define DPRINTF(x) do {} while (0)
-#else
-#define DPRINTF(x) printf x
-#endif
-
-#define DEVNAME(sc) ((sc)->sc_dev.bdev.dv_xname)
-
-/*
- * USB function match/attach/detach
- */
-
-int
-cdcef_match(struct device *parent, void *match, void *aux)
-{
- return UMATCH_GENERIC;
-}
-
-void
-cdcef_attach(struct device *parent, struct device *self, void *aux)
-{
- struct cdcef_softc *sc = (struct cdcef_softc *)self;
- struct usbf_attach_arg *uaa = aux;
- struct usbf_device *dev = uaa->device;
- struct ifnet *ifp = GET_IFP(sc);
- usbf_status err;
- struct usb_cdc_union_descriptor udesc;
- int s;
-
-
- /* Set the device identification according to the function. */
- usbf_devinfo_setup(dev, UDCLASS_IN_INTERFACE, 0, 0, CDCEF_VENDOR_ID,
- CDCEF_PRODUCT_ID, CDCEF_DEVICE_CODE, CDCEF_VENDOR_STRING,
- CDCEF_PRODUCT_STRING, CDCEF_SERIAL_STRING);
-
- /* Fill in the fields needed by the parent device. */
- sc->sc_dev.methods = &cdcef_methods;
-
- /* timeout to start delayed transfers */
- timeout_set(&sc->start_to, cdcef_start_timeout, sc);
-
- /*
- * Build descriptors according to the device class specification.
- */
- err = usbf_add_config(dev, &sc->sc_config);
- if (err) {
- printf(": usbf_add_config failed\n");
- return;
- }
- err = usbf_add_interface(sc->sc_config, UICLASS_CDC,
- UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 0, NULL,
- &sc->sc_iface);
- if (err) {
- printf(": usbf_add_interface failed\n");
- return;
- }
- /* XXX don't use hard-coded values 128 and 16. */
- err = usbf_add_endpoint(sc->sc_iface, UE_DIR_IN | 2, UE_BULK,
- 64, 16, &sc->sc_ep_in) ||
- usbf_add_endpoint(sc->sc_iface, UE_DIR_OUT | 1, UE_BULK,
- 64, 16, &sc->sc_ep_out);
- if (err) {
- printf(": usbf_add_endpoint failed\n");
- return;
- }
-
- /* Append a CDC union descriptor. */
- bzero(&udesc, sizeof udesc);
- udesc.bLength = sizeof udesc;
- udesc.bDescriptorType = UDESC_CS_INTERFACE;
- udesc.bDescriptorSubtype = UDESCSUB_CDC_UNION;
- udesc.bSlaveInterface[0] = usbf_interface_number(sc->sc_iface);
- err = usbf_add_config_desc(sc->sc_config,
- (usb_descriptor_t *)&udesc, NULL);
- if (err) {
- printf(": usbf_add_config_desc failed\n");
- return;
- }
-
- /*
- * Close the configuration and build permanent descriptors.
- */
- err = usbf_end_config(sc->sc_config);
- if (err) {
- printf(": usbf_end_config failed\n");
- return;
- }
-
- /* Preallocate xfers and data buffers. */
- sc->sc_xfer_in = usbf_alloc_xfer(dev);
- sc->sc_xfer_out = usbf_alloc_xfer(dev);
- sc->sc_buffer_in = usbf_alloc_buffer(sc->sc_xfer_in,
- CDCEF_BUFSZ);
- sc->sc_buffer_out = usbf_alloc_buffer(sc->sc_xfer_out,
- CDCEF_BUFSZ);
- if (sc->sc_buffer_in == NULL || sc->sc_buffer_out == NULL) {
- printf(": usbf_alloc_buffer failed\n");
- return;
- }
-
- /* Open the bulk pipes. */
- err = usbf_open_pipe(sc->sc_iface,
- usbf_endpoint_address(sc->sc_ep_out), &sc->sc_pipe_out) ||
- usbf_open_pipe(sc->sc_iface,
- usbf_endpoint_address(sc->sc_ep_in), &sc->sc_pipe_in);
- if (err) {
- printf(": usbf_open_pipe failed\n");
- return;
- }
-
- /* Get ready to receive packets. */
- usbf_setup_xfer(sc->sc_xfer_out, sc->sc_pipe_out, sc,
- sc->sc_buffer_out, CDCEF_BUFSZ, USBD_SHORT_XFER_OK, 0, cdcef_rxeof);
- err = usbf_transfer(sc->sc_xfer_out);
- if (err && err != USBF_IN_PROGRESS) {
- printf(": usbf_transfer failed\n");
- return;
- }
-
- s = splnet();
-
- ether_fakeaddr(ifp);
- printf(": address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr));
-
- ifp->if_softc = sc;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_ioctl = cdcef_ioctl;
- ifp->if_start = cdcef_start;
- ifp->if_watchdog = cdcef_watchdog;
- strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ);
-
- if_attach(ifp);
- ether_ifattach(ifp);
-
- splx(s);
-}
-
-usbf_status
-cdcef_do_request(struct usbf_function *fun, usb_device_request_t *req,
- void **data)
-{
- printf("cdcef_do_request\n");
- return USBF_STALLED;
-}
-
-void
-cdcef_start(struct ifnet *ifp)
-{
- struct cdcef_softc *sc = ifp->if_softc;
- struct mbuf *m_head = NULL;
-
- if (ifq_is_oactive(&ifp->if_snd))
- return;
-
- m_head = ifq_deq_begin(&ifp->if_snd);
- if (m_head == NULL) {
- return;
- }
-
- if (sc->sc_listening == 0 || m_head->m_pkthdr.len > CDCEF_BUFSZ) {
- /*
- * drop packet because receiver is not listening,
- * or if packet is larger than xmit buffer
- */
- ifq_deq_commit(&ifp->if_snd, m_head);
- m_freem(m_head);
- return;
- }
-
- if (cdcef_encap(sc, m_head, 0)) {
- ifq_deq_rollback(&ifp->if_snd, m_head);
- ifq_set_oactive(&ifp->if_snd);
- return;
- }
-
- ifq_deq_commit(&ifp->if_snd, m_head);
-
-#if NBPFILTER > 0
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
-#endif
-
- ifq_set_oactive(&ifp->if_snd);
-
- ifp->if_timer = 6;
-}
-
-void
-cdcef_txeof(struct usbf_xfer *xfer, void *priv,
- usbf_status err)
-{
- struct cdcef_softc *sc = priv;
- struct ifnet *ifp = GET_IFP(sc);
- int s;
-
- s = splnet();
-#if 0
- printf("cdcef_txeof: xfer=%p, priv=%p, %s\n", xfer, priv,
- usbf_errstr(err));
-#endif
-
- ifp->if_timer = 0;
- ifq_clr_oactive(&ifp->if_snd);
-
- if (sc->sc_xmit_mbuf != NULL) {
- m_freem(sc->sc_xmit_mbuf);
- sc->sc_xmit_mbuf = NULL;
- }
-
- if (err)
- ifp->if_oerrors++;
- else
- ifp->if_opackets++;
-
- if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)
- timeout_add(&sc->start_to, 1); /* XXX */
-
- splx(s);
-}
-void
-cdcef_start_timeout (void *v)
-{
- struct cdcef_softc *sc = v;
- struct ifnet *ifp = GET_IFP(sc);
- int s;
-
- s = splnet();
- cdcef_start(ifp);
- splx(s);
-}
-
-
-void
-cdcef_rxeof(struct usbf_xfer *xfer, void *priv,
- usbf_status status)
-{
- struct cdcef_softc *sc = priv;
- int total_len = 0;
- struct ifnet *ifp = GET_IFP(sc);
- struct mbuf_list ml = MBUF_LIST_INITIALIZER();
- struct mbuf *m = NULL;
-
-
- int s;
-
-#if 0
- printf("cdcef_rxeof: xfer=%p, priv=%p, %s\n", xfer, priv,
- usbf_errstr(status));
-#endif
-
- if (status != USBF_NORMAL_COMPLETION) {
- if (status == USBF_NOT_STARTED || status == USBF_CANCELLED)
- return;
- if (sc->sc_rxeof_errors == 0)
- printf("%s: usb error on rx: %s\n",
- DEVNAME(sc), usbf_errstr(status));
- /* XXX - no stalls on client */
- if (sc->sc_rxeof_errors++ > 10) {
- printf("%s: too many errors, disabling\n",
- DEVNAME(sc));
- }
- goto done;
- }
- sc->sc_rxeof_errors = 0;
-
- /* upon first incoming packet we know the host is listening */
- if (sc->sc_listening == 0) {
- sc->sc_listening = 1;
- }
-
-
- usbf_get_xfer_status(xfer, NULL, NULL, &total_len, NULL);
-
- /* total_len -= 4; Strip off CRC added for Zaurus - XXX*/
- if (total_len <= 1)
- goto done;
-
- if (total_len < sizeof(struct ether_header)) {
- ifp->if_ierrors++;
- goto done;
- }
-
- if (ifp->if_flags & IFF_RUNNING) {
- m = cdcef_newbuf();
- if (m == NULL) {
- /* message? */
- ifp->if_ierrors++;
- goto done;
- }
-
- m->m_pkthdr.len = m->m_len = total_len;
- bcopy(sc->sc_buffer_out, mtod(m, char *), total_len);
-
- ml_enqueue(&ml, m);
- }
-
- s = splnet();
- if_input(ifp, &ml);
- splx(s);
-done:
- /* Setup another xfer. */
- usbf_setup_xfer(xfer, sc->sc_pipe_out, sc, sc->sc_buffer_out,
- CDCEF_BUFSZ, USBD_SHORT_XFER_OK, 0, cdcef_rxeof);
-
- status = usbf_transfer(xfer);
- if (status && status != USBF_IN_PROGRESS) {
- printf("%s: usbf_transfer failed\n", DEVNAME(sc));
- return;
- }
-}
-
-struct mbuf *
-cdcef_newbuf(void)
-{
- struct mbuf *m;
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == NULL)
- return (NULL);
-
- MCLGET(m, M_DONTWAIT);
- if (!(m->m_flags & M_EXT)) {
- m_freem(m);
- return (NULL);
- }
-
- m->m_len = m->m_pkthdr.len = MCLBYTES;
- m_adj(m, ETHER_ALIGN);
-
- return (m);
-}
-
-int
-cdcef_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
-{
- struct cdcef_softc *sc = ifp->if_softc;
- int s, error = 0;
-
- s = splnet();
-
- switch (command) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- if (!(ifp->if_flags & IFF_RUNNING))
- cdcef_init(sc);
- break;
-
- case SIOCSIFFLAGS:
- if (ifp->if_flags & IFF_UP) {
- if (ifp->if_flags & IFF_RUNNING)
- error = ENETRESET;
- else
- cdcef_init(sc);
- } else {
- if (ifp->if_flags & IFF_RUNNING)
- cdcef_stop(sc);
- }
- break;
-
- default:
- error = ether_ioctl(ifp, &sc->sc_arpcom, command, data);
- }
-
- if (error == ENETRESET)
- error = 0;
-
- splx(s);
- return (error);
-}
-
-void
-cdcef_watchdog(struct ifnet *ifp)
-{
- struct cdcef_softc *sc = ifp->if_softc;
- int s;
-
- ifp->if_oerrors++;
- printf("%s: watchdog timeout\n", DEVNAME(sc));
-
- s = splusb();
- ifp->if_timer = 0;
- ifq_clr_oactive(&ifp->if_snd);
-
- /* cancel receive pipe? */
- usbf_abort_pipe(sc->sc_pipe_in); /* in is tx pipe */
- splx(s);
-}
-
-void
-cdcef_init(struct cdcef_softc *sc)
-{
- struct ifnet *ifp = GET_IFP(sc);
- int s;
-
- s = splnet();
-
- ifp->if_flags |= IFF_RUNNING;
- ifq_clr_oactive(&ifp->if_snd);
-
- splx(s);
-}
-
-int
-cdcef_encap(struct cdcef_softc *sc, struct mbuf *m, int idx)
-{
- usbf_status err;
-
- m_copydata(m, 0, m->m_pkthdr.len, sc->sc_buffer_in);
- /* NO CRC */
-
- usbf_setup_xfer(sc->sc_xfer_in, sc->sc_pipe_in, sc, sc->sc_buffer_in,
- m->m_pkthdr.len, USBD_FORCE_SHORT_XFER | USBD_NO_COPY,
- 10000, cdcef_txeof);
-
- err = usbf_transfer(sc->sc_xfer_in);
- if (err && err != USBD_IN_PROGRESS) {
- printf("encap error\n");
- cdcef_stop(sc);
- return (EIO);
- }
- sc->sc_xmit_mbuf = m;
-
- return (0);
-}
-
-
-void
-cdcef_stop(struct cdcef_softc *sc)
-{
- struct ifnet *ifp = GET_IFP(sc);
-
- ifp->if_timer = 0;
- ifp->if_flags &= ~IFF_RUNNING;
- ifq_clr_oactive(&ifp->if_snd);
-
- /* cancel receive pipe? */
-
- if (sc->sc_xmit_mbuf != NULL) {
- m_freem(sc->sc_xmit_mbuf);
- sc->sc_xmit_mbuf = NULL;
- }
-}
diff --git a/sys/dev/usb/usbf.c b/sys/dev/usb/usbf.c
deleted file mode 100644
index 75099d48965..00000000000
--- a/sys/dev/usb/usbf.c
+++ /dev/null
@@ -1,708 +0,0 @@
-/* $OpenBSD: usbf.c,v 1.16 2013/11/18 20:21:51 deraadt Exp $ */
-
-/*
- * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * USB 2.0 logical device driver
- *
- * Specification non-comformities:
- *
- * - not all Standard Device Requests are supported (see 9.4)
- * - USB 2.0 devices (device_descriptor.bcdUSB >= 0x0200) must support
- * the other_speed requests but we do not
- *
- * Missing functionality:
- *
- * - isochronous pipes/transfers
- * - clever, automatic endpoint address assignment to make optimal use
- * of available hardware endpoints
- * - alternate settings for interfaces are unsupported
- */
-
-/*
- * The source code below is marked an can be split into a number of pieces
- * (in that order):
- *
- * - USB logical device match/attach/detach
- * - USB device tasks
- * - Bus event handling
- * - Device request handling
- *
- * Stylistic issues:
- *
- * - "endpoint number" and "endpoint address" are sometimes confused in
- * this source code, OTOH the endpoint number is just the address, aside
- * from the direction bit that is added to the number to form a unique
- * endpoint address
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/kthread.h>
-#include <sys/timeout.h>
-#include <sys/malloc.h>
-#include <sys/systm.h>
-
-#include <machine/bus.h>
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdivar.h>
-#include <dev/usb/usbf.h>
-#include <dev/usb/usbfvar.h>
-
-#ifndef USBF_DEBUG
-#define DPRINTF(l, x) do {} while (0)
-#else
-int usbfdebug = 0;
-#define DPRINTF(l, x) if ((l) <= usbfdebug) printf x; else {}
-#endif
-
-struct usbf_softc {
- struct device sc_dev; /* base device */
- struct usbf_bus *sc_bus; /* USB device controller */
- struct usbf_port sc_port; /* dummy port for function */
- struct proc *sc_proc; /* task thread */
- TAILQ_HEAD(,usbf_task) sc_tskq; /* task queue head */
- int sc_dying;
-
- u_int8_t *sc_hs_config;
-};
-
-#define DEVNAME(sc) ((sc)->sc_dev.dv_xname)
-
-int usbf_match(struct device *, void *, void *);
-void usbf_attach(struct device *, struct device *, void *);
-void usbf_create_thread(void *);
-void usbf_task_thread(void *);
-
-usbf_status usbf_get_descriptor(struct usbf_device *, usb_device_request_t *,
- void **);
-void usbf_set_address(struct usbf_device *, u_int8_t);
-usbf_status usbf_set_config(struct usbf_device *, u_int8_t);
-
-#ifdef USBF_DEBUG
-void usbf_dump_request(struct usbf_device *, usb_device_request_t *);
-#endif
-
-struct cfattach usbf_ca = {
- sizeof(struct usbf_softc), usbf_match, usbf_attach
-};
-
-struct cfdriver usbf_cd = {
- NULL, "usbf", DV_DULL
-};
-
-static const char * const usbrev_str[] = USBREV_STR;
-
-int
-usbf_match(struct device *parent, void *match, void *aux)
-{
- return UMATCH_GENERIC;
-}
-
-void
-usbf_attach(struct device *parent, struct device *self, void *aux)
-{
- struct usbf_softc *sc = (struct usbf_softc *)self;
- int usbrev;
- int speed;
- usbf_status err;
-
- /* Continue to set up the bus struct. */
- sc->sc_bus = aux;
- sc->sc_bus->usbfctl = sc;
-
- usbrev = sc->sc_bus->usbrev;
- printf(": USB revision %s", usbrev_str[usbrev]);
- switch (usbrev) {
- case USBREV_2_0:
- speed = USB_SPEED_HIGH;
- break;
- case USBREV_1_1:
- case USBREV_1_0:
- speed = USB_SPEED_FULL;
- break;
- default:
- printf(", not supported\n");
- sc->sc_dying = 1;
- return;
- }
- printf("\n");
-
- /* Initialize the usbf struct. */
- TAILQ_INIT(&sc->sc_tskq);
-
- /* Establish the software interrupt. */
- if (usbf_softintr_establish(sc->sc_bus)) {
- printf("%s: can't establish softintr\n", DEVNAME(sc));
- sc->sc_dying = 1;
- return;
- }
-
- /* Attach the function driver. */
- err = usbf_new_device(self, sc->sc_bus, 0, speed, 0, &sc->sc_port);
- if (err) {
- printf("%s: usbf_new_device failed, %s\n", DEVNAME(sc),
- usbf_errstr(err));
- sc->sc_dying = 1;
- return;
- }
-
- /* Create a process context for asynchronous tasks. */
- config_pending_incr();
- kthread_create_deferred(usbf_create_thread, sc);
-}
-
-/*
- * USB device tasks
- */
-
-/*
- * Add a task to be performed by the task thread. This function can be
- * called from any context and the task function will be executed in a
- * process context ASAP.
- */
-void
-usbf_add_task(struct usbf_device *dev, struct usbf_task *task)
-{
- struct usbf_softc *sc = dev->bus->usbfctl;
- int s;
-
- s = splusb();
- if (!task->onqueue) {
- DPRINTF(1,("usbf_add_task: task=%p, proc=%s\n",
- task, sc->sc_bus->intr_context ? "(null)" :
- curproc->p_comm));
- TAILQ_INSERT_TAIL(&sc->sc_tskq, task, next);
- task->onqueue = 1;
- } else {
- DPRINTF(0,("usbf_add_task: task=%p on q, proc=%s\n",
- task, sc->sc_bus->intr_context ? "(null)" :
- curproc->p_comm));
- }
- wakeup(&sc->sc_tskq);
- splx(s);
-}
-
-void
-usbf_rem_task(struct usbf_device *dev, struct usbf_task *task)
-{
- struct usbf_softc *sc = dev->bus->usbfctl;
- int s;
-
- s = splusb();
- if (task->onqueue) {
- DPRINTF(1,("usbf_rem_task: task=%p\n", task));
- TAILQ_REMOVE(&sc->sc_tskq, task, next);
- task->onqueue = 0;
-
- } else {
- DPRINTF(0,("usbf_rem_task: task=%p not on q", task));
- }
- splx(s);
-}
-
-/*
- * Called from the kernel proper when it can create threads.
- */
-void
-usbf_create_thread(void *arg)
-{
- struct usbf_softc *sc = arg;
-
- if (kthread_create(usbf_task_thread, sc, &sc->sc_proc,
- DEVNAME(sc)) != 0) {
- printf("%s: can't create task thread\n", DEVNAME(sc));
- return;
- }
- config_pending_decr();
-}
-
-/*
- * Process context for USB function tasks.
- */
-void
-usbf_task_thread(void *arg)
-{
- struct usbf_softc *sc = arg;
- struct usbf_task *task;
- int s;
-
- DPRINTF(0,("usbf_task_thread: start (pid %d)\n", curproc->p_pid));
-
- s = splusb();
- while (!sc->sc_dying) {
- task = TAILQ_FIRST(&sc->sc_tskq);
- if (task == NULL) {
- tsleep(&sc->sc_tskq, PWAIT, "usbtsk", 0);
- task = TAILQ_FIRST(&sc->sc_tskq);
- }
- DPRINTF(1,("usbf_task_thread: woke up task=%p\n", task));
- if (task != NULL) {
- TAILQ_REMOVE(&sc->sc_tskq, task, next);
- task->onqueue = 0;
- splx(s);
- task->fun(task->arg);
- s = splusb();
- DPRINTF(1,("usbf_task_thread: done task=%p\n", task));
- }
- }
- splx(s);
-
- DPRINTF(0,("usbf_task_thread: exit\n"));
- kthread_exit(0);
-}
-
-/*
- * Bus event handling
- */
-
-void
-usbf_host_reset(struct usbf_bus *bus)
-{
- struct usbf_device *dev = bus->usbfctl->sc_port.device;
-
- DPRINTF(0,("usbf_host_reset\n"));
-
- /* Change device state from any state backe to Default. */
- (void)usbf_set_config(dev, USB_UNCONFIG_NO);
- dev->address = 0;
-}
-
-/*
- * Device request handling
- */
-
-usbf_status
-usbf_get_descriptor(struct usbf_device *dev, usb_device_request_t *req,
- void **data)
-{
- u_int8_t type = UGETW(req->wValue) >> 8;
- u_int8_t index = UGETW(req->wValue) & 0xff;
- usb_device_descriptor_t *dd;
- usb_config_descriptor_t *cd;
- usb_string_descriptor_t *sd;
- struct usbf_softc *sc;
-
- switch (type) {
- case UDESC_DEVICE:
- dd = usbf_device_descriptor(dev);
- *data = dd;
- USETW(req->wLength, MIN(UGETW(req->wLength), dd->bLength));
- return USBF_NORMAL_COMPLETION;
-
- case UDESC_DEVICE_QUALIFIER: {
- static usb_device_qualifier_t dq;
-
- dd = usbf_device_descriptor(dev);
- bzero(&dq, sizeof dq);
- dq.bLength = USB_DEVICE_QUALIFIER_SIZE;
- dq.bDescriptorType = UDESC_DEVICE_QUALIFIER;
- USETW(dq.bcdUSB, 0x0200);
- dq.bDeviceClass = dd->bDeviceClass;
- dq.bDeviceSubClass = dd->bDeviceSubClass;
- dq.bDeviceProtocol = dd->bDeviceProtocol;
- dq.bMaxPacketSize0 = dd->bMaxPacketSize;
- dq.bNumConfigurations = dd->bNumConfigurations;
- *data = &dq;
- USETW(req->wLength, MIN(UGETW(req->wLength), dq.bLength));
- return USBF_NORMAL_COMPLETION;
- }
-
- case UDESC_CONFIG:
- cd = usbf_config_descriptor(dev, index);
- if (cd == NULL)
- return USBF_INVAL;
- *data = cd;
- USETW(req->wLength, MIN(UGETW(req->wLength),
- UGETW(cd->wTotalLength)));
- return USBF_NORMAL_COMPLETION;
-
- /* XXX */
- case UDESC_OTHER_SPEED_CONFIGURATION:
- cd = usbf_config_descriptor(dev, index);
- if (cd == NULL)
- return USBF_INVAL;
- sc = dev->bus->usbfctl;
- if (sc->sc_hs_config == NULL) {
- /* XXX should allocate more dynamically */
- sc->sc_hs_config =
- (u_int8_t *)malloc(65536, M_USB, M_NOWAIT);
- }
- if (sc->sc_hs_config == NULL)
- return USBF_INVAL;
- bcopy(cd, sc->sc_hs_config, UGETW(cd->wTotalLength));
- *data = sc->sc_hs_config;
- ((usb_config_descriptor_t *)sc->sc_hs_config)->bDescriptorType =
- UDESC_OTHER_SPEED_CONFIGURATION;
- USETW(req->wLength, MIN(UGETW(req->wLength),
- UGETW(cd->wTotalLength)));
- return USBF_NORMAL_COMPLETION;
-
- case UDESC_STRING:
- sd = usbf_string_descriptor(dev, index);
- if (sd == NULL)
- return USBF_INVAL;
- *data = sd;
- USETW(req->wLength, MIN(UGETW(req->wLength), sd->bLength));
- return USBF_NORMAL_COMPLETION;
-
- default:
- DPRINTF(0,("usbf_get_descriptor: unknown descriptor type=%u\n",
- type));
- return USBF_INVAL;
- }
-}
-
-/*
- * Change device state from Default to Address, or change the device address
- * if the device is not currently in the Default state.
- */
-void
-usbf_set_address(struct usbf_device *dev, u_int8_t address)
-{
- DPRINTF(0,("usbf_set_address: dev=%p, %u -> %u\n", dev,
- dev->address, address));
- dev->address = address;
-}
-
-/*
- * If the device was in the Addressed state (dev->config == NULL) before, it
- * will be in the Configured state upon successful return from this routine.
- */
-usbf_status
-usbf_set_config(struct usbf_device *dev, u_int8_t new)
-{
- struct usbf_config *cfg = dev->config;
- struct usbf_function *fun = dev->function;
- usbf_status err = USBF_NORMAL_COMPLETION;
- u_int8_t old = cfg ? cfg->uc_cdesc->bConfigurationValue :
- USB_UNCONFIG_NO;
-
- if (old == new)
- return USBF_NORMAL_COMPLETION;
-
- DPRINTF(0,("usbf_set_config: dev=%p, %u -> %u\n", dev, old, new));
-
- /*
- * Resetting the device state to Unconfigured must always succeed.
- * This happens typically when the host resets the bus.
- */
- if (new == USB_UNCONFIG_NO) {
- if (dev->function->methods->set_config)
- err = fun->methods->set_config(fun, NULL);
- if (err) {
- DPRINTF(0,("usbf_set_config: %s\n", usbf_errstr(err)));
- }
- dev->config = NULL;
- return USBF_NORMAL_COMPLETION;
- }
-
- /*
- * Changing the device configuration may fail. The function
- * may decline to set the new configuration.
- */
- SIMPLEQ_FOREACH(cfg, &dev->configs, next) {
- if (cfg->uc_cdesc->bConfigurationValue == new) {
- if (dev->function->methods->set_config)
- err = fun->methods->set_config(fun, cfg);
- if (!err)
- dev->config = cfg;
- return err;
- }
- }
- return USBF_INVAL;
-}
-
-/*
- * Handle device requests coming in via endpoint 0 pipe.
- */
-void
-usbf_do_request(struct usbf_xfer *xfer, void *priv,
- usbf_status err)
-{
- struct usbf_device *dev = xfer->pipe->device;
- usb_device_request_t *req = xfer->buffer;
- struct usbf_config *cfg;
- void *data = NULL;
- u_int16_t value;
- u_int16_t index;
-
- if (err) {
- DPRINTF(0,("usbf_do_request: receive failed, %s\n",
- usbf_errstr(err)));
- return;
- }
-
-#ifdef USBF_DEBUG
- if (usbfdebug >= 0)
- usbf_dump_request(dev, req);
-#endif
-
-#define C(x,y) ((x) | ((y) << 8))
- switch (C(req->bRequest, req->bmRequestType)) {
-
- case C(UR_SET_ADDRESS, UT_WRITE_DEVICE):
- /* Change device state from Default to Address. */
- usbf_set_address(dev, UGETW(req->wValue));
- break;
-
- case C(UR_SET_CONFIG, UT_WRITE_DEVICE):
- /* Change device state from Address to Configured. */
- printf("set config activated\n");
- err = usbf_set_config(dev, UGETW(req->wValue) & 0xff);
- break;
-
- case C(UR_GET_CONFIG, UT_READ_DEVICE):
- { /* XXX */
- if ((cfg = dev->config) == NULL) {
- static u_int8_t zero = 0;
- data = &zero;
- } else
- data = &cfg->uc_cdesc->bConfigurationValue;
- USETW(req->wLength, MIN(UGETW(req->wLength), 1));
- }
- break;
-
- case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE):
- err = usbf_get_descriptor(dev, req, &data);
- break;
-
- case C(UR_GET_STATUS, UT_READ_DEVICE):
- DPRINTF(1,("usbf_do_request: UR_GET_STATUS %d\n",
- UGETW(req->wLength)));
- data = &dev->status;
- USETW(req->wLength, MIN(UGETW(req->wLength),
- sizeof dev->status));
- break;
-
- case C(UR_GET_STATUS, UT_READ_ENDPOINT): {
- //u_int8_t addr = UGETW(req->wIndex) & 0xff;
- static u_int16_t status = 0;
-
- data = &status;
- USETW(req->wLength, MIN(UGETW(req->wLength), sizeof status));
- break;
- }
-
- case C(UR_SET_FEATURE, UT_WRITE_ENDPOINT):
- value = UGETW(req->wValue);
- index = UGETW(req->wIndex);
- if ((cfg = dev->config) == NULL)
- err = USBF_STALLED;
- else
- err = usbf_set_endpoint_feature(cfg, index, value);
- break;
-
- case C(UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT):
- value = UGETW(req->wValue);
- index = UGETW(req->wIndex);
- if ((cfg = dev->config) == NULL)
- err = USBF_STALLED;
- else
- err = usbf_clear_endpoint_feature(cfg, index, value);
- break;
-
- /* Alternate settings for interfaces are unsupported. */
- case C(UR_SET_INTERFACE, UT_WRITE_INTERFACE):
- if (UGETW(req->wValue) != 0)
- err = USBF_STALLED;
- break;
- case C(UR_GET_INTERFACE, UT_READ_INTERFACE): {
- static u_int8_t zero = 0;
- data = &zero;
- USETW(req->wLength, MIN(UGETW(req->wLength), 1));
- break;
- }
-
- default: {
- struct usbf_function *fun = dev->function;
-
- if (fun == NULL)
- err = USBF_STALLED;
- else
- /* XXX change prototype for this method to remove
- * XXX the data argument. */
- err = fun->methods->do_request(fun, req, &data);
- }
- }
-
- if (err) {
- DPRINTF(0,("usbf_do_request: request=%#x, type=%#x "
- "failed, %s\n", req->bRequest, req->bmRequestType,
- usbf_errstr(err)));
- usbf_stall_pipe(dev->default_pipe);
- } else if (UGETW(req->wLength) > 0) {
- if (data == NULL) {
- DPRINTF(0,("usbf_do_request: no data, "
- "sending ZLP\n"));
- USETW(req->wLength, 0);
- }
- /* Transfer IN data in response to the request. */
- usbf_setup_xfer(dev->data_xfer, dev->default_pipe,
- NULL, data, UGETW(req->wLength), 0, 0, NULL);
- err = usbf_transfer(dev->data_xfer);
- if (err && err != USBF_IN_PROGRESS) {
- DPRINTF(0,("usbf_do_request: data xfer=%p, %s\n",
- xfer, usbf_errstr(err)));
- }
- }
-
- /* Schedule another request transfer. */
- usbf_setup_default_xfer(dev->default_xfer, dev->default_pipe,
- NULL, &dev->def_req, 0, 0, usbf_do_request);
- err = usbf_transfer(dev->default_xfer);
- if (err && err != USBF_IN_PROGRESS) {
- DPRINTF(0,("usbf_do_request: ctrl xfer=%p, %s\n", xfer,
- usbf_errstr(err)));
- }
-}
-
-#ifdef USBF_DEBUG
-struct usb_enum_str {
- int code;
- const char * const str;
-};
-
-static const struct usb_enum_str usb_request_str[] = {
- { UR_GET_STATUS, "GET STATUS" },
- { UR_CLEAR_FEATURE, "CLEAR FEATURE" },
- { UR_SET_FEATURE, "SET FEATURE" },
- { UR_SET_ADDRESS, "SET ADDRESS" },
- { UR_GET_DESCRIPTOR, "GET DESCRIPTOR" },
- { UR_SET_DESCRIPTOR, "SET DESCRIPTOR" },
- { UR_GET_CONFIG, "GET CONFIG" },
- { UR_SET_CONFIG, "SET CONFIG" },
- { UR_GET_INTERFACE, "GET INTERFACE" },
- { UR_SET_INTERFACE, "SET INTERFACE" },
- { UR_SYNCH_FRAME, "SYNCH FRAME" },
- { 0, NULL }
-};
-
-static const struct usb_enum_str usb_request_type_str[] = {
- { UT_READ_DEVICE, "Read Device" },
- { UT_READ_INTERFACE, "Read Interface" },
- { UT_READ_ENDPOINT, "Read Endpoint" },
- { UT_WRITE_DEVICE, "Write Device" },
- { UT_WRITE_INTERFACE, "Write Interface" },
- { UT_WRITE_ENDPOINT, "Write Endpoint" },
- { UT_READ_CLASS_DEVICE, "Read Class Device" },
- { UT_READ_CLASS_INTERFACE, "Read Class Interface" },
- { UT_READ_CLASS_OTHER, "Read Class Other" },
- { UT_READ_CLASS_ENDPOINT, "Read Class Endpoint" },
- { UT_WRITE_CLASS_DEVICE, "Write Class Device" },
- { UT_WRITE_CLASS_INTERFACE, "Write Class Interface" },
- { UT_WRITE_CLASS_OTHER, "Write Class Other" },
- { UT_WRITE_CLASS_ENDPOINT, "Write Class Endpoint" },
- { UT_READ_VENDOR_DEVICE, "Read Vendor Device" },
- { UT_READ_VENDOR_INTERFACE, "Read Vendor Interface" },
- { UT_READ_VENDOR_OTHER, "Read Vendor Other" },
- { UT_READ_VENDOR_ENDPOINT, "Read Vendor Endpoint" },
- { UT_WRITE_VENDOR_DEVICE, "Write Vendor Device" },
- { UT_WRITE_VENDOR_INTERFACE, "Write Vendor Interface" },
- { UT_WRITE_VENDOR_OTHER, "Write Vendor Other" },
- { UT_WRITE_VENDOR_ENDPOINT, "Write Vendor Endpoint" },
- { 0, NULL }
-};
-
-static const struct usb_enum_str usb_request_desc_str[] = {
- { UDESC_DEVICE, "Device" },
- { UDESC_CONFIG, "Configuration" },
- { UDESC_STRING, "String" },
- { UDESC_INTERFACE, "Interface" },
- { UDESC_ENDPOINT, "Endpoint" },
- { UDESC_DEVICE_QUALIFIER, "Device Qualifier" },
- { UDESC_OTHER_SPEED_CONFIGURATION, "Other Speed Configuration" },
- { UDESC_INTERFACE_POWER, "Interface Power" },
- { UDESC_OTG, "OTG" },
- { UDESC_CS_DEVICE, "Class-specific Device" },
- { UDESC_CS_CONFIG, "Class-specific Configuration" },
- { UDESC_CS_STRING, "Class-specific String" },
- { UDESC_CS_INTERFACE, "Class-specific Interface" },
- { UDESC_CS_ENDPOINT, "Class-specific Endpoint" },
- { UDESC_HUB, "Hub" },
- { 0, NULL }
-};
-
-static const char *
-usb_enum_string(const struct usb_enum_str *tab, int code)
-{
- static char buf[16];
-
- while (tab->str != NULL) {
- if (tab->code == code)
- return tab->str;
- tab++;
- }
-
- (void)snprintf(buf, sizeof buf, "0x%02x", code);
- return buf;
-}
-
-static const char *
-usbf_request_code_string(usb_device_request_t *req)
-{
- static char buf[32];
-
- (void)snprintf(buf, sizeof buf, "%s",
- usb_enum_string(usb_request_str, req->bRequest));
- return buf;
-}
-
-static const char *
-usbf_request_type_string(usb_device_request_t *req)
-{
- static char buf[32];
-
- (void)snprintf(buf, sizeof buf, "%s",
- usb_enum_string(usb_request_type_str, req->bmRequestType));
- return buf;
-}
-
-static const char *
-usbf_request_desc_string(usb_device_request_t *req)
-{
- static char buf[32];
- u_int8_t type = UGETW(req->wValue) >> 8;
- u_int8_t index = UGETW(req->wValue) & 0xff;
-
- (void)snprintf(buf, sizeof buf, "%s/%u",
- usb_enum_string(usb_request_desc_str, type), index);
- return buf;
-}
-
-void
-usbf_dump_request(struct usbf_device *dev, usb_device_request_t *req)
-{
- struct usbf_softc *sc = dev->bus->usbfctl;
-
- printf("%s: %s request %s\n",
- DEVNAME(sc), usbf_request_type_string(req),
- usbf_request_code_string(req));
-
- if (req->bRequest == UR_GET_DESCRIPTOR)
- printf("%s: VALUE: 0x%04x (%s)\n", DEVNAME(sc),
- UGETW(req->wValue), usbf_request_desc_string(req));
- else
- printf("%s: VALUE: 0x%04x\n", DEVNAME(sc),
- UGETW(req->wValue));
-
- printf("%s: INDEX: 0x%04x\n", DEVNAME(sc), UGETW(req->wIndex));
- printf("%s: LENGTH: 0x%04x\n", DEVNAME(sc), UGETW(req->wLength));
-}
-#endif
diff --git a/sys/dev/usb/usbf.h b/sys/dev/usb/usbf.h
deleted file mode 100644
index 23c4f8abc71..00000000000
--- a/sys/dev/usb/usbf.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* $OpenBSD: usbf.h,v 1.4 2013/04/15 09:23:02 mglocker Exp $ */
-
-/*
- * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * USB function driver interface data structures and subroutines
- */
-
-#ifndef _USBF_H_
-#define _USBF_H_
-
-struct usbf_function;
-struct usbf_bus;
-struct usbf_device;
-struct usbf_config;
-struct usbf_interface;
-struct usbf_endpoint;
-struct usbf_pipe;
-struct usbf_xfer;
-
-/*
- * Return codes for many of the function driver interface routines
- */
-typedef enum { /* keep in sync with USBF_ERROR_STRS */
- USBF_NORMAL_COMPLETION = 0, /* must be 0 */
- USBF_IN_PROGRESS, /* 1 */
- /* errors */
- USBF_NOT_STARTED, /* 2 */
- USBF_INVAL, /* 3 */
- USBF_NOMEM, /* 4 */
- USBF_CANCELLED, /* 5 */
- USBF_BAD_ADDRESS, /* 6 */
- USBF_IOERROR, /* 7 */
- USBF_TIMEOUT, /* 8 */
- USBF_SHORT_XFER, /* 9 */
- USBF_STALLED, /* 10 */
- USBF_ERROR_MAX /* must be last */
-} usbf_status;
-#define USBF_ERROR_STRS { /* keep in sync with enum usbf_status */ \
- "NORMAL_COMPLETION", /* 0 */ \
- "IN_PROGRESS", /* 1 */ \
- "NOT_STARTED", /* 2 */ \
- "INVAL", /* 3 */ \
- "NOMEM", /* 4 */ \
- "CANCELLED", /* 5 */ \
- "BAD_ADDRESS", /* 6 */ \
- "IOERROR", /* 7 */ \
- "TIMEOUT", /* 8 */ \
- "SHORT_XFER", /* 9 */ \
- "STALLED", /* 10 */ \
-};
-
-typedef void (*usbf_callback)(struct usbf_xfer *, void *, usbf_status);
-
-/*
- * Attach USB function at the logical device.
- */
-struct usbf_attach_arg {
- struct usbf_device *device;
-};
-
-struct usbf_function_methods {
- usbf_status (*set_config)(struct usbf_function *, struct usbf_config *);
- usbf_status (*do_request)(struct usbf_function *,
- usb_device_request_t *req, void **data);
-};
-
-struct usbf_function {
- struct device bdev; /* base device */
- /* filled in by function driver */
- struct usbf_function_methods *methods;
-};
-
-#define USBF_EMPTY_STRING_ID (USB_LANGUAGE_TABLE+1)
-#define USBF_STRING_ID_MIN (USB_LANGUAGE_TABLE+2)
-#define USBF_STRING_ID_MAX 255
-
-/*
- * USB function driver interface
- */
-
-/* global */
-const char *usbf_errstr(usbf_status);
-
-/* device */
-void usbf_devinfo_setup(struct usbf_device *, u_int8_t, u_int8_t,
- u_int8_t, u_int16_t, u_int16_t, u_int16_t, const char *,
- const char *, const char *);
-char *usbf_devinfo_alloc(struct usbf_device *);
-void usbf_devinfo_free(char *);
-usb_device_descriptor_t *usbf_device_descriptor(struct usbf_device *);
-usb_string_descriptor_t *usbf_string_descriptor(struct usbf_device *, u_int8_t);
-usb_config_descriptor_t *usbf_config_descriptor(struct usbf_device *, u_int8_t);
-
-/* configuration */
-u_int8_t usbf_add_string(struct usbf_device *, const char *);
-usbf_status usbf_add_config(struct usbf_device *, struct usbf_config **);
-usbf_status usbf_add_config_desc(struct usbf_config *, usb_descriptor_t *,
- usb_descriptor_t **);
-usbf_status usbf_add_interface(struct usbf_config *, u_int8_t, u_int8_t,
- u_int8_t, const char *, struct usbf_interface **);
-usbf_status usbf_add_endpoint(struct usbf_interface *, u_int8_t,
- u_int8_t, u_int16_t, u_int8_t, struct usbf_endpoint **);
-usbf_status usbf_end_config(struct usbf_config *);
-struct usbf_endpoint *usbf_config_endpoint(struct usbf_config *, u_int8_t);
-
-/* interface */
-int usbf_interface_number(struct usbf_interface *);
-struct usbf_endpoint *usbf_iface_endpoint(struct usbf_interface *, u_int8_t);
-
-/* endpoint */
-u_int8_t usbf_endpoint_address(struct usbf_endpoint *);
-u_int8_t usbf_endpoint_attributes(struct usbf_endpoint *);
-#define usbf_endpoint_index(e) UE_GET_ADDR(usbf_endpoint_address((e)))
-#define usbf_endpoint_dir(e) UE_GET_DIR(usbf_endpoint_address((e)))
-#define usbf_endpoint_type(e) UE_GET_XFERTYPE(usbf_endpoint_attributes((e)))
-
-/* pipe */
-usbf_status usbf_open_pipe(struct usbf_interface *, u_int8_t,
- struct usbf_pipe **);
-void usbf_abort_pipe(struct usbf_pipe *);
-void usbf_close_pipe(struct usbf_pipe *);
-void usbf_stall_pipe(struct usbf_pipe *);
-
-/* transfer */
-struct usbf_xfer *usbf_alloc_xfer(struct usbf_device *);
-void usbf_free_xfer(struct usbf_xfer *);
-void *usbf_alloc_buffer(struct usbf_xfer *, u_int32_t);
-void usbf_free_buffer(struct usbf_xfer *);
-void usbf_setup_xfer(struct usbf_xfer *, struct usbf_pipe *,
- void *, void *, u_int32_t, u_int16_t,
- u_int32_t, usbf_callback);
-void usbf_setup_default_xfer(struct usbf_xfer *, struct usbf_pipe *,
- void *, usb_device_request_t *, u_int16_t,
- u_int32_t, usbf_callback);
-void usbf_get_xfer_status(struct usbf_xfer *, void **,
- void **, u_int32_t *, usbf_status *);
-usbf_status usbf_transfer(struct usbf_xfer *);
-
-/*
- * The usbf_task structure describes a task to be perfomed in process
- * context, i.e. the USB device's task thread. This is normally used by
- * USB function drivers that need to perform tasks in a process context.
- */
-struct usbf_task {
- TAILQ_ENTRY(usbf_task) next;
- void (*fun)(void *);
- void *arg;
- char onqueue;
-};
-
-void usbf_add_task(struct usbf_device *, struct usbf_task *);
-void usbf_rem_task(struct usbf_device *, struct usbf_task *);
-#define usbf_init_task(t, f, a) ((t)->fun=(f), (t)->arg=(a), (t)->onqueue=0)
-
-#endif
diff --git a/sys/dev/usb/usbf_subr.c b/sys/dev/usb/usbf_subr.c
deleted file mode 100644
index 9cbf2385f8a..00000000000
--- a/sys/dev/usb/usbf_subr.c
+++ /dev/null
@@ -1,1082 +0,0 @@
-/* $OpenBSD: usbf_subr.c,v 1.20 2014/08/10 11:18:57 mpi Exp $ */
-
-/*
- * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * USB function driver interface subroutines
- */
-
-#include <sys/param.h>
-#include <sys/malloc.h>
-#include <sys/systm.h>
-#include <sys/timeout.h>
-
-#include <machine/bus.h>
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdivar.h>
-#include <dev/usb/usb_mem.h>
-#include <dev/usb/usbf.h>
-#include <dev/usb/usbfvar.h>
-
-#ifndef USBF_DEBUG
-#define DPRINTF(l, x) do {} while (0)
-#else
-extern int usbfdebug;
-#define DPRINTF(l, x) if ((l) <= usbfdebug) printf x; else {}
-#endif
-
-void *usbf_realloc(void **, size_t *, size_t);
-size_t usbf_get_string(struct usbf_device *, u_int8_t, char *, size_t);
-usbf_status usbf_open_pipe_ival(struct usbf_interface *, u_int8_t,
- struct usbf_pipe **, int);
-usbf_status usbf_setup_pipe(struct usbf_device *, struct usbf_interface *,
- struct usbf_endpoint *, int,
- struct usbf_pipe **);
-void usbf_start_next(struct usbf_pipe *);
-void usbf_set_endpoint_halt(struct usbf_endpoint *);
-void usbf_clear_endpoint_halt(struct usbf_endpoint *);
-
-static const char * const usbf_error_strs[] = USBF_ERROR_STRS;
-
-const char *
-usbf_errstr(usbf_status err)
-{
- static char buffer[5];
-
- if (err < USBF_ERROR_MAX)
- return usbf_error_strs[err];
-
- snprintf(buffer, sizeof buffer, "%d", err);
- return buffer;
-}
-
-void *
-usbf_realloc(void **pp, size_t *sizep, size_t newsize)
-{
- void *p;
- size_t oldsize;
-
- if (newsize == 0) {
- if (*sizep > 0)
- free(*pp, M_USB, 0);
- *pp = NULL;
- *sizep = 0;
- return NULL;
- }
-
- p = malloc(newsize, M_USB, M_NOWAIT);
- if (p == NULL)
- return NULL;
-
- oldsize = MIN(*sizep, newsize);
- if (oldsize > 0)
- bcopy(*pp, p, oldsize);
-#if 0
- /* XXX must leak for now; something unknown has a pointer */
- if (*pp != NULL)
- free(*pp, M_USB, 0);
-#endif
- *pp = p;
- *sizep = newsize;
- return p;
-}
-
-/*
- * Attach a function driver.
- */
-static usbf_status
-usbf_probe_and_attach(struct device *parent, struct usbf_device *dev, int port)
-{
- struct usbf_attach_arg uaa;
- struct device *dv;
-
- KASSERT(dev->function == NULL);
-
- bzero(&uaa, sizeof uaa);
- uaa.device = dev;
-
- /*
- * The softc structure of a USB function driver must begin with a
- * "struct usbf_function" member (instead of USBBASEDEV), which must
- * be initialized in the function driver's attach routine. Also, it
- * should use usbf_devinfo_setup() to set the device identification.
- */
- dv = config_found_sm(parent, &uaa, NULL, NULL);
- if (dv != NULL) {
- dev->function = (struct usbf_function *)dv;
- return USBF_NORMAL_COMPLETION;
- }
-
- /*
- * We failed to attach a function driver for this device, but the
- * device can still function as a generic USB device without any
- * interfaces.
- */
- return USBF_NORMAL_COMPLETION;
-}
-
-static void
-usbf_remove_device(struct usbf_device *dev, struct usbf_port *up)
-{
- KASSERT(dev != NULL && dev == up->device);
-
- if (dev->function != NULL)
- config_detach((struct device *)dev->function, DETACH_FORCE);
- if (dev->default_pipe != NULL)
- usbf_close_pipe(dev->default_pipe);
- up->device = NULL;
- free(dev, M_USB, 0);
-}
-
-usbf_status
-usbf_new_device(struct device *parent, struct usbf_bus *bus, int depth,
- int speed, int port, struct usbf_port *up)
-{
- struct usbf_device *dev;
- usb_device_descriptor_t *ud;
- usbf_status err;
-
-#ifdef DIAGNOSTIC
- KASSERT(up->device == NULL);
-#endif
-
- dev = malloc(sizeof(*dev), M_USB, M_NOWAIT | M_ZERO);
- if (dev == NULL)
- return USBF_NOMEM;
-
- dev->bus = bus;
- dev->string_id = USBF_STRING_ID_MIN;
- SIMPLEQ_INIT(&dev->configs);
-
- /* Initialize device status. */
- USETW(dev->status.wStatus, UDS_SELF_POWERED);
-
- /*
- * Initialize device descriptor. The function driver for this
- * device (attached below) must complete the device descriptor.
- */
- ud = &dev->ddesc;
- ud->bLength = USB_DEVICE_DESCRIPTOR_SIZE;
- ud->bDescriptorType = UDESC_DEVICE;
- ud->bMaxPacketSize = bus->ep0_maxp;
- if (bus->usbrev >= USBREV_2_0)
- USETW(ud->bcdUSB, 0x0200);
- else
- USETW(ud->bcdUSB, 0x0101);
-
- /* Set up the default endpoint handle and descriptor. */
- dev->def_ep.edesc = &dev->def_ep_desc;
- dev->def_ep_desc.bLength = USB_ENDPOINT_DESCRIPTOR_SIZE;
- dev->def_ep_desc.bDescriptorType = UDESC_ENDPOINT;
- dev->def_ep_desc.bEndpointAddress = USB_CONTROL_ENDPOINT;
- dev->def_ep_desc.bmAttributes = UE_CONTROL;
- USETW(dev->def_ep_desc.wMaxPacketSize, ud->bMaxPacketSize);
- dev->def_ep_desc.bInterval = 0;
-
- /* Establish the default pipe. */
- err = usbf_setup_pipe(dev, NULL, &dev->def_ep, 0,
- &dev->default_pipe);
- if (err) {
- free(dev, M_USB, 0);
- return err;
- }
-
- /* Preallocate xfers for default pipe. */
- dev->default_xfer = usbf_alloc_xfer(dev);
- dev->data_xfer = usbf_alloc_xfer(dev);
- if (dev->default_xfer == NULL || dev->data_xfer == NULL) {
- if (dev->default_xfer != NULL)
- usbf_free_xfer(dev->default_xfer);
- usbf_close_pipe(dev->default_pipe);
- free(dev, M_USB, 0);
- return USBF_NOMEM;
- }
-
- /* Insert device request xfer. */
- usbf_setup_default_xfer(dev->default_xfer, dev->default_pipe,
- NULL, &dev->def_req, 0, 0, usbf_do_request);
- err = usbf_transfer(dev->default_xfer);
- if (err && err != USBF_IN_PROGRESS) {
- usbf_free_xfer(dev->default_xfer);
- usbf_free_xfer(dev->data_xfer);
- usbf_close_pipe(dev->default_pipe);
- free(dev, M_USB, 0);
- return err;
- }
-
- /* Associate the upstream port with the device. */
- bzero(up, sizeof *up);
- up->portno = port;
- up->device = dev;
-
- /* Attach function driver. */
- err = usbf_probe_and_attach(parent, dev, port);
- if (err)
- usbf_remove_device(dev, up);
- return err;
-}
-
-/*
- * Should be called by the function driver in its attach routine to change
- * the default device identification according to the particular function.
- */
-void
-usbf_devinfo_setup(struct usbf_device *dev, u_int8_t devclass,
- u_int8_t subclass, u_int8_t proto, u_int16_t vendor, u_int16_t product,
- u_int16_t device, const char *manf, const char *prod, const char *ser)
-{
- usb_device_descriptor_t *dd;
-
- dd = usbf_device_descriptor(dev);
- dd->bDeviceClass = devclass;
- dd->bDeviceSubClass = subclass;
- dd->bDeviceProtocol = proto;
- if (vendor != 0)
- USETW(dd->idVendor, vendor);
- if (product != 0)
- USETW(dd->idProduct, product);
- if (device != 0)
- USETW(dd->bcdDevice, device);
- if (manf != NULL)
- dd->iManufacturer = usbf_add_string(dev, manf);
- if (prod != NULL)
- dd->iProduct = usbf_add_string(dev, prod);
- if (ser != NULL)
- dd->iSerialNumber = usbf_add_string(dev, ser);
-}
-
-char *
-usbf_devinfo_alloc(struct usbf_device *dev)
-{
- char manf[40];
- char prod[40];
- usb_device_descriptor_t *dd;
- size_t len;
- char *devinfo;
-
- dd = usbf_device_descriptor(dev);
- usbf_get_string(dev, dd->iManufacturer, manf, sizeof manf);
- usbf_get_string(dev, dd->iProduct, prod, sizeof prod);
-
- len = strlen(manf) + strlen(prod) + 32;
- devinfo = malloc(len, M_USB, M_NOWAIT);
- if (devinfo == NULL)
- return NULL;
-
- snprintf(devinfo, len, "%s %s, rev %d.%02d/%d.%02d", manf, prod,
- (UGETW(dd->bcdUSB)>>8) & 0xff, UGETW(dd->bcdUSB) & 0xff,
- (UGETW(dd->bcdDevice)>>8) & 0xff, UGETW(dd->bcdDevice) & 0xff);
- return devinfo;
-}
-
-void
-usbf_devinfo_free(char *devinfo)
-{
- if (devinfo != NULL)
- free(devinfo, M_USB, 0);
-}
-
-/*
- * Add a string descriptor to a logical device and return the string's id.
- *
- * If there is not enough memory available for the new string descriptor, or
- * if there is no unused string id left, return the id of the empty string
- * instead of failing.
- */
-u_int8_t
-usbf_add_string(struct usbf_device *dev, const char *string)
-{
- usb_string_descriptor_t *sd;
- size_t oldsize;
- size_t newsize;
- size_t len, i;
- u_int8_t id;
-
- if (string == NULL || *string == '\0' ||
- dev->string_id == USBF_STRING_ID_MAX)
- return USBF_EMPTY_STRING_ID;
-
- if ((len = strlen(string)) >= USB_MAX_STRING_LEN)
- len = USB_MAX_STRING_LEN - 1;
-
- oldsize = dev->sdesc_size;
- newsize = oldsize + 2 + 2 * len;
-
- sd = usbf_realloc((void **)&dev->sdesc, &dev->sdesc_size,
- newsize);
- if (sd == NULL)
- return USBF_EMPTY_STRING_ID;
-
- sd = (usb_string_descriptor_t *)((char *)sd + oldsize);
- sd->bLength = newsize - oldsize;
- sd->bDescriptorType = UDESC_STRING;
- for (i = 0; string[i] != '\0' && i < len; i++)
- USETW(sd->bString[i], string[i]);
-
- id = dev->string_id++;
- return id;
-}
-
-usb_string_descriptor_t *
-usbf_string_descriptor(struct usbf_device *dev, u_int8_t id)
-{
- static usb_string_descriptor_t sd0;
- static usb_string_descriptor_t sd1;
- usb_string_descriptor_t *sd;
-
- /* handle the special string ids */
- switch (id) {
- case USB_LANGUAGE_TABLE:
- sd0.bLength = 4;
- sd0.bDescriptorType = UDESC_STRING;
- USETW(sd0.bString[0], 0x0409 /* en_US */);
- return &sd0;
-
- case USBF_EMPTY_STRING_ID:
- sd1.bLength = 2;
- sd1.bDescriptorType = UDESC_STRING;
- return &sd0;
- }
-
- /* check if the string id is valid */
- if (id > dev->string_id)
- return NULL;
-
- /* seek and return the descriptor of a non-empty string */
- id -= USBF_STRING_ID_MIN;
- sd = dev->sdesc;
- while (id-- > 0)
- sd = (usb_string_descriptor_t *)((char *)sd + sd->bLength);
- return sd;
-}
-
-size_t
-usbf_get_string(struct usbf_device *dev, u_int8_t id, char *s, size_t size)
-{
- usb_string_descriptor_t *sd = NULL;
- size_t i, len;
-
- if (id != USB_LANGUAGE_TABLE)
- sd = usbf_string_descriptor(dev, id);
-
- if (sd == NULL) {
- if (size > 0)
- *s = '\0';
- return 0;
- }
-
- len = (sd->bLength - 2) / 2;
- if (size < 1)
- return len;
-
- for (i = 0; i < (size - 1) && i < len; i++)
- s[i] = UGETW(sd->bString[i]) & 0xff;
- s[i] = '\0';
- return len;
-}
-
-/*
- * Add a new device configuration to an existing USB logical device.
- * The new configuration initially has zero interfaces.
- */
-usbf_status
-usbf_add_config(struct usbf_device *dev, struct usbf_config **ucp)
-{
- struct usbf_config *uc;
- usb_config_descriptor_t *cd;
-
- uc = malloc(sizeof *uc, M_USB, M_NOWAIT | M_ZERO);
- if (uc == NULL)
- return USBF_NOMEM;
-
- cd = malloc(sizeof *cd, M_USB, M_NOWAIT | M_ZERO);
- if (cd == NULL) {
- free(uc, M_USB, 0);
- return USBF_NOMEM;
- }
-
- uc->uc_device = dev;
- uc->uc_cdesc = cd;
- uc->uc_cdesc_size = sizeof *cd;
- SIMPLEQ_INIT(&uc->iface_head);
-
- cd->bLength = USB_CONFIG_DESCRIPTOR_SIZE;
- cd->bDescriptorType = UDESC_CONFIG;
- USETW(cd->wTotalLength, USB_CONFIG_DESCRIPTOR_SIZE);
- cd->bConfigurationValue = USB_UNCONFIG_NO + 1 +
- dev->ddesc.bNumConfigurations;
- cd->iConfiguration = 0;
- cd->bmAttributes = UC_BUS_POWERED | UC_SELF_POWERED;
-#if 0
- cd->bMaxPower = 100 / UC_POWER_FACTOR; /* 100 mA */
-#else
- cd->bMaxPower = 0; /* XXX 0 mA */
-#endif
-
- SIMPLEQ_INSERT_TAIL(&dev->configs, uc, next);
- dev->ddesc.bNumConfigurations++;
-
- if (ucp != NULL)
- *ucp = uc;
- return USBF_NORMAL_COMPLETION;
-}
-
-/*
- * Allocate memory for a new descriptor at the end of the existing
- * device configuration descriptor.
- */
-usbf_status
-usbf_add_config_desc(struct usbf_config *uc, usb_descriptor_t *d,
- usb_descriptor_t **dp)
-{
- usb_config_descriptor_t *cd;
- size_t oldsize;
- size_t newsize;
-
- oldsize = uc->uc_cdesc_size;
- newsize = oldsize + d->bLength;
- if (d->bLength < sizeof(usb_descriptor_t) || newsize > 65535)
- return USBF_INVAL;
-
- cd = usbf_realloc((void **)&uc->uc_cdesc, &uc->uc_cdesc_size,
- newsize);
- if (cd == NULL)
- return USBF_NOMEM;
-
- bcopy(d, (char *)cd + oldsize, d->bLength);
- USETW(cd->wTotalLength, newsize);
- if (dp != NULL)
- *dp = (usb_descriptor_t *)((char *)cd + oldsize);
- return USBF_NORMAL_COMPLETION;
-}
-
-usbf_status
-usbf_add_interface(struct usbf_config *uc, u_int8_t bInterfaceClass,
- u_int8_t bInterfaceSubClass, u_int8_t bInterfaceProtocol,
- const char *string, struct usbf_interface **uip)
-{
- struct usbf_interface *ui;
- usb_interface_descriptor_t *id;
-
- if (uc->uc_closed)
- return USBF_INVAL;
-
- ui = malloc(sizeof *ui, M_USB, M_NOWAIT | M_ZERO);
- if (ui == NULL)
- return USBF_NOMEM;
-
- id = malloc(sizeof *id, M_USB, M_NOWAIT | M_ZERO);
- if (id == NULL) {
- free(ui, M_USB, 0);
- return USBF_NOMEM;
- }
-
- ui->config = uc;
- ui->idesc = id;
- LIST_INIT(&ui->pipes);
- SIMPLEQ_INIT(&ui->endpoint_head);
-
- id->bLength = USB_INTERFACE_DESCRIPTOR_SIZE;
- id->bDescriptorType = UDESC_INTERFACE;
- id->bInterfaceNumber = uc->uc_cdesc->bNumInterface;
- id->bInterfaceClass = bInterfaceClass;
- id->bInterfaceSubClass = bInterfaceSubClass;
- id->bInterfaceProtocol = bInterfaceProtocol;
- id->iInterface = 0; /*usbf_add_string(uc->uc_device, string);*/ /* XXX */
-
- SIMPLEQ_INSERT_TAIL(&uc->iface_head, ui, next);
- uc->uc_cdesc->bNumInterface++;
-
- *uip = ui;
- return USBF_NORMAL_COMPLETION;
-}
-
-usbf_status
-usbf_add_endpoint(struct usbf_interface *ui, u_int8_t bEndpointAddress,
- u_int8_t bmAttributes, u_int16_t wMaxPacketSize, u_int8_t bInterval,
- struct usbf_endpoint **uep)
-{
- struct usbf_endpoint *ue;
- usb_endpoint_descriptor_t *ed;
-
- if (ui->config->uc_closed)
- return USBF_INVAL;
-
- ue = malloc(sizeof *ue, M_USB, M_NOWAIT | M_ZERO);
- if (ue == NULL)
- return USBF_NOMEM;
-
- ed = malloc(sizeof *ed, M_USB, M_NOWAIT | M_ZERO);
- if (ed == NULL) {
- free(ue, M_USB, 0);
- return USBF_NOMEM;
- }
-
- ue->iface = ui;
- ue->edesc = ed;
-
- ed->bLength = USB_ENDPOINT_DESCRIPTOR_SIZE;
- ed->bDescriptorType = UDESC_ENDPOINT;
- ed->bEndpointAddress = bEndpointAddress;
- ed->bmAttributes = bmAttributes;
- USETW(ed->wMaxPacketSize, wMaxPacketSize);
- ed->bInterval = bInterval;
-
- SIMPLEQ_INSERT_TAIL(&ui->endpoint_head, ue, next);
- ui->idesc->bNumEndpoints++;
-
- *uep = ue;
- return USBF_NORMAL_COMPLETION;
-}
-
-/*
- * Close the configuration, thereby combining all descriptors and creating
- * the real USB configuration descriptor that can be sent to the USB host.
- */
-usbf_status
-usbf_end_config(struct usbf_config *uc)
-{
- struct usbf_interface *ui;
- struct usbf_endpoint *ue;
- usb_descriptor_t *d;
- usbf_status err = USBF_NORMAL_COMPLETION;
-
- if (uc->uc_closed)
- return USBF_INVAL;
-
- SIMPLEQ_FOREACH(ui, &uc->iface_head, next) {
- err = usbf_add_config_desc(uc,
- (usb_descriptor_t *)ui->idesc, &d);
- if (err)
- break;
-
- free(ui->idesc, M_USB, 0);
- ui->idesc = (usb_interface_descriptor_t *)d;
-
- SIMPLEQ_FOREACH(ue, &ui->endpoint_head, next) {
- err = usbf_add_config_desc(uc,
- (usb_descriptor_t *)ue->edesc, &d);
- if (err)
- break;
-
- free(ue->edesc, M_USB, 0);
- ue->edesc = (usb_endpoint_descriptor_t *)d;
- }
- }
-
- uc->uc_closed = 1;
- return err;
-}
-
-usb_device_descriptor_t *
-usbf_device_descriptor(struct usbf_device *dev)
-{
- return &dev->ddesc;
-}
-
-usb_config_descriptor_t *
-usbf_config_descriptor(struct usbf_device *dev, u_int8_t index)
-{
- struct usbf_config *uc;
-
- SIMPLEQ_FOREACH(uc, &dev->configs, next) {
- if (index-- == 0)
- return uc->uc_cdesc;
- }
- return NULL;
-}
-
-int
-usbf_interface_number(struct usbf_interface *iface)
-{
- return iface->idesc->bInterfaceNumber;
-}
-
-u_int8_t
-usbf_endpoint_address(struct usbf_endpoint *endpoint)
-{
- return endpoint->edesc->bEndpointAddress;
-}
-
-u_int8_t
-usbf_endpoint_attributes(struct usbf_endpoint *endpoint)
-{
- return endpoint->edesc->bmAttributes;
-}
-
-usbf_status
-usbf_open_pipe(struct usbf_interface *iface, u_int8_t address,
- struct usbf_pipe **pipe)
-{
- return usbf_open_pipe_ival(iface, address, pipe, 0);
-}
-
-usbf_status
-usbf_open_pipe_ival(struct usbf_interface *iface, u_int8_t address,
- struct usbf_pipe **pipe, int ival)
-{
- struct usbf_endpoint *ep;
- struct usbf_pipe *p;
- usbf_status err;
-
- ep = usbf_iface_endpoint(iface, address);
- if (ep == NULL)
- return USBF_BAD_ADDRESS;
-
- err = usbf_setup_pipe(iface->config->uc_device, iface, ep,
- ival, &p);
- if (err)
- return err;
- LIST_INSERT_HEAD(&iface->pipes, p, next);
- *pipe = p;
- return USBF_NORMAL_COMPLETION;
-}
-
-usbf_status
-usbf_setup_pipe(struct usbf_device *dev, struct usbf_interface *iface,
- struct usbf_endpoint *ep, int ival, struct usbf_pipe **pipe)
-{
- struct usbf_pipe *p;
- usbf_status err;
-
- p = malloc(dev->bus->pipe_size, M_USB, M_NOWAIT);
- if (p == NULL)
- return USBF_NOMEM;
-
- p->device = dev;
- p->iface = iface;
- p->endpoint = ep;
- ep->refcnt++;
- p->running = 0;
- p->refcnt = 1;
- p->repeat = 0;
- p->interval = ival;
- p->methods = NULL; /* set by bus driver in open_pipe() */
- SIMPLEQ_INIT(&p->queue);
- err = dev->bus->methods->open_pipe(p);
- if (err) {
- free(p, M_USB, 0);
- return err;
- }
- *pipe = p;
- return USBF_NORMAL_COMPLETION;
-}
-
-/* Dequeue all pipe operations. */
-void
-usbf_abort_pipe(struct usbf_pipe *pipe)
-{
- struct usbf_xfer *xfer;
- int s;
-
- s = splusb();
- pipe->repeat = 0;
- pipe->aborting = 1;
-
- while ((xfer = SIMPLEQ_FIRST(&pipe->queue)) != NULL) {
- DPRINTF(0,("usbf_abort_pipe: pipe=%p, xfer=%p\n", pipe,
- xfer));
- /* Make the DC abort it (and invoke the callback). */
- pipe->methods->abort(xfer);
- }
-
- pipe->aborting = 0;
- splx(s);
-}
-
-/* Abort all pipe operations and close the pipe. */
-void
-usbf_close_pipe(struct usbf_pipe *pipe)
-{
- usbf_abort_pipe(pipe);
- pipe->methods->close(pipe);
- pipe->endpoint->refcnt--;
- free(pipe, M_USB, 0);
-}
-
-void
-usbf_stall_pipe(struct usbf_pipe *pipe)
-{
- DPRINTF(0,("usbf_stall_pipe not implemented\n"));
-}
-
-struct usbf_endpoint *
-usbf_iface_endpoint(struct usbf_interface *iface, u_int8_t address)
-{
- struct usbf_endpoint *ep;
-
- SIMPLEQ_FOREACH(ep, &iface->endpoint_head, next) {
- if (ep->edesc->bEndpointAddress == address)
- return ep;
- }
- return NULL;
-}
-
-struct usbf_endpoint *
-usbf_config_endpoint(struct usbf_config *cfg, u_int8_t address)
-{
- struct usbf_interface *iface;
- struct usbf_endpoint *ep;
-
- SIMPLEQ_FOREACH(iface, &cfg->iface_head, next) {
- SIMPLEQ_FOREACH(ep, &iface->endpoint_head, next) {
- if (ep->edesc->bEndpointAddress == address)
- return ep;
- }
- }
- return NULL;
-}
-
-void
-usbf_set_endpoint_halt(struct usbf_endpoint *endpoint)
-{
-}
-
-void
-usbf_clear_endpoint_halt(struct usbf_endpoint *endpoint)
-{
-}
-
-usbf_status
-usbf_set_endpoint_feature(struct usbf_config *cfg, u_int8_t address,
- u_int16_t value)
-{
- struct usbf_endpoint *ep;
-
- DPRINTF(0,("usbf_set_endpoint_feature: cfg=%p address=%#x"
- " value=%#x\n", cfg, address, value));
-
- ep = usbf_config_endpoint(cfg, address);
- if (ep == NULL)
- return USBF_BAD_ADDRESS;
-
- switch (value) {
- case UF_ENDPOINT_HALT:
- usbf_set_endpoint_halt(ep);
- return USBF_NORMAL_COMPLETION;
- default:
- /* unsupported feature, send STALL in data/status phase */
- return USBF_STALLED;
- }
-}
-
-usbf_status
-usbf_clear_endpoint_feature(struct usbf_config *cfg, u_int8_t address,
- u_int16_t value)
-{
- struct usbf_endpoint *ep;
-
- DPRINTF(0,("usbf_clear_endpoint_feature: cfg=%p address=%#x"
- " value=%#x\n", cfg, address, value));
-
- ep = usbf_config_endpoint(cfg, address);
- if (ep == NULL)
- return USBF_BAD_ADDRESS;
-
- switch (value) {
- case UF_ENDPOINT_HALT:
- usbf_clear_endpoint_halt(ep);
- return USBF_NORMAL_COMPLETION;
- default:
- /* unsupported feature, send STALL in data/status phase */
- return USBF_STALLED;
- }
-}
-
-struct usbf_xfer *
-usbf_alloc_xfer(struct usbf_device *dev)
-{
- struct usbf_xfer *xfer;
-
- /* allocate zero-filled buffer */
- xfer = dev->bus->methods->allocx(dev->bus);
- if (xfer == NULL)
- return NULL;
- xfer->device = dev;
- timeout_set(&xfer->timeout_handle, NULL, NULL);
- DPRINTF(1,("usbf_alloc_xfer() = %p\n", xfer));
- return xfer;
-}
-
-void
-usbf_free_xfer(struct usbf_xfer *xfer)
-{
- DPRINTF(1,("usbf_free_xfer: %p\n", xfer));
- if (xfer->rqflags & (URQ_DEV_DMABUF | URQ_AUTO_DMABUF))
- usbf_free_buffer(xfer);
- xfer->device->bus->methods->freex(xfer->device->bus, xfer);
-}
-
-usbf_status
-usbf_allocmem(struct usbf_bus *bus, size_t size, size_t align, struct usb_dma *p)
-{
- struct usbd_bus dbus;
- usbd_status err;
-
- /* XXX bad idea, fix usb_mem.c instead! */
- dbus.dmatag = bus->dmatag;
- err = usb_allocmem(&dbus, size, align, p);
- return err ? USBF_NOMEM : USBF_NORMAL_COMPLETION;
-}
-
-void
-usbf_freemem(struct usbf_bus *bus, struct usb_dma *p)
-{
- usb_freemem((struct usbd_bus *)NULL, p);
-}
-
-void *
-usbf_alloc_buffer(struct usbf_xfer *xfer, u_int32_t size)
-{
- struct usbf_bus *bus = xfer->device->bus;
- usbf_status err;
-
-#ifdef DIAGNOSTIC
- if (xfer->rqflags & (URQ_DEV_DMABUF | URQ_AUTO_DMABUF))
- printf("xfer %p already has a buffer\n", xfer);
-#endif
-
- err = bus->methods->allocm(bus, &xfer->dmabuf, size);
- if (err)
- return NULL;
-
- xfer->rqflags |= URQ_DEV_DMABUF;
- return KERNADDR(&xfer->dmabuf, 0);
-}
-
-void
-usbf_free_buffer(struct usbf_xfer *xfer)
-{
-#ifdef DIAGNOSTIC
- if (!(xfer->rqflags & URQ_DEV_DMABUF)) {
- printf("usbf_free_buffer: no buffer\n");
- return;
- }
-#endif
- xfer->rqflags &= ~URQ_DEV_DMABUF;
- xfer->device->bus->methods->freem(xfer->device->bus, &xfer->dmabuf);
-}
-
-#ifdef USBF_DEBUG
-/*
- * The dump format is similar to Linux' Gadget driver so that we can
- * easily compare traces.
- */
-static void
-usbf_dump_buffer(struct usbf_xfer *xfer)
-{
- struct device *dev = (struct device *)xfer->pipe->device->bus->usbfctl;
- struct usbf_endpoint *ep = xfer->pipe->endpoint;
- int index = usbf_endpoint_index(ep);
- int dir = usbf_endpoint_dir(ep);
- u_char *p = xfer->buffer;
- u_int i;
-
- printf("%s: ep%d-%s, length=%u, %s", dev->dv_xname, index,
- (xfer->rqflags & URQ_REQUEST) ? "setup" :
- (index == 0 ? "in" : (dir == UE_DIR_IN ? "in" : "out")),
- xfer->length, usbf_errstr(xfer->status));
-
- for (i = 0; i < xfer->length; i++) {
- if ((i % 16) == 0)
- printf("\n%4x:", i);
- else if ((i % 8) == 0)
- printf(" ");
- printf(" %02x", p[i]);
- }
- printf("\n");
-}
-#endif
-
-void
-usbf_setup_xfer(struct usbf_xfer *xfer, struct usbf_pipe *pipe,
- void *priv, void *buffer, u_int32_t length,
- u_int16_t flags, u_int32_t timeout, usbf_callback callback)
-{
- xfer->pipe = pipe;
- xfer->priv = priv;
- xfer->buffer = buffer;
- xfer->length = length;
- xfer->actlen = 0;
- xfer->flags = flags;
- xfer->timeout = timeout;
- xfer->status = USBF_NOT_STARTED;
- xfer->callback = callback;
- xfer->rqflags &= ~URQ_REQUEST;
-}
-
-void
-usbf_setup_default_xfer(struct usbf_xfer *xfer, struct usbf_pipe *pipe,
- void *priv, usb_device_request_t *req, u_int16_t flags,
- u_int32_t timeout, usbf_callback callback)
-{
- xfer->pipe = pipe;
- xfer->priv = priv;
- xfer->buffer = req;
- xfer->length = sizeof *req;
- xfer->actlen = 0;
- xfer->flags = flags;
- xfer->timeout = timeout;
- xfer->status = USBF_NOT_STARTED;
- xfer->callback = callback;
- xfer->rqflags |= URQ_REQUEST;
-}
-
-void
-usbf_get_xfer_status(struct usbf_xfer *xfer, void **priv,
- void **buffer, u_int32_t *actlen, usbf_status *status)
-{
- if (priv != NULL)
- *priv = xfer->priv;
- if (buffer != NULL)
- *buffer = xfer->buffer;
- if (actlen != NULL)
- *actlen = xfer->actlen;
- if (status != NULL)
- *status = xfer->status;
-}
-
-usbf_status
-usbf_transfer(struct usbf_xfer *xfer)
-{
- struct usbf_pipe *pipe = xfer->pipe;
- usbf_status err;
-
- err = pipe->methods->transfer(xfer);
- if (err != USBF_IN_PROGRESS && err) {
- if (xfer->rqflags & URQ_AUTO_DMABUF) {
- usbf_free_buffer(xfer);
- xfer->rqflags &= ~URQ_AUTO_DMABUF;
- }
- }
- return err;
-}
-
-usbf_status
-usbf_insert_transfer(struct usbf_xfer *xfer)
-{
- struct usbf_pipe *pipe = xfer->pipe;
- usbf_status err;
- int s;
-
- DPRINTF(1,("usbf_insert_transfer: xfer=%p pipe=%p running=%d\n",
- xfer, pipe, pipe->running));
-
- s = splusb();
- SIMPLEQ_INSERT_TAIL(&pipe->queue, xfer, next);
- if (pipe->running)
- err = USBF_IN_PROGRESS;
- else {
- pipe->running = 1;
- err = USBF_NORMAL_COMPLETION;
- }
- splx(s);
- return err;
-}
-
-void
-usbf_start_next(struct usbf_pipe *pipe)
-{
- struct usbf_xfer *xfer;
- usbf_status err;
-
- SPLUSBCHECK;
-
- /* Get next request in queue. */
- xfer = SIMPLEQ_FIRST(&pipe->queue);
- if (xfer == NULL)
- pipe->running = 0;
- else {
- err = pipe->methods->start(xfer);
- if (err != USBF_IN_PROGRESS) {
- printf("usbf_start_next: %s\n", usbf_errstr(err));
- pipe->running = 0;
- /* XXX do what? */
- }
- }
-}
-
-/* Called at splusb() */
-void
-usbf_transfer_complete(struct usbf_xfer *xfer)
-{
- struct usbf_pipe *pipe = xfer->pipe;
- int repeat = pipe->repeat;
-
- SPLUSBCHECK;
- DPRINTF(1,("usbf_transfer_complete: xfer=%p pipe=%p running=%d\n",
- xfer, pipe, pipe->running));
-#ifdef USBF_DEBUG
- if (usbfdebug > 0)
- usbf_dump_buffer(xfer);
-#endif
-
- if (!repeat) {
- /* Remove request from queue. */
- KASSERT(SIMPLEQ_FIRST(&pipe->queue) == xfer);
- SIMPLEQ_REMOVE_HEAD(&pipe->queue, next);
- }
-
- if (xfer->status == USBF_NORMAL_COMPLETION &&
- xfer->actlen < xfer->length &&
- !(xfer->flags & USBD_SHORT_XFER_OK)) {
- DPRINTF(0,("usbf_transfer_complete: short xfer=%p %u<%u\n",
- xfer, xfer->actlen, xfer->length));
- xfer->status = USBF_SHORT_XFER;
- }
-
- if (xfer->callback != NULL)
- xfer->callback(xfer, xfer->priv, xfer->status);
-
- pipe->methods->done(xfer);
-
- if (xfer->flags & USBD_SYNCHRONOUS)
- wakeup(xfer);
-
- if (!repeat) {
- if (xfer->status != USBF_NORMAL_COMPLETION &&
- pipe->iface != NULL) /* not control pipe */
- pipe->running = 0;
- else
- usbf_start_next(pipe);
- }
-}
-
-/*
- * Software interrupts
- */
-
-usbf_status
-usbf_softintr_establish(struct usbf_bus *bus)
-{
- KASSERT(bus->soft == NULL);
-
- bus->soft = softintr_establish(IPL_SOFTUSB,
- bus->methods->soft_intr, bus);
- if (bus->soft == NULL)
- return USBF_INVAL;
-
- return USBF_NORMAL_COMPLETION;
-}
-
-void
-usbf_schedsoftintr(struct usbf_bus *bus)
-{
- softintr_schedule(bus->soft);
-}
diff --git a/sys/dev/usb/usbfvar.h b/sys/dev/usb/usbfvar.h
deleted file mode 100644
index 7fc72e3176e..00000000000
--- a/sys/dev/usb/usbfvar.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $OpenBSD: usbfvar.h,v 1.8 2013/04/15 09:23:02 mglocker Exp $ */
-
-/*
- * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * USB function driver interface
- *
- * This file is to be included only by the logical device driver and the
- * USB device controller (DC) driver.
- */
-
-/*** structures corresponding to USB protocol components ***/
-
-struct usbf_endpoint {
- struct usbf_interface *iface;
- usb_endpoint_descriptor_t *edesc;
- int halted; /* UF_ENDPOINT_HALT set */
- int refcnt;
- SIMPLEQ_ENTRY(usbf_endpoint) next;
-};
-
-struct usbf_interface {
- struct usbf_config *config;
- usb_interface_descriptor_t *idesc;
- LIST_HEAD(, usbf_pipe) pipes;
- SIMPLEQ_HEAD(, usbf_endpoint) endpoint_head;
- SIMPLEQ_ENTRY(usbf_interface) next;
-};
-
-struct usbf_config {
- struct usbf_device *uc_device;
- usb_config_descriptor_t *uc_cdesc;
- size_t uc_cdesc_size;
- int uc_closed;
- SIMPLEQ_HEAD(, usbf_interface) iface_head;
- SIMPLEQ_ENTRY(usbf_config) next;
-};
-
-struct usbf_device {
- struct device bdev; /* base device */
- struct usbf_bus *bus; /* device controller */
- struct usbf_function *function; /* function driver */
- struct usbf_pipe *default_pipe; /* pipe 0 (device control) */
- struct usbf_xfer *default_xfer; /* device request xfer */
- struct usbf_xfer *data_xfer; /* request response xfer */
- int address; /* assigned by host (or 0) */
- struct usbf_config *config; /* set by host (or NULL) */
- usb_status_t status; /* device status */
- usb_device_request_t def_req; /* device request buffer */
- struct usbf_endpoint def_ep; /* for pipe 0 */
- usb_endpoint_descriptor_t def_ep_desc; /* for pipe 0 */
- usb_device_descriptor_t ddesc; /* device descriptor */
- usb_string_descriptor_t *sdesc; /* string descriptors */
- size_t sdesc_size; /* size of ud_sdesc */
- uByte string_id; /* next string id */
- SIMPLEQ_HEAD(, usbf_config) configs;
-};
-
-/*** software control structures ***/
-
-struct usbf_pipe_methods {
- usbf_status (*transfer)(struct usbf_xfer *);
- usbf_status (*start)(struct usbf_xfer *);
- void (*abort)(struct usbf_xfer *);
- void (*done)(struct usbf_xfer *);
- void (*close)(struct usbf_pipe *);
-};
-
-struct usbf_bus_methods {
- usbf_status (*open_pipe)(struct usbf_pipe *);
- void (*soft_intr)(void *);
- usbf_status (*allocm)(struct usbf_bus *, struct usb_dma *,
- u_int32_t);
- void (*freem)(struct usbf_bus *, struct usb_dma *);
- struct usbf_xfer *(*allocx)(struct usbf_bus *);
- void (*freex)(struct usbf_bus *, struct usbf_xfer *);
-};
-
-struct usbf_softc;
-
-struct usbf_bus {
- /* Filled by DC driver */
- struct device bdev; /* base device */
- struct usbf_bus_methods *methods;
- size_t pipe_size; /* size of pipe struct */
- u_int8_t ep0_maxp; /* packet size for EP0 */
- int usbrev; /* as in struct usbd_bus */
- /* Filled by usbf driver */
- struct usbf_softc *usbfctl;
- int intr_context;
- void *soft; /* soft interrupt cookie */
- bus_dma_tag_t dmatag; /* DMA tag */
-};
-
-struct usbf_port {
- usb_port_status_t status;
- u_int8_t portno;
- struct usbf_device *device; /* connected function */
-};
-
-struct usbf_pipe {
- struct usbf_device *device;
- struct usbf_interface *iface; /* unless default pipe */
- struct usbf_endpoint *endpoint;
- int refcnt;
- int running;
- int aborting;
- SIMPLEQ_HEAD(, usbf_xfer) queue;
- LIST_ENTRY(usbf_pipe) next;
-
- char repeat;
- int interval;
-
- /* Filled by DC driver. */
- struct usbf_pipe_methods *methods;
-};
-
-struct usbf_xfer {
- struct usbf_pipe *pipe;
- void *priv;
- void *buffer;
- u_int32_t length;
- u_int32_t actlen;
- u_int16_t flags;
- u_int32_t timeout;
- usbf_status status;
- usbf_callback callback;
- SIMPLEQ_ENTRY(usbf_xfer) next;
-
- /* for memory management */
- struct usbf_device *device;
- int rqflags;
- struct usb_dma dmabuf;
-
- struct timeout timeout_handle;
-};
-
-
-/* usbf.c */
-void usbf_host_reset(struct usbf_bus *);
-void usbf_do_request(struct usbf_xfer *, void *, usbf_status);
-
-/* usbf_subr.c */
-usbf_status usbf_new_device(struct device *, struct usbf_bus *, int, int, int,
- struct usbf_port *);
-usbf_status usbf_set_endpoint_feature(struct usbf_config *, u_int8_t,
- u_int16_t);
-usbf_status usbf_clear_endpoint_feature(struct usbf_config *, u_int8_t,
- u_int16_t);
-usbf_status usbf_insert_transfer(struct usbf_xfer *xfer);
-void usbf_transfer_complete(struct usbf_xfer *xfer);
-usbf_status usbf_allocmem(struct usbf_bus *, size_t, size_t, struct usb_dma *);
-void usbf_freemem(struct usbf_bus *, struct usb_dma *);
-usbf_status usbf_softintr_establish(struct usbf_bus *);
-void usbf_schedsoftintr(struct usbf_bus *);
diff --git a/sys/kern/Makefile b/sys/kern/Makefile
index 66112e5ef1e..7b9ea74dead 100644
--- a/sys/kern/Makefile
+++ b/sys/kern/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.46 2016/09/01 09:21:08 tedu Exp $
+# $OpenBSD: Makefile,v 1.47 2016/09/03 13:37:45 guenther Exp $
# Makefile for kernel tags files, init_sysent, etc.
ARCH= alpha amd64 armv7 \
hppa i386 landisk loongson \
luna88k macppc octeon sgi socppc \
- sparc64 zaurus
+ sparc64
all:
@echo "Doing nothing. Did you want make syscalls?"