h3100.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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/init.h>
  13. #include <linux/kernel.h>
  14. #include <linux/gpio.h>
  15. #include <video/sa1100fb.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/mach/irda.h>
  19. #include <mach/h3xxx.h>
  20. #include <mach/irqs.h>
  21. #include "generic.h"
  22. /*
  23. * helper for sa1100fb
  24. */
  25. static void h3100_lcd_power(int enable)
  26. {
  27. if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) {
  28. gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
  29. gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
  30. gpio_free(H3XXX_EGPIO_LCD_ON);
  31. } else {
  32. pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__);
  33. }
  34. }
  35. static struct sa1100fb_mach_info h3100_lcd_info = {
  36. .pixclock = 406977, .bpp = 4,
  37. .xres = 320, .yres = 240,
  38. .hsync_len = 26, .vsync_len = 41,
  39. .left_margin = 4, .upper_margin = 0,
  40. .right_margin = 4, .lower_margin = 0,
  41. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  42. .cmap_greyscale = 1,
  43. .cmap_inverse = 1,
  44. .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas,
  45. .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
  46. .lcd_power = h3100_lcd_power,
  47. };
  48. static void __init h3100_map_io(void)
  49. {
  50. h3xxx_map_io();
  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_lcd(&h3100_lcd_info);
  84. sa11x0_register_irda(&h3100_irda_data);
  85. }
  86. MACHINE_START(H3100, "Compaq iPAQ H3100")
  87. .atag_offset = 0x100,
  88. .map_io = h3100_map_io,
  89. .nr_irqs = SA1100_NR_IRQS,
  90. .init_irq = sa1100_init_irq,
  91. .timer = &sa1100_timer,
  92. .init_machine = h3100_mach_init,
  93. .restart = sa11x0_restart,
  94. MACHINE_END