Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 //
0003 // Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>,
0004 //  as part of OpenInkpot project
0005 // Copyright (c) 2009 Promwad Innovation Company
0006 //  Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
0007 //
0008 // Samsung S3C2416 Mobile CPU support
0009 
0010 #include <linux/kernel.h>
0011 #include <linux/types.h>
0012 #include <linux/interrupt.h>
0013 #include <linux/list.h>
0014 #include <linux/timer.h>
0015 #include <linux/init.h>
0016 #include <linux/gpio.h>
0017 #include <linux/platform_device.h>
0018 #include <linux/serial_core.h>
0019 #include <linux/device.h>
0020 #include <linux/syscore_ops.h>
0021 #include <linux/clk.h>
0022 #include <linux/io.h>
0023 #include <linux/reboot.h>
0024 
0025 #include <asm/mach/arch.h>
0026 #include <asm/mach/map.h>
0027 #include <asm/mach/irq.h>
0028 
0029 #include "map.h"
0030 #include "gpio-samsung.h"
0031 #include <asm/proc-fns.h>
0032 #include <asm/irq.h>
0033 #include <asm/system_misc.h>
0034 
0035 #include "regs-s3c2443-clock.h"
0036 #include "rtc-core-s3c24xx.h"
0037 
0038 #include "gpio-core.h"
0039 #include "gpio-cfg.h"
0040 #include "gpio-cfg-helpers.h"
0041 #include "devs.h"
0042 #include "cpu.h"
0043 #include "sdhci.h"
0044 #include "pm.h"
0045 
0046 #include "iic-core.h"
0047 #include "adc-core.h"
0048 
0049 #include "s3c24xx.h"
0050 #include "fb-core-s3c24xx.h"
0051 #include "nand-core-s3c24xx.h"
0052 #include "spi-core-s3c24xx.h"
0053 
0054 static struct map_desc s3c2416_iodesc[] __initdata __maybe_unused = {
0055     IODESC_ENT(WATCHDOG),
0056     IODESC_ENT(CLKPWR),
0057     IODESC_ENT(TIMER),
0058 };
0059 
0060 struct bus_type s3c2416_subsys = {
0061     .name = "s3c2416-core",
0062     .dev_name = "s3c2416-core",
0063 };
0064 
0065 static struct device s3c2416_dev = {
0066     .bus        = &s3c2416_subsys,
0067 };
0068 
0069 int __init s3c2416_init(void)
0070 {
0071     printk(KERN_INFO "S3C2416: Initializing architecture\n");
0072 
0073     /* change WDT IRQ number */
0074     s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
0075     s3c_device_wdt.resource[1].end   = IRQ_S3C2443_WDT;
0076 
0077     /* the i2c devices are directly compatible with s3c2440 */
0078     s3c_i2c0_setname("s3c2440-i2c");
0079     s3c_i2c1_setname("s3c2440-i2c");
0080 
0081     s3c_fb_setname("s3c2443-fb");
0082 
0083     s3c_adc_setname("s3c2416-adc");
0084     s3c_rtc_setname("s3c2416-rtc");
0085 
0086 #ifdef CONFIG_PM_SLEEP
0087     register_syscore_ops(&s3c2416_pm_syscore_ops);
0088     register_syscore_ops(&s3c24xx_irq_syscore_ops);
0089     register_syscore_ops(&s3c2416_irq_syscore_ops);
0090 #endif
0091 
0092     return device_register(&s3c2416_dev);
0093 }
0094 
0095 void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no)
0096 {
0097     s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
0098 
0099     s3c_nand_setname("s3c2412-nand");
0100 }
0101 
0102 /* s3c2416_map_io
0103  *
0104  * register the standard cpu IO areas, and any passed in from the
0105  * machine specific initialisation.
0106  */
0107 
0108 void __init s3c2416_map_io(void)
0109 {
0110     s3c24xx_gpiocfg_default.set_pull = samsung_gpio_setpull_updown;
0111     s3c24xx_gpiocfg_default.get_pull = samsung_gpio_getpull_updown;
0112 
0113     /* initialize device information early */
0114     s3c2416_default_sdhci0();
0115     s3c2416_default_sdhci1();
0116     s3c24xx_spi_setname("s3c2443-spi");
0117 
0118     iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
0119 }
0120 
0121 /* need to register the subsystem before we actually register the device, and
0122  * we also need to ensure that it has been initialised before any of the
0123  * drivers even try to use it (even if not on an s3c2416 based system)
0124  * as a driver which may support both 2443 and 2440 may try and use it.
0125 */
0126 
0127 static int __init s3c2416_core_init(void)
0128 {
0129     return subsys_system_register(&s3c2416_subsys, NULL);
0130 }
0131 
0132 core_initcall(s3c2416_core_init);