1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-28 19:53:09 +02:00

Merge patches into files.

This commit is contained in:
Lars-Peter Clausen 2009-10-11 22:26:23 +02:00 committed by Xiangfu Liu
parent c456866a4a
commit c84ef25bf3
9 changed files with 95 additions and 649 deletions

View File

@ -43,6 +43,10 @@
#include <asm/mach-jz4740/board-virgo.h>
#endif
#ifdef CONFIG_JZ4740_QI_LB60
#include <asm/mach-jz4740/board-qi_lb60.h>
#endif
/* Add other platform definition here ... */

View File

@ -16,6 +16,7 @@ obj-$(CONFIG_JZ4740_LEO) += board-leo.o
obj-$(CONFIG_JZ4740_LYRA) += board-lyra.o
obj-$(CONFIG_JZ4725_DIPPER) += board-dipper.o
obj-$(CONFIG_JZ4720_VIRGO) += board-virgo.o
obj-$(CONFIG_JZ4740_QI_LB60) += board-qi_lb60.o
# PM support

View File

@ -21,6 +21,8 @@
#include <linux/spi/spi_gpio.h>
#include <linux/power_supply.h>
#include <linux/power/jz4740-battery.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
#include <asm/jzsoc.h>
#include <asm/gpio.h>
@ -170,6 +172,8 @@ static struct resource jz_nand_resources[] = {
},
};
#ifdef QI_LB60_1GB_NAND
static struct nand_ecclayout qi_lb60_ecclayout = {
.eccbytes = 36,
.eccpos = {
@ -196,13 +200,52 @@ static struct mtd_partition qi_lb60_partitions[] = {
},
{ .name = "NAND ROOTFS partition",
.offset = 8 * 0x100000,
.size = 20 * 0x100000,
.size = 504 * 0x100000,
},
{ .name = "NAND DATA partition",
.offset = 100 * 0x100000,
.size = 20 * 0x100000,
.offset = 512 * 0x100000,
.size = 512 * 0x100000,
},
};
#else
static struct nand_ecclayout qi_lb60_ecclayout = {
.eccbytes = 72,
.eccpos = {
12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79, 80, 81, 82, 83},
.oobfree = {
{.offset = 2,
.length = 10},
{.offset = 84,
.length = 44}}
};
static struct mtd_partition qi_lb60_partitions[] = {
{ .name = "NAND BOOT partition",
.offset = 0 * 0x100000,
.size = 4 * 0x100000,
},
{ .name = "NAND KERNEL partition",
.offset = 4 * 0x100000,
.size = 4 * 0x100000,
},
{ .name = "NAND ROOTFS partition",
.offset = 8 * 0x100000,
.size = 504 * 0x100000,
},
{ .name = "NAND DATA partition",
.offset = 512 * 0x100000,
.size = (512 + 1024) * 0x100000,
},
};
#endif /* QI_LB60_1GB_NAND */
static struct jz_nand_platform_data jz_nand_platform_data = {
.num_partitions = ARRAY_SIZE(qi_lb60_partitions),
@ -219,12 +262,15 @@ static struct platform_device jz_nand_device = {
.platform_data = &jz_nand_platform_data,
}
};
#define KEEP_UART_ALIVE
/* #define KEEP_UART_ALIVE
* don't define this. the keyboard and keyboard both work
*/
#define KEY_QI_QI KEY_F13
#define KEY_QI_UPRED KEY_F14
#define KEY_QI_UPRED KEY_RIGHTSHIFT
#define KEY_QI_VOLUP KEY_F15
#define KEY_QI_VOLDOWN KEY_F16
#define KEY_QI_FN KEY_RIGHTCTRL
static const uint32_t qi_lb60_keymap[] = {
KEY(0, 0, KEY_F1), /* S2 */
@ -287,7 +333,7 @@ static const uint32_t qi_lb60_keymap[] = {
#ifndef KEEP_UART_ALIVE
KEY(7, 0, KEY_LEFTSHIFT), /* S58 */
KEY(7, 1, KEY_LEFTALT), /* S59 */
KEY(7, 2, KEY_FN), /* S60 */
KEY(7, 2, KEY_QI_FN), /* S60 */
#endif
};
@ -469,6 +515,29 @@ static struct platform_device jz_battery_device = {
},
};
/* GPIO Key: power */
static const struct gpio_keys_button qi_lb60_gpio_keys_buttons[] = {
[0] = {
.code = KEY_POWER,
.gpio = GPIO_WAKEUP_N,
.active_low = 1,
.desc = "Power",
},
};
static const struct gpio_keys_platform_data qi_lb60_gpio_keys_data = {
.nbuttons = ARRAY_SIZE(qi_lb60_gpio_keys_buttons),
.buttons = qi_lb60_gpio_keys_buttons,
};
static struct platform_device qi_lb60_gpio_keys = {
.name = "gpio-keys",
.id = -1,
.dev = {
.platform_data = &qi_lb60_gpio_keys_data,
}
};
/* All */
static struct platform_device *jz_platform_devices[] __initdata = {
&jz_usb_ohci_device,
@ -484,6 +553,7 @@ static struct platform_device *jz_platform_devices[] __initdata = {
&jz_rtc_device,
&jz_adc_device,
&jz_battery_device,
&qi_lb60_gpio_keys,
};
static int __init jz_platform_init(void)

View File

@ -1,302 +0,0 @@
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/board-qi_lb60.h
@@ -0,0 +1,79 @@
+/*
+ * linux/include/asm-mips/mach-jz4740/board-qi_lb60.h
+ *
+ * Copyright (c) 2009 Qi Hardware inc.,
+ * Author: Xiangfu Liu <xiangfu@qi-hardware.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_JZ4740_QI_LB60_H__
+#define __ASM_JZ4740_QI_LB60_H__
+
+/*
+ * Frequencies of on-board oscillators
+ */
+#define JZ_EXTAL 12000000 /* Main extal freq: 12 MHz */
+#define JZ_EXTAL2 32768 /* RTC extal freq: 32.768 KHz */
+
+/*
+ * GPIO
+ */
+#define GPIO_DC_DETE_N (2 * 32 + 26)
+#define GPIO_CHARG_STAT_N (2 * 32 + 27)
+#define GPIO_LED_EN (2 * 32 + 28)
+#define GPIO_LCD_CS (2 * 32 + 21)
+#define GPIO_DISP_OFF_N (3 * 32 + 21)
+#define GPIO_PWM (3 * 32 + 27)
+
+#define GPIO_AMP_EN (3 * 32 + 4)
+
+#define GPIO_SD_CD_N (3 * 32 + 0)
+#define GPIO_SD_VCC_EN_N (3 * 32 + 2)
+#define GPIO_SD_WP (3 * 32 + 16)
+
+#define GPIO_USB_DETE (3 * 32 + 28)
+#define GPIO_BUZZ_PWM (3 * 32 + 27)
+#define GPIO_UDC_HOTPLUG GPIO_USB_DETE
+
+#define GPIO_AUDIO_POP (1 * 32 + 29)
+#define GPIO_COB_TEST (1 * 32 + 30)
+
+#define GPIO_KEYOUT_BASE (2 * 32 + 10)
+#define GPIO_KEYIN_BASE (3 * 32 + 18)
+#define GPIO_KEYIN_8 (3 * 32 + 26)
+
+/*
+ * MMC/SD
+ */
+#define MSC_WP_PIN GPIO_SD_WP
+#define MSC_HOTPLUG_PIN GPIO_SD_CD_N
+#define MSC_HOTPLUG_IRQ (IRQ_GPIO_0 + GPIO_SD_CD_N)
+
+#define __msc_init_io() \
+do { \
+ __gpio_as_output(GPIO_SD_VCC_EN_N); \
+ __gpio_as_input(GPIO_SD_CD_N); \
+} while (0)
+
+#define __msc_enable_power() \
+do { \
+ __gpio_clear_pin(GPIO_SD_VCC_EN_N); \
+} while (0)
+
+#define __msc_disable_power() \
+do { \
+ __gpio_set_pin(GPIO_SD_VCC_EN_N); \
+} while (0)
+
+#define __msc_card_detected(s) \
+({ \
+ int detected = 1; \
+ if (!__gpio_get_pin(GPIO_SD_CD_N)) \
+ detected = 0; \
+ detected; \
+})
+
+#endif /* __ASM_JZ4740_QI_LB60_H__ */
--- a/arch/mips/include/asm/mach-jz4740/jz4740.h
+++ b/arch/mips/include/asm/mach-jz4740/jz4740.h
@@ -43,6 +43,10 @@
#include <asm/mach-jz4740/board-virgo.h>
#endif
+#ifdef CONFIG_JZ4740_QI_LB60
+#include <asm/mach-jz4740/board-qi_lb60.h>
+#endif
+
/* Add other platform definition here ... */
--- a/arch/mips/jz4740/Makefile
+++ b/arch/mips/jz4740/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_JZ4740_LEO) += board-leo.o
obj-$(CONFIG_JZ4740_LYRA) += board-lyra.o
obj-$(CONFIG_JZ4725_DIPPER) += board-dipper.o
obj-$(CONFIG_JZ4720_VIRGO) += board-virgo.o
+obj-$(CONFIG_JZ4740_QI_LB60) += board-qi_lb60.o
# PM support
--- /dev/null
+++ b/arch/mips/jz4740/board-qi_lb60.c
@@ -0,0 +1,110 @@
+/*
+ * linux/arch/mips/jz4740/board-qi_lb60.c
+ *
+ * QI_LB60 setup routines.
+ *
+ * Copyright (c) 2009 Qi Hardware inc.,
+ * Author: Xiangfu Liu <xiangfu@qi-hardware.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/ioport.h>
+#include <linux/mm.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+
+#include <asm/cpu.h>
+#include <asm/bootinfo.h>
+#include <asm/mipsregs.h>
+#include <asm/reboot.h>
+
+#include <asm/jzsoc.h>
+
+extern void (*jz_timer_callback)(void);
+
+static void dancing(void)
+{
+ static unsigned int count = 0;
+
+ count ++;
+ count &= 1;
+ if (count)
+ __gpio_set_pin(GPIO_LED_EN);
+ else
+ __gpio_clear_pin(GPIO_LED_EN);
+}
+
+static void pi_timer_callback(void)
+{
+ static unsigned long count = 0;
+
+ if ((++count) % 50 == 0) {
+ dancing();
+ count = 0;
+ }
+}
+
+static void __init board_cpm_setup(void)
+{
+ /* Stop unused module clocks here.
+ * We have started all module clocks at arch/mips/jz4740/setup.c.
+ */
+}
+
+static void __init board_gpio_setup(void)
+{
+ /*
+ * Most of the GPIO pins should have been initialized by the boot-loader
+ */
+
+ /*
+ * Initialize MSC pins
+ */
+ /* __gpio_as_msc(); */
+
+ /*
+ * Initialize LCD pins
+ */
+ /* __gpio_as_lcd_18bit(); */
+
+ /*
+ * Initialize SSI pins
+ */
+ /* __gpio_as_ssi(); */
+
+ /*
+ * Initialize I2C pins
+ */
+ /* __gpio_as_i2c(); */
+
+ /*
+ * Initialize Other pins
+ */
+ __gpio_as_output(GPIO_SD_VCC_EN_N);
+ __gpio_disable_pull(GPIO_SD_VCC_EN_N);
+ __gpio_clear_pin(GPIO_SD_VCC_EN_N);
+
+ __gpio_as_input(GPIO_SD_CD_N);
+ __gpio_disable_pull(GPIO_SD_CD_N);
+
+ __gpio_as_input(GPIO_SD_WP);
+ __gpio_disable_pull(GPIO_SD_WP);
+
+ __gpio_as_input(GPIO_DC_DETE_N);
+ __gpio_as_input(GPIO_CHARG_STAT_N);
+}
+
+void __init jz_board_setup(void)
+{
+ printk("Qi Hardware JZ4740 QI_LB60 setup\n");
+
+ board_cpm_setup();
+ board_gpio_setup();
+
+ jz_timer_callback = pi_timer_callback;
+}
--- a/drivers/video/jzlcd.c
+++ b/drivers/video/jzlcd.c
@@ -127,15 +127,18 @@ static struct jzfb_info jzfb = {
MODE_TFT_GEN | HSYNC_N | VSYNC_N | PCLK_N | DE_N,
320, 240, 16, 60, 3, 3, 3, 3, 3, 85 /* 320x240 */
#endif
-#if defined(CONFIG_JZLCD_FOXCONN_PT035TN01) && defined(CONFIG_JZ4740_PAVO)
- MODE_TFT_GEN | HSYNC_N | VSYNC_N | MODE_TFT_18BIT | PCLK_N,
-// 320, 240, 18, 110, 1, 1, 10, 50, 10, 13
- 320, 240, 18, 80, 1, 1, 10, 50, 10, 13
-#endif
-#if defined(CONFIG_JZLCD_FOXCONN_PT035TN01) && !(defined(CONFIG_JZ4740_PAVO))
- MODE_TFT_GEN | HSYNC_N | VSYNC_N | PCLK_N,
- 320, 240, 16, 110, 1, 1, 10, 50, 10, 13
-#endif
+#if defined(CONFIG_JZLCD_FOXCONN_PT035TN01)
+ #if defined(CONFIG_JZ4740_PAVO)
+ MODE_TFT_GEN | HSYNC_N | VSYNC_N | MODE_TFT_18BIT | PCLK_N,
+ 320, 240, 18, 80, 1, 1, 10, 50, 10, 13
+ #elif defined(CONFIG_JZ4740_QI_LB60)
+ MODE_8BIT_SERIAL_TFT | PCLK_N | HSYNC_N | VSYNC_N,
+ 320, 240, 32, 70, 1, 1, 273, 140, 1, 20
+ #else
+ MODE_TFT_GEN | HSYNC_N | VSYNC_N | PCLK_N,
+ 320, 240, 16, 110, 1, 1, 10, 50, 10, 13
+ #endif
+#endif /* CONFIG_JZLCD_FOXCONN_PT035TN01 */
#if defined(CONFIG_JZLCD_INNOLUX_PT035TN01_SERIAL)
MODE_8BIT_SERIAL_TFT | PCLK_N | HSYNC_N | VSYNC_N,
320, 240, 32, 60, 1, 1, 10, 50, 10, 13
@@ -1487,7 +1490,7 @@ static int __init jzfb_probe(struct plat
printk("fb%d: %s frame buffer device, using %dK of video memory\n",
cfb->fb.node, cfb->fb.fix.id, cfb->fb.fix.smem_len>>10);
- __lcd_display_on();
+ __lcd_display_off();
return 0;
--- a/drivers/video/jzlcd.h
+++ b/drivers/video/jzlcd.h
@@ -363,7 +363,11 @@ do { \
#if defined(CONFIG_JZLCD_FOXCONN_PT035TN01) || defined(CONFIG_JZLCD_INNOLUX_PT035TN01_SERIAL)
#if defined(CONFIG_JZLCD_FOXCONN_PT035TN01) /* board pmp */
-#define MODE 0xcd /* 24bit parellel RGB */
+ #if defined(CONFIG_JZ4740_QI_LB60)
+ #define MODE 0xc9
+ #else
+ #define MODE 0xcd /* 24bit parellel RGB */
+ #endif
#endif
#if defined(CONFIG_JZLCD_INNOLUX_PT035TN01_SERIAL)
#define MODE 0xc9 /* 8bit serial RGB */
@@ -384,6 +388,11 @@ do { \
#define SPCK (32*1+17) //LCD_CLS
#define SPDA (32*2+12) //LCD_D12
#define LCD_RET (32*2+23) //LCD_REV, GPC23
+#elif defined(CONFIG_JZ4740_QI_LB60)
+ #define SPEN (32*2+21) //LCD_SPL
+ #define SPCK (32*2+23) //LCD_CLS
+ #define SPDA (32*2+22) //LCD_D12
+ #define LCD_RET (32*3+27)
#if 0 /*old driver*/
#define SPEN (32*1+18) //LCD_SPL
#define SPCK (32*1+17) //LCD_CLS
@@ -655,7 +664,7 @@ do { \
/*#if defined(CONFIG_JZ4740_LEO) || defined(CONFIG_JZ4740_PAVO)*/
#if defined(CONFIG_SOC_JZ4740)
-#if defined(CONFIG_JZ4740_PAVO) || defined(CONFIG_JZ4740_LYRA)
+#if defined(CONFIG_JZ4740_PAVO) || defined(CONFIG_JZ4740_LYRA) || defined(CONFIG_JZ4740_QI_LB60)
#define PWM_CHN 4 /* pwm channel */
#define PWM_FULL 101
/* 100 level: 0,1,...,100 */
@@ -724,7 +733,7 @@ do { \
do { \
__gpio_set_pin(GPIO_DISP_OFF_N); \
__lcd_special_on(); \
- __lcd_set_backlight_level(80); \
+ __lcd_set_backlight_level(20); \
} while (0)
#define __lcd_display_off() \

View File

@ -1,56 +0,0 @@
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -281,6 +281,42 @@ config FB_JZLCD_4730_4740
depends on FB_JZSOC && (SOC_JZ4730 || SOC_JZ4740)
help
This is the frame buffer device driver for the JZ4730 and JZ4740 LCD controller.
+config JZLCD_FRAMEBUFFER_MAX
+ int "Default FrameBuffer num"
+ depends on FB_JZLCD_4730_4740
+ default "1"
+ ---help---
+ JZ LCD driver support multi-framebuffers for video applications.
+config JZLCD_FRAMEBUFFER_ROTATE_SUPPORT
+ bool "JZLCD FrameBuffer Rotate Support(For TEST)"
+ depends on FB_JZLCD_4730_4740
+ default n
+ ---help---
+ JZ LCD driver framebuffer rotate support. Rotate angle can be 0,90,180,270.
+ Note, this fearture is implemented by software, and will cost a lot of cpu capcity.
+ That is to say, if you select this function, you system will become slowly.
+ Rotate cost cpu about:
+ ratate angle 0'C: 0% cpu
+ ratate angle 90'C: 40% cpu
+ ratate angle 180'C: 20% cpu
+ ratate angle 270'C: 40% cpu
+
+config JZLCD_FRAMEBUFFER_DEFAULT_ROTATE_ANGLE
+ int "FrameBuffer default rotate angle"
+ depends on JZLCD_FRAMEBUFFER_ROTATE_SUPPORT
+ default 0
+ ---help---
+ JZ LCD driver framebuffer angle value can be:
+ 0: 0'C
+ 1: 90'C
+ 2: 180'C
+ 3: 270'C
+config JZLCD_FRAMEBUFFER_BPP
+ int "FrameBuffer bit per pixel"
+ depends on JZLCD_FRAMEBUFFER_ROTATE_SUPPORT
+ default 32
+ ---help---
+ JZ LCD driver framebuffer support 8bpp, 16bpp, 32bpp
choice
depends on FB_JZLCD_4730_4740
prompt "LCD Panel"
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -28,7 +28,7 @@ obj-$(CONFIG_FB_DDC) += fb_ddc
obj-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o
# Hardware specific drivers go first
-obj-$(CONFIG_FB_JZLCD_4720_4740) += jzlcd.o
+obj-$(CONFIG_FB_JZLCD_4730_4740) += jzlcd.o
obj-$(CONFIG_FB_JZ4740_SLCD) += jz4740_slcd.o
obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o

View File

@ -1,104 +1,3 @@
--- a/arch/mips/jz4740/platform.c
+++ b/arch/mips/jz4740/platform.c
@@ -170,6 +170,8 @@ static struct resource jz_nand_resources
},
};
+
+#ifdef QI_LB60_1GB_NAND
static struct nand_ecclayout qi_lb60_ecclayout = {
.eccbytes = 36,
.eccpos = {
@@ -186,23 +188,62 @@ static struct nand_ecclayout qi_lb60_ecc
};
static struct mtd_partition qi_lb60_partitions[] = {
- { .name = "NAND BOOT partition",
- .offset = 0 * 0x100000,
- .size = 4 * 0x100000,
- },
- { .name = "NAND KERNEL partition",
- .offset = 4 * 0x100000,
- .size = 4 * 0x100000,
- },
- { .name = "NAND ROOTFS partition",
- .offset = 8 * 0x100000,
- .size = 20 * 0x100000,
- },
- { .name = "NAND DATA partition",
- .offset = 100 * 0x100000,
- .size = 20 * 0x100000,
- },
+ { .name = "NAND BOOT partition",
+ .offset = 0 * 0x100000,
+ .size = 4 * 0x100000,
+ },
+ { .name = "NAND KERNEL partition",
+ .offset = 4 * 0x100000,
+ .size = 4 * 0x100000,
+ },
+ { .name = "NAND ROOTFS partition",
+ .offset = 8 * 0x100000,
+ .size = 504 * 0x100000,
+ },
+ { .name = "NAND DATA partition",
+ .offset = 512 * 0x100000,
+ .size = 512 * 0x100000,
+ },
+};
+#else
+static struct nand_ecclayout qi_lb60_ecclayout = {
+ .eccbytes = 72,
+ .eccpos = {
+ 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 81, 82, 83},
+ .oobfree = {
+ {.offset = 2,
+ .length = 10},
+ {.offset = 84,
+ .length = 44}}
+};
+
+static struct mtd_partition qi_lb60_partitions[] = {
+ { .name = "NAND BOOT partition",
+ .offset = 0 * 0x100000,
+ .size = 4 * 0x100000,
+ },
+ { .name = "NAND KERNEL partition",
+ .offset = 4 * 0x100000,
+ .size = 4 * 0x100000,
+ },
+ { .name = "NAND ROOTFS partition",
+ .offset = 8 * 0x100000,
+ .size = 504 * 0x100000,
+ },
+ { .name = "NAND DATA partition",
+ .offset = 512 * 0x100000,
+ .size = (512 + 1024) * 0x100000,
+ },
};
+#endif /* QI_LB60_1GB_NAND */
static struct jz_nand_platform_data jz_nand_platform_data = {
.num_partitions = ARRAY_SIZE(qi_lb60_partitions),
@@ -219,7 +260,9 @@ static struct platform_device jz_nand_de
.platform_data = &jz_nand_platform_data,
}
};
-#define KEEP_UART_ALIVE
+/* #define KEEP_UART_ALIVE
+ * don't define this. the keyboard and keyboard both work
+ */
#define KEY_QI_QI KEY_F13
#define KEY_QI_UPRED KEY_F14
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -135,7 +135,7 @@ struct nand_oobfree {

View File

@ -1,86 +0,0 @@
--- a/arch/mips/include/asm/mach-jz4740/board-qi_lb60.h
+++ b/arch/mips/include/asm/mach-jz4740/board-qi_lb60.h
@@ -1,49 +1,57 @@
/*
- * linux/include/asm-mips/mach-jz4740/board-qi_lb60.h
- *
- * Copyright (c) 2009 Qi Hardware inc.,
+ * Copyright (c) 2009 Qi Hardware Inc.,
* Author: Xiangfu Liu <xiangfu@qi-hardware.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ASM_JZ4740_QI_LB60_H__
#define __ASM_JZ4740_QI_LB60_H__
+#include <linux/gpio.h>
/*
* Frequencies of on-board oscillators
*/
#define JZ_EXTAL 12000000 /* Main extal freq: 12 MHz */
-#define JZ_EXTAL2 32768 /* RTC extal freq: 32.768 KHz */
+#define JZ_EXTAL_RTC 32768 /* RTC extal freq: 32.768 KHz */
/*
* GPIO
*/
-#define GPIO_DC_DETE_N (2 * 32 + 26)
-#define GPIO_CHARG_STAT_N (2 * 32 + 27)
-#define GPIO_LED_EN (2 * 32 + 28)
-#define GPIO_LCD_CS (2 * 32 + 21)
-#define GPIO_DISP_OFF_N (3 * 32 + 21)
-#define GPIO_PWM (3 * 32 + 27)
-
-#define GPIO_AMP_EN (3 * 32 + 4)
-
-#define GPIO_SD_CD_N (3 * 32 + 0)
-#define GPIO_SD_VCC_EN_N (3 * 32 + 2)
-#define GPIO_SD_WP (3 * 32 + 16)
+#define GPIO_DC_DETE_N JZ_GPIO_PORTC(26)
+#define GPIO_CHARG_STAT_N JZ_GPIO_PORTC(27)
+#define GPIO_LED_EN JZ_GPIO_PORTC(28)
+#define GPIO_LCD_CS JZ_GPIO_PORTC(21)
+#define GPIO_DISP_OFF_N JZ_GPIO_PORTD(21)
+#define GPIO_PWM JZ_GPIO_PORTD(27)
+
+#define GPIO_AMP_EN JZ_GPIO_PORTD(4)
+
+#define GPIO_SD_CD_N JZ_GPIO_PORTD(0)
+#define GPIO_SD_VCC_EN_N JZ_GPIO_PORTD(2)
+#define GPIO_SD_WP JZ_GPIO_PORTD(16)
-#define GPIO_USB_DETE (3 * 32 + 28)
-#define GPIO_BUZZ_PWM (3 * 32 + 27)
+#define GPIO_USB_DETE JZ_GPIO_PORTD(28)
+#define GPIO_BUZZ_PWM JZ_GPIO_PORTD(27)
#define GPIO_UDC_HOTPLUG GPIO_USB_DETE
-#define GPIO_AUDIO_POP (1 * 32 + 29)
-#define GPIO_COB_TEST (1 * 32 + 30)
+#define GPIO_AUDIO_POP JZ_GPIO_PORTB(29)
+#define GPIO_COB_TEST JZ_GPIO_PORTB(30)
-#define GPIO_KEYOUT_BASE (2 * 32 + 10)
-#define GPIO_KEYIN_BASE (3 * 32 + 18)
-#define GPIO_KEYIN_8 (3 * 32 + 26)
+#define GPIO_KEYOUT_BASE JZ_GPIO_PORTC(10)
+#define GPIO_KEYIN_BASE JZ_GPIO_PORTD(18)
+#define GPIO_KEYIN_8 JZ_GPIO_PORTD(26)
/*
* MMC/SD

View File

@ -1,28 +1,3 @@
--- a/arch/mips/jz4740/platform.c
+++ b/arch/mips/jz4740/platform.c
@@ -264,10 +264,11 @@ static struct platform_device jz_nand_de
* don't define this. the keyboard and keyboard both work
*/
-#define KEY_QI_QI KEY_F13
-#define KEY_QI_UPRED KEY_F14
+#define KEY_QI_QI KEY_F13
+#define KEY_QI_UPRED KEY_RIGHTSHIFT
#define KEY_QI_VOLUP KEY_F15
#define KEY_QI_VOLDOWN KEY_F16
+#define KEY_QI_FN KEY_RIGHTCTRL
static const uint32_t qi_lb60_keymap[] = {
KEY(0, 0, KEY_F1), /* S2 */
@@ -330,7 +331,7 @@ static const uint32_t qi_lb60_keymap[] =
#ifndef KEEP_UART_ALIVE
KEY(7, 0, KEY_LEFTSHIFT), /* S58 */
KEY(7, 1, KEY_LEFTALT), /* S59 */
- KEY(7, 2, KEY_FN), /* S60 */
+ KEY(7, 2, KEY_QI_FN), /* S60 */
#endif
};
--- a/drivers/char/defkeymap.map
+++ b/drivers/char/defkeymap.map
@@ -1,5 +1,5 @@

View File

@ -1,59 +0,0 @@
--- a/arch/mips/include/asm/mach-jz4740/board-qi_lb60.h
+++ b/arch/mips/include/asm/mach-jz4740/board-qi_lb60.h
@@ -35,6 +35,7 @@
#define GPIO_LCD_CS JZ_GPIO_PORTC(21)
#define GPIO_DISP_OFF_N JZ_GPIO_PORTD(21)
#define GPIO_PWM JZ_GPIO_PORTD(27)
+#define GPIO_WAKEUP_N JZ_GPIO_PORTD(29)
#define GPIO_AMP_EN JZ_GPIO_PORTD(4)
--- a/arch/mips/jz4740/platform.c
+++ b/arch/mips/jz4740/platform.c
@@ -21,6 +21,8 @@
#include <linux/spi/spi_gpio.h>
#include <linux/power_supply.h>
#include <linux/power/jz4740-battery.h>
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
#include <asm/jzsoc.h>
#include <asm/gpio.h>
@@ -513,6 +515,29 @@ static struct platform_device jz_battery
},
};
+/* GPIO Key: power */
+static const struct gpio_keys_button qi_lb60_gpio_keys_buttons[] = {
+ [0] = {
+ .code = KEY_POWER,
+ .gpio = GPIO_WAKEUP_N,
+ .active_low = 1,
+ .desc = "Power",
+ },
+};
+
+static const struct gpio_keys_platform_data qi_lb60_gpio_keys_data = {
+ .nbuttons = ARRAY_SIZE(qi_lb60_gpio_keys_buttons),
+ .buttons = qi_lb60_gpio_keys_buttons,
+};
+
+static struct platform_device qi_lb60_gpio_keys = {
+ .name = "gpio-keys",
+ .id = -1,
+ .dev = {
+ .platform_data = &qi_lb60_gpio_keys_data,
+ }
+};
+
/* All */
static struct platform_device *jz_platform_devices[] __initdata = {
&jz_usb_ohci_device,
@@ -528,6 +553,7 @@ static struct platform_device *jz_platfo
&jz_rtc_device,
&jz_adc_device,
&jz_battery_device,
+ &qi_lb60_gpio_keys,
};
static int __init jz_platform_init(void)