Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MIPS] Alchemy common code style cleanup

Fix many errors and warnings given by checkpatch.pl:

- use of C99 // comments;

- missing space between the type and asterisk in a variable declaration;

- space between the asterisk and function/variable name;

- leading spaces instead of tabs;

- space after opening and before closing parentheses;

- initialization of a 'static' variable to 0;

- missing spaces around assignement/comparison operator;

- brace not on the same line with condition (or 'else') in the 'if'/'switch'
statement;

- missing space between 'if'/'for'/'while' and opening parenthesis;

- use of assignement in 'if' statement's condition;

- printk() without KERN_* facility level;

- EXPORT_SYMBOL() not following its function immediately;

- unnecessary braces for single-statement block;

- adding new 'typedef' (where including <linux/types.h> will do);

- use of 'extern' in the .c file (where it can be avoided by including header);

- line over 80 characters.

In addition to these changes, also do the following:

- insert missing space after opening brace and/or before closing brace in the
structure initializers;

- insert spaces between operator and its operands;

- put the function's result type and name/parameters on the same line;

- properly indent multi-line expressions;

- remove commented out code;

- remove useless initializers and code;

- remove needless parentheses;

- fix broken/excess indentation;

- add missing spaces between operator and its operands;

- insert missing and remove excess new lines;

- group 'else' and 'if' together where possible;

- make au1xxx_platform_init() 'static';

- regroup variable declarations in pm_do_freq() for prettier look;

- replace numeric literals with the matching macros;

- fix printk() format specifiers mismatching the argument types;

- make the multi-line comment style consistent with the kernel style elsewhere
by adding empty first line and/or adding space on their left side;

- make two-line comments that only have one line of text one-line;

- fix typos/errors, capitalize acronyms, etc. in the comments;

- fix/remove obsolete references in the comments;

- reformat some comments;

- add comment about the CPU:counter clock ratio to calc_clock();

- update MontaVista copyright;

- remove Pete Popov's and Steve Longerbeam's old email addresses...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Sergei Shtylyov and committed by
Ralf Baechle
c1dcb14e ff6814d5

+498 -570
+3 -4
arch/mips/au1000/common/Makefile
··· 1 1 # 2 - # Copyright 2000 MontaVista Software Inc. 3 - # Author: MontaVista Software, Inc. 4 - # ppopov@mvista.com or source@mvista.com 2 + # Copyright 2000, 2008 MontaVista Software Inc. 3 + # Author: MontaVista Software, Inc. <source@mvista.com> 5 4 # 6 - # Makefile for the Alchemy Au1000 CPU, generic files. 5 + # Makefile for the Alchemy Au1xx0 CPUs, generic files. 7 6 # 8 7 9 8 obj-y += prom.o irq.o puts.o time.o reset.o \
+72 -73
arch/mips/au1000/common/au1xxx_irqmap.c
··· 40 40 struct au1xxx_irqmap __initdata au1xxx_ic0_map[] = { 41 41 42 42 #if defined(CONFIG_SOC_AU1000) 43 - { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 44 - { AU1000_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 45 - { AU1000_UART2_INT, INTC_INT_HIGH_LEVEL, 0}, 46 - { AU1000_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 47 - { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0}, 48 - { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0}, 49 - { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 50 - { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 51 - { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 52 - { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 53 - { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 54 - { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 55 - { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 56 - { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 43 + { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0 }, 44 + { AU1000_UART1_INT, INTC_INT_HIGH_LEVEL, 0 }, 45 + { AU1000_UART2_INT, INTC_INT_HIGH_LEVEL, 0 }, 46 + { AU1000_UART3_INT, INTC_INT_HIGH_LEVEL, 0 }, 47 + { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0 }, 48 + { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0 }, 49 + { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 }, 50 + { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 }, 51 + { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 }, 52 + { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 }, 53 + { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 }, 54 + { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 }, 55 + { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 }, 56 + { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 }, 57 57 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 58 58 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 59 59 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, ··· 62 62 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 63 63 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 64 64 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 65 - { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0}, 66 - { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0}, 65 + { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0 }, 66 + { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0 }, 67 67 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 68 68 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 69 69 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 70 70 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 71 - { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 72 - { AU1000_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 71 + { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 }, 72 + { AU1000_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 }, 73 73 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 74 74 75 75 #elif defined(CONFIG_SOC_AU1500) 76 76 77 - { AU1500_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 77 + { AU1500_UART0_INT, INTC_INT_HIGH_LEVEL, 0 }, 78 78 { AU1000_PCI_INTA, INTC_INT_LOW_LEVEL, 0 }, 79 79 { AU1000_PCI_INTB, INTC_INT_LOW_LEVEL, 0 }, 80 - { AU1500_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 80 + { AU1500_UART3_INT, INTC_INT_HIGH_LEVEL, 0 }, 81 81 { AU1000_PCI_INTC, INTC_INT_LOW_LEVEL, 0 }, 82 82 { AU1000_PCI_INTD, INTC_INT_LOW_LEVEL, 0 }, 83 - { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 84 - { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 85 - { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 86 - { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 87 - { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 88 - { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 89 - { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 90 - { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 83 + { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 }, 84 + { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 }, 85 + { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 }, 86 + { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 }, 87 + { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 }, 88 + { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 }, 89 + { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 }, 90 + { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 }, 91 91 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 92 92 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 93 93 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, ··· 100 100 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 101 101 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 102 102 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 103 - { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 104 - { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 103 + { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 }, 104 + { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 }, 105 105 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 106 106 107 107 #elif defined(CONFIG_SOC_AU1100) 108 108 109 - { AU1100_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 110 - { AU1100_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 111 - { AU1100_SD_INT, INTC_INT_HIGH_LEVEL, 0}, 112 - { AU1100_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 113 - { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0}, 114 - { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0}, 115 - { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0}, 116 - { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0}, 117 - { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0}, 118 - { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0}, 119 - { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0}, 120 - { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0}, 121 - { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0}, 122 - { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0}, 109 + { AU1100_UART0_INT, INTC_INT_HIGH_LEVEL, 0 }, 110 + { AU1100_UART1_INT, INTC_INT_HIGH_LEVEL, 0 }, 111 + { AU1100_SD_INT, INTC_INT_HIGH_LEVEL, 0 }, 112 + { AU1100_UART3_INT, INTC_INT_HIGH_LEVEL, 0 }, 113 + { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0 }, 114 + { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0 }, 115 + { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0 }, 116 + { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0 }, 117 + { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0 }, 118 + { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0 }, 119 + { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0 }, 120 + { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0 }, 121 + { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0 }, 122 + { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0 }, 123 123 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 124 124 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 125 125 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, ··· 128 128 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 129 129 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 130 130 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 131 - { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0}, 132 - { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0}, 131 + { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0 }, 132 + { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0 }, 133 133 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 134 134 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 135 135 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 136 136 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, 137 - { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 138 - /*{ AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0},*/ 139 - { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, 137 + { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 }, 138 + /* { AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0 }, */ 139 + { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0 }, 140 140 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, 141 141 142 142 #elif defined(CONFIG_SOC_AU1550) 143 143 144 - { AU1550_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 144 + { AU1550_UART0_INT, INTC_INT_HIGH_LEVEL, 0 }, 145 145 { AU1550_PCI_INTA, INTC_INT_LOW_LEVEL, 0 }, 146 146 { AU1550_PCI_INTB, INTC_INT_LOW_LEVEL, 0 }, 147 - { AU1550_DDMA_INT, INTC_INT_HIGH_LEVEL, 0}, 148 - { AU1550_CRYPTO_INT, INTC_INT_HIGH_LEVEL, 0}, 147 + { AU1550_DDMA_INT, INTC_INT_HIGH_LEVEL, 0 }, 148 + { AU1550_CRYPTO_INT, INTC_INT_HIGH_LEVEL, 0 }, 149 149 { AU1550_PCI_INTC, INTC_INT_LOW_LEVEL, 0 }, 150 150 { AU1550_PCI_INTD, INTC_INT_LOW_LEVEL, 0 }, 151 151 { AU1550_PCI_RST_INT, INTC_INT_LOW_LEVEL, 0 }, 152 - { AU1550_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 153 - { AU1550_UART3_INT, INTC_INT_HIGH_LEVEL, 0}, 154 - { AU1550_PSC0_INT, INTC_INT_HIGH_LEVEL, 0}, 155 - { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, 156 - { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0}, 157 - { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0}, 152 + { AU1550_UART1_INT, INTC_INT_HIGH_LEVEL, 0 }, 153 + { AU1550_UART3_INT, INTC_INT_HIGH_LEVEL, 0 }, 154 + { AU1550_PSC0_INT, INTC_INT_HIGH_LEVEL, 0 }, 155 + { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0 }, 156 + { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0 }, 157 + { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0 }, 158 158 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 159 159 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 160 160 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, ··· 163 163 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 164 164 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 165 165 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 166 - { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0}, 166 + { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0 }, 167 167 { AU1550_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, 168 168 { AU1550_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, 169 169 { AU1550_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, 170 - { AU1550_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 171 - { AU1550_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, 170 + { AU1550_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0 }, 171 + { AU1550_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0 }, 172 172 173 173 #elif defined(CONFIG_SOC_AU1200) 174 174 175 - { AU1200_UART0_INT, INTC_INT_HIGH_LEVEL, 0}, 175 + { AU1200_UART0_INT, INTC_INT_HIGH_LEVEL, 0 }, 176 176 { AU1200_SWT_INT, INTC_INT_RISE_EDGE, 0 }, 177 - { AU1200_SD_INT, INTC_INT_HIGH_LEVEL, 0}, 178 - { AU1200_DDMA_INT, INTC_INT_HIGH_LEVEL, 0}, 177 + { AU1200_SD_INT, INTC_INT_HIGH_LEVEL, 0 }, 178 + { AU1200_DDMA_INT, INTC_INT_HIGH_LEVEL, 0 }, 179 179 { AU1200_MAE_BE_INT, INTC_INT_HIGH_LEVEL, 0 }, 180 - { AU1200_UART1_INT, INTC_INT_HIGH_LEVEL, 0}, 180 + { AU1200_UART1_INT, INTC_INT_HIGH_LEVEL, 0 }, 181 181 { AU1200_MAE_FE_INT, INTC_INT_HIGH_LEVEL, 0 }, 182 - { AU1200_PSC0_INT, INTC_INT_HIGH_LEVEL, 0}, 183 - { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, 184 - { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0}, 185 - { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0}, 182 + { AU1200_PSC0_INT, INTC_INT_HIGH_LEVEL, 0 }, 183 + { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0 }, 184 + { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0 }, 185 + { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0 }, 186 186 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, 187 187 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 188 188 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, ··· 191 191 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, 192 192 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, 193 193 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, 194 - { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0}, 194 + { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0 }, 195 195 { AU1200_USB_INT, INTC_INT_HIGH_LEVEL, 0 }, 196 - { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, 197 - { AU1200_MAE_BOTH_INT, INTC_INT_HIGH_LEVEL, 0}, 196 + { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0 }, 197 + { AU1200_MAE_BOTH_INT, INTC_INT_HIGH_LEVEL, 0 }, 198 198 199 199 #else 200 200 #error "Error: Unknown Alchemy SOC" ··· 203 203 }; 204 204 205 205 int __initdata au1xxx_ic0_nr_irqs = ARRAY_SIZE(au1xxx_ic0_map); 206 -
+10 -14
arch/mips/au1000/common/clocks.c
··· 1 1 /* 2 2 * BRIEF MODULE DESCRIPTION 3 - * Simple Au1000 clocks routines. 3 + * Simple Au1xx0 clocks routines. 4 4 * 5 - * Copyright 2001 MontaVista Software Inc. 6 - * Author: MontaVista Software, Inc. 7 - * ppopov@mvista.com or source@mvista.com 5 + * Copyright 2001, 2008 MontaVista Software Inc. 6 + * Author: MontaVista Software, Inc. <source@mvista.com> 8 7 * 9 8 * This program is free software; you can redistribute it and/or modify it 10 9 * under the terms of the GNU General Public License as published by the ··· 29 30 #include <linux/module.h> 30 31 #include <asm/mach-au1x00/au1000.h> 31 32 32 - static unsigned int au1x00_clock; // Hz 33 - static unsigned int lcd_clock; // KHz 33 + static unsigned int au1x00_clock; /* Hz */ 34 + static unsigned int lcd_clock; /* KHz */ 34 35 static unsigned long uart_baud_base; 35 36 36 37 /* ··· 45 46 { 46 47 return au1x00_clock; 47 48 } 48 - 49 - 50 49 51 50 /* 52 51 * The UART baud base is not known at compile time ... if ··· 70 73 void set_au1x00_lcd_clock(void) 71 74 { 72 75 unsigned int static_cfg0; 73 - unsigned int sys_busclk = 74 - (get_au1x00_speed()/1000) / 75 - ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2); 76 + unsigned int sys_busclk = (get_au1x00_speed() / 1000) / 77 + ((int)(au_readl(SYS_POWERCTRL) & 0x03) + 2); 76 78 77 79 static_cfg0 = au_readl(MEM_STCFG0); 78 80 79 - if (static_cfg0 & (1<<11)) 81 + if (static_cfg0 & (1 << 11)) 80 82 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */ 81 83 else 82 84 lcd_clock = sys_busclk / 4; 83 85 84 86 if (lcd_clock > 50000) /* Epson MAX */ 85 - printk("warning: LCD clock too high (%d KHz)\n", lcd_clock); 87 + printk(KERN_WARNING "warning: LCD clock too high (%u KHz)\n", 88 + lcd_clock); 86 89 } 87 90 88 91 unsigned int get_au1x00_lcd_clock(void) 89 92 { 90 93 return lcd_clock; 91 94 } 92 - 93 95 EXPORT_SYMBOL(get_au1x00_lcd_clock);
+2 -3
arch/mips/au1000/common/cputable.c
··· 14 14 15 15 #include <asm/mach-au1x00/au1000.h> 16 16 17 - struct cpu_spec* cur_cpu_spec[NR_CPUS]; 17 + struct cpu_spec *cur_cpu_spec[NR_CPUS]; 18 18 19 19 /* With some thought, we can probably use the mask to reduce the 20 20 * size of the table. ··· 39 39 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0, 0 } 40 40 }; 41 41 42 - void 43 - set_cpuspec(void) 42 + void set_cpuspec(void) 44 43 { 45 44 struct cpu_spec *sp; 46 45 u32 prid;
+182 -203
arch/mips/au1000/common/dbdma.c
··· 53 53 */ 54 54 static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock); 55 55 56 - /* I couldn't find a macro that did this...... 57 - */ 56 + /* I couldn't find a macro that did this... */ 58 57 #define ALIGN_ADDR(x, a) ((((u32)(x)) + (a-1)) & ~(a-1)) 59 58 60 59 static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE; 61 - static int dbdma_initialized=0; 60 + static int dbdma_initialized; 62 61 static void au1xxx_dbdma_init(void); 63 62 64 63 static dbdev_tab_t dbdev_tab[] = { ··· 148 149 149 150 { DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, 150 151 151 - #endif // CONFIG_SOC_AU1200 152 + #endif /* CONFIG_SOC_AU1200 */ 152 153 153 154 { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, 154 155 { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, ··· 176 177 177 178 static chan_tab_t *chan_tab_ptr[NUM_DBDMA_CHANS]; 178 179 179 - static dbdev_tab_t * 180 - find_dbdev_id(u32 id) 180 + static dbdev_tab_t *find_dbdev_id(u32 id) 181 181 { 182 182 int i; 183 183 dbdev_tab_t *p; ··· 188 190 return NULL; 189 191 } 190 192 191 - void * au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp) 193 + void *au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp) 192 194 { 193 - return phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 195 + return phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 194 196 } 195 197 EXPORT_SYMBOL(au1xxx_ddma_get_nextptr_virt); 196 198 197 - u32 198 - au1xxx_ddma_add_device(dbdev_tab_t *dev) 199 + u32 au1xxx_ddma_add_device(dbdev_tab_t *dev) 199 200 { 200 201 u32 ret = 0; 201 - dbdev_tab_t *p=NULL; 202 - static u16 new_id=0x1000; 202 + dbdev_tab_t *p; 203 + static u16 new_id = 0x1000; 203 204 204 205 p = find_dbdev_id(~0); 205 - if ( NULL != p ) 206 - { 206 + if (NULL != p) { 207 207 memcpy(p, dev, sizeof(dbdev_tab_t)); 208 208 p->dev_id = DSCR_DEV2CUSTOM_ID(new_id, dev->dev_id); 209 209 ret = p->dev_id; 210 210 new_id++; 211 211 #if 0 212 - printk("add_device: id:%x flags:%x padd:%x\n", 213 - p->dev_id, p->dev_flags, p->dev_physaddr ); 212 + printk(KERN_DEBUG "add_device: id:%x flags:%x padd:%x\n", 213 + p->dev_id, p->dev_flags, p->dev_physaddr); 214 214 #endif 215 215 } 216 216 ··· 216 220 } 217 221 EXPORT_SYMBOL(au1xxx_ddma_add_device); 218 222 219 - /* Allocate a channel and return a non-zero descriptor if successful. 220 - */ 221 - u32 222 - au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, 223 + /* Allocate a channel and return a non-zero descriptor if successful. */ 224 + u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, 223 225 void (*callback)(int, void *), void *callparam) 224 226 { 225 227 unsigned long flags; ··· 228 234 chan_tab_t *ctp; 229 235 au1x_dma_chan_t *cp; 230 236 231 - /* We do the intialization on the first channel allocation. 237 + /* 238 + * We do the intialization on the first channel allocation. 232 239 * We have to wait because of the interrupt handler initialization 233 240 * which can't be done successfully during board set up. 234 241 */ ··· 237 242 au1xxx_dbdma_init(); 238 243 dbdma_initialized = 1; 239 244 240 - if ((stp = find_dbdev_id(srcid)) == NULL) 245 + stp = find_dbdev_id(srcid); 246 + if (stp == NULL) 241 247 return 0; 242 - if ((dtp = find_dbdev_id(destid)) == NULL) 248 + dtp = find_dbdev_id(destid); 249 + if (dtp == NULL) 243 250 return 0; 244 251 245 252 used = 0; 246 253 rv = 0; 247 254 248 - /* Check to see if we can get both channels. 249 - */ 255 + /* Check to see if we can get both channels. */ 250 256 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags); 251 257 if (!(stp->dev_flags & DEV_FLAGS_INUSE) || 252 258 (stp->dev_flags & DEV_FLAGS_ANYUSE)) { ··· 257 261 (dtp->dev_flags & DEV_FLAGS_ANYUSE)) { 258 262 /* Got destination */ 259 263 dtp->dev_flags |= DEV_FLAGS_INUSE; 260 - } 261 - else { 262 - /* Can't get dest. Release src. 263 - */ 264 + } else { 265 + /* Can't get dest. Release src. */ 264 266 stp->dev_flags &= ~DEV_FLAGS_INUSE; 265 267 used++; 266 268 } 267 - } 268 - else { 269 + } else 269 270 used++; 270 - } 271 271 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags); 272 272 273 273 if (!used) { 274 - /* Let's see if we can allocate a channel for it. 275 - */ 274 + /* Let's see if we can allocate a channel for it. */ 276 275 ctp = NULL; 277 276 chan = 0; 278 277 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags); 279 - for (i=0; i<NUM_DBDMA_CHANS; i++) { 278 + for (i = 0; i < NUM_DBDMA_CHANS; i++) 280 279 if (chan_tab_ptr[i] == NULL) { 281 - /* If kmalloc fails, it is caught below same 280 + /* 281 + * If kmalloc fails, it is caught below same 282 282 * as a channel not available. 283 283 */ 284 284 ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC); 285 285 chan_tab_ptr[i] = ctp; 286 286 break; 287 287 } 288 - } 289 288 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags); 290 289 291 290 if (ctp != NULL) { ··· 295 304 ctp->chan_callback = callback; 296 305 ctp->chan_callparam = callparam; 297 306 298 - /* Initialize channel configuration. 299 - */ 307 + /* Initialize channel configuration. */ 300 308 i = 0; 301 309 if (stp->dev_intlevel) 302 310 i |= DDMA_CFG_SED; ··· 316 326 * operations. 317 327 */ 318 328 rv = (u32)(&chan_tab_ptr[chan]); 319 - } 320 - else { 329 + } else { 321 330 /* Release devices */ 322 331 stp->dev_flags &= ~DEV_FLAGS_INUSE; 323 332 dtp->dev_flags &= ~DEV_FLAGS_INUSE; ··· 326 337 } 327 338 EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc); 328 339 329 - /* Set the device width if source or destination is a FIFO. 340 + /* 341 + * Set the device width if source or destination is a FIFO. 330 342 * Should be 8, 16, or 32 bits. 331 343 */ 332 - u32 333 - au1xxx_dbdma_set_devwidth(u32 chanid, int bits) 344 + u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits) 334 345 { 335 346 u32 rv; 336 347 chan_tab_t *ctp; ··· 354 365 } 355 366 EXPORT_SYMBOL(au1xxx_dbdma_set_devwidth); 356 367 357 - /* Allocate a descriptor ring, initializing as much as possible. 358 - */ 359 - u32 360 - au1xxx_dbdma_ring_alloc(u32 chanid, int entries) 368 + /* Allocate a descriptor ring, initializing as much as possible. */ 369 + u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries) 361 370 { 362 371 int i; 363 372 u32 desc_base, srcid, destid; ··· 365 378 dbdev_tab_t *stp, *dtp; 366 379 au1x_ddma_desc_t *dp; 367 380 368 - /* I guess we could check this to be within the 381 + /* 382 + * I guess we could check this to be within the 369 383 * range of the table...... 370 384 */ 371 385 ctp = *((chan_tab_t **)chanid); 372 386 stp = ctp->chan_src; 373 387 dtp = ctp->chan_dest; 374 388 375 - /* The descriptors must be 32-byte aligned. There is a 389 + /* 390 + * The descriptors must be 32-byte aligned. There is a 376 391 * possibility the allocation will give us such an address, 377 392 * and if we try that first we are likely to not waste larger 378 393 * slabs of memory. 379 394 */ 380 395 desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t), 381 - GFP_KERNEL|GFP_DMA); 396 + GFP_KERNEL|GFP_DMA); 382 397 if (desc_base == 0) 383 398 return 0; 384 399 385 400 if (desc_base & 0x1f) { 386 - /* Lost....do it again, allocate extra, and round 401 + /* 402 + * Lost....do it again, allocate extra, and round 387 403 * the address base. 388 404 */ 389 405 kfree((const void *)desc_base); 390 406 i = entries * sizeof(au1x_ddma_desc_t); 391 407 i += (sizeof(au1x_ddma_desc_t) - 1); 392 - if ((desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA)) == 0) 408 + desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA); 409 + if (desc_base == 0) 393 410 return 0; 394 411 395 412 desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t)); 396 413 } 397 414 dp = (au1x_ddma_desc_t *)desc_base; 398 415 399 - /* Keep track of the base descriptor. 400 - */ 416 + /* Keep track of the base descriptor. */ 401 417 ctp->chan_desc_base = dp; 402 418 403 - /* Initialize the rings with as much information as we know. 404 - */ 419 + /* Initialize the rings with as much information as we know. */ 405 420 srcid = stp->dev_id; 406 421 destid = dtp->dev_id; 407 422 ··· 415 426 cmd0 |= DSCR_CMD0_IE | DSCR_CMD0_CV; 416 427 cmd0 |= DSCR_CMD0_ST(DSCR_CMD0_ST_NOCHANGE); 417 428 418 - /* is it mem to mem transfer? */ 419 - if(((DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_THROTTLE) || (DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_ALWAYS)) && 420 - ((DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_THROTTLE) || (DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_ALWAYS))) { 421 - cmd0 |= DSCR_CMD0_MEM; 422 - } 429 + /* Is it mem to mem transfer? */ 430 + if (((DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_THROTTLE) || 431 + (DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_ALWAYS)) && 432 + ((DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_THROTTLE) || 433 + (DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_ALWAYS))) 434 + cmd0 |= DSCR_CMD0_MEM; 423 435 424 436 switch (stp->dev_devwidth) { 425 437 case 8: ··· 448 458 break; 449 459 } 450 460 451 - /* If the device is marked as an in/out FIFO, ensure it is 461 + /* 462 + * If the device is marked as an in/out FIFO, ensure it is 452 463 * set non-coherent. 453 464 */ 454 465 if (stp->dev_flags & DEV_FLAGS_IN) 455 - cmd0 |= DSCR_CMD0_SN; /* Source in fifo */ 466 + cmd0 |= DSCR_CMD0_SN; /* Source in FIFO */ 456 467 if (dtp->dev_flags & DEV_FLAGS_OUT) 457 - cmd0 |= DSCR_CMD0_DN; /* Destination out fifo */ 468 + cmd0 |= DSCR_CMD0_DN; /* Destination out FIFO */ 458 469 459 - /* Set up source1. For now, assume no stride and increment. 470 + /* 471 + * Set up source1. For now, assume no stride and increment. 460 472 * A channel attribute update can change this later. 461 473 */ 462 474 switch (stp->dev_tsize) { ··· 477 485 break; 478 486 } 479 487 480 - /* If source input is fifo, set static address. 481 - */ 488 + /* If source input is FIFO, set static address. */ 482 489 if (stp->dev_flags & DEV_FLAGS_IN) { 483 - if ( stp->dev_flags & DEV_FLAGS_BURSTABLE ) 490 + if (stp->dev_flags & DEV_FLAGS_BURSTABLE) 484 491 src1 |= DSCR_SRC1_SAM(DSCR_xAM_BURST); 485 492 else 486 - src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC); 487 - 493 + src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC); 488 494 } 495 + 489 496 if (stp->dev_physaddr) 490 497 src0 = stp->dev_physaddr; 491 498 492 - /* Set up dest1. For now, assume no stride and increment. 499 + /* 500 + * Set up dest1. For now, assume no stride and increment. 493 501 * A channel attribute update can change this later. 494 502 */ 495 503 switch (dtp->dev_tsize) { ··· 508 516 break; 509 517 } 510 518 511 - /* If destination output is fifo, set static address. 512 - */ 519 + /* If destination output is FIFO, set static address. */ 513 520 if (dtp->dev_flags & DEV_FLAGS_OUT) { 514 - if ( dtp->dev_flags & DEV_FLAGS_BURSTABLE ) 515 - dest1 |= DSCR_DEST1_DAM(DSCR_xAM_BURST); 516 - else 517 - dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC); 521 + if (dtp->dev_flags & DEV_FLAGS_BURSTABLE) 522 + dest1 |= DSCR_DEST1_DAM(DSCR_xAM_BURST); 523 + else 524 + dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC); 518 525 } 526 + 519 527 if (dtp->dev_physaddr) 520 528 dest0 = dtp->dev_physaddr; 521 529 522 530 #if 0 523 - printk("did:%x sid:%x cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", 524 - dtp->dev_id, stp->dev_id, cmd0, cmd1, src0, src1, dest0, dest1 ); 531 + printk(KERN_DEBUG "did:%x sid:%x cmd0:%x cmd1:%x source0:%x " 532 + "source1:%x dest0:%x dest1:%x\n", 533 + dtp->dev_id, stp->dev_id, cmd0, cmd1, src0, 534 + src1, dest0, dest1); 525 535 #endif 526 - for (i=0; i<entries; i++) { 536 + for (i = 0; i < entries; i++) { 527 537 dp->dscr_cmd0 = cmd0; 528 538 dp->dscr_cmd1 = cmd1; 529 539 dp->dscr_source0 = src0; ··· 539 545 dp++; 540 546 } 541 547 542 - /* Make last descrptor point to the first. 543 - */ 548 + /* Make last descrptor point to the first. */ 544 549 dp--; 545 550 dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(ctp->chan_desc_base)); 546 551 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base; 547 552 548 - return (u32)(ctp->chan_desc_base); 553 + return (u32)ctp->chan_desc_base; 549 554 } 550 555 EXPORT_SYMBOL(au1xxx_dbdma_ring_alloc); 551 556 552 - /* Put a source buffer into the DMA ring. 557 + /* 558 + * Put a source buffer into the DMA ring. 553 559 * This updates the source pointer and byte count. Normally used 554 560 * for memory to fifo transfers. 555 561 */ 556 - u32 557 - _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags) 562 + u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags) 558 563 { 559 564 chan_tab_t *ctp; 560 565 au1x_ddma_desc_t *dp; 561 566 562 - /* I guess we could check this to be within the 567 + /* 568 + * I guess we could check this to be within the 563 569 * range of the table...... 564 570 */ 565 - ctp = *((chan_tab_t **)chanid); 571 + ctp = *(chan_tab_t **)chanid; 566 572 567 - /* We should have multiple callers for a particular channel, 573 + /* 574 + * We should have multiple callers for a particular channel, 568 575 * an interrupt doesn't affect this pointer nor the descriptor, 569 576 * so no locking should be needed. 570 577 */ 571 578 dp = ctp->put_ptr; 572 579 573 - /* If the descriptor is valid, we are way ahead of the DMA 580 + /* 581 + * If the descriptor is valid, we are way ahead of the DMA 574 582 * engine, so just return an error condition. 575 583 */ 576 - if (dp->dscr_cmd0 & DSCR_CMD0_V) { 584 + if (dp->dscr_cmd0 & DSCR_CMD0_V) 577 585 return 0; 578 - } 579 586 580 - /* Load up buffer address and byte count. 581 - */ 587 + /* Load up buffer address and byte count. */ 582 588 dp->dscr_source0 = virt_to_phys(buf); 583 589 dp->dscr_cmd1 = nbytes; 584 - /* Check flags */ 590 + /* Check flags */ 585 591 if (flags & DDMA_FLAGS_IE) 586 592 dp->dscr_cmd0 |= DSCR_CMD0_IE; 587 593 if (flags & DDMA_FLAGS_NOIE) ··· 589 595 590 596 /* 591 597 * There is an errata on the Au1200/Au1550 parts that could result 592 - * in "stale" data being DMA'd. It has to do with the snoop logic on 593 - * the dache eviction buffer. NONCOHERENT_IO is on by default for 594 - * these parts. If it is fixedin the future, these dma_cache_inv will 598 + * in "stale" data being DMA'ed. It has to do with the snoop logic on 599 + * the cache eviction buffer. DMA_NONCOHERENT is on by default for 600 + * these parts. If it is fixed in the future, these dma_cache_inv will 595 601 * just be nothing more than empty macros. See io.h. 596 - * */ 602 + */ 597 603 dma_cache_wback_inv((unsigned long)buf, nbytes); 598 - dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 604 + dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 599 605 au_sync(); 600 606 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 601 - ctp->chan_ptr->ddma_dbell = 0; 607 + ctp->chan_ptr->ddma_dbell = 0; 602 608 603 - /* Get next descriptor pointer. 604 - */ 609 + /* Get next descriptor pointer. */ 605 610 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 606 611 607 - /* return something not zero. 608 - */ 612 + /* Return something non-zero. */ 609 613 return nbytes; 610 614 } 611 615 EXPORT_SYMBOL(_au1xxx_dbdma_put_source); ··· 646 654 dp->dscr_dest0 = virt_to_phys(buf); 647 655 dp->dscr_cmd1 = nbytes; 648 656 #if 0 649 - printk("cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", 650 - dp->dscr_cmd0, dp->dscr_cmd1, dp->dscr_source0, 651 - dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1 ); 657 + printk(KERN_DEBUG "cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", 658 + dp->dscr_cmd0, dp->dscr_cmd1, dp->dscr_source0, 659 + dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1); 652 660 #endif 653 661 /* 654 662 * There is an errata on the Au1200/Au1550 parts that could result in 655 - * "stale" data being DMA'd. It has to do with the snoop logic on the 656 - * dache eviction buffer. NONCOHERENT_IO is on by default for these 657 - * parts. If it is fixedin the future, these dma_cache_inv will just 663 + * "stale" data being DMA'ed. It has to do with the snoop logic on the 664 + * cache eviction buffer. DMA_NONCOHERENT is on by default for these 665 + * parts. If it is fixed in the future, these dma_cache_inv will just 658 666 * be nothing more than empty macros. See io.h. 659 - * */ 667 + */ 660 668 dma_cache_inv((unsigned long)buf, nbytes); 661 669 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 662 670 au_sync(); 663 671 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 664 - ctp->chan_ptr->ddma_dbell = 0; 672 + ctp->chan_ptr->ddma_dbell = 0; 665 673 666 - /* Get next descriptor pointer. 667 - */ 674 + /* Get next descriptor pointer. */ 668 675 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 669 676 670 - /* return something not zero. 671 - */ 677 + /* Return something non-zero. */ 672 678 return nbytes; 673 679 } 674 680 EXPORT_SYMBOL(_au1xxx_dbdma_put_dest); 675 681 676 - /* Get a destination buffer into the DMA ring. 682 + /* 683 + * Get a destination buffer into the DMA ring. 677 684 * Normally used to get a full buffer from the ring during fifo 678 685 * to memory transfers. This does not set the valid bit, you will 679 686 * have to put another destination buffer to keep the DMA going. 680 687 */ 681 - u32 682 - au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes) 688 + u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes) 683 689 { 684 690 chan_tab_t *ctp; 685 691 au1x_ddma_desc_t *dp; 686 692 u32 rv; 687 693 688 - /* I guess we could check this to be within the 694 + /* 695 + * I guess we could check this to be within the 689 696 * range of the table...... 690 697 */ 691 698 ctp = *((chan_tab_t **)chanid); 692 699 693 - /* We should have multiple callers for a particular channel, 700 + /* 701 + * We should have multiple callers for a particular channel, 694 702 * an interrupt doesn't affect this pointer nor the descriptor, 695 703 * so no locking should be needed. 696 704 */ 697 705 dp = ctp->get_ptr; 698 706 699 - /* If the descriptor is valid, we are way ahead of the DMA 707 + /* 708 + * If the descriptor is valid, we are way ahead of the DMA 700 709 * engine, so just return an error condition. 701 710 */ 702 711 if (dp->dscr_cmd0 & DSCR_CMD0_V) 703 712 return 0; 704 713 705 - /* Return buffer address and byte count. 706 - */ 714 + /* Return buffer address and byte count. */ 707 715 *buf = (void *)(phys_to_virt(dp->dscr_dest0)); 708 716 *nbytes = dp->dscr_cmd1; 709 717 rv = dp->dscr_stat; 710 718 711 - /* Get next descriptor pointer. 712 - */ 719 + /* Get next descriptor pointer. */ 713 720 ctp->get_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 714 721 715 - /* return something not zero. 716 - */ 722 + /* Return something non-zero. */ 717 723 return rv; 718 724 } 719 - 720 725 EXPORT_SYMBOL_GPL(au1xxx_dbdma_get_dest); 721 726 722 - void 723 - au1xxx_dbdma_stop(u32 chanid) 727 + void au1xxx_dbdma_stop(u32 chanid) 724 728 { 725 729 chan_tab_t *ctp; 726 730 au1x_dma_chan_t *cp; ··· 731 743 udelay(1); 732 744 halt_timeout++; 733 745 if (halt_timeout > 100) { 734 - printk("warning: DMA channel won't halt\n"); 746 + printk(KERN_WARNING "warning: DMA channel won't halt\n"); 735 747 break; 736 748 } 737 749 } ··· 741 753 } 742 754 EXPORT_SYMBOL(au1xxx_dbdma_stop); 743 755 744 - /* Start using the current descriptor pointer. If the dbdma encounters 745 - * a not valid descriptor, it will stop. In this case, we can just 756 + /* 757 + * Start using the current descriptor pointer. If the DBDMA encounters 758 + * a non-valid descriptor, it will stop. In this case, we can just 746 759 * continue by adding a buffer to the list and starting again. 747 760 */ 748 - void 749 - au1xxx_dbdma_start(u32 chanid) 761 + void au1xxx_dbdma_start(u32 chanid) 750 762 { 751 763 chan_tab_t *ctp; 752 764 au1x_dma_chan_t *cp; ··· 761 773 } 762 774 EXPORT_SYMBOL(au1xxx_dbdma_start); 763 775 764 - void 765 - au1xxx_dbdma_reset(u32 chanid) 776 + void au1xxx_dbdma_reset(u32 chanid) 766 777 { 767 778 chan_tab_t *ctp; 768 779 au1x_ddma_desc_t *dp; ··· 771 784 ctp = *((chan_tab_t **)chanid); 772 785 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base; 773 786 774 - /* Run through the descriptors and reset the valid indicator. 775 - */ 787 + /* Run through the descriptors and reset the valid indicator. */ 776 788 dp = ctp->chan_desc_base; 777 789 778 790 do { 779 791 dp->dscr_cmd0 &= ~DSCR_CMD0_V; 780 - /* reset our SW status -- this is used to determine 781 - * if a descriptor is in use by upper level SW. Since 792 + /* 793 + * Reset our software status -- this is used to determine 794 + * if a descriptor is in use by upper level software. Since 782 795 * posting can reset 'V' bit. 783 796 */ 784 797 dp->sw_status = 0; ··· 787 800 } 788 801 EXPORT_SYMBOL(au1xxx_dbdma_reset); 789 802 790 - u32 791 - au1xxx_get_dma_residue(u32 chanid) 803 + u32 au1xxx_get_dma_residue(u32 chanid) 792 804 { 793 805 chan_tab_t *ctp; 794 806 au1x_dma_chan_t *cp; ··· 796 810 ctp = *((chan_tab_t **)chanid); 797 811 cp = ctp->chan_ptr; 798 812 799 - /* This is only valid if the channel is stopped. 800 - */ 813 + /* This is only valid if the channel is stopped. */ 801 814 rv = cp->ddma_bytecnt; 802 815 au_sync(); 803 816 804 817 return rv; 805 818 } 806 - 807 819 EXPORT_SYMBOL_GPL(au1xxx_get_dma_residue); 808 820 809 - void 810 - au1xxx_dbdma_chan_free(u32 chanid) 821 + void au1xxx_dbdma_chan_free(u32 chanid) 811 822 { 812 823 chan_tab_t *ctp; 813 824 dbdev_tab_t *stp, *dtp; ··· 825 842 } 826 843 EXPORT_SYMBOL(au1xxx_dbdma_chan_free); 827 844 828 - static irqreturn_t 829 - dbdma_interrupt(int irq, void *dev_id) 845 + static irqreturn_t dbdma_interrupt(int irq, void *dev_id) 830 846 { 831 847 u32 intstat; 832 848 u32 chan_index; ··· 841 859 cp = ctp->chan_ptr; 842 860 dp = ctp->cur_ptr; 843 861 844 - /* Reset interrupt. 845 - */ 862 + /* Reset interrupt. */ 846 863 cp->ddma_irq = 0; 847 864 au_sync(); 848 865 849 866 if (ctp->chan_callback) 850 - (ctp->chan_callback)(irq, ctp->chan_callparam); 867 + ctp->chan_callback(irq, ctp->chan_callparam); 851 868 852 869 ctp->cur_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 853 870 return IRQ_RETVAL(1); ··· 871 890 872 891 if (request_irq(irq_nr, dbdma_interrupt, IRQF_DISABLED, 873 892 "Au1xxx dbdma", (void *)dbdma_gptr)) 874 - printk("Can't get 1550 dbdma irq"); 893 + printk(KERN_ERR "Can't get 1550 dbdma irq"); 875 894 } 876 895 877 - void 878 - au1xxx_dbdma_dump(u32 chanid) 896 + void au1xxx_dbdma_dump(u32 chanid) 879 897 { 880 - chan_tab_t *ctp; 881 - au1x_ddma_desc_t *dp; 882 - dbdev_tab_t *stp, *dtp; 883 - au1x_dma_chan_t *cp; 884 - u32 i = 0; 898 + chan_tab_t *ctp; 899 + au1x_ddma_desc_t *dp; 900 + dbdev_tab_t *stp, *dtp; 901 + au1x_dma_chan_t *cp; 902 + u32 i = 0; 885 903 886 904 ctp = *((chan_tab_t **)chanid); 887 905 stp = ctp->chan_src; 888 906 dtp = ctp->chan_dest; 889 907 cp = ctp->chan_ptr; 890 908 891 - printk("Chan %x, stp %x (dev %d) dtp %x (dev %d) \n", 892 - (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp, dtp - dbdev_tab); 893 - printk("desc base %x, get %x, put %x, cur %x\n", 894 - (u32)(ctp->chan_desc_base), (u32)(ctp->get_ptr), 895 - (u32)(ctp->put_ptr), (u32)(ctp->cur_ptr)); 909 + printk(KERN_DEBUG "Chan %x, stp %x (dev %d) dtp %x (dev %d) \n", 910 + (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp, 911 + dtp - dbdev_tab); 912 + printk(KERN_DEBUG "desc base %x, get %x, put %x, cur %x\n", 913 + (u32)(ctp->chan_desc_base), (u32)(ctp->get_ptr), 914 + (u32)(ctp->put_ptr), (u32)(ctp->cur_ptr)); 896 915 897 - printk("dbdma chan %x\n", (u32)cp); 898 - printk("cfg %08x, desptr %08x, statptr %08x\n", 899 - cp->ddma_cfg, cp->ddma_desptr, cp->ddma_statptr); 900 - printk("dbell %08x, irq %08x, stat %08x, bytecnt %08x\n", 901 - cp->ddma_dbell, cp->ddma_irq, cp->ddma_stat, cp->ddma_bytecnt); 916 + printk(KERN_DEBUG "dbdma chan %x\n", (u32)cp); 917 + printk(KERN_DEBUG "cfg %08x, desptr %08x, statptr %08x\n", 918 + cp->ddma_cfg, cp->ddma_desptr, cp->ddma_statptr); 919 + printk(KERN_DEBUG "dbell %08x, irq %08x, stat %08x, bytecnt %08x\n", 920 + cp->ddma_dbell, cp->ddma_irq, cp->ddma_stat, 921 + cp->ddma_bytecnt); 902 922 903 - 904 - /* Run through the descriptors 905 - */ 923 + /* Run through the descriptors */ 906 924 dp = ctp->chan_desc_base; 907 925 908 926 do { 909 - printk("Dp[%d]= %08x, cmd0 %08x, cmd1 %08x\n", 910 - i++, (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1); 911 - printk("src0 %08x, src1 %08x, dest0 %08x, dest1 %08x\n", 912 - dp->dscr_source0, dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1); 913 - printk("stat %08x, nxtptr %08x\n", 914 - dp->dscr_stat, dp->dscr_nxtptr); 927 + printk(KERN_DEBUG "Dp[%d]= %08x, cmd0 %08x, cmd1 %08x\n", 928 + i++, (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1); 929 + printk(KERN_DEBUG "src0 %08x, src1 %08x, dest0 %08x, dest1 %08x\n", 930 + dp->dscr_source0, dp->dscr_source1, 931 + dp->dscr_dest0, dp->dscr_dest1); 932 + printk(KERN_DEBUG "stat %08x, nxtptr %08x\n", 933 + dp->dscr_stat, dp->dscr_nxtptr); 915 934 dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 916 935 } while (dp != ctp->chan_desc_base); 917 936 } ··· 919 938 /* Put a descriptor into the DMA ring. 920 939 * This updates the source/destination pointers and byte count. 921 940 */ 922 - u32 923 - au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr ) 941 + u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr) 924 942 { 925 943 chan_tab_t *ctp; 926 944 au1x_ddma_desc_t *dp; 927 - u32 nbytes=0; 945 + u32 nbytes = 0; 928 946 929 - /* I guess we could check this to be within the 930 - * range of the table...... 931 - */ 947 + /* 948 + * I guess we could check this to be within the 949 + * range of the table...... 950 + */ 932 951 ctp = *((chan_tab_t **)chanid); 933 952 934 - /* We should have multiple callers for a particular channel, 935 - * an interrupt doesn't affect this pointer nor the descriptor, 936 - * so no locking should be needed. 937 - */ 953 + /* 954 + * We should have multiple callers for a particular channel, 955 + * an interrupt doesn't affect this pointer nor the descriptor, 956 + * so no locking should be needed. 957 + */ 938 958 dp = ctp->put_ptr; 939 959 940 - /* If the descriptor is valid, we are way ahead of the DMA 941 - * engine, so just return an error condition. 942 - */ 960 + /* 961 + * If the descriptor is valid, we are way ahead of the DMA 962 + * engine, so just return an error condition. 963 + */ 943 964 if (dp->dscr_cmd0 & DSCR_CMD0_V) 944 965 return 0; 945 966 946 - /* Load up buffer addresses and byte count. 947 - */ 967 + /* Load up buffer addresses and byte count. */ 948 968 dp->dscr_dest0 = dscr->dscr_dest0; 949 969 dp->dscr_source0 = dscr->dscr_source0; 950 970 dp->dscr_dest1 = dscr->dscr_dest1; ··· 957 975 dp->dscr_cmd0 |= dscr->dscr_cmd0 | DSCR_CMD0_V; 958 976 ctp->chan_ptr->ddma_dbell = 0; 959 977 960 - /* Get next descriptor pointer. 961 - */ 978 + /* Get next descriptor pointer. */ 962 979 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); 963 980 964 - /* return something not zero. 965 - */ 981 + /* Return something non-zero. */ 966 982 return nbytes; 967 983 } 968 984 969 985 #endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */ 970 -
+11 -21
arch/mips/au1000/common/dbg_io.c
··· 1 + #include <linux/types.h> 1 2 2 3 #include <asm/mach-au1x00/au1000.h> 3 4 ··· 9 8 * uart to be used for debugging. 10 9 */ 11 10 #define DEBUG_BASE UART_DEBUG_BASE 12 - /**/ 13 - 14 - /* we need uint32 uint8 */ 15 - /* #include "types.h" */ 16 - typedef unsigned char uint8; 17 - typedef unsigned int uint32; 18 11 19 12 #define UART16550_BAUD_2400 2400 20 13 #define UART16550_BAUD_4800 4800 ··· 46 51 #define UART_MOD_CNTRL 0x100 /* Module Control */ 47 52 48 53 /* memory-mapped read/write of the port */ 49 - #define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff) 50 - #define UART16550_WRITE(y, z) (au_writel(z&0xff, DEBUG_BASE + y)) 54 + #define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff) 55 + #define UART16550_WRITE(y, z) (au_writel(z & 0xff, DEBUG_BASE + y)) 51 56 52 57 extern unsigned long calc_clock(void); 53 58 54 - void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) 59 + void debugInit(u32 baud, u8 data, u8 parity, u8 stop) 55 60 { 56 - 57 - if (UART16550_READ(UART_MOD_CNTRL) != 0x3) { 61 + if (UART16550_READ(UART_MOD_CNTRL) != 0x3) 58 62 UART16550_WRITE(UART_MOD_CNTRL, 3); 59 - } 60 63 calc_clock(); 61 64 62 65 /* disable interrupts */ ··· 62 69 63 70 /* set up baud rate */ 64 71 { 65 - uint32 divisor; 72 + u32 divisor; 66 73 67 74 /* set divisor */ 68 75 divisor = get_au1x00_uart_baud_base() / baud; ··· 73 80 UART16550_WRITE(UART_LCR, (data | parity | stop)); 74 81 } 75 82 76 - static int remoteDebugInitialized = 0; 83 + static int remoteDebugInitialized; 77 84 78 - uint8 getDebugChar(void) 85 + u8 getDebugChar(void) 79 86 { 80 87 if (!remoteDebugInitialized) { 81 88 remoteDebugInitialized = 1; ··· 85 92 UART16550_STOP_1BIT); 86 93 } 87 94 88 - while((UART16550_READ(UART_LSR) & 0x1) == 0); 95 + while ((UART16550_READ(UART_LSR) & 0x1) == 0); 89 96 return UART16550_READ(UART_RX); 90 97 } 91 98 92 99 93 - int putDebugChar(uint8 byte) 100 + int putDebugChar(u8 byte) 94 101 { 95 - // int i; 96 - 97 102 if (!remoteDebugInitialized) { 98 103 remoteDebugInitialized = 1; 99 104 debugInit(UART16550_BAUD_115200, ··· 100 109 UART16550_STOP_1BIT); 101 110 } 102 111 103 - while ((UART16550_READ(UART_LSR)&0x40) == 0); 112 + while ((UART16550_READ(UART_LSR) & 0x40) == 0); 104 113 UART16550_WRITE(UART_TX, byte); 105 - //for (i=0;i<0xfff;i++); 106 114 107 115 return 1; 108 116 }
+28 -28
arch/mips/au1000/common/dma.c
··· 1 1 /* 2 2 * 3 3 * BRIEF MODULE DESCRIPTION 4 - * A DMA channel allocator for Au1000. API is modeled loosely off of 4 + * A DMA channel allocator for Au1x00. API is modeled loosely off of 5 5 * linux/kernel/dma.c. 6 6 * 7 - * Copyright 2000 MontaVista Software Inc. 8 - * Author: MontaVista Software, Inc. 9 - * stevel@mvista.com or source@mvista.com 7 + * Copyright 2000, 2008 MontaVista Software Inc. 8 + * Author: MontaVista Software, Inc. <source@mvista.com> 10 9 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 11 10 * 12 11 * This program is free software; you can redistribute it and/or modify it ··· 38 39 #include <asm/mach-au1x00/au1000.h> 39 40 #include <asm/mach-au1x00/au1000_dma.h> 40 41 41 - #if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100) 42 + #if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || \ 43 + defined(CONFIG_SOC_AU1100) 42 44 /* 43 45 * A note on resource allocation: 44 46 * ··· 56 56 * returned from request_dma. 57 57 */ 58 58 59 - 60 59 DEFINE_SPINLOCK(au1000_dma_spin_lock); 61 60 62 61 struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = { ··· 70 71 }; 71 72 EXPORT_SYMBOL(au1000_dma_table); 72 73 73 - // Device FIFO addresses and default DMA modes 74 + /* Device FIFO addresses and default DMA modes */ 74 75 static const struct dma_dev { 75 76 unsigned int fifo_addr; 76 77 unsigned int dma_mode; ··· 79 80 {UART0_ADDR + UART_RX, 0}, 80 81 {0, 0}, 81 82 {0, 0}, 82 - {AC97C_DATA, DMA_DW16 }, // coherent 83 - {AC97C_DATA, DMA_DR | DMA_DW16 }, // coherent 83 + {AC97C_DATA, DMA_DW16 }, /* coherent */ 84 + {AC97C_DATA, DMA_DR | DMA_DW16 }, /* coherent */ 84 85 {UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC}, 85 86 {UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC}, 86 87 {USBD_EP0RD, DMA_DR | DMA_DW8 | DMA_NC}, ··· 100 101 struct dma_chan *chan; 101 102 102 103 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { 103 - if ((chan = get_dma_chan(i)) != NULL) { 104 + chan = get_dma_chan(i); 105 + if (chan != NULL) 104 106 len += sprintf(buf + len, "%2d: %s\n", 105 107 i, chan->dev_str); 106 - } 107 108 } 108 109 109 110 if (fpos >= len) { ··· 112 113 return 0; 113 114 } 114 115 *start = buf + fpos; 115 - if ((len -= fpos) > length) 116 + len -= fpos; 117 + if (len > length) 116 118 return length; 117 119 *eof = 1; 118 120 return len; 119 121 } 120 122 121 - // Device FIFO addresses and default DMA modes - 2nd bank 123 + /* Device FIFO addresses and default DMA modes - 2nd bank */ 122 124 static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2] = { 123 - {SD0_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent 124 - {SD0_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8}, // coherent 125 - {SD1_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent 126 - {SD1_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8} // coherent 125 + { SD0_XMIT_FIFO, DMA_DS | DMA_DW8 }, /* coherent */ 126 + { SD0_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8 }, /* coherent */ 127 + { SD1_XMIT_FIFO, DMA_DS | DMA_DW8 }, /* coherent */ 128 + { SD1_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8 } /* coherent */ 127 129 }; 128 130 129 131 void dump_au1000_dma_channel(unsigned int dmanr) ··· 150 150 au_readl(chan->io + DMA_BUFFER1_COUNT)); 151 151 } 152 152 153 - 154 153 /* 155 154 * Finds a free channel, and binds the requested device to it. 156 155 * Returns the allocated channel number, or negative on error. ··· 168 169 if (dev_id < 0 || dev_id >= (DMA_NUM_DEV + DMA_NUM_DEV_BANK2)) 169 170 return -EINVAL; 170 171 #else 171 - if (dev_id < 0 || dev_id >= DMA_NUM_DEV) 172 + if (dev_id < 0 || dev_id >= DMA_NUM_DEV) 172 173 return -EINVAL; 173 174 #endif 174 175 175 - for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) { 176 + for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) 176 177 if (au1000_dma_table[i].dev_id < 0) 177 178 break; 178 - } 179 + 179 180 if (i == NUM_AU1000_DMA_CHANNELS) 180 181 return -ENODEV; 181 182 ··· 184 185 if (dev_id >= DMA_NUM_DEV) { 185 186 dev_id -= DMA_NUM_DEV; 186 187 dev = &dma_dev_table_bank2[dev_id]; 187 - } else { 188 + } else 188 189 dev = &dma_dev_table[dev_id]; 189 - } 190 190 191 191 if (irqhandler) { 192 192 chan->irq = AU1000_DMA_INT_BASE + i; 193 193 chan->irq_dev = irq_dev_id; 194 - if ((ret = request_irq(chan->irq, irqhandler, irqflags, 195 - dev_str, chan->irq_dev))) { 194 + ret = request_irq(chan->irq, irqhandler, irqflags, dev_str, 195 + chan->irq_dev); 196 + if (ret) { 196 197 chan->irq = 0; 197 198 chan->irq_dev = NULL; 198 199 return ret; ··· 202 203 chan->irq_dev = NULL; 203 204 } 204 205 205 - // fill it in 206 + /* fill it in */ 206 207 chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN; 207 208 chan->dev_id = dev_id; 208 209 chan->dev_str = dev_str; ··· 219 220 void free_au1000_dma(unsigned int dmanr) 220 221 { 221 222 struct dma_chan *chan = get_dma_chan(dmanr); 223 + 222 224 if (!chan) { 223 - printk("Trying to free DMA%d\n", dmanr); 225 + printk(KERN_ERR "Error trying to free DMA%d\n", dmanr); 224 226 return; 225 227 } 226 228 ··· 235 235 } 236 236 EXPORT_SYMBOL(free_au1000_dma); 237 237 238 - #endif // AU1000 AU1500 AU1100 238 + #endif /* AU1000 AU1500 AU1100 */
+1 -5
arch/mips/au1000/common/gpio.c
··· 69 69 70 70 static int au1xxx_gpio1_read(unsigned gpio) 71 71 { 72 - return ((gpio1->pinstaterd >> gpio) & 0x01); 72 + return (gpio1->pinstaterd >> gpio) & 0x01; 73 73 } 74 74 75 75 static void au1xxx_gpio1_write(unsigned gpio, int value) ··· 104 104 else 105 105 return au1xxx_gpio1_read(gpio); 106 106 } 107 - 108 107 EXPORT_SYMBOL(au1xxx_gpio_get_value); 109 108 110 109 void au1xxx_gpio_set_value(unsigned gpio, int value) ··· 117 118 else 118 119 au1xxx_gpio1_write(gpio, value); 119 120 } 120 - 121 121 EXPORT_SYMBOL(au1xxx_gpio_set_value); 122 122 123 123 int au1xxx_gpio_direction_input(unsigned gpio) ··· 130 132 131 133 return au1xxx_gpio1_direction_input(gpio); 132 134 } 133 - 134 135 EXPORT_SYMBOL(au1xxx_gpio_direction_input); 135 136 136 137 int au1xxx_gpio_direction_output(unsigned gpio, int value) ··· 143 146 144 147 return au1xxx_gpio1_direction_output(gpio, value); 145 148 } 146 - 147 149 EXPORT_SYMBOL(au1xxx_gpio_direction_output);
+2 -4
arch/mips/au1000/common/irq.c
··· 210 210 au_sync(); 211 211 } 212 212 213 - 214 213 static inline void mask_and_ack_level_irq(unsigned int irq_nr) 215 214 { 216 - 217 215 local_disable_irq(irq_nr); 218 216 au_sync(); 219 217 #if defined(CONFIG_MIPS_PB1000) ··· 261 263 unsigned long flags, new_mask; 262 264 263 265 spin_lock_irqsave(&irq_lock, flags); 264 - for (i = 0; i < 32; i++) { 266 + for (i = 0; i < 32; i++) 265 267 if (mask & (1 << i)) { 266 268 if (controller) 267 269 local_enable_irq(i + 32); 268 270 else 269 271 local_enable_irq(i); 270 272 } 271 - } 273 + 272 274 if (controller) 273 275 new_mask = au_readl(IC1_MASKSET); 274 276 else
+5 -6
arch/mips/au1000/common/pci.c
··· 2 2 * BRIEF MODULE DESCRIPTION 3 3 * Alchemy/AMD Au1x00 PCI support. 4 4 * 5 - * Copyright 2001-2003, 2007 MontaVista Software Inc. 6 - * Author: MontaVista Software, Inc. 7 - * ppopov@mvista.com or source@mvista.com 5 + * Copyright 2001-2003, 2007-2008 MontaVista Software Inc. 6 + * Author: MontaVista Software, Inc. <source@mvista.com> 8 7 * 9 8 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) 10 9 * ··· 85 86 u32 prid = read_c0_prid(); 86 87 87 88 if ((prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) { 88 - au_writel((1 << 16) | au_readl(Au1500_PCI_CFG), 89 - Au1500_PCI_CFG); 90 - printk("Non-coherent PCI accesses enabled\n"); 89 + au_writel((1 << 16) | au_readl(Au1500_PCI_CFG), 90 + Au1500_PCI_CFG); 91 + printk(KERN_INFO "Non-coherent PCI accesses enabled\n"); 91 92 } 92 93 } 93 94 #endif
+4 -3
arch/mips/au1000/common/platform.c
··· 302 302 #endif 303 303 }; 304 304 305 - int __init au1xxx_platform_init(void) 305 + static int __init au1xxx_platform_init(void) 306 306 { 307 307 unsigned int uartclk = get_au1x00_uart_baud_base() * 16; 308 308 int i; 309 309 310 310 /* Fill up uartclk. */ 311 - for (i = 0; au1x00_uart_data[i].flags ; i++) 311 + for (i = 0; au1x00_uart_data[i].flags; i++) 312 312 au1x00_uart_data[i].uartclk = uartclk; 313 313 314 - return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices)); 314 + return platform_add_devices(au1xxx_platform_devices, 315 + ARRAY_SIZE(au1xxx_platform_devices)); 315 316 } 316 317 317 318 arch_initcall(au1xxx_platform_init);
+74 -83
arch/mips/au1000/common/power.c
··· 1 1 /* 2 2 * BRIEF MODULE DESCRIPTION 3 - * Au1000 Power Management routines. 3 + * Au1xx0 Power Management routines. 4 4 * 5 - * Copyright 2001 MontaVista Software Inc. 6 - * Author: MontaVista Software, Inc. 7 - * ppopov@mvista.com or source@mvista.com 5 + * Copyright 2001, 2008 MontaVista Software Inc. 6 + * Author: MontaVista Software, Inc. <source@mvista.com> 8 7 * 9 8 * Some of the routines are right out of init/main.c, whose 10 9 * copyrights apply here. ··· 42 43 #ifdef CONFIG_PM 43 44 44 45 #define DEBUG 1 45 - #ifdef DEBUG 46 - # define DPRINTK(fmt, args...) printk("%s: " fmt, __func__, ## args) 46 + #ifdef DEBUG 47 + #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__, ## args) 47 48 #else 48 - # define DPRINTK(fmt, args...) 49 + #define DPRINTK(fmt, args...) 49 50 #endif 50 51 51 52 static void au1000_calibrate_delay(void); ··· 56 57 57 58 static DEFINE_SPINLOCK(pm_lock); 58 59 59 - /* We need to save/restore a bunch of core registers that are 60 + /* 61 + * We need to save/restore a bunch of core registers that are 60 62 * either volatile or reset to some state across a processor sleep. 61 63 * If reading a register doesn't provide a proper result for a 62 64 * later restore, we have to provide a function for loading that ··· 78 78 static unsigned int sleep_usbdev_enable; 79 79 static unsigned int sleep_static_memctlr[4][3]; 80 80 81 - /* Define this to cause the value you write to /proc/sys/pm/sleep to 81 + /* 82 + * Define this to cause the value you write to /proc/sys/pm/sleep to 82 83 * set the TOY timer for the amount of time you want to sleep. 83 84 * This is done mainly for testing, but may be useful in other cases. 84 85 * The value is number of 32KHz ticks to sleep. 85 86 */ 86 87 #define SLEEP_TEST_TIMEOUT 1 87 - #ifdef SLEEP_TEST_TIMEOUT 88 - static int sleep_ticks; 88 + #ifdef SLEEP_TEST_TIMEOUT 89 + static int sleep_ticks; 89 90 void wakeup_counter0_set(int ticks); 90 91 #endif 91 92 92 - static void 93 - save_core_regs(void) 93 + static void save_core_regs(void) 94 94 { 95 95 extern void save_au1xxx_intctl(void); 96 96 extern void pm_eth0_shutdown(void); 97 97 98 - /* Do the serial ports.....these really should be a pm_* 98 + /* 99 + * Do the serial ports.....these really should be a pm_* 99 100 * registered function by the driver......but of course the 100 101 * standard serial driver doesn't understand our Au1xxx 101 102 * unique registers. ··· 107 106 sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK); 108 107 sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL); 109 108 110 - /* Shutdown USB host/device. 111 - */ 109 + /* Shutdown USB host/device. */ 112 110 sleep_usbhost_enable = au_readl(USB_HOST_CONFIG); 113 111 114 - /* There appears to be some undocumented reset register.... 115 - */ 112 + /* There appears to be some undocumented reset register.... */ 116 113 au_writel(0, 0xb0100004); au_sync(); 117 114 au_writel(0, USB_HOST_CONFIG); au_sync(); 118 115 119 116 sleep_usbdev_enable = au_readl(USBD_ENABLE); 120 117 au_writel(0, USBD_ENABLE); au_sync(); 121 118 122 - /* Save interrupt controller state. 123 - */ 119 + /* Save interrupt controller state. */ 124 120 save_au1xxx_intctl(); 125 121 126 - /* Clocks and PLLs. 127 - */ 122 + /* Clocks and PLLs. */ 128 123 sleep_aux_pll_cntrl = au_readl(SYS_AUXPLL); 129 124 130 - /* We don't really need to do this one, but unless we 125 + /* 126 + * We don't really need to do this one, but unless we 131 127 * write it again it won't have a valid value if we 132 128 * happen to read it. 133 129 */ ··· 132 134 133 135 sleep_pin_function = au_readl(SYS_PINFUNC); 134 136 135 - /* Save the static memory controller configuration. 136 - */ 137 + /* Save the static memory controller configuration. */ 137 138 sleep_static_memctlr[0][0] = au_readl(MEM_STCFG0); 138 139 sleep_static_memctlr[0][1] = au_readl(MEM_STTIME0); 139 140 sleep_static_memctlr[0][2] = au_readl(MEM_STADDR0); ··· 147 150 sleep_static_memctlr[3][2] = au_readl(MEM_STADDR3); 148 151 } 149 152 150 - static void 151 - restore_core_regs(void) 153 + static void restore_core_regs(void) 152 154 { 153 155 extern void restore_au1xxx_intctl(void); 154 156 extern void wakeup_counter0_adjust(void); ··· 156 160 au_writel(sleep_cpu_pll_cntrl, SYS_CPUPLL); au_sync(); 157 161 au_writel(sleep_pin_function, SYS_PINFUNC); au_sync(); 158 162 159 - /* Restore the static memory controller configuration. 160 - */ 163 + /* Restore the static memory controller configuration. */ 161 164 au_writel(sleep_static_memctlr[0][0], MEM_STCFG0); 162 165 au_writel(sleep_static_memctlr[0][1], MEM_STTIME0); 163 166 au_writel(sleep_static_memctlr[0][2], MEM_STADDR0); ··· 170 175 au_writel(sleep_static_memctlr[3][1], MEM_STTIME3); 171 176 au_writel(sleep_static_memctlr[3][2], MEM_STADDR3); 172 177 173 - /* Enable the UART if it was enabled before sleep. 178 + /* 179 + * Enable the UART if it was enabled before sleep. 174 180 * I guess I should define module control bits........ 175 181 */ 176 182 if (sleep_uart0_enable & 0x02) { ··· 198 202 int au_sleep(void) 199 203 { 200 204 unsigned long wakeup, flags; 201 - extern void save_and_sleep(void); 205 + extern void save_and_sleep(void); 202 206 203 207 spin_lock_irqsave(&pm_lock, flags); 204 208 ··· 206 210 207 211 flush_cache_all(); 208 212 209 - /** The code below is all system dependent and we should probably 213 + /** 214 + ** The code below is all system dependent and we should probably 210 215 ** have a function call out of here to set this up. You need 211 216 ** to configure the GPIO or timer interrupts that will bring 212 217 ** you out of sleep. 213 218 ** For testing, the TOY counter wakeup is useful. 214 219 **/ 215 - 216 220 #if 0 217 221 au_writel(au_readl(SYS_PINSTATERD) & ~(1 << 11), SYS_PINSTATERD); 218 222 219 - /* gpio 6 can cause a wake up event */ 223 + /* GPIO 6 can cause a wake up event */ 220 224 wakeup = au_readl(SYS_WAKEMSK); 221 225 wakeup &= ~(1 << 8); /* turn off match20 wakeup */ 222 - wakeup |= 1 << 6; /* turn on gpio 6 wakeup */ 226 + wakeup |= 1 << 6; /* turn on GPIO 6 wakeup */ 223 227 #else 224 - /* For testing, allow match20 to wake us up. 225 - */ 228 + /* For testing, allow match20 to wake us up. */ 226 229 #ifdef SLEEP_TEST_TIMEOUT 227 230 wakeup_counter0_set(sleep_ticks); 228 231 #endif ··· 235 240 236 241 save_and_sleep(); 237 242 238 - /* after a wakeup, the cpu vectors back to 0x1fc00000 so 243 + /* 244 + * After a wakeup, the cpu vectors back to 0x1fc00000, so 239 245 * it's up to the boot code to get us back here. 240 246 */ 241 247 restore_core_regs(); ··· 244 248 return 0; 245 249 } 246 250 247 - static int pm_do_sleep(ctl_table * ctl, int write, struct file *file, 248 - void __user *buffer, size_t * len, loff_t *ppos) 251 + static int pm_do_sleep(ctl_table *ctl, int write, struct file *file, 252 + void __user *buffer, size_t *len, loff_t *ppos) 249 253 { 250 254 #ifdef SLEEP_TEST_TIMEOUT 251 255 #define TMPBUFLEN2 16 252 256 char buf[TMPBUFLEN2], *p; 253 257 #endif 254 258 255 - if (!write) { 259 + if (!write) 256 260 *len = 0; 257 - } else { 261 + else { 258 262 #ifdef SLEEP_TEST_TIMEOUT 259 - if (*len > TMPBUFLEN2 - 1) { 263 + if (*len > TMPBUFLEN2 - 1) 260 264 return -EFAULT; 261 - } 262 - if (copy_from_user(buf, buffer, *len)) { 265 + if (copy_from_user(buf, buffer, *len)) 263 266 return -EFAULT; 264 - } 265 267 buf[*len] = 0; 266 268 p = buf; 267 269 sleep_ticks = simple_strtoul(p, &p, 0); ··· 270 276 return 0; 271 277 } 272 278 273 - static int pm_do_freq(ctl_table * ctl, int write, struct file *file, 274 - void __user *buffer, size_t * len, loff_t *ppos) 279 + static int pm_do_freq(ctl_table *ctl, int write, struct file *file, 280 + void __user *buffer, size_t *len, loff_t *ppos) 275 281 { 276 282 int retval = 0, i; 277 283 unsigned long val, pll; ··· 279 285 #define MAX_CPU_FREQ 396 280 286 char buf[TMPBUFLEN], *p; 281 287 unsigned long flags, intc0_mask, intc1_mask; 282 - unsigned long old_baud_base, old_cpu_freq, baud_rate, old_clk, 283 - old_refresh; 288 + unsigned long old_baud_base, old_cpu_freq, old_clk, old_refresh; 284 289 unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh; 290 + unsigned long baud_rate; 285 291 286 292 spin_lock_irqsave(&pm_lock, flags); 287 - if (!write) { 293 + if (!write) 288 294 *len = 0; 289 - } else { 295 + else { 290 296 /* Parse the new frequency */ 291 297 if (*len > TMPBUFLEN - 1) { 292 298 spin_unlock_irqrestore(&pm_lock, flags); ··· 306 312 307 313 pll = val / 12; 308 314 if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */ 309 - /* revisit this for higher speed cpus */ 315 + /* Revisit this for higher speed CPUs */ 310 316 spin_unlock_irqrestore(&pm_lock, flags); 311 317 return -EFAULT; 312 318 } ··· 315 321 old_cpu_freq = get_au1x00_speed(); 316 322 317 323 new_cpu_freq = pll * 12 * 1000000; 318 - new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16)); 324 + new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL) 325 + & 0x03) + 2) * 16)); 319 326 set_au1x00_speed(new_cpu_freq); 320 327 set_au1x00_uart_baud_base(new_baud_base); 321 328 322 329 old_refresh = au_readl(MEM_SDREFCFG) & 0x1ffffff; 323 - new_refresh = 324 - ((old_refresh * new_cpu_freq) / 325 - old_cpu_freq) | (au_readl(MEM_SDREFCFG) & ~0x1ffffff); 330 + new_refresh = ((old_refresh * new_cpu_freq) / old_cpu_freq) | 331 + (au_readl(MEM_SDREFCFG) & ~0x1ffffff); 326 332 327 333 au_writel(pll, SYS_CPUPLL); 328 334 au_sync_delay(1); 329 335 au_writel(new_refresh, MEM_SDREFCFG); 330 336 au_sync_delay(1); 331 337 332 - for (i = 0; i < 4; i++) { 333 - if (au_readl 334 - (UART_BASE + UART_MOD_CNTRL + 335 - i * 0x00100000) == 3) { 336 - old_clk = 337 - au_readl(UART_BASE + UART_CLK + 338 - i * 0x00100000); 339 - // baud_rate = baud_base/clk 338 + for (i = 0; i < 4; i++) 339 + if (au_readl(UART_BASE + UART_MOD_CNTRL + 340 + i * 0x00100000) == 3) { 341 + old_clk = au_readl(UART_BASE + UART_CLK + 342 + i * 0x00100000); 340 343 baud_rate = old_baud_base / old_clk; 341 - /* we won't get an exact baud rate and the error 344 + /* 345 + * We won't get an exact baud rate and the error 342 346 * could be significant enough that our new 343 347 * calculation will result in a clock that will 344 348 * give us a baud rate that's too far off from ··· 351 359 else if (baud_rate > 17000) 352 360 baud_rate = 19200; 353 361 else 354 - (baud_rate = 9600); 355 - // new_clk = new_baud_base/baud_rate 362 + baud_rate = 9600; 356 363 new_clk = new_baud_base / baud_rate; 357 - au_writel(new_clk, 358 - UART_BASE + UART_CLK + 359 - i * 0x00100000); 364 + au_writel(new_clk, UART_BASE + UART_CLK + 365 + i * 0x00100000); 360 366 au_sync_delay(10); 361 367 } 362 - } 363 368 } 364 - 365 369 366 370 /* 367 371 * We don't want _any_ interrupts other than match20. Otherwise our ··· 416 428 417 429 __initcall(pm_init); 418 430 419 - 420 431 /* 421 432 * This is right out of init/main.c 422 433 */ 423 434 424 - /* This is the number of bits of precision for the loops_per_jiffy. Each 425 - bit takes on average 1.5/HZ seconds. This (like the original) is a little 426 - better than 1% */ 435 + /* 436 + * This is the number of bits of precision for the loops_per_jiffy. 437 + * Each bit takes on average 1.5/HZ seconds. This (like the original) 438 + * is a little better than 1%. 439 + */ 427 440 #define LPS_PREC 8 428 441 429 442 static void au1000_calibrate_delay(void) ··· 432 443 unsigned long ticks, loopbit; 433 444 int lps_precision = LPS_PREC; 434 445 435 - loops_per_jiffy = (1 << 12); 446 + loops_per_jiffy = 1 << 12; 436 447 437 448 while (loops_per_jiffy <<= 1) { 438 - /* wait for "start of" clock tick */ 449 + /* Wait for "start of" clock tick */ 439 450 ticks = jiffies; 440 451 while (ticks == jiffies) 441 452 /* nothing */ ; 442 - /* Go .. */ 453 + /* Go ... */ 443 454 ticks = jiffies; 444 455 __delay(loops_per_jiffy); 445 456 ticks = jiffies - ticks; ··· 447 458 break; 448 459 } 449 460 450 - /* Do a binary approximation to get loops_per_jiffy set to equal one clock 451 - (up to lps_precision bits) */ 461 + /* 462 + * Do a binary approximation to get loops_per_jiffy set to be equal 463 + * one clock (up to lps_precision bits) 464 + */ 452 465 loops_per_jiffy >>= 1; 453 466 loopbit = loops_per_jiffy; 454 467 while (lps_precision-- && (loopbit >>= 1)) { ··· 463 472 loops_per_jiffy &= ~loopbit; 464 473 } 465 474 } 466 - #endif /* CONFIG_PM */ 475 + #endif /* CONFIG_PM */
+9 -12
arch/mips/au1000/common/prom.c
··· 3 3 * BRIEF MODULE DESCRIPTION 4 4 * PROM library initialisation code, supports YAMON and U-Boot. 5 5 * 6 - * Copyright 2000, 2001, 2006 MontaVista Software Inc. 7 - * Author: MontaVista Software, Inc. 8 - * ppopov@mvista.com or source@mvista.com 6 + * Copyright 2000-2001, 2006, 2008 MontaVista Software Inc. 7 + * Author: MontaVista Software, Inc. <source@mvista.com> 9 8 * 10 9 * This file was derived from Carsten Langgaard's 11 10 * arch/mips/mips-boards/xx files. ··· 56 57 actr = 1; /* Always ignore argv[0] */ 57 58 58 59 cp = &(arcs_cmdline[0]); 59 - while(actr < prom_argc) { 60 + while (actr < prom_argc) { 60 61 strcpy(cp, prom_argv[actr]); 61 62 cp += strlen(prom_argv[actr]); 62 63 *cp++ = ' '; ··· 83 84 if (yamon) { 84 85 if (strcmp(envname, *env++) == 0) 85 86 return *env; 86 - } else { 87 - if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=') 88 - return *env + i + 1; 89 - } 87 + } else if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=') 88 + return *env + i + 1; 90 89 env++; 91 90 } 92 91 ··· 107 110 { 108 111 int i; 109 112 110 - for(i = 0; i < 6; i++) { 113 + for (i = 0; i < 6; i++) { 111 114 unsigned char num; 112 115 113 - if((*str == '.') || (*str == ':')) 116 + if ((*str == '.') || (*str == ':')) 114 117 str++; 115 - num = str2hexnum(*str++) << 4; 116 - num |= (str2hexnum(*str++)); 118 + num = str2hexnum(*str++) << 4; 119 + num |= str2hexnum(*str++); 117 120 ea[i] = num; 118 121 } 119 122 }
+17 -18
arch/mips/au1000/common/puts.c
··· 1 1 /* 2 2 * 3 3 * BRIEF MODULE DESCRIPTION 4 - * Low level uart routines to directly access a 16550 uart. 4 + * Low level UART routines to directly access Alchemy UART. 5 5 * 6 - * Copyright 2001 MontaVista Software Inc. 7 - * Author: MontaVista Software, Inc. 8 - * ppopov@mvista.com or source@mvista.com 6 + * Copyright 2001, 2008 MontaVista Software Inc. 7 + * Author: MontaVista Software, Inc. <source@mvista.com> 9 8 * 10 9 * This program is free software; you can redistribute it and/or modify it 11 10 * under the terms of the GNU General Public License as published by the ··· 39 40 40 41 static volatile unsigned long * const com1 = (unsigned long *)SERIAL_BASE; 41 42 42 - 43 43 #ifdef SLOW_DOWN 44 44 static inline void slow_down(void) 45 45 { 46 - int k; 47 - for (k=0; k<10000; k++); 46 + int k; 47 + 48 + for (k = 0; k < 10000; k++); 48 49 } 49 50 #else 50 51 #define slow_down() ··· 53 54 void 54 55 prom_putchar(const unsigned char c) 55 56 { 56 - unsigned char ch; 57 - int i = 0; 57 + unsigned char ch; 58 + int i = 0; 58 59 59 - do { 60 - ch = com1[SER_CMD]; 61 - slow_down(); 62 - i++; 63 - if (i>TIMEOUT) { 64 - break; 65 - } 66 - } while (0 == (ch & TX_BUSY)); 67 - com1[SER_DATA] = c; 60 + do { 61 + ch = com1[SER_CMD]; 62 + slow_down(); 63 + i++; 64 + if (i > TIMEOUT) 65 + break; 66 + } while (0 == (ch & TX_BUSY)); 67 + 68 + com1[SER_DATA] = c; 68 69 }
+15 -18
arch/mips/au1000/common/reset.c
··· 1 1 /* 2 2 * 3 3 * BRIEF MODULE DESCRIPTION 4 - * Au1000 reset routines. 4 + * Au1xx0 reset routines. 5 5 * 6 - * Copyright 2001 MontaVista Software Inc. 7 - * Author: MontaVista Software, Inc. 8 - * ppopov@mvista.com or source@mvista.com 6 + * Copyright 2001, 2006, 2008 MontaVista Software Inc. 7 + * Author: MontaVista Software, Inc. <source@mvista.com> 9 8 * 10 9 * This program is free software; you can redistribute it and/or modify it 11 10 * under the terms of the GNU General Public License as published by the ··· 27 28 * 675 Mass Ave, Cambridge, MA 02139, USA. 28 29 */ 29 30 31 + #include <asm/cacheflush.h> 32 + 30 33 #include <asm/mach-au1x00/au1000.h> 31 34 32 35 extern int au_sleep(void); 33 - extern void (*flush_cache_all)(void); 34 36 35 37 void au1000_restart(char *command) 36 38 { ··· 40 40 u32 prid = read_c0_prid(); 41 41 42 42 printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n"); 43 - switch (prid & 0xFF000000) 44 - { 43 + 44 + switch (prid & 0xFF000000) { 45 45 case 0x00000000: /* Au1000 */ 46 46 au_writel(0x02, 0xb0000010); /* ac97_enable */ 47 47 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ ··· 138 138 au_writel(0x00, 0xb1900064); /* sys_auxpll */ 139 139 au_writel(0x00, 0xb1900100); /* sys_pininputen */ 140 140 break; 141 - 142 - default: 143 - break; 144 141 } 145 142 146 143 set_c0_status(ST0_BEV | ST0_ERL); ··· 155 158 void au1000_halt(void) 156 159 { 157 160 #if defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550) 158 - /* power off system */ 159 - printk("\n** Powering off...\n"); 160 - au_writew(au_readw(0xAF00001C) | (3<<14), 0xAF00001C); 161 + /* Power off system */ 162 + printk(KERN_NOTICE "\n** Powering off...\n"); 163 + au_writew(au_readw(0xAF00001C) | (3 << 14), 0xAF00001C); 161 164 au_sync(); 162 - while(1); /* should not get here */ 165 + while (1); /* should not get here */ 163 166 #else 164 167 printk(KERN_NOTICE "\n** You can safely turn off the power\n"); 165 168 #ifdef CONFIG_MIPS_MIRAGE 166 169 au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT); 167 170 #endif 168 171 #ifdef CONFIG_MIPS_DB1200 169 - au_writew(au_readw(0xB980001C) | (1<<14), 0xB980001C); 172 + au_writew(au_readw(0xB980001C) | (1 << 14), 0xB980001C); 170 173 #endif 171 174 #ifdef CONFIG_PM 172 175 au_sleep(); 173 176 174 - /* should not get here */ 175 - printk(KERN_ERR "Unable to put cpu in sleep mode\n"); 176 - while(1); 177 + /* Should not get here */ 178 + printk(KERN_ERR "Unable to put CPU in sleep mode\n"); 179 + while (1); 177 180 #else 178 181 while (1) 179 182 __asm__(".set\tmips3\n\t"
+28 -32
arch/mips/au1000/common/setup.c
··· 1 1 /* 2 - * Copyright 2000 MontaVista Software Inc. 3 - * Author: MontaVista Software, Inc. 4 - * ppopov@mvista.com or source@mvista.com 2 + * Copyright 2000, 2007-2008 MontaVista Software Inc. 3 + * Author: MontaVista Software, Inc. <source@mvista.com 5 4 * 6 5 * Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc. 7 6 * ··· 47 48 { 48 49 struct cpu_spec *sp; 49 50 char *argptr; 50 - unsigned long prid, cpufreq, bclk = 1; 51 + unsigned long prid, cpufreq, bclk; 51 52 52 53 set_cpuspec(); 53 54 sp = cur_cpu_spec[0]; ··· 65 66 cpufreq = (au_readl(SYS_CPUPLL) & 0x3F) * 12; 66 67 printk(KERN_INFO "(PRID %08lx) @ %ld MHz\n", prid, cpufreq); 67 68 68 - bclk = sp->cpu_bclk; 69 - if (bclk) 70 - { 69 + if (sp->cpu_bclk) { 71 70 /* Enable BCLK switching */ 72 - bclk = au_readl(0xB190003C); 73 - au_writel(bclk | 0x60, 0xB190003C); 74 - printk("BCLK switching enabled!\n"); 71 + bclk = au_readl(SYS_POWERCTRL); 72 + au_writel(bclk | 0x60, SYS_POWERCTRL); 73 + printk(KERN_INFO "BCLK switching enabled!\n"); 75 74 } 76 75 77 - if (sp->cpu_od) { 78 - /* Various early Au1000 Errata corrected by this */ 79 - set_c0_config(1<<19); /* Set Config[OD] */ 80 - } 81 - else { 76 + if (sp->cpu_od) 77 + /* Various early Au1xx0 errata corrected by this */ 78 + set_c0_config(1 << 19); /* Set Config[OD] */ 79 + else 82 80 /* Clear to obtain best system bus performance */ 83 - clear_c0_config(1<<19); /* Clear Config[OD] */ 84 - } 81 + clear_c0_config(1 << 19); /* Clear Config[OD] */ 85 82 86 83 argptr = prom_getcmdline(); 87 84 88 85 #ifdef CONFIG_SERIAL_8250_CONSOLE 89 - if ((argptr = strstr(argptr, "console=")) == NULL) { 86 + argptr = strstr(argptr, "console="); 87 + if (argptr == NULL) { 90 88 argptr = prom_getcmdline(); 91 89 strcat(argptr, " console=ttyS0,115200"); 92 90 } 93 91 #endif 94 92 95 93 #ifdef CONFIG_FB_AU1100 96 - if ((argptr = strstr(argptr, "video=")) == NULL) { 97 - argptr = prom_getcmdline(); 98 - /* default panel */ 99 - /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/ 100 - } 94 + argptr = strstr(argptr, "video="); 95 + if (argptr == NULL) { 96 + argptr = prom_getcmdline(); 97 + /* default panel */ 98 + /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/ 99 + } 101 100 #endif 102 - 103 101 104 102 #if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000) 105 103 /* au1000 does not support vra, au1500 and au1100 do */ ··· 125 129 /* This routine should be valid for all Au1x based boards */ 126 130 phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size) 127 131 { 128 - /* Don't fixup 36 bit addresses */ 132 + /* Don't fixup 36-bit addresses */ 129 133 if ((phys_addr >> 32) != 0) 130 134 return phys_addr; 131 135 ··· 141 145 } 142 146 #endif 143 147 144 - /* All Au1x SOCs have a pcmcia controller */ 145 - /* We setup our 32 bit pseudo addresses to be equal to the 146 - * 36 bit addr >> 4, to make it easier to check the address 148 + /* 149 + * All Au1xx0 SOCs have a PCMCIA controller. 150 + * We setup our 32-bit pseudo addresses to be equal to the 151 + * 36-bit addr >> 4, to make it easier to check the address 147 152 * and fix it. 148 - * The Au1x socket 0 phys attribute address is 0xF 4000 0000. 153 + * The PCMCIA socket 0 physical attribute address is 0xF 4000 0000. 149 154 * The pseudo address we use is 0xF400 0000. Any address over 150 - * 0xF400 0000 is a pcmcia pseudo address. 155 + * 0xF400 0000 is a PCMCIA pseudo address. 151 156 */ 152 - if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF)) { 157 + if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF)) 153 158 return (phys_t)(phys_addr << 4); 154 - } 155 159 156 160 /* default nop */ 157 161 return phys_addr;
+35 -43
arch/mips/au1000/common/time.c
··· 25 25 * 26 26 * Setting up the clock on the MIPS boards. 27 27 * 28 - * Update. Always configure the kernel with CONFIG_NEW_TIME_C. This 29 - * will use the user interface gettimeofday() functions from the 30 - * arch/mips/kernel/time.c, and we provide the clock interrupt processing 31 - * and the timer offset compute functions. If CONFIG_PM is selected, 32 - * we also ensure the 32KHz timer is available. -- Dan 28 + * We provide the clock interrupt processing and the timer offset compute 29 + * functions. If CONFIG_PM is selected, we also ensure the 32KHz timer is 30 + * available. -- Dan 33 31 */ 34 32 35 33 #include <linux/types.h> ··· 45 47 #if HZ < 100 || HZ > 1000 46 48 #error "unsupported HZ value! Must be in [100,1000]" 47 49 #endif 48 - #define MATCH20_INC (328*100/HZ) /* magic number 328 is for HZ=100... */ 49 - extern void startup_match20_interrupt(irq_handler_t handler); 50 + #define MATCH20_INC (328 * 100 / HZ) /* magic number 328 is for HZ=100... */ 50 51 static unsigned long last_pc0, last_match20; 51 52 #endif 52 53 ··· 58 61 { 59 62 unsigned long pc0; 60 63 int time_elapsed; 61 - static int jiffie_drift = 0; 64 + static int jiffie_drift; 62 65 63 66 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) { 64 67 /* should never happen! */ ··· 67 70 } 68 71 69 72 pc0 = au_readl(SYS_TOYREAD); 70 - if (pc0 < last_match20) { 73 + if (pc0 < last_match20) 71 74 /* counter overflowed */ 72 75 time_elapsed = (0xffffffff - last_match20) + pc0; 73 - } 74 - else { 76 + else 75 77 time_elapsed = pc0 - last_match20; 76 - } 77 78 78 79 while (time_elapsed > 0) { 79 80 do_timer(1); ··· 87 92 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 88 93 au_sync(); 89 94 90 - /* our counter ticks at 10.009765625 ms/tick, we we're running 91 - * almost 10uS too slow per tick. 95 + /* 96 + * Our counter ticks at 10.009765625 ms/tick, we we're running 97 + * almost 10 uS too slow per tick. 92 98 */ 93 99 94 100 if (jiffie_drift >= 999) { ··· 113 117 /* When we wakeup from sleep, we have to "catch up" on all of the 114 118 * timer ticks we have missed. 115 119 */ 116 - void 117 - wakeup_counter0_adjust(void) 120 + void wakeup_counter0_adjust(void) 118 121 { 119 122 unsigned long pc0; 120 123 int time_elapsed; 121 124 122 125 pc0 = au_readl(SYS_TOYREAD); 123 - if (pc0 < last_match20) { 126 + if (pc0 < last_match20) 124 127 /* counter overflowed */ 125 128 time_elapsed = (0xffffffff - last_match20) + pc0; 126 - } 127 - else { 129 + else 128 130 time_elapsed = pc0 - last_match20; 129 - } 130 131 131 132 while (time_elapsed > 0) { 132 133 time_elapsed -= MATCH20_INC; ··· 136 143 137 144 } 138 145 139 - /* This is just for debugging to set the timer for a sleep delay. 140 - */ 141 - void 142 - wakeup_counter0_set(int ticks) 146 + /* This is just for debugging to set the timer for a sleep delay. */ 147 + void wakeup_counter0_set(int ticks) 143 148 { 144 149 unsigned long pc0; 145 150 ··· 148 157 } 149 158 #endif 150 159 151 - /* I haven't found anyone that doesn't use a 12 MHz source clock, 160 + /* 161 + * I haven't found anyone that doesn't use a 12 MHz source clock, 152 162 * but just in case..... 153 163 */ 154 164 #define AU1000_SRC_CLK 12000000 155 165 156 166 /* 157 167 * We read the real processor speed from the PLL. This is important 158 - * because it is more accurate than computing it from the 32KHz 168 + * because it is more accurate than computing it from the 32 KHz 159 169 * counter, if it exists. If we don't have an accurate processor 160 170 * speed, all of the peripherals that derive their clocks based on 161 171 * this advertised speed will introduce error and sometimes not work 162 172 * properly. This function is futher convoluted to still allow configurations 163 173 * to do that in case they have really, really old silicon with a 164 - * write-only PLL register, that we need the 32KHz when power management 165 - * "wait" is enabled, and we need to detect if the 32KHz isn't present 174 + * write-only PLL register, that we need the 32 KHz when power management 175 + * "wait" is enabled, and we need to detect if the 32 KHz isn't present 166 176 * but requested......got it? :-) -- Dan 167 177 */ 168 178 unsigned long calc_clock(void) ··· 174 182 175 183 spin_lock_irqsave(&time_lock, flags); 176 184 177 - /* Power management cares if we don't have a 32KHz counter. 178 - */ 185 + /* Power management cares if we don't have a 32 KHz counter. */ 179 186 no_au1xxx_32khz = 0; 180 187 counter = au_readl(SYS_COUNTER_CNTRL); 181 188 if (counter & SYS_CNTRL_E0) { ··· 184 193 185 194 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S); 186 195 /* RTC now ticks at 32.768/16 kHz */ 187 - au_writel(trim_divide-1, SYS_RTCTRIM); 196 + au_writel(trim_divide - 1, SYS_RTCTRIM); 188 197 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S); 189 198 190 199 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S); ··· 206 215 #endif 207 216 else 208 217 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK; 218 + /* On Alchemy CPU:counter ratio is 1:1 */ 209 219 mips_hpt_frequency = cpu_speed; 210 - // Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) 211 - set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16)); 220 + /* Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) */ 221 + set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL) 222 + & 0x03) + 2) * 16)); 212 223 spin_unlock_irqrestore(&time_lock, flags); 213 224 return cpu_speed; 214 225 } ··· 221 228 222 229 est_freq += 5000; /* round */ 223 230 est_freq -= est_freq%10000; 224 - printk("CPU frequency %d.%02d MHz\n", est_freq/1000000, 225 - (est_freq%1000000)*100/1000000); 226 - set_au1x00_speed(est_freq); 227 - set_au1x00_lcd_clock(); // program the LCD clock 231 + printk(KERN_INFO "CPU frequency %u.%02u MHz\n", 232 + est_freq / 1000000, ((est_freq % 1000000) * 100) / 1000000); 233 + set_au1x00_speed(est_freq); 234 + set_au1x00_lcd_clock(); /* program the LCD clock */ 228 235 229 236 #ifdef CONFIG_PM 230 237 /* ··· 236 243 * counter 0 interrupt as a special irq and it doesn't show 237 244 * up under /proc/interrupts. 238 245 * 239 - * Check to ensure we really have a 32KHz oscillator before 246 + * Check to ensure we really have a 32 KHz oscillator before 240 247 * we do this. 241 248 */ 242 249 if (no_au1xxx_32khz) 243 - printk("WARNING: no 32KHz clock found.\n"); 250 + printk(KERN_WARNING "WARNING: no 32KHz clock found.\n"); 244 251 else { 245 252 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); 246 253 au_writel(0, SYS_TOYWRITE); 247 254 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); 248 255 249 - au_writel(au_readl(SYS_WAKEMSK) | (1<<8), SYS_WAKEMSK); 256 + au_writel(au_readl(SYS_WAKEMSK) | (1 << 8), SYS_WAKEMSK); 250 257 au_writel(~0, SYS_WAKESRC); 251 258 au_sync(); 252 259 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 253 260 254 - /* setup match20 to interrupt once every HZ */ 261 + /* Setup match20 to interrupt once every HZ */ 255 262 last_pc0 = last_match20 = au_readl(SYS_TOYREAD); 256 263 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 257 264 au_sync(); 258 265 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 259 266 setup_irq(AU1000_TOY_MATCH2_INT, &counter0_action); 260 267 261 - /* We can use the real 'wait' instruction. 262 - */ 268 + /* We can use the real 'wait' instruction. */ 263 269 allow_au1k_wait = 1; 264 270 } 265 271