colibri-pxa3xx.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. #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>
  28. #include "generic.h"
  29. #include "devices.h"
  30. #if defined(CONFIG_AX88796)
  31. #define ETHER_ADDR_LEN 6
  32. static u8 ether_mac_addr[ETHER_ADDR_LEN];
  33. void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data)
  34. {
  35. int i;
  36. u64 serial = ((u64) system_serial_high << 32) | system_serial_low;
  37. /*
  38. * If the bootloader passed in a serial boot tag, which contains a
  39. * valid ethernet MAC, pass it to the interface. Toradex ships the
  40. * modules with their own bootloader which provides a valid MAC
  41. * this way.
  42. */
  43. for (i = 0; i < ETHER_ADDR_LEN; i++) {
  44. ether_mac_addr[i] = serial & 0xff;
  45. serial >>= 8;
  46. }
  47. if (is_valid_ether_addr(ether_mac_addr)) {
  48. plat_data->flags |= AXFLG_MAC_FROMPLATFORM;
  49. plat_data->mac_addr = ether_mac_addr;
  50. printk(KERN_INFO "%s(): taking MAC from serial boot tag\n",
  51. __func__);
  52. } else {
  53. plat_data->flags |= AXFLG_MAC_FROMDEV;
  54. printk(KERN_INFO "%s(): no valid serial boot tag found, "
  55. "taking MAC from device\n", __func__);
  56. }
  57. }
  58. #endif
  59. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  60. static int lcd_bl_pin;
  61. /*
  62. * LCD panel (Sharp LQ043T3DX02)
  63. */
  64. static void colibri_lcd_backlight(int on)
  65. {
  66. gpio_set_value(lcd_bl_pin, !!on);
  67. }
  68. static struct pxafb_mode_info sharp_lq43_mode = {
  69. .pixclock = 101936,
  70. .xres = 480,
  71. .yres = 272,
  72. .bpp = 32,
  73. .depth = 18,
  74. .hsync_len = 41,
  75. .left_margin = 2,
  76. .right_margin = 2,
  77. .vsync_len = 10,
  78. .upper_margin = 2,
  79. .lower_margin = 2,
  80. .sync = 0,
  81. .cmap_greyscale = 0,
  82. };
  83. static struct pxafb_mach_info sharp_lq43_info = {
  84. .modes = &sharp_lq43_mode,
  85. .num_modes = 1,
  86. .cmap_inverse = 0,
  87. .cmap_static = 0,
  88. .lcd_conn = LCD_COLOR_TFT_18BPP,
  89. .pxafb_backlight_power = colibri_lcd_backlight,
  90. };
  91. void __init colibri_pxa3xx_init_lcd(int bl_pin)
  92. {
  93. lcd_bl_pin = bl_pin;
  94. gpio_request(bl_pin, "lcd backlight");
  95. gpio_direction_output(bl_pin, 0);
  96. set_pxa_fb_info(&sharp_lq43_info);
  97. }
  98. #endif
  99. #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
  100. static struct mtd_partition colibri_nand_partitions[] = {
  101. {
  102. .name = "bootloader",
  103. .offset = 0,
  104. .size = SZ_512K,
  105. .mask_flags = MTD_WRITEABLE, /* force read-only */
  106. },
  107. {
  108. .name = "kernel",
  109. .offset = MTDPART_OFS_APPEND,
  110. .size = SZ_4M,
  111. .mask_flags = MTD_WRITEABLE, /* force read-only */
  112. },
  113. {
  114. .name = "reserved",
  115. .offset = MTDPART_OFS_APPEND,
  116. .size = SZ_1M,
  117. .mask_flags = MTD_WRITEABLE, /* force read-only */
  118. },
  119. {
  120. .name = "fs",
  121. .offset = MTDPART_OFS_APPEND,
  122. .size = MTDPART_SIZ_FULL,
  123. },
  124. };
  125. static struct pxa3xx_nand_platform_data colibri_nand_info = {
  126. .enable_arbiter = 1,
  127. .keep_config = 1,
  128. .parts = colibri_nand_partitions,
  129. .nr_parts = ARRAY_SIZE(colibri_nand_partitions),
  130. };
  131. void __init colibri_pxa3xx_init_nand(void)
  132. {
  133. pxa3xx_set_nand_info(&colibri_nand_info);
  134. }
  135. #endif