h3100.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Hardware definitions for Compaq iPAQ H3xxx Handheld Computers
  3. *
  4. * Copyright 2000,1 Compaq Computer Corporation.
  5. *
  6. * Use consistent with the GNU GPL is permitted,
  7. * provided that this copyright notice is
  8. * preserved in its entirety in all copies and derived works.
  9. *
  10. * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
  11. * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
  12. * FITNESS FOR ANY PARTICULAR PURPOSE.
  13. *
  14. * Author: Jamey Hicks.
  15. *
  16. * History:
  17. *
  18. * 2001-10-?? Andrew Christian Added support for iPAQ H3800
  19. * and abstracted EGPIO interface.
  20. *
  21. */
  22. #include <linux/module.h>
  23. #include <linux/init.h>
  24. #include <linux/kernel.h>
  25. #include <linux/tty.h>
  26. #include <linux/pm.h>
  27. #include <linux/device.h>
  28. #include <linux/mfd/htc-egpio.h>
  29. #include <linux/mtd/mtd.h>
  30. #include <linux/mtd/partitions.h>
  31. #include <linux/serial_core.h>
  32. #include <linux/gpio.h>
  33. #include <linux/platform_device.h>
  34. #include <asm/irq.h>
  35. #include <mach/hardware.h>
  36. #include <asm/mach-types.h>
  37. #include <asm/setup.h>
  38. #include <asm/mach/irq.h>
  39. #include <asm/mach/arch.h>
  40. #include <asm/mach/flash.h>
  41. #include <asm/mach/irda.h>
  42. #include <asm/mach/map.h>
  43. #include <asm/mach/serial_sa1100.h>
  44. #include <mach/h3xxx.h>
  45. #include "generic.h"
  46. /*
  47. * helper for sa1100fb
  48. */
  49. static void h3100_lcd_power(int enable)
  50. {
  51. if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) {
  52. gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
  53. gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
  54. gpio_free(H3XXX_EGPIO_LCD_ON);
  55. }
  56. }
  57. static void __init h3100_map_io(void)
  58. {
  59. h3xxx_map_io();
  60. sa1100fb_lcd_power = h3100_lcd_power;
  61. /* Older bootldrs put GPIO2-9 in alternate mode on the
  62. assumption that they are used for video */
  63. GAFR &= ~0x000001fb;
  64. }
  65. /*
  66. * This turns the IRDA power on or off on the Compaq H3100
  67. */
  68. static int h3100_irda_set_power(struct device *dev, unsigned int state)
  69. {
  70. gpio_set_value(H3100_GPIO_IR_ON, state);
  71. return 0;
  72. }
  73. static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
  74. {
  75. gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
  76. }
  77. static struct irda_platform_data h3100_irda_data = {
  78. .set_power = h3100_irda_set_power,
  79. .set_speed = h3100_irda_set_speed,
  80. };
  81. static struct gpio_default_state h3100_default_gpio[] = {
  82. { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" },
  83. { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" },
  84. { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
  85. { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
  86. { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
  87. { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" },
  88. };
  89. static void __init h3100_mach_init(void)
  90. {
  91. h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio));
  92. h3xxx_mach_init();
  93. sa11x0_register_irda(&h3100_irda_data);
  94. }
  95. MACHINE_START(H3100, "Compaq iPAQ H3100")
  96. .phys_io = 0x80000000,
  97. .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
  98. .boot_params = 0xc0000100,
  99. .map_io = h3100_map_io,
  100. .init_irq = sa1100_init_irq,
  101. .timer = &sa1100_timer,
  102. .init_machine = h3100_mach_init,
  103. MACHINE_END