eseries.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * Hardware definitions for the Toshiba eseries PDAs
  3. *
  4. * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
  5. *
  6. * This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. *
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/gpio.h>
  15. #include <linux/delay.h>
  16. #include <linux/platform_device.h>
  17. #include <asm/setup.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach-types.h>
  20. #include <mach/pxa25x.h>
  21. #include <mach/eseries-gpio.h>
  22. #include <mach/udc.h>
  23. #include <mach/irda.h>
  24. #include "generic.h"
  25. #include "clock.h"
  26. /* Only e800 has 128MB RAM */
  27. void __init eseries_fixup(struct machine_desc *desc,
  28. struct tag *tags, char **cmdline, struct meminfo *mi)
  29. {
  30. mi->nr_banks=1;
  31. mi->bank[0].start = 0xa0000000;
  32. mi->bank[0].node = 0;
  33. if (machine_is_e800())
  34. mi->bank[0].size = (128*1024*1024);
  35. else
  36. mi->bank[0].size = (64*1024*1024);
  37. }
  38. struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
  39. .gpio_vbus = GPIO_E7XX_USB_DISC,
  40. .gpio_pullup = GPIO_E7XX_USB_PULLUP,
  41. .gpio_pullup_inverted = 1
  42. };
  43. static void e7xx_irda_transceiver_mode(struct device *dev, int mode)
  44. {
  45. if (mode & IR_OFF) {
  46. gpio_set_value(GPIO_E7XX_IR_OFF, 1);
  47. pxa2xx_transceiver_mode(dev, mode);
  48. } else {
  49. pxa2xx_transceiver_mode(dev, mode);
  50. gpio_set_value(GPIO_E7XX_IR_OFF, 0);
  51. }
  52. }
  53. int e7xx_irda_init(void)
  54. {
  55. int ret;
  56. ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power");
  57. if (ret)
  58. goto out;
  59. ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0);
  60. if (ret)
  61. goto out;
  62. e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF);
  63. out:
  64. return ret;
  65. }
  66. static void e7xx_irda_shutdown(struct device *dev)
  67. {
  68. e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
  69. gpio_free(GPIO_E7XX_IR_OFF);
  70. }
  71. struct pxaficp_platform_data e7xx_ficp_platform_data = {
  72. .transceiver_cap = IR_SIRMODE | IR_OFF,
  73. .transceiver_mode = e7xx_irda_transceiver_mode,
  74. .shutdown = e7xx_irda_shutdown,
  75. };
  76. int eseries_tmio_enable(struct platform_device *dev)
  77. {
  78. /* Reset - bring SUSPEND high before PCLR */
  79. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
  80. gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
  81. msleep(1);
  82. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
  83. msleep(1);
  84. gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
  85. msleep(1);
  86. return 0;
  87. }
  88. int eseries_tmio_disable(struct platform_device *dev)
  89. {
  90. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
  91. gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
  92. return 0;
  93. }
  94. int eseries_tmio_suspend(struct platform_device *dev)
  95. {
  96. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
  97. return 0;
  98. }
  99. int eseries_tmio_resume(struct platform_device *dev)
  100. {
  101. gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
  102. msleep(1);
  103. return 0;
  104. }
  105. void eseries_get_tmio_gpios(void)
  106. {
  107. gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
  108. gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
  109. gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
  110. gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
  111. }
  112. /* TMIO controller uses the same resources on all e-series machines. */
  113. struct resource eseries_tmio_resources[] = {
  114. [0] = {
  115. .start = PXA_CS4_PHYS,
  116. .end = PXA_CS4_PHYS + 0x1fffff,
  117. .flags = IORESOURCE_MEM,
  118. },
  119. [1] = {
  120. .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
  121. .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
  122. .flags = IORESOURCE_IRQ,
  123. },
  124. };
  125. /* Some e-series hardware cannot control the 32K clock */
  126. static void clk_32k_dummy(struct clk *clk)
  127. {
  128. }
  129. static const struct clkops clk_32k_dummy_ops = {
  130. .enable = clk_32k_dummy,
  131. .disable = clk_32k_dummy,
  132. };
  133. static struct clk tmio_dummy_clk = {
  134. .ops = &clk_32k_dummy_ops,
  135. .rate = 32768,
  136. };
  137. static struct clk_lookup eseries_clkregs[] = {
  138. INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"),
  139. };
  140. void eseries_register_clks(void)
  141. {
  142. clks_register(eseries_clkregs, ARRAY_SIZE(eseries_clkregs));
  143. }