Host:Ubuntu-12.04
Target:Tiny6410
简介:移植LCD驱动程序,其实是copy啦~
移植LCD驱动的基本思路是拿来主义,最大感受是:被友臂的资料给坑了。一线触摸屏控制方式与其他方式有很大不同,内核资料提供的mini6410_backlight.c也不是真正的背光控制,真正的背光控制被mini6410_1wire_host.c劫持了。详细内容可以看这篇帖子http://www.arm9home.net/read.php?tid-14273.html。
总体过程可以分为以下几步:
1、修改mach-mini6410.c及相关头文件,添加fb信息。
2、拷贝与触摸屏相关的dev-ts-mini6410.c、ts.h、regs-adc.h、mini6410_1wire_host.c到相关目录。
3、完整拷贝友臂提供的linux-2.6.38源码下的drivers/video/samsung目录到新源码。
以下是patch记录。
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 5552e04..01ad86d 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -107,9 +107,9 @@ config MACH_MINI6410
select S3C_DEV_USB_HOST
select S3C_DEV_NAND
select S3C_DEV_FB
+ select S3C_DEV_RTC
select S3C64XX_SETUP_FB_24BPP
select SAMSUNG_DEV_ADC
- select SAMSUNG_DEV_TS
/*一定要去掉,不然报错*/
help
Machine support for the FriendlyARM MINI6410
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index cfc0b99..c3523ee 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -61,3 +61,4 @@ obj-$(CONFIG_MACH_WLF_CRAGG_6410) += mach-crag6410.o mach-crag6410-module.o
obj-y += dev-uart.o
obj-y += dev-audio.o
obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
+obj-$(CONFIG_TOUCHSCREEN_MINI6410) += dev-ts-mini6410.o
//添加部分
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
//自行比对
index 1bc85c3..e432d74 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -23,6 +23,7 @@
#include <linux/mtd/partitions.h>
#include <linux/serial_core.h>
#include <linux/types.h>
+#include <linux/delay.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -32,6 +33,7 @@
#include <mach/regs-gpio.h>
#include <mach/regs-modem.h>
#include <mach/regs-srom.h>
+#include <mach/ts.h>
#include <plat/s3c6410.h>
#include <plat/adc.h>
@@ -40,7 +42,7 @@
#include <plat/fb.h>
#include <plat/nand.h>
#include <plat/regs-serial.h>
-#include <plat/ts.h>
+//#include <plat/ts.h>
#include <plat/regs-fb-v4.h>
#include <video/platform_lcd.h>
@@ -188,11 +190,20 @@ static struct s3c_fb_platdata mini6410_lcd_pdata __initdata = {
static void mini6410_lcd_power_set(struct plat_lcd_data *pd,
unsigned int power)
-{
- if (power)
- gpio_direction_output(S3C64XX_GPE(0), 1);
- else
- gpio_direction_output(S3C64XX_GPE(0), 0);
+{
+ if (power) {
+ gpio_direction_output(S3C64XX_GPF(13), 1);
+ gpio_direction_output(S3C64XX_GPF(15), 1);
+
+ /* fire nRESET on power up */
+ gpio_direction_output(S3C64XX_GPN(5), 0);
+ msleep(10);
+ gpio_direction_output(S3C64XX_GPN(5), 1);
+ msleep(1);
+ } else {
+ gpio_direction_output(S3C64XX_GPF(15), 0);
+ gpio_direction_output(S3C64XX_GPF(13), 0);
+ }
}
static struct plat_lcd_data mini6410_lcd_power_data = {
@@ -217,11 +228,36 @@ static struct platform_device *mini6410_devices[] __initdata = {
&s3c_device_ts,
};
+static struct map_desc mini6410_iodesc[] = {
+ {
+ /* LCD support */
+ .virtual = (unsigned long)S3C_VA_LCD,
+ .pfn = __phys_to_pfn(S3C_PA_FB),
+ .length = SZ_16K,
+ .type = MT_DEVICE,
+ },
+/*#ifdef CONFIG_DM9000
+ {
+ .virtual = (u32)S3C64XX_VA_DM9000,
+ .pfn = __phys_to_pfn(S3C64XX_PA_DM9000),
+ .length = S3C64XX_SZ_DM9000,
+ .type = MT_DEVICE,
+ },
+#endif*/
+};
+static struct s3c_ts_mach_info s3c_ts_platform __initdata = {
+ .delay = 0xFFFF,
+ .presc = 0xFF,
+ .oversampling_shift = 2,
+ .resol_bit = 12,
+ .s3c_adc_con = ADC_TYPE_2,
+};
+
static void __init mini6410_map_io(void)
{
u32 tmp;
- s3c64xx_init_io(NULL, 0);
+ s3c64xx_init_io(mini6410_iodesc,ARRAY_SIZE(mini6410_iodesc));
s3c24xx_init_clocks(12000000);
s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
@@ -313,7 +349,7 @@ static void __init mini6410_machine_init(void)
s3c_nand_set_platdata(&mini6410_nand_info);
s3c_fb_set_platdata(&mini6410_lcd_pdata);
- s3c24xx_ts_set_platdata(NULL);
+ s3c_ts_set_platdata(&s3c_ts_platform);
/* configure nCS1 width to 16 bits */
@@ -335,8 +371,8 @@ static void __init mini6410_machine_init(void)
(4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
(0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
- gpio_request(S3C64XX_GPF(15), "LCD power");
- gpio_request(S3C64XX_GPE(0), "LCD power");
+ gpio_request(S3C64XX_GPF(13), "LCD power");
+ gpio_request(S3C64XX_GPN(5), "LCD power");
platform_add_devices(mini6410_devices, ARRAY_SIZE(mini6410_devices));
}
diff --git a/arch/arm/plat-samsung/include/plat/map-base.h b/arch/arm/plat-samsung/include/plat/map-base.h
index 3ffac4d..aac06ec 100644
--- a/arch/arm/plat-samsung/include/plat/map-base.h
+++ b/arch/arm/plat-samsung/include/plat/map-base.h
@@ -36,6 +36,7 @@
#define S3C_VA_TIMER S3C_ADDR(0x00300000)
/* timer block */
#define S3C_VA_WATCHDOG S3C_ADDR(0x00400000)
/* watchdog */
#define S3C_VA_UART S3C_ADDR(0x01000000)
/* UART */
+#define S3C_VA_LCD S3C_ADDR(0x01100000)
/* LCD */ //添加部分
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 3488ffe..88ffdaa 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -190,6 +190,31 @@ config TOUCHSCREEN_FUJITSU
To compile this driver as a module, choose M here: the
module will be called fujitsu-ts.
+config TOUCHSCREEN_MINI6410
+ tristate "S3C touchscreen driver for Mini6410"
+ depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5P64XX
+ default y
+ help
+ Say Y here to enable the driver for the touchscreen on the
+ FriendlyARM Mini6410 development board.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called mini6410_ts.
+
+config TOUCHSCREEN_1WIRE
+ tristate "Mini6410 1-Wire host and Touch Screen Driver"
+ depends on MACH_MINI6410
+ help
+ Say Y here to enable the driver for the touchscreen on the
+ FriendlyARM Mini6410 development board.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called mini6410_1wire_host.
+
config TOUCHSCREEN_S3C2410
tristate "Samsung S3C2410/generic touchscreen input driver"
depends on ARCH_S3C2410 || SAMSUNG_DEV_TS
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index f957676..8c9e23f 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -61,3 +61,8 @@ obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE)
+= mainstone-wm97xx.o
obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o
obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o
obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o
+obj-$(CONFIG_TOUCHSCREEN_1WIRE) += mini6410_1wire_host.o
+obj-$(CONFIG_TOUCHSCREEN_MINI6410) += mini6410-ts.o
+obj-$(CONFIG_FB_S3C_EXT_TFT800480) += ts-if.o
+obj-$(CONFIG_FB_S3C_EXT_TFT480272) += ts-if.o
+obj-$(CONFIG_FB_S3C_EXT_x240320) += ts-if.o
以下是直接copy 的文件。
diff --git a/arch/arm/mach-s3c64xx/dev-ts-mini6410.c
diff --git a/arch/arm/mach-s3c64xx/include/mach/gpio-bank-*.h /*懒人原则,全部拷贝,从a-p*/
diff --git a/arch/arm/mach-s3c64xx/include/mach/regs-lcd.h
diff --git a/arch/arm/mach-s3c64xx/include/mach/regs-fb.h /*不想看的话就把整个reg-x.h都拷贝过去吧*/
diff --git a/arch/arm/mach-s3c64xx/include/mach/ts.h
diff --git a/arch/arm/plat-samsung/include/plat/regs-adc.h
diff --git a/drivers/input/touchscreen/mini6410-ts.c
diff --git a/drivers/input/touchscreen/mini6410_1wire_host.c
diff --git a/drivers/input/touchscreen/ts-if.c
diff --git a/drivers/video/samsung/**
/*全部拷贝,并修改video目录下的Kconfig、Makefile文件*/
最后一步,配置内核,启动nfs,看到小企鹅。。