From c63fc13f806b11576e8c41969d4b1598dd261d80 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Wed, 16 Apr 2008 00:04:19 +0100 Subject: [ARM] 4983/1: S3C2412: Add initial memory controller registers Add initial defines for the S3C2412's memory controller registers. Signed-off-by: Ben Dooks Signed-off-by: Russell King --- include/asm-arm/arch-s3c2410/regs-s3c2412-mem.h | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 include/asm-arm/arch-s3c2410/regs-s3c2412-mem.h (limited to 'include/asm-arm/arch-s3c2410') diff --git a/include/asm-arm/arch-s3c2410/regs-s3c2412-mem.h b/include/asm-arm/arch-s3c2410/regs-s3c2412-mem.h new file mode 100644 index 000000000000..c8c793e78936 --- /dev/null +++ b/include/asm-arm/arch-s3c2410/regs-s3c2412-mem.h @@ -0,0 +1,29 @@ +/* linux/include/asm-arm/arch-s3c2410/regs-s3c2412-mem.h + * + * Copyright (c) 2008 Simtec Electronics + * Ben Dooks + * http://armlinux.simtec.co.uk/ + * + * 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. + * + * S3C2412 memory register definitions +*/ + +#ifndef __ASM_ARM_REGS_S3C2412_MEM +#define __ASM_ARM_REGS_S3C2412_MEM + +#ifndef S3C2412_MEMREG +#define S3C2412_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x)) +#endif + +#define S3C2412_BANKCFG S3C2412_MEMREG(0x00) +#define S3C2412_BANKCON1 S3C2412_MEMREG(0x04) +#define S3C2412_BANKCON2 S3C2412_MEMREG(0x08) +#define S3C2412_BANKCON3 S3C2412_MEMREG(0x0C) + +#define S3C2412_REFRESH S3C2412_MEMREG(0x10) +#define S3C2412_TIMEOUT S3C2412_MEMREG(0x14) + +#endif /* __ASM_ARM_REGS_S3C2412_MEM */ -- cgit v1.2.3-59-g8ed1b From 1017be88d341c05adc8d790d8092781b7330dafd Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Wed, 16 Apr 2008 00:08:36 +0100 Subject: [ARM] 4985/1: S3C2412: Fix ARMDIVN name in CLKDIVN definition. Fix the name of the S3C2412_CLKDIVN_ARMDIVN define. Signed-off-by: Ben Dooks Signed-off-by: Russell King --- arch/arm/mach-s3c2412/s3c2412.c | 2 +- include/asm-arm/arch-s3c2410/regs-clock.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include/asm-arm/arch-s3c2410') diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c index abf1599c9f97..98a0de924c22 100644 --- a/arch/arm/mach-s3c2412/s3c2412.c +++ b/arch/arm/mach-s3c2412/s3c2412.c @@ -175,7 +175,7 @@ void __init s3c2412_init_clocks(int xtal) /* work out clock scalings */ hclk = fclk / ((tmp & S3C2412_CLKDIVN_HDIVN_MASK) + 1); - hclk /= ((tmp & S3C2421_CLKDIVN_ARMDIVN) ? 2 : 1); + hclk /= ((tmp & S3C2412_CLKDIVN_ARMDIVN) ? 2 : 1); pclk = hclk / ((tmp & S3C2412_CLKDIVN_PDIVN) ? 2 : 1); /* print brieft summary of clocks, etc */ diff --git a/include/asm-arm/arch-s3c2410/regs-clock.h b/include/asm-arm/arch-s3c2410/regs-clock.h index dba9df9d8713..ecae9e7f5e45 100644 --- a/include/asm-arm/arch-s3c2410/regs-clock.h +++ b/include/asm-arm/arch-s3c2410/regs-clock.h @@ -137,7 +137,7 @@ s3c2410_get_pll(unsigned int pllval, unsigned int baseclk) #define S3C2412_CLKDIVN_PDIVN (1<<2) #define S3C2412_CLKDIVN_HDIVN_MASK (3<<0) -#define S3C2421_CLKDIVN_ARMDIVN (1<<3) +#define S3C2412_CLKDIVN_ARMDIVN (1<<3) #define S3C2412_CLKDIVN_DVSEN (1<<4) #define S3C2412_CLKDIVN_HALFHCLK (1<<5) #define S3C2412_CLKDIVN_USB48DIV (1<<6) -- cgit v1.2.3-59-g8ed1b From 3c7d9c81e1302c244180e62999a08ca95b175cf5 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Wed, 16 Apr 2008 00:15:20 +0100 Subject: [ARM] 4987/1: S3C24XX: Ensure watchdog reset initiated from cached code. There seems to be some problem with at-least the S3C2440 and bus traffic during an reset. It is unlikely, but still possible that the system will hang in such a way that the watchdog cannot get the system out of the state it is in. Change to making the code that calls the watchdog reset run from cached memory so that instruction fetches have quiesced before the watchdog fires. Signed-off-by: Ben Dooks Signed-off-by: Russell King --- arch/arm/plat-s3c24xx/cpu.c | 27 ++++++++++++ include/asm-arm/arch-s3c2410/system-reset.h | 64 +++++++++++++++++++++++++++++ include/asm-arm/arch-s3c2410/system.h | 46 +-------------------- 3 files changed, 92 insertions(+), 45 deletions(-) create mode 100644 include/asm-arm/arch-s3c2410/system-reset.h (limited to 'include/asm-arm/arch-s3c2410') diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c index f513ab083b8f..f5699cadb0c3 100644 --- a/arch/arm/plat-s3c24xx/cpu.c +++ b/arch/arm/plat-s3c24xx/cpu.c @@ -28,15 +28,19 @@ #include #include #include +#include #include #include #include #include +#include #include #include +#include + #include #include @@ -203,6 +207,27 @@ static unsigned long s3c24xx_read_idcode_v4(void) #endif } +/* Hook for arm_pm_restart to ensure we execute the reset code + * with the caches enabled. It seems at least the S3C2440 has a problem + * resetting if there is bus activity interrupted by the reset. + */ +static void s3c24xx_pm_restart(char mode) +{ + if (mode != 's') { + unsigned long flags; + + local_irq_save(flags); + __cpuc_flush_kern_all(); + __cpuc_flush_user_all(); + + arch_reset(mode); + local_irq_restore(flags); + } + + /* fallback, or unhandled */ + arm_machine_restart(mode); +} + void __init s3c24xx_init_io(struct map_desc *mach_desc, int size) { unsigned long idcode = 0x0; @@ -230,6 +255,8 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size) panic("Unsupported S3C24XX CPU"); } + arm_pm_restart = s3c24xx_pm_restart; + (cpu->map_io)(mach_desc, size); } diff --git a/include/asm-arm/arch-s3c2410/system-reset.h b/include/asm-arm/arch-s3c2410/system-reset.h new file mode 100644 index 000000000000..1615bce0c026 --- /dev/null +++ b/include/asm-arm/arch-s3c2410/system-reset.h @@ -0,0 +1,64 @@ +/* linux/include/asm-arm/arch-s3c2410/system-reset.h + * + * Copyright (c) 2008 Simtec Electronics + * Ben Dooks + * + * S3C2410 - System define for arch_reset() function + * + * 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 + +extern void (*s3c24xx_reset_hook)(void); + +static void +arch_reset(char mode) +{ + struct clk *wdtclk; + + if (mode == 's') { + cpu_reset(0); + } + + if (s3c24xx_reset_hook) + s3c24xx_reset_hook(); + + printk("arch_reset: attempting watchdog reset\n"); + + __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */ + + wdtclk = clk_get(NULL, "watchdog"); + if (!IS_ERR(wdtclk)) { + clk_enable(wdtclk); + } else + printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__); + + /* put initial values into count and data */ + __raw_writel(0x80, S3C2410_WTCNT); + __raw_writel(0x80, S3C2410_WTDAT); + + /* set the watchdog to go and reset... */ + __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN | + S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON); + + /* wait for reset to assert... */ + mdelay(500); + + printk(KERN_ERR "Watchdog reset failed to assert reset\n"); + + /* delay to allow the serial port to show the message */ + mdelay(50); + + /* we'll take a jump through zero as a poor second */ + cpu_reset(0); +} diff --git a/include/asm-arm/arch-s3c2410/system.h b/include/asm-arm/arch-s3c2410/system.h index 14de4e596f87..ad258085e53b 100644 --- a/include/asm-arm/arch-s3c2410/system.h +++ b/include/asm-arm/arch-s3c2410/system.h @@ -17,12 +17,8 @@ #include #include -#include #include -#include -#include - void (*s3c24xx_idle)(void); void (*s3c24xx_reset_hook)(void); @@ -59,44 +55,4 @@ static void arch_idle(void) s3c24xx_default_idle(); } -static void -arch_reset(char mode) -{ - struct clk *wdtclk; - - if (mode == 's') { - cpu_reset(0); - } - - if (s3c24xx_reset_hook) - s3c24xx_reset_hook(); - - printk("arch_reset: attempting watchdog reset\n"); - - __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */ - - wdtclk = clk_get(NULL, "watchdog"); - if (!IS_ERR(wdtclk)) { - clk_enable(wdtclk); - } else - printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__); - - /* put initial values into count and data */ - __raw_writel(0x80, S3C2410_WTCNT); - __raw_writel(0x80, S3C2410_WTDAT); - - /* set the watchdog to go and reset... */ - __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN | - S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON); - - /* wait for reset to assert... */ - mdelay(500); - - printk(KERN_ERR "Watchdog reset failed to assert reset\n"); - - /* delay to allow the serial port to show the message */ - mdelay(50); - - /* we'll take a jump through zero as a poor second */ - cpu_reset(0); -} +#include -- cgit v1.2.3-59-g8ed1b From de56a2f9228477866449963c2aff9df4728ea7fb Mon Sep 17 00:00:00 2001 From: Davide Rizzo Date: Sun, 30 Mar 2008 08:58:33 +0100 Subject: [ARM] 4883/1: Adds some missing gpio defines for S3C2410 This is a small addition of forgotten defines to regs-gpio.h include file for the Samsung S3C2410 ARM9 SoC Signed-off-by: Davide Rizzo Signed-off-by: Ben Dooks Signed-off-by: Russell King --- include/asm-arm/arch-s3c2410/regs-gpio.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/asm-arm/arch-s3c2410') diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h index 0ad75d716ded..497dd06e2c99 100644 --- a/include/asm-arm/arch-s3c2410/regs-gpio.h +++ b/include/asm-arm/arch-s3c2410/regs-gpio.h @@ -529,11 +529,13 @@ #define S3C2410_GPD14_INP (0x00 << 28) #define S3C2410_GPD14_OUTP (0x01 << 28) #define S3C2410_GPD14_VD22 (0x02 << 28) +#define S3C2410_GPD14_nSS1 (0x03 << 28) #define S3C2410_GPD15 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 15) #define S3C2410_GPD15_INP (0x00 << 30) #define S3C2410_GPD15_OUTP (0x01 << 30) #define S3C2410_GPD15_VD23 (0x02 << 30) +#define S3C2410_GPD15_nSS0 (0x03 << 30) #define S3C2410_GPD_PUPDIS(x) (1<<(x)) @@ -801,12 +803,14 @@ #define S3C2410_GPG2_INP (0x00 << 4) #define S3C2410_GPG2_OUTP (0x01 << 4) #define S3C2410_GPG2_EINT10 (0x02 << 4) +#define S3C2410_GPG2_nSS0 (0x03 << 4) #define S3C2400_GPG2_CDCLK (0x02 << 4) #define S3C2410_GPG3 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 3) #define S3C2410_GPG3_INP (0x00 << 6) #define S3C2410_GPG3_OUTP (0x01 << 6) #define S3C2410_GPG3_EINT11 (0x02 << 6) +#define S3C2410_GPG3_nSS1 (0x03 << 6) #define S3C2400_GPG3_I2SSDO (0x02 << 6) #define S3C2400_GPG3_I2SSDI (0x03 << 6) -- cgit v1.2.3-59-g8ed1b