h3100.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Support for Compaq iPAQ H3100 handheld computer
  3. *
  4. * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
  5. * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. */
  12. #include <linux/module.h>
  13. #include <linux/init.h>
  14. #include <linux/kernel.h>
  15. #include <linux/tty.h>
  16. #include <linux/pm.h>
  17. #include <linux/device.h>
  18. #include <linux/mfd/htc-egpio.h>
  19. #include <linux/mtd/mtd.h>
  20. #include <linux/mtd/partitions.h>
  21. #include <linux/serial_core.h>
  22. #include <linux/gpio.h>
  23. #include <linux/platform_device.h>
  24. #include <asm/irq.h>
  25. #include <mach/hardware.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/setup.h>
  28. #include <asm/mach/irq.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/flash.h>
  31. #include <asm/mach/irda.h>
  32. #include <asm/mach/map.h>
  33. #include <asm/mach/serial_sa1100.h>
  34. #include <mach/h3xxx.h>
  35. #include "generic.h"
  36. /*
  37. * helper for sa1100fb
  38. */
  39. static void h3100_lcd_power(int enable)
  40. {
  41. if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) {
  42. gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
  43. gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
  44. gpio_free(H3XXX_EGPIO_LCD_ON);
  45. }
  46. }
  47. static void __init h3100_map_io(void)
  48. {
  49. h3xxx_map_io();
  50. sa1100fb_lcd_power = h3100_lcd_power;
  51. /* Older bootldrs put GPIO2-9 in alternate mode on the
  52. assumption that they are used for video */
  53. GAFR &= ~0x000001fb;
  54. }
  55. /*
  56. * This turns the IRDA power on or off on the Compaq H3100
  57. */
  58. static int h3100_irda_set_power(struct device *dev, unsigned int state)
  59. {
  60. gpio_set_value(H3100_GPIO_IR_ON, state);
  61. return 0;
  62. }
  63. static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
  64. {
  65. gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
  66. }
  67. static struct irda_platform_data h3100_irda_data = {
  68. .set_power = h3100_irda_set_power,
  69. .set_speed = h3100_irda_set_speed,
  70. };
  71. static struct gpio_default_state h3100_default_gpio[] = {
  72. { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" },
  73. { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" },
  74. { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
  75. { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
  76. { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
  77. { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" },
  78. };
  79. static void __init h3100_mach_init(void)
  80. {
  81. h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio));
  82. h3xxx_mach_init();
  83. sa11x0_register_irda(&h3100_irda_data);
  84. }
  85. MACHINE_START(H3100, "Compaq iPAQ H3100")
  86. .phys_io = 0x80000000,
  87. .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
  88. .boot_params = 0xc0000100,
  89. .map_io = h3100_map_io,
  90. .init_irq = sa1100_init_irq,
  91. .timer = &sa1100_timer,
  92. .init_machine = h3100_mach_init,
  93. MACHINE_END