Path: blob/master/arch/arm/mach-pxa/colibri-pxa3xx.c
10817 views
/*1* arch/arm/mach-pxa/colibri-pxa3xx.c2*3* Common functions for all Toradex PXA3xx modules4*5* Daniel Mack <[email protected]>6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*/1112#include <linux/init.h>13#include <linux/kernel.h>14#include <linux/platform_device.h>15#include <linux/gpio.h>16#include <linux/etherdevice.h>17#include <asm/mach-types.h>18#include <mach/hardware.h>19#include <asm/sizes.h>20#include <asm/mach/arch.h>21#include <asm/mach/irq.h>22#include <mach/pxa3xx-regs.h>23#include <mach/mfp-pxa300.h>24#include <mach/colibri.h>25#include <mach/mmc.h>26#include <mach/pxafb.h>27#include <plat/pxa3xx_nand.h>2829#include "generic.h"30#include "devices.h"3132#if defined(CONFIG_AX88796)33#define ETHER_ADDR_LEN 634static u8 ether_mac_addr[ETHER_ADDR_LEN];3536void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data)37{38int i;39u64 serial = ((u64) system_serial_high << 32) | system_serial_low;4041/*42* If the bootloader passed in a serial boot tag, which contains a43* valid ethernet MAC, pass it to the interface. Toradex ships the44* modules with their own bootloader which provides a valid MAC45* this way.46*/4748for (i = 0; i < ETHER_ADDR_LEN; i++) {49ether_mac_addr[i] = serial & 0xff;50serial >>= 8;51}5253if (is_valid_ether_addr(ether_mac_addr)) {54plat_data->flags |= AXFLG_MAC_FROMPLATFORM;55plat_data->mac_addr = ether_mac_addr;56printk(KERN_INFO "%s(): taking MAC from serial boot tag\n",57__func__);58} else {59plat_data->flags |= AXFLG_MAC_FROMDEV;60printk(KERN_INFO "%s(): no valid serial boot tag found, "61"taking MAC from device\n", __func__);62}63}64#endif6566#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)67static int lcd_bl_pin;6869/*70* LCD panel (Sharp LQ043T3DX02)71*/72static void colibri_lcd_backlight(int on)73{74gpio_set_value(lcd_bl_pin, !!on);75}7677static struct pxafb_mode_info sharp_lq43_mode = {78.pixclock = 101936,79.xres = 480,80.yres = 272,81.bpp = 32,82.depth = 18,83.hsync_len = 41,84.left_margin = 2,85.right_margin = 2,86.vsync_len = 10,87.upper_margin = 2,88.lower_margin = 2,89.sync = 0,90.cmap_greyscale = 0,91};9293static struct pxafb_mach_info sharp_lq43_info = {94.modes = &sharp_lq43_mode,95.num_modes = 1,96.cmap_inverse = 0,97.cmap_static = 0,98.lcd_conn = LCD_COLOR_TFT_18BPP,99.pxafb_backlight_power = colibri_lcd_backlight,100};101102void __init colibri_pxa3xx_init_lcd(int bl_pin)103{104lcd_bl_pin = bl_pin;105gpio_request(bl_pin, "lcd backlight");106gpio_direction_output(bl_pin, 0);107pxa_set_fb_info(NULL, &sharp_lq43_info);108}109#endif110111#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)112static struct mtd_partition colibri_nand_partitions[] = {113{114.name = "bootloader",115.offset = 0,116.size = SZ_512K,117.mask_flags = MTD_WRITEABLE, /* force read-only */118},119{120.name = "kernel",121.offset = MTDPART_OFS_APPEND,122.size = SZ_4M,123.mask_flags = MTD_WRITEABLE, /* force read-only */124},125{126.name = "reserved",127.offset = MTDPART_OFS_APPEND,128.size = SZ_1M,129.mask_flags = MTD_WRITEABLE, /* force read-only */130},131{132.name = "fs",133.offset = MTDPART_OFS_APPEND,134.size = MTDPART_SIZ_FULL,135},136};137138static struct pxa3xx_nand_platform_data colibri_nand_info = {139.enable_arbiter = 1,140.keep_config = 1,141.parts = colibri_nand_partitions,142.nr_parts = ARRAY_SIZE(colibri_nand_partitions),143};144145void __init colibri_pxa3xx_init_nand(void)146{147pxa3xx_set_nand_info(&colibri_nand_info);148}149#endif150151152153