All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: Improve kfr2r09 serial port setup code
@ 2009-11-27  9:28 Magnus Damm
  2009-11-27  7:38 ` [PATCH] sh: Break out SuperH PFC code Magnus Damm
  0 siblings, 1 reply; 14+ messages in thread
From: Magnus Damm @ 2009-11-27  9:28 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

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>
---

 arch/sh/boards/mach-kfr2r09/setup.c |   51 +++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

--- 0008/arch/sh/boards/mach-kfr2r09/setup.c
+++ work/arch/sh/boards/mach-kfr2r09/setup.c	2009-11-27 18:13:11.000000000 +0900
@@ -414,11 +414,59 @@ static int kfr2r09_usb0_gadget_i2c_setup
 
 	return 0;
 }
+
+static int kfr2r09_serial_i2c_setup(void)
+{
+	struct i2c_adapter *a;
+	struct i2c_msg msg;
+	unsigned char buf[2];
+	int ret;
+
+	a = i2c_get_adapter(0);
+	if (!a)
+		return -ENODEV;
+
+	/* set bit 6 (the 7th bit) of chip at 0x09, register 0x13 */
+	buf[0] = 0x13;
+	msg.addr = 0x09;
+	msg.buf = buf;
+	msg.len = 1;
+	msg.flags = 0;
+	ret = i2c_transfer(a, &msg, 1);
+	if (ret != 1)
+		return -ENODEV;
+
+	buf[0] = 0;
+	msg.addr = 0x09;
+	msg.buf = buf;
+	msg.len = 1;
+	msg.flags = I2C_M_RD;
+	ret = i2c_transfer(a, &msg, 1);
+	if (ret != 1)
+		return -ENODEV;
+
+	buf[1] = buf[0] | (1 << 6);
+	buf[0] = 0x13;
+	msg.addr = 0x09;
+	msg.buf = buf;
+	msg.len = 2;
+	msg.flags = 0;
+	ret = i2c_transfer(a, &msg, 1);
+	if (ret != 1)
+		return -ENODEV;
+
+	return 0;
+}
 #else
 static int kfr2r09_usb0_gadget_i2c_setup(void)
 {
 	return -ENODEV;
 }
+
+static int kfr2r09_serial_i2c_setup(void)
+{
+	return -ENODEV;
+}
 #endif
 
 static int kfr2r09_usb0_gadget_setup(void)
@@ -463,6 +511,9 @@ static int __init kfr2r09_devices_setup(
 	/* enable SCIF1 serial port for YC401 console support */
 	gpio_request(GPIO_FN_SCIF1_RXD, NULL);
 	gpio_request(GPIO_FN_SCIF1_TXD, NULL);
+	kfr2r09_serial_i2c_setup(); /* ECONTMSK(bit6=L10ONEN) set 1 */
+	gpio_request(GPIO_PTG3, NULL); /* HPON_ON */
+	gpio_direction_output(GPIO_PTG3, 1); /* HPON_ON = H */
 
 	/* setup NOR flash at CS0 */
 	ctrl_outl(0x36db0400, BSC_CS0BCR);

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-11-30  3:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-27  9:28 [PATCH] sh: Improve kfr2r09 serial port setup code Magnus Damm
2009-11-27  7:38 ` [PATCH] sh: Break out SuperH PFC code Magnus Damm
2009-11-27  7:32   ` [PATCH] sh: Move KEYSC header file Magnus Damm
2009-11-27  7:32     ` Magnus Damm
2009-11-27  5:16     ` [PATCH] sh: Add CPG save/restore code for sh7724 R-standby Magnus Damm
2009-11-27  4:36       ` [PATCH] sh: Add SDHI power control support to Ecovec Magnus Damm
2009-11-27  4:31         ` [PATCH] mfd: Add power control platform data to SDHI driver Magnus Damm
2009-11-27 19:47           ` Samuel Ortiz
2009-11-28 13:10           ` Magnus Damm
2009-11-29 23:56           ` Samuel Ortiz
2009-11-30  3:05           ` Paul Mundt
2009-11-30  3:05             ` Paul Mundt
2009-11-28  1:43     ` [PATCH] sh: Move KEYSC header file Dmitry Torokhov
2009-11-28  1:43       ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.