nios2: Fix outx/writex parameter order in io.h
The outx/writex macros were using writex(addr, val) rather than the standard writex(val, addr), resulting in incompatibilty with architecture independent components. This change set uses standard parameter order. Signed-off-by: Scott McNutt <smcnutt@psyent.com>
This commit is contained in:
parent
64da04d24e
commit
3ea0037f23
@ -122,12 +122,12 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr2 = (unsigned char *) info->start[sect];
|
||||
writeb (addr, 0xaa);
|
||||
writeb (addr, 0x55);
|
||||
writeb (addr, 0x80);
|
||||
writeb (addr, 0xaa);
|
||||
writeb (addr, 0x55);
|
||||
writeb (addr2, 0x30);
|
||||
writeb (0xaa, addr);
|
||||
writeb (0x55, addr);
|
||||
writeb (0x80, addr);
|
||||
writeb (0xaa, addr);
|
||||
writeb (0x55, addr);
|
||||
writeb (0x30, addr2);
|
||||
/* Now just wait for 0xff & provide some user
|
||||
* feedback while we wait.
|
||||
*/
|
||||
@ -169,9 +169,9 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
return (2);
|
||||
}
|
||||
|
||||
writeb (cmd, 0xaa);
|
||||
writeb (cmd, 0x55);
|
||||
writeb (cmd, 0xa0);
|
||||
writeb (0xaa, cmd);
|
||||
writeb (0x55, cmd);
|
||||
writeb (0xa0, cmd);
|
||||
writeb (dst, b);
|
||||
|
||||
/* Verify write */
|
||||
|
@ -39,7 +39,7 @@ void __led_init (led_id_t mask, int state)
|
||||
val &= ~mask;
|
||||
else
|
||||
val |= mask;
|
||||
writel (&pio->data, val);
|
||||
writel (val, &pio->data);
|
||||
}
|
||||
|
||||
void __led_set (led_id_t mask, int state)
|
||||
@ -50,7 +50,7 @@ void __led_set (led_id_t mask, int state)
|
||||
val &= ~mask;
|
||||
else
|
||||
val |= mask;
|
||||
writel (&pio->data, val);
|
||||
writel (val, &pio->data);
|
||||
}
|
||||
|
||||
void __led_toggle (led_id_t mask)
|
||||
@ -58,5 +58,5 @@ void __led_toggle (led_id_t mask)
|
||||
nios_pio_t *pio = (nios_pio_t *)CONFIG_SYS_LEDPIO_ADDR;
|
||||
|
||||
val ^= mask;
|
||||
writel (&pio->data, val);
|
||||
writel (val, &pio->data);
|
||||
}
|
||||
|
@ -122,12 +122,12 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr2 = (unsigned char *) info->start[sect];
|
||||
writeb (addr, 0xaa);
|
||||
writeb (addr, 0x55);
|
||||
writeb (addr, 0x80);
|
||||
writeb (addr, 0xaa);
|
||||
writeb (addr, 0x55);
|
||||
writeb (addr2, 0x30);
|
||||
writeb (0xaa, addr);
|
||||
writeb (0x55, addr);
|
||||
writeb (0x80, addr);
|
||||
writeb (0xaa, addr);
|
||||
writeb (0x55, addr);
|
||||
writeb (0x30, addr2);
|
||||
/* Now just wait for 0xff & provide some user
|
||||
* feedback while we wait.
|
||||
*/
|
||||
@ -169,9 +169,9 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
return (2);
|
||||
}
|
||||
|
||||
writeb (cmd, 0xaa);
|
||||
writeb (cmd, 0x55);
|
||||
writeb (cmd, 0xa0);
|
||||
writeb (0xaa, cmd);
|
||||
writeb (0x55, cmd);
|
||||
writeb (0xa0, cmd);
|
||||
writeb (dst, b);
|
||||
|
||||
/* Verify write */
|
||||
|
@ -39,7 +39,7 @@ void __led_init (led_id_t mask, int state)
|
||||
val &= ~mask;
|
||||
else
|
||||
val |= mask;
|
||||
writel (&pio->data, val);
|
||||
writel (val, &pio->data);
|
||||
}
|
||||
|
||||
void __led_set (led_id_t mask, int state)
|
||||
@ -50,7 +50,7 @@ void __led_set (led_id_t mask, int state)
|
||||
val &= ~mask;
|
||||
else
|
||||
val |= mask;
|
||||
writel (&pio->data, val);
|
||||
writel (val, &pio->data);
|
||||
}
|
||||
|
||||
void __led_toggle (led_id_t mask)
|
||||
@ -58,5 +58,5 @@ void __led_toggle (led_id_t mask)
|
||||
nios_pio_t *pio = (nios_pio_t *)CONFIG_SYS_LEDPIO_ADDR;
|
||||
|
||||
val ^= mask;
|
||||
writel (&pio->data, val);
|
||||
writel (val, &pio->data);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ static int epcs_cs (int assert)
|
||||
|
||||
if (assert) {
|
||||
tmp = readl (&epcs->control);
|
||||
writel (&epcs->control, tmp | NIOS_SPI_SSO);
|
||||
writel (tmp | NIOS_SPI_SSO, &epcs->control);
|
||||
} else {
|
||||
/* Let all bits shift out */
|
||||
start = get_timer (0);
|
||||
@ -93,7 +93,7 @@ static int epcs_cs (int assert)
|
||||
if (get_timer (start) > EPCS_TIMEOUT)
|
||||
return (-1);
|
||||
tmp = readl (&epcs->control);
|
||||
writel (&epcs->control, tmp & ~NIOS_SPI_SSO);
|
||||
writel (tmp & ~NIOS_SPI_SSO, &epcs->control);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@ -106,7 +106,7 @@ static int epcs_tx (unsigned char c)
|
||||
while ((readl (&epcs->status) & NIOS_SPI_TRDY) == 0)
|
||||
if (get_timer (start) > EPCS_TIMEOUT)
|
||||
return (-1);
|
||||
writel (&epcs->txdata, c);
|
||||
writel (c, &epcs->txdata);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void tmr_isr (void *arg)
|
||||
/* Interrupt is cleared by writing anything to the
|
||||
* status register.
|
||||
*/
|
||||
writel (&tmr->status, 0);
|
||||
writel (0, &tmr->status);
|
||||
timestamp += CONFIG_SYS_NIOS_TMRMS;
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
status_led_tick(timestamp);
|
||||
@ -92,16 +92,16 @@ static void tmr_init (void)
|
||||
{
|
||||
nios_timer_t *tmr =(nios_timer_t *)CONFIG_SYS_NIOS_TMRBASE;
|
||||
|
||||
writel (&tmr->status, 0);
|
||||
writel (&tmr->control, 0);
|
||||
writel (&tmr->control, NIOS_TIMER_STOP);
|
||||
writel (0, &tmr->status);
|
||||
writel (0, &tmr->control);
|
||||
writel (NIOS_TIMER_STOP, &tmr->control);
|
||||
|
||||
#if defined(CONFIG_SYS_NIOS_TMRCNT)
|
||||
writel (&tmr->periodl, CONFIG_SYS_NIOS_TMRCNT & 0xffff);
|
||||
writel (&tmr->periodh, (CONFIG_SYS_NIOS_TMRCNT >> 16) & 0xffff);
|
||||
writel (CONFIG_SYS_NIOS_TMRCNT & 0xffff, &tmr->periodl);
|
||||
writel ((CONFIG_SYS_NIOS_TMRCNT >> 16) & 0xffff, &tmr->periodh);
|
||||
#endif
|
||||
writel (&tmr->control, NIOS_TIMER_ITO | NIOS_TIMER_CONT |
|
||||
NIOS_TIMER_START );
|
||||
writel (NIOS_TIMER_ITO | NIOS_TIMER_CONT | NIOS_TIMER_START,
|
||||
&tmr->control);
|
||||
irq_install_handler (CONFIG_SYS_NIOS_TMRIRQ, tmr_isr, (void *)tmr);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ void serial_putc (char c)
|
||||
{
|
||||
while (NIOS_JTAG_WSPACE ( readl (&jtag->control)) == 0)
|
||||
WATCHDOG_RESET ();
|
||||
writel (&jtag->data, (unsigned char)c);
|
||||
writel ((unsigned char)c, &jtag->data);
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
|
@ -50,7 +50,7 @@ void serial_setbrg (void)
|
||||
unsigned div;
|
||||
|
||||
div = (CONFIG_SYS_CLK_FREQ/gd->baudrate)-1;
|
||||
writel (&uart->divisor,div);
|
||||
writel (div, &uart->divisor);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void serial_putc (char c)
|
||||
serial_putc ('\r');
|
||||
while ((readl (&uart->status) & NIOS_UART_TRDY) == 0)
|
||||
WATCHDOG_RESET ();
|
||||
writel (&uart->txdata,(unsigned char)c);
|
||||
writel ((unsigned char)c, &uart->txdata);
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
|
@ -61,7 +61,7 @@ void serial_setbrg (void)
|
||||
((unsigned)CONFIG_SYS_CLK_FREQ >> k);
|
||||
|
||||
baud = best_m + best_n * YANU_BAUDE;
|
||||
writel(&uart->baud, baud);
|
||||
writel(baud, &uart->baud);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -92,7 +92,7 @@ void serial_setbrg (void)
|
||||
((unsigned)CONFIG_SYS_CLK_FREQ >> k);
|
||||
|
||||
baud = best_m + best_n * YANU_BAUDE;
|
||||
writel(&uart->baud, baud);
|
||||
writel(baud, &uart->baud);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -113,7 +113,7 @@ int serial_init (void)
|
||||
YANU_ACTION_RPE |
|
||||
YANU_ACTION_RFE | YANU_ACTION_RFIFO_CLEAR | YANU_ACTION_TFIFO_CLEAR;
|
||||
|
||||
writel(&uart->action, action);
|
||||
writel(action, &uart->action);
|
||||
|
||||
/* control register cleanup */
|
||||
/* no interrupts enabled */
|
||||
@ -127,7 +127,7 @@ int serial_init (void)
|
||||
control |= YANU_CONTROL_RDYDLY * YANU_RXFIFO_DLY;
|
||||
control |= YANU_CONTROL_TXTHR * YANU_TXFIFO_THR;
|
||||
|
||||
writel(&uart->control, control);
|
||||
writel(control, &uart->control);
|
||||
|
||||
/* to set baud rate */
|
||||
serial_setbrg();
|
||||
@ -156,7 +156,7 @@ void serial_putc (char c)
|
||||
WATCHDOG_RESET ();
|
||||
}
|
||||
|
||||
writel(&uart->data, (unsigned char)c);
|
||||
writel((unsigned char)c, &uart->data);
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
@ -182,7 +182,7 @@ int serial_getc (void)
|
||||
WATCHDOG_RESET ();
|
||||
|
||||
/* first we pull the char */
|
||||
writel(&uart->action, YANU_ACTION_RFIFO_PULL);
|
||||
writel(YANU_ACTION_RFIFO_PULL, &uart->action);
|
||||
|
||||
return(readl(&uart->data) & YANU_DATA_CHAR_MASK);
|
||||
}
|
||||
|
@ -80,19 +80,19 @@ extern unsigned inl (unsigned port);
|
||||
({unsigned long val;\
|
||||
asm volatile( "ldwio %0, 0(%1)" :"=r"(val) : "r" (addr)); val;})
|
||||
|
||||
#define writeb(addr,val)\
|
||||
asm volatile ("stbio %1, 0(%0)" : : "r" (addr), "r" (val))
|
||||
#define writew(addr,val)\
|
||||
asm volatile ("sthio %1, 0(%0)" : : "r" (addr), "r" (val))
|
||||
#define writel(addr,val)\
|
||||
asm volatile ("stwio %1, 0(%0)" : : "r" (addr), "r" (val))
|
||||
#define writeb(val,addr)\
|
||||
asm volatile ("stbio %0, 0(%1)" : : "r" (val), "r" (addr))
|
||||
#define writew(val,addr)\
|
||||
asm volatile ("sthio %0, 0(%1)" : : "r" (val), "r" (addr))
|
||||
#define writel(val,addr)\
|
||||
asm volatile ("stwio %0, 0(%1)" : : "r" (val), "r" (addr))
|
||||
|
||||
#define inb(addr) readb(addr)
|
||||
#define inw(addr) readw(addr)
|
||||
#define inl(addr) readl(addr)
|
||||
#define outb(addr,val) writeb(addr,val)
|
||||
#define outw(addr,val) writew(addr,val)
|
||||
#define outl(addr,val) writel(addr,val)
|
||||
#define outb(val, addr) writeb(val,addr)
|
||||
#define outw(val, addr) writew(val,addr)
|
||||
#define outl(val, addr) writel(val,addr)
|
||||
|
||||
static inline void insb (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user