diff options
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon2/rasta/rasta.c')
-rw-r--r-- | c/src/lib/libbsp/sparc/leon2/rasta/rasta.c | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/c/src/lib/libbsp/sparc/leon2/rasta/rasta.c b/c/src/lib/libbsp/sparc/leon2/rasta/rasta.c index ae28904ed8..7b66b07246 100644 --- a/c/src/lib/libbsp/sparc/leon2/rasta/rasta.c +++ b/c/src/lib/libbsp/sparc/leon2/rasta/rasta.c @@ -34,7 +34,7 @@ #ifdef DEBUG #define DBG(x...) printk(x) #else -#define DBG(x...) +#define DBG(x...) #endif /* @@ -72,7 +72,7 @@ struct gpio_reg *gpio0, *gpio1; /* volatile unsigned int *pci_mem = (volatile unsigned int *) 0xb0400000; */ /* if (*pci_int & 0x20) { */ - + /* *pci_int = 0x20; */ /* *pci_mem = 0; */ @@ -99,13 +99,13 @@ void (*brm_int_handler)(int irq, void *arg) = NULL; static rtems_isr rasta_interrupt_handler (rtems_vector_number v) { unsigned int status; - + status = irq->ipend; if ( (status & GRCAN_IRQ) && grcan_int_handler ) { grcan_int_handler(GRCAN_IRQNO,grcan_int_arg); } - + if (status & SPW_IRQ) { if ( (status & SPW0_IRQ) && spw0_int_handler ){ spw0_int_handler(SPW0_IRQNO,spw0_int_arg); @@ -114,12 +114,12 @@ static rtems_isr rasta_interrupt_handler (rtems_vector_number v) if ( (status & SPW1_IRQ) && spw1_int_handler ){ spw1_int_handler(SPW1_IRQNO,spw1_int_arg); } - + if ( (status & SPW2_IRQ) && spw2_int_handler ){ spw2_int_handler(SPW2_IRQNO,spw2_int_arg); } } - if ((status & BRM_IRQ) && brm_int_handler ){ + if ((status & BRM_IRQ) && brm_int_handler ){ brm_int_handler(BRM_IRQNO,brm_int_arg); } if ( (status & UART0_IRQ) && uart0_int_handler ) { @@ -128,10 +128,10 @@ static rtems_isr rasta_interrupt_handler (rtems_vector_number v) if ( (status & UART1_IRQ) && uart1_int_handler) { uart1_int_handler(UART1_IRQNO,uart1_int_arg); } - + DBG("RASTA-IRQ: 0x%x\n",status); irq->iclear = status; - + } void rasta_interrrupt_register(void *handler, int irqno, void *arg) @@ -141,27 +141,27 @@ void rasta_interrrupt_register(void *handler, int irqno, void *arg) DBG("RASTA: Registering uart0 handler: 0x%x, arg: 0x%x\n",handler,arg); uart0_int_handler = handler; uart0_int_arg = arg; - + /* unmask interrupt source */ irq->iclear = UART0_IRQ; irq->mask[0] |= UART0_IRQ; } - + if ( irqno == UART1_IRQNO ){ DBG("RASTA: Registering uart1 handler: 0x%x, arg: 0x%x\n",handler,arg); uart1_int_handler = handler; uart1_int_arg = arg; - + /* unmask interrupt source */ irq->iclear = UART1_IRQ; irq->mask[0] |= UART1_IRQ; } - + if ( irqno == SPW0_IRQNO ){ DBG("RASTA: Registering spw0 handler: 0x%x, arg: 0x%x\n",handler,arg); spw0_int_handler = handler; spw0_int_arg = arg; - + /* unmask interrupt source */ irq->iclear = SPW0_IRQ; irq->mask[0] |= SPW0_IRQ; @@ -171,41 +171,41 @@ void rasta_interrrupt_register(void *handler, int irqno, void *arg) DBG("RASTA: Registering spw1 handler: 0x%x, arg: 0x%x\n",handler,arg); spw1_int_handler = handler; spw1_int_arg = arg; - + /* unmask interrupt source */ irq->iclear = SPW1_IRQ; irq->mask[0] |= SPW1_IRQ; } - + if ( irqno == SPW2_IRQNO ){ DBG("RASTA: Registering spw2 handler: 0x%x, arg: 0x%x\n",handler,arg); spw2_int_handler = handler; spw2_int_arg = arg; - + /* unmask interrupt source */ irq->iclear = SPW2_IRQ; irq->mask[0] |= SPW2_IRQ; } - + if ( irqno == GRCAN_IRQNO ){ DBG("RASTA: Registering GRCAN handler: 0x%x, arg: 0x%x\n",handler,arg); grcan_int_handler = handler; grcan_int_arg = arg; - + /* unmask interrupt source */ irq->iclear = GRCAN_IRQ; irq->mask[0] |= GRCAN_IRQ; } - + if ( irqno == BRM_IRQNO ){ DBG("RASTA: Registering BRM handler: 0x%x, arg: 0x%x\n",handler,arg); brm_int_handler = handler; brm_int_arg = arg; - + /* unmask interrupt source */ irq->iclear = BRM_IRQ; irq->mask[0] |= BRM_IRQ; - } + } } @@ -213,21 +213,21 @@ int rasta_get_gpio(amba_confarea_type *abus, int index, struct gpio_reg **regs, { amba_apb_device dev; int cores; - - if ( !abus ) + + if ( !abus ) return -1; - + /* Scan PnP info for GPIO port number 'index' */ cores = amba_find_next_apbslv(abus,VENDOR_GAISLER,GAISLER_PIOPORT,&dev,index); if ( cores < 1 ) return -1; - + if ( regs ) *regs = (struct gpio_reg *)dev.start; - + if ( irq ) *irq = dev.irq; - + return 0; } @@ -235,37 +235,37 @@ int rasta_get_gpio(amba_confarea_type *abus, int index, struct gpio_reg **regs, static amba_confarea_type abus; static struct amba_mmap amba_maps[3]; -int rasta_register(void) +int rasta_register(void) { unsigned int bar0, bar1, data; unsigned int *page0 = NULL; unsigned int *apb_base = NULL; int found=0; - + DBG("Searching for RASTA board ..."); - + /* Search PCI vendor/device id. */ if (BSP_pciFindDevice(0x1AC8, 0x0010, 0, &bus, &dev, &fun) == 0) { found = 1; } - + /* Search old PCI vendor/device id. */ if ( (!found) && (BSP_pciFindDevice(0x16E3, 0x0210, 0, &bus, &dev, &fun) == 0) ) { found = 1; } - + /* Did we find a RASTA board? */ if ( !found ) return -1; - + DBG(" found it (dev/fun: %d/%d).\n", dev, fun); pci_read_config_dword(bus, dev, fun, 0x10, &bar0); pci_read_config_dword(bus, dev, fun, 0x14, &bar1); - page0 = (unsigned int *)(bar0 + 0x400000); + page0 = (unsigned int *)(bar0 + 0x400000); *page0 = 0x80000000; /* Point PAGE0 to start of APB */ apb_base = (unsigned int *)(bar0+APB2_OFFSET); @@ -279,13 +279,13 @@ int rasta_register(void) apb_base[0] = 0x000002ff; apb_base[1] = 0x00001260; apb_base[2] = 0x000e8000; -#else +#else apb_base[0] = 0x000002ff; apb_base[1] = 0x82206000; apb_base[2] = 0x000e8000; #endif /* Set up rasta irq controller */ - irq = (LEON3_IrqCtrl_Regs_Map *) (bar0+IRQ_OFFSET); + irq = (LEON3_IrqCtrl_Regs_Map *) (bar0+IRQ_OFFSET); irq->iclear = 0xffff; irq->ilevel = 0; irq->mask[0] = 0xffff & ~(UART0_IRQ|UART1_IRQ|SPW0_IRQ|SPW1_IRQ|SPW2_IRQ|GRCAN_IRQ|BRM_IRQ); @@ -297,23 +297,23 @@ int rasta_register(void) apb_base[0x100] |= 0x40000000; /* Set GRPCI mmap 0x4 */ apb_base[0x104] = 0x40000000; /* 0xA0000000; Point PAGE1 to RAM */ - + /* set parity error response */ pci_read_config_dword(bus, dev, fun, 0x4, &data); pci_write_config_dword(bus, dev, fun, 0x4, data|0x40); - + pci_master_enable(bus, dev, fun); /* install PCI interrupt vector */ /* set_vector(pci_interrupt_handler,14+0x10, 1); */ - + /* install interrupt vector */ set_vector(rasta_interrupt_handler, RASTA_IRQ+0x10, 1); /* Scan AMBA Plug&Play */ - + /* AMBA MAP bar0 (in CPU) ==> 0x80000000(remote amba address) */ amba_maps[0].size = 0x10000000; amba_maps[0].cpu_adr = bar0; @@ -328,14 +328,14 @@ int rasta_register(void) amba_maps[2].size=0; amba_maps[2].cpu_adr = 0; amba_maps[2].remote_amba_adr = 0; - + memset(&abus,0,sizeof(abus)); - + /* Start AMBA PnP scan at first AHB bus */ amba_scan(&abus,bar0+(AHB1_IOAREA_BASE_ADDR&~0xf0000000),&amba_maps[0]); - + printk("Registering RASTA GRCAN driver\n\r"); - + /*grhcan_register(bar0 + GRHCAN_OFFSET, bar1);*/ grcan_rasta_int_reg=rasta_interrrupt_register; if ( grcan_rasta_ram_register(&abus,bar1+0x20000) ){ @@ -352,7 +352,7 @@ int rasta_register(void) printk("Failed to register BRM RASTA driver\n"); return -1; } - + /* provide the spacewire driver with AMBA Plug&Play * info so that it can find the GRSPW cores. */ @@ -376,13 +376,13 @@ int rasta_register(void) printk("Failed to get address for RASTA GPIO0\n\r"); return -1; } - + /* Find GPIO1 address */ if ( rasta_get_gpio(&abus,1,&gpio1,NULL) ){ printk("Failed to get address for RASTA GPIO1\n\r"); return -1; } - + /* Successfully registered the RASTA board */ return 0; } |