1 /* linux/arch/arm/mach-s3c2410/s3c2412.c
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 * 16-May-2003 BJD Created initial version
14 * 16-Aug-2003 BJD Fixed header files and copyright, added URL
15 * 05-Sep-2003 BJD Moved to kernel v2.6
16 * 18-Jan-2004 BJD Added serial port configuration
17 * 21-Aug-2004 BJD Added new struct s3c2410_board handler
18 * 28-Sep-2004 BJD Updates for new serial port bits
19 * 04-Nov-2004 BJD Updated UART configuration process
20 * 10-Jan-2005 BJD Removed s3c2410_clock_tick_rate
21 * 13-Aug-2005 DA Removed UART from initial I/O mappings
24 #include <linux/kernel.h>
25 #include <linux/types.h>
26 #include <linux/interrupt.h>
27 #include <linux/list.h>
28 #include <linux/timer.h>
29 #include <linux/init.h>
30 #include <linux/sysdev.h>
31 #include <linux/platform_device.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
35 #include <asm/mach/irq.h>
37 #include <asm/hardware.h>
41 #include <asm/arch/regs-clock.h>
42 #include <asm/arch/regs-serial.h>
43 #include <asm/arch/regs-gpio.h>
44 #include <asm/arch/regs-gpioj.h>
45 #include <asm/arch/regs-dsc.h>
53 #ifndef CONFIG_CPU_S3C2412_ONLY
54 void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO;
57 /* Initial IO mappings */
59 static struct map_desc s3c2412_iodesc[] __initdata = {
67 /* uart registration process */
69 void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no)
71 s3c24xx_init_uartdevs("s3c2412-uart", s3c2410_uart_resources, cfg, no);
73 /* rename devices that are s3c2412/s3c2413 specific */
74 s3c_device_sdi.name = "s3c2412-sdi";
75 s3c_device_nand.name = "s3c2412-nand";
80 * register the standard cpu IO areas, and any passed in from the
81 * machine specific initialisation.
84 void __init s3c2412_map_io(struct map_desc *mach_desc, int mach_size)
88 s3c24xx_va_gpio2 = S3C24XX_VA_GPIO + 0x10;
90 /* register our io-tables */
92 iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc));
93 iotable_init(mach_desc, mach_size);
96 void __init s3c2412_init_clocks(int xtal)
103 /* now we've got our machine bits initialised, work out what
104 * clocks we've got */
106 fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal*2);
108 tmp = __raw_readl(S3C2410_CLKDIVN);
110 /* work out clock scalings */
112 hclk = fclk / ((tmp & S3C2412_CLKDIVN_HDIVN_MASK) + 1);
113 hclk /= ((tmp & S3C2421_CLKDIVN_ARMDIVN) ? 2 : 1);
114 pclk = hclk / ((tmp & S3C2412_CLKDIVN_PDIVN) ? 2 : 1);
116 /* print brieft summary of clocks, etc */
118 printk("S3C2412: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
119 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
121 /* initialise the clocks here, to allow other things like the
122 * console to use them
125 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk);
126 s3c2412_baseclk_add();
129 /* need to register class before we actually register the device, and
130 * we also need to ensure that it has been initialised before any of the
131 * drivers even try to use it (even if not on an s3c2412 based system)
132 * as a driver which may support both 2410 and 2440 may try and use it.
136 static struct sleep_save s3c2412_sleep[] = {
137 SAVE_ITEM(S3C2412_DSC0),
138 SAVE_ITEM(S3C2412_DSC1),
139 SAVE_ITEM(S3C2413_GPJDAT),
140 SAVE_ITEM(S3C2413_GPJCON),
141 SAVE_ITEM(S3C2413_GPJUP),
143 /* save the sleep configuration anyway, just in case these
144 * get damaged during wakeup */
146 SAVE_ITEM(S3C2412_GPBSLPCON),
147 SAVE_ITEM(S3C2412_GPCSLPCON),
148 SAVE_ITEM(S3C2412_GPDSLPCON),
149 SAVE_ITEM(S3C2412_GPESLPCON),
150 SAVE_ITEM(S3C2412_GPFSLPCON),
151 SAVE_ITEM(S3C2412_GPGSLPCON),
152 SAVE_ITEM(S3C2412_GPHSLPCON),
153 SAVE_ITEM(S3C2413_GPJSLPCON),
156 static int s3c2412_suspend(struct sys_device *dev, pm_message_t state)
158 s3c2410_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
162 static int s3c2412_resume(struct sys_device *dev)
164 s3c2410_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
169 #define s3c2412_suspend NULL
170 #define s3c2412_resume NULL
173 struct sysdev_class s3c2412_sysclass = {
174 set_kset_name("s3c2412-core"),
175 .suspend = s3c2412_suspend,
176 .resume = s3c2412_resume
179 static int __init s3c2412_core_init(void)
181 return sysdev_class_register(&s3c2412_sysclass);
184 core_initcall(s3c2412_core_init);
186 static struct sys_device s3c2412_sysdev = {
187 .cls = &s3c2412_sysclass,
190 int __init s3c2412_init(void)
192 printk("S3C2412: Initialising architecture\n");
194 return sysdev_register(&s3c2412_sysdev);