Changeset 5097
- Timestamp:
- Feb 9, 2010 11:22:33 AM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
-
mainboard/amd/norwich/romstage.c (modified) (1 diff)
-
mainboard/olpc/btest/romstage.c (modified) (1 diff)
-
mainboard/olpc/rev_a/romstage.c (modified) (1 diff)
-
southbridge/amd/cs5536/cs5536.c (modified) (8 diffs)
-
southbridge/amd/cs5536/cs5536_early_setup.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mainboard/amd/norwich/romstage.c
r5092 r5097 116 116 */ 117 117 /* If debug. real setup done in chipset init via Config.lb. */ 118 cs5536_setup_onchipuart( );118 cs5536_setup_onchipuart(1); 119 119 mb_gpio_init(); 120 120 uart_init(); -
trunk/src/mainboard/olpc/btest/romstage.c
r5092 r5097 178 178 * for cs5536 179 179 */ 180 cs5536_setup_onchipuart( );180 cs5536_setup_onchipuart(1); 181 181 gpio_init(); 182 182 uart_init(); -
trunk/src/mainboard/olpc/rev_a/romstage.c
r5092 r5097 178 178 * for cs5536 179 179 */ 180 cs5536_setup_onchipuart( );180 cs5536_setup_onchipuart(1); 181 181 gpio_init(); 182 182 uart_init(); -
trunk/src/southbridge/amd/cs5536/cs5536.c
r5074 r5097 248 248 isa_dma_init(); 249 249 } 250 250 251 252 /** 253 * Depending on settings in the config struct, enable COM1 or COM2 or both. 254 * 255 * If the enable is NOT set, the UARTs are explicitly disabled, which is 256 * required if (e.g.) there is a Super I/O attached that does COM1 or COM2. 257 * 258 * @param sb Southbridge config structure. 259 */ 251 260 static void uarts_init(struct southbridge_amd_cs5536_config *sb) 252 261 { 253 262 msr_t msr; 254 u int16_t addr;255 u int32_tgpio_addr;263 u16 addr = 0; 264 u32 gpio_addr; 256 265 device_t dev; 257 266 258 267 dev = dev_find_device(PCI_VENDOR_ID_AMD, 259 268 PCI_DEVICE_ID_AMD_CS5536_ISA, 0); 260 269 gpio_addr = pci_read_config32(dev, PCI_BASE_ADDRESS_1); 261 gpio_addr &= ~1; /* clear IO bit */262 printk _debug("GPIO_ADDR: %08X\n", gpio_addr);263 264 /* This could be extended to support IR modes */270 gpio_addr &= ~1; /* Clear I/O bit */ 271 printk(BIOS_DEBUG, "GPIO_ADDR: %08X\n", gpio_addr); 272 273 /* This could be extended to support IR modes. */ 265 274 266 275 /* COM1 */ 267 276 if (sb->com1_enable) { 268 /* Set the address */ 277 printk(BIOS_SPEW, "uarts_init: enable COM1\n"); 278 /* Set the address. */ 269 279 switch (sb->com1_address) { 270 280 case 0x3F8: 271 281 addr = 7; 272 282 break; 273 274 283 case 0x3E8: 275 284 addr = 6; 276 285 break; 277 278 286 case 0x2F8: 279 287 addr = 5; 280 288 break; 281 282 289 case 0x2E8: 283 290 addr = 4; … … 288 295 wrmsr(MDD_LEG_IO, msr); 289 296 290 /* Set the IRQ */297 /* Set the IRQ. */ 291 298 msr = rdmsr(MDD_IRQM_YHIGH); 292 299 msr.lo |= sb->com1_irq << 24; … … 294 301 295 302 /* GPIO8 - UART1_TX */ 296 /* Set: Output Enable (0x4) */303 /* Set: Output Enable (0x4) */ 297 304 outl(GPIOL_8_SET, gpio_addr + GPIOL_OUTPUT_ENABLE); 298 305 /* Set: OUTAUX1 Select (0x10) */ … … 302 309 /* Set: Input Enable (0x20) */ 303 310 outl(GPIOL_9_SET, gpio_addr + GPIOL_INPUT_ENABLE); 304 /* Set: INAUX1 Select (0x34) */311 /* Set: INAUX1 Select (0x34) */ 305 312 outl(GPIOL_9_SET, gpio_addr + GPIOL_IN_AUX1_SELECT); 306 313 307 /* Set: GPIO 8 + 9 Pull Up (0x18) */314 /* Set: GPIO 8 + 9 Pull Up (0x18) */ 308 315 outl(GPIOL_8_SET | GPIOL_9_SET, 309 316 gpio_addr + GPIOL_PULLUP_ENABLE); 310 317 311 /* enable COM1 */ 312 /* Bit 1 = device enable Bit 4 = allow access to the upper banks */ 318 /* Enable COM1. 319 * 320 * Bit 1 = device enable 321 * Bit 4 = allow access to the upper banks 322 */ 313 323 msr.lo = (1 << 4) | (1 << 1); 314 324 msr.hi = 0; 315 325 wrmsr(MDD_UART1_CONF, msr); 316 317 326 } else { 318 /* Reset and disable COM1 */ 327 /* Reset and disable COM1. */ 328 printk(BIOS_SPEW, "uarts_init: disable COM1\n"); 319 329 msr = rdmsr(MDD_UART1_CONF); 320 msr.lo = 1; // reset330 msr.lo = 1; /* Reset */ 321 331 wrmsr(MDD_UART1_CONF, msr); 322 msr.lo = 0; // disabled332 msr.lo = 0; /* Disabled */ 323 333 wrmsr(MDD_UART1_CONF, msr); 324 334 325 /* Disable the IRQ */335 /* Disable the IRQ. */ 326 336 msr = rdmsr(MDD_LEG_IO); 327 337 msr.lo &= ~(0xF << 16); … … 331 341 /* COM2 */ 332 342 if (sb->com2_enable) { 343 printk(BIOS_SPEW, "uarts_init: enable COM2\n"); 333 344 switch (sb->com2_address) { 334 345 case 0x3F8: 335 346 addr = 7; 336 347 break; 337 338 348 case 0x3E8: 339 349 addr = 6; 340 350 break; 341 342 351 case 0x2F8: 343 352 addr = 5; 344 353 break; 345 346 354 case 0x2E8: 347 355 addr = 4; … … 351 359 msr.lo |= addr << 20; 352 360 wrmsr(MDD_LEG_IO, msr); 353 354 /* Set the IRQ */ 361 printk(BIOS_SPEW, "uarts_init: wrote COM2 address 0x%x\n", sb->com2_address); 362 363 /* Set the IRQ. */ 355 364 msr = rdmsr(MDD_IRQM_YHIGH); 356 365 msr.lo |= sb->com2_irq << 28; 357 366 wrmsr(MDD_IRQM_YHIGH, msr); 367 printk(BIOS_SPEW, "uarts_init: set COM2 irq\n"); 358 368 359 369 /* GPIO3 - UART2_RX */ … … 366 376 /* Set: Output Enable (0x4) */ 367 377 outl(GPIOL_4_SET, gpio_addr + GPIOL_OUTPUT_ENABLE); 378 printk(BIOS_SPEW, "uarts_init: set output enable\n"); 368 379 /* Set: OUTAUX1 Select (0x10) */ 369 380 outl(GPIOL_4_SET, gpio_addr + GPIOL_OUT_AUX1_SELECT); 370 371 /* Set: GPIO 3 and 4 Pull Up (0x18) */ 381 printk(BIOS_SPEW, "uarts_init: set OUTAUX1\n"); 382 383 /* Set: GPIO 3 + 4 Pull Up (0x18) */ 372 384 outl(GPIOL_3_SET | GPIOL_4_SET, 373 385 gpio_addr + GPIOL_PULLUP_ENABLE); 374 375 /* enable COM2 */ 376 /* Bit 1 = device enable Bit 4 = allow access to the upper banks */ 386 printk(BIOS_SPEW, "uarts_init: set pullup COM2\n"); 387 388 /* Enable COM2. 389 * 390 * Bit 1 = device enable 391 * Bit 4 = allow access to the upper banks 392 */ 377 393 msr.lo = (1 << 4) | (1 << 1); 378 394 msr.hi = 0; 379 395 wrmsr(MDD_UART2_CONF, msr); 380 396 printk(BIOS_SPEW, "uarts_init: COM2 enabled\n"); 381 397 } else { 382 /* Reset and disable COM2 */ 398 printk(BIOS_SPEW, "uarts_init: disable COM2\n"); 399 /* Reset and disable COM2. */ 383 400 msr = rdmsr(MDD_UART2_CONF); 384 msr.lo = 1; // reset401 msr.lo = 1; /* Reset */ 385 402 wrmsr(MDD_UART2_CONF, msr); 386 msr.lo = 0; // disabled403 msr.lo = 0; /* Disabled */ 387 404 wrmsr(MDD_UART2_CONF, msr); 388 405 389 /* Disable the IRQ */406 /* Disable the IRQ. */ 390 407 msr = rdmsr(MDD_LEG_IO); 391 408 msr.lo &= ~(0xF << 20); … … 393 410 } 394 411 } 412 395 413 396 414 #define HCCPARAMS 0x08 -
trunk/src/southbridge/amd/cs5536/cs5536_early_setup.c
r5074 r5097 154 154 } 155 155 156 /* see page 412 of the cs5536 companion book */ 157 static void cs5536_setup_onchipuart(void) 156 /** 157 * Enable the on-chip UART. 158 * 159 * See page 412 of the AMD Geode CS5536 Companion Device data book. 160 */ 161 void cs5536_setup_onchipuart1(void) 158 162 { 159 163 msr_t msr; 160 164 161 165 /* Setup early for polling only mode. 162 * 1. E anble GPIO 8 to OUT_AUX1, 9 to IN_AUX1166 * 1. Enable GPIO 8 to OUT_AUX1, 9 to IN_AUX1. 163 167 * GPIO LBAR + 0x04, LBAR + 0x10, LBAR + 0x20, LBAR + 34 164 * 2. Enable UART I O space in MDD168 * 2. Enable UART I/O space in MDD. 165 169 * MSR 0x51400014 bit 18:16 166 * 3. Enable UART controller 170 * 3. Enable UART controller. 167 171 * MSR 0x5140003A bit 0, 1 168 172 */ 169 173 170 174 /* GPIO8 - UART1_TX */ 171 /* Set: Output Enable (0x4) */175 /* Set: Output Enable (0x4) */ 172 176 outl(GPIOL_8_SET, GPIO_IO_BASE + GPIOL_OUTPUT_ENABLE); 173 177 /* Set: OUTAUX1 Select (0x10) */ … … 175 179 176 180 /* GPIO9 - UART1_RX */ 177 /* Set: Input Enable (0x20) */181 /* Set: Input Enable (0x20) */ 178 182 outl(GPIOL_9_SET, GPIO_IO_BASE + GPIOL_INPUT_ENABLE); 179 /* Set: INAUX1 Select (0x34) */183 /* Set: INAUX1 Select (0x34) */ 180 184 outl(GPIOL_9_SET, GPIO_IO_BASE + GPIOL_IN_AUX1_SELECT); 181 185 182 /* set address to 3F8*/186 /* Set address to 0x3F8. */ 183 187 msr = rdmsr(MDD_LEG_IO); 184 188 msr.lo |= 0x7 << 16; 185 189 wrmsr(MDD_LEG_IO, msr); 186 190 187 /* Bit 1 = DEVEN (device enable)188 * Bit 4 = EN_BANKS (allow access to the upper banks191 /* Bit 1 = DEVEN (device enable) 192 * Bit 4 = EN_BANKS (allow access to the upper banks) 189 193 */ 190 194 msr.lo = (1 << 4) | (1 << 1); 191 195 msr.hi = 0; 192 196 193 /* enable COM1*/197 /* Enable COM1. */ 194 198 wrmsr(MDD_UART1_CONF, msr); 195 199 } 200 201 void cs5536_setup_onchipuart2(void) 202 { 203 msr_t msr; 204 205 /* GPIO4 - UART2_TX */ 206 /* Set: Output Enable (0x4) */ 207 outl(GPIOL_4_SET, GPIO_IO_BASE + GPIOL_OUTPUT_ENABLE); 208 /* Set: OUTAUX1 Select (0x10) */ 209 outl(GPIOL_4_SET, GPIO_IO_BASE + GPIOL_OUT_AUX1_SELECT); 210 /* GPIO4 - UART2_RX */ 211 /* Set: Input Enable (0x20) */ 212 outl(GPIOL_3_SET, GPIO_IO_BASE + GPIOL_INPUT_ENABLE); 213 /* Set: INAUX1 Select (0x34) */ 214 outl(GPIOL_3_SET, GPIO_IO_BASE + GPIOL_IN_AUX1_SELECT); 215 216 /* Set: GPIO 3 + 3 Pull Up (0x18) */ 217 outl(GPIOL_3_SET | GPIOL_4_SET, 218 GPIO_IO_BASE + GPIOL_PULLUP_ENABLE); 219 220 /* set address to 2F8 */ 221 msr = rdmsr(MDD_LEG_IO); 222 msr.lo |= 0x5 << 20; 223 wrmsr(MDD_LEG_IO, msr); 224 225 /* Bit 1 = DEVEN (device enable) 226 * Bit 4 = EN_BANKS (allow access to the upper banks 227 */ 228 msr.lo = (1 << 4) | (1 << 1); 229 msr.hi = 0; 230 231 /* enable COM2 */ 232 wrmsr(MDD_UART2_CONF, msr); 233 } 234 235 void cs5536_setup_onchipuart(int uart) 236 { 237 switch (uart) { 238 case 1: 239 cs5536_setup_onchipuart1(); 240 break; 241 case 2: 242 cs5536_setup_onchipuart2(); 243 break; 244 } 245 } 246 196 247 197 248 /* note: you can't do prints in here in most cases,
Note: See TracChangeset
for help on using the changeset viewer.
