Skip to contentSkip to conversation

sh: LCDC SYS bus access wait fix

PATCH New Magnus Damm 2 participants 8 messages Aug 6, 2009 – Aug 13, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: LCDC SYS bus access wait fix

From: Magnus Damm <[email protected]>

Update the SuperH Mobile LCDC driver to wait for SYS bus to become idle after reading or writing. This is needed by the kfr2r09 board, but also fixes potential problems on other boards making use of the LCDC in a SYS configuration.

---

Tested on Migo-R and kfr2r09.

 drivers/video/sh_mobile_lcdcfb.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/video/sh_mobile_lcdcfb.c +3 -0
@@ -154,6 +154,7 @@ static void lcdc_sys_write_index(void *h
 	lcdc_write(ch->lcdc, _LDDWD0R, data | 0x10000000);
 	lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
 	lcdc_write(ch->lcdc, _LDDWAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0));
+	lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
 }
 
 static void lcdc_sys_write_data(void *handle, unsigned long data)
@@ -163,6 +164,7 @@ static void lcdc_sys_write_data(void *ha
 	lcdc_write(ch->lcdc, _LDDWD0R, data | 0x11000000);
 	lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
 	lcdc_write(ch->lcdc, _LDDWAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0));
+	lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
 }
 
 static unsigned long lcdc_sys_read_data(void *handle)
@@ -173,6 +175,7 @@ static unsigned long lcdc_sys_read_data(
 	lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
 	lcdc_write(ch->lcdc, _LDDRAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0));
 	udelay(1);
+	lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
 
 	return lcdc_read(ch->lcdc, _LDDRDR) & 0xffff;
 }
#1 lore raw

PATCH 1/1 sh: 18-bit SYS panel fix for SuperH Mobile LCDC

From: Magnus Damm <[email protected]>

Fix the SuperH Mobile LCDC driver to make use of the full 18-bit DRD field in the LDDRDR register. Without this patch only 16-bit register access is possible. Needed by 18-bit SYS panels such as the one used on kfr2r09.

---

Tested on Migo-R and kfr2r09. Applies on top of the wait bit fix.

 drivers/video/sh_mobile_lcdcfb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/sh_mobile_lcdcfb.c +1 -1
@@ -177,7 +177,7 @@ static unsigned long lcdc_sys_read_data(
 	udelay(1);
 	lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
 
-	return lcdc_read(ch->lcdc, _LDDRDR) & 0xffff;
+	return lcdc_read(ch->lcdc, _LDDRDR) & 0x3ffff;
 }
 
 struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
#2 lore raw

PATCH 1/1 sh: kfr2r09 board support - LCDC panel

From: Magnus Damm <[email protected]>

This patch adds support for the WQVGA LCD display used by the KFR2R09 board. The LCD module is a TX07D34VM0AAA made by Hitachi, and this module is made up by a R61517 chip together with a 240x400 pixel display. The screen is attached to the SuperH Mobile LCDC using a 18-bit SYS bus.

The register settings used by the SYS panel setup code are based on an out-of-tree driver which apart from duplicating all LCDC driver code and writing to non-existing hardware registers also never was posted for upstream merge.

---

 arch/sh/boards/mach-kfr2r09/Makefile        |    1 
 arch/sh/boards/mach-kfr2r09/lcd_wqvga.c     |  332 +++++++++++++++++++++++++++
 arch/sh/boards/mach-kfr2r09/setup.c         |   94 +++++++
 arch/sh/include/mach-kfr2r09/mach/kfr2r09.h |   21 +
 4 files changed, 448 insertions(+)
arch/sh/boards/mach-kfr2r09/Makefile +1 -0
@@ -1 +1,2 @@
 obj-y	 := setup.o
+obj-$(CONFIG_FB_SH_MOBILE_LCDC)	+=  lcd_wqvga.o
arch/sh/boards/mach-kfr2r09/lcd_wqvga.c new file +332 -0

332 lines not on this page · raw message

arch/sh/boards/mach-kfr2r09/setup.c +94 -0

119 lines not on this page · raw message

arch/sh/include/mach-kfr2r09/mach/kfr2r09.h new file +21 -0
@@ -0,0 +1,21 @@
+#ifndef __ASM_SH_KFR2R09_H
+#define __ASM_SH_KFR2R09_H
+
+#include <video/sh_mobile_lcdc.h>
+
+#ifdef CONFIG_FB_SH_MOBILE_LCDC
+void kfr2r09_lcd_on(void *board_data);
+void kfr2r09_lcd_off(void *board_data);
+int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle,
+		      struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+#else
+static inline void kfr2r09_lcd_on(void *board_data) {}
+static inline void kfr2r09_lcd_off(void *board_data) {}
+static inline int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle,
+				    struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
+{
+	return -ENODEV;
+}
+#endif
+
+#endif /* __ASM_SH_KFR2R09_H */
#3 lore raw

PATCH 1/1 sh: kfr2r09 board support - NAND flash

From: Magnus Damm <[email protected]>

This patch adds support for the NAND flash chip attached to CS4 on the KFR2R09 board. The device is driven by the platform device driver "onenand-flash".

---

No merge/build time dependencies, but needs the following patch to start working on the actual hardware:

"[PATCH] mtd: make onenand/generic.c more generic"

 arch/sh/boards/mach-kfr2r09/setup.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/sh/boards/mach-kfr2r09/setup.c +23 -0
@@ -11,6 +11,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/mtd/physmap.h>
+#include <linux/mtd/onenand.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/gpio.h>
@@ -62,6 +63,21 @@ static struct platform_device kfr2r09_no
 	},
 };
 
+static struct resource kfr2r09_nand_flash_resources[] = {
+	[0] = {
+		.name		= "NAND Flash",
+		.start		= 0x10000000,
+		.end		= 0x1001ffff,
+		.flags		= IORESOURCE_MEM,
+	}
+};
+
+static struct platform_device kfr2r09_nand_flash_device = {
+	.name		= "onenand-flash",
+	.resource	= kfr2r09_nand_flash_resources,
+	.num_resources	= ARRAY_SIZE(kfr2r09_nand_flash_resources),
+};
+
 static struct sh_keysc_info kfr2r09_sh_keysc_info = {
 	.mode = SH_KEYSC_MODE_1, /* KEYOUT0->4, KEYIN0->4 */
 	.scan_timing = 3,
@@ -161,12 +177,15 @@ static struct platform_device kfr2r09_sh
 
 static struct platform_device *kfr2r09_devices[] __initdata = {
 	&kfr2r09_nor_flash_device,
+	&kfr2r09_nand_flash_device,
 	&kfr2r09_sh_keysc_device,
 	&kfr2r09_sh_lcdc_device,
 };
 
 #define BSC_CS0BCR 0xfec10004
 #define BSC_CS0WCR 0xfec10024
+#define BSC_CS4BCR 0xfec10010
+#define BSC_CS4WCR 0xfec10030
 
 static int __init kfr2r09_devices_setup(void)
 {
@@ -178,6 +197,10 @@ static int __init kfr2r09_devices_setup(
 	ctrl_outl(0x36db0400, BSC_CS0BCR);
 	ctrl_outl(0x00000500, BSC_CS0WCR);
 
+	/* setup NAND flash at CS4 */
+	ctrl_outl(0x36db0400, BSC_CS4BCR);
+	ctrl_outl(0x00000500, BSC_CS4WCR);
+
 	/* setup KEYSC pins */
 	gpio_request(GPIO_FN_KEYOUT0, NULL);
 	gpio_request(GPIO_FN_KEYOUT1, NULL);
#4 lore raw

PATCH 1/1 sh: LED9, LED10 and LED11 support for Solution Engine 7724

From: Magnus Damm <[email protected]>

This patch adds support for LED9, LED10 and LED11 on the Solution Engine 7724 board. If CONFIG_PM is enabled then these LEDs are used to show the hardware sleep mode used by the processor. Useful to debug cpuidle.

---

 arch/sh/boards/mach-se/7724/setup.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/sh/boards/mach-se/7724/setup.c +26 -0
@@ -429,6 +429,32 @@ static int __init devices_setup(void)
 	/* turn on USB clocks, use external clock */
 	ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
 
+#ifdef CONFIG_PM
+	/* Let LED9 show STATUS2 */
+	gpio_request(GPIO_FN_STATUS2, NULL);
+
+	/* Lit LED10 show STATUS0 */
+	gpio_request(GPIO_FN_STATUS0, NULL);
+
+	/* Lit LED11 show PDSTATUS */
+	gpio_request(GPIO_FN_PDSTATUS, NULL);
+#else
+	/* Lit LED9 */
+	gpio_request(GPIO_PTJ6, NULL);
+	gpio_direction_output(GPIO_PTJ6, 1);
+	gpio_export(GPIO_PTJ6, 0);
+
+	/* Lit LED10 */
+	gpio_request(GPIO_PTJ5, NULL);
+	gpio_direction_output(GPIO_PTJ5, 1);
+	gpio_export(GPIO_PTJ5, 0);
+
+	/* Lit LED11 */
+	gpio_request(GPIO_PTJ7, NULL);
+	gpio_direction_output(GPIO_PTJ7, 1);
+	gpio_export(GPIO_PTJ7, 0);
+#endif
+
 	/* enable USB0 port */
 	ctrl_outw(0x0600, 0xa40501d4);
 
#5 lore raw

PATCH 1/1 sh: fix romImage mach dir usage

From: Magnus Damm <[email protected]>

This patch moves all the romImage related header files into the mach/ directory.

---

 arch/sh/boot/romimage/head.S                            |    2 
 arch/sh/include/mach-common/mach/romimage.h             |    1 
 arch/sh/include/mach-common/romimage.h                  |    1 
 arch/sh/include/mach-kfr2r09/mach/partner-jet-setup.txt |  134 +++++++++++++++
 arch/sh/include/mach-kfr2r09/mach/romimage.h            |   75 ++++++++
 arch/sh/include/mach-kfr2r09/partner-jet-setup.txt      |  134 ---------------
 arch/sh/include/mach-kfr2r09/romimage.h                 |   75 --------
 7 files changed, 211 insertions(+), 211 deletions(-)
arch/sh/boot/romimage/head.S +1 -1
@@ -7,4 +7,4 @@
 .text
 	.global	romstart
 romstart:
-#include <romimage.h>
+#include <mach/romimage.h>
arch/sh/include/mach-common/mach/romimage.h new file +1 -0
@@ -0,0 +1 @@
+/* do nothing here by default */
arch/sh/include/mach-common/romimage.h deleted +0 -1
@@ -1 +0,0 @@
-/* do nothing here by default */
arch/sh/include/mach-kfr2r09/mach/partner-jet-setup.txt new file +134 -0

134 lines not on this page · raw message

arch/sh/include/mach-kfr2r09/mach/romimage.h new file +75 -0

75 lines not on this page · raw message

arch/sh/include/mach-kfr2r09/partner-jet-setup.txt deleted +0 -134

134 lines not on this page · raw message

arch/sh/include/mach-kfr2r09/romimage.h deleted +0 -75

75 lines not on this page · raw message

#6 lore raw

PATCH 1/1 sh: clean up Migo-R header file

From: Magnus Damm <[email protected]>

This patch moves the Migo-R specific header file from mach-common/ into mach-migor/ and removes unused cruft.

---

 arch/sh/include/mach-common/mach/migor.h |   64 ------------------------------
 arch/sh/include/mach-migor/mach/migor.h  |   14 ++++++
 2 files changed, 14 insertions(+), 64 deletions(-)
arch/sh/include/mach-common/mach/migor.h deleted +0 -64
@@ -1,64 +0,0 @@
-#ifndef __ASM_SH_MIGOR_H
-#define __ASM_SH_MIGOR_H
-
-/*
- * linux/include/asm-sh/migor.h
- *
- * Copyright (C) 2008 Renesas Solutions
- *
- * Portions Copyright (C) 2007 Nobuhiro Iwamatsu
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- */
-#include <asm/addrspace.h>
-
-/* GPIO */
-#define PORT_PACR 0xa4050100
-#define PORT_PDCR 0xa4050106
-#define PORT_PECR 0xa4050108
-#define PORT_PHCR 0xa405010e
-#define PORT_PJCR 0xa4050110
-#define PORT_PKCR 0xa4050112
-#define PORT_PLCR 0xa4050114
-#define PORT_PMCR 0xa4050116
-#define PORT_PRCR 0xa405011c
-#define PORT_PTCR 0xa4050140
-#define PORT_PUCR 0xa4050142
-#define PORT_PVCR 0xa4050144
-#define PORT_PWCR 0xa4050146
-#define PORT_PXCR 0xa4050148
-#define PORT_PYCR 0xa405014a
-#define PORT_PZCR 0xa405014c
-#define PORT_PADR 0xa4050120
-#define PORT_PHDR 0xa405012e
-#define PORT_PTDR 0xa4050160
-#define PORT_PWDR 0xa4050166
-
-#define PORT_HIZCRA 0xa4050158
-#define PORT_HIZCRC 0xa405015c
-
-#define PORT_MSELCRB 0xa4050182
-
-#define PORT_PSELA 0xa405014e
-#define PORT_PSELB 0xa4050150
-#define PORT_PSELC 0xa4050152
-#define PORT_PSELD 0xa4050154
-#define PORT_PSELE 0xa4050156
-
-#define PORT_HIZCRA 0xa4050158
-#define PORT_HIZCRB 0xa405015a
-#define PORT_HIZCRC 0xa405015c
-
-#define BSC_CS4BCR 0xfec10010
-#define BSC_CS6ABCR 0xfec1001c
-#define BSC_CS4WCR 0xfec10030
-
-#include <video/sh_mobile_lcdc.h>
-
-int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle,
-			 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
-
-#endif /* __ASM_SH_MIGOR_H */
arch/sh/include/mach-migor/mach/migor.h new file +14 -0
@@ -0,0 +1,14 @@
+#ifndef __ASM_SH_MIGOR_H
+#define __ASM_SH_MIGOR_H
+
+#define PORT_MSELCRB 0xa4050182
+#define BSC_CS4BCR 0xfec10010
+#define BSC_CS6ABCR 0xfec1001c
+#define BSC_CS4WCR 0xfec10030
+
+#include <video/sh_mobile_lcdc.h>
+
+int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle,
+			 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+
+#endif /* __ASM_SH_MIGOR_H */
#7 lore raw
Quoted 4 lines · Magnus Damm

Update the SuperH Mobile LCDC driver to wait for SYS bus to become idle after reading or writing. This is needed by the kfr2r09 board, but also fixes potential problems on other boards making use of the LCDC in a SYS configuration.

Quoted 4 lines · Magnus Damm

Fix the SuperH Mobile LCDC driver to make use of the full 18-bit DRD field in the LDDRDR register. Without this patch only 16-bit register access is possible. Needed by 18-bit SYS panels such as the one used on kfr2r09.

Quoted 10 lines · Magnus Damm

This patch adds support for the WQVGA LCD display used by the KFR2R09 board. The LCD module is a TX07D34VM0AAA made by Hitachi, and this module is made up by a R61517 chip together with a 240x400 pixel display. The screen is attached to the SuperH Mobile LCDC using a 18-bit SYS bus.

The register settings used by the SYS panel setup code are based on an out-of-tree driver which apart from duplicating all LCDC driver code and writing to non-existing hardware registers also never was posted for upstream merge.

Quoted 3 lines · Magnus Damm

This patch adds support for the NAND flash chip attached to CS4 on the KFR2R09 board. The device is driven by the platform device driver "onenand-flash".

Quoted 4 lines · Magnus Damm

This patch adds support for LED9, LED10 and LED11 on the Solution Engine 7724 board. If CONFIG_PM is enabled then these LEDs are used to show the hardware sleep mode used by the processor. Useful to debug cpuidle.

Quoted 2 lines · Magnus Damm

This patch moves all the romImage related header files into the mach/ directory.

Quoted 2 lines · Magnus Damm

This patch moves the Migo-R specific header file from mach-common/ into mach-migor/ and removes unused cruft.

All applied, thanks.