2007-09-06 Daniel Hellstrom <daniel@gaisler.com>

New drivers: PCI, b1553BRM, SpaceWire(GRSPW), CAN (GRCAN,OC_CAN),
	Raw UART.
	* shared/1553/b1553brm.c, shared/1553/b1553brm_pci.c,
	shared/1553/b1553brm_rasta.c, shared/can/grcan.c,
	shared/can/grcan_rasta.c, shared/can/occan.c, shared/can/occan_pci.c,
	shared/spw/grspw.c, shared/spw/grspw_pci.c, shared/spw/grspw_rasta.c,
	shared/uart/apbuart.c, shared/uart/apbuart_pci.c,
	shared/uart/apbuart_rasta.c: New files missed in previous commit.
This commit is contained in:
Joel Sherrill
2007-09-06 13:27:25 +00:00
parent e16e0caf72
commit 226455f9ff
14 changed files with 8310 additions and 0 deletions
+11
View File
@@ -1,3 +1,14 @@
2007-09-06 Daniel Hellstrom <daniel@gaisler.com>
New drivers: PCI, b1553BRM, SpaceWire(GRSPW), CAN (GRCAN,OC_CAN),
Raw UART.
* shared/1553/b1553brm.c, shared/1553/b1553brm_pci.c,
shared/1553/b1553brm_rasta.c, shared/can/grcan.c,
shared/can/grcan_rasta.c, shared/can/occan.c, shared/can/occan_pci.c,
shared/spw/grspw.c, shared/spw/grspw_pci.c, shared/spw/grspw_rasta.c,
shared/uart/apbuart.c, shared/uart/apbuart_pci.c,
shared/uart/apbuart_rasta.c: New files missed in previous commit.
2007-09-06 Daniel Hellstrom <daniel@gaisler.com>
* Makefile.am: Add the following new drivers: PCI, b1553BRM,
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,132 @@
/* Select PCI driver */
#define B1553BRM_NO_AMBA
#define B1553BRM_PCI
#undef B1553BRM_MAXDEVS
/* Use only 16K memory */
#define DMA_MEM_16K
/* Malloced memory or
* Card local memory
*/
#define B1553BRM_LOCAL_MEM
#define DONT_DEF_RAMON
/* memory must be aligned to a 128k boundary */
unsigned int brmpci_memarea_address;
#define B1553BRM_LOCAL_MEM_ADR brmpci_memarea_address
/* We have custom address tranlation for HW addresses */
#define B1553BRM_ADR_TO
/* No custom MEMAREA=>CPU used since BRM Core work with offsets
* in it's descriptors.
*/
#undef B1553BRM_ADR_FROM
/* Set registered device name */
#define B1553BRM_DEVNAME "/dev/brmpci0"
#define B1553BRM_DEVNAME_NO(devstr,no) ((devstr)[11]='0'+(no))
/* Any non-static function will begin with */
#define B1553BRM_PREFIX(name) b1553brmpci##name
/* do nothing, assume that the interrupt handler is called
* setup externally calling b1553_interrupt_handler.
*/
#define B1553BRM_REG_INT(handler,irq,arg) \
if ( b1553brm_pci_int_reg ) \
b1553brm_pci_int_reg(handler,irq,arg);
#ifdef B1553BRM_ADR_TO
/* Translate a address within the Memory Region (memarea) into an Hardware
* device address. This address is put into hardware registers or descriptors
* so that the hardware can access the Memory Region.
* Example:
* An local AMBA access at 0xe0000000 will translate into PCI address 0x40000000,
* the PCI address 0x40000000 will translate into CPU-AMBA address 0x40000000.
*/
unsigned int brmpci_hw_address;
static inline unsigned int memarea_to_hw(unsigned int addr) {
/* don't translate? */
if ( brmpci_hw_address == 0xffffffff )
return addr;
return ((addr & 0x000fffff) | brmpci_hw_address);
}
#endif
/* not used since BRM Core work with offsets */
#ifdef B1553BRM_ADR_FROM
unsigned int brmpci_cpu_access_address;
static inline unsigned int hw_to_cpu(unsigned int addr) {
/* don't translate? */
if ( brmpci_cpu_address == 0xffffffff )
return addr;
return ((addr & 0x0fffffff) | brmpci_cpu_address);
}
#endif
void (*b1553brm_pci_int_reg)(void *handler, int irq, void *arg) = 0;
static void b1553brmpci_interrupt_handler(int irq, void *arg);
#include "b1553brm.c"
/*
*
* memarea = preallocated memory somewhere, pointer to start of memory.
* hw_address = how to translate a memarea address into an HW device AMBA address.
*/
int b1553brm_pci_register(
amba_confarea_type *bus,
unsigned int clksel,
unsigned int clkdiv,
unsigned int brm_freq,
unsigned int memarea,
unsigned int hw_address
)
{
/* Setup configuration */
/* if zero malloc will be used */
brmpci_memarea_address = memarea;
brmpci_hw_address = hw_address;
#ifdef B1553BRM_ADR_FROM
brmpci_cpu_address = memarea & 0xf0000000;
#endif
/* Register the driver */
return B1553BRM_PREFIX(_register)(bus,clksel,clkdiv,brm_freq);
}
/* Call this from PCI interrupt handler
* irq = the irq number of the HW device local to that IRQMP controller
*
*/
static void b1553brmpci_interrupt_handler(int irq, void *arg){
brm_interrupt(arg);
}
#if 0
int b1553brm_pci_interrupt_handler(int irqmask){
int i;
unsigned int mask=0;
/* find minor */
for(i=0; i<brm_cores; i++){
if ( (1<<brms[i].irqno) & irqmask ){
mask |= 1<<brms[i].irqno;
brm_interrupt(&brms[i]);
/* more interrupts to scan for? */
if ( irqmask & ~mask )
return mask; /* handled */
}
}
return mask;
}
#endif
@@ -0,0 +1,115 @@
/* Select PCI driver */
#define B1553BRM_NO_AMBA
#define B1553BRM_PCI
#undef B1553BRM_MAXDEVS
/* Use only 16K memory */
#define DMA_MEM_128K
/* Malloced memory or
* Card local memory
*/
#define B1553BRM_LOCAL_MEM
#define DONT_DEF_RAMON
/* memory must be aligned to a 128k boundary */
unsigned int brmrasta_memarea_address;
#define B1553BRM_LOCAL_MEM_ADR brmrasta_memarea_address
/* We have custom address tranlation for HW addresses */
#define B1553BRM_ADR_TO
/* No custom MEMAREA=>CPU used since BRM Core work with offsets
* in it's descriptors.
*/
#undef B1553BRM_ADR_FROM
/* Set registered device name */
#define B1553BRM_DEVNAME "/dev/brmrasta0"
#define B1553BRM_DEVNAME_NO(devstr,no) ((devstr)[13]='0'+(no))
/* Any non-static function will begin with */
#define B1553BRM_PREFIX(name) b1553brmrasta##name
/* do nothing, assume that the interrupt handler is called
* setup externally calling b1553_interrupt_handler.
*/
#define B1553BRM_REG_INT(handler,irq,arg) \
if ( b1553brm_rasta_int_reg ) \
b1553brm_rasta_int_reg(handler,irq,arg);
#ifdef B1553BRM_ADR_TO
/* Translate a address within the Memory Region (memarea) into an Hardware
* device address. This address is put into hardware registers or descriptors
* so that the hardware can access the Memory Region.
* Example:
* An local AMBA access at 0xe0000000 will translate into PCI address 0x40000000,
* the PCI address 0x40000000 will translate into CPU-AMBA address 0x40000000.
*/
unsigned int brmrasta_hw_address;
static inline unsigned int memarea_to_hw(unsigned int addr) {
/* don't translate? */
if ( brmrasta_hw_address == 0xffffffff )
return addr;
return ((addr & 0x0fffffff) | brmrasta_hw_address);
}
#endif
/* not used since BRM Core work with offsets */
#ifdef B1553BRM_ADR_FROM
unsigned int brmrasta_cpu_access_address;
static inline unsigned int hw_to_cpu(unsigned int addr) {
/* don't translate? */
if ( brmrasta_cpu_address == 0xffffffff )
return addr;
return ((addr & 0x0fffffff) | brmrasta_cpu_address);
}
#endif
void (*b1553brm_rasta_int_reg)(void *handler, int irq, void *arg) = 0;
static void b1553brmrasta_interrupt_handler(int irq, void *arg);
#include "b1553brm.c"
/*
*
* memarea = preallocated memory somewhere, pointer to start of memory.
* hw_address = how to translate a memarea address into an HW device AMBA address.
*/
int b1553brm_rasta_register(
amba_confarea_type *bus,
unsigned int clksel,
unsigned int clkdiv,
unsigned int brm_freq,
unsigned int memarea,
unsigned int hw_address
)
{
/* Setup configuration */
/* if zero the malloc will be used */
brmrasta_memarea_address = memarea;
brmrasta_hw_address = hw_address;
#ifdef B1553BRM_ADR_FROM
brmrasta_cpu_address = memarea & 0xf0000000;
#endif
/* Register the driver */
return B1553BRM_PREFIX(_register)(bus,clksel,clkdiv,brm_freq);
}
/* Call this from RASTA interrupt handler
* irq = the irq number of the HW device local to that IRQMP controller
*
*/
static void b1553brmrasta_interrupt_handler(int irq, void *arg){
brm_interrupt(arg);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,99 @@
#include <rasta.h>
/* PCI frequency */
#define SYS_FREQ_HZ 33000000
/*#define USE_AT697_RAM 1 */
/* memarea_to_hw(x)
*
* x: address in AT697 address space
*
* returns the address in the RASTA address space that can be used to access x with dma.
*
*/
#ifdef USE_AT697_RAM
static inline unsigned int memarea_to_hw(unsigned int addr) {
return ((addr & 0x0fffffff) | RASTA_PCI_BASE);
}
#else
static inline unsigned int memarea_to_hw(unsigned int addr) {
return ((addr & 0x0fffffff) | RASTA_LOCAL_SRAM);
}
#endif
#define MEMAREA_TO_HW(x) memarea_to_hw(x)
#define IRQ_CLEAR_PENDING(irqno)
#define IRQ_UNMASK(irqno)
#define IRQ_MASK(irqno)
#define IRQ_GLOBAL_DISABLE() sparc_disable_interrupts()
#define IRQ_GLOBAL_ENABLE() sparc_enable_interrupts()
#define GRCAN_REG_INT(handler,irqno,arg) \
if ( grcan_rasta_int_reg ) \
grcan_rasta_int_reg(handler,irqno,arg);
void (*grcan_rasta_int_reg)(void *handler, int irq, void *arg) = 0;
#define GRCAN_PREFIX(name) grcan_rasta##name
/* We provide our own handler */
#define GRCAN_DONT_DECLARE_IRQ_HANDLER
#define GRCAN_REG_BYPASS_CACHE
#define GRCAN_DMA_BYPASS_CACHE
#define GRCAN_MAX_CORES 1
/* Custom Statically allocated memory */
#undef STATICALLY_ALLOCATED_TX_BUFFER
#undef STATICALLY_ALLOCATED_RX_BUFFER
#define STATIC_TX_BUF_SIZE 4096
#define STATIC_RX_BUF_SIZE 4096
#define TX_BUF_SIZE 4096
#define RX_BUF_SIZE 4096
#define STATIC_TX_BUF_ADDR(core) \
(grcan_rasta_rambase+(core)*(STATIC_TX_BUF_SIZE+STATIC_RX_BUF_SIZE))
#define STATIC_RX_BUF_ADDR(core) \
(grcan_rasta_rambase+(core)*(STATIC_TX_BUF_SIZE+STATIC_RX_BUF_SIZE)+STATIC_RX_BUF_SIZE)
#define GRCAN_DEVNAME "/dev/grcan0"
#define GRCAN_DEVNAME_NO(devstr,no) ((devstr)[10]='0'+(no))
static int grcan_rasta_calc_memoffs(int maxcores, int corenum, unsigned int *mem_base, unsigned int *mem_end, unsigned int *bdtable_base);
void grcan_rasta_interrupt_handler(int irq, void *pDev);
unsigned int grcan_rasta_rambase;
#include "grcan.c"
int grcan_rasta_ram_register(amba_confarea_type *abus, int rambase)
{
grcan_rasta_rambase = rambase;
return GRCAN_PREFIX(_register)(abus);
}
#if 0
static void grcan_rasta_interrupt_handler(int v)
{
/* We know there is always only one GRCAN core in a RASTA chip... */
grcan_interrupt(&grcans[0]);
/*
struct grcan_priv *pDev = arg;
grcan_interrupt(pDev);
*/
}
#endif
void GRCAN_PREFIX(_interrupt_handler)(int irq, void *pDev)
{
grcan_interrupt(pDev);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,64 @@
/* PCI cannot do byte accesses to addresses aligned byte wise
* Use alternative reg map.
*/
#define OCCAN_WORD_REGS
/* Set registered device name */
#define OCCAN_DEVNAME "/dev/occanpci0"
#define OCCAN_DEVNAME_NO(devstr,no) ((devstr)[13]='0'+(no))
/* Any non-static function will begin with */
#define OCCAN_PREFIX(name) occanpci##name
/* do nothing, assume that the interrupt handler is called
* setup externally calling b1553_interrupt_handler.
*/
#define OCCAN_REG_INT(handler,irq,arg) \
if ( occan_pci_int_reg ) \
occan_pci_int_reg(handler,irq,arg);
void (*occan_pci_int_reg)(void *handler, int irq, void *arg) = 0;
void occanpci_interrupt_handler(int irq, void *arg);
/* AMBA Bus is clocked using the PCI clock (33.3MHz) */
#define SYS_FREQ_HZ 33333333
/* Enable two redundant channels */
#define REDUNDANT_CHANNELS 2
#define OCCAN_SET_CHANNEL(priv,channel) occanpci_set_channel(priv,channel)
#include "occan.c"
/* Define method that sets redundant channel
* The channel select register:
* 0x00 = byte regs
* 0x40 = channel select
* 0x80 = word regs
*/
static void inline occanpci_set_channel(occan_priv *priv, int channel){
unsigned int *chan_sel = (unsigned int *)(((unsigned int)priv->regs & ~0xff)+0x40);
if ( channel == 0 )
*chan_sel = 0;
else
*chan_sel = 0xffffffff;
}
int occan_pci_register(amba_confarea_type *bus)
{
/* Setup configuration */
/* Register the driver */
return OCCAN_PREFIX(_register)(bus);
}
/* Call this from PCI interrupt handler
* irq = the irq number of the HW device local to that IRQMP controller
*
*/
void occanpci_interrupt_handler(int irq, void *arg){
occan_interrupt(arg);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,126 @@
/* Select PCI driver */
#define GRSPW_PCI
#undef GRSPW_MAXDEVS
#undef DEBUG_SPACEWIRE_ONOFF
/* Only Malloced memory supported
*/
#undef GRSPW_LOCAL_MEM
/* memory must be aligned to a 128k boundary */
unsigned int grspwpci_memarea_address;
#define GRSPW_LOCAL_MEM_ADR grspwpci_memarea_address
/* We have custom address tranlation for HW addresses */
#define GRSPW_ADR_TO
/* MEMAREA=>CPU used when reading descriptor buffer pointers,
* they need to be translated from adresses used by GRSPW HW
* into CPU readable addresses.
*
* NOT NEEDED AS GRSPW DRIVER USES INDEXES TO GET DESCRIPTOR
* DATA POINTER ADDRESSES.
*/
#undef GRSPW_ADR_FROM
/* Set registered device name */
#define GRSPW_DEVNAME "/dev/grspwpci0"
#define GRSPW_DEVNAME_NO(devstr,no) ((devstr)[13]='0'+(no))
/* Any non-static function will begin with */
#define GRSPW_PREFIX(name) grspwpci##name
/* do nothing, assume that the interrupt handler is called
* setup externally calling b1553_interrupt_handler.
*/
#define GRSPW_REG_INT(handler,irq,arg) \
if ( grspw_pci_int_reg ) \
grspw_pci_int_reg(handler,irq,arg);
void (*grspw_pci_int_reg)(void *handler, int irq, void *arg) = 0;
#ifdef GRSPW_ADR_TO
/* Translate an address within the Memory Region (memarea) into an Hardware
* device address. This address is put into hardware registers or descriptors
* so that the hardware can access the Memory Region.
* Example:
* A local AMBA access at 0xe0000000 will translate into PCI address 0x40000000,
* the PCI address 0x40000000 will translate into LEON-AMBA address 0x40000000.
*/
unsigned int grspwpci_hw_address;
static inline unsigned int memarea_to_hw(unsigned int addr) {
/* don't translate? */
if ( grspwpci_hw_address == 0xffffffff )
return addr;
return ((addr & 0x0fffffff) | grspwpci_hw_address);
}
#endif
/* not used since BRM Core work with offsets */
#ifdef GRSPW_ADR_FROM
unsigned int grspwpci_cpu_access_address;
static inline unsigned int hw_to_cpu(unsigned int addr) {
/* don't translate? */
if ( grspwpci_cpu_address == 0xffffffff )
return addr;
return ((addr & 0x0fffffff) | grspwpci_cpu_address);
}
#endif
int grspwpci_interrupt_handler(int irq, void *arg);
#include "grspw.c"
/*
*
* memarea = preallocated memory somewhere, pointer to start of memory.
* hw_address = how to translate a memarea address into an HW device AMBA address.
*/
int grspw_pci_register(
amba_confarea_type *bus,
unsigned int memarea,
unsigned int hw_address
)
{
/* Setup configuration */
/* if zero the malloc will be used */
grspwpci_memarea_address = memarea;
grspwpci_hw_address = hw_address;
#ifdef GRSPW_ADR_FROM
grspwpci_cpu_address = memarea & 0xf0000000;
#endif
/* Register the driver */
return GRSPW_PREFIX(_register)(bus);
}
/* Call this from PCI interrupt handler
* irq = the irq number of the HW device local to that IRQMP controller
*
*/
int grspwpci_interrupt_handler(int irq, void *arg){
grspw_interrupt( (GRSPW_DEV *)arg );
}
#if 0
int grspw_pci_interrupt_handler(int irqmask){
int i;
unsigned int mask=0;
/* find minor */
for(i=0; i<spw_cores; i++){
if ( (1<<SPW_PARAM(i).irq) & irqmask ){
mask |= 1<<SPW_PARAM(i).irq;
grspw_interrupt(i);
/* more interrupts to scan for? */
if ( irqmask & ~mask )
return mask; /* handled */
}
}
return mask;
}
#endif
@@ -0,0 +1,153 @@
/* Select PCI driver */
#define GRSPW_PCI
#undef GRSPW_MAXDEVS
#undef DEBUG_SPACEWIRE_ONOFF
/*#define DEBUG_SPACEWIRE_ONOFF*/
/*
* If USE_AT697_RAM is defined the RAM on the AT697 board will be used for DMA buffers (but rx message queue is always in AT697 ram).
* USE_AT697_DMA specifies whether the messages will be fetched using DMA or PIO.
*
* RASTA_PCI_BASE is the base address of the GRPCI AHB slave
*
*/
#define USE_AT697_RAM 1
#define USE_AT697_DMA 0
#define RASTA_PCI_BASE 0xe0000000
#define GRSPW_RASTA_MEM_OFF 0x21000
/* Make GRSPW driver use malloced or static memory
*/
#ifdef USE_AT697_RAM
#undef GRSPW_STATIC_MEM
#else
#define GRSPW_STATIC_MEM
#define GRSPW_CALC_MEMOFS(maxcores,corenum,ptr_mem_base,ptr_mem_end,ptr_bdtable_base) \
grspw_rasta_calc_memoffs((maxcores),(corenum),(ptr_mem_base),(ptr_mem_end),(ptr_bdtable_base))
#endif
/* We have custom address tranlation for HW addresses */
#define GRSPW_ADR_TO
/* MEMAREA=>CPU used when reading descriptor buffer pointers,
* they need to be translated from adresses used by GRSPW HW
* into CPU readable addresses.
*
* NOT NEEDED AS GRSPW DRIVER USES INDEXES TO GET DESCRIPTOR
* DATA POINTER ADDRESSES.
*/
#undef GRSPW_ADR_FROM
/* Set registered device name */
#define GRSPW_DEVNAME "/dev/grspwrasta0"
#define GRSPW_DEVNAME_NO(devstr,no) ((devstr)[15]='0'+(no))
/* Any non-static function will begin with */
#define GRSPW_PREFIX(name) grspwrasta##name
/* do nothing, assume that the interrupt handler is called
* setup externally calling grspw_interrupt_handler.
*/
#define GRSPW_REG_INT(handler,irq,arg) \
if ( grspw_rasta_int_reg ) \
grspw_rasta_int_reg(handler,irq,arg);
#define GRSPW_DONT_BYPASS_CACHE
#ifdef GRSPW_ADR_TO
/* Translate a address within the Memory Region (memarea) into an Hardware
* device address. This address is put into hardware registers or descriptors
* so that the hardware can access the Memory Region.
* Example:
* An local AMBA access at 0xe0000000 will translate into PCI address 0x40000000,
* the PCI address 0x40000000 will translate into CPU-AMBA address 0x40000000.
*/
static inline unsigned int memarea_to_hw(unsigned int addr) {
return ((addr & 0x0fffffff) | RASTA_PCI_BASE);
}
#endif
void (*grspw_rasta_int_reg)(void *handler, int irq, void *arg) = 0;
static int grspw_rasta_calc_memoffs(int maxcores, int corenum, unsigned int *mem_base, unsigned int *mem_end, unsigned int *bdtable_base);
int grspw_rasta_interrupt_handler(unsigned int status);
void grspwrasta_interrupt_handler(int irq, void *pDev);
#include "grspw.c"
unsigned int grspw_rasta_memarea_address;
/* Register RASTA GRSPW driver.
*
* memarea = preallocated memory somewhere, pointer to start of memory.
*/
int grspw_rasta_register(
amba_confarea_type *bus,
unsigned int ram_base
)
{
/* Setup configuration */
/* if zero the malloc will be used */
grspw_rasta_memarea_address = ram_base + GRSPW_RASTA_MEM_OFF;
/* Register the driver */
return GRSPW_PREFIX(_register)(bus);
}
#if 0
/* Call this from PCI interrupt handler, simply figures out
* which GRSPW core was responsible for the IRQ (may be multiple).
* v = status of the PCI/AMBA MCPU IRQ CTRL
*/
int grspw_rasta_interrupt_handler(unsigned int status)
{
int minor;
for(minor = 0; minor < spw_cores; minor++) {
if (status & (1<<grspw_devs[minor].irq) ) {
grspw_interrupt(&grspw_devs[minor]);
}
}
}
#endif
void GRSPW_PREFIX(_interrupt_handler)(int irq, void *pDev)
{
grspw_interrupt(pDev);
}
#ifdef GRSPW_STATIC_MEM
/*
* --------------------------------------- <-
* | Core1: BD TABLE 1 and 2 |
* | Core2: BD TABLE 1 and 2 |
* | Core3: BD TABLE 1 and 2 |
* |-------------------------------------|
* | Core1: rx data buf + rx header buf |
* | Core2: rx data buf + rx header buf |
* | Core3: rx data buf + rx header buf |
* ---------------------------------------
*/
static int grspw_rasta_calc_memoffs(int maxcores, int corenum, unsigned int *mem_base, unsigned int *mem_end, unsigned int *bdtable_base)
{
if ( maxcores > 3 )
return -1;
if ( bdtable_base )
*bdtable_base = grspw_rasta_memarea_address + corenum*2*SPACEWIRE_BDTABLE_SIZE;
if ( mem_base )
*mem_base = grspw_rasta_memarea_address + coremax*2*SPACEWIRE_BDTABLE_SIZE + corenum*BUFMEM_PER_LINK;
if ( mem_end )
*mem_end = grspw_rasta_memarea_address + coremax*2*SPACEWIRE_BDTABLE_SIZE + (corenum+1)*BUFMEM_PER_LINK;
return 0;
}
#endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,42 @@
#undef DEBUG
/* Set registered device name */
#define APBUART_DEVNAME "/dev/apbupci0"
#define APBUART_DEVNAME_NO(devstr,no) ((devstr)[12]='0'+(no))
/* Any non-static function will begin with */
#define APBUART_PREFIX(name) apbuartpci##name
/* do nothing, assume that the interrupt handler is called
* setup externally calling apbuartpci_interrupt_handler.
*/
#define APBUART_REG_INT(handler,irq,arg) \
if ( apbuart_pci_int_reg ) \
apbuart_pci_int_reg(handler,irq,arg);
void (*apbuart_pci_int_reg)(void *handler, int irq, void *arg) = 0;
void apbuartpci_interrupt_handler(int irq, void *arg);
/* AMBA Bus is clocked using the PCI clock (33.3MHz) */
#define SYS_FREQ_HZ 33333333
#include "apbuart.c"
int apbuart_pci_register(amba_confarea_type *bus)
{
/* Setup configuration */
/* Register the driver */
return APBUART_PREFIX(_register)(bus);
}
/* Call this from PCI interrupt handler
* irq = the irq number of the HW device local to that IRQMP controller
*
*/
void apbuartpci_interrupt_handler(int irq, void *arg){
apbuart_interrupt(arg);
}
@@ -0,0 +1,42 @@
#undef DEBUG
/* Set registered device name */
#define APBUART_DEVNAME "/dev/apburasta0"
#define APBUART_DEVNAME_NO(devstr,no) ((devstr)[14]='0'+(no))
/* Any non-static function will begin with */
#define APBUART_PREFIX(name) apbuartrasta##name
/* do nothing, assume that the interrupt handler is called
* setup externally calling apbuartrasta_interrupt_handler.
*/
#define APBUART_REG_INT(handler,irq,arg) \
if ( apbuart_rasta_int_reg ) \
apbuart_rasta_int_reg(handler,irq,arg);
void (*apbuart_rasta_int_reg)(void *handler, int irq, void *arg) = 0;
void apbuartrasta_interrupt_handler(int irq, void *arg);
/* AMBA Bus is clocked using the RASTA internal clock (30MHz) */
#define SYS_FREQ_HZ 30000000
#include "apbuart.c"
int apbuart_rasta_register(amba_confarea_type *bus)
{
/* Setup configuration */
/* Register the driver */
return APBUART_PREFIX(_register)(bus);
}
/* Call this from RASTA interrupt handler
* irq = the irq number of the HW device local to that IRQMP controller
*
*/
void apbuartrasta_interrupt_handler(int irq, void *arg){
apbuart_interrupt(arg);
}