Return to spi.c CVS log | Up to [local] / sys / dev |
File: [local] / sys / dev / spi.c (download)
Revision 1.1.1.1 (vendor branch), Tue Mar 4 16:09:35 2008 UTC (16 years, 4 months ago) by nbrk
Import of OpenBSD 4.2 release kernel tree with initial code to support Jornada 720/728, StrongARM 1110-based handheld PC. At this point kernel roots on NFS and boots into vfs_mountroot() and traps. What is supported: - glass console, Jornada framebuffer (jfb) works in 16bpp direct color mode (needs some palette tweaks for non black/white/blue colors, i think) - saic, SA11x0 interrupt controller (needs cleanup) - sacom, SA11x0 UART (supported only as boot console for now) - SA11x0 GPIO controller fully supported (but can't handle multiple interrupt handlers on one gpio pin) - sassp, SSP port on SA11x0 that attaches spibus - Jornada microcontroller (jmcu) to control kbd, battery, etc throught the SPI bus (wskbd attaches on jmcu, but not tested) - tod functions seem work - initial code for SA-1111 (chip companion) : this is TODO Next important steps, i think: - gpio and intc on sa1111 - pcmcia support for sa11x0 (and sa1111 help logic) - REAL root on nfs when we have PCMCIA support (we may use any of supported pccard NICs) - root on wd0! (using already supported PCMCIA-ATA) |
/* $Id: spi.c,v 1.1.1.1 2008/03/04 16:09:35 nbrk Exp $ */ /* * SPI bus. */ #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/proc.h> #include <sys/queue.h> #include <sys/rwlock.h> #include <dev/spivar.h> struct spi_softc { struct device sc_dev; struct spi_bus *sc_bus; }; int spi_match(struct device *parent, void *cf, void *aux); void spi_attach(struct device *parent, struct device *self, void *aux); struct cfattach spibus_ca = { sizeof(struct spi_softc), spi_match, spi_attach, NULL, NULL }; struct cfdriver spibus_cd = { NULL, "spibus", DV_DULL }; int spi_match(struct device *parent, void *cf, void *aux) { return(1); } void spi_attach(struct device *parent, struct device *self, void *aux) { struct spi_softc *sc = (struct spi_softc *)self; struct spibus_attach_args *sba = aux; sc->sc_bus = sba->sba_bus; sba->sba_spisc = sc; printf("\n"); /* attach slave */ config_found(&sc->sc_dev, sba, spibus_print); } int spibus_print(void *aux, const char *pnp) { return(QUIET); } int spi_shift_1(void *arg, uint8_t data) { struct spi_softc *sc = arg; struct spi_bus *sb = sc->sc_bus; /* * TODO: locking. */ return(sb->bus_shift_1(sb->bus_cookie, data)); } int spi_acquire(void *arg) { struct spi_softc *sc = arg; struct spi_bus *sb = sc->sc_bus; return(sb->bus_acquire(sb->bus_cookie)); } void spi_release(void *arg) { struct spi_softc *sc = arg; struct spi_bus *sb = sc->sc_bus; return(sb->bus_release(sb->bus_cookie)); }