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/system_info.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/irq.h>
24 #include <mach/pxa3xx-regs.h>
25 #include "mfp-pxa300.h"
27 #include <linux/platform_data/mmc-pxamci.h>
28 #include <linux/platform_data/video-pxafb.h>
29 #include <linux/platform_data/mtd-nand-pxa3xx.h>
34 #if defined(CONFIG_AX88796)
35 #define ETHER_ADDR_LEN 6
36 static u8 ether_mac_addr[ETHER_ADDR_LEN];
38 void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data)
41 u64 serial = ((u64) system_serial_high << 32) | system_serial_low;
44 * If the bootloader passed in a serial boot tag, which contains a
45 * valid ethernet MAC, pass it to the interface. Toradex ships the
46 * modules with their own bootloader which provides a valid MAC
50 for (i = 0; i < ETHER_ADDR_LEN; i++) {
51 ether_mac_addr[i] = serial & 0xff;
55 if (is_valid_ether_addr(ether_mac_addr)) {
56 plat_data->flags |= AXFLG_MAC_FROMPLATFORM;
57 plat_data->mac_addr = ether_mac_addr;
58 printk(KERN_INFO "%s(): taking MAC from serial boot tag\n",
61 plat_data->flags |= AXFLG_MAC_FROMDEV;
62 printk(KERN_INFO "%s(): no valid serial boot tag found, "
63 "taking MAC from device\n", __func__);
68 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
69 static int lcd_bl_pin;
72 * LCD panel (Sharp LQ043T3DX02)
74 static void colibri_lcd_backlight(int on)
76 gpio_set_value(lcd_bl_pin, !!on);
79 static struct pxafb_mode_info sharp_lq43_mode = {
95 static struct pxafb_mach_info sharp_lq43_info = {
96 .modes = &sharp_lq43_mode,
100 .lcd_conn = LCD_COLOR_TFT_18BPP,
101 .pxafb_backlight_power = colibri_lcd_backlight,
104 void __init colibri_pxa3xx_init_lcd(int bl_pin)
107 gpio_request(bl_pin, "lcd backlight");
108 gpio_direction_output(bl_pin, 0);
109 pxa_set_fb_info(NULL, &sharp_lq43_info);
113 #if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
114 static struct mtd_partition colibri_nand_partitions[] = {
116 .name = "bootloader",
119 .mask_flags = MTD_WRITEABLE, /* force read-only */
123 .offset = MTDPART_OFS_APPEND,
125 .mask_flags = MTD_WRITEABLE, /* force read-only */
129 .offset = MTDPART_OFS_APPEND,
131 .mask_flags = MTD_WRITEABLE, /* force read-only */
135 .offset = MTDPART_OFS_APPEND,
136 .size = MTDPART_SIZ_FULL,
140 static struct pxa3xx_nand_platform_data colibri_nand_info = {
142 .parts = colibri_nand_partitions,
143 .nr_parts = ARRAY_SIZE(colibri_nand_partitions),
146 void __init colibri_pxa3xx_init_nand(void)
148 pxa3xx_set_nand_info(&colibri_nand_info);