From: Paul M. <le...@us...> - 2001-09-25 03:36:37
|
Update of /cvsroot/linux-mips/linux/arch/mips/au1000/common In directory usw-pr-cvs1:/tmp/cvs-serv5739/arch/mips/au1000/common Modified Files: dma.c irq.c power.c usbdev.c Log Message: Sync with OSS 2.4.9. Index: dma.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/dma.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- dma.c 2001/08/30 21:50:49 1.3 +++ dma.c 2001/09/25 03:36:35 1.4 @@ -61,14 +61,14 @@ spinlock_t au1000_dma_spin_lock = SPIN_LOCK_UNLOCKED; struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = { - {dev_id: -1,}, - {dev_id: -1,}, - {dev_id: -1,}, - {dev_id: -1,}, - {dev_id: -1,}, - {dev_id: -1,}, - {dev_id: -1,}, - {dev_id: -1,} + {dev_id:-1,}, + {dev_id:-1,}, + {dev_id:-1,}, + {dev_id:-1,}, + {dev_id:-1,}, + {dev_id:-1,}, + {dev_id:-1,}, + {dev_id:-1,} }; // Device FIFO addresses and default DMA modes @@ -76,35 +76,37 @@ unsigned int fifo_addr; unsigned int dma_mode; } dma_dev_table[DMA_NUM_DEV] = { - { UART0_ADDR + UART_TX, 0 }, - { UART0_ADDR + UART_RX, 0 }, - { 0, 0 }, - { 0, 0 }, - { AC97C_DATA, DMA_DW16 | DMA_NC }, - { AC97C_DATA, DMA_DR | DMA_DW16 | DMA_NC }, - { UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC }, - { UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC }, - { USB_DEV_EP0_READ_FIFO, DMA_DR | DMA_DW8 | DMA_NC }, - { USB_DEV_EP0_WRITE_FIFO, DMA_DW8 | DMA_NC }, - { USB_DEV_EP2_WRITE_FIFO, DMA_DW8 | DMA_NC }, - { USB_DEV_EP3_WRITE_FIFO, DMA_DW8 | DMA_NC }, - { USB_DEV_EP4_READ_FIFO, DMA_DR | DMA_DW8 | DMA_NC }, - { USB_DEV_EP5_READ_FIFO, DMA_DR | DMA_DW8 | DMA_NC }, - { I2S_DATA, DMA_DW32 | DMA_NC }, - { I2S_DATA, DMA_DR | DMA_DW32 | DMA_NC } + { + UART0_ADDR + UART_TX, 0}, { + UART0_ADDR + UART_RX, 0}, { + 0, 0}, { + 0, 0}, { + AC97C_DATA, DMA_DW16 | DMA_NC}, { + AC97C_DATA, DMA_DR | DMA_DW16 | DMA_NC}, { + UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC}, { + UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC}, { + USB_DEV_EP0_READ_FIFO, DMA_DR | DMA_DW8 | DMA_NC}, { + USB_DEV_EP0_WRITE_FIFO, DMA_DW8 | DMA_NC}, { + USB_DEV_EP2_WRITE_FIFO, DMA_DW8 | DMA_NC}, { + USB_DEV_EP3_WRITE_FIFO, DMA_DW8 | DMA_NC}, { + USB_DEV_EP4_READ_FIFO, DMA_DR | DMA_DW8 | DMA_NC}, { + USB_DEV_EP5_READ_FIFO, DMA_DR | DMA_DW8 | DMA_NC}, { + I2S_DATA, DMA_DW32 | DMA_NC}, { + I2S_DATA, DMA_DR | DMA_DW32 | DMA_NC} }; -int au1000_dma_read_proc (char *buf, char **start, off_t fpos, +int au1000_dma_read_proc(char *buf, char **start, off_t fpos, int length, int *eof, void *data) { - int i, len=0; - struct dma_chan * chan; + int i, len = 0; + struct dma_chan *chan; - for (i = 0 ; i < NUM_AU1000_DMA_CHANNELS ; i++) { + for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { if ((chan = get_dma_chan(i)) != NULL) { - len += sprintf(buf+len, "%2d: %s\n", - i, chan->dev_str); + len += + sprintf(buf + len, "%2d: %s\n", i, + chan->dev_str); } } @@ -123,7 +125,7 @@ void dump_au1000_dma_channel(unsigned int dmanr) { - struct dma_chan * chan; + struct dma_chan *chan; if (dmanr > NUM_AU1000_DMA_CHANNELS) return; @@ -131,17 +133,17 @@ printk(KERN_INFO "Au1000 DMA%d Register Dump:\n", dmanr); printk(KERN_INFO " mode = 0x%08x\n", - inl(chan->io+DMA_MODE_SET)); + inl(chan->io + DMA_MODE_SET)); printk(KERN_INFO " addr = 0x%08x\n", - inl(chan->io+DMA_PERIPHERAL_ADDR)); + inl(chan->io + DMA_PERIPHERAL_ADDR)); printk(KERN_INFO " start0 = 0x%08x\n", - inl(chan->io+DMA_BUFFER0_START)); + inl(chan->io + DMA_BUFFER0_START)); printk(KERN_INFO " start1 = 0x%08x\n", - inl(chan->io+DMA_BUFFER1_START)); + inl(chan->io + DMA_BUFFER1_START)); printk(KERN_INFO " count0 = 0x%08x\n", - inl(chan->io+DMA_BUFFER0_COUNT)); + inl(chan->io + DMA_BUFFER0_COUNT)); printk(KERN_INFO " count1 = 0x%08x\n", - inl(chan->io+DMA_BUFFER1_COUNT)); + inl(chan->io + DMA_BUFFER1_COUNT)); } @@ -149,15 +151,15 @@ * Finds a free channel, and binds the requested device to it. * Returns the allocated channel number, or negative on error. */ -int request_au1000_dma(int dev_id, const char * dev_str) +int request_au1000_dma(int dev_id, const char *dev_str) { - struct dma_chan * chan; + struct dma_chan *chan; int i; if (dev_id < 0 || dev_id >= DMA_NUM_DEV) return -EINVAL; - for (i = 0 ; i < NUM_AU1000_DMA_CHANNELS ; i++) { + for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { if (au1000_dma_table[i].dev_id < 0) break; } @@ -167,7 +169,7 @@ chan = &au1000_dma_table[i]; // fill it in - chan->io = DMA_CHANNEL_BASE + i*DMA_CHANNEL_LEN; + chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN; chan->irq = AU1000_DMA_INT_BASE + i; chan->dev_id = dev_id; chan->dev_str = dev_str; @@ -180,7 +182,7 @@ void free_au1000_dma(unsigned int dmanr) { - struct dma_chan * chan = get_dma_chan(dmanr); + struct dma_chan *chan = get_dma_chan(dmanr); if (!chan) { printk("Trying to free DMA%d\n", dmanr); return; Index: irq.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/irq.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- irq.c 2001/08/30 17:52:50 1.6 +++ irq.c 2001/09/25 03:36:35 1.7 @@ -194,7 +194,6 @@ static void shutdown_irq(unsigned int irq_nr) { local_disable_irq(irq_nr); - return; } @@ -268,7 +267,6 @@ #endif local_disable_irq(irq_nr); au_sync(); - return; } Index: power.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/power.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- power.c 2001/08/28 07:23:54 1.1 +++ power.c 2001/09/25 03:36:35 1.2 @@ -76,12 +76,12 @@ flush_cache_all(); /* pin 6 is gpio */ - writel(readl(PIN_STATE) & ~(1<<11), PIN_STATE); + writel(readl(PIN_STATE) & ~(1 << 11), PIN_STATE); /* gpio 6 can cause a wake up event */ wakeup = readl(PM_WAKEUP_SOURCE_MASK); - wakeup &= ~(1<<8); /* turn off match20 wakeup */ - wakeup |= 1<<6; /* turn on gpio 6 wakeup */ + wakeup &= ~(1 << 8); /* turn off match20 wakeup */ + wakeup |= 1 << 6; /* turn on gpio 6 wakeup */ writel(wakeup, PM_WAKEUP_SOURCE_MASK); writel(1, PM_WAKEUP_CAUSE); /* clear cause */ @@ -94,10 +94,7 @@ "li $4, 1\n\t" "lui $5, 0xb190\n\t" "ori $5, 0x7c\n\t" - "sw $4, 0($5)\n\t" - "sync\n\t" - "1:\t\n\t" - "nop\n\t"); + "sw $4, 0($5)\n\t" "sync\n\t" "1:\t\n\t" "nop\n\t"); /* after a wakeup, the cpu vectors back to 0x1fc00000 so * it's up to the boot code to get us back here. @@ -106,44 +103,45 @@ return 0; } -static int pm_do_sleep(ctl_table *ctl, int write, struct file *file, void *buffer, size_t *len) +static int pm_do_sleep(ctl_table * ctl, int write, struct file *file, + void *buffer, size_t * len) { int retval = 0; if (!write) { *len = 0; - } - else { - retval = pm_send_all(PM_SUSPEND, (void *)2); + } else { + retval = pm_send_all(PM_SUSPEND, (void *) 2); if (retval) return retval; au_sleep(); - retval = pm_send_all(PM_RESUME, (void *)0); + retval = pm_send_all(PM_RESUME, (void *) 0); } return retval; } -static int pm_do_suspend(ctl_table *ctl, int write, struct file *file, void *buffer, size_t *len) +static int pm_do_suspend(ctl_table * ctl, int write, struct file *file, + void *buffer, size_t * len) { int retval = 0; if (!write) { *len = 0; - } - else { - retval = pm_send_all(PM_SUSPEND, (void *)2); + } else { + retval = pm_send_all(PM_SUSPEND, (void *) 2); if (retval) return retval; suspend_mode = 1; au1_wait(); - retval = pm_send_all(PM_RESUME, (void *)0); + retval = pm_send_all(PM_RESUME, (void *) 0); } return retval; } -static int pm_do_freq(ctl_table *ctl, int write, struct file *file, void *buffer, size_t *len) +static int pm_do_freq(ctl_table * ctl, int write, struct file *file, + void *buffer, size_t * len) { int retval = 0, i; unsigned long val, pll; @@ -151,20 +149,20 @@ #define MAX_CPU_FREQ 396 char buf[8], *p; unsigned long flags, intc0_mask, intc1_mask; - unsigned long old_baud_base, old_cpu_freq, baud_rate, old_clk, old_refresh; + unsigned long old_baud_base, old_cpu_freq, baud_rate, old_clk, + old_refresh; unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh; save_and_cli(flags); if (!write) { *len = 0; - } - else { + } else { /* Parse the new frequency */ - if (*len > TMPBUFLEN-1) { + if (*len > TMPBUFLEN - 1) { restore_flags(flags); return -EFAULT; } - if(copy_from_user(buf, buffer, *len)) { + if (copy_from_user(buf, buffer, *len)) { restore_flags(flags); return -EFAULT; } @@ -176,7 +174,7 @@ return -EFAULT; } - pll = val/12; + pll = val / 12; if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */ /* revisit this for higher speed cpus */ restore_flags(flags); @@ -192,17 +190,22 @@ set_au1000_uart_baud_base(new_baud_base); old_refresh = readl(REFRESH_CONFIG) & 0x1ffffff; - new_refresh = ((old_refresh * new_cpu_freq)/old_cpu_freq) | - (readl(REFRESH_CONFIG) & ~0x1ffffff); + new_refresh = + ((old_refresh * new_cpu_freq) / + old_cpu_freq) | (readl(REFRESH_CONFIG) & ~0x1ffffff); writel(pll, CPU_PLL_CNTRL); au_sync_delay(1); writel(new_refresh, REFRESH_CONFIG); au_sync_delay(1); - for (i=0; i<4; i++) { - if (readl(UART_BASE + UART_MOD_CNTRL + i*0x00100000) == 3) { - old_clk = readl(UART_BASE + UART_CLK + i*0x00100000); + for (i = 0; i < 4; i++) { + if (readl + (UART_BASE + UART_MOD_CNTRL + + i * 0x00100000) == 3) { + old_clk = + readl(UART_BASE + UART_CLK + + i * 0x00100000); // baud_rate = baud_base/clk baud_rate = old_baud_base / old_clk; /* we won't get an exact baud rate and the error @@ -215,15 +218,17 @@ baud_rate = 115200; else if (baud_rate > 50000) baud_rate = 57600; - else if(baud_rate > 30000) + else if (baud_rate > 30000) baud_rate = 38400; else if (baud_rate > 17000) baud_rate = 19200; else (baud_rate = 9600); // new_clk = new_baud_base/baud_rate - new_clk = new_baud_base/baud_rate; - writel(new_clk, UART_BASE + UART_CLK + i*0x00100000); + new_clk = new_baud_base / baud_rate; + writel(new_clk, + UART_BASE + UART_CLK + + i * 0x00100000); au_sync_delay(10); } } @@ -245,16 +250,14 @@ } -static struct ctl_table pm_table[] = -{ +static struct ctl_table pm_table[] = { {ACPI_S1_SLP_TYP, "suspend", NULL, 0, 0600, NULL, &pm_do_suspend}, {ACPI_SLEEP, "sleep", NULL, 0, 0600, NULL, &pm_do_sleep}, {CTL_ACPI, "freq", NULL, 0, 0600, NULL, &pm_do_freq}, {0} }; -static struct ctl_table pm_dir_table[] = -{ +static struct ctl_table pm_dir_table[] = { {CTL_ACPI, "pm", NULL, 0, 0555, pm_table}, {0} }; @@ -274,11 +277,7 @@ { __asm__(".set\tmips3\n\t" "wait\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - ".set\tmips0"); + "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" ".set\tmips0"); } @@ -296,13 +295,13 @@ unsigned long ticks, loopbit; int lps_precision = LPS_PREC; - loops_per_jiffy = (1<<12); + loops_per_jiffy = (1 << 12); while (loops_per_jiffy <<= 1) { /* wait for "start of" clock tick */ ticks = jiffies; while (ticks == jiffies) - /* nothing */; + /* nothing */ ; /* Go .. */ ticks = jiffies; __delay(loops_per_jiffy); @@ -315,7 +314,7 @@ (up to lps_precision bits) */ loops_per_jiffy >>= 1; loopbit = loops_per_jiffy; - while ( lps_precision-- && (loopbit >>= 1) ) { + while (lps_precision-- && (loopbit >>= 1)) { loops_per_jiffy |= loopbit; ticks = jiffies; while (ticks == jiffies); @@ -331,8 +330,7 @@ void au1_wait(void) { - __asm__("nop\n\t" - "nop\n\t"); + __asm__("nop\n\t" "nop\n\t"); } #endif /* CONFIG_PM */ Index: usbdev.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/au1000/common/usbdev.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- usbdev.c 2001/08/30 21:50:49 1.3 +++ usbdev.c 2001/09/25 03:36:35 1.4 @@ -90,17 +90,18 @@ } dev_state_t; /* local function prototypes */ -static int serial_open (struct tty_struct *tty, struct file * filp); -static void serial_close (struct tty_struct *tty, struct file * filp); -static int serial_write (struct tty_struct * tty, int from_user, +static int serial_open(struct tty_struct *tty, struct file *filp); +static void serial_close(struct tty_struct *tty, struct file *filp); +static int serial_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count); -static int serial_write_room (struct tty_struct *tty); [...1583 lines suppressed...] } #endif @@ -1799,7 +1828,7 @@ udelay(100); outl_sync(0x0003, USB_DEV_ENABLE); udelay(100); - for (i = 0; i < sizeof(au1000_config_table)/sizeof(u32); ++i) + for (i = 0; i < sizeof(au1000_config_table) / sizeof(u32); ++i) outl_sync(au1000_config_table[i], USB_DEV_CONFIG); // Flush the endpoint buffers and FIFOs @@ -1809,7 +1838,7 @@ kickstart_receive_packet(ep); for (i = 0; i < NUM_PORTS; ++i) { - struct usb_serial_port * port = &usbserial.port[i]; + struct usb_serial_port *port = &usbserial.port[i]; endpoint_flush(&port->ep_bulkin); endpoint_flush(&port->ep_bulkout); // start packet reception on bulk OUT endpoint |