Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 //
0003 // Copyright (c) 2004-2006 Simtec Electronics
0004 //   Ben Dooks <ben@simtec.co.uk>
0005 //
0006 // Samsung S3C2440 and S3C2442 Mobile CPU support (not S3C2443)
0007 
0008 #include <linux/kernel.h>
0009 #include <linux/types.h>
0010 #include <linux/interrupt.h>
0011 #include <linux/list.h>
0012 #include <linux/timer.h>
0013 #include <linux/init.h>
0014 #include <linux/serial_core.h>
0015 #include <linux/serial_s3c.h>
0016 #include <linux/platform_device.h>
0017 #include <linux/reboot.h>
0018 #include <linux/device.h>
0019 #include <linux/syscore_ops.h>
0020 #include <linux/clk.h>
0021 #include <linux/io.h>
0022 
0023 #include <asm/system_misc.h>
0024 #include <asm/mach/arch.h>
0025 #include <asm/mach/map.h>
0026 #include <asm/mach/irq.h>
0027 
0028 #include "map.h"
0029 #include <asm/irq.h>
0030 
0031 #include "regs-clock.h"
0032 #include "regs-gpio.h"
0033 
0034 #include "devs.h"
0035 #include "cpu.h"
0036 #include "pm.h"
0037 
0038 #include "s3c24xx.h"
0039 #include "nand-core-s3c24xx.h"
0040 #include "regs-dsc-s3c24xx.h"
0041 
0042 static struct map_desc s3c244x_iodesc[] __initdata __maybe_unused = {
0043     IODESC_ENT(CLKPWR),
0044     IODESC_ENT(TIMER),
0045     IODESC_ENT(WATCHDOG),
0046 };
0047 
0048 /* uart initialisation */
0049 
0050 void __init s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no)
0051 {
0052     s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
0053 }
0054 
0055 void __init s3c244x_map_io(void)
0056 {
0057     /* register our io-tables */
0058 
0059     iotable_init(s3c244x_iodesc, ARRAY_SIZE(s3c244x_iodesc));
0060 
0061     /* rename any peripherals used differing from the s3c2410 */
0062 
0063     s3c_device_sdi.name  = "s3c2440-sdi";
0064     s3c_device_i2c0.name  = "s3c2440-i2c";
0065     s3c_nand_setname("s3c2440-nand");
0066     s3c_device_ts.name = "s3c2440-ts";
0067     s3c_device_usbgadget.name = "s3c2440-usbgadget";
0068     s3c2410_device_dclk.name = "s3c2440-dclk";
0069 }
0070 
0071 /* Since the S3C2442 and S3C2440 share items, put both subsystems here */
0072 
0073 struct bus_type s3c2440_subsys = {
0074     .name       = "s3c2440-core",
0075     .dev_name   = "s3c2440-core",
0076 };
0077 
0078 struct bus_type s3c2442_subsys = {
0079     .name       = "s3c2442-core",
0080     .dev_name   = "s3c2442-core",
0081 };
0082 
0083 /* need to register the subsystem before we actually register the device, and
0084  * we also need to ensure that it has been initialised before any of the
0085  * drivers even try to use it (even if not on an s3c2440 based system)
0086  * as a driver which may support both 2410 and 2440 may try and use it.
0087 */
0088 
0089 static int __init s3c2440_core_init(void)
0090 {
0091     return subsys_system_register(&s3c2440_subsys, NULL);
0092 }
0093 
0094 core_initcall(s3c2440_core_init);
0095 
0096 static int __init s3c2442_core_init(void)
0097 {
0098     return subsys_system_register(&s3c2442_subsys, NULL);
0099 }
0100 
0101 core_initcall(s3c2442_core_init);
0102 
0103 
0104 #ifdef CONFIG_PM_SLEEP
0105 static struct sleep_save s3c244x_sleep[] = {
0106     SAVE_ITEM(S3C2440_DSC0),
0107     SAVE_ITEM(S3C2440_DSC1),
0108     SAVE_ITEM(S3C2440_GPJDAT),
0109     SAVE_ITEM(S3C2440_GPJCON),
0110     SAVE_ITEM(S3C2440_GPJUP)
0111 };
0112 
0113 static int s3c244x_suspend(void)
0114 {
0115     s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
0116     return 0;
0117 }
0118 
0119 static void s3c244x_resume(void)
0120 {
0121     s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
0122 }
0123 
0124 struct syscore_ops s3c244x_pm_syscore_ops = {
0125     .suspend    = s3c244x_suspend,
0126     .resume     = s3c244x_resume,
0127 };
0128 #endif