diff options
author | Magnus Damm <damm@opensource.se> | 2009-11-27 04:28:03 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-11-29 22:02:55 -0500 |
commit | e6d8460aca6311d7ab5371b59dc999bb4d714444 (patch) | |
tree | f06e509b47d6b02f4b0ef362491c887bca8d69ae /arch/sh | |
parent | fae4339919c741f89f7e293b8c646207e1df28e1 (diff) |
sh: Improve kfr2r09 serial port setup code
This patch improves the serial port communication quality
of port YC401 on the KFR2R09 board. With this fix serial
console is fine at 115200 - up and down keys now work as
expected. Thanks to Hirohide Yamasaki for this fix.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/boards/mach-kfr2r09/setup.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c index e755bad6dc15..87438d6603d6 100644 --- a/arch/sh/boards/mach-kfr2r09/setup.c +++ b/arch/sh/boards/mach-kfr2r09/setup.c | |||
@@ -414,11 +414,59 @@ static int kfr2r09_usb0_gadget_i2c_setup(void) | |||
414 | 414 | ||
415 | return 0; | 415 | return 0; |
416 | } | 416 | } |
417 | |||
418 | static int kfr2r09_serial_i2c_setup(void) | ||
419 | { | ||
420 | struct i2c_adapter *a; | ||
421 | struct i2c_msg msg; | ||
422 | unsigned char buf[2]; | ||
423 | int ret; | ||
424 | |||
425 | a = i2c_get_adapter(0); | ||
426 | if (!a) | ||
427 | return -ENODEV; | ||
428 | |||
429 | /* set bit 6 (the 7th bit) of chip at 0x09, register 0x13 */ | ||
430 | buf[0] = 0x13; | ||
431 | msg.addr = 0x09; | ||
432 | msg.buf = buf; | ||
433 | msg.len = 1; | ||
434 | msg.flags = 0; | ||
435 | ret = i2c_transfer(a, &msg, 1); | ||
436 | if (ret != 1) | ||
437 | return -ENODEV; | ||
438 | |||
439 | buf[0] = 0; | ||
440 | msg.addr = 0x09; | ||
441 | msg.buf = buf; | ||
442 | msg.len = 1; | ||
443 | msg.flags = I2C_M_RD; | ||
444 | ret = i2c_transfer(a, &msg, 1); | ||
445 | if (ret != 1) | ||
446 | return -ENODEV; | ||
447 | |||
448 | buf[1] = buf[0] | (1 << 6); | ||
449 | buf[0] = 0x13; | ||
450 | msg.addr = 0x09; | ||
451 | msg.buf = buf; | ||
452 | msg.len = 2; | ||
453 | msg.flags = 0; | ||
454 | ret = i2c_transfer(a, &msg, 1); | ||
455 | if (ret != 1) | ||
456 | return -ENODEV; | ||
457 | |||
458 | return 0; | ||
459 | } | ||
417 | #else | 460 | #else |
418 | static int kfr2r09_usb0_gadget_i2c_setup(void) | 461 | static int kfr2r09_usb0_gadget_i2c_setup(void) |
419 | { | 462 | { |
420 | return -ENODEV; | 463 | return -ENODEV; |
421 | } | 464 | } |
465 | |||
466 | static int kfr2r09_serial_i2c_setup(void) | ||
467 | { | ||
468 | return -ENODEV; | ||
469 | } | ||
422 | #endif | 470 | #endif |
423 | 471 | ||
424 | static int kfr2r09_usb0_gadget_setup(void) | 472 | static int kfr2r09_usb0_gadget_setup(void) |
@@ -463,6 +511,9 @@ static int __init kfr2r09_devices_setup(void) | |||
463 | /* enable SCIF1 serial port for YC401 console support */ | 511 | /* enable SCIF1 serial port for YC401 console support */ |
464 | gpio_request(GPIO_FN_SCIF1_RXD, NULL); | 512 | gpio_request(GPIO_FN_SCIF1_RXD, NULL); |
465 | gpio_request(GPIO_FN_SCIF1_TXD, NULL); | 513 | gpio_request(GPIO_FN_SCIF1_TXD, NULL); |
514 | kfr2r09_serial_i2c_setup(); /* ECONTMSK(bit6=L10ONEN) set 1 */ | ||
515 | gpio_request(GPIO_PTG3, NULL); /* HPON_ON */ | ||
516 | gpio_direction_output(GPIO_PTG3, 1); /* HPON_ON = H */ | ||
466 | 517 | ||
467 | /* setup NOR flash at CS0 */ | 518 | /* setup NOR flash at CS0 */ |
468 | ctrl_outl(0x36db0400, BSC_CS0BCR); | 519 | ctrl_outl(0x36db0400, BSC_CS0BCR); |