s3c244x.c 3.0 KB

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