s3c244x.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* linux/arch/arm/plat-s3c24xx/s3c244x.c
  2. *
  3. * Copyright (c) 2004-2006 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * Samsung S3C2440 and S3C2442 Mobile CPU support (not S3C2443)
  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/kernel.h>
  13. #include <linux/types.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/list.h>
  16. #include <linux/timer.h>
  17. #include <linux/init.h>
  18. #include <linux/serial_core.h>
  19. #include <linux/serial_s3c.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/reboot.h>
  22. #include <linux/device.h>
  23. #include <linux/syscore_ops.h>
  24. #include <linux/clk.h>
  25. #include <linux/io.h>
  26. #include <asm/system_misc.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/map.h>
  29. #include <asm/mach/irq.h>
  30. #include <mach/hardware.h>
  31. #include <asm/irq.h>
  32. #include <plat/cpu-freq.h>
  33. #include <mach/regs-clock.h>
  34. #include <mach/regs-gpio.h>
  35. #include <plat/devs.h>
  36. #include <plat/cpu.h>
  37. #include <plat/pm.h>
  38. #include "common.h"
  39. #include "nand-core.h"
  40. #include "regs-dsc.h"
  41. static struct map_desc s3c244x_iodesc[] __initdata = {
  42. IODESC_ENT(CLKPWR),
  43. IODESC_ENT(TIMER),
  44. IODESC_ENT(WATCHDOG),
  45. };
  46. /* uart initialisation */
  47. void __init s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no)
  48. {
  49. s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
  50. }
  51. void __init s3c244x_map_io(void)
  52. {
  53. /* register our io-tables */
  54. iotable_init(s3c244x_iodesc, ARRAY_SIZE(s3c244x_iodesc));
  55. /* rename any peripherals used differing from the s3c2410 */
  56. s3c_device_sdi.name = "s3c2440-sdi";
  57. s3c_device_i2c0.name = "s3c2440-i2c";
  58. s3c_nand_setname("s3c2440-nand");
  59. s3c_device_ts.name = "s3c2440-ts";
  60. s3c_device_usbgadget.name = "s3c2440-usbgadget";
  61. s3c2410_device_dclk.name = "s3c2440-dclk";
  62. }
  63. /* Since the S3C2442 and S3C2440 share items, put both subsystems here */
  64. struct bus_type s3c2440_subsys = {
  65. .name = "s3c2440-core",
  66. .dev_name = "s3c2440-core",
  67. };
  68. struct bus_type s3c2442_subsys = {
  69. .name = "s3c2442-core",
  70. .dev_name = "s3c2442-core",
  71. };
  72. /* need to register the subsystem before we actually register the device, and
  73. * we also need to ensure that it has been initialised before any of the
  74. * drivers even try to use it (even if not on an s3c2440 based system)
  75. * as a driver which may support both 2410 and 2440 may try and use it.
  76. */
  77. static int __init s3c2440_core_init(void)
  78. {
  79. return subsys_system_register(&s3c2440_subsys, NULL);
  80. }
  81. core_initcall(s3c2440_core_init);
  82. static int __init s3c2442_core_init(void)
  83. {
  84. return subsys_system_register(&s3c2442_subsys, NULL);
  85. }
  86. core_initcall(s3c2442_core_init);
  87. #ifdef CONFIG_PM_SLEEP
  88. static struct sleep_save s3c244x_sleep[] = {
  89. SAVE_ITEM(S3C2440_DSC0),
  90. SAVE_ITEM(S3C2440_DSC1),
  91. SAVE_ITEM(S3C2440_GPJDAT),
  92. SAVE_ITEM(S3C2440_GPJCON),
  93. SAVE_ITEM(S3C2440_GPJUP)
  94. };
  95. static int s3c244x_suspend(void)
  96. {
  97. s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
  98. return 0;
  99. }
  100. static void s3c244x_resume(void)
  101. {
  102. s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
  103. }
  104. struct syscore_ops s3c244x_pm_syscore_ops = {
  105. .suspend = s3c244x_suspend,
  106. .resume = s3c244x_resume,
  107. };
  108. #endif