From 66ad4eea7ec50fe131755c80058b1157d160294d Mon Sep 17 00:00:00 2001 From: Atul Dahiya Date: Mon, 18 Oct 2010 19:53:34 +0900 Subject: ARM: S3C24XX: Fix nand partition table for s3c24XX This patch fixes the partition table as existing partition table have last partition size fixed and can't utilize available memory proprly if size is more than 64M. Signed-off-by: Atul Dahiya Signed-off-by: Sangbeom Kim Signed-off-by: Kukjin Kim --- arch/arm/plat-s3c24xx/common-smdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/plat-s3c24xx/common-smdk.c b/arch/arm/plat-s3c24xx/common-smdk.c index 7b44d0c592b5..bcc43f346272 100644 --- a/arch/arm/plat-s3c24xx/common-smdk.c +++ b/arch/arm/plat-s3c24xx/common-smdk.c @@ -147,7 +147,7 @@ static struct mtd_partition smdk_default_nand_part[] = { [7] = { .name = "S3C2410 flash partition 7", .offset = SZ_1M * 48, - .size = SZ_16M, + .size = MTDPART_SIZ_FULL, } }; -- cgit v1.2.1 From ef3f2dd4810cca5bf5b1d3648968b50fb267d5e2 Mon Sep 17 00:00:00 2001 From: Atul Dahiya Date: Mon, 18 Oct 2010 19:56:45 +0900 Subject: ARM: SAMSUNG: Add setname core function for S3C24XX NAND This patch replaces the device name assignment method from string assignment to set_name method for all s3c24xx machines and adds device core file. Signed-off-by: Atul Dahiya Signed-off-by: Sangbeom Kim Signed-off-by: Kukjin Kim --- arch/arm/mach-s3c2412/s3c2412.c | 3 ++- arch/arm/mach-s3c2416/s3c2416.c | 3 ++- arch/arm/mach-s3c2440/s3c244x.c | 3 ++- arch/arm/mach-s3c2443/s3c2443.c | 3 ++- arch/arm/plat-samsung/include/plat/nand-core.h | 28 ++++++++++++++++++++++++++ 5 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 arch/arm/plat-samsung/include/plat/nand-core.h diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c index bef39f77729d..4c6df51ddf33 100644 --- a/arch/arm/mach-s3c2412/s3c2412.c +++ b/arch/arm/mach-s3c2412/s3c2412.c @@ -51,6 +51,7 @@ #include #include #include +#include #ifndef CONFIG_CPU_S3C2412_ONLY void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO; @@ -92,7 +93,7 @@ void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no) /* rename devices that are s3c2412/s3c2413 specific */ s3c_device_sdi.name = "s3c2412-sdi"; s3c_device_lcd.name = "s3c2412-lcd"; - s3c_device_nand.name = "s3c2412-nand"; + s3c_nand_setname("s3c2412-nand"); /* alter IRQ of SDI controller */ diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c index bc30245e133b..620718939628 100644 --- a/arch/arm/mach-s3c2416/s3c2416.c +++ b/arch/arm/mach-s3c2416/s3c2416.c @@ -56,6 +56,7 @@ #include #include +#include static struct map_desc s3c2416_iodesc[] __initdata = { IODESC_ENT(WATCHDOG), @@ -100,7 +101,7 @@ void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no) { s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no); - s3c_device_nand.name = "s3c2416-nand"; + s3c_nand_setname("s3c2416-nand"); } /* s3c2416_map_io diff --git a/arch/arm/mach-s3c2440/s3c244x.c b/arch/arm/mach-s3c2440/s3c244x.c index 5e4a97e76533..90c1707b9c95 100644 --- a/arch/arm/mach-s3c2440/s3c244x.c +++ b/arch/arm/mach-s3c2440/s3c244x.c @@ -44,6 +44,7 @@ #include #include #include +#include static struct map_desc s3c244x_iodesc[] __initdata = { IODESC_ENT(CLKPWR), @@ -68,7 +69,7 @@ void __init s3c244x_map_io(void) s3c_device_sdi.name = "s3c2440-sdi"; s3c_device_i2c0.name = "s3c2440-i2c"; - s3c_device_nand.name = "s3c2440-nand"; + s3c_nand_setname("s3c2440-nand"); s3c_device_ts.name = "s3c2440-ts"; s3c_device_usbgadget.name = "s3c2440-usbgadget"; } diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c index 839b6b2ced74..33d18dd1ebd5 100644 --- a/arch/arm/mach-s3c2443/s3c2443.c +++ b/arch/arm/mach-s3c2443/s3c2443.c @@ -36,6 +36,7 @@ #include #include #include +#include static struct map_desc s3c2443_iodesc[] __initdata = { IODESC_ENT(WATCHDOG), @@ -62,7 +63,7 @@ int __init s3c2443_init(void) s3c24xx_reset_hook = s3c2443_hard_reset; - s3c_device_nand.name = "s3c2412-nand"; + s3c_nand_setname("s3c2412-nand"); s3c_fb_setname("s3c2443-fb"); /* change WDT IRQ number */ diff --git a/arch/arm/plat-samsung/include/plat/nand-core.h b/arch/arm/plat-samsung/include/plat/nand-core.h new file mode 100644 index 000000000000..6de20789a95e --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/nand-core.h @@ -0,0 +1,28 @@ +/* arch/arm/plat-samsung/include/plat/nand-core.h + * + * Copyright (c) 2010 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * S3C - Nand Controller core functions + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#ifndef __ASM_ARCH_NAND_CORE_H +#define __ASM_ARCH_NAND_CORE_H __FILE__ + +/* These functions are only for use with the core support code, such as + * the cpu specific initialisation code + */ + +/* re-define device name depending on support. */ +static inline void s3c_nand_setname(char *name) +{ +#ifdef CONFIG_S3C_DEV_NAND + s3c_device_nand.name = name; +#endif +} + +#endif /* __ASM_ARCH_NAND_CORE_H */ -- cgit v1.2.1 From 4bc778661a86722b2c1128dd03851fa013ef26de Mon Sep 17 00:00:00 2001 From: Atul Dahiya Date: Mon, 18 Oct 2010 19:56:49 +0900 Subject: ARM: S3C2416: Change S3C2416 NAND platform device name This patch changes the platform device name from 's3c2416-nand' to 's3c2412-nand' so that S3C2416 can reuse the nand functionality available on S3C2412. Signed-off-by: Atul Dahiya Signed-off-by: Sangbeom Kim Signed-off-by: Kukjin Kim --- arch/arm/mach-s3c2416/s3c2416.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c index 620718939628..63f39cdc0972 100644 --- a/arch/arm/mach-s3c2416/s3c2416.c +++ b/arch/arm/mach-s3c2416/s3c2416.c @@ -101,7 +101,7 @@ void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no) { s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no); - s3c_nand_setname("s3c2416-nand"); + s3c_nand_setname("s3c2412-nand"); } /* s3c2416_map_io -- cgit v1.2.1 From e0e451ea092915fa683e5fe7a9e52df33726a5ac Mon Sep 17 00:00:00 2001 From: Yauhen Kharuzhy Date: Wed, 20 Oct 2010 19:40:46 +0900 Subject: ARM: S3C24XX: Fix gpiolib support for ports K..M S3C2443 and S3C2416 has 12 GPIO banks (from A to M), increase ARCH_NR_GPIOS for this architectures. Also typo from previous commit has been fixed: CONFIG_CPU_S3C24XX instead CONFIG_CPU_244X. Signed-off-by: Yauhen Kharuzhy Tested-by: Vasily Khoruzhick Signed-off-by: Kukjin Kim --- arch/arm/mach-s3c2410/include/mach/gpio.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h b/arch/arm/mach-s3c2410/include/mach/gpio.h index b649bf2ccd5c..f7f6b07df30e 100644 --- a/arch/arm/mach-s3c2410/include/mach/gpio.h +++ b/arch/arm/mach-s3c2410/include/mach/gpio.h @@ -22,6 +22,8 @@ #ifdef CONFIG_CPU_S3C244X #define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA) +#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416) +#define ARCH_NR_GPIOS (32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA) #else #define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) #endif @@ -30,8 +32,10 @@ #include #include -#ifdef CONFIG_CPU_S3C24XX -#define S3C_GPIO_END (S3C2410_GPIO_BANKJ + 32) +#ifdef CONFIG_CPU_S3C244X +#define S3C_GPIO_END (S3C2410_GPJ(0) + 32) +#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416) +#define S3C_GPIO_END (S3C2410_GPM(0) + 32) #else -#define S3C_GPIO_END (S3C2410_GPIO_BANKH + 32) +#define S3C_GPIO_END (S3C2410_GPH(0) + 32) #endif -- cgit v1.2.1 From 6436b6a7a64f946c5a5f3d8a8c0e6404e2bda8d5 Mon Sep 17 00:00:00 2001 From: Abhilash Kesavan Date: Wed, 20 Oct 2010 19:43:35 +0900 Subject: ARM: S3C2416: Add Power Management support for SMDK2416 Adds suspend-to-ram support for SMDK2416 based on existing 2412 PM code Signed-off-by: Abhilash Kesavan Signed-off-by: Sangbeom Kim Signed-off-by: Kukjin Kim --- .../mach-s3c2410/include/mach/regs-s3c2443-clock.h | 2 + arch/arm/mach-s3c2416/Kconfig | 6 ++ arch/arm/mach-s3c2416/Makefile | 2 +- arch/arm/mach-s3c2416/irq.c | 2 + arch/arm/mach-s3c2416/pm.c | 84 ++++++++++++++++++++++ 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-s3c2416/pm.c diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h index 08ab9dfb6ae6..101aeea22310 100644 --- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h +++ b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h @@ -118,6 +118,8 @@ #define S3C2443_SCLKCON_UARTCLK (1<<8) #define S3C2443_SCLKCON_USBHOST (1<<1) +#define S3C2443_PWRCFG_SLEEP (1<<15) + #include static inline unsigned int diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig index 657e4fe17f39..87b9c9f003bd 100644 --- a/arch/arm/mach-s3c2416/Kconfig +++ b/arch/arm/mach-s3c2416/Kconfig @@ -25,6 +25,11 @@ config S3C2416_DMA help Internal config node for S3C2416 DMA support +config S3C2416_PM + bool + help + Internal config node to apply S3C2416 power management + menu "S3C2416 Machines" config MACH_SMDK2416 @@ -33,6 +38,7 @@ config MACH_SMDK2416 select S3C_DEV_FB select S3C_DEV_HSMMC select S3C_DEV_HSMMC1 + select S3C2416_PM if PM help Say Y here if you are using an SMDK2416 diff --git a/arch/arm/mach-s3c2416/Makefile b/arch/arm/mach-s3c2416/Makefile index 6c12c7bf40ad..ef038d62ffdb 100644 --- a/arch/arm/mach-s3c2416/Makefile +++ b/arch/arm/mach-s3c2416/Makefile @@ -11,7 +11,7 @@ obj- := obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock.o obj-$(CONFIG_CPU_S3C2416) += irq.o - +obj-$(CONFIG_S3C2416_PM) += pm.o #obj-$(CONFIG_S3C2416_DMA) += dma.o # Machine support diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c2416/irq.c index 89f521d59d06..084d121f368c 100644 --- a/arch/arm/mach-s3c2416/irq.c +++ b/arch/arm/mach-s3c2416/irq.c @@ -243,6 +243,8 @@ static int __init s3c2416_irq_add(struct sys_device *sysdev) static struct sysdev_driver s3c2416_irq_driver = { .add = s3c2416_irq_add, + .suspend = s3c24xx_irq_suspend, + .resume = s3c24xx_irq_resume, }; static int __init s3c2416_irq_init(void) diff --git a/arch/arm/mach-s3c2416/pm.c b/arch/arm/mach-s3c2416/pm.c new file mode 100644 index 000000000000..4a04205b04d5 --- /dev/null +++ b/arch/arm/mach-s3c2416/pm.c @@ -0,0 +1,84 @@ +/* linux/arch/arm/mach-s3c2416/pm.c + * + * Copyright (c) 2010 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM support) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include +#include + +#include + +#include +#include + +#include +#include + +extern void s3c2412_sleep_enter(void); + +static void s3c2416_cpu_suspend(void) +{ + flush_cache_all(); + + /* enable wakeup sources regardless of battery state */ + __raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG); + + /* set the mode as sleep, 2BED represents "Go to BED" */ + __raw_writel(0x2BED, S3C2443_PWRMODE); + + s3c2412_sleep_enter(); +} + +static void s3c2416_pm_prepare(void) +{ + /* + * write the magic value u-boot uses to check for resume into + * the INFORM0 register, and ensure INFORM1 is set to the + * correct address to resume from. + */ + __raw_writel(0x2BED, S3C2412_INFORM0); + __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); +} + +static int s3c2416_pm_add(struct sys_device *sysdev) +{ + pm_cpu_prep = s3c2416_pm_prepare; + pm_cpu_sleep = s3c2416_cpu_suspend; + + return 0; +} + +static int s3c2416_pm_suspend(struct sys_device *dev, pm_message_t state) +{ + return 0; +} + +static int s3c2416_pm_resume(struct sys_device *dev) +{ + /* unset the return-from-sleep amd inform flags */ + __raw_writel(0x0, S3C2443_PWRMODE); + __raw_writel(0x0, S3C2412_INFORM0); + __raw_writel(0x0, S3C2412_INFORM1); + + return 0; +} + +static struct sysdev_driver s3c2416_pm_driver = { + .add = s3c2416_pm_add, + .suspend = s3c2416_pm_suspend, + .resume = s3c2416_pm_resume, +}; + +static __init int s3c2416_pm_init(void) +{ + return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_pm_driver); +} + +arch_initcall(s3c2416_pm_init); -- cgit v1.2.1