diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-02-18 15:44:39 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-20 20:11:48 -0500 |
commit | 58ff70d4feae29cbb7ace410fa6585ef3afb44b6 (patch) | |
tree | 298ddfd64df8fbab670538202f93cf0bc028605a | |
parent | 04f93a87a2db84e7214a4ec56fccd2289e973ce5 (diff) |
ssb: Fix serial console on new bcm47xx devices
This fixes the baud settings for new devices
like the Linksys WRT350n.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/ssb/driver_chipcommon.c | 36 | ||||
-rw-r--r-- | include/linux/ssb/ssb_driver_chipcommon.h | 3 |
2 files changed, 34 insertions, 5 deletions
diff --git a/drivers/ssb/driver_chipcommon.c b/drivers/ssb/driver_chipcommon.c index 6fbf1c53b6f2..7cc03f2dd5a6 100644 --- a/drivers/ssb/driver_chipcommon.c +++ b/drivers/ssb/driver_chipcommon.c | |||
@@ -376,6 +376,7 @@ int ssb_chipco_serial_init(struct ssb_chipcommon *cc, | |||
376 | unsigned int irq; | 376 | unsigned int irq; |
377 | u32 baud_base, div; | 377 | u32 baud_base, div; |
378 | u32 i, n; | 378 | u32 i, n; |
379 | unsigned int ccrev = cc->dev->id.revision; | ||
379 | 380 | ||
380 | plltype = (cc->capabilities & SSB_CHIPCO_CAP_PLLT); | 381 | plltype = (cc->capabilities & SSB_CHIPCO_CAP_PLLT); |
381 | irq = ssb_mips_irq(cc->dev); | 382 | irq = ssb_mips_irq(cc->dev); |
@@ -387,14 +388,39 @@ int ssb_chipco_serial_init(struct ssb_chipcommon *cc, | |||
387 | chipco_read32(cc, SSB_CHIPCO_CLOCK_M2)); | 388 | chipco_read32(cc, SSB_CHIPCO_CLOCK_M2)); |
388 | div = 1; | 389 | div = 1; |
389 | } else { | 390 | } else { |
390 | if (cc->dev->id.revision >= 11) { | 391 | if (ccrev == 20) { |
392 | /* BCM5354 uses constant 25MHz clock */ | ||
393 | baud_base = 25000000; | ||
394 | div = 48; | ||
395 | /* Set the override bit so we don't divide it */ | ||
396 | chipco_write32(cc, SSB_CHIPCO_CORECTL, | ||
397 | chipco_read32(cc, SSB_CHIPCO_CORECTL) | ||
398 | | SSB_CHIPCO_CORECTL_UARTCLK0); | ||
399 | } else if ((ccrev >= 11) && (ccrev != 15)) { | ||
391 | /* Fixed ALP clock */ | 400 | /* Fixed ALP clock */ |
392 | baud_base = 20000000; | 401 | baud_base = 20000000; |
402 | if (cc->capabilities & SSB_CHIPCO_CAP_PMU) { | ||
403 | /* FIXME: baud_base is different for devices with a PMU */ | ||
404 | SSB_WARN_ON(1); | ||
405 | } | ||
393 | div = 1; | 406 | div = 1; |
407 | if (ccrev >= 21) { | ||
408 | /* Turn off UART clock before switching clocksource. */ | ||
409 | chipco_write32(cc, SSB_CHIPCO_CORECTL, | ||
410 | chipco_read32(cc, SSB_CHIPCO_CORECTL) | ||
411 | & ~SSB_CHIPCO_CORECTL_UARTCLKEN); | ||
412 | } | ||
394 | /* Set the override bit so we don't divide it */ | 413 | /* Set the override bit so we don't divide it */ |
395 | chipco_write32(cc, SSB_CHIPCO_CORECTL, | 414 | chipco_write32(cc, SSB_CHIPCO_CORECTL, |
396 | SSB_CHIPCO_CORECTL_UARTCLK0); | 415 | chipco_read32(cc, SSB_CHIPCO_CORECTL) |
397 | } else if (cc->dev->id.revision >= 3) { | 416 | | SSB_CHIPCO_CORECTL_UARTCLK0); |
417 | if (ccrev >= 21) { | ||
418 | /* Re-enable the UART clock. */ | ||
419 | chipco_write32(cc, SSB_CHIPCO_CORECTL, | ||
420 | chipco_read32(cc, SSB_CHIPCO_CORECTL) | ||
421 | | SSB_CHIPCO_CORECTL_UARTCLKEN); | ||
422 | } | ||
423 | } else if (ccrev >= 3) { | ||
398 | /* Internal backplane clock */ | 424 | /* Internal backplane clock */ |
399 | baud_base = ssb_clockspeed(bus); | 425 | baud_base = ssb_clockspeed(bus); |
400 | div = chipco_read32(cc, SSB_CHIPCO_CLKDIV) | 426 | div = chipco_read32(cc, SSB_CHIPCO_CLKDIV) |
@@ -406,7 +432,7 @@ int ssb_chipco_serial_init(struct ssb_chipcommon *cc, | |||
406 | } | 432 | } |
407 | 433 | ||
408 | /* Clock source depends on strapping if UartClkOverride is unset */ | 434 | /* Clock source depends on strapping if UartClkOverride is unset */ |
409 | if ((cc->dev->id.revision > 0) && | 435 | if ((ccrev > 0) && |
410 | !(chipco_read32(cc, SSB_CHIPCO_CORECTL) & SSB_CHIPCO_CORECTL_UARTCLK0)) { | 436 | !(chipco_read32(cc, SSB_CHIPCO_CORECTL) & SSB_CHIPCO_CORECTL_UARTCLK0)) { |
411 | if ((cc->capabilities & SSB_CHIPCO_CAP_UARTCLK) == | 437 | if ((cc->capabilities & SSB_CHIPCO_CAP_UARTCLK) == |
412 | SSB_CHIPCO_CAP_UARTCLK_INT) { | 438 | SSB_CHIPCO_CAP_UARTCLK_INT) { |
@@ -428,7 +454,7 @@ int ssb_chipco_serial_init(struct ssb_chipcommon *cc, | |||
428 | cc_mmio = cc->dev->bus->mmio + (cc->dev->core_index * SSB_CORE_SIZE); | 454 | cc_mmio = cc->dev->bus->mmio + (cc->dev->core_index * SSB_CORE_SIZE); |
429 | uart_regs = cc_mmio + SSB_CHIPCO_UART0_DATA; | 455 | uart_regs = cc_mmio + SSB_CHIPCO_UART0_DATA; |
430 | /* Offset changed at after rev 0 */ | 456 | /* Offset changed at after rev 0 */ |
431 | if (cc->dev->id.revision == 0) | 457 | if (ccrev == 0) |
432 | uart_regs += (i * 8); | 458 | uart_regs += (i * 8); |
433 | else | 459 | else |
434 | uart_regs += (i * 256); | 460 | uart_regs += (i * 256); |
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h index 4cb995494662..35717b400cef 100644 --- a/include/linux/ssb/ssb_driver_chipcommon.h +++ b/include/linux/ssb/ssb_driver_chipcommon.h | |||
@@ -51,9 +51,12 @@ | |||
51 | #define SSB_CHIPCO_CAP_JTAGM 0x00400000 /* JTAG master present */ | 51 | #define SSB_CHIPCO_CAP_JTAGM 0x00400000 /* JTAG master present */ |
52 | #define SSB_CHIPCO_CAP_BROM 0x00800000 /* Internal boot ROM active */ | 52 | #define SSB_CHIPCO_CAP_BROM 0x00800000 /* Internal boot ROM active */ |
53 | #define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */ | 53 | #define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */ |
54 | #define SSB_CHIPCO_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */ | ||
55 | #define SSB_CHIPCO_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */ | ||
54 | #define SSB_CHIPCO_CORECTL 0x0008 | 56 | #define SSB_CHIPCO_CORECTL 0x0008 |
55 | #define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */ | 57 | #define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */ |
56 | #define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */ | 58 | #define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */ |
59 | #define SSB_CHIPCO_CORECTL_UARTCLKEN 0x00000008 /* UART clock enable (rev >= 21) */ | ||
57 | #define SSB_CHIPCO_BIST 0x000C | 60 | #define SSB_CHIPCO_BIST 0x000C |
58 | #define SSB_CHIPCO_OTPS 0x0010 /* OTP status */ | 61 | #define SSB_CHIPCO_OTPS 0x0010 /* OTP status */ |
59 | #define SSB_CHIPCO_OTPS_PROGFAIL 0x80000000 | 62 | #define SSB_CHIPCO_OTPS_PROGFAIL 0x80000000 |