forked from Imagelibrary/rtems
GRETH: use shared-irq service instead of BSP specific set_vec()
The ISR code is updated to use argument instead of global greth structure, now that the greth private is available in the ISR. The shared-irq routines will unmask the IRQ, so the forced LEON3 BSP unmask/clear IRQ is removed. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
This commit is contained in:
committed by
Joel Sherrill
parent
0f04edd9cc
commit
7499b84f41
@@ -48,13 +48,10 @@ int rtems_leon_greth_driver_attach(
|
||||
*(volatile int *) base_addr = GRETH_CTRL_RST;
|
||||
*(volatile int *) base_addr = 0;
|
||||
leon_greth_configuration.base_address = base_addr;
|
||||
leon_greth_configuration.vector = eth_irq + 0x10;
|
||||
leon_greth_configuration.vector = eth_irq; /* on LEON vector is IRQ no. */
|
||||
leon_greth_configuration.txd_count = TDA_COUNT;
|
||||
leon_greth_configuration.rxd_count = RDA_COUNT;
|
||||
if (rtems_greth_driver_attach( config, &leon_greth_configuration )) {
|
||||
LEON_Clear_interrupt(eth_irq);
|
||||
LEON_Unmask_interrupt(eth_irq);
|
||||
}
|
||||
rtems_greth_driver_attach(config, &leon_greth_configuration);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -42,15 +42,6 @@
|
||||
#undef free
|
||||
#endif
|
||||
|
||||
#if defined(__m68k__)
|
||||
extern m68k_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
|
||||
#elif defined(__lm32__)
|
||||
extern lm32_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
|
||||
#else
|
||||
extern rtems_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
|
||||
#endif
|
||||
|
||||
|
||||
/* #define GRETH_DEBUG */
|
||||
|
||||
#ifdef CPU_U32_FIX
|
||||
@@ -189,22 +180,22 @@ static char *almalloc(int sz)
|
||||
|
||||
/* GRETH interrupt handler */
|
||||
|
||||
rtems_isr
|
||||
greth_interrupt_handler (rtems_vector_number v)
|
||||
void greth_interrupt_handler (void *arg)
|
||||
{
|
||||
uint32_t status;
|
||||
uint32_t ctrl;
|
||||
rtems_event_set events = 0;
|
||||
struct greth_softc *greth = arg;
|
||||
|
||||
/* read and clear interrupt cause */
|
||||
status = greth.regs->status;
|
||||
greth.regs->status = status;
|
||||
ctrl = greth.regs->ctrl;
|
||||
status = greth->regs->status;
|
||||
greth->regs->status = status;
|
||||
ctrl = greth->regs->ctrl;
|
||||
|
||||
/* Frame received? */
|
||||
if ((ctrl & GRETH_CTRL_RXIRQ) && (status & (GRETH_STATUS_RXERR | GRETH_STATUS_RXIRQ)))
|
||||
{
|
||||
greth.rxInterrupts++;
|
||||
greth->rxInterrupts++;
|
||||
/* Stop RX-Error and RX-Packet interrupts */
|
||||
ctrl &= ~GRETH_CTRL_RXIRQ;
|
||||
events |= INTERRUPT_EVENT;
|
||||
@@ -212,17 +203,17 @@ greth_interrupt_handler (rtems_vector_number v)
|
||||
|
||||
if ( (ctrl & GRETH_CTRL_TXIRQ) && (status & (GRETH_STATUS_TXERR | GRETH_STATUS_TXIRQ)) )
|
||||
{
|
||||
greth.txInterrupts++;
|
||||
greth->txInterrupts++;
|
||||
ctrl &= ~GRETH_CTRL_TXIRQ;
|
||||
events |= GRETH_TX_WAIT_EVENT;
|
||||
}
|
||||
|
||||
|
||||
/* Clear interrupt sources */
|
||||
greth.regs->ctrl = ctrl;
|
||||
|
||||
greth->regs->ctrl = ctrl;
|
||||
|
||||
/* Send the event(s) */
|
||||
if ( events )
|
||||
rtems_event_send (greth.daemonTid, events);
|
||||
rtems_event_send (greth->daemonTid, events);
|
||||
}
|
||||
|
||||
static uint32_t read_mii(uint32_t phy_addr, uint32_t reg_addr)
|
||||
@@ -485,8 +476,9 @@ auto_neg_done:
|
||||
/* clear all pending interrupts */
|
||||
regs->status = 0xffffffff;
|
||||
|
||||
/* install interrupt vector */
|
||||
set_vector(greth_interrupt_handler, sc->vector, 1);
|
||||
/* install interrupt handler */
|
||||
rtems_interrupt_handler_install(sc->vector, "greth", RTEMS_INTERRUPT_SHARED,
|
||||
greth_interrupt_handler, sc);
|
||||
|
||||
regs->ctrl |= GRETH_CTRL_RXEN | (sc->fd << 4) | GRETH_CTRL_RXIRQ | (sc->sp << 7) | (sc->gb << 8);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
typedef struct {
|
||||
void *base_address;
|
||||
uint32_t vector;
|
||||
rtems_vector_number vector;
|
||||
uint32_t txd_count;
|
||||
uint32_t rxd_count;
|
||||
} greth_configuration_t;
|
||||
|
||||
Reference in New Issue
Block a user