t5325-setup.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. *
  3. * HP t5325 Thin Client setup
  4. *
  5. * Copyright (C) 2010 Martin Michlmayr <tbm@cyrius.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/mtd/physmap.h>
  16. #include <linux/spi/flash.h>
  17. #include <linux/spi/spi.h>
  18. #include <linux/spi/orion_spi.h>
  19. #include <linux/i2c.h>
  20. #include <linux/mv643xx_eth.h>
  21. #include <linux/ata_platform.h>
  22. #include <linux/gpio.h>
  23. #include <linux/gpio_keys.h>
  24. #include <linux/input.h>
  25. #include <sound/alc5623.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/mach/arch.h>
  28. #include <mach/kirkwood.h>
  29. #include "common.h"
  30. #include "mpp.h"
  31. struct mtd_partition hp_t5325_partitions[] = {
  32. {
  33. .name = "u-boot env",
  34. .size = SZ_64K,
  35. .offset = SZ_512K + SZ_256K,
  36. },
  37. {
  38. .name = "permanent u-boot env",
  39. .size = SZ_64K,
  40. .offset = MTDPART_OFS_APPEND,
  41. .mask_flags = MTD_WRITEABLE,
  42. },
  43. {
  44. .name = "HP env",
  45. .size = SZ_64K,
  46. .offset = MTDPART_OFS_APPEND,
  47. },
  48. {
  49. .name = "u-boot",
  50. .size = SZ_512K,
  51. .offset = 0,
  52. .mask_flags = MTD_WRITEABLE,
  53. },
  54. {
  55. .name = "SSD firmware",
  56. .size = SZ_256K,
  57. .offset = SZ_512K,
  58. },
  59. };
  60. const struct flash_platform_data hp_t5325_flash = {
  61. .type = "mx25l8005",
  62. .name = "spi_flash",
  63. .parts = hp_t5325_partitions,
  64. .nr_parts = ARRAY_SIZE(hp_t5325_partitions),
  65. };
  66. struct spi_board_info __initdata hp_t5325_spi_slave_info[] = {
  67. {
  68. .modalias = "m25p80",
  69. .platform_data = &hp_t5325_flash,
  70. .irq = -1,
  71. },
  72. };
  73. static struct mv643xx_eth_platform_data hp_t5325_ge00_data = {
  74. .phy_addr = MV643XX_ETH_PHY_ADDR(8),
  75. };
  76. static struct mv_sata_platform_data hp_t5325_sata_data = {
  77. .n_ports = 2,
  78. };
  79. static struct gpio_keys_button hp_t5325_buttons[] = {
  80. {
  81. .code = KEY_POWER,
  82. .gpio = 45,
  83. .desc = "Power",
  84. .active_low = 1,
  85. },
  86. };
  87. static struct gpio_keys_platform_data hp_t5325_button_data = {
  88. .buttons = hp_t5325_buttons,
  89. .nbuttons = ARRAY_SIZE(hp_t5325_buttons),
  90. };
  91. static struct platform_device hp_t5325_button_device = {
  92. .name = "gpio-keys",
  93. .id = -1,
  94. .num_resources = 0,
  95. .dev = {
  96. .platform_data = &hp_t5325_button_data,
  97. }
  98. };
  99. static unsigned int hp_t5325_mpp_config[] __initdata = {
  100. MPP0_NF_IO2,
  101. MPP1_SPI_MOSI,
  102. MPP2_SPI_SCK,
  103. MPP3_SPI_MISO,
  104. MPP4_NF_IO6,
  105. MPP5_NF_IO7,
  106. MPP6_SYSRST_OUTn,
  107. MPP7_SPI_SCn,
  108. MPP8_TW0_SDA,
  109. MPP9_TW0_SCK,
  110. MPP10_UART0_TXD,
  111. MPP11_UART0_RXD,
  112. MPP12_SD_CLK,
  113. MPP13_GPIO,
  114. MPP14_GPIO,
  115. MPP15_GPIO,
  116. MPP16_GPIO,
  117. MPP17_GPIO,
  118. MPP18_NF_IO0,
  119. MPP19_NF_IO1,
  120. MPP20_GPIO,
  121. MPP21_GPIO,
  122. MPP22_GPIO,
  123. MPP23_GPIO,
  124. MPP32_GPIO,
  125. MPP33_GE1_TXCTL,
  126. MPP39_AU_I2SBCLK,
  127. MPP40_AU_I2SDO,
  128. MPP43_AU_I2SDI,
  129. MPP41_AU_I2SLRCLK,
  130. MPP42_AU_I2SMCLK,
  131. MPP45_GPIO, /* Power button */
  132. MPP48_GPIO, /* Board power off */
  133. 0
  134. };
  135. static struct alc5623_platform_data alc5621_data = {
  136. .add_ctrl = 0x3700,
  137. .jack_det_ctrl = 0x4810,
  138. };
  139. static struct i2c_board_info i2c_board_info[] __initdata = {
  140. {
  141. I2C_BOARD_INFO("alc5621", 0x1a),
  142. .platform_data = &alc5621_data,
  143. },
  144. };
  145. #define HP_T5325_GPIO_POWER_OFF 48
  146. static void hp_t5325_power_off(void)
  147. {
  148. gpio_set_value(HP_T5325_GPIO_POWER_OFF, 1);
  149. }
  150. static void __init hp_t5325_init(void)
  151. {
  152. /*
  153. * Basic setup. Needs to be called early.
  154. */
  155. kirkwood_init();
  156. kirkwood_mpp_conf(hp_t5325_mpp_config);
  157. kirkwood_uart0_init();
  158. spi_register_board_info(hp_t5325_spi_slave_info,
  159. ARRAY_SIZE(hp_t5325_spi_slave_info));
  160. kirkwood_spi_init();
  161. kirkwood_i2c_init();
  162. kirkwood_ge00_init(&hp_t5325_ge00_data);
  163. kirkwood_sata_init(&hp_t5325_sata_data);
  164. kirkwood_ehci_init();
  165. platform_device_register(&hp_t5325_button_device);
  166. i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info));
  167. kirkwood_audio_init();
  168. if (gpio_request(HP_T5325_GPIO_POWER_OFF, "power-off") == 0 &&
  169. gpio_direction_output(HP_T5325_GPIO_POWER_OFF, 0) == 0)
  170. pm_power_off = hp_t5325_power_off;
  171. else
  172. pr_err("t5325: failed to configure power-off GPIO\n");
  173. }
  174. static int __init hp_t5325_pci_init(void)
  175. {
  176. if (machine_is_t5325())
  177. kirkwood_pcie_init(KW_PCIE0);
  178. return 0;
  179. }
  180. subsys_initcall(hp_t5325_pci_init);
  181. MACHINE_START(T5325, "HP t5325 Thin Client")
  182. /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
  183. .boot_params = 0x00000100,
  184. .init_machine = hp_t5325_init,
  185. .map_io = kirkwood_map_io,
  186. .init_early = kirkwood_init_early,
  187. .init_irq = kirkwood_init_irq,
  188. .timer = &kirkwood_timer,
  189. MACHINE_END