MFC: Bring AT91RM92 support.

This commit is contained in:
cognet 2006-06-23 23:35:36 +00:00
parent 77aebf88d8
commit ab5a937744
12 changed files with 60 additions and 32 deletions

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/module.h> #include <sys/module.h>
#include <sys/mutex.h> #include <sys/mutex.h>
#define __RMAN_RESOURCE_VISIBLE
#include <sys/rman.h> #include <sys/rman.h>
#include <machine/bus.h> #include <machine/bus.h>
@ -55,13 +56,15 @@ struct at91_pio_softc
static inline uint32_t static inline uint32_t
RD4(struct at91_pio_softc *sc, bus_size_t off) RD4(struct at91_pio_softc *sc, bus_size_t off)
{ {
return bus_read_4(sc->mem_res, off); return bus_space_read_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle,
off);
} }
static inline void static inline void
WR4(struct at91_pio_softc *sc, bus_size_t off, uint32_t val) WR4(struct at91_pio_softc *sc, bus_size_t off, uint32_t val)
{ {
bus_write_4(sc->mem_res, off, val); bus_space_write_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle, off,
val);
} }
#define AT91_PIO_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx) #define AT91_PIO_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx)

View File

@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h> #include <sys/time.h>
#include <sys/bus.h> #include <sys/bus.h>
#include <sys/resource.h> #include <sys/resource.h>
#define __RMAN_RESOURCE_VISIBLE
#include <sys/rman.h> #include <sys/rman.h>
#include <sys/timetc.h> #include <sys/timetc.h>
@ -145,13 +146,15 @@ static struct at91_pmc_clock *const clock_list[] = {
static inline uint32_t static inline uint32_t
RD4(struct at91_pmc_softc *sc, bus_size_t off) RD4(struct at91_pmc_softc *sc, bus_size_t off)
{ {
return bus_read_4(sc->mem_res, off); return bus_space_read_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle,
off);
} }
static inline void static inline void
WR4(struct at91_pmc_softc *sc, bus_size_t off, uint32_t val) WR4(struct at91_pmc_softc *sc, bus_size_t off, uint32_t val)
{ {
bus_write_4(sc->mem_res, off, val); bus_space_write_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle,
off, val);
} }
static void static void

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/module.h> #include <sys/module.h>
#include <sys/mutex.h> #include <sys/mutex.h>
#define __RMAN_RESOURCE_VISIBLE
#include <sys/rman.h> #include <sys/rman.h>
#include <machine/bus.h> #include <machine/bus.h>
@ -55,13 +56,15 @@ struct at91_rtc_softc
static inline uint32_t static inline uint32_t
RD4(struct at91_rtc_softc *sc, bus_size_t off) RD4(struct at91_rtc_softc *sc, bus_size_t off)
{ {
return bus_read_4(sc->mem_res, off); return bus_space_read_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle,
off);
} }
static inline void static inline void
WR4(struct at91_rtc_softc *sc, bus_size_t off, uint32_t val) WR4(struct at91_rtc_softc *sc, bus_size_t off, uint32_t val)
{ {
bus_write_4(sc->mem_res, off, val); bus_space_write_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle, off,
val);
} }
#define AT91_RTC_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx) #define AT91_RTC_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx)

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/module.h> #include <sys/module.h>
#include <sys/mutex.h> #include <sys/mutex.h>
#define __RMAN_RESOURCE_VISIBLE
#include <sys/rman.h> #include <sys/rman.h>
#include <machine/bus.h> #include <machine/bus.h>
@ -60,13 +61,15 @@ struct at91_spi_softc
static inline uint32_t static inline uint32_t
RD4(struct at91_spi_softc *sc, bus_size_t off) RD4(struct at91_spi_softc *sc, bus_size_t off)
{ {
return bus_read_4(sc->mem_res, off); return bus_space_read_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle,
off);
} }
static inline void static inline void
WR4(struct at91_spi_softc *sc, bus_size_t off, uint32_t val) WR4(struct at91_spi_softc *sc, bus_size_t off, uint32_t val)
{ {
bus_write_4(sc->mem_res, off, val); bus_space_write_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle, off,
val);
} }
#define AT91_SPI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define AT91_SPI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)

View File

@ -143,14 +143,14 @@ at91st_get_timecount(struct timecounter *tc)
static void static void
clock_intr(void *arg) clock_intr(void *arg)
{ {
struct trapframe *fp = arg; struct clockframe *fp = arg;
/* The interrupt is shared, so we have to make sure it's for us. */ /* The interrupt is shared, so we have to make sure it's for us. */
if (RD4(ST_SR) & ST_SR_PITS) { if (RD4(ST_SR) & ST_SR_PITS) {
#ifdef SKYEYE_WORKAROUNDS #ifdef SKYEYE_WORKAROUNDS
tot_count += 32768 / hz; tot_count += 32768 / hz;
#endif #endif
hardclock(TRAPF_USERMODE(fp), TRAPF_PC(fp)); hardclock(fp);
} }
} }

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/module.h> #include <sys/module.h>
#include <sys/mutex.h> #include <sys/mutex.h>
#define __RMAN_RESOURCE_VISIBLE
#include <sys/rman.h> #include <sys/rman.h>
#include <machine/bus.h> #include <machine/bus.h>
@ -64,13 +65,15 @@ struct at91_twi_softc
static inline uint32_t static inline uint32_t
RD4(struct at91_twi_softc *sc, bus_size_t off) RD4(struct at91_twi_softc *sc, bus_size_t off)
{ {
return bus_read_4(sc->mem_res, off); return bus_space_read_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle,
off);
} }
static inline void static inline void
WR4(struct at91_twi_softc *sc, bus_size_t off, uint32_t val) WR4(struct at91_twi_softc *sc, bus_size_t off, uint32_t val)
{ {
bus_write_4(sc->mem_res, off, val); bus_space_write_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle, off,
val);
} }
#define AT91_TWI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define AT91_TWI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)

View File

@ -22,7 +22,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/* $FreeBSD$ */ /* $$FreeBSD$ */
#ifndef AT91RM92REG_H_ #ifndef AT91RM92REG_H_
#define AT91RM92REG_H_ #define AT91RM92REG_H_

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mbuf.h> #include <sys/mbuf.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/module.h> #include <sys/module.h>
#define __RMAN_RESOURCE_VISIBLE
#include <sys/rman.h> #include <sys/rman.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/sockio.h> #include <sys/sockio.h>
@ -103,13 +104,15 @@ struct ate_softc
static inline uint32_t static inline uint32_t
RD4(struct ate_softc *sc, bus_size_t off) RD4(struct ate_softc *sc, bus_size_t off)
{ {
return bus_read_4(sc->mem_res, off); return bus_space_read_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle,
off);
} }
static inline void static inline void
WR4(struct ate_softc *sc, bus_size_t off, uint32_t val) WR4(struct ate_softc *sc, bus_size_t off, uint32_t val)
{ {
bus_write_4(sc->mem_res, off, val); bus_space_write_4(sc->mem_res->r_bustag, sc->mem_res->r_bushandle, off,
val);
} }
#define ATE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define ATE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)

View File

@ -47,7 +47,7 @@
#include "opt_ddb.h" #include "opt_ddb.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$$FreeBSD$");
#define _ARM32_BUS_DMA_PRIVATE #define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h> #include <sys/param.h>

View File

@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$");
#include "uart_if.h" #include "uart_if.h"
#define uart_lock(x) mtx_lock_spin(&(x))
#define uart_unlock(x) mtx_unlock_spin(&(x))
/* /*
* High-level UART interface. * High-level UART interface.
*/ */
@ -80,7 +82,7 @@ static void at91_usart_init(struct uart_bas *bas, int, int, int, int);
static void at91_usart_term(struct uart_bas *bas); static void at91_usart_term(struct uart_bas *bas);
static void at91_usart_putc(struct uart_bas *bas, int); static void at91_usart_putc(struct uart_bas *bas, int);
static int at91_usart_poll(struct uart_bas *bas); static int at91_usart_poll(struct uart_bas *bas);
static int at91_usart_getc(struct uart_bas *bas, struct mtx *mtx); static int at91_usart_getc(struct uart_bas *bas);
extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
@ -248,7 +250,7 @@ at91_usart_poll(struct uart_bas *bas)
* Block waiting for a character. * Block waiting for a character.
*/ */
static int static int
at91_usart_getc(struct uart_bas *bas, struct mtx *mtx) at91_usart_getc(struct uart_bas *bas)
{ {
int c; int c;
@ -407,7 +409,7 @@ at91_usart_bus_receive(struct uart_softc *sc)
{ {
uart_lock(sc->sc_hwmtx); uart_lock(sc->sc_hwmtx);
uart_rx_put(sc, at91_usart_getc(&sc->sc_bas, NULL)); uart_rx_put(sc, at91_usart_getc(&sc->sc_bas));
uart_unlock(sc->sc_hwmtx); uart_unlock(sc->sc_hwmtx);
return (0); return (0);
} }
@ -433,15 +435,15 @@ at91_usart_bus_ipend(struct uart_softc *sc)
} }
uart_lock(sc->sc_hwmtx); uart_lock(sc->sc_hwmtx);
if (csr & USART_CSR_TXRDY && sc->sc_txbusy) if (csr & USART_CSR_TXRDY && sc->sc_txbusy)
ipend |= SER_INT_TXIDLE; ipend |= UART_IPEND_TXIDLE;
if (csr & USART_CSR_ENDTX && sc->sc_txbusy) if (csr & USART_CSR_ENDTX && sc->sc_txbusy)
ipend |= SER_INT_TXIDLE; ipend |= UART_IPEND_TXIDLE;
if (csr & (USART_CSR_RXRDY /* | USART_CSR_ENDRX | USART_CSR_TIMEOUT */)) if (csr & (USART_CSR_RXRDY /* | USART_CSR_ENDRX | USART_CSR_TIMEOUT */))
ipend |= SER_INT_RXREADY; ipend |= UART_IPEND_RXREADY;
if (csr & USART_CSR_RXBRK) { if (csr & USART_CSR_RXBRK) {
unsigned int cr = USART_CR_RSTSTA; unsigned int cr = USART_CR_RSTSTA;
ipend |= SER_INT_BREAK; ipend |= UART_IPEND_BREAK;
WR4(&sc->sc_bas, USART_CR, cr); WR4(&sc->sc_bas, USART_CR, cr);
} }
uart_unlock(sc->sc_hwmtx); uart_unlock(sc->sc_hwmtx);
@ -470,7 +472,7 @@ at91_usart_bus_getsig(struct uart_softc *sc)
sig |= SER_DSR; sig |= SER_DSR;
if (csr & USART_CSR_RI) if (csr & USART_CSR_RI)
sig |= SER_RI; sig |= SER_RI;
new = sig & ~SER_MASK_DELTA; new = sig & ~UART_SIGMASK_DELTA;
sc->sc_hwsig = new; sc->sc_hwsig = new;
uart_unlock(sc->sc_hwmtx); uart_unlock(sc->sc_hwmtx);
return (sig); return (sig);

View File

@ -25,11 +25,12 @@ options KERNPHYSADDR=0x20000000
options KERNVIRTADDR=0xc0000000 options KERNVIRTADDR=0xc0000000
options PHYSADDR=0x20000000 options PHYSADDR=0x20000000
options STARTUP_PAGETABLE_ADDR=0x20800000 options STARTUP_PAGETABLE_ADDR=0x20800000
options ARM32_NEW_VM_LAYOUT
include "../at91/std.kb920x" include "../at91/std.kb920x"
#To statically compile in device wiring instead of /boot/device.hints #To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" #Default places to look for devices. #hints "GENERIC.hints" #Default places to look for devices.
makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
makeoptions CONF_CFLAGS=-mcpu=arm9 makeoptions CONF_CFLAGS=-mcpu=arm9
options DDB options DDB
options KDB options KDB
@ -41,12 +42,12 @@ options FFS #Berkeley Fast Filesystem
#options SOFTUPDATES #Enable FFS soft updates support #options SOFTUPDATES #Enable FFS soft updates support
#options UFS_ACL #Support for access control lists #options UFS_ACL #Support for access control lists
#options UFS_DIRHASH #Improve performance on big directories #options UFS_DIRHASH #Improve performance on big directories
options MD_ROOT #MD is a potential root device #options MD_ROOT #MD is a potential root device
options MD_ROOT_SIZE=4096 # 3MB ram disk #options MD_ROOT_SIZE=4096 # 3MB ram disk
options ROOTDEVNAME=\"ufs:md0\" #options ROOTDEVNAME=\"ufs:md0\"
#options NFSCLIENT #Network Filesystem Client options NFSCLIENT #Network Filesystem Client
#options NFSSERVER #Network Filesystem Server #options NFSSERVER #Network Filesystem Server
#options NFS_ROOT #NFS usable as /, requires NFSCLIENT options NFS_ROOT #NFS usable as /, requires NFSCLIENT
#options MSDOSFS #MSDOS Filesystem #options MSDOSFS #MSDOS Filesystem
#options CD9660 #ISO 9660 Filesystem #options CD9660 #ISO 9660 Filesystem
#options PROCFS #Process filesystem (requires PSEUDOFS) #options PROCFS #Process filesystem (requires PSEUDOFS)
@ -64,12 +65,16 @@ options NO_FFS_SNAPSHOT
options NO_SWAPPING options NO_SWAPPING
device genclock device genclock
device loop device loop
options BOOTP
options BOOTP_WIRED_TO=ate0
options BOOTP_NFSROOT
options BOOTP_NFSV3
options BOOTP_COMPAT
device ether device ether
device nexus device nexus
device uart device uart
device ate device ate
device mii device miibus
device lxtphy
# Debugging for use in -current # Debugging for use in -current
#options INVARIANTS #Enable calls of extra sanity checking #options INVARIANTS #Enable calls of extra sanity checking
@ -81,3 +86,4 @@ device mem # Memory and kernel memory devices
device md device md
# device at91_twi # TWI: Two Wire Interface # device at91_twi # TWI: Two Wire Interface
device at91_spi # SPI: device at91_spi # SPI:
options COMPAT_43

View File

@ -24,6 +24,7 @@ ident KB920X
options KERNPHYSADDR=0xc0000000 options KERNPHYSADDR=0xc0000000
options KERNVIRTADDR=0xc0000000 options KERNVIRTADDR=0xc0000000
options PHYSADDR=0xc0000000 options PHYSADDR=0xc0000000
options ARM32_NEW_VM_LAYOUT
include "../at91/std.kb920x" include "../at91/std.kb920x"
#To statically compile in device wiring instead of /boot/device.hints #To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" #Default places to look for devices. #hints "GENERIC.hints" #Default places to look for devices.
@ -86,3 +87,4 @@ options SKYEYE_WORKAROUNDS
# Floppy drives # Floppy drives
options COMPAT_43