p720t.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * linux/arch/arm/mach-clps711x/p720t.c
  3. *
  4. * Copyright (C) 2000-2001 Deep Blue Solutions Ltd
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/types.h>
  23. #include <linux/string.h>
  24. #include <linux/mm.h>
  25. #include <linux/io.h>
  26. #include <linux/slab.h>
  27. #include <linux/leds.h>
  28. #include <mach/hardware.h>
  29. #include <asm/pgtable.h>
  30. #include <asm/page.h>
  31. #include <asm/setup.h>
  32. #include <asm/sizes.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/map.h>
  36. #include <mach/syspld.h>
  37. #include "common.h"
  38. /*
  39. * Map the P720T system PLD. It occupies two address spaces:
  40. * 0x10000000 and 0x10400000. We map both regions as one.
  41. */
  42. static struct map_desc p720t_io_desc[] __initdata = {
  43. {
  44. .virtual = SYSPLD_VIRT_BASE,
  45. .pfn = __phys_to_pfn(SYSPLD_PHYS_BASE),
  46. .length = SZ_8M,
  47. .type = MT_DEVICE,
  48. },
  49. };
  50. static void __init
  51. fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
  52. {
  53. /*
  54. * Our bootloader doesn't setup any tags (yet).
  55. */
  56. if (tag->hdr.tag != ATAG_CORE) {
  57. tag->hdr.tag = ATAG_CORE;
  58. tag->hdr.size = tag_size(tag_core);
  59. tag->u.core.flags = 0;
  60. tag->u.core.pagesize = PAGE_SIZE;
  61. tag->u.core.rootdev = 0x0100;
  62. tag = tag_next(tag);
  63. tag->hdr.tag = ATAG_MEM;
  64. tag->hdr.size = tag_size(tag_mem32);
  65. tag->u.mem.size = 4096;
  66. tag->u.mem.start = PHYS_OFFSET;
  67. tag = tag_next(tag);
  68. tag->hdr.tag = ATAG_NONE;
  69. tag->hdr.size = 0;
  70. }
  71. }
  72. static void __init p720t_map_io(void)
  73. {
  74. clps711x_map_io();
  75. iotable_init(p720t_io_desc, ARRAY_SIZE(p720t_io_desc));
  76. }
  77. static void __init p720t_init_early(void)
  78. {
  79. /*
  80. * Power down as much as possible in case we don't
  81. * have the drivers loaded.
  82. */
  83. PLD_LCDEN = 0;
  84. PLD_PWR &= ~(PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON);
  85. PLD_KBD = 0;
  86. PLD_IO = 0;
  87. PLD_IRDA = 0;
  88. PLD_CODEC = 0;
  89. PLD_TCH = 0;
  90. PLD_SPI = 0;
  91. if (!IS_ENABLED(CONFIG_DEBUG_LL)) {
  92. PLD_COM2 = 0;
  93. PLD_COM1 = 0;
  94. }
  95. }
  96. /*
  97. * LED controled by CPLD
  98. */
  99. #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
  100. static void p720t_led_set(struct led_classdev *cdev,
  101. enum led_brightness b)
  102. {
  103. u8 reg = clps_readb(PDDR);
  104. if (b != LED_OFF)
  105. reg |= 0x1;
  106. else
  107. reg &= ~0x1;
  108. clps_writeb(reg, PDDR);
  109. }
  110. static enum led_brightness p720t_led_get(struct led_classdev *cdev)
  111. {
  112. u8 reg = clps_readb(PDDR);
  113. return (reg & 0x1) ? LED_FULL : LED_OFF;
  114. }
  115. static int __init p720t_leds_init(void)
  116. {
  117. struct led_classdev *cdev;
  118. int ret;
  119. if (!machine_is_p720t())
  120. return -ENODEV;
  121. cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
  122. if (!cdev)
  123. return -ENOMEM;
  124. cdev->name = "p720t:0";
  125. cdev->brightness_set = p720t_led_set;
  126. cdev->brightness_get = p720t_led_get;
  127. cdev->default_trigger = "heartbeat";
  128. ret = led_classdev_register(NULL, cdev);
  129. if (ret < 0) {
  130. kfree(cdev);
  131. return ret;
  132. }
  133. return 0;
  134. }
  135. /*
  136. * Since we may have triggers on any subsystem, defer registration
  137. * until after subsystem_init.
  138. */
  139. fs_initcall(p720t_leds_init);
  140. #endif
  141. MACHINE_START(P720T, "ARM-Prospector720T")
  142. /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
  143. .atag_offset = 0x100,
  144. .fixup = fixup_p720t,
  145. .init_early = p720t_init_early,
  146. .map_io = p720t_map_io,
  147. .init_irq = clps711x_init_irq,
  148. .timer = &clps711x_timer,
  149. .restart = clps711x_restart,
  150. MACHINE_END