2 * arch/arm/mach-pxa/colibri-pxa3xx.c
4 * Common functions for all Toradex PXA3xx modules
6 * Daniel Mack <daniel@caiaq.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/init.h>
14 #include <linux/kernel.h>
15 #include <linux/platform_device.h>
16 #include <linux/gpio.h>
17 #include <linux/etherdevice.h>
18 #include <asm/mach-types.h>
19 #include <mach/hardware.h>
20 #include <asm/sizes.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/irq.h>
23 #include <mach/pxa3xx-regs.h>
24 #include <mach/mfp-pxa300.h>
25 #include <mach/colibri.h>
27 #include <mach/pxafb.h>
32 #if defined(CONFIG_AX88796)
33 #define ETHER_ADDR_LEN 6
34 static u8 ether_mac_addr[ETHER_ADDR_LEN];
36 void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data)
39 u64 serial = ((u64) system_serial_high << 32) | system_serial_low;
42 * If the bootloader passed in a serial boot tag, which contains a
43 * valid ethernet MAC, pass it to the interface. Toradex ships the
44 * modules with their own bootloader which provides a valid MAC
48 for (i = 0; i < ETHER_ADDR_LEN; i++) {
49 ether_mac_addr[i] = serial & 0xff;
53 if (is_valid_ether_addr(ether_mac_addr)) {
54 plat_data->flags |= AXFLG_MAC_FROMPLATFORM;
55 plat_data->mac_addr = ether_mac_addr;
56 printk(KERN_INFO "%s(): taking MAC from serial boot tag\n",
59 plat_data->flags |= AXFLG_MAC_FROMDEV;
60 printk(KERN_INFO "%s(): no valid serial boot tag found, "
61 "taking MAC from device\n", __func__);
66 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
67 static int mmc_detect_pin;
69 static int colibri_pxa3xx_mci_init(struct device *dev,
70 irq_handler_t colibri_mmc_detect_int,
75 ret = gpio_request(mmc_detect_pin, "mmc card detect");
79 gpio_direction_input(mmc_detect_pin);
80 ret = request_irq(gpio_to_irq(mmc_detect_pin), colibri_mmc_detect_int,
81 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
82 "MMC card detect", data);
84 gpio_free(mmc_detect_pin);
91 static void colibri_pxa3xx_mci_exit(struct device *dev, void *data)
93 free_irq(mmc_detect_pin, data);
94 gpio_free(gpio_to_irq(mmc_detect_pin));
97 static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = {
99 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
100 .init = colibri_pxa3xx_mci_init,
101 .exit = colibri_pxa3xx_mci_exit,
104 void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin)
106 pxa3xx_mfp_config(pins, len);
107 mmc_detect_pin = detect_pin;
108 pxa_set_mci_info(&colibri_pxa3xx_mci_platform_data);
110 #endif /* CONFIG_MMC_PXA || CONFIG_MMC_PXA_MODULE */
112 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
113 static int lcd_bl_pin;
116 * LCD panel (Sharp LQ043T3DX02)
118 static void colibri_lcd_backlight(int on)
120 gpio_set_value(lcd_bl_pin, !!on);
123 static struct pxafb_mode_info sharp_lq43_mode = {
139 static struct pxafb_mach_info sharp_lq43_info = {
140 .modes = &sharp_lq43_mode,
144 .lcd_conn = LCD_COLOR_TFT_18BPP,
145 .pxafb_backlight_power = colibri_lcd_backlight,
148 void __init colibri_pxa3xx_init_lcd(int bl_pin)
151 gpio_request(bl_pin, "lcd backlight");
152 gpio_direction_output(bl_pin, 0);
153 set_pxa_fb_info(&sharp_lq43_info);