Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 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> |
Daniel Mack | 22a0200 | 2009-04-02 08:33:14 +0200 | [diff] [blame] | 17 | #include <linux/etherdevice.h> |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 18 | #include <asm/mach-types.h> |
| 19 | #include <mach/hardware.h> |
| 20 | #include <asm/sizes.h> |
David Howells | 9f97da7 | 2012-03-28 18:30:01 +0100 | [diff] [blame] | 21 | #include <asm/system_info.h> |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 22 | #include <asm/mach/arch.h> |
| 23 | #include <asm/mach/irq.h> |
| 24 | #include <mach/pxa3xx-regs.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 25 | #include "mfp-pxa300.h" |
| 26 | #include "colibri.h" |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 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> |
Daniel Mack | acb3655 | 2009-03-23 02:04:17 +0100 | [diff] [blame] | 30 | |
| 31 | #include "generic.h" |
| 32 | #include "devices.h" |
| 33 | |
Daniel Mack | 22a0200 | 2009-04-02 08:33:14 +0200 | [diff] [blame] | 34 | #if defined(CONFIG_AX88796) |
| 35 | #define ETHER_ADDR_LEN 6 |
| 36 | static u8 ether_mac_addr[ETHER_ADDR_LEN]; |
| 37 | |
| 38 | void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data) |
| 39 | { |
| 40 | int i; |
| 41 | u64 serial = ((u64) system_serial_high << 32) | system_serial_low; |
| 42 | |
| 43 | /* |
| 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 |
| 47 | * this way. |
| 48 | */ |
| 49 | |
| 50 | for (i = 0; i < ETHER_ADDR_LEN; i++) { |
| 51 | ether_mac_addr[i] = serial & 0xff; |
| 52 | serial >>= 8; |
| 53 | } |
| 54 | |
| 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", |
| 59 | __func__); |
| 60 | } else { |
| 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__); |
| 64 | } |
| 65 | } |
| 66 | #endif |
| 67 | |
Daniel Mack | 91fcfb9 | 2009-03-23 02:04:19 +0100 | [diff] [blame] | 68 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
| 69 | static int lcd_bl_pin; |
| 70 | |
| 71 | /* |
| 72 | * LCD panel (Sharp LQ043T3DX02) |
| 73 | */ |
| 74 | static void colibri_lcd_backlight(int on) |
| 75 | { |
| 76 | gpio_set_value(lcd_bl_pin, !!on); |
| 77 | } |
| 78 | |
| 79 | static struct pxafb_mode_info sharp_lq43_mode = { |
| 80 | .pixclock = 101936, |
| 81 | .xres = 480, |
| 82 | .yres = 272, |
| 83 | .bpp = 32, |
| 84 | .depth = 18, |
| 85 | .hsync_len = 41, |
| 86 | .left_margin = 2, |
| 87 | .right_margin = 2, |
| 88 | .vsync_len = 10, |
| 89 | .upper_margin = 2, |
| 90 | .lower_margin = 2, |
| 91 | .sync = 0, |
| 92 | .cmap_greyscale = 0, |
| 93 | }; |
| 94 | |
| 95 | static struct pxafb_mach_info sharp_lq43_info = { |
| 96 | .modes = &sharp_lq43_mode, |
| 97 | .num_modes = 1, |
| 98 | .cmap_inverse = 0, |
| 99 | .cmap_static = 0, |
| 100 | .lcd_conn = LCD_COLOR_TFT_18BPP, |
| 101 | .pxafb_backlight_power = colibri_lcd_backlight, |
| 102 | }; |
| 103 | |
| 104 | void __init colibri_pxa3xx_init_lcd(int bl_pin) |
| 105 | { |
| 106 | lcd_bl_pin = bl_pin; |
| 107 | gpio_request(bl_pin, "lcd backlight"); |
| 108 | gpio_direction_output(bl_pin, 0); |
Russell King - ARM Linux | 4321e1a | 2011-02-15 15:37:30 +0800 | [diff] [blame] | 109 | pxa_set_fb_info(NULL, &sharp_lq43_info); |
Daniel Mack | 91fcfb9 | 2009-03-23 02:04:19 +0100 | [diff] [blame] | 110 | } |
| 111 | #endif |
| 112 | |
Daniel Mack | 53740df | 2009-06-17 10:32:54 +0200 | [diff] [blame] | 113 | #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) |
| 114 | static struct mtd_partition colibri_nand_partitions[] = { |
| 115 | { |
| 116 | .name = "bootloader", |
| 117 | .offset = 0, |
| 118 | .size = SZ_512K, |
| 119 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 120 | }, |
| 121 | { |
| 122 | .name = "kernel", |
| 123 | .offset = MTDPART_OFS_APPEND, |
| 124 | .size = SZ_4M, |
| 125 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 126 | }, |
| 127 | { |
| 128 | .name = "reserved", |
| 129 | .offset = MTDPART_OFS_APPEND, |
| 130 | .size = SZ_1M, |
| 131 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 132 | }, |
| 133 | { |
| 134 | .name = "fs", |
| 135 | .offset = MTDPART_OFS_APPEND, |
| 136 | .size = MTDPART_SIZ_FULL, |
| 137 | }, |
| 138 | }; |
| 139 | |
| 140 | static struct pxa3xx_nand_platform_data colibri_nand_info = { |
| 141 | .enable_arbiter = 1, |
| 142 | .keep_config = 1, |
Lei Wen | f3c8cfc | 2011-07-14 20:44:33 -0700 | [diff] [blame] | 143 | .num_cs = 1, |
| 144 | .parts[0] = colibri_nand_partitions, |
| 145 | .nr_parts[0] = ARRAY_SIZE(colibri_nand_partitions), |
Daniel Mack | 53740df | 2009-06-17 10:32:54 +0200 | [diff] [blame] | 146 | }; |
| 147 | |
| 148 | void __init colibri_pxa3xx_init_nand(void) |
| 149 | { |
| 150 | pxa3xx_set_nand_info(&colibri_nand_info); |
| 151 | } |
| 152 | #endif |
| 153 | |