Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 //
0003 // Copyright (c) 2003-2005 Simtec Electronics
0004 //  Ben Dooks <ben@simtec.co.uk>
0005 //
0006 // http://www.simtec.co.uk/products/EB2410ITX/
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/gpio.h>
0015 #include <linux/clk.h>
0016 #include <linux/device.h>
0017 #include <linux/syscore_ops.h>
0018 #include <linux/serial_core.h>
0019 #include <linux/serial_s3c.h>
0020 #include <linux/platform_device.h>
0021 #include <linux/reboot.h>
0022 #include <linux/io.h>
0023 
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 "gpio-samsung.h"
0030 #include <asm/irq.h>
0031 #include <asm/system_misc.h>
0032 
0033 
0034 #include "regs-clock.h"
0035 
0036 #include "cpu.h"
0037 #include "devs.h"
0038 #include "pm.h"
0039 
0040 #include "gpio-core.h"
0041 #include "gpio-cfg.h"
0042 #include "gpio-cfg-helpers.h"
0043 
0044 #include "s3c24xx.h"
0045 
0046 /* Initial IO mappings */
0047 
0048 static struct map_desc s3c2410_iodesc[] __initdata __maybe_unused = {
0049     IODESC_ENT(CLKPWR),
0050     IODESC_ENT(TIMER),
0051     IODESC_ENT(WATCHDOG),
0052 };
0053 
0054 /* our uart devices */
0055 
0056 /* uart registration process */
0057 
0058 void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
0059 {
0060     s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no);
0061 }
0062 
0063 /* s3c2410_map_io
0064  *
0065  * register the standard cpu IO areas, and any passed in from the
0066  * machine specific initialisation.
0067 */
0068 
0069 void __init s3c2410_map_io(void)
0070 {
0071     s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
0072     s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
0073 
0074     iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
0075 }
0076 
0077 struct bus_type s3c2410_subsys = {
0078     .name = "s3c2410-core",
0079     .dev_name = "s3c2410-core",
0080 };
0081 
0082 /* Note, we would have liked to name this s3c2410-core, but we cannot
0083  * register two subsystems with the same name.
0084  */
0085 struct bus_type s3c2410a_subsys = {
0086     .name = "s3c2410a-core",
0087     .dev_name = "s3c2410a-core",
0088 };
0089 
0090 static struct device s3c2410_dev = {
0091     .bus        = &s3c2410_subsys,
0092 };
0093 
0094 /* need to register the subsystem before we actually register the device, and
0095  * we also need to ensure that it has been initialised before any of the
0096  * drivers even try to use it (even if not on an s3c2410 based system)
0097  * as a driver which may support both 2410 and 2440 may try and use it.
0098 */
0099 
0100 static int __init s3c2410_core_init(void)
0101 {
0102     return subsys_system_register(&s3c2410_subsys, NULL);
0103 }
0104 
0105 core_initcall(s3c2410_core_init);
0106 
0107 static int __init s3c2410a_core_init(void)
0108 {
0109     return subsys_system_register(&s3c2410a_subsys, NULL);
0110 }
0111 
0112 core_initcall(s3c2410a_core_init);
0113 
0114 int __init s3c2410_init(void)
0115 {
0116     printk("S3C2410: Initialising architecture\n");
0117 
0118 #ifdef CONFIG_PM_SLEEP
0119     register_syscore_ops(&s3c2410_pm_syscore_ops);
0120     register_syscore_ops(&s3c24xx_irq_syscore_ops);
0121 #endif
0122 
0123     return device_register(&s3c2410_dev);
0124 }
0125 
0126 int __init s3c2410a_init(void)
0127 {
0128     s3c2410_dev.bus = &s3c2410a_subsys;
0129     return s3c2410_init();
0130 }