]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/arm/mach-pxa/colibri-pxa3xx.c
[ARM] pxa/ezx: set IRQ_BOARD_END for EZX
[mirror_ubuntu-artful-kernel.git] / arch / arm / mach-pxa / colibri-pxa3xx.c
CommitLineData
acb36559
DM
1/*
2 * arch/arm/mach-pxa/colibri-pxa3xx.c
3 *
4 * Common functions for all Toradex PXA3xx modules
5 *
6 * Daniel Mack <daniel@caiaq.de>
7 *
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.
11 */
12
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/gpio.h>
22a0200b 17#include <linux/etherdevice.h>
acb36559
DM
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>
26#include <mach/mmc.h>
91fcfb90 27#include <mach/pxafb.h>
acb36559
DM
28
29#include "generic.h"
30#include "devices.h"
31
22a0200b
DM
32#if defined(CONFIG_AX88796)
33#define ETHER_ADDR_LEN 6
34static u8 ether_mac_addr[ETHER_ADDR_LEN];
35
36void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data)
37{
38 int i;
39 u64 serial = ((u64) system_serial_high << 32) | system_serial_low;
40
41 /*
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
45 * this way.
46 */
47
48 for (i = 0; i < ETHER_ADDR_LEN; i++) {
49 ether_mac_addr[i] = serial & 0xff;
50 serial >>= 8;
51 }
52
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",
57 __func__);
58 } else {
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__);
62 }
63}
64#endif
65
acb36559
DM
66#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
67static int mmc_detect_pin;
68
69static int colibri_pxa3xx_mci_init(struct device *dev,
70 irq_handler_t colibri_mmc_detect_int,
71 void *data)
72{
73 int ret;
74
75 ret = gpio_request(mmc_detect_pin, "mmc card detect");
76 if (ret)
77 return ret;
78
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);
83 if (ret) {
84 gpio_free(mmc_detect_pin);
85 return ret;
86 }
87
88 return 0;
89}
90
91static void colibri_pxa3xx_mci_exit(struct device *dev, void *data)
92{
93 free_irq(mmc_detect_pin, data);
94 gpio_free(gpio_to_irq(mmc_detect_pin));
95}
96
97static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = {
7a648256
RJ
98 .detect_delay = 20,
99 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
100 .init = colibri_pxa3xx_mci_init,
101 .exit = colibri_pxa3xx_mci_exit,
102 .gpio_card_detect = -1,
103 .gpio_card_ro = -1,
104 .gpio_power = -1,
acb36559
DM
105};
106
107void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin)
108{
109 pxa3xx_mfp_config(pins, len);
110 mmc_detect_pin = detect_pin;
111 pxa_set_mci_info(&colibri_pxa3xx_mci_platform_data);
112}
113#endif /* CONFIG_MMC_PXA || CONFIG_MMC_PXA_MODULE */
114
91fcfb90
DM
115#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
116static int lcd_bl_pin;
117
118/*
119 * LCD panel (Sharp LQ043T3DX02)
120 */
121static void colibri_lcd_backlight(int on)
122{
123 gpio_set_value(lcd_bl_pin, !!on);
124}
125
126static struct pxafb_mode_info sharp_lq43_mode = {
127 .pixclock = 101936,
128 .xres = 480,
129 .yres = 272,
130 .bpp = 32,
131 .depth = 18,
132 .hsync_len = 41,
133 .left_margin = 2,
134 .right_margin = 2,
135 .vsync_len = 10,
136 .upper_margin = 2,
137 .lower_margin = 2,
138 .sync = 0,
139 .cmap_greyscale = 0,
140};
141
142static struct pxafb_mach_info sharp_lq43_info = {
143 .modes = &sharp_lq43_mode,
144 .num_modes = 1,
145 .cmap_inverse = 0,
146 .cmap_static = 0,
147 .lcd_conn = LCD_COLOR_TFT_18BPP,
148 .pxafb_backlight_power = colibri_lcd_backlight,
149};
150
151void __init colibri_pxa3xx_init_lcd(int bl_pin)
152{
153 lcd_bl_pin = bl_pin;
154 gpio_request(bl_pin, "lcd backlight");
155 gpio_direction_output(bl_pin, 0);
156 set_pxa_fb_info(&sharp_lq43_info);
157}
158#endif
159