^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) // Copyright (c) 2007 Simtec Electronics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) // Ben Dooks <ben@simtec.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) // Samsung S3C2443 Mobile CPU support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/serial_core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/clk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/reboot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <asm/mach/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include "map.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include "gpio-samsung.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <mach/irqs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <asm/system_misc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include "regs-s3c2443-clock.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include "rtc-core-s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include "gpio-core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include "gpio-cfg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include "gpio-cfg-helpers.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include "devs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #include "cpu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #include "adc-core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #include "s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include "fb-core-s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #include "nand-core-s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include "spi-core-s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) static struct map_desc s3c2443_iodesc[] __initdata __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) IODESC_ENT(WATCHDOG),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) IODESC_ENT(CLKPWR),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) IODESC_ENT(TIMER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct bus_type s3c2443_subsys = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) .name = "s3c2443-core",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) .dev_name = "s3c2443-core",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) static struct device s3c2443_dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .bus = &s3c2443_subsys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int __init s3c2443_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) printk("S3C2443: Initialising architecture\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) s3c_nand_setname("s3c2412-nand");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) s3c_fb_setname("s3c2443-fb");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) s3c_adc_setname("s3c2443-adc");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) s3c_rtc_setname("s3c2443-rtc");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /* change WDT IRQ number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) return device_register(&s3c2443_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) /* s3c2443_map_io
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * register the standard cpu IO areas, and any passed in from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * machine specific initialisation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) void __init s3c2443_map_io(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) /* initialize device information early */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) s3c24xx_spi_setname("s3c2443-spi");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /* need to register the subsystem before we actually register the device, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * we also need to ensure that it has been initialised before any of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * drivers even try to use it (even if not on an s3c2443 based system)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * as a driver which may support both 2443 and 2440 may try and use it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) static int __init s3c2443_core_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) return subsys_system_register(&s3c2443_subsys, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) core_initcall(s3c2443_core_init);