Merge tag 'samsung-soc-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk...
authorOlof Johansson <olof@lixom.net>
Sat, 26 Sep 2020 19:55:43 +0000 (12:55 -0700)
committerOlof Johansson <olof@lixom.net>
Sat, 26 Sep 2020 19:55:43 +0000 (12:55 -0700)
Samsung mach/soc changes for v5.10

1. Clear unneeded L2C-310 flag which presenc was triggering warning
   message.
2. Fix build of SAMSUNG_PM_DEBUG without MMU.
3. Minor cleanups and update of linux-samsung-soc mailing list in
   Maintainers.

* tag 'samsung-soc-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux:
  ARM: s3c64xx: bring back notes from removed debug-macro.S
  ARM: s3c24xx: fix Wunused-variable warning on !MMU
  ARM: samsung: fix PM debug build with DEBUG_LL but !MMU
  MAINTAINERS: mark linux-samsung-soc list non-moderated
  ARM: exynos: clear L310_AUX_CTRL_NS_LOCKDOWN in default l2c_aux_val

Signed-off-by: Olof Johansson <olof@lixom.net>
1  2 
MAINTAINERS
arch/arm/mach-exynos/exynos.c
arch/arm/mach-s3c/s3c2410.c
arch/arm/mach-s3c/s3c2412.c
arch/arm/mach-s3c/s3c2416.c
arch/arm/mach-s3c/s3c2443.c
arch/arm/mach-s3c/s3c244x.c
arch/arm/mach-s3c/s3c24xx.c
arch/arm/mach-s3c/s3c64xx.c
drivers/soc/samsung/Kconfig

diff --cc MAINTAINERS
Simple merge
Simple merge
index 4153e67,0000000..4d39d99
mode 100644,000000..100644
--- /dev/null
@@@ -1,130 -1,0 +1,130 @@@
- static struct map_desc s3c2410_iodesc[] __initdata = {
 +// SPDX-License-Identifier: GPL-2.0
 +//
 +// Copyright (c) 2003-2005 Simtec Electronics
 +//    Ben Dooks <ben@simtec.co.uk>
 +//
 +// http://www.simtec.co.uk/products/EB2410ITX/
 +
 +#include <linux/kernel.h>
 +#include <linux/types.h>
 +#include <linux/interrupt.h>
 +#include <linux/list.h>
 +#include <linux/timer.h>
 +#include <linux/init.h>
 +#include <linux/gpio.h>
 +#include <linux/clk.h>
 +#include <linux/device.h>
 +#include <linux/syscore_ops.h>
 +#include <linux/serial_core.h>
 +#include <linux/serial_s3c.h>
 +#include <linux/platform_device.h>
 +#include <linux/reboot.h>
 +#include <linux/io.h>
 +
 +#include <asm/mach/arch.h>
 +#include <asm/mach/map.h>
 +#include <asm/mach/irq.h>
 +
 +#include "map.h"
 +#include "gpio-samsung.h"
 +#include <asm/irq.h>
 +#include <asm/system_misc.h>
 +
 +
 +#include "regs-clock.h"
 +
 +#include "cpu.h"
 +#include "devs.h"
 +#include "pm.h"
 +
 +#include "gpio-core.h"
 +#include "gpio-cfg.h"
 +#include "gpio-cfg-helpers.h"
 +
 +#include "s3c24xx.h"
 +
 +/* Initial IO mappings */
 +
++static struct map_desc s3c2410_iodesc[] __initdata __maybe_unused = {
 +      IODESC_ENT(CLKPWR),
 +      IODESC_ENT(TIMER),
 +      IODESC_ENT(WATCHDOG),
 +};
 +
 +/* our uart devices */
 +
 +/* uart registration process */
 +
 +void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
 +{
 +      s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no);
 +}
 +
 +/* s3c2410_map_io
 + *
 + * register the standard cpu IO areas, and any passed in from the
 + * machine specific initialisation.
 +*/
 +
 +void __init s3c2410_map_io(void)
 +{
 +      s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
 +      s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
 +
 +      iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
 +}
 +
 +struct bus_type s3c2410_subsys = {
 +      .name = "s3c2410-core",
 +      .dev_name = "s3c2410-core",
 +};
 +
 +/* Note, we would have liked to name this s3c2410-core, but we cannot
 + * register two subsystems with the same name.
 + */
 +struct bus_type s3c2410a_subsys = {
 +      .name = "s3c2410a-core",
 +      .dev_name = "s3c2410a-core",
 +};
 +
 +static struct device s3c2410_dev = {
 +      .bus            = &s3c2410_subsys,
 +};
 +
 +/* need to register the subsystem before we actually register the device, and
 + * we also need to ensure that it has been initialised before any of the
 + * drivers even try to use it (even if not on an s3c2410 based system)
 + * as a driver which may support both 2410 and 2440 may try and use it.
 +*/
 +
 +static int __init s3c2410_core_init(void)
 +{
 +      return subsys_system_register(&s3c2410_subsys, NULL);
 +}
 +
 +core_initcall(s3c2410_core_init);
 +
 +static int __init s3c2410a_core_init(void)
 +{
 +      return subsys_system_register(&s3c2410a_subsys, NULL);
 +}
 +
 +core_initcall(s3c2410a_core_init);
 +
 +int __init s3c2410_init(void)
 +{
 +      printk("S3C2410: Initialising architecture\n");
 +
 +#ifdef CONFIG_PM_SLEEP
 +      register_syscore_ops(&s3c2410_pm_syscore_ops);
 +      register_syscore_ops(&s3c24xx_irq_syscore_ops);
 +#endif
 +
 +      return device_register(&s3c2410_dev);
 +}
 +
 +int __init s3c2410a_init(void)
 +{
 +      s3c2410_dev.bus = &s3c2410a_subsys;
 +      return s3c2410_init();
 +}
index 35f4add,0000000..0b1ca78
mode 100644,000000..100644
--- /dev/null
@@@ -1,175 -1,0 +1,175 @@@
- static struct map_desc s3c2412_iodesc[] __initdata = {
 +// SPDX-License-Identifier: GPL-2.0
 +//
 +// Copyright (c) 2006 Simtec Electronics
 +//    Ben Dooks <ben@simtec.co.uk>
 +//
 +// http://armlinux.simtec.co.uk/.
 +
 +#include <linux/kernel.h>
 +#include <linux/types.h>
 +#include <linux/interrupt.h>
 +#include <linux/list.h>
 +#include <linux/timer.h>
 +#include <linux/init.h>
 +#include <linux/clk.h>
 +#include <linux/delay.h>
 +#include <linux/device.h>
 +#include <linux/syscore_ops.h>
 +#include <linux/serial_core.h>
 +#include <linux/serial_s3c.h>
 +#include <linux/platform_device.h>
 +#include <linux/io.h>
 +#include <linux/reboot.h>
 +
 +#include <asm/mach/arch.h>
 +#include <asm/mach/map.h>
 +#include <asm/mach/irq.h>
 +
 +#include <asm/proc-fns.h>
 +#include <asm/irq.h>
 +#include <asm/system_misc.h>
 +
 +#include "map.h"
 +#include "regs-clock.h"
 +#include "regs-gpio.h"
 +
 +#include "cpu.h"
 +#include "devs.h"
 +#include "pm.h"
 +
 +#include "s3c24xx.h"
 +#include "nand-core-s3c24xx.h"
 +#include "regs-dsc-s3c24xx.h"
 +#include "s3c2412-power.h"
 +
 +#ifndef CONFIG_CPU_S3C2412_ONLY
 +void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO;
 +
 +static inline void s3c2412_init_gpio2(void)
 +{
 +      s3c24xx_va_gpio2 = S3C24XX_VA_GPIO + 0x10;
 +}
 +#else
 +#define s3c2412_init_gpio2() do { } while(0)
 +#endif
 +
 +/* Initial IO mappings */
 +
++static struct map_desc s3c2412_iodesc[] __initdata __maybe_unused = {
 +      IODESC_ENT(CLKPWR),
 +      IODESC_ENT(TIMER),
 +      IODESC_ENT(WATCHDOG),
 +      {
 +              .virtual = (unsigned long)S3C2412_VA_SSMC,
 +              .pfn     = __phys_to_pfn(S3C2412_PA_SSMC),
 +              .length  = SZ_1M,
 +              .type    = MT_DEVICE,
 +      },
 +      {
 +              .virtual = (unsigned long)S3C2412_VA_EBI,
 +              .pfn     = __phys_to_pfn(S3C2412_PA_EBI),
 +              .length  = SZ_1M,
 +              .type    = MT_DEVICE,
 +      },
 +};
 +
 +/* uart registration process */
 +
 +void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no)
 +{
 +      s3c24xx_init_uartdevs("s3c2412-uart", s3c2410_uart_resources, cfg, no);
 +
 +      /* rename devices that are s3c2412/s3c2413 specific */
 +      s3c_device_sdi.name  = "s3c2412-sdi";
 +      s3c_device_lcd.name  = "s3c2412-lcd";
 +      s3c_nand_setname("s3c2412-nand");
 +
 +      /* alter IRQ of SDI controller */
 +
 +      s3c_device_sdi.resource[1].start = IRQ_S3C2412_SDI;
 +      s3c_device_sdi.resource[1].end   = IRQ_S3C2412_SDI;
 +
 +      /* spi channel related changes, s3c2412/13 specific */
 +      s3c_device_spi0.name = "s3c2412-spi";
 +      s3c_device_spi0.resource[0].end = S3C24XX_PA_SPI + 0x24;
 +      s3c_device_spi1.name = "s3c2412-spi";
 +      s3c_device_spi1.resource[0].start = S3C24XX_PA_SPI + S3C2412_SPI1;
 +      s3c_device_spi1.resource[0].end = S3C24XX_PA_SPI + S3C2412_SPI1 + 0x24;
 +
 +}
 +
 +/* s3c2412_idle
 + *
 + * use the standard idle call by ensuring the idle mode
 + * in power config, then issuing the idle co-processor
 + * instruction
 +*/
 +
 +static void s3c2412_idle(void)
 +{
 +      unsigned long tmp;
 +
 +      /* ensure our idle mode is to go to idle */
 +
 +      tmp = __raw_readl(S3C2412_PWRCFG);
 +      tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
 +      tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE;
 +      __raw_writel(tmp, S3C2412_PWRCFG);
 +
 +      cpu_do_idle();
 +}
 +
 +/* s3c2412_map_io
 + *
 + * register the standard cpu IO areas, and any passed in from the
 + * machine specific initialisation.
 +*/
 +
 +void __init s3c2412_map_io(void)
 +{
 +      /* move base of IO */
 +
 +      s3c2412_init_gpio2();
 +
 +      /* set our idle function */
 +
 +      arm_pm_idle = s3c2412_idle;
 +
 +      /* register our io-tables */
 +
 +      iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc));
 +}
 +
 +/* need to register the subsystem before we actually register the device, and
 + * we also need to ensure that it has been initialised before any of the
 + * drivers even try to use it (even if not on an s3c2412 based system)
 + * as a driver which may support both 2410 and 2440 may try and use it.
 +*/
 +
 +struct bus_type s3c2412_subsys = {
 +      .name = "s3c2412-core",
 +      .dev_name = "s3c2412-core",
 +};
 +
 +static int __init s3c2412_core_init(void)
 +{
 +      return subsys_system_register(&s3c2412_subsys, NULL);
 +}
 +
 +core_initcall(s3c2412_core_init);
 +
 +static struct device s3c2412_dev = {
 +      .bus            = &s3c2412_subsys,
 +};
 +
 +int __init s3c2412_init(void)
 +{
 +      printk("S3C2412: Initialising architecture\n");
 +
 +#ifdef CONFIG_PM_SLEEP
 +      register_syscore_ops(&s3c2412_pm_syscore_ops);
 +      register_syscore_ops(&s3c24xx_irq_syscore_ops);
 +#endif
 +
 +      return device_register(&s3c2412_dev);
 +}
index 34b7c10,0000000..126e6ed
mode 100644,000000..100644
--- /dev/null
@@@ -1,132 -1,0 +1,132 @@@
- static struct map_desc s3c2416_iodesc[] __initdata = {
 +// SPDX-License-Identifier: GPL-2.0+
 +//
 +// Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>,
 +//    as part of OpenInkpot project
 +// Copyright (c) 2009 Promwad Innovation Company
 +//    Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
 +//
 +// Samsung S3C2416 Mobile CPU support
 +
 +#include <linux/kernel.h>
 +#include <linux/types.h>
 +#include <linux/interrupt.h>
 +#include <linux/list.h>
 +#include <linux/timer.h>
 +#include <linux/init.h>
 +#include <linux/gpio.h>
 +#include <linux/platform_device.h>
 +#include <linux/serial_core.h>
 +#include <linux/device.h>
 +#include <linux/syscore_ops.h>
 +#include <linux/clk.h>
 +#include <linux/io.h>
 +#include <linux/reboot.h>
 +
 +#include <asm/mach/arch.h>
 +#include <asm/mach/map.h>
 +#include <asm/mach/irq.h>
 +
 +#include "map.h"
 +#include "gpio-samsung.h"
 +#include <asm/proc-fns.h>
 +#include <asm/irq.h>
 +#include <asm/system_misc.h>
 +
 +#include "regs-s3c2443-clock.h"
 +#include "rtc-core-s3c24xx.h"
 +
 +#include "gpio-core.h"
 +#include "gpio-cfg.h"
 +#include "gpio-cfg-helpers.h"
 +#include "devs.h"
 +#include "cpu.h"
 +#include "sdhci.h"
 +#include "pm.h"
 +
 +#include "iic-core.h"
 +#include "adc-core.h"
 +
 +#include "s3c24xx.h"
 +#include "fb-core-s3c24xx.h"
 +#include "nand-core-s3c24xx.h"
 +#include "spi-core-s3c24xx.h"
 +
++static struct map_desc s3c2416_iodesc[] __initdata __maybe_unused = {
 +      IODESC_ENT(WATCHDOG),
 +      IODESC_ENT(CLKPWR),
 +      IODESC_ENT(TIMER),
 +};
 +
 +struct bus_type s3c2416_subsys = {
 +      .name = "s3c2416-core",
 +      .dev_name = "s3c2416-core",
 +};
 +
 +static struct device s3c2416_dev = {
 +      .bus            = &s3c2416_subsys,
 +};
 +
 +int __init s3c2416_init(void)
 +{
 +      printk(KERN_INFO "S3C2416: Initializing architecture\n");
 +
 +      /* change WDT IRQ number */
 +      s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
 +      s3c_device_wdt.resource[1].end   = IRQ_S3C2443_WDT;
 +
 +      /* the i2c devices are directly compatible with s3c2440 */
 +      s3c_i2c0_setname("s3c2440-i2c");
 +      s3c_i2c1_setname("s3c2440-i2c");
 +
 +      s3c_fb_setname("s3c2443-fb");
 +
 +      s3c_adc_setname("s3c2416-adc");
 +      s3c_rtc_setname("s3c2416-rtc");
 +
 +#ifdef CONFIG_PM_SLEEP
 +      register_syscore_ops(&s3c2416_pm_syscore_ops);
 +      register_syscore_ops(&s3c24xx_irq_syscore_ops);
 +      register_syscore_ops(&s3c2416_irq_syscore_ops);
 +#endif
 +
 +      return device_register(&s3c2416_dev);
 +}
 +
 +void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no)
 +{
 +      s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
 +
 +      s3c_nand_setname("s3c2412-nand");
 +}
 +
 +/* s3c2416_map_io
 + *
 + * register the standard cpu IO areas, and any passed in from the
 + * machine specific initialisation.
 + */
 +
 +void __init s3c2416_map_io(void)
 +{
 +      s3c24xx_gpiocfg_default.set_pull = samsung_gpio_setpull_updown;
 +      s3c24xx_gpiocfg_default.get_pull = samsung_gpio_getpull_updown;
 +
 +      /* initialize device information early */
 +      s3c2416_default_sdhci0();
 +      s3c2416_default_sdhci1();
 +      s3c24xx_spi_setname("s3c2443-spi");
 +
 +      iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
 +}
 +
 +/* need to register the subsystem before we actually register the device, and
 + * we also need to ensure that it has been initialised before any of the
 + * drivers even try to use it (even if not on an s3c2416 based system)
 + * as a driver which may support both 2443 and 2440 may try and use it.
 +*/
 +
 +static int __init s3c2416_core_init(void)
 +{
 +      return subsys_system_register(&s3c2416_subsys, NULL);
 +}
 +
 +core_initcall(s3c2416_core_init);
index 45fde50,0000000..08f9101
mode 100644,000000..100644
--- /dev/null
@@@ -1,112 -1,0 +1,112 @@@
- static struct map_desc s3c2443_iodesc[] __initdata = {
 +// SPDX-License-Identifier: GPL-2.0
 +//
 +// Copyright (c) 2007 Simtec Electronics
 +//   Ben Dooks <ben@simtec.co.uk>
 +//
 +// Samsung S3C2443 Mobile CPU support
 +
 +#include <linux/kernel.h>
 +#include <linux/types.h>
 +#include <linux/interrupt.h>
 +#include <linux/list.h>
 +#include <linux/timer.h>
 +#include <linux/init.h>
 +#include <linux/gpio.h>
 +#include <linux/platform_device.h>
 +#include <linux/serial_core.h>
 +#include <linux/device.h>
 +#include <linux/clk.h>
 +#include <linux/io.h>
 +#include <linux/reboot.h>
 +
 +#include <asm/mach/arch.h>
 +#include <asm/mach/map.h>
 +#include <asm/mach/irq.h>
 +
 +#include "map.h"
 +#include "gpio-samsung.h"
 +#include <mach/irqs.h>
 +#include <asm/irq.h>
 +#include <asm/system_misc.h>
 +
 +#include "regs-s3c2443-clock.h"
 +#include "rtc-core-s3c24xx.h"
 +
 +#include "gpio-core.h"
 +#include "gpio-cfg.h"
 +#include "gpio-cfg-helpers.h"
 +#include "devs.h"
 +#include "cpu.h"
 +#include "adc-core.h"
 +
 +#include "s3c24xx.h"
 +#include "fb-core-s3c24xx.h"
 +#include "nand-core-s3c24xx.h"
 +#include "spi-core-s3c24xx.h"
 +
++static struct map_desc s3c2443_iodesc[] __initdata __maybe_unused = {
 +      IODESC_ENT(WATCHDOG),
 +      IODESC_ENT(CLKPWR),
 +      IODESC_ENT(TIMER),
 +};
 +
 +struct bus_type s3c2443_subsys = {
 +      .name = "s3c2443-core",
 +      .dev_name = "s3c2443-core",
 +};
 +
 +static struct device s3c2443_dev = {
 +      .bus            = &s3c2443_subsys,
 +};
 +
 +int __init s3c2443_init(void)
 +{
 +      printk("S3C2443: Initialising architecture\n");
 +
 +      s3c_nand_setname("s3c2412-nand");
 +      s3c_fb_setname("s3c2443-fb");
 +
 +      s3c_adc_setname("s3c2443-adc");
 +      s3c_rtc_setname("s3c2443-rtc");
 +
 +      /* change WDT IRQ number */
 +      s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
 +      s3c_device_wdt.resource[1].end   = IRQ_S3C2443_WDT;
 +
 +      return device_register(&s3c2443_dev);
 +}
 +
 +void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no)
 +{
 +      s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
 +}
 +
 +/* s3c2443_map_io
 + *
 + * register the standard cpu IO areas, and any passed in from the
 + * machine specific initialisation.
 + */
 +
 +void __init s3c2443_map_io(void)
 +{
 +      s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull;
 +      s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull;
 +
 +      /* initialize device information early */
 +      s3c24xx_spi_setname("s3c2443-spi");
 +
 +      iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
 +}
 +
 +/* need to register the subsystem before we actually register the device, and
 + * we also need to ensure that it has been initialised before any of the
 + * drivers even try to use it (even if not on an s3c2443 based system)
 + * as a driver which may support both 2443 and 2440 may try and use it.
 +*/
 +
 +static int __init s3c2443_core_init(void)
 +{
 +      return subsys_system_register(&s3c2443_subsys, NULL);
 +}
 +
 +core_initcall(s3c2443_core_init);
index bae9359,0000000..95df349
mode 100644,000000..100644
--- /dev/null
@@@ -1,128 -1,0 +1,128 @@@
- static struct map_desc s3c244x_iodesc[] __initdata = {
 +// SPDX-License-Identifier: GPL-2.0
 +//
 +// Copyright (c) 2004-2006 Simtec Electronics
 +//   Ben Dooks <ben@simtec.co.uk>
 +//
 +// Samsung S3C2440 and S3C2442 Mobile CPU support (not S3C2443)
 +
 +#include <linux/kernel.h>
 +#include <linux/types.h>
 +#include <linux/interrupt.h>
 +#include <linux/list.h>
 +#include <linux/timer.h>
 +#include <linux/init.h>
 +#include <linux/serial_core.h>
 +#include <linux/serial_s3c.h>
 +#include <linux/platform_device.h>
 +#include <linux/reboot.h>
 +#include <linux/device.h>
 +#include <linux/syscore_ops.h>
 +#include <linux/clk.h>
 +#include <linux/io.h>
 +
 +#include <asm/system_misc.h>
 +#include <asm/mach/arch.h>
 +#include <asm/mach/map.h>
 +#include <asm/mach/irq.h>
 +
 +#include "map.h"
 +#include <asm/irq.h>
 +
 +#include "regs-clock.h"
 +#include "regs-gpio.h"
 +
 +#include "devs.h"
 +#include "cpu.h"
 +#include "pm.h"
 +
 +#include "s3c24xx.h"
 +#include "nand-core-s3c24xx.h"
 +#include "regs-dsc-s3c24xx.h"
 +
++static struct map_desc s3c244x_iodesc[] __initdata __maybe_unused = {
 +      IODESC_ENT(CLKPWR),
 +      IODESC_ENT(TIMER),
 +      IODESC_ENT(WATCHDOG),
 +};
 +
 +/* uart initialisation */
 +
 +void __init s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no)
 +{
 +      s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
 +}
 +
 +void __init s3c244x_map_io(void)
 +{
 +      /* register our io-tables */
 +
 +      iotable_init(s3c244x_iodesc, ARRAY_SIZE(s3c244x_iodesc));
 +
 +      /* rename any peripherals used differing from the s3c2410 */
 +
 +      s3c_device_sdi.name  = "s3c2440-sdi";
 +      s3c_device_i2c0.name  = "s3c2440-i2c";
 +      s3c_nand_setname("s3c2440-nand");
 +      s3c_device_ts.name = "s3c2440-ts";
 +      s3c_device_usbgadget.name = "s3c2440-usbgadget";
 +      s3c2410_device_dclk.name = "s3c2440-dclk";
 +}
 +
 +/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
 +
 +struct bus_type s3c2440_subsys = {
 +      .name           = "s3c2440-core",
 +      .dev_name       = "s3c2440-core",
 +};
 +
 +struct bus_type s3c2442_subsys = {
 +      .name           = "s3c2442-core",
 +      .dev_name       = "s3c2442-core",
 +};
 +
 +/* need to register the subsystem before we actually register the device, and
 + * we also need to ensure that it has been initialised before any of the
 + * drivers even try to use it (even if not on an s3c2440 based system)
 + * as a driver which may support both 2410 and 2440 may try and use it.
 +*/
 +
 +static int __init s3c2440_core_init(void)
 +{
 +      return subsys_system_register(&s3c2440_subsys, NULL);
 +}
 +
 +core_initcall(s3c2440_core_init);
 +
 +static int __init s3c2442_core_init(void)
 +{
 +      return subsys_system_register(&s3c2442_subsys, NULL);
 +}
 +
 +core_initcall(s3c2442_core_init);
 +
 +
 +#ifdef CONFIG_PM_SLEEP
 +static struct sleep_save s3c244x_sleep[] = {
 +      SAVE_ITEM(S3C2440_DSC0),
 +      SAVE_ITEM(S3C2440_DSC1),
 +      SAVE_ITEM(S3C2440_GPJDAT),
 +      SAVE_ITEM(S3C2440_GPJCON),
 +      SAVE_ITEM(S3C2440_GPJUP)
 +};
 +
 +static int s3c244x_suspend(void)
 +{
 +      s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
 +      return 0;
 +}
 +
 +static void s3c244x_resume(void)
 +{
 +      s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
 +}
 +
 +struct syscore_ops s3c244x_pm_syscore_ops = {
 +      .suspend        = s3c244x_suspend,
 +      .resume         = s3c244x_resume,
 +};
 +#endif
index 26a2190,0000000..ccfed48
mode 100644,000000..100644
--- /dev/null
@@@ -1,680 -1,0 +1,680 @@@
- static struct map_desc s3c_iodesc[] __initdata = {
 +// SPDX-License-Identifier: GPL-2.0+
 +//
 +// Copyright (c) 2004-2005 Simtec Electronics
 +//    http://www.simtec.co.uk/products/SWLINUX/
 +//    Ben Dooks <ben@simtec.co.uk>
 +//
 +// Common code for S3C24XX machines
 +
 +#include <linux/dma-mapping.h>
 +#include <linux/init.h>
 +#include <linux/module.h>
 +#include <linux/interrupt.h>
 +#include <linux/ioport.h>
 +#include <linux/serial_core.h>
 +#include <linux/serial_s3c.h>
 +#include <clocksource/samsung_pwm.h>
 +#include <linux/platform_device.h>
 +#include <linux/delay.h>
 +#include <linux/io.h>
 +#include <linux/platform_data/clk-s3c2410.h>
 +#include <linux/platform_data/dma-s3c24xx.h>
 +#include <linux/dmaengine.h>
 +#include <linux/clk/samsung.h>
 +
 +#include "hardware-s3c24xx.h"
 +#include "map.h"
 +#include "regs-clock.h"
 +#include <asm/irq.h>
 +#include <asm/cacheflush.h>
 +#include <asm/system_info.h>
 +#include <asm/system_misc.h>
 +
 +#include <asm/mach/arch.h>
 +#include <asm/mach/map.h>
 +
 +#include "regs-gpio.h"
 +#include "dma-s3c24xx.h"
 +
 +#include "cpu.h"
 +#include "devs.h"
 +#include "pwm-core.h"
 +
 +#include "s3c24xx.h"
 +
 +/* table of supported CPUs */
 +
 +static const char name_s3c2410[]  = "S3C2410";
 +static const char name_s3c2412[]  = "S3C2412";
 +static const char name_s3c2416[]  = "S3C2416/S3C2450";
 +static const char name_s3c2440[]  = "S3C2440";
 +static const char name_s3c2442[]  = "S3C2442";
 +static const char name_s3c2442b[]  = "S3C2442B";
 +static const char name_s3c2443[]  = "S3C2443";
 +static const char name_s3c2410a[] = "S3C2410A";
 +static const char name_s3c2440a[] = "S3C2440A";
 +
 +static struct cpu_table cpu_ids[] __initdata = {
 +      {
 +              .idcode         = 0x32410000,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2410_map_io,
 +              .init_uarts     = s3c2410_init_uarts,
 +              .init           = s3c2410_init,
 +              .name           = name_s3c2410
 +      },
 +      {
 +              .idcode         = 0x32410002,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2410_map_io,
 +              .init_uarts     = s3c2410_init_uarts,
 +              .init           = s3c2410a_init,
 +              .name           = name_s3c2410a
 +      },
 +      {
 +              .idcode         = 0x32440000,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2440_map_io,
 +              .init_uarts     = s3c244x_init_uarts,
 +              .init           = s3c2440_init,
 +              .name           = name_s3c2440
 +      },
 +      {
 +              .idcode         = 0x32440001,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2440_map_io,
 +              .init_uarts     = s3c244x_init_uarts,
 +              .init           = s3c2440_init,
 +              .name           = name_s3c2440a
 +      },
 +      {
 +              .idcode         = 0x32440aaa,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2442_map_io,
 +              .init_uarts     = s3c244x_init_uarts,
 +              .init           = s3c2442_init,
 +              .name           = name_s3c2442
 +      },
 +      {
 +              .idcode         = 0x32440aab,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2442_map_io,
 +              .init_uarts     = s3c244x_init_uarts,
 +              .init           = s3c2442_init,
 +              .name           = name_s3c2442b
 +      },
 +      {
 +              .idcode         = 0x32412001,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2412_map_io,
 +              .init_uarts     = s3c2412_init_uarts,
 +              .init           = s3c2412_init,
 +              .name           = name_s3c2412,
 +      },
 +      {                       /* a newer version of the s3c2412 */
 +              .idcode         = 0x32412003,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2412_map_io,
 +              .init_uarts     = s3c2412_init_uarts,
 +              .init           = s3c2412_init,
 +              .name           = name_s3c2412,
 +      },
 +      {                       /* a strange version of the s3c2416 */
 +              .idcode         = 0x32450003,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2416_map_io,
 +              .init_uarts     = s3c2416_init_uarts,
 +              .init           = s3c2416_init,
 +              .name           = name_s3c2416,
 +      },
 +      {
 +              .idcode         = 0x32443001,
 +              .idmask         = 0xffffffff,
 +              .map_io         = s3c2443_map_io,
 +              .init_uarts     = s3c2443_init_uarts,
 +              .init           = s3c2443_init,
 +              .name           = name_s3c2443,
 +      },
 +};
 +
 +/* minimal IO mapping */
 +
++static struct map_desc s3c_iodesc[] __initdata __maybe_unused = {
 +      IODESC_ENT(GPIO),
 +      IODESC_ENT(IRQ),
 +      IODESC_ENT(MEMCTRL),
 +      IODESC_ENT(UART)
 +};
 +
 +/* read cpu identificaiton code */
 +
 +static unsigned long s3c24xx_read_idcode_v5(void)
 +{
 +#if defined(CONFIG_CPU_S3C2416)
 +      /* s3c2416 is v5, with S3C24XX_GSTATUS1 instead of S3C2412_GSTATUS1 */
 +
 +      u32 gs = __raw_readl(S3C24XX_GSTATUS1);
 +
 +      /* test for s3c2416 or similar device */
 +      if ((gs >> 16) == 0x3245)
 +              return gs;
 +#endif
 +
 +#if defined(CONFIG_CPU_S3C2412)
 +      return __raw_readl(S3C2412_GSTATUS1);
 +#else
 +      return 1UL;     /* don't look like an 2400 */
 +#endif
 +}
 +
 +static unsigned long s3c24xx_read_idcode_v4(void)
 +{
 +      return __raw_readl(S3C2410_GSTATUS1);
 +}
 +
 +static void s3c24xx_default_idle(void)
 +{
 +      unsigned long tmp = 0;
 +      int i;
 +
 +      /* idle the system by using the idle mode which will wait for an
 +       * interrupt to happen before restarting the system.
 +       */
 +
 +      /* Warning: going into idle state upsets jtag scanning */
 +
 +      __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
 +                   S3C2410_CLKCON);
 +
 +      /* the samsung port seems to do a loop and then unset idle.. */
 +      for (i = 0; i < 50; i++)
 +              tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
 +
 +      /* this bit is not cleared on re-start... */
 +
 +      __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
 +                   S3C2410_CLKCON);
 +}
 +
 +static struct samsung_pwm_variant s3c24xx_pwm_variant = {
 +      .bits           = 16,
 +      .div_base       = 1,
 +      .has_tint_cstat = false,
 +      .tclk_mask      = (1 << 4),
 +};
 +
 +void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 +{
 +      arm_pm_idle = s3c24xx_default_idle;
 +
 +      /* initialise the io descriptors we need for initialisation */
 +      iotable_init(mach_desc, size);
 +      iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
 +
 +      if (cpu_architecture() >= CPU_ARCH_ARMv5) {
 +              samsung_cpu_id = s3c24xx_read_idcode_v5();
 +      } else {
 +              samsung_cpu_id = s3c24xx_read_idcode_v4();
 +      }
 +
 +      s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
 +
 +      samsung_pwm_set_platdata(&s3c24xx_pwm_variant);
 +}
 +
 +void __init s3c24xx_set_timer_source(unsigned int event, unsigned int source)
 +{
 +      s3c24xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
 +      s3c24xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
 +}
 +
 +void __init s3c24xx_timer_init(void)
 +{
 +      unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
 +              IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2, IRQ_TIMER3, IRQ_TIMER4,
 +      };
 +
 +      samsung_pwm_clocksource_init(S3C_VA_TIMER,
 +                                      timer_irqs, &s3c24xx_pwm_variant);
 +}
 +
 +/* Serial port registrations */
 +
 +#define S3C2410_PA_UART0      (S3C24XX_PA_UART)
 +#define S3C2410_PA_UART1      (S3C24XX_PA_UART + 0x4000 )
 +#define S3C2410_PA_UART2      (S3C24XX_PA_UART + 0x8000 )
 +#define S3C2443_PA_UART3      (S3C24XX_PA_UART + 0xC000 )
 +
 +static struct resource s3c2410_uart0_resource[] = {
 +      [0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K),
 +      [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \
 +                      IRQ_S3CUART_ERR0 - IRQ_S3CUART_RX0 + 1, \
 +                      NULL, IORESOURCE_IRQ)
 +};
 +
 +static struct resource s3c2410_uart1_resource[] = {
 +      [0] = DEFINE_RES_MEM(S3C2410_PA_UART1, SZ_16K),
 +      [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX1, \
 +                      IRQ_S3CUART_ERR1 - IRQ_S3CUART_RX1 + 1, \
 +                      NULL, IORESOURCE_IRQ)
 +};
 +
 +static struct resource s3c2410_uart2_resource[] = {
 +      [0] = DEFINE_RES_MEM(S3C2410_PA_UART2, SZ_16K),
 +      [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX2, \
 +                      IRQ_S3CUART_ERR2 - IRQ_S3CUART_RX2 + 1, \
 +                      NULL, IORESOURCE_IRQ)
 +};
 +
 +static struct resource s3c2410_uart3_resource[] = {
 +      [0] = DEFINE_RES_MEM(S3C2443_PA_UART3, SZ_16K),
 +      [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX3, \
 +                      IRQ_S3CUART_ERR3 - IRQ_S3CUART_RX3 + 1, \
 +                      NULL, IORESOURCE_IRQ)
 +};
 +
 +struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
 +      [0] = {
 +              .resources      = s3c2410_uart0_resource,
 +              .nr_resources   = ARRAY_SIZE(s3c2410_uart0_resource),
 +      },
 +      [1] = {
 +              .resources      = s3c2410_uart1_resource,
 +              .nr_resources   = ARRAY_SIZE(s3c2410_uart1_resource),
 +      },
 +      [2] = {
 +              .resources      = s3c2410_uart2_resource,
 +              .nr_resources   = ARRAY_SIZE(s3c2410_uart2_resource),
 +      },
 +      [3] = {
 +              .resources      = s3c2410_uart3_resource,
 +              .nr_resources   = ARRAY_SIZE(s3c2410_uart3_resource),
 +      },
 +};
 +
 +#define s3c24xx_device_dma_mask (*((u64[]) { DMA_BIT_MASK(32) }))
 +
 +#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
 +      defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
 +static struct resource s3c2410_dma_resource[] = {
 +      [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
 +      [1] = DEFINE_RES_IRQ(IRQ_DMA0),
 +      [2] = DEFINE_RES_IRQ(IRQ_DMA1),
 +      [3] = DEFINE_RES_IRQ(IRQ_DMA2),
 +      [4] = DEFINE_RES_IRQ(IRQ_DMA3),
 +};
 +#endif
 +
 +#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2442)
 +static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
 +      [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
 +      [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
 +      [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
 +                                              S3C24XX_DMA_CHANREQ(2, 2) |
 +                                              S3C24XX_DMA_CHANREQ(1, 3),
 +      },
 +      [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
 +      [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
 +      [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
 +      [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
 +      [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
 +      [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
 +                                               S3C24XX_DMA_CHANREQ(3, 2) |
 +                                               S3C24XX_DMA_CHANREQ(3, 3),
 +      },
 +      [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
 +                                                S3C24XX_DMA_CHANREQ(1, 2),
 +      },
 +      [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 2), },
 +      [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
 +      [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
 +      [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
 +      [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
 +};
 +
 +static const struct dma_slave_map s3c2410_dma_slave_map[] = {
 +      { "s3c2410-sdi", "rx-tx", (void *)DMACH_SDI },
 +      { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0_RX },
 +      { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0_TX },
 +      { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1_RX },
 +      { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1_TX },
 +      /*
 +       * The DMA request source[1] (DMACH_UARTx_SRC2) are
 +       * not used in the UART driver.
 +       */
 +      { "s3c2410-uart.0", "rx", (void *)DMACH_UART0 },
 +      { "s3c2410-uart.0", "tx", (void *)DMACH_UART0 },
 +      { "s3c2410-uart.1", "rx", (void *)DMACH_UART1 },
 +      { "s3c2410-uart.1", "tx", (void *)DMACH_UART1 },
 +      { "s3c2410-uart.2", "rx", (void *)DMACH_UART2 },
 +      { "s3c2410-uart.2", "tx", (void *)DMACH_UART2 },
 +      { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
 +      { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
 +      { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
 +      { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
 +      { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
 +      { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
 +      { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
 +      { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
 +      { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
 +      { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
 +};
 +
 +static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
 +      .num_phy_channels = 4,
 +      .channels = s3c2410_dma_channels,
 +      .num_channels = DMACH_MAX,
 +      .slave_map = s3c2410_dma_slave_map,
 +      .slavecnt = ARRAY_SIZE(s3c2410_dma_slave_map),
 +};
 +
 +struct platform_device s3c2410_device_dma = {
 +      .name           = "s3c2410-dma",
 +      .id             = 0,
 +      .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
 +      .resource       = s3c2410_dma_resource,
 +      .dev    = {
 +              .dma_mask = &s3c24xx_device_dma_mask,
 +              .coherent_dma_mask = DMA_BIT_MASK(32),
 +              .platform_data = &s3c2410_dma_platdata,
 +      },
 +};
 +#endif
 +
 +#ifdef CONFIG_CPU_S3C2412
 +static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
 +      [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
 +      [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
 +      [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
 +      [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
 +      [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
 +      [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
 +      [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
 +      [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
 +      [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
 +      [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
 +      [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
 +      [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
 +      [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
 +      [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
 +      [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
 +      [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
 +      [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, 13 },
 +      [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, 14 },
 +      [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, 15 },
 +      [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
 +};
 +
 +static const struct dma_slave_map s3c2412_dma_slave_map[] = {
 +      { "s3c2412-sdi", "rx-tx", (void *)DMACH_SDI },
 +      { "s3c2412-spi.0", "rx", (void *)DMACH_SPI0_RX },
 +      { "s3c2412-spi.0", "tx", (void *)DMACH_SPI0_TX },
 +      { "s3c2412-spi.1", "rx", (void *)DMACH_SPI1_RX },
 +      { "s3c2412-spi.1", "tx", (void *)DMACH_SPI1_TX },
 +      { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
 +      { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
 +      { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
 +      { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
 +      { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
 +      { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
 +      { "s3c2412-iis", "rx", (void *)DMACH_I2S_IN },
 +      { "s3c2412-iis", "tx", (void *)DMACH_I2S_OUT },
 +      { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
 +      { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
 +      { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
 +      { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
 +      { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
 +      { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
 +      { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
 +      { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
 +};
 +
 +static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
 +      .num_phy_channels = 4,
 +      .channels = s3c2412_dma_channels,
 +      .num_channels = DMACH_MAX,
 +      .slave_map = s3c2412_dma_slave_map,
 +      .slavecnt = ARRAY_SIZE(s3c2412_dma_slave_map),
 +};
 +
 +struct platform_device s3c2412_device_dma = {
 +      .name           = "s3c2412-dma",
 +      .id             = 0,
 +      .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
 +      .resource       = s3c2410_dma_resource,
 +      .dev    = {
 +              .dma_mask = &s3c24xx_device_dma_mask,
 +              .coherent_dma_mask = DMA_BIT_MASK(32),
 +              .platform_data = &s3c2412_dma_platdata,
 +      },
 +};
 +#endif
 +
 +#if defined(CONFIG_CPU_S3C2440)
 +static struct s3c24xx_dma_channel s3c2440_dma_channels[DMACH_MAX] = {
 +      [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
 +      [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
 +      [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
 +                                              S3C24XX_DMA_CHANREQ(6, 1) |
 +                                              S3C24XX_DMA_CHANREQ(2, 2) |
 +                                              S3C24XX_DMA_CHANREQ(1, 3),
 +      },
 +      [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
 +      [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
 +      [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
 +      [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
 +      [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
 +      [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
 +                                               S3C24XX_DMA_CHANREQ(3, 2) |
 +                                               S3C24XX_DMA_CHANREQ(3, 3),
 +      },
 +      [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
 +                                                S3C24XX_DMA_CHANREQ(1, 2),
 +      },
 +      [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 0) |
 +                                                 S3C24XX_DMA_CHANREQ(0, 2),
 +      },
 +      [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 0) |
 +                                                S3C24XX_DMA_CHANREQ(5, 2),
 +      },
 +      [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 1) |
 +                                                S3C24XX_DMA_CHANREQ(6, 3),
 +      },
 +      [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 2) |
 +                                                S3C24XX_DMA_CHANREQ(5, 3),
 +      },
 +      [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
 +      [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
 +      [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
 +      [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
 +};
 +
 +static const struct dma_slave_map s3c2440_dma_slave_map[] = {
 +      /* TODO: DMACH_XD0 */
 +      /* TODO: DMACH_XD1 */
 +      { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI },
 +      { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0 },
 +      { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0 },
 +      { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1 },
 +      { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1 },
 +      { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
 +      { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
 +      { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
 +      { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
 +      { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
 +      { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
 +      { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 },
 +      { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 },
 +      /* TODO: DMACH_TIMER */
 +      { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
 +      { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
 +      { "samsung-ac97", "rx", (void *)DMACH_PCM_IN },
 +      { "samsung-ac97", "tx", (void *)DMACH_PCM_OUT },
 +      { "samsung-ac97", "rx", (void *)DMACH_MIC_IN },
 +      { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
 +      { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
 +      { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
 +      { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
 +      { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
 +      { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
 +      { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
 +      { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
 +};
 +
 +static struct s3c24xx_dma_platdata s3c2440_dma_platdata = {
 +      .num_phy_channels = 4,
 +      .channels = s3c2440_dma_channels,
 +      .num_channels = DMACH_MAX,
 +      .slave_map = s3c2440_dma_slave_map,
 +      .slavecnt = ARRAY_SIZE(s3c2440_dma_slave_map),
 +};
 +
 +struct platform_device s3c2440_device_dma = {
 +      .name           = "s3c2410-dma",
 +      .id             = 0,
 +      .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
 +      .resource       = s3c2410_dma_resource,
 +      .dev    = {
 +              .dma_mask = &s3c24xx_device_dma_mask,
 +              .coherent_dma_mask = DMA_BIT_MASK(32),
 +              .platform_data = &s3c2440_dma_platdata,
 +      },
 +};
 +#endif
 +
 +#if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
 +static struct resource s3c2443_dma_resource[] = {
 +      [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
 +      [1] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA0),
 +      [2] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA1),
 +      [3] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA2),
 +      [4] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA3),
 +      [5] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA4),
 +      [6] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA5),
 +};
 +
 +static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
 +      [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
 +      [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
 +      [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
 +      [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
 +      [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
 +      [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
 +      [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
 +      [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
 +      [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
 +      [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
 +      [DMACH_UART3] = { S3C24XX_DMA_APB, true, 25 },
 +      [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
 +      [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
 +      [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
 +      [DMACH_UART3_SRC2] = { S3C24XX_DMA_APB, true, 26 },
 +      [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
 +      [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
 +      [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
 +      [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, 28 },
 +      [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, 27 },
 +      [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
 +};
 +
 +static const struct dma_slave_map s3c2443_dma_slave_map[] = {
 +      { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI },
 +      { "s3c2443-spi.0", "rx", (void *)DMACH_SPI0_RX },
 +      { "s3c2443-spi.0", "tx", (void *)DMACH_SPI0_TX },
 +      { "s3c2443-spi.1", "rx", (void *)DMACH_SPI1_RX },
 +      { "s3c2443-spi.1", "tx", (void *)DMACH_SPI1_TX },
 +      { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
 +      { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
 +      { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
 +      { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
 +      { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
 +      { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
 +      { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 },
 +      { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 },
 +      { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
 +      { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
 +};
 +
 +static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
 +      .num_phy_channels = 6,
 +      .channels = s3c2443_dma_channels,
 +      .num_channels = DMACH_MAX,
 +      .slave_map = s3c2443_dma_slave_map,
 +      .slavecnt = ARRAY_SIZE(s3c2443_dma_slave_map),
 +};
 +
 +struct platform_device s3c2443_device_dma = {
 +      .name           = "s3c2443-dma",
 +      .id             = 0,
 +      .num_resources  = ARRAY_SIZE(s3c2443_dma_resource),
 +      .resource       = s3c2443_dma_resource,
 +      .dev    = {
 +              .dma_mask = &s3c24xx_device_dma_mask,
 +              .coherent_dma_mask = DMA_BIT_MASK(32),
 +              .platform_data = &s3c2443_dma_platdata,
 +      },
 +};
 +#endif
 +
 +#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2410)
 +void __init s3c2410_init_clocks(int xtal)
 +{
 +      s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
 +}
 +#endif
 +
 +#ifdef CONFIG_CPU_S3C2412
 +void __init s3c2412_init_clocks(int xtal)
 +{
 +      s3c2412_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
 +}
 +#endif
 +
 +#ifdef CONFIG_CPU_S3C2416
 +void __init s3c2416_init_clocks(int xtal)
 +{
 +      s3c2443_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
 +}
 +#endif
 +
 +#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2440)
 +void __init s3c2440_init_clocks(int xtal)
 +{
 +      s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
 +}
 +#endif
 +
 +#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2442)
 +void __init s3c2442_init_clocks(int xtal)
 +{
 +      s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
 +}
 +#endif
 +
 +#ifdef CONFIG_CPU_S3C2443
 +void __init s3c2443_init_clocks(int xtal)
 +{
 +      s3c2443_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
 +}
 +#endif
 +
 +#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2440) || \
 +      defined(CONFIG_CPU_S3C2442)
 +static struct resource s3c2410_dclk_resource[] = {
 +      [0] = DEFINE_RES_MEM(0x56000084, 0x4),
 +};
 +
 +static struct s3c2410_clk_platform_data s3c_clk_platform_data = {
 +      .modify_misccr = s3c2410_modify_misccr,
 +};
 +
 +struct platform_device s3c2410_device_dclk = {
 +      .name           = "s3c2410-dclk",
 +      .id             = 0,
 +      .num_resources  = ARRAY_SIZE(s3c2410_dclk_resource),
 +      .resource       = s3c2410_dclk_resource,
 +      .dev            = {
 +              .platform_data = &s3c_clk_platform_data,
 +      },
 +};
 +#endif
index b5fc615,0000000..4dfb648
mode 100644,000000..100644
--- /dev/null
@@@ -1,422 -1,0 +1,427 @@@
- /* see notes on uart map in arch/arm/mach-s3c64xx/include/mach/debug-macro.S */
 +// SPDX-License-Identifier: GPL-2.0
 +//
 +// Copyright (c) 2011 Samsung Electronics Co., Ltd.
 +//            http://www.samsung.com
 +//
 +// Copyright 2008 Openmoko, Inc.
 +// Copyright 2008 Simtec Electronics
 +//    Ben Dooks <ben@simtec.co.uk>
 +//    http://armlinux.simtec.co.uk/
 +//
 +// Common Codes for S3C64XX machines
 +
 +/*
 + * NOTE: Code in this file is not used when booting with Device Tree support.
 + */
 +
 +#include <linux/kernel.h>
 +#include <linux/init.h>
 +#include <linux/module.h>
 +#include <linux/interrupt.h>
 +#include <linux/ioport.h>
 +#include <linux/serial_core.h>
 +#include <linux/serial_s3c.h>
 +#include <linux/platform_device.h>
 +#include <linux/reboot.h>
 +#include <linux/io.h>
 +#include <linux/clk/samsung.h>
 +#include <linux/dma-mapping.h>
 +#include <linux/irq.h>
 +#include <linux/gpio.h>
 +#include <linux/irqchip/arm-vic.h>
 +#include <clocksource/samsung_pwm.h>
 +
 +#include <asm/mach/arch.h>
 +#include <asm/mach/map.h>
 +#include <asm/system_misc.h>
 +
 +#include "map.h"
 +#include <mach/irqs.h>
 +#include "regs-gpio.h"
 +#include "gpio-samsung.h"
 +
 +#include "cpu.h"
 +#include "devs.h"
 +#include "pm.h"
 +#include "gpio-cfg.h"
 +#include "pwm-core.h"
 +#include "regs-irqtype.h"
 +#include "s3c64xx.h"
 +#include "irq-uart-s3c64xx.h"
 +
 +/* External clock frequency */
 +static unsigned long xtal_f __ro_after_init = 12000000;
 +static unsigned long xusbxti_f __ro_after_init = 48000000;
 +
 +void __init s3c64xx_set_xtal_freq(unsigned long freq)
 +{
 +      xtal_f = freq;
 +}
 +
 +void __init s3c64xx_set_xusbxti_freq(unsigned long freq)
 +{
 +      xusbxti_f = freq;
 +}
 +
 +/* uart registration process */
 +
 +static void __init s3c64xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
 +{
 +      s3c24xx_init_uartdevs("s3c6400-uart", s3c64xx_uart_resources, cfg, no);
 +}
 +
 +/* table of supported CPUs */
 +
 +static const char name_s3c6400[] = "S3C6400";
 +static const char name_s3c6410[] = "S3C6410";
 +
 +static struct cpu_table cpu_ids[] __initdata = {
 +      {
 +              .idcode         = S3C6400_CPU_ID,
 +              .idmask         = S3C64XX_CPU_MASK,
 +              .map_io         = s3c6400_map_io,
 +              .init_uarts     = s3c64xx_init_uarts,
 +              .init           = s3c6400_init,
 +              .name           = name_s3c6400,
 +      }, {
 +              .idcode         = S3C6410_CPU_ID,
 +              .idmask         = S3C64XX_CPU_MASK,
 +              .map_io         = s3c6410_map_io,
 +              .init_uarts     = s3c64xx_init_uarts,
 +              .init           = s3c6410_init,
 +              .name           = name_s3c6410,
 +      },
 +};
 +
 +/* minimal IO mapping */
 +
++/*
++ * note, for the boot process to work we have to keep the UART
++ * virtual address aligned to an 1MiB boundary for the L1
++ * mapping the head code makes. We keep the UART virtual address
++ * aligned and add in the offset when we load the value here.
++ */
 +#define UART_OFFS (S3C_PA_UART & 0xfffff)
 +
 +static struct map_desc s3c_iodesc[] __initdata = {
 +      {
 +              .virtual        = (unsigned long)S3C_VA_SYS,
 +              .pfn            = __phys_to_pfn(S3C64XX_PA_SYSCON),
 +              .length         = SZ_4K,
 +              .type           = MT_DEVICE,
 +      }, {
 +              .virtual        = (unsigned long)S3C_VA_MEM,
 +              .pfn            = __phys_to_pfn(S3C64XX_PA_SROM),
 +              .length         = SZ_4K,
 +              .type           = MT_DEVICE,
 +      }, {
 +              .virtual        = (unsigned long)(S3C_VA_UART + UART_OFFS),
 +              .pfn            = __phys_to_pfn(S3C_PA_UART),
 +              .length         = SZ_4K,
 +              .type           = MT_DEVICE,
 +      }, {
 +              .virtual        = (unsigned long)VA_VIC0,
 +              .pfn            = __phys_to_pfn(S3C64XX_PA_VIC0),
 +              .length         = SZ_16K,
 +              .type           = MT_DEVICE,
 +      }, {
 +              .virtual        = (unsigned long)VA_VIC1,
 +              .pfn            = __phys_to_pfn(S3C64XX_PA_VIC1),
 +              .length         = SZ_16K,
 +              .type           = MT_DEVICE,
 +      }, {
 +              .virtual        = (unsigned long)S3C_VA_TIMER,
 +              .pfn            = __phys_to_pfn(S3C_PA_TIMER),
 +              .length         = SZ_16K,
 +              .type           = MT_DEVICE,
 +      }, {
 +              .virtual        = (unsigned long)S3C64XX_VA_GPIO,
 +              .pfn            = __phys_to_pfn(S3C64XX_PA_GPIO),
 +              .length         = SZ_4K,
 +              .type           = MT_DEVICE,
 +      }, {
 +              .virtual        = (unsigned long)S3C64XX_VA_MODEM,
 +              .pfn            = __phys_to_pfn(S3C64XX_PA_MODEM),
 +              .length         = SZ_4K,
 +              .type           = MT_DEVICE,
 +      }, {
 +              .virtual        = (unsigned long)S3C_VA_WATCHDOG,
 +              .pfn            = __phys_to_pfn(S3C64XX_PA_WATCHDOG),
 +              .length         = SZ_4K,
 +              .type           = MT_DEVICE,
 +      }, {
 +              .virtual        = (unsigned long)S3C_VA_USB_HSPHY,
 +              .pfn            = __phys_to_pfn(S3C64XX_PA_USB_HSPHY),
 +              .length         = SZ_1K,
 +              .type           = MT_DEVICE,
 +      },
 +};
 +
 +static struct bus_type s3c64xx_subsys = {
 +      .name           = "s3c64xx-core",
 +      .dev_name       = "s3c64xx-core",
 +};
 +
 +static struct device s3c64xx_dev = {
 +      .bus    = &s3c64xx_subsys,
 +};
 +
 +static struct samsung_pwm_variant s3c64xx_pwm_variant = {
 +      .bits           = 32,
 +      .div_base       = 0,
 +      .has_tint_cstat = true,
 +      .tclk_mask      = (1 << 7) | (1 << 6) | (1 << 5),
 +};
 +
 +void __init s3c64xx_set_timer_source(unsigned int event, unsigned int source)
 +{
 +      s3c64xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
 +      s3c64xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
 +}
 +
 +void __init s3c64xx_timer_init(void)
 +{
 +      unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
 +              IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
 +              IRQ_TIMER3_VIC, IRQ_TIMER4_VIC,
 +      };
 +
 +      samsung_pwm_clocksource_init(S3C_VA_TIMER,
 +                                      timer_irqs, &s3c64xx_pwm_variant);
 +}
 +
 +/* read cpu identification code */
 +
 +void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
 +{
 +      /* initialise the io descriptors we need for initialisation */
 +      iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
 +      iotable_init(mach_desc, size);
 +
 +      /* detect cpu id */
 +      s3c64xx_init_cpu();
 +
 +      s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
 +
 +      samsung_pwm_set_platdata(&s3c64xx_pwm_variant);
 +}
 +
 +static __init int s3c64xx_dev_init(void)
 +{
 +      /* Not applicable when using DT. */
 +      if (of_have_populated_dt() || !soc_is_s3c64xx())
 +              return 0;
 +
 +      subsys_system_register(&s3c64xx_subsys, NULL);
 +      return device_register(&s3c64xx_dev);
 +}
 +core_initcall(s3c64xx_dev_init);
 +
 +/*
 + * setup the sources the vic should advertise resume
 + * for, even though it is not doing the wake
 + * (set_irq_wake needs to be valid)
 + */
 +#define IRQ_VIC0_RESUME (1 << (IRQ_RTC_TIC - IRQ_VIC0_BASE))
 +#define IRQ_VIC1_RESUME (1 << (IRQ_RTC_ALARM - IRQ_VIC1_BASE) |       \
 +                       1 << (IRQ_PENDN - IRQ_VIC1_BASE) |     \
 +                       1 << (IRQ_HSMMC0 - IRQ_VIC1_BASE) |    \
 +                       1 << (IRQ_HSMMC1 - IRQ_VIC1_BASE) |    \
 +                       1 << (IRQ_HSMMC2 - IRQ_VIC1_BASE))
 +
 +void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
 +{
 +      s3c64xx_clk_init(NULL, xtal_f, xusbxti_f, soc_is_s3c6400(), S3C_VA_SYS);
 +
 +      printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
 +
 +      /* initialise the pair of VICs */
 +      vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME);
 +      vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME);
 +}
 +
 +#define eint_offset(irq)      ((irq) - IRQ_EINT(0))
 +#define eint_irq_to_bit(irq)  ((u32)(1 << eint_offset(irq)))
 +
 +static inline void s3c_irq_eint_mask(struct irq_data *data)
 +{
 +      u32 mask;
 +
 +      mask = __raw_readl(S3C64XX_EINT0MASK);
 +      mask |= (u32)data->chip_data;
 +      __raw_writel(mask, S3C64XX_EINT0MASK);
 +}
 +
 +static void s3c_irq_eint_unmask(struct irq_data *data)
 +{
 +      u32 mask;
 +
 +      mask = __raw_readl(S3C64XX_EINT0MASK);
 +      mask &= ~((u32)data->chip_data);
 +      __raw_writel(mask, S3C64XX_EINT0MASK);
 +}
 +
 +static inline void s3c_irq_eint_ack(struct irq_data *data)
 +{
 +      __raw_writel((u32)data->chip_data, S3C64XX_EINT0PEND);
 +}
 +
 +static void s3c_irq_eint_maskack(struct irq_data *data)
 +{
 +      /* compiler should in-line these */
 +      s3c_irq_eint_mask(data);
 +      s3c_irq_eint_ack(data);
 +}
 +
 +static int s3c_irq_eint_set_type(struct irq_data *data, unsigned int type)
 +{
 +      int offs = eint_offset(data->irq);
 +      int pin, pin_val;
 +      int shift;
 +      u32 ctrl, mask;
 +      u32 newvalue = 0;
 +      void __iomem *reg;
 +
 +      if (offs > 27)
 +              return -EINVAL;
 +
 +      if (offs <= 15)
 +              reg = S3C64XX_EINT0CON0;
 +      else
 +              reg = S3C64XX_EINT0CON1;
 +
 +      switch (type) {
 +      case IRQ_TYPE_NONE:
 +              printk(KERN_WARNING "No edge setting!\n");
 +              break;
 +
 +      case IRQ_TYPE_EDGE_RISING:
 +              newvalue = S3C2410_EXTINT_RISEEDGE;
 +              break;
 +
 +      case IRQ_TYPE_EDGE_FALLING:
 +              newvalue = S3C2410_EXTINT_FALLEDGE;
 +              break;
 +
 +      case IRQ_TYPE_EDGE_BOTH:
 +              newvalue = S3C2410_EXTINT_BOTHEDGE;
 +              break;
 +
 +      case IRQ_TYPE_LEVEL_LOW:
 +              newvalue = S3C2410_EXTINT_LOWLEV;
 +              break;
 +
 +      case IRQ_TYPE_LEVEL_HIGH:
 +              newvalue = S3C2410_EXTINT_HILEV;
 +              break;
 +
 +      default:
 +              printk(KERN_ERR "No such irq type %d", type);
 +              return -1;
 +      }
 +
 +      if (offs <= 15)
 +              shift = (offs / 2) * 4;
 +      else
 +              shift = ((offs - 16) / 2) * 4;
 +      mask = 0x7 << shift;
 +
 +      ctrl = __raw_readl(reg);
 +      ctrl &= ~mask;
 +      ctrl |= newvalue << shift;
 +      __raw_writel(ctrl, reg);
 +
 +      /* set the GPIO pin appropriately */
 +
 +      if (offs < 16) {
 +              pin = S3C64XX_GPN(offs);
 +              pin_val = S3C_GPIO_SFN(2);
 +      } else if (offs < 23) {
 +              pin = S3C64XX_GPL(offs + 8 - 16);
 +              pin_val = S3C_GPIO_SFN(3);
 +      } else {
 +              pin = S3C64XX_GPM(offs - 23);
 +              pin_val = S3C_GPIO_SFN(3);
 +      }
 +
 +      s3c_gpio_cfgpin(pin, pin_val);
 +
 +      return 0;
 +}
 +
 +static struct irq_chip s3c_irq_eint = {
 +      .name           = "s3c-eint",
 +      .irq_mask       = s3c_irq_eint_mask,
 +      .irq_unmask     = s3c_irq_eint_unmask,
 +      .irq_mask_ack   = s3c_irq_eint_maskack,
 +      .irq_ack        = s3c_irq_eint_ack,
 +      .irq_set_type   = s3c_irq_eint_set_type,
 +      .irq_set_wake   = s3c_irqext_wake,
 +};
 +
 +/* s3c_irq_demux_eint
 + *
 + * This function demuxes the IRQ from the group0 external interrupts,
 + * from IRQ_EINT(0) to IRQ_EINT(27). It is designed to be inlined into
 + * the specific handlers s3c_irq_demux_eintX_Y.
 + */
 +static inline void s3c_irq_demux_eint(unsigned int start, unsigned int end)
 +{
 +      u32 status = __raw_readl(S3C64XX_EINT0PEND);
 +      u32 mask = __raw_readl(S3C64XX_EINT0MASK);
 +      unsigned int irq;
 +
 +      status &= ~mask;
 +      status >>= start;
 +      status &= (1 << (end - start + 1)) - 1;
 +
 +      for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) {
 +              if (status & 1)
 +                      generic_handle_irq(irq);
 +
 +              status >>= 1;
 +      }
 +}
 +
 +static void s3c_irq_demux_eint0_3(struct irq_desc *desc)
 +{
 +      s3c_irq_demux_eint(0, 3);
 +}
 +
 +static void s3c_irq_demux_eint4_11(struct irq_desc *desc)
 +{
 +      s3c_irq_demux_eint(4, 11);
 +}
 +
 +static void s3c_irq_demux_eint12_19(struct irq_desc *desc)
 +{
 +      s3c_irq_demux_eint(12, 19);
 +}
 +
 +static void s3c_irq_demux_eint20_27(struct irq_desc *desc)
 +{
 +      s3c_irq_demux_eint(20, 27);
 +}
 +
 +static int __init s3c64xx_init_irq_eint(void)
 +{
 +      int irq;
 +
 +      /* On DT-enabled systems EINTs are handled by pinctrl-s3c64xx driver. */
 +      if (of_have_populated_dt() || !soc_is_s3c64xx())
 +              return -ENODEV;
 +
 +      for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
 +              irq_set_chip_and_handler(irq, &s3c_irq_eint, handle_level_irq);
 +              irq_set_chip_data(irq, (void *)eint_irq_to_bit(irq));
 +              irq_clear_status_flags(irq, IRQ_NOREQUEST);
 +      }
 +
 +      irq_set_chained_handler(IRQ_EINT0_3, s3c_irq_demux_eint0_3);
 +      irq_set_chained_handler(IRQ_EINT4_11, s3c_irq_demux_eint4_11);
 +      irq_set_chained_handler(IRQ_EINT12_19, s3c_irq_demux_eint12_19);
 +      irq_set_chained_handler(IRQ_EINT20_27, s3c_irq_demux_eint20_27);
 +
 +      return 0;
 +}
 +arch_initcall(s3c64xx_init_irq_eint);
@@@ -35,53 -35,7 +35,54 @@@ config EXYNOS_PMU_ARM_DRIVER
  
  config EXYNOS_PM_DOMAINS
        bool "Exynos PM domains" if COMPILE_TEST
 -      depends on PM_GENERIC_DOMAINS || COMPILE_TEST
 +      depends on (ARCH_EXYNOS && PM_GENERIC_DOMAINS) || COMPILE_TEST
 +
 +config SAMSUNG_PM_DEBUG
 +      bool "Samsung PM Suspend debug"
 +      depends on PM && DEBUG_KERNEL
 +      depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
 +      depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART
++      depends on DEBUG_LL && MMU
 +      help
 +        Say Y here if you want verbose debugging from the PM Suspend and
 +        Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
 +        for more information.
 +
 +config S3C_PM_DEBUG_LED_SMDK
 +       bool "SMDK LED suspend/resume debugging"
 +       depends on PM && (MACH_SMDK6410)
 +       help
 +         Say Y here to enable the use of the SMDK LEDs on the baseboard
 +       for debugging of the state of the suspend and resume process.
 +
 +       Note, this currently only works for S3C64XX based SMDK boards.
 +
 +config SAMSUNG_PM_CHECK
 +      bool "S3C2410 PM Suspend Memory CRC"
 +      depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210)
 +      select CRC32
 +      help
 +        Enable the PM code's memory area checksum over sleep. This option
 +        will generate CRCs of all blocks of memory, and store them before
 +        going to sleep. The blocks are then checked on resume for any
 +        errors.
 +
 +        Note, this can take several seconds depending on memory size
 +        and CPU speed.
 +
 +        See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
 +
 +config SAMSUNG_PM_CHECK_CHUNKSIZE
 +      int "S3C2410 PM Suspend CRC Chunksize (KiB)"
 +      depends on PM && SAMSUNG_PM_CHECK
 +      default 64
 +      help
 +        Set the chunksize in Kilobytes of the CRC for checking memory
 +        corruption over suspend and resume. A smaller value will mean that
 +        the CRC data block will take more memory, but will identify any
 +        faults with better precision.
 +
 +        See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
  
  config EXYNOS_REGULATOR_COUPLER
        bool "Exynos SoC Regulator Coupler" if COMPILE_TEST