setup.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Renesas System Solutions Asia Pte. Ltd - Migo-R
  3. *
  4. * Copyright (C) 2008 Magnus Damm
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/input.h>
  14. #include <asm/machvec.h>
  15. #include <asm/io.h>
  16. #include <asm/sh_keysc.h>
  17. /* Address IRQ Size Bus Description
  18. * 0x00000000 64MB 16 NOR Flash (SP29PL256N)
  19. * 0x0c000000 64MB 64 SDRAM (2xK4M563233G)
  20. * 0x10000000 IRQ0 16 Ethernet (SMC91C111)
  21. * 0x14000000 IRQ4 16 USB 2.0 Host Controller (M66596)
  22. * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A)
  23. */
  24. static struct resource smc91x_eth_resources[] = {
  25. [0] = {
  26. .name = "smc91x-regs" ,
  27. .start = P2SEGADDR(0x10000300),
  28. .end = P2SEGADDR(0x1000030f),
  29. .flags = IORESOURCE_MEM,
  30. },
  31. [1] = {
  32. .start = 32, /* IRQ0 */
  33. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
  34. },
  35. };
  36. static struct platform_device smc91x_eth_device = {
  37. .name = "smc91x",
  38. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  39. .resource = smc91x_eth_resources,
  40. };
  41. static struct sh_keysc_info sh_keysc_info = {
  42. .mode = SH_KEYSC_MODE_2, /* KEYOUT0->4, KEYIN1->5 */
  43. .scan_timing = 3,
  44. .delay = 5,
  45. .keycodes = {
  46. 0, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ENTER,
  47. 0, KEY_F, KEY_C, KEY_D, KEY_H, KEY_1,
  48. 0, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
  49. 0, KEY_7, KEY_8, KEY_9, KEY_S, KEY_0,
  50. 0, KEY_P, KEY_STOP, KEY_REWIND, KEY_PLAY, KEY_FASTFORWARD,
  51. },
  52. };
  53. static struct resource sh_keysc_resources[] = {
  54. [0] = {
  55. .start = 0x044b0000,
  56. .end = 0x044b000f,
  57. .flags = IORESOURCE_MEM,
  58. },
  59. [1] = {
  60. .start = 79,
  61. .flags = IORESOURCE_IRQ,
  62. },
  63. };
  64. static struct platform_device sh_keysc_device = {
  65. .name = "sh_keysc",
  66. .num_resources = ARRAY_SIZE(sh_keysc_resources),
  67. .resource = sh_keysc_resources,
  68. .dev = {
  69. .platform_data = &sh_keysc_info,
  70. },
  71. };
  72. static struct platform_device *migor_devices[] __initdata = {
  73. &smc91x_eth_device,
  74. &sh_keysc_device,
  75. };
  76. static int __init migor_devices_setup(void)
  77. {
  78. return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
  79. }
  80. __initcall(migor_devices_setup);
  81. #define PORT_PJCR 0xA4050110UL
  82. #define PORT_PSELA 0xA405014EUL
  83. #define PORT_PYCR 0xA405014AUL
  84. #define PORT_PZCR 0xA405014CUL
  85. #define PORT_HIZCRA 0xA4050158UL
  86. #define PORT_HIZCRC 0xA405015CUL
  87. #define MSTPCR2 0xA4150038UL
  88. static void __init migor_setup(char **cmdline_p)
  89. {
  90. /* SMC91C111 - Enable IRQ0 */
  91. ctrl_outw(ctrl_inw(PORT_PJCR) & ~0x0003, PORT_PJCR);
  92. /* KEYSC */
  93. ctrl_outw(ctrl_inw(PORT_PYCR) & ~0x0fff, PORT_PYCR);
  94. ctrl_outw(ctrl_inw(PORT_PZCR) & ~0x0ff0, PORT_PZCR);
  95. ctrl_outw(ctrl_inw(PORT_PSELA) & ~0x4100, PORT_PSELA);
  96. ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
  97. ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
  98. ctrl_outl(ctrl_inl(MSTPCR2) & ~0x00004000, MSTPCR2);
  99. }
  100. static struct sh_machine_vector mv_migor __initmv = {
  101. .mv_name = "Migo-R",
  102. .mv_setup = migor_setup,
  103. };