shannon.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/arch/arm/mach-sa1100/shannon.c
  4. */
  5. #include <linux/init.h>
  6. #include <linux/device.h>
  7. #include <linux/gpio/machine.h>
  8. #include <linux/kernel.h>
  9. #include <linux/platform_data/sa11x0-serial.h>
  10. #include <linux/tty.h>
  11. #include <linux/mtd/mtd.h>
  12. #include <linux/mtd/partitions.h>
  13. #include <linux/regulator/fixed.h>
  14. #include <linux/regulator/machine.h>
  15. #include <video/sa1100fb.h>
  16. #include <mach/hardware.h>
  17. #include <asm/mach-types.h>
  18. #include <asm/setup.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach/flash.h>
  21. #include <asm/mach/map.h>
  22. #include <linux/platform_data/mfd-mcp-sa11x0.h>
  23. #include <mach/shannon.h>
  24. #include <mach/irqs.h>
  25. #include "generic.h"
  26. static struct mtd_partition shannon_partitions[] = {
  27. {
  28. .name = "BLOB boot loader",
  29. .offset = 0,
  30. .size = 0x20000
  31. },
  32. {
  33. .name = "kernel",
  34. .offset = MTDPART_OFS_APPEND,
  35. .size = 0xe0000
  36. },
  37. {
  38. .name = "initrd",
  39. .offset = MTDPART_OFS_APPEND,
  40. .size = MTDPART_SIZ_FULL
  41. }
  42. };
  43. static struct flash_platform_data shannon_flash_data = {
  44. .map_name = "cfi_probe",
  45. .parts = shannon_partitions,
  46. .nr_parts = ARRAY_SIZE(shannon_partitions),
  47. };
  48. static struct resource shannon_flash_resource =
  49. DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_4M);
  50. static struct mcp_plat_data shannon_mcp_data = {
  51. .mccr0 = MCCR0_ADM,
  52. .sclk_rate = 11981000,
  53. };
  54. static struct sa1100fb_mach_info shannon_lcd_info = {
  55. .pixclock = 152500, .bpp = 8,
  56. .xres = 640, .yres = 480,
  57. .hsync_len = 4, .vsync_len = 3,
  58. .left_margin = 2, .upper_margin = 0,
  59. .right_margin = 1, .lower_margin = 0,
  60. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  61. .lccr0 = LCCR0_Color | LCCR0_Dual | LCCR0_Pas,
  62. .lccr3 = LCCR3_ACBsDiv(512),
  63. };
  64. static struct gpiod_lookup_table shannon_pcmcia0_gpio_table = {
  65. .dev_id = "sa11x0-pcmcia.0",
  66. .table = {
  67. GPIO_LOOKUP("gpio", 24, "detect", GPIO_ACTIVE_LOW),
  68. GPIO_LOOKUP("gpio", 26, "ready", GPIO_ACTIVE_HIGH),
  69. { },
  70. },
  71. };
  72. static struct gpiod_lookup_table shannon_pcmcia1_gpio_table = {
  73. .dev_id = "sa11x0-pcmcia.1",
  74. .table = {
  75. GPIO_LOOKUP("gpio", 25, "detect", GPIO_ACTIVE_LOW),
  76. GPIO_LOOKUP("gpio", 27, "ready", GPIO_ACTIVE_HIGH),
  77. { },
  78. },
  79. };
  80. static struct regulator_consumer_supply shannon_cf_vcc_consumers[] = {
  81. REGULATOR_SUPPLY("vcc", "sa11x0-pcmcia.0"),
  82. REGULATOR_SUPPLY("vcc", "sa11x0-pcmcia.1"),
  83. };
  84. static struct fixed_voltage_config shannon_cf_vcc_pdata __initdata = {
  85. .supply_name = "cf-power",
  86. .microvolts = 3300000,
  87. .enabled_at_boot = 1,
  88. .gpio = -EINVAL,
  89. };
  90. static void __init shannon_init(void)
  91. {
  92. sa11x0_register_fixed_regulator(0, &shannon_cf_vcc_pdata,
  93. shannon_cf_vcc_consumers,
  94. ARRAY_SIZE(shannon_cf_vcc_consumers));
  95. sa11x0_register_pcmcia(0, &shannon_pcmcia0_gpio_table);
  96. sa11x0_register_pcmcia(1, &shannon_pcmcia1_gpio_table);
  97. sa11x0_ppc_configure_mcp();
  98. sa11x0_register_lcd(&shannon_lcd_info);
  99. sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1);
  100. sa11x0_register_mcp(&shannon_mcp_data);
  101. }
  102. static void __init shannon_map_io(void)
  103. {
  104. sa1100_map_io();
  105. sa1100_register_uart(0, 3);
  106. sa1100_register_uart(1, 1);
  107. Ser1SDCR0 |= SDCR0_SUS;
  108. GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
  109. GPDR |= GPIO_UART_TXD | SHANNON_GPIO_CODEC_RESET;
  110. GPDR &= ~GPIO_UART_RXD;
  111. PPAR |= PPAR_UPR;
  112. /* reset the codec */
  113. GPCR = SHANNON_GPIO_CODEC_RESET;
  114. GPSR = SHANNON_GPIO_CODEC_RESET;
  115. }
  116. MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)")
  117. .atag_offset = 0x100,
  118. .map_io = shannon_map_io,
  119. .nr_irqs = SA1100_NR_IRQS,
  120. .init_irq = sa1100_init_irq,
  121. .init_time = sa1100_timer_init,
  122. .init_machine = shannon_init,
  123. .init_late = sa11x0_init_late,
  124. .restart = sa11x0_restart,
  125. MACHINE_END