rendered paste bodyIndex: arch/arm/mach-pxa/htcblueangel/blueangel.c
===================================================================
RCS file: /cvs/linux/kernel26/arch/arm/mach-pxa/htcblueangel/blueangel.c,v
retrieving revision 1.37
diff -u -r1.37 blueangel.c
--- arch/arm/mach-pxa/htcblueangel/blueangel.c 25 Jul 2007 21:38:46 -0000 1.37
+++ arch/arm/mach-pxa/htcblueangel/blueangel.c 25 Jul 2007 23:22:40 -0000
@@ -23,6 +23,9 @@
#include <linux/pm.h>
#include <linux/bootmem.h>
#include <linux/platform_device.h>
+#include <linux/gpiodev.h>
+#include <linux/input.h>
+#include <linux/input_pda.h>
#include <linux/gpio_keys.h>
#include <asm/irq.h>
@@ -41,15 +44,20 @@
#include <asm/arch/udc.h>
#include <asm/hardware/ipaq-asic3.h>
-#include <asm/hardware/asic3_leds.h>
#include <asm/hardware/asic3_keys.h>
#include <asm/arch/htcblueangel.h>
#include <asm/arch/htcblueangel-gpio.h>
#include <asm/arch/htcblueangel-asic.h>
#include <linux/mfd/tsc2200.h>
+#include <linux/mfd/pasic3.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
#include <linux/serial_core.h>
#include <linux/touchscreen-adc.h>
#include <linux/adc_battery.h>
+#include <asm/hardware/asic3_leds.h>
#include <asm/arch/pxa2xx_udc_gpio.h>
#include <asm-arm/arch-pxa/serial.h>
@@ -88,7 +96,7 @@
{
.led_cdev = {
.name = "blueangel:phonebuttons",
- .default_trigger = "blueangel-phonebuttons",
+ .default_trigger = "backlight",
},
.hw_num = -1,
.gpio_num = ('B'-'A')*16+GPIOB_PHONEL_PWR_ON,
@@ -104,7 +112,7 @@
{
.led_cdev = {
.name = "blueangel:kbdbacklight",
- .default_trigger = "blueangel-kbdbacklight",
+ .default_trigger = "input-key",
},
.hw_num = -1,
.gpio_num = ('C'-'A')*16+GPIOC_KEYBL_PWR_ON,
@@ -177,10 +185,92 @@
}
};
+
+/*
+ * LEDs
+ */
+
+static struct pasic3_led pasic3_leds[] = {
+ {
+ .led = {
+ .name = "blueangel:wifi",
+ .default_trigger = "wifi", /* and WIFI */
+ .flags = LED_SUPPORTS_HWTIMER,
+ },
+ .hw_num = 1,
+ .mask = PASIC3_MASK_LED1, /* 0x08 */
+ },
+ {
+ .led = {
+ .name = "blueangel:bt",
+ .default_trigger = "bluetooth", /* and Bluetooth */
+ .flags = LED_SUPPORTS_HWTIMER,
+ },
+ .hw_num = 0,
+ .mask = PASIC3_MASK_LED0, /* 0x04 */
+ },
+};
+
+static struct platform_device pasic3;
+
+static struct pasic3_leds_machinfo __devinit pasic3_leds_machinfo = {
+ .num_leds = ARRAY_SIZE(pasic3_leds),
+ .leds = pasic3_leds,
+};
+
+static struct platform_device pasic3_led = {
+ .name = "pasic3-led",
+ .id = -1,
+ .dev = {
+ .platform_data = &pasic3_leds_machinfo,
+ },
+};
+
+/*
+ * PASIC3 with DS1WM
+ */
+
+static struct platform_device *pasic3_devices[] = {
+ &pasic3_led,
+};
+
+static struct resource pasic3_resources[] = {
+ [0] = {
+ .start = 0x11000000,
+ .end = 0x11000000 + 0x08,
+ .flags = IORESOURCE_MEM,
+ },
+ /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */
+ [1] = {
+ .start = HTCBLUEANGEL_ASIC3_IRQ_BASE + BLUEANGEL_OWM_IRQ,
+ .end = HTCBLUEANGEL_ASIC3_IRQ_BASE + BLUEANGEL_OWM_IRQ,
+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE ,
+ }
+};
+
+static struct pasic3_platform_data pasic3_platform_data = {
+ .bus_shift = 1,
+
+ .child_devs = pasic3_devices,
+ .num_child_devs = ARRAY_SIZE(pasic3_devices),
+ .clock_rate = 16000000,
+};
+
+static struct platform_device pasic3 = {
+ .name = "pasic3",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(pasic3_resources),
+ .resource = pasic3_resources,
+ .dev = {
+ .platform_data = &pasic3_platform_data,
+ },
+};
+
static void __init blueangel_init_irq( void )
{
/* Initialize standard IRQs */
pxa_init_irq();
+
}
static void ser_stuart_gpio_config(int enable)
@@ -276,39 +367,133 @@
extern struct platform_device blueangel_bl;
static struct platform_device blueangel_lcd = { .name = "blueangel-lcd", };
-static struct platform_device blueangel_leds = { .name = "blueangel-leds", };
static struct platform_device blueangel_pcmcia = { .name =
"blueangel-pcmcia", };
+/* StrataFlash */
+
+static void blueangel_set_vpp(struct map_info *map, int vpp)
+{
+ static int old_vpp = 0;
+
+/* Don't use VPP at the moment
+ if (vpp == old_vpp)
+ return;
+ if (vpp)
+ magician_egpio_set(EGPIO_NR_MAGICIAN_FLASH_VPP, 1);
+ else
+ magician_egpio_set(EGPIO_NR_MAGICIAN_FLASH_VPP, 0);
+*/
+
+ old_vpp = vpp;
+}
+
+#ifdef CONFIG_MTD_PARTITIONS
+static struct mtd_partition wince_partitions[] = {
+ {
+ name: "bootloader",
+ offset: 0,
+ size: 1*0x40000,
+ mask_flags: MTD_WRITEABLE, /* force read-only */
+ },
+ {
+ name: "osrom",
+ size: 143*0x40000,
+ mask_flags: MTD_WRITEABLE, /* force read-only */
+ offset: MTDPART_OFS_NXTBLK,
+ },
+ {
+ name: "backup_area",
+ size: 32*0x40000,
+ mask_flags: MTD_WRITEABLE, /* force read-only */
+ offset: MTDPART_OFS_NXTBLK,
+ },
+ {
+ name: "extrom",
+ size: 76*0x40000,
+ mask_flags: MTD_WRITEABLE, /* force read-only */
+ offset: MTDPART_OFS_NXTBLK,
+ },
+ {
+ name: "unused",
+ size: 2*0x40000,
+ mask_flags: MTD_WRITEABLE, /* force read-only */
+ offset: MTDPART_OFS_NXTBLK,
+ },
+ {
+ name: "splash",
+ size: 1*0x40000,
+ offset: MTDPART_OFS_NXTBLK,
+ },
+ {
+ name: "asset",
+ size: 1*0x40000,
+ mask_flags: MTD_WRITEABLE, /* force read-only */
+ offset: MTDPART_OFS_NXTBLK,
+ },
+};
+#endif
+
+#define WINDOW_SIZE 32*1024*1024
+
+static struct resource blueangel_flash_resource = {
+ .start = 0x0,
+ .end = 0x0 + WINDOW_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+};
+
+struct physmap_flash_data blueangel_flash_data = {
+ .width = 4,
+ .set_vpp = blueangel_set_vpp,
+#ifdef CONFIG_MTD_PARTITIONS
+ .nr_parts = ARRAY_SIZE(wince_partitions),
+ .parts = wince_partitions,
+#endif
+};
+
+static struct platform_device blueangel_flash = {
+ .name = "physmap-flash",
+ .id = -1,
+ .num_resources = 1,
+ .resource = &blueangel_flash_resource,
+ .dev = {
+ .platform_data = &blueangel_flash_data,
+ },
+};
+
/*
- * ASIC3 buttons
+ * GPIO buttons
*/
+static struct gpio_keys_button blueangel_button_table[] = {
+
+ { KEY_POWER, GPIO_NR_BLUEANGEL_POWER_BUTTON_N, 1 },
-static struct asic3_keys_button blueangel_asic3_keys_table[] = {
- {KEY_RECORD, BLUEANGEL_RECORD_BTN_IRQ, 1, "Record Button"},
- {KEY_VOLUMEUP, BLUEANGEL_VOL_UP_BTN_IRQ, 1, "Volume Up Button"},
- {KEY_VOLUMEDOWN, BLUEANGEL_VOL_DOWN_BTN_IRQ, 1, "Volume Down Button"},
- {KEY_CAMERA, BLUEANGEL_CAMERA_BTN_IRQ, 1, "Camera Button"},
- {KEY_MENU, BLUEANGEL_WINDOWS_BTN_IRQ, 1, "Windows Button"},
- {KEY_EMAIL, BLUEANGEL_MAIL_BTN_IRQ, 1, "Mail Button"},
- {KEY_WWW, BLUEANGEL_WWW_BTN_IRQ, 1, "Internet Button"},
- {KEY_KPENTER, BLUEANGEL_OK_BTN_IRQ, 1, "Ok Button"},
+ {KEY_RECORD, HTCBLUEANGEL_ASIC3_GPIO_BASE + BLUEANGEL_RECORD_BTN_IRQ, 1, "Record Button"},
+ {KEY_VOLUMEUP, HTCBLUEANGEL_ASIC3_GPIO_BASE + BLUEANGEL_VOL_UP_BTN_IRQ, 1, "Volume Up Button"},
+ {KEY_VOLUMEDOWN, HTCBLUEANGEL_ASIC3_GPIO_BASE + BLUEANGEL_VOL_DOWN_BTN_IRQ, 1, "Volume Down Button"},
+ {KEY_CAMERA, HTCBLUEANGEL_ASIC3_GPIO_BASE + BLUEANGEL_CAMERA_BTN_IRQ, 1, "Camera Button"},
+ {KEY_MENU, HTCBLUEANGEL_ASIC3_GPIO_BASE + BLUEANGEL_WINDOWS_BTN_IRQ, 1, "Windows Button"},
+ {KEY_EMAIL, HTCBLUEANGEL_ASIC3_GPIO_BASE + BLUEANGEL_MAIL_BTN_IRQ, 1, "Mail Button"},
+ {KEY_WWW, HTCBLUEANGEL_ASIC3_GPIO_BASE + BLUEANGEL_WWW_BTN_IRQ, 1, "Internet Button"},
+ {KEY_KPENTER, HTCBLUEANGEL_ASIC3_GPIO_BASE + BLUEANGEL_OK_BTN_IRQ, 1, "Ok Button"},
};
-static struct asic3_keys_platform_data blueangel_asic3_keys_data = {
- .buttons = blueangel_asic3_keys_table,
- .nbuttons = ARRAY_SIZE(blueangel_asic3_keys_table),
- .asic3_dev = &blueangel_asic3.dev,
+static struct gpio_keys_platform_data blueangel_gpio_keys_data = {
+
+ .buttons = blueangel_button_table,
+ .nbuttons = ARRAY_SIZE(blueangel_button_table),
+
};
-static struct platform_device blueangel_asic3_keys = {
- .name = "asic3-keys",
- .dev = {
- .platform_data = &blueangel_asic3_keys_data,
- }
+static struct platform_device blueangel_gpio_keys = {
+ .name = "gpio-keys",
+ .dev = {
+ .platform_data = &blueangel_gpio_keys_data,
+ },
};
+
/* UDC device */
struct pxa2xx_udc_gpio_info blueangel_udc_info = {
.detect_gpio = {&pxagpio_device.dev, GPIO_NR_BLUEANGEL_USB_DETECT_N},
@@ -334,8 +519,8 @@
#ifdef CONFIG_MACH_BLUEANGEL_BACKLIGHT
&blueangel_bl,
#endif
- &blueangel_asic3_keys,
- &blueangel_leds,
+ &pasic3,
+ &blueangel_gpio_keys,
&blueangel_pcmcia,
&blueangel_leds_pdev,
};
@@ -395,6 +580,7 @@
},
.bus_shift=1,
.irq_base = HTCBLUEANGEL_ASIC3_IRQ_BASE,
+ .gpio_base = HTCBLUEANGEL_ASIC3_GPIO_BASE,
.child_devs = blueangel_asic3_devices,
.num_child_devs = ARRAY_SIZE(blueangel_asic3_devices),
@@ -435,48 +621,20 @@
EXPORT_SYMBOL(blueangel_asic3);
/*
- * Magician LEDs
- */
-static struct platform_device blueangel_led = {
- .name = "htcblueangel-led",
- .id = -1,
-};
-
-/*
- * GPIO buttons
- */
-static struct gpio_keys_button blueangel_button_table[] = {
- { KEY_POWER, GPIO_NR_BLUEANGEL_POWER_BUTTON_N, 1 },
-};
-
-static struct gpio_keys_platform_data blueangel_pxa_keys_data = {
- .buttons = blueangel_button_table,
- .nbuttons = ARRAY_SIZE(blueangel_button_table),
-};
-
-static struct platform_device blueangel_pxa_keys = {
- .name = "gpio-keys",
- .dev = {
- .platform_data = &blueangel_pxa_keys_data,
- },
-};
-
-/*
*
*/
static struct platform_device *devices[] __initdata = {
&blueangel_asic3,
- &blueangel_led,
&blueangel_tsc2200,
- &blueangel_pxa_keys,
+ &blueangel_flash,
};
static void __init blueangel_init(void)
{
platform_add_devices (devices, ARRAY_SIZE (devices));
-
+
}
MACHINE_START(BLUEANGEL, "HTC Blueangel")
Index: include/asm-arm/arch-pxa/htcblueangel.h
===================================================================
RCS file: /cvs/linux/kernel26/include/asm-arm/arch-pxa/htcblueangel.h,v
retrieving revision 1.1
diff -u -r1.1 htcblueangel.h
--- include/asm-arm/arch-pxa/htcblueangel.h 18 Apr 2007 14:13:42 -0000 1.1
+++ include/asm-arm/arch-pxa/htcblueangel.h 25 Jul 2007 23:23:06 -0000
@@ -1,3 +1,5 @@
#include <asm/arch/irqs.h>
+#include <linux/gpiodev2.h>
#define HTCBLUEANGEL_ASIC3_IRQ_BASE IRQ_BOARD_START
+#define HTCBLUEANGEL_ASIC3_GPIO_BASE GPIO_BASE_INCREMENT