mmp2.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * linux/arch/arm/mach-mmp/mmp2.c
  3. *
  4. * code name MMP2
  5. *
  6. * Copyright (C) 2009 Marvell International Ltd.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/module.h>
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/io.h>
  16. #include <mach/addr-map.h>
  17. #include <mach/regs-apbc.h>
  18. #include <mach/regs-apmu.h>
  19. #include <mach/cputype.h>
  20. #include <mach/irqs.h>
  21. #include <mach/mfp.h>
  22. #include <mach/gpio.h>
  23. #include <mach/devices.h>
  24. #include "common.h"
  25. #include "clock.h"
  26. #define MFPR_VIRT_BASE (APB_VIRT_BASE + 0x1e000)
  27. #define APMASK(i) (GPIO_REGS_VIRT + BANK_OFF(i) + 0x9c)
  28. static struct mfp_addr_map mmp2_addr_map[] __initdata = {
  29. MFP_ADDR(PMIC_INT, 0x2c4),
  30. MFP_ADDR_END,
  31. };
  32. void mmp2_clear_pmic_int(void)
  33. {
  34. unsigned long mfpr_pmic, data;
  35. mfpr_pmic = APB_VIRT_BASE + 0x1e000 + 0x2c4;
  36. data = __raw_readl(mfpr_pmic);
  37. __raw_writel(data | (1 << 6), mfpr_pmic);
  38. __raw_writel(data, mfpr_pmic);
  39. }
  40. static void __init mmp2_init_gpio(void)
  41. {
  42. int i;
  43. /* enable GPIO clock */
  44. __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_MMP2_GPIO);
  45. /* unmask GPIO edge detection for all 6 banks -- APMASKx */
  46. for (i = 0; i < 6; i++)
  47. __raw_writel(0xffffffff, APMASK(i));
  48. pxa_init_gpio(IRQ_MMP2_GPIO, 0, 167, NULL);
  49. }
  50. void __init mmp2_init_irq(void)
  51. {
  52. mmp2_init_icu();
  53. mmp2_init_gpio();
  54. }
  55. /* APB peripheral clocks */
  56. static APBC_CLK(uart1, MMP2_UART1, 1, 26000000);
  57. static APBC_CLK(uart2, MMP2_UART2, 1, 26000000);
  58. static APBC_CLK(uart3, MMP2_UART3, 1, 26000000);
  59. static APBC_CLK(uart4, MMP2_UART4, 1, 26000000);
  60. static APBC_CLK(twsi1, MMP2_TWSI1, 0, 26000000);
  61. static APBC_CLK(twsi2, MMP2_TWSI2, 0, 26000000);
  62. static APBC_CLK(twsi3, MMP2_TWSI3, 0, 26000000);
  63. static APBC_CLK(twsi4, MMP2_TWSI4, 0, 26000000);
  64. static APBC_CLK(twsi5, MMP2_TWSI5, 0, 26000000);
  65. static APBC_CLK(twsi6, MMP2_TWSI6, 0, 26000000);
  66. static APBC_CLK(rtc, MMP2_RTC, 0, 32768);
  67. static APMU_CLK(nand, NAND, 0xbf, 100000000);
  68. static struct clk_lookup mmp2_clkregs[] = {
  69. INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
  70. INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL),
  71. INIT_CLKREG(&clk_uart3, "pxa2xx-uart.2", NULL),
  72. INIT_CLKREG(&clk_uart4, "pxa2xx-uart.3", NULL),
  73. INIT_CLKREG(&clk_twsi1, "pxa2xx-i2c.0", NULL),
  74. INIT_CLKREG(&clk_twsi2, "pxa2xx-i2c.1", NULL),
  75. INIT_CLKREG(&clk_twsi3, "pxa2xx-i2c.2", NULL),
  76. INIT_CLKREG(&clk_twsi4, "pxa2xx-i2c.3", NULL),
  77. INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL),
  78. INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL),
  79. INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
  80. };
  81. static int __init mmp2_init(void)
  82. {
  83. if (cpu_is_mmp2()) {
  84. mfp_init_base(MFPR_VIRT_BASE);
  85. mfp_init_addr(mmp2_addr_map);
  86. clks_register(ARRAY_AND_SIZE(mmp2_clkregs));
  87. }
  88. return 0;
  89. }
  90. postcore_initcall(mmp2_init);
  91. /* on-chip devices */
  92. MMP2_DEVICE(uart1, "pxa2xx-uart", 0, UART1, 0xd4030000, 0x30, 4, 5);
  93. MMP2_DEVICE(uart2, "pxa2xx-uart", 1, UART2, 0xd4017000, 0x30, 20, 21);
  94. MMP2_DEVICE(uart3, "pxa2xx-uart", 2, UART3, 0xd4018000, 0x30, 22, 23);
  95. MMP2_DEVICE(uart4, "pxa2xx-uart", 3, UART4, 0xd4016000, 0x30, 18, 19);
  96. MMP2_DEVICE(twsi1, "pxa2xx-i2c", 0, TWSI1, 0xd4011000, 0x70);
  97. MMP2_DEVICE(twsi2, "pxa2xx-i2c", 1, TWSI2, 0xd4031000, 0x70);
  98. MMP2_DEVICE(twsi3, "pxa2xx-i2c", 2, TWSI3, 0xd4032000, 0x70);
  99. MMP2_DEVICE(twsi4, "pxa2xx-i2c", 3, TWSI4, 0xd4033000, 0x70);
  100. MMP2_DEVICE(twsi5, "pxa2xx-i2c", 4, TWSI5, 0xd4033800, 0x70);
  101. MMP2_DEVICE(twsi6, "pxa2xx-i2c", 5, TWSI6, 0xd4034000, 0x70);
  102. MMP2_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x100, 28, 29);