Created
February 14, 2026 05:01
-
-
Save tmzt/4f66c6f728e04a4a3cf92d208b88a0d2 to your computer and use it in GitHub Desktop.
Moto Q CDMA Board (found in email archive sent at Oct 24, 2008, 4:43 PM)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from: Timothy Meade <zt.tmzt@gmail.com> | |
| to: drwyrm@gmail.com | |
| date: Oct 24, 2008, 4:43 PM | |
| subject: Moto Q Board | |
| mailed-by: gmail.com | |
| --- ORIGINAL --- | |
| NOT SIGNED OFF | |
| #include <linux/kernel.h> | |
| #include <linux/init.h> | |
| #include <linux/platform_device.h> | |
| #include <linux/major.h> | |
| #include <linux/fs.h> | |
| #include <linux/interrupt.h> | |
| #include <linux/mmc/host.h> | |
| #include <linux/pm.h> | |
| #include <linux/backlight.h> | |
| #include <asm/setup.h> | |
| #include <asm/memory.h> | |
| #include <asm/hardware.h> | |
| #include <asm/mach-types.h> | |
| #include <asm/irq.h> | |
| #include <asm/io.h> | |
| #include <asm/system.h> | |
| #include <asm/mach/arch.h> | |
| #include <asm/mach/map.h> | |
| #include <asm/mach/irq.h> | |
| #include <asm/arch/gpio.h> | |
| #include <asm/arch/pxa-regs.h> | |
| #include <asm/arch/pxa2xx-gpio.h> | |
| #include <asm/arch/irda.h> | |
| #include <asm/arch/mmc.h> | |
| #include <asm/arch/udc.h> | |
| #include <asm/arch/pxafb.h> | |
| #include <asm/arch/pxa27x_keypad.h> | |
| #include "generic.h" | |
| #include "devices.h" | |
| #define GPIO11_MOTOQ_SD_N 11 | |
| //#define MOTOQ_GPIO_USB_PULLUP 65 | |
| #define MOTOQ_GPIO_USB_PULLUP 19 | |
| #define MOTOQ_GPIO_USB_VBUS 18 | |
| static void motoq_lcd_power(int on, struct fb_var_screeninfo *var) | |
| { | |
| if(on) { | |
| //udelay(6000); | |
| } | |
| }; | |
| static struct pxafb_mode_info motoq_lcd_mode = { | |
| /* values from apache handhelds.org */ | |
| .pixclock = 192307, | |
| .xres = 240, | |
| .yres = 320, | |
| .bpp = 16, | |
| .hsync_len = 11, | |
| .vsync_len = 3, | |
| // margin from CE on apache | |
| /*.left_margin = 15, */ | |
| .left_margin = 1, | |
| .right_margin = 10, | |
| .upper_margin = 2, | |
| .lower_margin = 2, | |
| }; | |
| static struct pxafb_mach_info motoq_lcd_info = { | |
| .modes = &motoq_lcd_mode, | |
| .num_modes = 1, | |
| .lcd_conn = LCD_COLOR_TFT_16BPP, | |
| /*.lccr0 = LCCR0_LDDALT | LCCR0_Alt, */ | |
| .pxafb_lcd_power = motoq_lcd_power, | |
| }; | |
| static unsigned int motoq_matrix_key_map[] = { | |
| KEY(0,0,KEY_O), | |
| KEY(0,1,KEY_Y), | |
| KEY(0,2,KEY_A), | |
| KEY(0,3,KEY_D), | |
| KEY(0,4,KEY_W), | |
| KEY(0,5,KEY_G), | |
| KEY(0,6,KEY_J), | |
| KEY(0,7,KEY_L), | |
| KEY(1,0,KEY_U), | |
| KEY(1,1,KEY_V), | |
| KEY(1,2,KEY_DOT), | |
| KEY(1,3,KEY_0), | |
| KEY(1,4,KEY_LEFTALT), /* speakerphone */ | |
| KEY(1,5,KEY_LEFTCTRL), /* mail ??!! */ | |
| KEY(1,6,KEY_8), | |
| KEY(1,7,KEY_ENTER), | |
| KEY(2,0,KEY_F), | |
| KEY(2,1,KEY_O), | |
| KEY(2,2,KEY_O), | |
| KEY(2,3,KEY_Z), | |
| KEY(2,4,KEY_ENTER), /* wheel back/wheel click ?? */ | |
| KEY(2,5,KEY_LEFTCTRL), | |
| KEY(2,6,KEY_RIGHTSHIFT), /* shift ! */ | |
| KEY(2,7,KEY_R), | |
| KEY(3,0,KEY_T), | |
| KEY(3,1,KEY_E), /* e !! */ | |
| KEY(3,2,KEY_RIGHTALT), /* fn !?? */ | |
| KEY(3,3,KEY_I), | |
| KEY(3,4,KEY_ESC), /* back wheel ? */ | |
| KEY(3,5,KEY_B), | |
| KEY(3,6,KEY_TAB), /* right softkey */ | |
| KEY(3,7,KEY_4), | |
| KEY(4,0,KEY_H), | |
| KEY(4,1,KEY_LEFTCTRL), /* mail */ | |
| KEY(4,2,KEY_X), | |
| KEY(4,3,KEY_V), | |
| KEY(4,4,KEY_LEFTCTRL), /* left softkey */ | |
| KEY(4,5,KEY_P), | |
| KEY(4,6,KEY_M), | |
| KEY(4,7,KEY_UP), /* up ? */ | |
| KEY(5,0,KEY_K), | |
| KEY(5,1,KEY_ENTER), /* ok (center button) */ | |
| KEY(5,2,KEY_N), | |
| KEY(5,3,KEY_RIGHT), /* not B? */ | |
| KEY(5,4,KEY_DOWN), /* down */ | |
| KEY(5,5,KEY_C), | |
| KEY(5,6,KEY_LEFT), /* left? */ | |
| KEY(5,7,KEY_Q), | |
| KEY(6,0,KEY_S), | |
| KEY(6,1,KEY_SPACE), | |
| KEY(6,2,KEY_ENTER), /* return key */ | |
| KEY(6,3,KEY_N), | |
| KEY(6,4,KEY_RIGHT), /* right? */ | |
| KEY(6,5,KEY_MINUS), /* call? (green phone) */ | |
| KEY(6,6,KEY_RIGHTALT), /* fn !!!!! */ | |
| KEY(6,7,KEY_SLASH), /* home (house) */ | |
| KEY(7,0,KEY_LEFTBRACE), /* alt/fn ? */ | |
| KEY(7,1,KEY_Y), | |
| KEY(7,2,KEY_BACKSPACE), /* backspace ? */ | |
| KEY(7,3,KEY_BACKSPACE), /* backspace !? */ | |
| KEY(7,4,KEY_K), | |
| KEY(7,5,KEY_C), | |
| KEY(7,6,KEY_RIGHTALT), /* fn ??? was E */ | |
| KEY(7,7,KEY_9), | |
| }; | |
| static struct pxa27x_keypad_platform_data motoq_keypad_info = { | |
| .matrix_key_rows = 8, | |
| .matrix_key_cols = 8, | |
| .matrix_key_map = motoq_matrix_key_map, | |
| .matrix_key_map_size = ARRAY_SIZE(motoq_matrix_key_map), | |
| .debounce_interval = 30, /* from littleton.c */ | |
| }; | |
| static void motoq_init_keypad(void) | |
| { | |
| pxa_set_keypad_info(&motoq_keypad_info); | |
| }; | |
| static void motoq_init_lcd(void) | |
| { | |
| set_pxa_fb_info(&motoq_lcd_info); | |
| }; | |
| static int motoq_mci_init(struct device *dev, | |
| irq_handler_t detect_irq, void *data) | |
| { | |
| int err; | |
| err = request_irq(gpio_to_irq(GPIO11_MOTOQ_SD_N), detect_irq, | |
| (IRQF_DISABLED | IRQF_TRIGGER_FALLING | |
| | IRQF_TRIGGER_RISING), | |
| "MMC card detect", data); | |
| if (err) { | |
| printk("could not request mmc card detect irq\n"); | |
| return -ENODEV; | |
| }; | |
| return 0; | |
| }; | |
| static void motoq_mci_exit(struct device *dev, void *data) | |
| { | |
| free_irq(gpio_to_irq(GPIO11_MOTOQ_SD_N), data); | |
| }; | |
| static struct pxamci_platform_data motoq_mci_info = { | |
| .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | |
| .init = motoq_mci_init, | |
| .exit = motoq_mci_exit, | |
| }; | |
| static void motoq_udc_command(int cmd) | |
| { | |
| switch(cmd) { | |
| case PXA2XX_UDC_CMD_CONNECT: | |
| printk("udc: connect\n"); | |
| gpio_set_value(MOTOQ_GPIO_USB_PULLUP, 1); | |
| break; | |
| case PXA2XX_UDC_CMD_DISCONNECT: | |
| printk("udc: disconnect\n"); | |
| gpio_set_value(MOTOQ_GPIO_USB_PULLUP, 0); | |
| break; | |
| }; | |
| }; | |
| static struct pxa2xx_udc_mach_info motoq_udc_info __initdata = { | |
| .udc_command = motoq_udc_command, | |
| .gpio_vbus = MOTOQ_GPIO_USB_VBUS, | |
| }; | |
| static irqreturn_t motoq_usb_irq(int irq, void *data) | |
| { | |
| printk(KERN_INFO "GOT UDC IRQ\n"); | |
| gpio_set_value(MOTOQ_GPIO_USB_PULLUP, 1); | |
| UP2OCR = 0x02000000; | |
| } | |
| static void __init motoq_init(void) | |
| { | |
| motoq_init_lcd(); | |
| motoq_init_keypad(); | |
| pxa_set_mci_info(&motoq_mci_info); | |
| int err; | |
| err = request_irq(gpio_to_irq(MOTOQ_GPIO_USB_VBUS), &motoq_usb_irq, | |
| (IRQF_DISABLED | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING), "motoq | |
| udc", NULL); | |
| if (err) | |
| printk(KERN_ERR "count not request vbus irq\n"); | |
| pxa_set_udc_info(&motoq_udc_info); | |
| }; | |
| MACHINE_START(MOTOQ, "Motorola Q CDMA (Franklin)") | |
| .phys_io = 0x40000000, | |
| .boot_params = 0xa0000100, | |
| .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
| .map_io = pxa_map_io, | |
| .init_irq = pxa27x_init_irq, | |
| .timer = &pxa_timer, | |
| .init_machine = motoq_init, | |
| MACHINE_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment