devices-vt8500.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* linux/arch/arm/mach-vt8500/devices-vt8500.c
  2. *
  3. * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
  4. *
  5. * This software is licensed under the terms of the GNU General Public
  6. * License version 2, as published by the Free Software Foundation, and
  7. * may be copied, distributed, and modified under those terms.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. */
  15. #include <linux/platform_device.h>
  16. #include <mach/vt8500_regs.h>
  17. #include <mach/vt8500_irqs.h>
  18. #include <mach/i8042.h>
  19. #include "devices.h"
  20. void __init vt8500_set_resources(void)
  21. {
  22. struct resource tmp[3];
  23. tmp[0] = wmt_mmio_res(VT8500_LCDC_BASE, SZ_1K);
  24. tmp[1] = wmt_irq_res(IRQ_LCDC);
  25. wmt_res_add(&vt8500_device_lcdc, tmp, 2);
  26. tmp[0] = wmt_mmio_res(VT8500_UART0_BASE, 0x1040);
  27. tmp[1] = wmt_irq_res(IRQ_UART0);
  28. wmt_res_add(&vt8500_device_uart0, tmp, 2);
  29. tmp[0] = wmt_mmio_res(VT8500_UART1_BASE, 0x1040);
  30. tmp[1] = wmt_irq_res(IRQ_UART1);
  31. wmt_res_add(&vt8500_device_uart1, tmp, 2);
  32. tmp[0] = wmt_mmio_res(VT8500_UART2_BASE, 0x1040);
  33. tmp[1] = wmt_irq_res(IRQ_UART2);
  34. wmt_res_add(&vt8500_device_uart2, tmp, 2);
  35. tmp[0] = wmt_mmio_res(VT8500_UART3_BASE, 0x1040);
  36. tmp[1] = wmt_irq_res(IRQ_UART3);
  37. wmt_res_add(&vt8500_device_uart3, tmp, 2);
  38. tmp[0] = wmt_mmio_res(VT8500_EHCI_BASE, SZ_512);
  39. tmp[1] = wmt_irq_res(IRQ_EHCI);
  40. wmt_res_add(&vt8500_device_ehci, tmp, 2);
  41. /* vt8500 uses a single IRQ for both EHCI and UHCI controllers */
  42. tmp[0] = wmt_mmio_res(VT8500_UHCI_BASE, SZ_512);
  43. tmp[1] = wmt_irq_res(IRQ_EHCI);
  44. wmt_res_add(&vt8500_device_uhci, tmp, 2);
  45. tmp[0] = wmt_mmio_res(VT8500_GEGEA_BASE, SZ_256);
  46. wmt_res_add(&vt8500_device_ge_rops, tmp, 1);
  47. tmp[0] = wmt_mmio_res(VT8500_PWM_BASE, 0x44);
  48. wmt_res_add(&vt8500_device_pwm, tmp, 1);
  49. tmp[0] = wmt_mmio_res(VT8500_RTC_BASE, 0x2c);
  50. tmp[1] = wmt_irq_res(IRQ_RTC);
  51. tmp[2] = wmt_irq_res(IRQ_RTCSM);
  52. wmt_res_add(&vt8500_device_rtc, tmp, 3);
  53. }
  54. static void __init vt8500_set_externs(void)
  55. {
  56. /* Non-resource-aware stuff */
  57. wmt_ic_base = VT8500_IC_BASE;
  58. wmt_gpio_base = VT8500_GPIO_BASE;
  59. wmt_pmc_base = VT8500_PMC_BASE;
  60. wmt_i8042_base = VT8500_PS2_BASE;
  61. wmt_nr_irqs = VT8500_NR_IRQS;
  62. wmt_timer_irq = IRQ_PMCOS0;
  63. wmt_gpio_ext_irq[0] = IRQ_EXT0;
  64. wmt_gpio_ext_irq[1] = IRQ_EXT1;
  65. wmt_gpio_ext_irq[2] = IRQ_EXT2;
  66. wmt_gpio_ext_irq[3] = IRQ_EXT3;
  67. wmt_gpio_ext_irq[4] = IRQ_EXT4;
  68. wmt_gpio_ext_irq[5] = IRQ_EXT5;
  69. wmt_gpio_ext_irq[6] = IRQ_EXT6;
  70. wmt_gpio_ext_irq[7] = IRQ_EXT7;
  71. wmt_i8042_kbd_irq = IRQ_PS2KBD;
  72. wmt_i8042_aux_irq = IRQ_PS2MOUSE;
  73. }
  74. void __init vt8500_map_io(void)
  75. {
  76. iotable_init(wmt_io_desc, ARRAY_SIZE(wmt_io_desc));
  77. /* Should be done before interrupts and timers are initialized */
  78. vt8500_set_externs();
  79. }