diff options
Diffstat (limited to 'arch/arm')
76 files changed, 1930 insertions, 525 deletions
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index ed820e737a8a..eddcbba87c67 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -110,6 +110,8 @@ CHECKFLAGS += -D__arm__ | |||
110 | head-y := arch/arm/kernel/head$(MMUEXT).o arch/arm/kernel/init_task.o | 110 | head-y := arch/arm/kernel/head$(MMUEXT).o arch/arm/kernel/init_task.o |
111 | textofs-y := 0x00008000 | 111 | textofs-y := 0x00008000 |
112 | textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000 | 112 | textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000 |
113 | # We don't want the htc bootloader to corrupt kernel during resume | ||
114 | textofs-$(CONFIG_PM_H1940) := 0x00108000 | ||
113 | # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory | 115 | # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory |
114 | ifeq ($(CONFIG_ARCH_SA1100),y) | 116 | ifeq ($(CONFIG_ARCH_SA1100),y) |
115 | textofs-$(CONFIG_SA1111) := 0x00208000 | 117 | textofs-$(CONFIG_SA1111) := 0x00208000 |
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig index 554731868b07..a4c0b3fcdbba 100644 --- a/arch/arm/mach-s3c2410/Kconfig +++ b/arch/arm/mach-s3c2410/Kconfig | |||
@@ -6,6 +6,7 @@ config CPU_S3C2410 | |||
6 | bool | 6 | bool |
7 | depends on ARCH_S3C2410 | 7 | depends on ARCH_S3C2410 |
8 | select CPU_ARM920T | 8 | select CPU_ARM920T |
9 | select S3C_GPIO_PULL_UP | ||
9 | select S3C2410_CLOCK | 10 | select S3C2410_CLOCK |
10 | select S3C2410_GPIO | 11 | select S3C2410_GPIO |
11 | select CPU_LLSERIAL_S3C2410 | 12 | select CPU_LLSERIAL_S3C2410 |
@@ -95,12 +96,19 @@ config PM_H1940 | |||
95 | config MACH_N30 | 96 | config MACH_N30 |
96 | bool "Acer N30 family" | 97 | bool "Acer N30 family" |
97 | select CPU_S3C2410 | 98 | select CPU_S3C2410 |
99 | select MACH_N35 | ||
98 | select S3C_DEV_USB_HOST | 100 | select S3C_DEV_USB_HOST |
99 | select S3C_DEV_NAND | 101 | select S3C_DEV_NAND |
100 | help | 102 | help |
101 | Say Y here if you want suppt for the Acer N30, Acer N35, | 103 | Say Y here if you want suppt for the Acer N30, Acer N35, |
102 | Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs. | 104 | Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs. |
103 | 105 | ||
106 | config MACH_N35 | ||
107 | bool | ||
108 | help | ||
109 | Internal node in order to enable support for Acer N35 if Acer N30 is | ||
110 | selected. | ||
111 | |||
104 | config ARCH_BAST | 112 | config ARCH_BAST |
105 | bool "Simtec Electronics BAST (EB2410ITX)" | 113 | bool "Simtec Electronics BAST (EB2410ITX)" |
106 | select CPU_S3C2410 | 114 | select CPU_S3C2410 |
@@ -110,6 +118,7 @@ config ARCH_BAST | |||
110 | select MACH_BAST_IDE | 118 | select MACH_BAST_IDE |
111 | select S3C24XX_DCLK | 119 | select S3C24XX_DCLK |
112 | select ISA | 120 | select ISA |
121 | select S3C_DEV_HWMON | ||
113 | select S3C_DEV_USB_HOST | 122 | select S3C_DEV_USB_HOST |
114 | select S3C_DEV_NAND | 123 | select S3C_DEV_NAND |
115 | help | 124 | help |
diff --git a/arch/arm/mach-s3c2410/Makefile.boot b/arch/arm/mach-s3c2410/Makefile.boot index 7dab2a0325b5..58c1dd7f8e1d 100644 --- a/arch/arm/mach-s3c2410/Makefile.boot +++ b/arch/arm/mach-s3c2410/Makefile.boot | |||
@@ -1,3 +1,7 @@ | |||
1 | zreladdr-y := 0x30008000 | 1 | ifeq ($(CONFIG_PM_H1940),y) |
2 | params_phys-y := 0x30000100 | 2 | zreladdr-y := 0x30108000 |
3 | 3 | params_phys-y := 0x30100100 | |
4 | else | ||
5 | zreladdr-y := 0x30008000 | ||
6 | params_phys-y := 0x30000100 | ||
7 | endif | ||
diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c b/arch/arm/mach-s3c2410/h1940-bluetooth.c index a3f3c7b1ca38..8cdeb14af592 100644 --- a/arch/arm/mach-s3c2410/h1940-bluetooth.c +++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c | |||
@@ -33,14 +33,15 @@ static void h1940bt_enable(int on) | |||
33 | h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER); | 33 | h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER); |
34 | /* Reset the chip */ | 34 | /* Reset the chip */ |
35 | mdelay(10); | 35 | mdelay(10); |
36 | s3c2410_gpio_setpin(S3C2410_GPH(1), 1); | 36 | |
37 | gpio_set_value(S3C2410_GPH(1), 1); | ||
37 | mdelay(10); | 38 | mdelay(10); |
38 | s3c2410_gpio_setpin(S3C2410_GPH(1), 0); | 39 | gpio_set_value(S3C2410_GPH(1), 0); |
39 | } | 40 | } |
40 | else { | 41 | else { |
41 | s3c2410_gpio_setpin(S3C2410_GPH(1), 1); | 42 | gpio_set_value(S3C2410_GPH(1), 1); |
42 | mdelay(10); | 43 | mdelay(10); |
43 | s3c2410_gpio_setpin(S3C2410_GPH(1), 0); | 44 | gpio_set_value(S3C2410_GPH(1), 0); |
44 | mdelay(10); | 45 | mdelay(10); |
45 | h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0); | 46 | h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0); |
46 | } | 47 | } |
@@ -61,15 +62,21 @@ static int __devinit h1940bt_probe(struct platform_device *pdev) | |||
61 | struct rfkill *rfk; | 62 | struct rfkill *rfk; |
62 | int ret = 0; | 63 | int ret = 0; |
63 | 64 | ||
65 | ret = gpio_request(S3C2410_GPH(1), dev_name(&pdev->dev)); | ||
66 | if (ret) { | ||
67 | dev_err(&pdev->dev, "could not get GPH1\n");\ | ||
68 | return ret; | ||
69 | } | ||
70 | |||
64 | /* Configures BT serial port GPIOs */ | 71 | /* Configures BT serial port GPIOs */ |
65 | s3c2410_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0); | 72 | s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0); |
66 | s3c2410_gpio_pullup(S3C2410_GPH(0), 1); | 73 | s3c_gpio_cfgpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE); |
67 | s3c2410_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT); | 74 | s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT); |
68 | s3c2410_gpio_pullup(S3C2410_GPH(1), 1); | 75 | s3c_gpio_cfgpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE); |
69 | s3c2410_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0); | 76 | s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0); |
70 | s3c2410_gpio_pullup(S3C2410_GPH(2), 1); | 77 | s3c_gpio_cfgpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE); |
71 | s3c2410_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0); | 78 | s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0); |
72 | s3c2410_gpio_pullup(S3C2410_GPH(3), 1); | 79 | s3c_gpio_cfgpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE); |
73 | 80 | ||
74 | 81 | ||
75 | rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH, | 82 | rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH, |
@@ -100,6 +107,7 @@ static int h1940bt_remove(struct platform_device *pdev) | |||
100 | struct rfkill *rfk = platform_get_drvdata(pdev); | 107 | struct rfkill *rfk = platform_get_drvdata(pdev); |
101 | 108 | ||
102 | platform_set_drvdata(pdev, NULL); | 109 | platform_set_drvdata(pdev, NULL); |
110 | gpio_free(S3C2410_GPH(1)); | ||
103 | 111 | ||
104 | if (rfk) { | 112 | if (rfk) { |
105 | rfkill_unregister(rfk); | 113 | rfkill_unregister(rfk); |
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-fns.h b/arch/arm/mach-s3c2410/include/mach/gpio-fns.h index 035a493952db..f453c4f2cb8e 100644 --- a/arch/arm/mach-s3c2410/include/mach/gpio-fns.h +++ b/arch/arm/mach-s3c2410/include/mach/gpio-fns.h | |||
@@ -10,14 +10,28 @@ | |||
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifndef __MACH_GPIO_FNS_H | ||
14 | #define __MACH_GPIO_FNS_H __FILE__ | ||
15 | |||
13 | /* These functions are in the to-be-removed category and it is strongly | 16 | /* These functions are in the to-be-removed category and it is strongly |
14 | * encouraged not to use these in new code. They will be marked deprecated | 17 | * encouraged not to use these in new code. They will be marked deprecated |
15 | * very soon. | 18 | * very soon. |
16 | * | 19 | * |
17 | * Most of the functionality can be either replaced by the gpiocfg calls | 20 | * Most of the functionality can be either replaced by the gpiocfg calls |
18 | * for the s3c platform or by the generic GPIOlib API. | 21 | * for the s3c platform or by the generic GPIOlib API. |
22 | * | ||
23 | * As of 2.6.35-rc, these will be removed, with the few drivers using them | ||
24 | * either replaced or given a wrapper until the calls can be removed. | ||
19 | */ | 25 | */ |
20 | 26 | ||
27 | #include <plat/gpio-cfg.h> | ||
28 | |||
29 | static inline void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int cfg) | ||
30 | { | ||
31 | /* 1:1 mapping between cfgpin and setcfg calls at the moment */ | ||
32 | s3c_gpio_cfgpin(pin, cfg); | ||
33 | } | ||
34 | |||
21 | /* external functions for GPIO support | 35 | /* external functions for GPIO support |
22 | * | 36 | * |
23 | * These allow various different clients to access the same GPIO | 37 | * These allow various different clients to access the same GPIO |
@@ -25,17 +39,6 @@ | |||
25 | * GPIO register, then it is safe to ioremap/__raw_{read|write} to it. | 39 | * GPIO register, then it is safe to ioremap/__raw_{read|write} to it. |
26 | */ | 40 | */ |
27 | 41 | ||
28 | /* s3c2410_gpio_cfgpin | ||
29 | * | ||
30 | * set the configuration of the given pin to the value passed. | ||
31 | * | ||
32 | * eg: | ||
33 | * s3c2410_gpio_cfgpin(S3C2410_GPA(0), S3C2410_GPA0_ADDR0); | ||
34 | * s3c2410_gpio_cfgpin(S3C2410_GPE(8), S3C2410_GPE8_SDDAT1); | ||
35 | */ | ||
36 | |||
37 | extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function); | ||
38 | |||
39 | extern unsigned int s3c2410_gpio_getcfg(unsigned int pin); | 42 | extern unsigned int s3c2410_gpio_getcfg(unsigned int pin); |
40 | 43 | ||
41 | /* s3c2410_gpio_getirq | 44 | /* s3c2410_gpio_getirq |
@@ -73,6 +76,14 @@ extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on, | |||
73 | 76 | ||
74 | /* s3c2410_gpio_pullup | 77 | /* s3c2410_gpio_pullup |
75 | * | 78 | * |
79 | * This call should be replaced with s3c_gpio_setpull(). | ||
80 | * | ||
81 | * As a note, there is currently no distinction between pull-up and pull-down | ||
82 | * in the s3c24xx series devices with only an on/off configuration. | ||
83 | */ | ||
84 | |||
85 | /* s3c2410_gpio_pullup | ||
86 | * | ||
76 | * configure the pull-up control on the given pin | 87 | * configure the pull-up control on the given pin |
77 | * | 88 | * |
78 | * to = 1 => disable the pull-up | 89 | * to = 1 => disable the pull-up |
@@ -86,18 +97,8 @@ extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on, | |||
86 | 97 | ||
87 | extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); | 98 | extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); |
88 | 99 | ||
89 | /* s3c2410_gpio_getpull | ||
90 | * | ||
91 | * Read the state of the pull-up on a given pin | ||
92 | * | ||
93 | * return: | ||
94 | * < 0 => error code | ||
95 | * 0 => enabled | ||
96 | * 1 => disabled | ||
97 | */ | ||
98 | |||
99 | extern int s3c2410_gpio_getpull(unsigned int pin); | ||
100 | |||
101 | extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); | 100 | extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); |
102 | 101 | ||
103 | extern unsigned int s3c2410_gpio_getpin(unsigned int pin); | 102 | extern unsigned int s3c2410_gpio_getpin(unsigned int pin); |
103 | |||
104 | #endif /* __MACH_GPIO_FNS_H */ | ||
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h b/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h index 2edbb9c88ab3..4f7bf3272e87 100644 --- a/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h +++ b/arch/arm/mach-s3c2410/include/mach/gpio-nrs.h | |||
@@ -16,15 +16,28 @@ | |||
16 | 16 | ||
17 | #define S3C2410_GPIONO(bank,offset) ((bank) + (offset)) | 17 | #define S3C2410_GPIONO(bank,offset) ((bank) + (offset)) |
18 | 18 | ||
19 | #define S3C2410_GPIO_BANKA (32*0) | ||
20 | #define S3C2410_GPIO_BANKB (32*1) | ||
21 | #define S3C2410_GPIO_BANKC (32*2) | ||
22 | #define S3C2410_GPIO_BANKD (32*3) | ||
23 | #define S3C2410_GPIO_BANKE (32*4) | ||
24 | #define S3C2410_GPIO_BANKF (32*5) | ||
25 | #define S3C2410_GPIO_BANKG (32*6) | 19 | #define S3C2410_GPIO_BANKG (32*6) |
26 | #define S3C2410_GPIO_BANKH (32*7) | 20 | #define S3C2410_GPIO_BANKH (32*7) |
27 | 21 | ||
22 | /* GPIO sizes for various SoCs: | ||
23 | * | ||
24 | * 2442 | ||
25 | * 2410 2412 2440 2443 2416 | ||
26 | * ---- ---- ---- ---- ---- | ||
27 | * A 23 22 25 16 25 | ||
28 | * B 11 11 11 11 9 | ||
29 | * C 16 15 16 16 16 | ||
30 | * D 16 16 16 16 16 | ||
31 | * E 16 16 16 16 16 | ||
32 | * F 8 8 8 8 8 | ||
33 | * G 16 16 16 16 8 | ||
34 | * H 11 11 9 15 15 | ||
35 | * J -- -- 13 16 -- | ||
36 | * K -- -- -- -- 16 | ||
37 | * L -- -- -- 15 7 | ||
38 | * M -- -- -- 2 2 | ||
39 | */ | ||
40 | |||
28 | /* GPIO bank sizes */ | 41 | /* GPIO bank sizes */ |
29 | #define S3C2410_GPIO_A_NR (32) | 42 | #define S3C2410_GPIO_A_NR (32) |
30 | #define S3C2410_GPIO_B_NR (32) | 43 | #define S3C2410_GPIO_B_NR (32) |
@@ -34,6 +47,10 @@ | |||
34 | #define S3C2410_GPIO_F_NR (32) | 47 | #define S3C2410_GPIO_F_NR (32) |
35 | #define S3C2410_GPIO_G_NR (32) | 48 | #define S3C2410_GPIO_G_NR (32) |
36 | #define S3C2410_GPIO_H_NR (32) | 49 | #define S3C2410_GPIO_H_NR (32) |
50 | #define S3C2410_GPIO_J_NR (32) /* technically 16. */ | ||
51 | #define S3C2410_GPIO_K_NR (32) /* technically 16. */ | ||
52 | #define S3C2410_GPIO_L_NR (32) /* technically 15. */ | ||
53 | #define S3C2410_GPIO_M_NR (32) /* technically 2. */ | ||
37 | 54 | ||
38 | #if CONFIG_S3C_GPIO_SPACE != 0 | 55 | #if CONFIG_S3C_GPIO_SPACE != 0 |
39 | #error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment | 56 | #error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment |
@@ -53,6 +70,10 @@ enum s3c_gpio_number { | |||
53 | S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E), | 70 | S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E), |
54 | S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F), | 71 | S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F), |
55 | S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G), | 72 | S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G), |
73 | S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H), | ||
74 | S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J), | ||
75 | S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K), | ||
76 | S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L), | ||
56 | }; | 77 | }; |
57 | 78 | ||
58 | #endif /* __ASSEMBLY__ */ | 79 | #endif /* __ASSEMBLY__ */ |
@@ -67,6 +88,10 @@ enum s3c_gpio_number { | |||
67 | #define S3C2410_GPF(_nr) (S3C2410_GPIO_F_START + (_nr)) | 88 | #define S3C2410_GPF(_nr) (S3C2410_GPIO_F_START + (_nr)) |
68 | #define S3C2410_GPG(_nr) (S3C2410_GPIO_G_START + (_nr)) | 89 | #define S3C2410_GPG(_nr) (S3C2410_GPIO_G_START + (_nr)) |
69 | #define S3C2410_GPH(_nr) (S3C2410_GPIO_H_START + (_nr)) | 90 | #define S3C2410_GPH(_nr) (S3C2410_GPIO_H_START + (_nr)) |
91 | #define S3C2410_GPJ(_nr) (S3C2410_GPIO_J_START + (_nr)) | ||
92 | #define S3C2410_GPK(_nr) (S3C2410_GPIO_K_START + (_nr)) | ||
93 | #define S3C2410_GPL(_nr) (S3C2410_GPIO_L_START + (_nr)) | ||
94 | #define S3C2410_GPM(_nr) (S3C2410_GPIO_M_START + (_nr)) | ||
70 | 95 | ||
71 | /* compatibility until drivers can be modified */ | 96 | /* compatibility until drivers can be modified */ |
72 | 97 | ||
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-track.h b/arch/arm/mach-s3c2410/include/mach/gpio-track.h index acb259103808..d67819dde42a 100644 --- a/arch/arm/mach-s3c2410/include/mach/gpio-track.h +++ b/arch/arm/mach-s3c2410/include/mach/gpio-track.h | |||
@@ -23,11 +23,11 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin) | |||
23 | { | 23 | { |
24 | struct s3c_gpio_chip *chip; | 24 | struct s3c_gpio_chip *chip; |
25 | 25 | ||
26 | if (pin > S3C2410_GPG(10)) | 26 | if (pin > S3C_GPIO_END) |
27 | return NULL; | 27 | return NULL; |
28 | 28 | ||
29 | chip = &s3c24xx_gpios[pin/32]; | 29 | chip = &s3c24xx_gpios[pin/32]; |
30 | return (S3C2410_GPIO_OFFSET(pin) < chip->chip.ngpio) ? chip : NULL; | 30 | return ((pin - chip->chip.base) < chip->chip.ngpio) ? chip : NULL; |
31 | } | 31 | } |
32 | 32 | ||
33 | #endif /* __ASM_ARCH_GPIO_CORE_H */ | 33 | #endif /* __ASM_ARCH_GPIO_CORE_H */ |
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h b/arch/arm/mach-s3c2410/include/mach/gpio.h index 15f0b3e7ce69..b649bf2ccd5c 100644 --- a/arch/arm/mach-s3c2410/include/mach/gpio.h +++ b/arch/arm/mach-s3c2410/include/mach/gpio.h | |||
@@ -20,10 +20,18 @@ | |||
20 | * devices that need GPIO. | 20 | * devices that need GPIO. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifdef CONFIG_CPU_S3C244X | ||
24 | #define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA) | ||
25 | #else | ||
23 | #define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) | 26 | #define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) |
27 | #endif | ||
24 | 28 | ||
25 | #include <asm-generic/gpio.h> | 29 | #include <asm-generic/gpio.h> |
26 | #include <mach/gpio-nrs.h> | 30 | #include <mach/gpio-nrs.h> |
27 | #include <mach/gpio-fns.h> | 31 | #include <mach/gpio-fns.h> |
28 | 32 | ||
33 | #ifdef CONFIG_CPU_S3C24XX | ||
34 | #define S3C_GPIO_END (S3C2410_GPIO_BANKJ + 32) | ||
35 | #else | ||
29 | #define S3C_GPIO_END (S3C2410_GPIO_BANKH + 32) | 36 | #define S3C_GPIO_END (S3C2410_GPIO_BANKH + 32) |
37 | #endif | ||
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h index fd672f330bf2..95e29fefec34 100644 --- a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h +++ b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h | |||
@@ -17,29 +17,11 @@ | |||
17 | #include <mach/gpio-nrs.h> | 17 | #include <mach/gpio-nrs.h> |
18 | 18 | ||
19 | #ifdef CONFIG_CPU_S3C2400 | 19 | #ifdef CONFIG_CPU_S3C2400 |
20 | #define S3C24XX_GPIO_BASE(x) S3C2400_GPIO_BASE(x) | 20 | #define S3C24XX_MISCCR S3C2400_MISCCR |
21 | #define S3C24XX_MISCCR S3C2400_MISCCR | ||
22 | #else | 21 | #else |
23 | #define S3C24XX_GPIO_BASE(x) S3C2410_GPIO_BASE(x) | 22 | #define S3C24XX_MISCCR S3C24XX_GPIOREG2(0x80) |
24 | #define S3C24XX_MISCCR S3C24XX_GPIOREG2(0x80) | ||
25 | #endif /* CONFIG_CPU_S3C2400 */ | 23 | #endif /* CONFIG_CPU_S3C2400 */ |
26 | 24 | ||
27 | |||
28 | /* S3C2400 doesn't have a 1:1 mapping to S3C2410 gpio base pins */ | ||
29 | |||
30 | #define S3C2400_BANKNUM(pin) (((pin) & ~31) / 32) | ||
31 | #define S3C2400_BASEA2B(pin) ((((pin) & ~31) >> 2)) | ||
32 | #define S3C2400_BASEC2H(pin) ((S3C2400_BANKNUM(pin) * 10) + \ | ||
33 | (2 * (S3C2400_BANKNUM(pin)-2))) | ||
34 | |||
35 | #define S3C2400_GPIO_BASE(pin) (pin < S3C2410_GPIO_BANKC ? \ | ||
36 | S3C2400_BASEA2B(pin)+S3C24XX_VA_GPIO : \ | ||
37 | S3C2400_BASEC2H(pin)+S3C24XX_VA_GPIO) | ||
38 | |||
39 | |||
40 | #define S3C2410_GPIO_BASE(pin) ((((pin) & ~31) >> 1) + S3C24XX_VA_GPIO) | ||
41 | #define S3C2410_GPIO_OFFSET(pin) ((pin) & 31) | ||
42 | |||
43 | /* general configuration options */ | 25 | /* general configuration options */ |
44 | 26 | ||
45 | #define S3C2410_GPIO_LEAVE (0xFFFFFFFF) | 27 | #define S3C2410_GPIO_LEAVE (0xFFFFFFFF) |
@@ -639,6 +621,23 @@ | |||
639 | * for the 2412/2413 from the 2410/2440/2442 | 621 | * for the 2412/2413 from the 2410/2440/2442 |
640 | */ | 622 | */ |
641 | 623 | ||
624 | /* S3C2443 and above */ | ||
625 | #define S3C2440_GPJCON S3C2410_GPIOREG(0xD0) | ||
626 | #define S3C2440_GPJDAT S3C2410_GPIOREG(0xD4) | ||
627 | #define S3C2440_GPJUP S3C2410_GPIOREG(0xD8) | ||
628 | |||
629 | #define S3C2443_GPKCON S3C2410_GPIOREG(0xE0) | ||
630 | #define S3C2443_GPKDAT S3C2410_GPIOREG(0xE4) | ||
631 | #define S3C2443_GPKUP S3C2410_GPIOREG(0xE8) | ||
632 | |||
633 | #define S3C2443_GPLCON S3C2410_GPIOREG(0xF0) | ||
634 | #define S3C2443_GPLDAT S3C2410_GPIOREG(0xF4) | ||
635 | #define S3C2443_GPLUP S3C2410_GPIOREG(0xF8) | ||
636 | |||
637 | #define S3C2443_GPMCON S3C2410_GPIOREG(0x100) | ||
638 | #define S3C2443_GPMDAT S3C2410_GPIOREG(0x104) | ||
639 | #define S3C2443_GPMUP S3C2410_GPIOREG(0x108) | ||
640 | |||
642 | /* miscellaneous control */ | 641 | /* miscellaneous control */ |
643 | #define S3C2400_MISCCR S3C2410_GPIOREG(0x54) | 642 | #define S3C2400_MISCCR S3C2410_GPIOREG(0x54) |
644 | #define S3C2410_MISCCR S3C2410_GPIOREG(0x80) | 643 | #define S3C2410_MISCCR S3C2410_GPIOREG(0x80) |
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpioj.h b/arch/arm/mach-s3c2410/include/mach/regs-gpioj.h index 1202ca5e99f6..19575e061114 100644 --- a/arch/arm/mach-s3c2410/include/mach/regs-gpioj.h +++ b/arch/arm/mach-s3c2410/include/mach/regs-gpioj.h | |||
@@ -22,85 +22,49 @@ | |||
22 | * pull up works like all other ports. | 22 | * pull up works like all other ports. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #define S3C2440_GPIO_BANKJ (416) | ||
26 | |||
27 | #define S3C2440_GPJCON S3C2410_GPIOREG(0xd0) | ||
28 | #define S3C2440_GPJDAT S3C2410_GPIOREG(0xd4) | ||
29 | #define S3C2440_GPJUP S3C2410_GPIOREG(0xd8) | ||
30 | |||
31 | #define S3C2413_GPJCON S3C2410_GPIOREG(0x80) | 25 | #define S3C2413_GPJCON S3C2410_GPIOREG(0x80) |
32 | #define S3C2413_GPJDAT S3C2410_GPIOREG(0x84) | 26 | #define S3C2413_GPJDAT S3C2410_GPIOREG(0x84) |
33 | #define S3C2413_GPJUP S3C2410_GPIOREG(0x88) | 27 | #define S3C2413_GPJUP S3C2410_GPIOREG(0x88) |
34 | #define S3C2413_GPJSLPCON S3C2410_GPIOREG(0x8C) | 28 | #define S3C2413_GPJSLPCON S3C2410_GPIOREG(0x8C) |
35 | 29 | ||
36 | #define S3C2440_GPJ0 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 0) | ||
37 | #define S3C2440_GPJ0_INP (0x00 << 0) | ||
38 | #define S3C2440_GPJ0_OUTP (0x01 << 0) | 30 | #define S3C2440_GPJ0_OUTP (0x01 << 0) |
39 | #define S3C2440_GPJ0_CAMDATA0 (0x02 << 0) | 31 | #define S3C2440_GPJ0_CAMDATA0 (0x02 << 0) |
40 | 32 | ||
41 | #define S3C2440_GPJ1 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 1) | ||
42 | #define S3C2440_GPJ1_INP (0x00 << 2) | ||
43 | #define S3C2440_GPJ1_OUTP (0x01 << 2) | 33 | #define S3C2440_GPJ1_OUTP (0x01 << 2) |
44 | #define S3C2440_GPJ1_CAMDATA1 (0x02 << 2) | 34 | #define S3C2440_GPJ1_CAMDATA1 (0x02 << 2) |
45 | 35 | ||
46 | #define S3C2440_GPJ2 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 2) | ||
47 | #define S3C2440_GPJ2_INP (0x00 << 4) | ||
48 | #define S3C2440_GPJ2_OUTP (0x01 << 4) | 36 | #define S3C2440_GPJ2_OUTP (0x01 << 4) |
49 | #define S3C2440_GPJ2_CAMDATA2 (0x02 << 4) | 37 | #define S3C2440_GPJ2_CAMDATA2 (0x02 << 4) |
50 | 38 | ||
51 | #define S3C2440_GPJ3 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 3) | ||
52 | #define S3C2440_GPJ3_INP (0x00 << 6) | ||
53 | #define S3C2440_GPJ3_OUTP (0x01 << 6) | 39 | #define S3C2440_GPJ3_OUTP (0x01 << 6) |
54 | #define S3C2440_GPJ3_CAMDATA3 (0x02 << 6) | 40 | #define S3C2440_GPJ3_CAMDATA3 (0x02 << 6) |
55 | 41 | ||
56 | #define S3C2440_GPJ4 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 4) | ||
57 | #define S3C2440_GPJ4_INP (0x00 << 8) | ||
58 | #define S3C2440_GPJ4_OUTP (0x01 << 8) | 42 | #define S3C2440_GPJ4_OUTP (0x01 << 8) |
59 | #define S3C2440_GPJ4_CAMDATA4 (0x02 << 8) | 43 | #define S3C2440_GPJ4_CAMDATA4 (0x02 << 8) |
60 | 44 | ||
61 | #define S3C2440_GPJ5 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 5) | ||
62 | #define S3C2440_GPJ5_INP (0x00 << 10) | ||
63 | #define S3C2440_GPJ5_OUTP (0x01 << 10) | 45 | #define S3C2440_GPJ5_OUTP (0x01 << 10) |
64 | #define S3C2440_GPJ5_CAMDATA5 (0x02 << 10) | 46 | #define S3C2440_GPJ5_CAMDATA5 (0x02 << 10) |
65 | 47 | ||
66 | #define S3C2440_GPJ6 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 6) | ||
67 | #define S3C2440_GPJ6_INP (0x00 << 12) | ||
68 | #define S3C2440_GPJ6_OUTP (0x01 << 12) | 48 | #define S3C2440_GPJ6_OUTP (0x01 << 12) |
69 | #define S3C2440_GPJ6_CAMDATA6 (0x02 << 12) | 49 | #define S3C2440_GPJ6_CAMDATA6 (0x02 << 12) |
70 | 50 | ||
71 | #define S3C2440_GPJ7 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 7) | ||
72 | #define S3C2440_GPJ7_INP (0x00 << 14) | ||
73 | #define S3C2440_GPJ7_OUTP (0x01 << 14) | 51 | #define S3C2440_GPJ7_OUTP (0x01 << 14) |
74 | #define S3C2440_GPJ7_CAMDATA7 (0x02 << 14) | 52 | #define S3C2440_GPJ7_CAMDATA7 (0x02 << 14) |
75 | 53 | ||
76 | #define S3C2440_GPJ8 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 8) | ||
77 | #define S3C2440_GPJ8_INP (0x00 << 16) | ||
78 | #define S3C2440_GPJ8_OUTP (0x01 << 16) | 54 | #define S3C2440_GPJ8_OUTP (0x01 << 16) |
79 | #define S3C2440_GPJ8_CAMPCLK (0x02 << 16) | 55 | #define S3C2440_GPJ8_CAMPCLK (0x02 << 16) |
80 | 56 | ||
81 | #define S3C2440_GPJ9 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 9) | ||
82 | #define S3C2440_GPJ9_INP (0x00 << 18) | ||
83 | #define S3C2440_GPJ9_OUTP (0x01 << 18) | 57 | #define S3C2440_GPJ9_OUTP (0x01 << 18) |
84 | #define S3C2440_GPJ9_CAMVSYNC (0x02 << 18) | 58 | #define S3C2440_GPJ9_CAMVSYNC (0x02 << 18) |
85 | 59 | ||
86 | #define S3C2440_GPJ10 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 10) | ||
87 | #define S3C2440_GPJ10_INP (0x00 << 20) | ||
88 | #define S3C2440_GPJ10_OUTP (0x01 << 20) | 60 | #define S3C2440_GPJ10_OUTP (0x01 << 20) |
89 | #define S3C2440_GPJ10_CAMHREF (0x02 << 20) | 61 | #define S3C2440_GPJ10_CAMHREF (0x02 << 20) |
90 | 62 | ||
91 | #define S3C2440_GPJ11 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 11) | ||
92 | #define S3C2440_GPJ11_INP (0x00 << 22) | ||
93 | #define S3C2440_GPJ11_OUTP (0x01 << 22) | 63 | #define S3C2440_GPJ11_OUTP (0x01 << 22) |
94 | #define S3C2440_GPJ11_CAMCLKOUT (0x02 << 22) | 64 | #define S3C2440_GPJ11_CAMCLKOUT (0x02 << 22) |
95 | 65 | ||
96 | #define S3C2440_GPJ12 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 12) | ||
97 | #define S3C2440_GPJ12_INP (0x00 << 24) | ||
98 | #define S3C2440_GPJ12_OUTP (0x01 << 24) | 66 | #define S3C2440_GPJ12_OUTP (0x01 << 24) |
99 | #define S3C2440_GPJ12_CAMRESET (0x02 << 24) | 67 | #define S3C2440_GPJ12_CAMRESET (0x02 << 24) |
100 | 68 | ||
101 | #define S3C2443_GPJ13 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 13) | ||
102 | #define S3C2443_GPJ14 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 14) | ||
103 | #define S3C2443_GPJ15 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 15) | ||
104 | |||
105 | #endif /* __ASM_ARCH_REGS_GPIOJ_H */ | 69 | #endif /* __ASM_ARCH_REGS_GPIOJ_H */ |
106 | 70 | ||
diff --git a/arch/arm/mach-s3c2410/mach-amlm5900.c b/arch/arm/mach-s3c2410/mach-amlm5900.c index 7047317ed7f4..34fc05a4244b 100644 --- a/arch/arm/mach-s3c2410/mach-amlm5900.c +++ b/arch/arm/mach-s3c2410/mach-amlm5900.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <plat/iic.h> | 56 | #include <plat/iic.h> |
57 | #include <plat/devs.h> | 57 | #include <plat/devs.h> |
58 | #include <plat/cpu.h> | 58 | #include <plat/cpu.h> |
59 | #include <plat/gpio-cfg.h> | ||
59 | 60 | ||
60 | #ifdef CONFIG_MTD_PARTITIONS | 61 | #ifdef CONFIG_MTD_PARTITIONS |
61 | 62 | ||
@@ -225,8 +226,8 @@ static void amlm5900_init_pm(void) | |||
225 | } else { | 226 | } else { |
226 | enable_irq_wake(IRQ_EINT9); | 227 | enable_irq_wake(IRQ_EINT9); |
227 | /* configure the suspend/resume status pin */ | 228 | /* configure the suspend/resume status pin */ |
228 | s3c2410_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); | 229 | s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); |
229 | s3c2410_gpio_pullup(S3C2410_GPF(2), 0); | 230 | s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP); |
230 | } | 231 | } |
231 | } | 232 | } |
232 | static void __init amlm5900_init(void) | 233 | static void __init amlm5900_init(void) |
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c index 02b1b6220cba..c1f90f6fab42 100644 --- a/arch/arm/mach-s3c2410/mach-bast.c +++ b/arch/arm/mach-s3c2410/mach-bast.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <plat/devs.h> | 61 | #include <plat/devs.h> |
62 | #include <plat/cpu.h> | 62 | #include <plat/cpu.h> |
63 | #include <plat/cpu-freq.h> | 63 | #include <plat/cpu-freq.h> |
64 | #include <plat/gpio-cfg.h> | ||
64 | #include <plat/audio-simtec.h> | 65 | #include <plat/audio-simtec.h> |
65 | 66 | ||
66 | #include "usb-simtec.h" | 67 | #include "usb-simtec.h" |
@@ -216,15 +217,13 @@ static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = { | |||
216 | static int bast_pm_suspend(struct sys_device *sd, pm_message_t state) | 217 | static int bast_pm_suspend(struct sys_device *sd, pm_message_t state) |
217 | { | 218 | { |
218 | /* ensure that an nRESET is not generated on resume. */ | 219 | /* ensure that an nRESET is not generated on resume. */ |
219 | s3c2410_gpio_setpin(S3C2410_GPA(21), 1); | 220 | gpio_direction_output(S3C2410_GPA(21), 1); |
220 | s3c2410_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPIO_OUTPUT); | ||
221 | |||
222 | return 0; | 221 | return 0; |
223 | } | 222 | } |
224 | 223 | ||
225 | static int bast_pm_resume(struct sys_device *sd) | 224 | static int bast_pm_resume(struct sys_device *sd) |
226 | { | 225 | { |
227 | s3c2410_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); | 226 | s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); |
228 | return 0; | 227 | return 0; |
229 | } | 228 | } |
230 | 229 | ||
@@ -634,7 +633,7 @@ static void __init bast_map_io(void) | |||
634 | 633 | ||
635 | s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks)); | 634 | s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks)); |
636 | 635 | ||
637 | s3c_device_hwmon.dev.platform_data = &bast_hwmon_info; | 636 | s3c_hwmon_set_platdata(&bast_hwmon_info); |
638 | 637 | ||
639 | s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); | 638 | s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); |
640 | s3c24xx_init_clocks(0); | 639 | s3c24xx_init_clocks(0); |
@@ -658,6 +657,8 @@ static void __init bast_init(void) | |||
658 | nor_simtec_init(); | 657 | nor_simtec_init(); |
659 | simtec_audio_add(NULL, true, &bast_audio); | 658 | simtec_audio_add(NULL, true, &bast_audio); |
660 | 659 | ||
660 | WARN_ON(gpio_request(S3C2410_GPA(21), "bast nreset")); | ||
661 | |||
661 | s3c_cpufreq_setboard(&bast_cpufreq); | 662 | s3c_cpufreq_setboard(&bast_cpufreq); |
662 | } | 663 | } |
663 | 664 | ||
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c index fbedd0760941..d2a2fad7db97 100644 --- a/arch/arm/mach-s3c2410/mach-h1940.c +++ b/arch/arm/mach-s3c2410/mach-h1940.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <plat/udc.h> | 50 | #include <plat/udc.h> |
51 | #include <plat/iic.h> | 51 | #include <plat/iic.h> |
52 | 52 | ||
53 | #include <plat/gpio-cfg.h> | ||
53 | #include <plat/clock.h> | 54 | #include <plat/clock.h> |
54 | #include <plat/devs.h> | 55 | #include <plat/devs.h> |
55 | #include <plat/cpu.h> | 56 | #include <plat/cpu.h> |
@@ -162,8 +163,8 @@ static struct s3c2410fb_display h1940_lcd __initdata = { | |||
162 | .xres = 240, | 163 | .xres = 240, |
163 | .yres = 320, | 164 | .yres = 320, |
164 | .bpp = 16, | 165 | .bpp = 16, |
165 | .left_margin = 20, | 166 | .left_margin = 8, |
166 | .right_margin = 8, | 167 | .right_margin = 20, |
167 | .hsync_len = 4, | 168 | .hsync_len = 4, |
168 | .upper_margin = 8, | 169 | .upper_margin = 8, |
169 | .lower_margin = 7, | 170 | .lower_margin = 7, |
@@ -207,16 +208,16 @@ static int h1940_backlight_init(struct device *dev) | |||
207 | { | 208 | { |
208 | gpio_request(S3C2410_GPB(0), "Backlight"); | 209 | gpio_request(S3C2410_GPB(0), "Backlight"); |
209 | 210 | ||
210 | s3c2410_gpio_setpin(S3C2410_GPB(0), 0); | 211 | gpio_direction_output(S3C2410_GPB(0), 0); |
211 | s3c2410_gpio_pullup(S3C2410_GPB(0), 0); | 212 | s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE); |
212 | s3c2410_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); | 213 | s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); |
213 | 214 | ||
214 | return 0; | 215 | return 0; |
215 | } | 216 | } |
216 | 217 | ||
217 | static void h1940_backlight_exit(struct device *dev) | 218 | static void h1940_backlight_exit(struct device *dev) |
218 | { | 219 | { |
219 | s3c2410_gpio_cfgpin(S3C2410_GPB(0), 1/*S3C2410_GPB0_OUTP*/); | 220 | gpio_direction_output(S3C2410_GPB(0), 1); |
220 | } | 221 | } |
221 | 222 | ||
222 | static struct platform_pwm_backlight_data backlight_data = { | 223 | static struct platform_pwm_backlight_data backlight_data = { |
@@ -245,18 +246,18 @@ static void h1940_lcd_power_set(struct plat_lcd_data *pd, | |||
245 | 246 | ||
246 | if (!power) { | 247 | if (!power) { |
247 | /* set to 3ec */ | 248 | /* set to 3ec */ |
248 | s3c2410_gpio_setpin(S3C2410_GPC(0), 0); | 249 | gpio_direction_output(S3C2410_GPC(0), 0); |
249 | /* wait for 3ac */ | 250 | /* wait for 3ac */ |
250 | do { | 251 | do { |
251 | value = s3c2410_gpio_getpin(S3C2410_GPC(6)); | 252 | value = gpio_get_value(S3C2410_GPC(6)); |
252 | } while (value); | 253 | } while (value); |
253 | /* set to 38c */ | 254 | /* set to 38c */ |
254 | s3c2410_gpio_setpin(S3C2410_GPC(5), 0); | 255 | gpio_direction_output(S3C2410_GPC(5), 0); |
255 | } else { | 256 | } else { |
256 | /* Set to 3ac */ | 257 | /* Set to 3ac */ |
257 | s3c2410_gpio_setpin(S3C2410_GPC(5), 1); | 258 | gpio_direction_output(S3C2410_GPC(5), 1); |
258 | /* Set to 3ad */ | 259 | /* Set to 3ad */ |
259 | s3c2410_gpio_setpin(S3C2410_GPC(0), 1); | 260 | gpio_direction_output(S3C2410_GPC(0), 1); |
260 | } | 261 | } |
261 | } | 262 | } |
262 | 263 | ||
@@ -271,7 +272,6 @@ static struct platform_device h1940_lcd_powerdev = { | |||
271 | }; | 272 | }; |
272 | 273 | ||
273 | static struct platform_device *h1940_devices[] __initdata = { | 274 | static struct platform_device *h1940_devices[] __initdata = { |
274 | &s3c_device_ts, | ||
275 | &s3c_device_ohci, | 275 | &s3c_device_ohci, |
276 | &s3c_device_lcd, | 276 | &s3c_device_lcd, |
277 | &s3c_device_wdt, | 277 | &s3c_device_wdt, |
@@ -285,6 +285,8 @@ static struct platform_device *h1940_devices[] __initdata = { | |||
285 | &s3c_device_timer[0], | 285 | &s3c_device_timer[0], |
286 | &h1940_backlight, | 286 | &h1940_backlight, |
287 | &h1940_lcd_powerdev, | 287 | &h1940_lcd_powerdev, |
288 | &s3c_device_adc, | ||
289 | &s3c_device_ts, | ||
288 | }; | 290 | }; |
289 | 291 | ||
290 | static void __init h1940_map_io(void) | 292 | static void __init h1940_map_io(void) |
@@ -332,12 +334,13 @@ static void __init h1940_init(void) | |||
332 | gpio_request(S3C2410_GPC(5), "LCD power"); | 334 | gpio_request(S3C2410_GPC(5), "LCD power"); |
333 | gpio_request(S3C2410_GPC(6), "LCD power"); | 335 | gpio_request(S3C2410_GPC(6), "LCD power"); |
334 | 336 | ||
337 | gpio_direction_input(S3C2410_GPC(6)); | ||
335 | 338 | ||
336 | platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); | 339 | platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); |
337 | } | 340 | } |
338 | 341 | ||
339 | MACHINE_START(H1940, "IPAQ-H1940") | 342 | MACHINE_START(H1940, "IPAQ-H1940") |
340 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 343 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
341 | .phys_io = S3C2410_PA_UART, | 344 | .phys_io = S3C2410_PA_UART, |
342 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 345 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
343 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 346 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c index 684710f88142..41f299d983eb 100644 --- a/arch/arm/mach-s3c2410/mach-n30.c +++ b/arch/arm/mach-s3c2410/mach-n30.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/serial_core.h> | 26 | #include <linux/serial_core.h> |
27 | #include <linux/timer.h> | 27 | #include <linux/timer.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/mmc/host.h> | ||
29 | 30 | ||
30 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
31 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
@@ -46,6 +47,7 @@ | |||
46 | #include <plat/clock.h> | 47 | #include <plat/clock.h> |
47 | #include <plat/cpu.h> | 48 | #include <plat/cpu.h> |
48 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <plat/mci.h> | ||
49 | #include <plat/s3c2410.h> | 51 | #include <plat/s3c2410.h> |
50 | #include <plat/udc.h> | 52 | #include <plat/udc.h> |
51 | 53 | ||
@@ -86,10 +88,10 @@ static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd) | |||
86 | { | 88 | { |
87 | switch (cmd) { | 89 | switch (cmd) { |
88 | case S3C2410_UDC_P_ENABLE : | 90 | case S3C2410_UDC_P_ENABLE : |
89 | s3c2410_gpio_setpin(S3C2410_GPB(3), 1); | 91 | gpio_set_value(S3C2410_GPB(3), 1); |
90 | break; | 92 | break; |
91 | case S3C2410_UDC_P_DISABLE : | 93 | case S3C2410_UDC_P_DISABLE : |
92 | s3c2410_gpio_setpin(S3C2410_GPB(3), 0); | 94 | gpio_set_value(S3C2410_GPB(3), 0); |
93 | break; | 95 | break; |
94 | case S3C2410_UDC_P_RESET : | 96 | case S3C2410_UDC_P_RESET : |
95 | break; | 97 | break; |
@@ -172,8 +174,10 @@ static struct gpio_keys_button n35_buttons[] = { | |||
172 | { | 174 | { |
173 | .gpio = S3C2410_GPF(0), | 175 | .gpio = S3C2410_GPF(0), |
174 | .code = KEY_POWER, | 176 | .code = KEY_POWER, |
177 | .type = EV_PWR, | ||
175 | .desc = "Power", | 178 | .desc = "Power", |
176 | .active_low = 0, | 179 | .active_low = 0, |
180 | .wakeup = 1, | ||
177 | }, | 181 | }, |
178 | { | 182 | { |
179 | .gpio = S3C2410_GPG(9), | 183 | .gpio = S3C2410_GPG(9), |
@@ -264,6 +268,14 @@ static struct s3c24xx_led_platdata n30_blue_led_pdata = { | |||
264 | .def_trigger = "", | 268 | .def_trigger = "", |
265 | }; | 269 | }; |
266 | 270 | ||
271 | /* This is the blue LED on the device. Originaly used to indicate GPS activity | ||
272 | * by flashing. */ | ||
273 | static struct s3c24xx_led_platdata n35_blue_led_pdata = { | ||
274 | .name = "blue_led", | ||
275 | .gpio = S3C2410_GPD(8), | ||
276 | .def_trigger = "", | ||
277 | }; | ||
278 | |||
267 | /* This LED is driven by the battery microcontroller, and is blinking | 279 | /* This LED is driven by the battery microcontroller, and is blinking |
268 | * red, blinking green or solid green when the battery is low, | 280 | * red, blinking green or solid green when the battery is low, |
269 | * charging or full respectively. By driving GPD9 low, it's possible | 281 | * charging or full respectively. By driving GPD9 low, it's possible |
@@ -275,6 +287,13 @@ static struct s3c24xx_led_platdata n30_warning_led_pdata = { | |||
275 | .def_trigger = "", | 287 | .def_trigger = "", |
276 | }; | 288 | }; |
277 | 289 | ||
290 | static struct s3c24xx_led_platdata n35_warning_led_pdata = { | ||
291 | .name = "warning_led", | ||
292 | .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, | ||
293 | .gpio = S3C2410_GPD(9), | ||
294 | .def_trigger = "", | ||
295 | }; | ||
296 | |||
278 | static struct platform_device n30_blue_led = { | 297 | static struct platform_device n30_blue_led = { |
279 | .name = "s3c24xx_led", | 298 | .name = "s3c24xx_led", |
280 | .id = 1, | 299 | .id = 1, |
@@ -283,6 +302,14 @@ static struct platform_device n30_blue_led = { | |||
283 | }, | 302 | }, |
284 | }; | 303 | }; |
285 | 304 | ||
305 | static struct platform_device n35_blue_led = { | ||
306 | .name = "s3c24xx_led", | ||
307 | .id = 1, | ||
308 | .dev = { | ||
309 | .platform_data = &n35_blue_led_pdata, | ||
310 | }, | ||
311 | }; | ||
312 | |||
286 | static struct platform_device n30_warning_led = { | 313 | static struct platform_device n30_warning_led = { |
287 | .name = "s3c24xx_led", | 314 | .name = "s3c24xx_led", |
288 | .id = 2, | 315 | .id = 2, |
@@ -291,6 +318,14 @@ static struct platform_device n30_warning_led = { | |||
291 | }, | 318 | }, |
292 | }; | 319 | }; |
293 | 320 | ||
321 | static struct platform_device n35_warning_led = { | ||
322 | .name = "s3c24xx_led", | ||
323 | .id = 2, | ||
324 | .dev = { | ||
325 | .platform_data = &n35_warning_led_pdata, | ||
326 | }, | ||
327 | }; | ||
328 | |||
294 | static struct s3c2410fb_display n30_display __initdata = { | 329 | static struct s3c2410fb_display n30_display __initdata = { |
295 | .type = S3C2410_LCDCON1_TFT, | 330 | .type = S3C2410_LCDCON1_TFT, |
296 | .width = 240, | 331 | .width = 240, |
@@ -317,13 +352,36 @@ static struct s3c2410fb_mach_info n30_fb_info __initdata = { | |||
317 | .lpcsel = 0x06, | 352 | .lpcsel = 0x06, |
318 | }; | 353 | }; |
319 | 354 | ||
355 | static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd) | ||
356 | { | ||
357 | switch (power_mode) { | ||
358 | case MMC_POWER_ON: | ||
359 | case MMC_POWER_UP: | ||
360 | gpio_set_value(S3C2410_GPG(4), 1); | ||
361 | break; | ||
362 | case MMC_POWER_OFF: | ||
363 | default: | ||
364 | gpio_set_value(S3C2410_GPG(4), 0); | ||
365 | break; | ||
366 | } | ||
367 | } | ||
368 | |||
369 | static struct s3c24xx_mci_pdata n30_mci_cfg __initdata = { | ||
370 | .gpio_detect = S3C2410_GPF(1), | ||
371 | .gpio_wprotect = S3C2410_GPG(10), | ||
372 | .ocr_avail = MMC_VDD_32_33, | ||
373 | .set_power = n30_sdi_set_power, | ||
374 | }; | ||
375 | |||
320 | static struct platform_device *n30_devices[] __initdata = { | 376 | static struct platform_device *n30_devices[] __initdata = { |
321 | &s3c_device_lcd, | 377 | &s3c_device_lcd, |
322 | &s3c_device_wdt, | 378 | &s3c_device_wdt, |
323 | &s3c_device_i2c0, | 379 | &s3c_device_i2c0, |
324 | &s3c_device_iis, | 380 | &s3c_device_iis, |
325 | &s3c_device_ohci, | 381 | &s3c_device_ohci, |
382 | &s3c_device_rtc, | ||
326 | &s3c_device_usbgadget, | 383 | &s3c_device_usbgadget, |
384 | &s3c_device_sdi, | ||
327 | &n30_button_device, | 385 | &n30_button_device, |
328 | &n30_blue_led, | 386 | &n30_blue_led, |
329 | &n30_warning_led, | 387 | &n30_warning_led, |
@@ -334,8 +392,12 @@ static struct platform_device *n35_devices[] __initdata = { | |||
334 | &s3c_device_wdt, | 392 | &s3c_device_wdt, |
335 | &s3c_device_i2c0, | 393 | &s3c_device_i2c0, |
336 | &s3c_device_iis, | 394 | &s3c_device_iis, |
395 | &s3c_device_rtc, | ||
337 | &s3c_device_usbgadget, | 396 | &s3c_device_usbgadget, |
397 | &s3c_device_sdi, | ||
338 | &n35_button_device, | 398 | &n35_button_device, |
399 | &n35_blue_led, | ||
400 | &n35_warning_led, | ||
339 | }; | 401 | }; |
340 | 402 | ||
341 | static struct s3c2410_platform_i2c __initdata n30_i2ccfg = { | 403 | static struct s3c2410_platform_i2c __initdata n30_i2ccfg = { |
@@ -490,17 +552,15 @@ static void __init n30_map_io(void) | |||
490 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); | 552 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); |
491 | } | 553 | } |
492 | 554 | ||
493 | static void __init n30_init_irq(void) | ||
494 | { | ||
495 | s3c24xx_init_irq(); | ||
496 | } | ||
497 | |||
498 | /* GPB3 is the line that controls the pull-up for the USB D+ line */ | 555 | /* GPB3 is the line that controls the pull-up for the USB D+ line */ |
499 | 556 | ||
500 | static void __init n30_init(void) | 557 | static void __init n30_init(void) |
501 | { | 558 | { |
559 | WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power")); | ||
560 | |||
502 | s3c24xx_fb_set_platdata(&n30_fb_info); | 561 | s3c24xx_fb_set_platdata(&n30_fb_info); |
503 | s3c24xx_udc_set_platdata(&n30_udc_cfg); | 562 | s3c24xx_udc_set_platdata(&n30_udc_cfg); |
563 | s3c24xx_mci_set_platdata(&n30_mci_cfg); | ||
504 | s3c_i2c0_set_platdata(&n30_i2ccfg); | 564 | s3c_i2c0_set_platdata(&n30_i2ccfg); |
505 | 565 | ||
506 | /* Turn off suspend on both USB ports, and switch the | 566 | /* Turn off suspend on both USB ports, and switch the |
@@ -532,10 +592,13 @@ static void __init n30_init(void) | |||
532 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | 592 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | |
533 | S3C2410_MISCCR_USBSUSPND0 | | 593 | S3C2410_MISCCR_USBSUSPND0 | |
534 | S3C2410_MISCCR_USBSUSPND1, | 594 | S3C2410_MISCCR_USBSUSPND1, |
535 | S3C2410_MISCCR_USBSUSPND1); | 595 | S3C2410_MISCCR_USBSUSPND0); |
536 | 596 | ||
537 | platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices)); | 597 | platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices)); |
538 | } | 598 | } |
599 | |||
600 | WARN_ON(gpio_request(S3C2410_GPB(3), "udc pup")); | ||
601 | gpio_direction_output(S3C2410_GPB(3), 0); | ||
539 | } | 602 | } |
540 | 603 | ||
541 | MACHINE_START(N30, "Acer-N30") | 604 | MACHINE_START(N30, "Acer-N30") |
@@ -547,7 +610,7 @@ MACHINE_START(N30, "Acer-N30") | |||
547 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 610 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
548 | .timer = &s3c24xx_timer, | 611 | .timer = &s3c24xx_timer, |
549 | .init_machine = n30_init, | 612 | .init_machine = n30_init, |
550 | .init_irq = n30_init_irq, | 613 | .init_irq = s3c24xx_init_irq, |
551 | .map_io = n30_map_io, | 614 | .map_io = n30_map_io, |
552 | MACHINE_END | 615 | MACHINE_END |
553 | 616 | ||
@@ -559,6 +622,6 @@ MACHINE_START(N35, "Acer-N35") | |||
559 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 622 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
560 | .timer = &s3c24xx_timer, | 623 | .timer = &s3c24xx_timer, |
561 | .init_machine = n30_init, | 624 | .init_machine = n30_init, |
562 | .init_irq = n30_init_irq, | 625 | .init_irq = s3c24xx_init_irq, |
563 | .map_io = n30_map_io, | 626 | .map_io = n30_map_io, |
564 | MACHINE_END | 627 | MACHINE_END |
diff --git a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c2410/mach-qt2410.c index 92a4ec375d82..d0e87b6e2e0f 100644 --- a/arch/arm/mach-s3c2410/mach-qt2410.c +++ b/arch/arm/mach-s3c2410/mach-qt2410.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <plat/iic.h> | 58 | #include <plat/iic.h> |
59 | 59 | ||
60 | #include <plat/common-smdk.h> | 60 | #include <plat/common-smdk.h> |
61 | #include <plat/gpio-cfg.h> | ||
61 | #include <plat/devs.h> | 62 | #include <plat/devs.h> |
62 | #include <plat/cpu.h> | 63 | #include <plat/cpu.h> |
63 | #include <plat/pm.h> | 64 | #include <plat/pm.h> |
@@ -219,10 +220,10 @@ static void spi_gpio_cs(struct s3c2410_spigpio_info *spi, int cs) | |||
219 | { | 220 | { |
220 | switch (cs) { | 221 | switch (cs) { |
221 | case BITBANG_CS_ACTIVE: | 222 | case BITBANG_CS_ACTIVE: |
222 | s3c2410_gpio_setpin(S3C2410_GPB(5), 0); | 223 | gpio_set_value(S3C2410_GPB(5), 0); |
223 | break; | 224 | break; |
224 | case BITBANG_CS_INACTIVE: | 225 | case BITBANG_CS_INACTIVE: |
225 | s3c2410_gpio_setpin(S3C2410_GPB(5), 1); | 226 | gpio_set_value(S3C2410_GPB(5), 1); |
226 | break; | 227 | break; |
227 | } | 228 | } |
228 | } | 229 | } |
@@ -347,13 +348,14 @@ static void __init qt2410_machine_init(void) | |||
347 | } | 348 | } |
348 | s3c24xx_fb_set_platdata(&qt2410_fb_info); | 349 | s3c24xx_fb_set_platdata(&qt2410_fb_info); |
349 | 350 | ||
350 | s3c2410_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPIO_OUTPUT); | 351 | s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPIO_OUTPUT); |
351 | s3c2410_gpio_setpin(S3C2410_GPB(0), 1); | 352 | s3c2410_gpio_setpin(S3C2410_GPB(0), 1); |
352 | 353 | ||
353 | s3c24xx_udc_set_platdata(&qt2410_udc_cfg); | 354 | s3c24xx_udc_set_platdata(&qt2410_udc_cfg); |
354 | s3c_i2c0_set_platdata(NULL); | 355 | s3c_i2c0_set_platdata(NULL); |
355 | 356 | ||
356 | s3c2410_gpio_cfgpin(S3C2410_GPB(5), S3C2410_GPIO_OUTPUT); | 357 | WARN_ON(gpio_request(S3C2410_GPB(5), "spi cs")); |
358 | gpio_direction_output(S3C2410_GPB(5), 1); | ||
357 | 359 | ||
358 | platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices)); | 360 | platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices)); |
359 | s3c_pm_init(); | 361 | s3c_pm_init(); |
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c index 9051f0d31123..d540d79dd264 100644 --- a/arch/arm/mach-s3c2410/mach-vr1000.c +++ b/arch/arm/mach-s3c2410/mach-vr1000.c | |||
@@ -357,8 +357,7 @@ static struct clk *vr1000_clocks[] __initdata = { | |||
357 | 357 | ||
358 | static void vr1000_power_off(void) | 358 | static void vr1000_power_off(void) |
359 | { | 359 | { |
360 | s3c2410_gpio_cfgpin(S3C2410_GPB(9), S3C2410_GPIO_OUTPUT); | 360 | gpio_direction_output(S3C2410_GPB(9), 1); |
361 | s3c2410_gpio_setpin(S3C2410_GPB(9), 1); | ||
362 | } | 361 | } |
363 | 362 | ||
364 | static void __init vr1000_map_io(void) | 363 | static void __init vr1000_map_io(void) |
@@ -395,6 +394,8 @@ static void __init vr1000_init(void) | |||
395 | 394 | ||
396 | nor_simtec_init(); | 395 | nor_simtec_init(); |
397 | simtec_audio_add(NULL, true, NULL); | 396 | simtec_audio_add(NULL, true, NULL); |
397 | |||
398 | WARN_ON(gpio_request(S3C2410_GPB(9), "power off")); | ||
398 | } | 399 | } |
399 | 400 | ||
400 | MACHINE_START(VR1000, "Thorcom-VR1000") | 401 | MACHINE_START(VR1000, "Thorcom-VR1000") |
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c index 966119c8efee..725636fc4dc3 100644 --- a/arch/arm/mach-s3c2410/pm.c +++ b/arch/arm/mach-s3c2410/pm.c | |||
@@ -60,10 +60,10 @@ static void s3c2410_pm_prepare(void) | |||
60 | __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM)); | 60 | __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM)); |
61 | } | 61 | } |
62 | 62 | ||
63 | /* the RX3715 uses similar code and the same H1940 and the | 63 | /* RX3715 and RX1950 use similar to H1940 code and the |
64 | * same offsets for resume and checksum pointers */ | 64 | * same offsets for resume and checksum pointers */ |
65 | 65 | ||
66 | if (machine_is_rx3715()) { | 66 | if (machine_is_rx3715() || machine_is_rx1950()) { |
67 | void *base = phys_to_virt(H1940_SUSPEND_CHECK); | 67 | void *base = phys_to_virt(H1940_SUSPEND_CHECK); |
68 | unsigned long ptr; | 68 | unsigned long ptr; |
69 | unsigned long calc = 0; | 69 | unsigned long calc = 0; |
@@ -79,6 +79,17 @@ static void s3c2410_pm_prepare(void) | |||
79 | if ( machine_is_aml_m5900() ) | 79 | if ( machine_is_aml_m5900() ) |
80 | s3c2410_gpio_setpin(S3C2410_GPF(2), 1); | 80 | s3c2410_gpio_setpin(S3C2410_GPF(2), 1); |
81 | 81 | ||
82 | if (machine_is_rx1950()) { | ||
83 | /* According to S3C2442 user's manual, page 7-17, | ||
84 | * when the system is operating in NAND boot mode, | ||
85 | * the hardware pin configuration - EINT[23:21] – | ||
86 | * must be set as input for starting up after | ||
87 | * wakeup from sleep mode | ||
88 | */ | ||
89 | s3c_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPIO_INPUT); | ||
90 | s3c_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPIO_INPUT); | ||
91 | s3c_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPIO_INPUT); | ||
92 | } | ||
82 | } | 93 | } |
83 | 94 | ||
84 | static int s3c2410_pm_resume(struct sys_device *dev) | 95 | static int s3c2410_pm_resume(struct sys_device *dev) |
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c index 91ba42f688ac..adc90a3c5890 100644 --- a/arch/arm/mach-s3c2410/s3c2410.c +++ b/arch/arm/mach-s3c2410/s3c2410.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/list.h> | 16 | #include <linux/list.h> |
17 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/gpio.h> | ||
19 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
20 | #include <linux/sysdev.h> | 21 | #include <linux/sysdev.h> |
21 | #include <linux/serial_core.h> | 22 | #include <linux/serial_core.h> |
@@ -40,6 +41,10 @@ | |||
40 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
41 | #include <plat/pll.h> | 42 | #include <plat/pll.h> |
42 | 43 | ||
44 | #include <plat/gpio-core.h> | ||
45 | #include <plat/gpio-cfg.h> | ||
46 | #include <plat/gpio-cfg-helpers.h> | ||
47 | |||
43 | /* Initial IO mappings */ | 48 | /* Initial IO mappings */ |
44 | 49 | ||
45 | static struct map_desc s3c2410_iodesc[] __initdata = { | 50 | static struct map_desc s3c2410_iodesc[] __initdata = { |
@@ -65,6 +70,9 @@ void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no) | |||
65 | 70 | ||
66 | void __init s3c2410_map_io(void) | 71 | void __init s3c2410_map_io(void) |
67 | { | 72 | { |
73 | s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up; | ||
74 | s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up; | ||
75 | |||
68 | iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc)); | 76 | iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc)); |
69 | } | 77 | } |
70 | 78 | ||
diff --git a/arch/arm/mach-s3c2412/gpio.c b/arch/arm/mach-s3c2412/gpio.c index f7afece7fc38..3404a876b33e 100644 --- a/arch/arm/mach-s3c2412/gpio.c +++ b/arch/arm/mach-s3c2412/gpio.c | |||
@@ -16,41 +16,43 @@ | |||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/gpio.h> | ||
19 | 20 | ||
20 | #include <asm/mach/arch.h> | 21 | #include <asm/mach/arch.h> |
21 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
22 | 23 | ||
23 | #include <mach/regs-gpio.h> | 24 | #include <mach/regs-gpio.h> |
24 | |||
25 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
26 | 26 | ||
27 | #include <plat/gpio-core.h> | ||
28 | |||
27 | int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state) | 29 | int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state) |
28 | { | 30 | { |
29 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | 31 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); |
30 | unsigned long offs = S3C2410_GPIO_OFFSET(pin); | 32 | unsigned long offs = pin - chip->chip.base; |
31 | unsigned long flags; | 33 | unsigned long flags; |
32 | unsigned long slpcon; | 34 | unsigned long slpcon; |
33 | 35 | ||
34 | offs *= 2; | 36 | offs *= 2; |
35 | 37 | ||
36 | if (pin < S3C2410_GPIO_BANKB) | 38 | if (pin < S3C2410_GPB(0)) |
37 | return -EINVAL; | 39 | return -EINVAL; |
38 | 40 | ||
39 | if (pin >= S3C2410_GPIO_BANKF && | 41 | if (pin >= S3C2410_GPF(0) && |
40 | pin <= S3C2410_GPIO_BANKG) | 42 | pin <= S3C2410_GPG(16)) |
41 | return -EINVAL; | 43 | return -EINVAL; |
42 | 44 | ||
43 | if (pin > (S3C2410_GPIO_BANKH + 32)) | 45 | if (pin > S3C2410_GPH(16)) |
44 | return -EINVAL; | 46 | return -EINVAL; |
45 | 47 | ||
46 | local_irq_save(flags); | 48 | local_irq_save(flags); |
47 | 49 | ||
48 | slpcon = __raw_readl(base + 0x0C); | 50 | slpcon = __raw_readl(chip->base + 0x0C); |
49 | 51 | ||
50 | slpcon &= ~(3 << offs); | 52 | slpcon &= ~(3 << offs); |
51 | slpcon |= state << offs; | 53 | slpcon |= state << offs; |
52 | 54 | ||
53 | __raw_writel(slpcon, base + 0x0C); | 55 | __raw_writel(slpcon, chip->base + 0x0C); |
54 | 56 | ||
55 | local_irq_restore(flags); | 57 | local_irq_restore(flags); |
56 | 58 | ||
diff --git a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c index 14f4798291aa..478f4b4606c2 100644 --- a/arch/arm/mach-s3c2412/mach-jive.c +++ b/arch/arm/mach-s3c2412/mach-jive.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/mtd/nand_ecc.h> | 48 | #include <linux/mtd/nand_ecc.h> |
49 | #include <linux/mtd/partitions.h> | 49 | #include <linux/mtd/partitions.h> |
50 | 50 | ||
51 | #include <plat/gpio-cfg.h> | ||
51 | #include <plat/clock.h> | 52 | #include <plat/clock.h> |
52 | #include <plat/devs.h> | 53 | #include <plat/devs.h> |
53 | #include <plat/cpu.h> | 54 | #include <plat/cpu.h> |
@@ -357,8 +358,7 @@ static void jive_lcm_reset(unsigned int set) | |||
357 | { | 358 | { |
358 | printk(KERN_DEBUG "%s(%d)\n", __func__, set); | 359 | printk(KERN_DEBUG "%s(%d)\n", __func__, set); |
359 | 360 | ||
360 | s3c2410_gpio_setpin(S3C2410_GPG(13), set); | 361 | gpio_set_value(S3C2410_GPG(13), set); |
361 | s3c2410_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPIO_OUTPUT); | ||
362 | } | 362 | } |
363 | 363 | ||
364 | #undef LCD_UPPER_MARGIN | 364 | #undef LCD_UPPER_MARGIN |
@@ -391,7 +391,7 @@ static struct ili9320_platdata jive_lcm_config = { | |||
391 | 391 | ||
392 | static void jive_lcd_spi_chipselect(struct s3c2410_spigpio_info *spi, int cs) | 392 | static void jive_lcd_spi_chipselect(struct s3c2410_spigpio_info *spi, int cs) |
393 | { | 393 | { |
394 | s3c2410_gpio_setpin(S3C2410_GPB(7), cs ? 0 : 1); | 394 | gpio_set_value(S3C2410_GPB(7), cs ? 0 : 1); |
395 | } | 395 | } |
396 | 396 | ||
397 | static struct s3c2410_spigpio_info jive_lcd_spi = { | 397 | static struct s3c2410_spigpio_info jive_lcd_spi = { |
@@ -413,7 +413,7 @@ static struct platform_device jive_device_lcdspi = { | |||
413 | 413 | ||
414 | static void jive_wm8750_chipselect(struct s3c2410_spigpio_info *spi, int cs) | 414 | static void jive_wm8750_chipselect(struct s3c2410_spigpio_info *spi, int cs) |
415 | { | 415 | { |
416 | s3c2410_gpio_setpin(S3C2410_GPH(10), cs ? 0 : 1); | 416 | gpio_set_value(S3C2410_GPH(10), cs ? 0 : 1); |
417 | } | 417 | } |
418 | 418 | ||
419 | static struct s3c2410_spigpio_info jive_wm8750_spi = { | 419 | static struct s3c2410_spigpio_info jive_wm8750_spi = { |
@@ -531,7 +531,7 @@ static void jive_power_off(void) | |||
531 | printk(KERN_INFO "powering system down...\n"); | 531 | printk(KERN_INFO "powering system down...\n"); |
532 | 532 | ||
533 | s3c2410_gpio_setpin(S3C2410_GPC(5), 1); | 533 | s3c2410_gpio_setpin(S3C2410_GPC(5), 1); |
534 | s3c2410_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT); | 534 | s3c_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT); |
535 | } | 535 | } |
536 | 536 | ||
537 | static void __init jive_machine_init(void) | 537 | static void __init jive_machine_init(void) |
@@ -636,22 +636,22 @@ static void __init jive_machine_init(void) | |||
636 | 636 | ||
637 | /* initialise the spi */ | 637 | /* initialise the spi */ |
638 | 638 | ||
639 | s3c2410_gpio_setpin(S3C2410_GPG(13), 0); | 639 | gpio_request(S3C2410_GPG(13), "lcm reset"); |
640 | s3c2410_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPIO_OUTPUT); | 640 | gpio_direction_output(S3C2410_GPG(13), 0); |
641 | 641 | ||
642 | s3c2410_gpio_setpin(S3C2410_GPB(7), 1); | 642 | gpio_request(S3C2410_GPB(7), "jive spi"); |
643 | s3c2410_gpio_cfgpin(S3C2410_GPB(7), S3C2410_GPIO_OUTPUT); | 643 | gpio_direction_output(S3C2410_GPB(7), 1); |
644 | 644 | ||
645 | s3c2410_gpio_setpin(S3C2410_GPB(6), 0); | 645 | s3c2410_gpio_setpin(S3C2410_GPB(6), 0); |
646 | s3c2410_gpio_cfgpin(S3C2410_GPB(6), S3C2410_GPIO_OUTPUT); | 646 | s3c_gpio_cfgpin(S3C2410_GPB(6), S3C2410_GPIO_OUTPUT); |
647 | 647 | ||
648 | s3c2410_gpio_setpin(S3C2410_GPG(8), 1); | 648 | s3c2410_gpio_setpin(S3C2410_GPG(8), 1); |
649 | s3c2410_gpio_cfgpin(S3C2410_GPG(8), S3C2410_GPIO_OUTPUT); | 649 | s3c_gpio_cfgpin(S3C2410_GPG(8), S3C2410_GPIO_OUTPUT); |
650 | 650 | ||
651 | /* initialise the WM8750 spi */ | 651 | /* initialise the WM8750 spi */ |
652 | 652 | ||
653 | s3c2410_gpio_setpin(S3C2410_GPH(10), 1); | 653 | gpio_request(S3C2410_GPH(10), "jive wm8750 spi"); |
654 | s3c2410_gpio_cfgpin(S3C2410_GPH(10), S3C2410_GPIO_OUTPUT); | 654 | gpio_direction_output(S3C2410_GPH(10), 1); |
655 | 655 | ||
656 | /* Turn off suspend on both USB ports, and switch the | 656 | /* Turn off suspend on both USB ports, and switch the |
657 | * selectable USB port to USB device mode. */ | 657 | * selectable USB port to USB device mode. */ |
@@ -674,7 +674,7 @@ static void __init jive_machine_init(void) | |||
674 | } | 674 | } |
675 | 675 | ||
676 | MACHINE_START(JIVE, "JIVE") | 676 | MACHINE_START(JIVE, "JIVE") |
677 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 677 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
678 | .phys_io = S3C2410_PA_UART, | 678 | .phys_io = S3C2410_PA_UART, |
679 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 679 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
680 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 680 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c2412/mach-smdk2413.c index 0392065af1af..ba93a356a839 100644 --- a/arch/arm/mach-s3c2412/mach-smdk2413.c +++ b/arch/arm/mach-s3c2412/mach-smdk2413.c | |||
@@ -85,10 +85,10 @@ static void smdk2413_udc_pullup(enum s3c2410_udc_cmd_e cmd) | |||
85 | switch (cmd) | 85 | switch (cmd) |
86 | { | 86 | { |
87 | case S3C2410_UDC_P_ENABLE : | 87 | case S3C2410_UDC_P_ENABLE : |
88 | s3c2410_gpio_setpin(S3C2410_GPF(2), 1); | 88 | gpio_set_value(S3C2410_GPF(2), 1); |
89 | break; | 89 | break; |
90 | case S3C2410_UDC_P_DISABLE : | 90 | case S3C2410_UDC_P_DISABLE : |
91 | s3c2410_gpio_setpin(S3C2410_GPF(2), 0); | 91 | gpio_set_value(S3C2410_GPF(2), 0); |
92 | break; | 92 | break; |
93 | case S3C2410_UDC_P_RESET : | 93 | case S3C2410_UDC_P_RESET : |
94 | break; | 94 | break; |
@@ -134,8 +134,8 @@ static void __init smdk2413_machine_init(void) | |||
134 | { /* Turn off suspend on both USB ports, and switch the | 134 | { /* Turn off suspend on both USB ports, and switch the |
135 | * selectable USB port to USB device mode. */ | 135 | * selectable USB port to USB device mode. */ |
136 | 136 | ||
137 | s3c2410_gpio_setpin(S3C2410_GPF(2), 0); | 137 | WARN_ON(gpio_request(S3C2410_GPF(2), "udc pull")); |
138 | s3c2410_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); | 138 | gpio_direction_output(S3C2410_GPF(2), 0); |
139 | 139 | ||
140 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | 140 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | |
141 | S3C2410_MISCCR_USBSUSPND0 | | 141 | S3C2410_MISCCR_USBSUSPND0 | |
@@ -150,7 +150,7 @@ static void __init smdk2413_machine_init(void) | |||
150 | } | 150 | } |
151 | 151 | ||
152 | MACHINE_START(S3C2413, "S3C2413") | 152 | MACHINE_START(S3C2413, "S3C2413") |
153 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 153 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
154 | .phys_io = S3C2410_PA_UART, | 154 | .phys_io = S3C2410_PA_UART, |
155 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 155 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
156 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 156 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
@@ -163,7 +163,7 @@ MACHINE_START(S3C2413, "S3C2413") | |||
163 | MACHINE_END | 163 | MACHINE_END |
164 | 164 | ||
165 | MACHINE_START(SMDK2412, "SMDK2412") | 165 | MACHINE_START(SMDK2412, "SMDK2412") |
166 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 166 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
167 | .phys_io = S3C2410_PA_UART, | 167 | .phys_io = S3C2410_PA_UART, |
168 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 168 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
169 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 169 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
@@ -176,7 +176,7 @@ MACHINE_START(SMDK2412, "SMDK2412") | |||
176 | MACHINE_END | 176 | MACHINE_END |
177 | 177 | ||
178 | MACHINE_START(SMDK2413, "SMDK2413") | 178 | MACHINE_START(SMDK2413, "SMDK2413") |
179 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 179 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
180 | .phys_io = S3C2410_PA_UART, | 180 | .phys_io = S3C2410_PA_UART, |
181 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 181 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
182 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 182 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig index 7f465265cf04..cd8e7de388f0 100644 --- a/arch/arm/mach-s3c2440/Kconfig +++ b/arch/arm/mach-s3c2440/Kconfig | |||
@@ -6,6 +6,7 @@ config CPU_S3C2440 | |||
6 | bool | 6 | bool |
7 | depends on ARCH_S3C2410 | 7 | depends on ARCH_S3C2410 |
8 | select CPU_ARM920T | 8 | select CPU_ARM920T |
9 | select S3C_GPIO_PULL_UP | ||
9 | select S3C2410_CLOCK | 10 | select S3C2410_CLOCK |
10 | select S3C2410_PM if PM | 11 | select S3C2410_PM if PM |
11 | select S3C2410_GPIO | 12 | select S3C2410_GPIO |
@@ -187,4 +188,17 @@ config MACH_MINI2440 | |||
187 | Say Y here to select support for the MINI2440. Is a 10cm x 10cm board | 188 | Say Y here to select support for the MINI2440. Is a 10cm x 10cm board |
188 | available via various sources. It can come with a 3.5" or 7" touch LCD. | 189 | available via various sources. It can come with a 3.5" or 7" touch LCD. |
189 | 190 | ||
191 | config MACH_RX1950 | ||
192 | bool "HP iPAQ rx1950" | ||
193 | select CPU_S3C2442 | ||
194 | select S3C24XX_DCLK | ||
195 | select PM_H1940 if PM | ||
196 | select I2C | ||
197 | select S3C2410_PWM | ||
198 | select S3C_DEV_NAND | ||
199 | select S3C2410_IOTIMING if S3C2440_CPUFREQ | ||
200 | select S3C2440_XTAL_16934400 | ||
201 | help | ||
202 | Say Y here if you're using HP iPAQ rx1950 | ||
203 | |||
190 | endmenu | 204 | endmenu |
diff --git a/arch/arm/mach-s3c2440/Makefile b/arch/arm/mach-s3c2440/Makefile index c85ba32d8956..d5440fa34b04 100644 --- a/arch/arm/mach-s3c2440/Makefile +++ b/arch/arm/mach-s3c2440/Makefile | |||
@@ -34,6 +34,7 @@ obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o | |||
34 | obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o | 34 | obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o |
35 | obj-$(CONFIG_MACH_MINI2440) += mach-mini2440.o | 35 | obj-$(CONFIG_MACH_MINI2440) += mach-mini2440.o |
36 | obj-$(CONFIG_MACH_NEO1973_GTA02) += mach-gta02.o | 36 | obj-$(CONFIG_MACH_NEO1973_GTA02) += mach-gta02.o |
37 | obj-$(CONFIG_MACH_RX1950) += mach-rx1950.o | ||
37 | 38 | ||
38 | # extra machine support | 39 | # extra machine support |
39 | 40 | ||
diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c index 571b17683d96..a76bcda210ad 100644 --- a/arch/arm/mach-s3c2440/mach-mini2440.c +++ b/arch/arm/mach-s3c2440/mach-mini2440.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/mtd/nand_ecc.h> | 53 | #include <linux/mtd/nand_ecc.h> |
54 | #include <linux/mtd/partitions.h> | 54 | #include <linux/mtd/partitions.h> |
55 | 55 | ||
56 | #include <plat/gpio-cfg.h> | ||
56 | #include <plat/clock.h> | 57 | #include <plat/clock.h> |
57 | #include <plat/devs.h> | 58 | #include <plat/devs.h> |
58 | #include <plat/cpu.h> | 59 | #include <plat/cpu.h> |
@@ -102,10 +103,10 @@ static void mini2440_udc_pullup(enum s3c2410_udc_cmd_e cmd) | |||
102 | 103 | ||
103 | switch (cmd) { | 104 | switch (cmd) { |
104 | case S3C2410_UDC_P_ENABLE : | 105 | case S3C2410_UDC_P_ENABLE : |
105 | s3c2410_gpio_setpin(S3C2410_GPC(5), 1); | 106 | gpio_set_value(S3C2410_GPC(5), 1); |
106 | break; | 107 | break; |
107 | case S3C2410_UDC_P_DISABLE : | 108 | case S3C2410_UDC_P_DISABLE : |
108 | s3c2410_gpio_setpin(S3C2410_GPC(5), 0); | 109 | gpio_set_value(S3C2410_GPC(5), 0); |
109 | break; | 110 | break; |
110 | case S3C2410_UDC_P_RESET : | 111 | case S3C2410_UDC_P_RESET : |
111 | break; | 112 | break; |
@@ -632,25 +633,25 @@ static void __init mini2440_init(void) | |||
632 | mini2440_parse_features(&features, mini2440_features_str); | 633 | mini2440_parse_features(&features, mini2440_features_str); |
633 | 634 | ||
634 | /* turn LCD on */ | 635 | /* turn LCD on */ |
635 | s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND); | 636 | s3c_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND); |
636 | 637 | ||
637 | /* Turn the backlight early on */ | 638 | /* Turn the backlight early on */ |
638 | s3c2410_gpio_setpin(S3C2410_GPG(4), 1); | 639 | WARN_ON(gpio_request(S3C2410_GPG(4), "backlight")); |
639 | s3c2410_gpio_cfgpin(S3C2410_GPG(4), S3C2410_GPIO_OUTPUT); | 640 | gpio_direction_output(S3C2410_GPG(4), 1); |
640 | 641 | ||
641 | /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */ | 642 | /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */ |
642 | s3c2410_gpio_pullup(S3C2410_GPB(1), 0); | 643 | s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP); |
643 | s3c2410_gpio_setpin(S3C2410_GPB(1), 0); | 644 | s3c2410_gpio_setpin(S3C2410_GPB(1), 0); |
644 | s3c2410_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT); | 645 | s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT); |
645 | 646 | ||
646 | /* Make sure the D+ pullup pin is output */ | 647 | /* Make sure the D+ pullup pin is output */ |
647 | s3c2410_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT); | 648 | WARN_ON(gpio_request(S3C2410_GPC(5), "udc pup")); |
649 | gpio_direction_output(S3C2410_GPC(5), 0); | ||
648 | 650 | ||
649 | /* mark the key as input, without pullups (there is one on the board) */ | 651 | /* mark the key as input, without pullups (there is one on the board) */ |
650 | for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) { | 652 | for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) { |
651 | s3c2410_gpio_pullup(mini2440_buttons[i].gpio, 0); | 653 | s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP); |
652 | s3c2410_gpio_cfgpin(mini2440_buttons[i].gpio, | 654 | s3c_gpio_cfgpin(mini2440_buttons[i].gpio, S3C2410_GPIO_INPUT); |
653 | S3C2410_GPIO_INPUT); | ||
654 | } | 655 | } |
655 | if (features.lcd_index != -1) { | 656 | if (features.lcd_index != -1) { |
656 | int li; | 657 | int li; |
diff --git a/arch/arm/mach-s3c2440/mach-nexcoder.c b/arch/arm/mach-s3c2440/mach-nexcoder.c index 342041593f22..3ff62de45fde 100644 --- a/arch/arm/mach-s3c2440/mach-nexcoder.c +++ b/arch/arm/mach-s3c2440/mach-nexcoder.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <plat/regs-serial.h> | 40 | #include <plat/regs-serial.h> |
41 | #include <plat/iic.h> | 41 | #include <plat/iic.h> |
42 | 42 | ||
43 | #include <plat/gpio-cfg.h> | ||
43 | #include <plat/s3c2410.h> | 44 | #include <plat/s3c2410.h> |
44 | #include <plat/s3c244x.h> | 45 | #include <plat/s3c244x.h> |
45 | #include <plat/clock.h> | 46 | #include <plat/clock.h> |
@@ -122,15 +123,15 @@ static void __init nexcoder_sensorboard_init(void) | |||
122 | { | 123 | { |
123 | // Initialize SCCB bus | 124 | // Initialize SCCB bus |
124 | s3c2410_gpio_setpin(S3C2410_GPE(14), 1); // IICSCL | 125 | s3c2410_gpio_setpin(S3C2410_GPE(14), 1); // IICSCL |
125 | s3c2410_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPIO_OUTPUT); | 126 | s3c_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPIO_OUTPUT); |
126 | s3c2410_gpio_setpin(S3C2410_GPE(15), 1); // IICSDA | 127 | s3c2410_gpio_setpin(S3C2410_GPE(15), 1); // IICSDA |
127 | s3c2410_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPIO_OUTPUT); | 128 | s3c_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPIO_OUTPUT); |
128 | 129 | ||
129 | // Power up the sensor board | 130 | // Power up the sensor board |
130 | s3c2410_gpio_setpin(S3C2410_GPF(1), 1); | 131 | s3c2410_gpio_setpin(S3C2410_GPF(1), 1); |
131 | s3c2410_gpio_cfgpin(S3C2410_GPF(1), S3C2410_GPIO_OUTPUT); // CAM_GPIO7 => nLDO_PWRDN | 132 | s3c_gpio_cfgpin(S3C2410_GPF(1), S3C2410_GPIO_OUTPUT); // CAM_GPIO7 => nLDO_PWRDN |
132 | s3c2410_gpio_setpin(S3C2410_GPF(2), 0); | 133 | s3c2410_gpio_setpin(S3C2410_GPF(2), 0); |
133 | s3c2410_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); // CAM_GPIO6 => CAM_PWRDN | 134 | s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); // CAM_GPIO6 => CAM_PWRDN |
134 | } | 135 | } |
135 | 136 | ||
136 | static void __init nexcoder_map_io(void) | 137 | static void __init nexcoder_map_io(void) |
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c index f35371db33f5..319458da71a0 100644 --- a/arch/arm/mach-s3c2440/mach-osiris.c +++ b/arch/arm/mach-s3c2440/mach-osiris.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/mtd/nand_ecc.h> | 49 | #include <linux/mtd/nand_ecc.h> |
50 | #include <linux/mtd/partitions.h> | 50 | #include <linux/mtd/partitions.h> |
51 | 51 | ||
52 | #include <plat/gpio-cfg.h> | ||
52 | #include <plat/clock.h> | 53 | #include <plat/clock.h> |
53 | #include <plat/devs.h> | 54 | #include <plat/devs.h> |
54 | #include <plat/cpu.h> | 55 | #include <plat/cpu.h> |
@@ -298,7 +299,7 @@ static int osiris_pm_suspend(struct sys_device *sd, pm_message_t state) | |||
298 | 299 | ||
299 | /* ensure that an nRESET is not generated on resume. */ | 300 | /* ensure that an nRESET is not generated on resume. */ |
300 | s3c2410_gpio_setpin(S3C2410_GPA(21), 1); | 301 | s3c2410_gpio_setpin(S3C2410_GPA(21), 1); |
301 | s3c2410_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPIO_OUTPUT); | 302 | s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPIO_OUTPUT); |
302 | 303 | ||
303 | return 0; | 304 | return 0; |
304 | } | 305 | } |
@@ -310,7 +311,7 @@ static int osiris_pm_resume(struct sys_device *sd) | |||
310 | 311 | ||
311 | __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0); | 312 | __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0); |
312 | 313 | ||
313 | s3c2410_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); | 314 | s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); |
314 | 315 | ||
315 | return 0; | 316 | return 0; |
316 | } | 317 | } |
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c new file mode 100644 index 000000000000..8603b577a24b --- /dev/null +++ b/arch/arm/mach-s3c2440/mach-rx1950.c | |||
@@ -0,0 +1,582 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/mach-rx1950.c | ||
2 | * | ||
3 | * Copyright (c) 2006-2009 Victor Chukhantsev, Denis Grigoriev, | ||
4 | * Copyright (c) 2007-2010 Vasily Khoruzhick | ||
5 | * | ||
6 | * based on smdk2440 written by Ben Dooks | ||
7 | * | ||
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. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/delay.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/serial_core.h> | ||
24 | #include <linux/input.h> | ||
25 | #include <linux/gpio_keys.h> | ||
26 | #include <linux/sysdev.h> | ||
27 | #include <linux/pwm_backlight.h> | ||
28 | #include <linux/pwm.h> | ||
29 | |||
30 | #include <linux/mtd/mtd.h> | ||
31 | #include <linux/mtd/partitions.h> | ||
32 | |||
33 | #include <linux/mmc/host.h> | ||
34 | |||
35 | #include <asm/mach/arch.h> | ||
36 | #include <asm/mach/map.h> | ||
37 | #include <asm/mach-types.h> | ||
38 | |||
39 | #include <mach/regs-gpio.h> | ||
40 | #include <mach/regs-gpioj.h> | ||
41 | #include <mach/h1940.h> | ||
42 | #include <mach/fb.h> | ||
43 | |||
44 | #include <plat/clock.h> | ||
45 | #include <plat/regs-serial.h> | ||
46 | #include <plat/regs-iic.h> | ||
47 | #include <plat/mci.h> | ||
48 | #include <plat/udc.h> | ||
49 | #include <plat/nand.h> | ||
50 | #include <plat/iic.h> | ||
51 | #include <plat/devs.h> | ||
52 | #include <plat/cpu.h> | ||
53 | #include <plat/pm.h> | ||
54 | #include <plat/irq.h> | ||
55 | #include <plat/ts.h> | ||
56 | |||
57 | #define LCD_PWM_PERIOD 192960 | ||
58 | #define LCD_PWM_DUTY 127353 | ||
59 | |||
60 | static struct map_desc rx1950_iodesc[] __initdata = { | ||
61 | }; | ||
62 | |||
63 | static struct s3c24xx_uart_clksrc rx1950_serial_clocks[] = { | ||
64 | [0] = { | ||
65 | .name = "fclk", | ||
66 | .divisor = 0x0a, | ||
67 | .min_baud = 0, | ||
68 | .max_baud = 0, | ||
69 | }, | ||
70 | }; | ||
71 | |||
72 | static struct s3c2410_uartcfg rx1950_uartcfgs[] __initdata = { | ||
73 | [0] = { | ||
74 | .hwport = 0, | ||
75 | .flags = 0, | ||
76 | .ucon = 0x3c5, | ||
77 | .ulcon = 0x03, | ||
78 | .ufcon = 0x51, | ||
79 | .clocks = rx1950_serial_clocks, | ||
80 | .clocks_size = ARRAY_SIZE(rx1950_serial_clocks), | ||
81 | }, | ||
82 | [1] = { | ||
83 | .hwport = 1, | ||
84 | .flags = 0, | ||
85 | .ucon = 0x3c5, | ||
86 | .ulcon = 0x03, | ||
87 | .ufcon = 0x51, | ||
88 | .clocks = rx1950_serial_clocks, | ||
89 | .clocks_size = ARRAY_SIZE(rx1950_serial_clocks), | ||
90 | }, | ||
91 | /* IR port */ | ||
92 | [2] = { | ||
93 | .hwport = 2, | ||
94 | .flags = 0, | ||
95 | .ucon = 0x3c5, | ||
96 | .ulcon = 0x43, | ||
97 | .ufcon = 0xf1, | ||
98 | .clocks = rx1950_serial_clocks, | ||
99 | .clocks_size = ARRAY_SIZE(rx1950_serial_clocks), | ||
100 | }, | ||
101 | }; | ||
102 | |||
103 | static struct s3c2410fb_display rx1950_display = { | ||
104 | .type = S3C2410_LCDCON1_TFT, | ||
105 | .width = 240, | ||
106 | .height = 320, | ||
107 | .xres = 240, | ||
108 | .yres = 320, | ||
109 | .bpp = 16, | ||
110 | |||
111 | .pixclock = 260000, | ||
112 | .left_margin = 10, | ||
113 | .right_margin = 20, | ||
114 | .hsync_len = 10, | ||
115 | .upper_margin = 2, | ||
116 | .lower_margin = 2, | ||
117 | .vsync_len = 2, | ||
118 | |||
119 | .lcdcon5 = S3C2410_LCDCON5_FRM565 | | ||
120 | S3C2410_LCDCON5_INVVCLK | | ||
121 | S3C2410_LCDCON5_INVVLINE | | ||
122 | S3C2410_LCDCON5_INVVFRAME | | ||
123 | S3C2410_LCDCON5_HWSWP | | ||
124 | (0x02 << 13) | | ||
125 | (0x02 << 15), | ||
126 | |||
127 | }; | ||
128 | |||
129 | static struct s3c2410fb_mach_info rx1950_lcd_cfg = { | ||
130 | .displays = &rx1950_display, | ||
131 | .num_displays = 1, | ||
132 | .default_display = 0, | ||
133 | |||
134 | .lpcsel = 0x02, | ||
135 | .gpccon = 0xaa9556a9, | ||
136 | .gpccon_mask = 0xffc003fc, | ||
137 | .gpcup = 0x0000ffff, | ||
138 | .gpcup_mask = 0xffffffff, | ||
139 | |||
140 | .gpdcon = 0xaa90aaa1, | ||
141 | .gpdcon_mask = 0xffc0fff0, | ||
142 | .gpdup = 0x0000fcfd, | ||
143 | .gpdup_mask = 0xffffffff, | ||
144 | |||
145 | }; | ||
146 | |||
147 | static struct pwm_device *lcd_pwm; | ||
148 | |||
149 | void rx1950_lcd_power(int enable) | ||
150 | { | ||
151 | int i; | ||
152 | static int enabled; | ||
153 | if (enabled == enable) | ||
154 | return; | ||
155 | if (!enable) { | ||
156 | |||
157 | /* GPC11-GPC15->OUTPUT */ | ||
158 | for (i = 11; i < 16; i++) | ||
159 | gpio_direction_output(S3C2410_GPC(i), 1); | ||
160 | |||
161 | /* Wait a bit here... */ | ||
162 | mdelay(100); | ||
163 | |||
164 | /* GPD2-GPD7->OUTPUT */ | ||
165 | /* GPD11-GPD15->OUTPUT */ | ||
166 | /* GPD2-GPD7->1, GPD11-GPD15->1 */ | ||
167 | for (i = 2; i < 8; i++) | ||
168 | gpio_direction_output(S3C2410_GPD(i), 1); | ||
169 | for (i = 11; i < 16; i++) | ||
170 | gpio_direction_output(S3C2410_GPD(i), 1); | ||
171 | |||
172 | /* Wait a bit here...*/ | ||
173 | mdelay(100); | ||
174 | |||
175 | /* GPB0->OUTPUT, GPB0->0 */ | ||
176 | gpio_direction_output(S3C2410_GPB(0), 0); | ||
177 | |||
178 | /* GPC1-GPC4->OUTPUT, GPC1-4->0 */ | ||
179 | for (i = 1; i < 5; i++) | ||
180 | gpio_direction_output(S3C2410_GPC(i), 0); | ||
181 | |||
182 | /* GPC15-GPC11->0 */ | ||
183 | for (i = 11; i < 16; i++) | ||
184 | gpio_direction_output(S3C2410_GPC(i), 0); | ||
185 | |||
186 | /* GPD15-GPD11->0, GPD2->GPD7->0 */ | ||
187 | for (i = 11; i < 16; i++) | ||
188 | gpio_direction_output(S3C2410_GPD(i), 0); | ||
189 | |||
190 | for (i = 2; i < 8; i++) | ||
191 | gpio_direction_output(S3C2410_GPD(i), 0); | ||
192 | |||
193 | /* GPC6->0, GPC7->0, GPC5->0 */ | ||
194 | gpio_direction_output(S3C2410_GPC(6), 0); | ||
195 | gpio_direction_output(S3C2410_GPC(7), 0); | ||
196 | gpio_direction_output(S3C2410_GPC(5), 0); | ||
197 | |||
198 | /* GPB1->OUTPUT, GPB1->0 */ | ||
199 | gpio_direction_output(S3C2410_GPB(1), 0); | ||
200 | pwm_config(lcd_pwm, 0, LCD_PWM_PERIOD); | ||
201 | pwm_disable(lcd_pwm); | ||
202 | |||
203 | /* GPC0->0, GPC10->0 */ | ||
204 | gpio_direction_output(S3C2410_GPC(0), 0); | ||
205 | gpio_direction_output(S3C2410_GPC(10), 0); | ||
206 | } else { | ||
207 | pwm_config(lcd_pwm, LCD_PWM_DUTY, LCD_PWM_PERIOD); | ||
208 | pwm_enable(lcd_pwm); | ||
209 | |||
210 | gpio_direction_output(S3C2410_GPC(0), 1); | ||
211 | gpio_direction_output(S3C2410_GPC(5), 1); | ||
212 | |||
213 | s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPB1_TOUT1); | ||
214 | gpio_direction_output(S3C2410_GPC(7), 1); | ||
215 | |||
216 | for (i = 1; i < 5; i++) | ||
217 | s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2)); | ||
218 | |||
219 | for (i = 11; i < 16; i++) | ||
220 | s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2)); | ||
221 | |||
222 | for (i = 2; i < 8; i++) | ||
223 | s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2)); | ||
224 | |||
225 | for (i = 11; i < 16; i++) | ||
226 | s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2)); | ||
227 | |||
228 | gpio_direction_output(S3C2410_GPC(10), 1); | ||
229 | gpio_direction_output(S3C2410_GPC(6), 1); | ||
230 | } | ||
231 | enabled = enable; | ||
232 | } | ||
233 | |||
234 | static void rx1950_bl_power(int enable) | ||
235 | { | ||
236 | static int enabled; | ||
237 | if (enabled == enable) | ||
238 | return; | ||
239 | if (!enable) { | ||
240 | gpio_direction_output(S3C2410_GPB(0), 0); | ||
241 | } else { | ||
242 | /* LED driver need a "push" to power on */ | ||
243 | gpio_direction_output(S3C2410_GPB(0), 1); | ||
244 | /* Warm up backlight for one period of PWM. | ||
245 | * Without this trick its almost impossible to | ||
246 | * enable backlight with low brightness value | ||
247 | */ | ||
248 | ndelay(48000); | ||
249 | s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); | ||
250 | } | ||
251 | enabled = enable; | ||
252 | } | ||
253 | |||
254 | static int rx1950_backlight_init(struct device *dev) | ||
255 | { | ||
256 | WARN_ON(gpio_request(S3C2410_GPB(0), "Backlight")); | ||
257 | lcd_pwm = pwm_request(1, "RX1950 LCD"); | ||
258 | if (IS_ERR(lcd_pwm)) { | ||
259 | dev_err(dev, "Unable to request PWM for LCD power!\n"); | ||
260 | return PTR_ERR(lcd_pwm); | ||
261 | } | ||
262 | |||
263 | rx1950_lcd_power(1); | ||
264 | rx1950_bl_power(1); | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | static void rx1950_backlight_exit(struct device *dev) | ||
270 | { | ||
271 | rx1950_bl_power(0); | ||
272 | rx1950_lcd_power(0); | ||
273 | |||
274 | pwm_free(lcd_pwm); | ||
275 | gpio_free(S3C2410_GPB(0)); | ||
276 | } | ||
277 | |||
278 | |||
279 | static int rx1950_backlight_notify(struct device *dev, int brightness) | ||
280 | { | ||
281 | if (!brightness) { | ||
282 | rx1950_bl_power(0); | ||
283 | rx1950_lcd_power(0); | ||
284 | } else { | ||
285 | rx1950_lcd_power(1); | ||
286 | rx1950_bl_power(1); | ||
287 | } | ||
288 | return brightness; | ||
289 | } | ||
290 | |||
291 | static struct platform_pwm_backlight_data rx1950_backlight_data = { | ||
292 | .pwm_id = 0, | ||
293 | .max_brightness = 24, | ||
294 | .dft_brightness = 4, | ||
295 | .pwm_period_ns = 48000, | ||
296 | .init = rx1950_backlight_init, | ||
297 | .notify = rx1950_backlight_notify, | ||
298 | .exit = rx1950_backlight_exit, | ||
299 | }; | ||
300 | |||
301 | static struct platform_device rx1950_backlight = { | ||
302 | .name = "pwm-backlight", | ||
303 | .dev = { | ||
304 | .parent = &s3c_device_timer[0].dev, | ||
305 | .platform_data = &rx1950_backlight_data, | ||
306 | }, | ||
307 | }; | ||
308 | |||
309 | static void rx1950_set_mmc_power(unsigned char power_mode, unsigned short vdd) | ||
310 | { | ||
311 | switch (power_mode) { | ||
312 | case MMC_POWER_OFF: | ||
313 | gpio_direction_output(S3C2410_GPJ(1), 0); | ||
314 | break; | ||
315 | case MMC_POWER_UP: | ||
316 | case MMC_POWER_ON: | ||
317 | gpio_direction_output(S3C2410_GPJ(1), 1); | ||
318 | break; | ||
319 | default: | ||
320 | break; | ||
321 | } | ||
322 | } | ||
323 | |||
324 | static struct s3c24xx_mci_pdata rx1950_mmc_cfg __initdata = { | ||
325 | .gpio_detect = S3C2410_GPF(5), | ||
326 | .gpio_wprotect = S3C2410_GPH(8), | ||
327 | .set_power = rx1950_set_mmc_power, | ||
328 | .ocr_avail = MMC_VDD_32_33, | ||
329 | }; | ||
330 | |||
331 | static struct mtd_partition rx1950_nand_part[] = { | ||
332 | [0] = { | ||
333 | .name = "Boot0", | ||
334 | .offset = 0, | ||
335 | .size = 0x4000, | ||
336 | .mask_flags = MTD_WRITEABLE, | ||
337 | }, | ||
338 | [1] = { | ||
339 | .name = "Boot1", | ||
340 | .offset = MTDPART_OFS_APPEND, | ||
341 | .size = 0x40000, | ||
342 | .mask_flags = MTD_WRITEABLE, | ||
343 | }, | ||
344 | [2] = { | ||
345 | .name = "Kernel", | ||
346 | .offset = MTDPART_OFS_APPEND, | ||
347 | .size = 0x300000, | ||
348 | .mask_flags = 0, | ||
349 | }, | ||
350 | [3] = { | ||
351 | .name = "Filesystem", | ||
352 | .offset = MTDPART_OFS_APPEND, | ||
353 | .size = MTDPART_SIZ_FULL, | ||
354 | .mask_flags = 0, | ||
355 | }, | ||
356 | }; | ||
357 | |||
358 | static struct s3c2410_nand_set rx1950_nand_sets[] = { | ||
359 | [0] = { | ||
360 | .name = "Internal", | ||
361 | .nr_chips = 1, | ||
362 | .nr_partitions = ARRAY_SIZE(rx1950_nand_part), | ||
363 | .partitions = rx1950_nand_part, | ||
364 | }, | ||
365 | }; | ||
366 | |||
367 | static struct s3c2410_platform_nand rx1950_nand_info = { | ||
368 | .tacls = 25, | ||
369 | .twrph0 = 50, | ||
370 | .twrph1 = 15, | ||
371 | .nr_sets = ARRAY_SIZE(rx1950_nand_sets), | ||
372 | .sets = rx1950_nand_sets, | ||
373 | }; | ||
374 | |||
375 | static void rx1950_udc_pullup(enum s3c2410_udc_cmd_e cmd) | ||
376 | { | ||
377 | switch (cmd) { | ||
378 | case S3C2410_UDC_P_ENABLE: | ||
379 | gpio_direction_output(S3C2410_GPJ(5), 1); | ||
380 | break; | ||
381 | case S3C2410_UDC_P_DISABLE: | ||
382 | gpio_direction_output(S3C2410_GPJ(5), 0); | ||
383 | break; | ||
384 | case S3C2410_UDC_P_RESET: | ||
385 | break; | ||
386 | default: | ||
387 | break; | ||
388 | } | ||
389 | } | ||
390 | |||
391 | static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = { | ||
392 | .udc_command = rx1950_udc_pullup, | ||
393 | .vbus_pin = S3C2410_GPG(5), | ||
394 | .vbus_pin_inverted = 1, | ||
395 | }; | ||
396 | |||
397 | static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = { | ||
398 | .delay = 10000, | ||
399 | .presc = 49, | ||
400 | .oversampling_shift = 3, | ||
401 | }; | ||
402 | |||
403 | static struct gpio_keys_button rx1950_gpio_keys_table[] = { | ||
404 | { | ||
405 | .code = KEY_POWER, | ||
406 | .gpio = S3C2410_GPF(0), | ||
407 | .active_low = 1, | ||
408 | .desc = "Power button", | ||
409 | .wakeup = 1, | ||
410 | }, | ||
411 | { | ||
412 | .code = KEY_F5, | ||
413 | .gpio = S3C2410_GPF(7), | ||
414 | .active_low = 1, | ||
415 | .desc = "Record button", | ||
416 | }, | ||
417 | { | ||
418 | .code = KEY_F1, | ||
419 | .gpio = S3C2410_GPG(0), | ||
420 | .active_low = 1, | ||
421 | .desc = "Calendar button", | ||
422 | }, | ||
423 | { | ||
424 | .code = KEY_F2, | ||
425 | .gpio = S3C2410_GPG(2), | ||
426 | .active_low = 1, | ||
427 | .desc = "Contacts button", | ||
428 | }, | ||
429 | { | ||
430 | .code = KEY_F3, | ||
431 | .gpio = S3C2410_GPG(3), | ||
432 | .active_low = 1, | ||
433 | .desc = "Mail button", | ||
434 | }, | ||
435 | { | ||
436 | .code = KEY_F4, | ||
437 | .gpio = S3C2410_GPG(7), | ||
438 | .active_low = 1, | ||
439 | .desc = "WLAN button", | ||
440 | }, | ||
441 | { | ||
442 | .code = KEY_LEFT, | ||
443 | .gpio = S3C2410_GPG(10), | ||
444 | .active_low = 1, | ||
445 | .desc = "Left button", | ||
446 | }, | ||
447 | { | ||
448 | .code = KEY_RIGHT, | ||
449 | .gpio = S3C2410_GPG(11), | ||
450 | .active_low = 1, | ||
451 | .desc = "Right button", | ||
452 | }, | ||
453 | { | ||
454 | .code = KEY_UP, | ||
455 | .gpio = S3C2410_GPG(4), | ||
456 | .active_low = 1, | ||
457 | .desc = "Up button", | ||
458 | }, | ||
459 | { | ||
460 | .code = KEY_DOWN, | ||
461 | .gpio = S3C2410_GPG(6), | ||
462 | .active_low = 1, | ||
463 | .desc = "Down button", | ||
464 | }, | ||
465 | { | ||
466 | .code = KEY_ENTER, | ||
467 | .gpio = S3C2410_GPG(9), | ||
468 | .active_low = 1, | ||
469 | .desc = "Ok button" | ||
470 | }, | ||
471 | }; | ||
472 | |||
473 | static struct gpio_keys_platform_data rx1950_gpio_keys_data = { | ||
474 | .buttons = rx1950_gpio_keys_table, | ||
475 | .nbuttons = ARRAY_SIZE(rx1950_gpio_keys_table), | ||
476 | }; | ||
477 | |||
478 | static struct platform_device rx1950_device_gpiokeys = { | ||
479 | .name = "gpio-keys", | ||
480 | .dev.platform_data = &rx1950_gpio_keys_data, | ||
481 | }; | ||
482 | |||
483 | static struct s3c2410_platform_i2c rx1950_i2c_data = { | ||
484 | .flags = 0, | ||
485 | .slave_addr = 0x42, | ||
486 | .frequency = 400 * 1000, | ||
487 | .sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON, | ||
488 | }; | ||
489 | |||
490 | static struct platform_device *rx1950_devices[] __initdata = { | ||
491 | &s3c_device_lcd, | ||
492 | &s3c_device_wdt, | ||
493 | &s3c_device_i2c0, | ||
494 | &s3c_device_iis, | ||
495 | &s3c_device_usbgadget, | ||
496 | &s3c_device_rtc, | ||
497 | &s3c_device_nand, | ||
498 | &s3c_device_sdi, | ||
499 | &s3c_device_adc, | ||
500 | &s3c_device_ts, | ||
501 | &s3c_device_timer[0], | ||
502 | &s3c_device_timer[1], | ||
503 | &rx1950_backlight, | ||
504 | &rx1950_device_gpiokeys, | ||
505 | }; | ||
506 | |||
507 | static struct clk *rx1950_clocks[] __initdata = { | ||
508 | &s3c24xx_clkout0, | ||
509 | &s3c24xx_clkout1, | ||
510 | }; | ||
511 | |||
512 | static void __init rx1950_map_io(void) | ||
513 | { | ||
514 | s3c24xx_clkout0.parent = &clk_h; | ||
515 | s3c24xx_clkout1.parent = &clk_f; | ||
516 | |||
517 | s3c24xx_register_clocks(rx1950_clocks, ARRAY_SIZE(rx1950_clocks)); | ||
518 | |||
519 | s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); | ||
520 | s3c24xx_init_clocks(16934000); | ||
521 | s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); | ||
522 | |||
523 | /* setup PM */ | ||
524 | |||
525 | #ifdef CONFIG_PM_H1940 | ||
526 | memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 8); | ||
527 | #endif | ||
528 | |||
529 | s3c_pm_init(); | ||
530 | } | ||
531 | |||
532 | static void __init rx1950_init_machine(void) | ||
533 | { | ||
534 | int i; | ||
535 | |||
536 | s3c24xx_fb_set_platdata(&rx1950_lcd_cfg); | ||
537 | s3c24xx_udc_set_platdata(&rx1950_udc_cfg); | ||
538 | s3c24xx_ts_set_platdata(&rx1950_ts_cfg); | ||
539 | s3c24xx_mci_set_platdata(&rx1950_mmc_cfg); | ||
540 | s3c_i2c0_set_platdata(&rx1950_i2c_data); | ||
541 | s3c_nand_set_platdata(&rx1950_nand_info); | ||
542 | |||
543 | /* Turn off suspend on both USB ports, and switch the | ||
544 | * selectable USB port to USB device mode. */ | ||
545 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | | ||
546 | S3C2410_MISCCR_USBSUSPND0 | | ||
547 | S3C2410_MISCCR_USBSUSPND1, 0x0); | ||
548 | |||
549 | WARN_ON(gpio_request(S3C2410_GPJ(5), "UDC pullup")); | ||
550 | gpio_direction_output(S3C2410_GPJ(5), 0); | ||
551 | |||
552 | /* mmc power is disabled by default */ | ||
553 | WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power")); | ||
554 | gpio_direction_output(S3C2410_GPJ(1), 0); | ||
555 | |||
556 | for (i = 0; i < 8; i++) | ||
557 | WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power")); | ||
558 | |||
559 | for (i = 10; i < 16; i++) | ||
560 | WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power")); | ||
561 | |||
562 | for (i = 2; i < 8; i++) | ||
563 | WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power")); | ||
564 | |||
565 | for (i = 11; i < 16; i++) | ||
566 | WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power")); | ||
567 | |||
568 | WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power")); | ||
569 | |||
570 | platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices)); | ||
571 | } | ||
572 | |||
573 | MACHINE_START(RX1950, "HP iPAQ RX1950") | ||
574 | /* Maintainers: Vasily Khoruzhick */ | ||
575 | .phys_io = S3C2410_PA_UART, | ||
576 | .io_pg_offst = (((u32) S3C24XX_VA_UART) >> 18) & 0xfffc, | ||
577 | .boot_params = S3C2410_SDRAM_PA + 0x100, | ||
578 | .map_io = rx1950_map_io, | ||
579 | .init_irq = s3c24xx_init_irq, | ||
580 | .init_machine = rx1950_init_machine, | ||
581 | .timer = &s3c24xx_timer, | ||
582 | MACHINE_END | ||
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c index 1e836e506f8b..d2946de3f365 100644 --- a/arch/arm/mach-s3c2440/mach-rx3715.c +++ b/arch/arm/mach-s3c2440/mach-rx3715.c | |||
@@ -209,7 +209,7 @@ static void __init rx3715_init_machine(void) | |||
209 | } | 209 | } |
210 | 210 | ||
211 | MACHINE_START(RX3715, "IPAQ-RX3715") | 211 | MACHINE_START(RX3715, "IPAQ-RX3715") |
212 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 212 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
213 | .phys_io = S3C2410_PA_UART, | 213 | .phys_io = S3C2410_PA_UART, |
214 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 214 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
215 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 215 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2440/mach-smdk2440.c b/arch/arm/mach-s3c2440/mach-smdk2440.c index 3ac3d636d615..df83276d85ae 100644 --- a/arch/arm/mach-s3c2440/mach-smdk2440.c +++ b/arch/arm/mach-s3c2440/mach-smdk2440.c | |||
@@ -174,7 +174,7 @@ static void __init smdk2440_machine_init(void) | |||
174 | } | 174 | } |
175 | 175 | ||
176 | MACHINE_START(S3C2440, "SMDK2440") | 176 | MACHINE_START(S3C2440, "SMDK2440") |
177 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 177 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
178 | .phys_io = S3C2410_PA_UART, | 178 | .phys_io = S3C2410_PA_UART, |
179 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 179 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
180 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 180 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c2440/s3c2440.c b/arch/arm/mach-s3c2440/s3c2440.c index 2b68f7ea45ae..d50f3ae6173d 100644 --- a/arch/arm/mach-s3c2440/s3c2440.c +++ b/arch/arm/mach-s3c2440/s3c2440.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/serial_core.h> | 20 | #include <linux/serial_core.h> |
21 | #include <linux/sysdev.h> | 21 | #include <linux/sysdev.h> |
22 | #include <linux/gpio.h> | ||
22 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
23 | #include <linux/io.h> | 24 | #include <linux/io.h> |
24 | 25 | ||
@@ -33,6 +34,10 @@ | |||
33 | #include <plat/cpu.h> | 34 | #include <plat/cpu.h> |
34 | #include <plat/s3c244x.h> | 35 | #include <plat/s3c244x.h> |
35 | 36 | ||
37 | #include <plat/gpio-core.h> | ||
38 | #include <plat/gpio-cfg.h> | ||
39 | #include <plat/gpio-cfg-helpers.h> | ||
40 | |||
36 | static struct sys_device s3c2440_sysdev = { | 41 | static struct sys_device s3c2440_sysdev = { |
37 | .cls = &s3c2440_sysclass, | 42 | .cls = &s3c2440_sysclass, |
38 | }; | 43 | }; |
@@ -41,6 +46,9 @@ int __init s3c2440_init(void) | |||
41 | { | 46 | { |
42 | printk("S3C2440: Initialising architecture\n"); | 47 | printk("S3C2440: Initialising architecture\n"); |
43 | 48 | ||
49 | s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up; | ||
50 | s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up; | ||
51 | |||
44 | /* change irq for watchdog */ | 52 | /* change irq for watchdog */ |
45 | 53 | ||
46 | s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT; | 54 | s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT; |
diff --git a/arch/arm/mach-s3c2443/mach-smdk2443.c b/arch/arm/mach-s3c2443/mach-smdk2443.c index e2e362bda9b7..4c863d3a52f4 100644 --- a/arch/arm/mach-s3c2443/mach-smdk2443.c +++ b/arch/arm/mach-s3c2443/mach-smdk2443.c | |||
@@ -131,7 +131,7 @@ static void __init smdk2443_machine_init(void) | |||
131 | } | 131 | } |
132 | 132 | ||
133 | MACHINE_START(SMDK2443, "SMDK2443") | 133 | MACHINE_START(SMDK2443, "SMDK2443") |
134 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 134 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
135 | .phys_io = S3C2410_PA_UART, | 135 | .phys_io = S3C2410_PA_UART, |
136 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 136 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
137 | .boot_params = S3C2410_SDRAM_PA + 0x100, | 137 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c index 2ac2e7d73e53..7a4138beb665 100644 --- a/arch/arm/mach-s3c64xx/clock.c +++ b/arch/arm/mach-s3c64xx/clock.c | |||
@@ -88,6 +88,12 @@ struct clk clk_48m = { | |||
88 | .enable = clk_48m_ctrl, | 88 | .enable = clk_48m_ctrl, |
89 | }; | 89 | }; |
90 | 90 | ||
91 | struct clk clk_xusbxti = { | ||
92 | .name = "xusbxti", | ||
93 | .id = -1, | ||
94 | .rate = 48000000, | ||
95 | }; | ||
96 | |||
91 | static int inline s3c64xx_gate(void __iomem *reg, | 97 | static int inline s3c64xx_gate(void __iomem *reg, |
92 | struct clk *clk, | 98 | struct clk *clk, |
93 | int enable) | 99 | int enable) |
@@ -518,6 +524,11 @@ static struct clk clk_iis_cd1 = { | |||
518 | .id = -1, | 524 | .id = -1, |
519 | }; | 525 | }; |
520 | 526 | ||
527 | static struct clk clk_iisv4_cd = { | ||
528 | .name = "iis_cdclk_v4", | ||
529 | .id = -1, | ||
530 | }; | ||
531 | |||
521 | static struct clk clk_pcm_cd = { | 532 | static struct clk clk_pcm_cd = { |
522 | .name = "pcm_cdclk", | 533 | .name = "pcm_cdclk", |
523 | .id = -1, | 534 | .id = -1, |
@@ -549,6 +560,19 @@ static struct clksrc_sources clkset_audio1 = { | |||
549 | .nr_sources = ARRAY_SIZE(clkset_audio1_list), | 560 | .nr_sources = ARRAY_SIZE(clkset_audio1_list), |
550 | }; | 561 | }; |
551 | 562 | ||
563 | static struct clk *clkset_audio2_list[] = { | ||
564 | [0] = &clk_mout_epll.clk, | ||
565 | [1] = &clk_dout_mpll, | ||
566 | [2] = &clk_fin_epll, | ||
567 | [3] = &clk_iisv4_cd, | ||
568 | [4] = &clk_pcm_cd, | ||
569 | }; | ||
570 | |||
571 | static struct clksrc_sources clkset_audio2 = { | ||
572 | .sources = clkset_audio2_list, | ||
573 | .nr_sources = ARRAY_SIZE(clkset_audio2_list), | ||
574 | }; | ||
575 | |||
552 | static struct clk *clkset_camif_list[] = { | 576 | static struct clk *clkset_camif_list[] = { |
553 | &clk_h2, | 577 | &clk_h2, |
554 | }; | 578 | }; |
@@ -652,6 +676,16 @@ static struct clksrc_clk clksrcs[] = { | |||
652 | .sources = &clkset_audio1, | 676 | .sources = &clkset_audio1, |
653 | }, { | 677 | }, { |
654 | .clk = { | 678 | .clk = { |
679 | .name = "audio-bus", | ||
680 | .id = -1, /* There's only one IISv4 port */ | ||
681 | .ctrlbit = S3C6410_CLKCON_SCLK_AUDIO2, | ||
682 | .enable = s3c64xx_sclk_ctrl, | ||
683 | }, | ||
684 | .reg_src = { .reg = S3C6410_CLK_SRC2, .shift = 0, .size = 3 }, | ||
685 | .reg_div = { .reg = S3C_CLK_DIV2, .shift = 24, .size = 4 }, | ||
686 | .sources = &clkset_audio2, | ||
687 | }, { | ||
688 | .clk = { | ||
655 | .name = "irda-bus", | 689 | .name = "irda-bus", |
656 | .id = 0, | 690 | .id = 0, |
657 | .ctrlbit = S3C_CLKCON_SCLK_IRDA, | 691 | .ctrlbit = S3C_CLKCON_SCLK_IRDA, |
@@ -749,6 +783,7 @@ static struct clk *clks1[] __initdata = { | |||
749 | &clk_ext_xtal_mux, | 783 | &clk_ext_xtal_mux, |
750 | &clk_iis_cd0, | 784 | &clk_iis_cd0, |
751 | &clk_iis_cd1, | 785 | &clk_iis_cd1, |
786 | &clk_iisv4_cd, | ||
752 | &clk_pcm_cd, | 787 | &clk_pcm_cd, |
753 | &clk_mout_epll.clk, | 788 | &clk_mout_epll.clk, |
754 | &clk_mout_mpll.clk, | 789 | &clk_mout_mpll.clk, |
@@ -762,6 +797,7 @@ static struct clk *clks[] __initdata = { | |||
762 | &clk_27m, | 797 | &clk_27m, |
763 | &clk_48m, | 798 | &clk_48m, |
764 | &clk_h2, | 799 | &clk_h2, |
800 | &clk_xusbxti, | ||
765 | }; | 801 | }; |
766 | 802 | ||
767 | /** | 803 | /** |
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c index 33ccf7bf766a..5567e037b0d1 100644 --- a/arch/arm/mach-s3c64xx/dma.c +++ b/arch/arm/mach-s3c64xx/dma.c | |||
@@ -414,7 +414,7 @@ err_buff: | |||
414 | EXPORT_SYMBOL(s3c2410_dma_enqueue); | 414 | EXPORT_SYMBOL(s3c2410_dma_enqueue); |
415 | 415 | ||
416 | 416 | ||
417 | int s3c2410_dma_devconfig(int channel, | 417 | int s3c2410_dma_devconfig(unsigned int channel, |
418 | enum s3c2410_dmasrc source, | 418 | enum s3c2410_dmasrc source, |
419 | unsigned long devaddr) | 419 | unsigned long devaddr) |
420 | { | 420 | { |
diff --git a/arch/arm/mach-s3c64xx/gpiolib.c b/arch/arm/mach-s3c64xx/gpiolib.c index 66e6794481d2..60c929a3cab6 100644 --- a/arch/arm/mach-s3c64xx/gpiolib.c +++ b/arch/arm/mach-s3c64xx/gpiolib.c | |||
@@ -51,6 +51,7 @@ | |||
51 | 51 | ||
52 | static struct s3c_gpio_cfg gpio_4bit_cfg_noint = { | 52 | static struct s3c_gpio_cfg gpio_4bit_cfg_noint = { |
53 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, | 53 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, |
54 | .get_config = s3c_gpio_getcfg_s3c64xx_4bit, | ||
54 | .set_pull = s3c_gpio_setpull_updown, | 55 | .set_pull = s3c_gpio_setpull_updown, |
55 | .get_pull = s3c_gpio_getpull_updown, | 56 | .get_pull = s3c_gpio_getpull_updown, |
56 | }; | 57 | }; |
@@ -58,12 +59,14 @@ static struct s3c_gpio_cfg gpio_4bit_cfg_noint = { | |||
58 | static struct s3c_gpio_cfg gpio_4bit_cfg_eint0111 = { | 59 | static struct s3c_gpio_cfg gpio_4bit_cfg_eint0111 = { |
59 | .cfg_eint = 7, | 60 | .cfg_eint = 7, |
60 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, | 61 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, |
62 | .get_config = s3c_gpio_getcfg_s3c64xx_4bit, | ||
61 | .set_pull = s3c_gpio_setpull_updown, | 63 | .set_pull = s3c_gpio_setpull_updown, |
62 | .get_pull = s3c_gpio_getpull_updown, | 64 | .get_pull = s3c_gpio_getpull_updown, |
63 | }; | 65 | }; |
64 | 66 | ||
65 | static struct s3c_gpio_cfg gpio_4bit_cfg_eint0011 = { | 67 | static struct s3c_gpio_cfg gpio_4bit_cfg_eint0011 = { |
66 | .cfg_eint = 3, | 68 | .cfg_eint = 3, |
69 | .get_config = s3c_gpio_getcfg_s3c64xx_4bit, | ||
67 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, | 70 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, |
68 | .set_pull = s3c_gpio_setpull_updown, | 71 | .set_pull = s3c_gpio_setpull_updown, |
69 | .get_pull = s3c_gpio_getpull_updown, | 72 | .get_pull = s3c_gpio_getpull_updown, |
@@ -171,6 +174,7 @@ static struct s3c_gpio_chip gpio_4bit2[] = { | |||
171 | 174 | ||
172 | static struct s3c_gpio_cfg gpio_2bit_cfg_noint = { | 175 | static struct s3c_gpio_cfg gpio_2bit_cfg_noint = { |
173 | .set_config = s3c_gpio_setcfg_s3c24xx, | 176 | .set_config = s3c_gpio_setcfg_s3c24xx, |
177 | .get_config = s3c_gpio_getcfg_s3c24xx, | ||
174 | .set_pull = s3c_gpio_setpull_updown, | 178 | .set_pull = s3c_gpio_setpull_updown, |
175 | .get_pull = s3c_gpio_getpull_updown, | 179 | .get_pull = s3c_gpio_getpull_updown, |
176 | }; | 180 | }; |
@@ -178,6 +182,7 @@ static struct s3c_gpio_cfg gpio_2bit_cfg_noint = { | |||
178 | static struct s3c_gpio_cfg gpio_2bit_cfg_eint10 = { | 182 | static struct s3c_gpio_cfg gpio_2bit_cfg_eint10 = { |
179 | .cfg_eint = 2, | 183 | .cfg_eint = 2, |
180 | .set_config = s3c_gpio_setcfg_s3c24xx, | 184 | .set_config = s3c_gpio_setcfg_s3c24xx, |
185 | .get_config = s3c_gpio_getcfg_s3c24xx, | ||
181 | .set_pull = s3c_gpio_setpull_updown, | 186 | .set_pull = s3c_gpio_setpull_updown, |
182 | .get_pull = s3c_gpio_getpull_updown, | 187 | .get_pull = s3c_gpio_getpull_updown, |
183 | }; | 188 | }; |
@@ -185,6 +190,7 @@ static struct s3c_gpio_cfg gpio_2bit_cfg_eint10 = { | |||
185 | static struct s3c_gpio_cfg gpio_2bit_cfg_eint11 = { | 190 | static struct s3c_gpio_cfg gpio_2bit_cfg_eint11 = { |
186 | .cfg_eint = 3, | 191 | .cfg_eint = 3, |
187 | .set_config = s3c_gpio_setcfg_s3c24xx, | 192 | .set_config = s3c_gpio_setcfg_s3c24xx, |
193 | .get_config = s3c_gpio_getcfg_s3c24xx, | ||
188 | .set_pull = s3c_gpio_setpull_updown, | 194 | .set_pull = s3c_gpio_setpull_updown, |
189 | .get_pull = s3c_gpio_getpull_updown, | 195 | .get_pull = s3c_gpio_getpull_updown, |
190 | }; | 196 | }; |
diff --git a/arch/arm/mach-s3c64xx/include/mach/regs-clock.h b/arch/arm/mach-s3c64xx/include/mach/regs-clock.h index 3ef62741e5d1..0114eb0c1fe7 100644 --- a/arch/arm/mach-s3c64xx/include/mach/regs-clock.h +++ b/arch/arm/mach-s3c64xx/include/mach/regs-clock.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #define S3C_PCLK_GATE S3C_CLKREG(0x34) | 33 | #define S3C_PCLK_GATE S3C_CLKREG(0x34) |
34 | #define S3C_SCLK_GATE S3C_CLKREG(0x38) | 34 | #define S3C_SCLK_GATE S3C_CLKREG(0x38) |
35 | #define S3C_MEM0_GATE S3C_CLKREG(0x3C) | 35 | #define S3C_MEM0_GATE S3C_CLKREG(0x3C) |
36 | #define S3C6410_CLK_SRC2 S3C_CLKREG(0x10C) | ||
36 | 37 | ||
37 | /* CLKDIV0 */ | 38 | /* CLKDIV0 */ |
38 | #define S3C6400_CLKDIV0_PCLK_MASK (0xf << 12) | 39 | #define S3C6400_CLKDIV0_PCLK_MASK (0xf << 12) |
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c index f7b18983950c..59916676d8d2 100644 --- a/arch/arm/mach-s3c64xx/mach-smdk6400.c +++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c | |||
@@ -84,7 +84,7 @@ static void __init smdk6400_machine_init(void) | |||
84 | } | 84 | } |
85 | 85 | ||
86 | MACHINE_START(SMDK6400, "SMDK6400") | 86 | MACHINE_START(SMDK6400, "SMDK6400") |
87 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 87 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
88 | .phys_io = S3C_PA_UART & 0xfff00000, | 88 | .phys_io = S3C_PA_UART & 0xfff00000, |
89 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, | 89 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, |
90 | .boot_params = S3C64XX_PA_SDRAM + 0x100, | 90 | .boot_params = S3C64XX_PA_SDRAM + 0x100, |
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c index 2d5afd221d77..9d51455feb31 100644 --- a/arch/arm/mach-s3c64xx/mach-smdk6410.c +++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c | |||
@@ -656,7 +656,7 @@ static void __init smdk6410_machine_init(void) | |||
656 | } | 656 | } |
657 | 657 | ||
658 | MACHINE_START(SMDK6410, "SMDK6410") | 658 | MACHINE_START(SMDK6410, "SMDK6410") |
659 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 659 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
660 | .phys_io = S3C_PA_UART & 0xfff00000, | 660 | .phys_io = S3C_PA_UART & 0xfff00000, |
661 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, | 661 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, |
662 | .boot_params = S3C64XX_PA_SDRAM + 0x100, | 662 | .boot_params = S3C64XX_PA_SDRAM + 0x100, |
diff --git a/arch/arm/mach-s5p6440/clock.c b/arch/arm/mach-s5p6440/clock.c index b2672e16e7aa..ca6e48dce777 100644 --- a/arch/arm/mach-s5p6440/clock.c +++ b/arch/arm/mach-s5p6440/clock.c | |||
@@ -134,24 +134,6 @@ static struct clksrc_clk clk_mout_mpll = { | |||
134 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 1, .size = 1 }, | 134 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 1, .size = 1 }, |
135 | }; | 135 | }; |
136 | 136 | ||
137 | static struct clk clk_h_low = { | ||
138 | .name = "hclk_low", | ||
139 | .id = -1, | ||
140 | .rate = 0, | ||
141 | .parent = NULL, | ||
142 | .ctrlbit = 0, | ||
143 | .ops = &clk_ops_def_setrate, | ||
144 | }; | ||
145 | |||
146 | static struct clk clk_p_low = { | ||
147 | .name = "pclk_low", | ||
148 | .id = -1, | ||
149 | .rate = 0, | ||
150 | .parent = NULL, | ||
151 | .ctrlbit = 0, | ||
152 | .ops = &clk_ops_def_setrate, | ||
153 | }; | ||
154 | |||
155 | enum perf_level { | 137 | enum perf_level { |
156 | L0 = 532*1000, | 138 | L0 = 532*1000, |
157 | L1 = 266*1000, | 139 | L1 = 266*1000, |
@@ -247,23 +229,70 @@ static struct clk_ops s5p6440_clkarm_ops = { | |||
247 | .round_rate = s5p6440_armclk_round_rate, | 229 | .round_rate = s5p6440_armclk_round_rate, |
248 | }; | 230 | }; |
249 | 231 | ||
250 | static unsigned long s5p6440_clk_doutmpll_get_rate(struct clk *clk) | 232 | static struct clksrc_clk clk_armclk = { |
251 | { | 233 | .clk = { |
252 | unsigned long rate = clk_get_rate(clk->parent); | 234 | .name = "armclk", |
235 | .id = 1, | ||
236 | .parent = &clk_mout_apll.clk, | ||
237 | .ops = &s5p6440_clkarm_ops, | ||
238 | }, | ||
239 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 4 }, | ||
240 | }; | ||
253 | 241 | ||
254 | if (__raw_readl(S5P_CLK_DIV0) & S5P_CLKDIV0_MPLL_MASK) | 242 | static struct clksrc_clk clk_dout_mpll = { |
255 | rate /= 2; | 243 | .clk = { |
244 | .name = "dout_mpll", | ||
245 | .id = -1, | ||
246 | .parent = &clk_mout_mpll.clk, | ||
247 | }, | ||
248 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 1 }, | ||
249 | }; | ||
256 | 250 | ||
257 | return rate; | 251 | static struct clksrc_clk clk_hclk = { |
258 | } | 252 | .clk = { |
253 | .name = "clk_hclk", | ||
254 | .id = -1, | ||
255 | .parent = &clk_armclk.clk, | ||
256 | }, | ||
257 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 4 }, | ||
258 | }; | ||
259 | 259 | ||
260 | static struct clk clk_dout_mpll = { | 260 | static struct clksrc_clk clk_pclk = { |
261 | .name = "dout_mpll", | 261 | .clk = { |
262 | .id = -1, | 262 | .name = "clk_pclk", |
263 | .parent = &clk_mout_mpll.clk, | 263 | .id = -1, |
264 | .ops = &(struct clk_ops) { | 264 | .parent = &clk_hclk.clk, |
265 | .get_rate = s5p6440_clk_doutmpll_get_rate, | ||
266 | }, | 265 | }, |
266 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 4 }, | ||
267 | }; | ||
268 | |||
269 | static struct clk *clkset_hclklow_list[] = { | ||
270 | &clk_mout_apll.clk, | ||
271 | &clk_mout_mpll.clk, | ||
272 | }; | ||
273 | |||
274 | static struct clksrc_sources clkset_hclklow = { | ||
275 | .sources = clkset_hclklow_list, | ||
276 | .nr_sources = ARRAY_SIZE(clkset_hclklow_list), | ||
277 | }; | ||
278 | |||
279 | static struct clksrc_clk clk_hclk_low = { | ||
280 | .clk = { | ||
281 | .name = "hclk_low", | ||
282 | .id = -1, | ||
283 | }, | ||
284 | .sources = &clkset_hclklow, | ||
285 | .reg_src = { .reg = S5P_SYS_OTHERS, .shift = 6, .size = 1 }, | ||
286 | .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 }, | ||
287 | }; | ||
288 | |||
289 | static struct clksrc_clk clk_pclk_low = { | ||
290 | .clk = { | ||
291 | .name = "pclk_low", | ||
292 | .id = -1, | ||
293 | .parent = &clk_hclk_low.clk, | ||
294 | }, | ||
295 | .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 }, | ||
267 | }; | 296 | }; |
268 | 297 | ||
269 | int s5p6440_clk48m_ctrl(struct clk *clk, int enable) | 298 | int s5p6440_clk48m_ctrl(struct clk *clk, int enable) |
@@ -307,6 +336,11 @@ static int s5p6440_sclk_ctrl(struct clk *clk, int enable) | |||
307 | return s5p_gatectrl(S5P_CLK_GATE_SCLK0, clk, enable); | 336 | return s5p_gatectrl(S5P_CLK_GATE_SCLK0, clk, enable); |
308 | } | 337 | } |
309 | 338 | ||
339 | static int s5p6440_sclk1_ctrl(struct clk *clk, int enable) | ||
340 | { | ||
341 | return s5p_gatectrl(S5P_CLK_GATE_SCLK1, clk, enable); | ||
342 | } | ||
343 | |||
310 | static int s5p6440_mem_ctrl(struct clk *clk, int enable) | 344 | static int s5p6440_mem_ctrl(struct clk *clk, int enable) |
311 | { | 345 | { |
312 | return s5p_gatectrl(S5P_CLK_GATE_MEM0, clk, enable); | 346 | return s5p_gatectrl(S5P_CLK_GATE_MEM0, clk, enable); |
@@ -321,37 +355,37 @@ static struct clk init_clocks_disable[] = { | |||
321 | { | 355 | { |
322 | .name = "nand", | 356 | .name = "nand", |
323 | .id = -1, | 357 | .id = -1, |
324 | .parent = &clk_h, | 358 | .parent = &clk_hclk.clk, |
325 | .enable = s5p6440_mem_ctrl, | 359 | .enable = s5p6440_mem_ctrl, |
326 | .ctrlbit = S5P_CLKCON_MEM0_HCLK_NFCON, | 360 | .ctrlbit = S5P_CLKCON_MEM0_HCLK_NFCON, |
327 | }, { | 361 | }, { |
328 | .name = "adc", | 362 | .name = "adc", |
329 | .id = -1, | 363 | .id = -1, |
330 | .parent = &clk_p_low, | 364 | .parent = &clk_pclk_low.clk, |
331 | .enable = s5p6440_pclk_ctrl, | 365 | .enable = s5p6440_pclk_ctrl, |
332 | .ctrlbit = S5P_CLKCON_PCLK_TSADC, | 366 | .ctrlbit = S5P_CLKCON_PCLK_TSADC, |
333 | }, { | 367 | }, { |
334 | .name = "i2c", | 368 | .name = "i2c", |
335 | .id = -1, | 369 | .id = -1, |
336 | .parent = &clk_p_low, | 370 | .parent = &clk_pclk_low.clk, |
337 | .enable = s5p6440_pclk_ctrl, | 371 | .enable = s5p6440_pclk_ctrl, |
338 | .ctrlbit = S5P_CLKCON_PCLK_IIC0, | 372 | .ctrlbit = S5P_CLKCON_PCLK_IIC0, |
339 | }, { | 373 | }, { |
340 | .name = "i2s_v40", | 374 | .name = "i2s_v40", |
341 | .id = 0, | 375 | .id = 0, |
342 | .parent = &clk_p_low, | 376 | .parent = &clk_pclk_low.clk, |
343 | .enable = s5p6440_pclk_ctrl, | 377 | .enable = s5p6440_pclk_ctrl, |
344 | .ctrlbit = S5P_CLKCON_PCLK_IIS2, | 378 | .ctrlbit = S5P_CLKCON_PCLK_IIS2, |
345 | }, { | 379 | }, { |
346 | .name = "spi", | 380 | .name = "spi", |
347 | .id = 0, | 381 | .id = 0, |
348 | .parent = &clk_p_low, | 382 | .parent = &clk_pclk_low.clk, |
349 | .enable = s5p6440_pclk_ctrl, | 383 | .enable = s5p6440_pclk_ctrl, |
350 | .ctrlbit = S5P_CLKCON_PCLK_SPI0, | 384 | .ctrlbit = S5P_CLKCON_PCLK_SPI0, |
351 | }, { | 385 | }, { |
352 | .name = "spi", | 386 | .name = "spi", |
353 | .id = 1, | 387 | .id = 1, |
354 | .parent = &clk_p_low, | 388 | .parent = &clk_pclk_low.clk, |
355 | .enable = s5p6440_pclk_ctrl, | 389 | .enable = s5p6440_pclk_ctrl, |
356 | .ctrlbit = S5P_CLKCON_PCLK_SPI1, | 390 | .ctrlbit = S5P_CLKCON_PCLK_SPI1, |
357 | }, { | 391 | }, { |
@@ -387,58 +421,124 @@ static struct clk init_clocks_disable[] = { | |||
387 | }, { | 421 | }, { |
388 | .name = "otg", | 422 | .name = "otg", |
389 | .id = -1, | 423 | .id = -1, |
390 | .parent = &clk_h_low, | 424 | .parent = &clk_hclk_low.clk, |
391 | .enable = s5p6440_hclk0_ctrl, | 425 | .enable = s5p6440_hclk0_ctrl, |
392 | .ctrlbit = S5P_CLKCON_HCLK0_USB | 426 | .ctrlbit = S5P_CLKCON_HCLK0_USB |
393 | }, { | 427 | }, { |
394 | .name = "post", | 428 | .name = "post", |
395 | .id = -1, | 429 | .id = -1, |
396 | .parent = &clk_h_low, | 430 | .parent = &clk_hclk_low.clk, |
397 | .enable = s5p6440_hclk0_ctrl, | 431 | .enable = s5p6440_hclk0_ctrl, |
398 | .ctrlbit = S5P_CLKCON_HCLK0_POST0 | 432 | .ctrlbit = S5P_CLKCON_HCLK0_POST0 |
399 | }, { | 433 | }, { |
400 | .name = "lcd", | 434 | .name = "lcd", |
401 | .id = -1, | 435 | .id = -1, |
402 | .parent = &clk_h_low, | 436 | .parent = &clk_hclk_low.clk, |
403 | .enable = s5p6440_hclk1_ctrl, | 437 | .enable = s5p6440_hclk1_ctrl, |
404 | .ctrlbit = S5P_CLKCON_HCLK1_DISPCON, | 438 | .ctrlbit = S5P_CLKCON_HCLK1_DISPCON, |
405 | }, { | 439 | }, { |
406 | .name = "hsmmc", | 440 | .name = "hsmmc", |
407 | .id = 0, | 441 | .id = 0, |
408 | .parent = &clk_h_low, | 442 | .parent = &clk_hclk_low.clk, |
409 | .enable = s5p6440_hclk0_ctrl, | 443 | .enable = s5p6440_hclk0_ctrl, |
410 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC0, | 444 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC0, |
411 | }, { | 445 | }, { |
412 | .name = "hsmmc", | 446 | .name = "hsmmc", |
413 | .id = 1, | 447 | .id = 1, |
414 | .parent = &clk_h_low, | 448 | .parent = &clk_hclk_low.clk, |
415 | .enable = s5p6440_hclk0_ctrl, | 449 | .enable = s5p6440_hclk0_ctrl, |
416 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC1, | 450 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC1, |
417 | }, { | 451 | }, { |
418 | .name = "hsmmc", | 452 | .name = "hsmmc", |
419 | .id = 2, | 453 | .id = 2, |
420 | .parent = &clk_h_low, | 454 | .parent = &clk_hclk_low.clk, |
421 | .enable = s5p6440_hclk0_ctrl, | 455 | .enable = s5p6440_hclk0_ctrl, |
422 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC2, | 456 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC2, |
423 | }, { | 457 | }, { |
424 | .name = "rtc", | 458 | .name = "rtc", |
425 | .id = -1, | 459 | .id = -1, |
426 | .parent = &clk_p_low, | 460 | .parent = &clk_pclk_low.clk, |
427 | .enable = s5p6440_pclk_ctrl, | 461 | .enable = s5p6440_pclk_ctrl, |
428 | .ctrlbit = S5P_CLKCON_PCLK_RTC, | 462 | .ctrlbit = S5P_CLKCON_PCLK_RTC, |
429 | }, { | 463 | }, { |
430 | .name = "watchdog", | 464 | .name = "watchdog", |
431 | .id = -1, | 465 | .id = -1, |
432 | .parent = &clk_p_low, | 466 | .parent = &clk_pclk_low.clk, |
433 | .enable = s5p6440_pclk_ctrl, | 467 | .enable = s5p6440_pclk_ctrl, |
434 | .ctrlbit = S5P_CLKCON_PCLK_WDT, | 468 | .ctrlbit = S5P_CLKCON_PCLK_WDT, |
435 | }, { | 469 | }, { |
436 | .name = "timers", | 470 | .name = "timers", |
437 | .id = -1, | 471 | .id = -1, |
438 | .parent = &clk_p_low, | 472 | .parent = &clk_pclk_low.clk, |
439 | .enable = s5p6440_pclk_ctrl, | 473 | .enable = s5p6440_pclk_ctrl, |
440 | .ctrlbit = S5P_CLKCON_PCLK_PWM, | 474 | .ctrlbit = S5P_CLKCON_PCLK_PWM, |
441 | } | 475 | }, { |
476 | .name = "hclk_fimgvg", | ||
477 | .id = -1, | ||
478 | .parent = &clk_hclk.clk, | ||
479 | .enable = s5p6440_hclk1_ctrl, | ||
480 | .ctrlbit = (1 << 2), | ||
481 | }, { | ||
482 | .name = "tsi", | ||
483 | .id = -1, | ||
484 | .parent = &clk_hclk_low.clk, | ||
485 | .enable = s5p6440_hclk1_ctrl, | ||
486 | .ctrlbit = (1 << 0), | ||
487 | }, { | ||
488 | .name = "pclk_fimgvg", | ||
489 | .id = -1, | ||
490 | .parent = &clk_pclk.clk, | ||
491 | .enable = s5p6440_pclk_ctrl, | ||
492 | .ctrlbit = (1 << 31), | ||
493 | }, { | ||
494 | .name = "dmc0", | ||
495 | .id = -1, | ||
496 | .parent = &clk_pclk.clk, | ||
497 | .enable = s5p6440_pclk_ctrl, | ||
498 | .ctrlbit = (1 << 30), | ||
499 | }, { | ||
500 | .name = "etm", | ||
501 | .id = -1, | ||
502 | .parent = &clk_pclk.clk, | ||
503 | .enable = s5p6440_pclk_ctrl, | ||
504 | .ctrlbit = (1 << 29), | ||
505 | }, { | ||
506 | .name = "dsim", | ||
507 | .id = -1, | ||
508 | .parent = &clk_pclk_low.clk, | ||
509 | .enable = s5p6440_pclk_ctrl, | ||
510 | .ctrlbit = (1 << 28), | ||
511 | }, { | ||
512 | .name = "gps", | ||
513 | .id = -1, | ||
514 | .parent = &clk_pclk_low.clk, | ||
515 | .enable = s5p6440_pclk_ctrl, | ||
516 | .ctrlbit = (1 << 25), | ||
517 | }, { | ||
518 | .name = "pcm", | ||
519 | .id = -1, | ||
520 | .parent = &clk_pclk_low.clk, | ||
521 | .enable = s5p6440_pclk_ctrl, | ||
522 | .ctrlbit = (1 << 8), | ||
523 | }, { | ||
524 | .name = "irom", | ||
525 | .id = -1, | ||
526 | .parent = &clk_hclk.clk, | ||
527 | .enable = s5p6440_hclk0_ctrl, | ||
528 | .ctrlbit = (1 << 25), | ||
529 | }, { | ||
530 | .name = "dma", | ||
531 | .id = -1, | ||
532 | .parent = &clk_hclk_low.clk, | ||
533 | .enable = s5p6440_hclk0_ctrl, | ||
534 | .ctrlbit = (1 << 12), | ||
535 | }, { | ||
536 | .name = "2d", | ||
537 | .id = -1, | ||
538 | .parent = &clk_hclk.clk, | ||
539 | .enable = s5p6440_hclk0_ctrl, | ||
540 | .ctrlbit = (1 << 8), | ||
541 | }, | ||
442 | }; | 542 | }; |
443 | 543 | ||
444 | /* | 544 | /* |
@@ -448,34 +548,46 @@ static struct clk init_clocks[] = { | |||
448 | { | 548 | { |
449 | .name = "gpio", | 549 | .name = "gpio", |
450 | .id = -1, | 550 | .id = -1, |
451 | .parent = &clk_p_low, | 551 | .parent = &clk_pclk_low.clk, |
452 | .enable = s5p6440_pclk_ctrl, | 552 | .enable = s5p6440_pclk_ctrl, |
453 | .ctrlbit = S5P_CLKCON_PCLK_GPIO, | 553 | .ctrlbit = S5P_CLKCON_PCLK_GPIO, |
454 | }, { | 554 | }, { |
455 | .name = "uart", | 555 | .name = "uart", |
456 | .id = 0, | 556 | .id = 0, |
457 | .parent = &clk_p_low, | 557 | .parent = &clk_pclk_low.clk, |
458 | .enable = s5p6440_pclk_ctrl, | 558 | .enable = s5p6440_pclk_ctrl, |
459 | .ctrlbit = S5P_CLKCON_PCLK_UART0, | 559 | .ctrlbit = S5P_CLKCON_PCLK_UART0, |
460 | }, { | 560 | }, { |
461 | .name = "uart", | 561 | .name = "uart", |
462 | .id = 1, | 562 | .id = 1, |
463 | .parent = &clk_p_low, | 563 | .parent = &clk_pclk_low.clk, |
464 | .enable = s5p6440_pclk_ctrl, | 564 | .enable = s5p6440_pclk_ctrl, |
465 | .ctrlbit = S5P_CLKCON_PCLK_UART1, | 565 | .ctrlbit = S5P_CLKCON_PCLK_UART1, |
466 | }, { | 566 | }, { |
467 | .name = "uart", | 567 | .name = "uart", |
468 | .id = 2, | 568 | .id = 2, |
469 | .parent = &clk_p_low, | 569 | .parent = &clk_pclk_low.clk, |
470 | .enable = s5p6440_pclk_ctrl, | 570 | .enable = s5p6440_pclk_ctrl, |
471 | .ctrlbit = S5P_CLKCON_PCLK_UART2, | 571 | .ctrlbit = S5P_CLKCON_PCLK_UART2, |
472 | }, { | 572 | }, { |
473 | .name = "uart", | 573 | .name = "uart", |
474 | .id = 3, | 574 | .id = 3, |
475 | .parent = &clk_p_low, | 575 | .parent = &clk_pclk_low.clk, |
476 | .enable = s5p6440_pclk_ctrl, | 576 | .enable = s5p6440_pclk_ctrl, |
477 | .ctrlbit = S5P_CLKCON_PCLK_UART3, | 577 | .ctrlbit = S5P_CLKCON_PCLK_UART3, |
478 | } | 578 | }, { |
579 | .name = "mem", | ||
580 | .id = -1, | ||
581 | .parent = &clk_hclk.clk, | ||
582 | .enable = s5p6440_hclk0_ctrl, | ||
583 | .ctrlbit = (1 << 21), | ||
584 | }, { | ||
585 | .name = "intc", | ||
586 | .id = -1, | ||
587 | .parent = &clk_hclk.clk, | ||
588 | .enable = s5p6440_hclk0_ctrl, | ||
589 | .ctrlbit = (1 << 1), | ||
590 | }, | ||
479 | }; | 591 | }; |
480 | 592 | ||
481 | static struct clk clk_iis_cd_v40 = { | 593 | static struct clk clk_iis_cd_v40 = { |
@@ -488,20 +600,20 @@ static struct clk clk_pcm_cd = { | |||
488 | .id = -1, | 600 | .id = -1, |
489 | }; | 601 | }; |
490 | 602 | ||
491 | static struct clk *clkset_spi_mmc_list[] = { | 603 | static struct clk *clkset_group1_list[] = { |
492 | &clk_mout_epll.clk, | 604 | &clk_mout_epll.clk, |
493 | &clk_dout_mpll, | 605 | &clk_dout_mpll.clk, |
494 | &clk_fin_epll, | 606 | &clk_fin_epll, |
495 | }; | 607 | }; |
496 | 608 | ||
497 | static struct clksrc_sources clkset_spi_mmc = { | 609 | static struct clksrc_sources clkset_group1 = { |
498 | .sources = clkset_spi_mmc_list, | 610 | .sources = clkset_group1_list, |
499 | .nr_sources = ARRAY_SIZE(clkset_spi_mmc_list), | 611 | .nr_sources = ARRAY_SIZE(clkset_group1_list), |
500 | }; | 612 | }; |
501 | 613 | ||
502 | static struct clk *clkset_uart_list[] = { | 614 | static struct clk *clkset_uart_list[] = { |
503 | &clk_mout_epll.clk, | 615 | &clk_mout_epll.clk, |
504 | &clk_dout_mpll | 616 | &clk_dout_mpll.clk, |
505 | }; | 617 | }; |
506 | 618 | ||
507 | static struct clksrc_sources clkset_uart = { | 619 | static struct clksrc_sources clkset_uart = { |
@@ -509,6 +621,19 @@ static struct clksrc_sources clkset_uart = { | |||
509 | .nr_sources = ARRAY_SIZE(clkset_uart_list), | 621 | .nr_sources = ARRAY_SIZE(clkset_uart_list), |
510 | }; | 622 | }; |
511 | 623 | ||
624 | static struct clk *clkset_audio_list[] = { | ||
625 | &clk_mout_epll.clk, | ||
626 | &clk_dout_mpll.clk, | ||
627 | &clk_fin_epll, | ||
628 | &clk_iis_cd_v40, | ||
629 | &clk_pcm_cd, | ||
630 | }; | ||
631 | |||
632 | static struct clksrc_sources clkset_audio = { | ||
633 | .sources = clkset_audio_list, | ||
634 | .nr_sources = ARRAY_SIZE(clkset_audio_list), | ||
635 | }; | ||
636 | |||
512 | static struct clksrc_clk clksrcs[] = { | 637 | static struct clksrc_clk clksrcs[] = { |
513 | { | 638 | { |
514 | .clk = { | 639 | .clk = { |
@@ -517,7 +642,7 @@ static struct clksrc_clk clksrcs[] = { | |||
517 | .ctrlbit = S5P_CLKCON_SCLK0_MMC0, | 642 | .ctrlbit = S5P_CLKCON_SCLK0_MMC0, |
518 | .enable = s5p6440_sclk_ctrl, | 643 | .enable = s5p6440_sclk_ctrl, |
519 | }, | 644 | }, |
520 | .sources = &clkset_spi_mmc, | 645 | .sources = &clkset_group1, |
521 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 18, .size = 2 }, | 646 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 18, .size = 2 }, |
522 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4 }, | 647 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4 }, |
523 | }, { | 648 | }, { |
@@ -527,7 +652,7 @@ static struct clksrc_clk clksrcs[] = { | |||
527 | .ctrlbit = S5P_CLKCON_SCLK0_MMC1, | 652 | .ctrlbit = S5P_CLKCON_SCLK0_MMC1, |
528 | .enable = s5p6440_sclk_ctrl, | 653 | .enable = s5p6440_sclk_ctrl, |
529 | }, | 654 | }, |
530 | .sources = &clkset_spi_mmc, | 655 | .sources = &clkset_group1, |
531 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 2 }, | 656 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 2 }, |
532 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 4, .size = 4 }, | 657 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 4, .size = 4 }, |
533 | }, { | 658 | }, { |
@@ -537,7 +662,7 @@ static struct clksrc_clk clksrcs[] = { | |||
537 | .ctrlbit = S5P_CLKCON_SCLK0_MMC2, | 662 | .ctrlbit = S5P_CLKCON_SCLK0_MMC2, |
538 | .enable = s5p6440_sclk_ctrl, | 663 | .enable = s5p6440_sclk_ctrl, |
539 | }, | 664 | }, |
540 | .sources = &clkset_spi_mmc, | 665 | .sources = &clkset_group1, |
541 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 22, .size = 2 }, | 666 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 22, .size = 2 }, |
542 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 8, .size = 4 }, | 667 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 8, .size = 4 }, |
543 | }, { | 668 | }, { |
@@ -557,7 +682,7 @@ static struct clksrc_clk clksrcs[] = { | |||
557 | .ctrlbit = S5P_CLKCON_SCLK0_SPI0, | 682 | .ctrlbit = S5P_CLKCON_SCLK0_SPI0, |
558 | .enable = s5p6440_sclk_ctrl, | 683 | .enable = s5p6440_sclk_ctrl, |
559 | }, | 684 | }, |
560 | .sources = &clkset_spi_mmc, | 685 | .sources = &clkset_group1, |
561 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 14, .size = 2 }, | 686 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 14, .size = 2 }, |
562 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 }, | 687 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 }, |
563 | }, { | 688 | }, { |
@@ -567,17 +692,63 @@ static struct clksrc_clk clksrcs[] = { | |||
567 | .ctrlbit = S5P_CLKCON_SCLK0_SPI1, | 692 | .ctrlbit = S5P_CLKCON_SCLK0_SPI1, |
568 | .enable = s5p6440_sclk_ctrl, | 693 | .enable = s5p6440_sclk_ctrl, |
569 | }, | 694 | }, |
570 | .sources = &clkset_spi_mmc, | 695 | .sources = &clkset_group1, |
571 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 2 }, | 696 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 2 }, |
572 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 }, | 697 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 }, |
573 | } | 698 | }, { |
699 | .clk = { | ||
700 | .name = "sclk_post", | ||
701 | .id = -1, | ||
702 | .ctrlbit = (1 << 10), | ||
703 | .enable = s5p6440_sclk_ctrl, | ||
704 | }, | ||
705 | .sources = &clkset_group1, | ||
706 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 26, .size = 2 }, | ||
707 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 4 }, | ||
708 | }, { | ||
709 | .clk = { | ||
710 | .name = "sclk_dispcon", | ||
711 | .id = -1, | ||
712 | .ctrlbit = (1 << 1), | ||
713 | .enable = s5p6440_sclk1_ctrl, | ||
714 | }, | ||
715 | .sources = &clkset_group1, | ||
716 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 2 }, | ||
717 | .reg_div = { .reg = S5P_CLK_DIV3, .shift = 0, .size = 4 }, | ||
718 | }, { | ||
719 | .clk = { | ||
720 | .name = "sclk_fimgvg", | ||
721 | .id = -1, | ||
722 | .ctrlbit = (1 << 2), | ||
723 | .enable = s5p6440_sclk1_ctrl, | ||
724 | }, | ||
725 | .sources = &clkset_group1, | ||
726 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 8, .size = 2 }, | ||
727 | .reg_div = { .reg = S5P_CLK_DIV3, .shift = 4, .size = 4 }, | ||
728 | }, { | ||
729 | .clk = { | ||
730 | .name = "sclk_audio2", | ||
731 | .id = -1, | ||
732 | .ctrlbit = (1 << 11), | ||
733 | .enable = s5p6440_sclk_ctrl, | ||
734 | }, | ||
735 | .sources = &clkset_audio, | ||
736 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 0, .size = 3 }, | ||
737 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 24, .size = 4 }, | ||
738 | }, | ||
574 | }; | 739 | }; |
575 | 740 | ||
576 | /* Clock initialisation code */ | 741 | /* Clock initialisation code */ |
577 | static struct clksrc_clk *init_parents[] = { | 742 | static struct clksrc_clk *sysclks[] = { |
578 | &clk_mout_apll, | 743 | &clk_mout_apll, |
579 | &clk_mout_epll, | 744 | &clk_mout_epll, |
580 | &clk_mout_mpll, | 745 | &clk_mout_mpll, |
746 | &clk_dout_mpll, | ||
747 | &clk_armclk, | ||
748 | &clk_hclk, | ||
749 | &clk_pclk, | ||
750 | &clk_hclk_low, | ||
751 | &clk_pclk_low, | ||
581 | }; | 752 | }; |
582 | 753 | ||
583 | void __init_or_cpufreq s5p6440_setup_clocks(void) | 754 | void __init_or_cpufreq s5p6440_setup_clocks(void) |
@@ -593,21 +764,13 @@ void __init_or_cpufreq s5p6440_setup_clocks(void) | |||
593 | unsigned long apll; | 764 | unsigned long apll; |
594 | unsigned long mpll; | 765 | unsigned long mpll; |
595 | unsigned int ptr; | 766 | unsigned int ptr; |
596 | u32 clkdiv0; | ||
597 | u32 clkdiv3; | ||
598 | 767 | ||
599 | /* Set S5P6440 functions for clk_fout_epll */ | 768 | /* Set S5P6440 functions for clk_fout_epll */ |
600 | clk_fout_epll.enable = s5p6440_epll_enable; | 769 | clk_fout_epll.enable = s5p6440_epll_enable; |
601 | clk_fout_epll.ops = &s5p6440_epll_ops; | 770 | clk_fout_epll.ops = &s5p6440_epll_ops; |
602 | 771 | ||
603 | /* Set S5P6440 functions for arm clock */ | ||
604 | clk_arm.parent = &clk_mout_apll.clk; | ||
605 | clk_arm.ops = &s5p6440_clkarm_ops; | ||
606 | clk_48m.enable = s5p6440_clk48m_ctrl; | 772 | clk_48m.enable = s5p6440_clk48m_ctrl; |
607 | 773 | ||
608 | clkdiv0 = __raw_readl(S5P_CLK_DIV0); | ||
609 | clkdiv3 = __raw_readl(S5P_CLK_DIV3); | ||
610 | |||
611 | xtal_clk = clk_get(NULL, "ext_xtal"); | 774 | xtal_clk = clk_get(NULL, "ext_xtal"); |
612 | BUG_ON(IS_ERR(xtal_clk)); | 775 | BUG_ON(IS_ERR(xtal_clk)); |
613 | 776 | ||
@@ -619,41 +782,28 @@ void __init_or_cpufreq s5p6440_setup_clocks(void) | |||
619 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502); | 782 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502); |
620 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4502); | 783 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4502); |
621 | 784 | ||
785 | clk_fout_mpll.rate = mpll; | ||
786 | clk_fout_epll.rate = epll; | ||
787 | clk_fout_apll.rate = apll; | ||
788 | |||
622 | printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \ | 789 | printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \ |
623 | " E=%ld.%ldMHz\n", | 790 | " E=%ld.%ldMHz\n", |
624 | print_mhz(apll), print_mhz(mpll), print_mhz(epll)); | 791 | print_mhz(apll), print_mhz(mpll), print_mhz(epll)); |
625 | 792 | ||
626 | fclk = apll / GET_DIV(clkdiv0, S5P_CLKDIV0_ARM); | 793 | fclk = clk_get_rate(&clk_armclk.clk); |
627 | hclk = fclk / GET_DIV(clkdiv0, S5P_CLKDIV0_HCLK); | 794 | hclk = clk_get_rate(&clk_hclk.clk); |
628 | pclk = hclk / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK); | 795 | pclk = clk_get_rate(&clk_pclk.clk); |
629 | 796 | hclk_low = clk_get_rate(&clk_hclk_low.clk); | |
630 | if (__raw_readl(S5P_OTHERS) & S5P_OTHERS_HCLK_LOW_SEL_MPLL) { | 797 | pclk_low = clk_get_rate(&clk_pclk_low.clk); |
631 | /* Asynchronous mode */ | ||
632 | hclk_low = mpll / GET_DIV(clkdiv3, S5P_CLKDIV3_HCLK_LOW); | ||
633 | } else { | ||
634 | /* Synchronous mode */ | ||
635 | hclk_low = apll / GET_DIV(clkdiv3, S5P_CLKDIV3_HCLK_LOW); | ||
636 | } | ||
637 | |||
638 | pclk_low = hclk_low / GET_DIV(clkdiv3, S5P_CLKDIV3_PCLK_LOW); | ||
639 | 798 | ||
640 | printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \ | 799 | printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \ |
641 | " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n", | 800 | " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n", |
642 | print_mhz(hclk), print_mhz(hclk_low), | 801 | print_mhz(hclk), print_mhz(hclk_low), |
643 | print_mhz(pclk), print_mhz(pclk_low)); | 802 | print_mhz(pclk), print_mhz(pclk_low)); |
644 | 803 | ||
645 | clk_fout_mpll.rate = mpll; | ||
646 | clk_fout_epll.rate = epll; | ||
647 | clk_fout_apll.rate = apll; | ||
648 | |||
649 | clk_f.rate = fclk; | 804 | clk_f.rate = fclk; |
650 | clk_h.rate = hclk; | 805 | clk_h.rate = hclk; |
651 | clk_p.rate = pclk; | 806 | clk_p.rate = pclk; |
652 | clk_h_low.rate = hclk_low; | ||
653 | clk_p_low.rate = pclk_low; | ||
654 | |||
655 | for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++) | ||
656 | s3c_set_clksrc(init_parents[ptr], true); | ||
657 | 807 | ||
658 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | 808 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) |
659 | s3c_set_clksrc(&clksrcs[ptr], true); | 809 | s3c_set_clksrc(&clksrcs[ptr], true); |
@@ -661,13 +811,8 @@ void __init_or_cpufreq s5p6440_setup_clocks(void) | |||
661 | 811 | ||
662 | static struct clk *clks[] __initdata = { | 812 | static struct clk *clks[] __initdata = { |
663 | &clk_ext, | 813 | &clk_ext, |
664 | &clk_mout_epll.clk, | ||
665 | &clk_mout_mpll.clk, | ||
666 | &clk_dout_mpll, | ||
667 | &clk_iis_cd_v40, | 814 | &clk_iis_cd_v40, |
668 | &clk_pcm_cd, | 815 | &clk_pcm_cd, |
669 | &clk_p_low, | ||
670 | &clk_h_low, | ||
671 | }; | 816 | }; |
672 | 817 | ||
673 | void __init s5p6440_register_clocks(void) | 818 | void __init s5p6440_register_clocks(void) |
@@ -680,6 +825,9 @@ void __init s5p6440_register_clocks(void) | |||
680 | if (ret > 0) | 825 | if (ret > 0) |
681 | printk(KERN_ERR "Failed to register %u clocks\n", ret); | 826 | printk(KERN_ERR "Failed to register %u clocks\n", ret); |
682 | 827 | ||
828 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) | ||
829 | s3c_register_clksrc(sysclks[ptr], 1); | ||
830 | |||
683 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | 831 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); |
684 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | 832 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); |
685 | 833 | ||
diff --git a/arch/arm/mach-s5p6440/cpu.c b/arch/arm/mach-s5p6440/cpu.c index 1794131aeacb..ca3b3206e6f8 100644 --- a/arch/arm/mach-s5p6440/cpu.c +++ b/arch/arm/mach-s5p6440/cpu.c | |||
@@ -88,7 +88,7 @@ void __init s5p6440_init_irq(void) | |||
88 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | 88 | s5p_init_irq(vic, ARRAY_SIZE(vic)); |
89 | } | 89 | } |
90 | 90 | ||
91 | static struct sysdev_class s5p6440_sysclass = { | 91 | struct sysdev_class s5p6440_sysclass = { |
92 | .name = "s5p6440-core", | 92 | .name = "s5p6440-core", |
93 | }; | 93 | }; |
94 | 94 | ||
diff --git a/arch/arm/mach-s5p6440/gpio.c b/arch/arm/mach-s5p6440/gpio.c index b0ea741177ad..262dc75d5bea 100644 --- a/arch/arm/mach-s5p6440/gpio.c +++ b/arch/arm/mach-s5p6440/gpio.c | |||
@@ -161,12 +161,15 @@ static struct s3c_gpio_cfg s5p6440_gpio_cfgs[] = { | |||
161 | }, { | 161 | }, { |
162 | .cfg_eint = 0, | 162 | .cfg_eint = 0, |
163 | .set_config = s3c_gpio_setcfg_s3c24xx, | 163 | .set_config = s3c_gpio_setcfg_s3c24xx, |
164 | .get_config = s3c_gpio_getcfg_s3c24xx, | ||
164 | }, { | 165 | }, { |
165 | .cfg_eint = 2, | 166 | .cfg_eint = 2, |
166 | .set_config = s3c_gpio_setcfg_s3c24xx, | 167 | .set_config = s3c_gpio_setcfg_s3c24xx, |
168 | .get_config = s3c_gpio_getcfg_s3c24xx, | ||
167 | }, { | 169 | }, { |
168 | .cfg_eint = 3, | 170 | .cfg_eint = 3, |
169 | .set_config = s3c_gpio_setcfg_s3c24xx, | 171 | .set_config = s3c_gpio_setcfg_s3c24xx, |
172 | .get_config = s3c_gpio_getcfg_s3c24xx, | ||
170 | }, | 173 | }, |
171 | }; | 174 | }; |
172 | 175 | ||
@@ -279,6 +282,8 @@ void __init s5p6440_gpiolib_set_cfg(struct s3c_gpio_cfg *chipcfg, int nr_chips) | |||
279 | for (; nr_chips > 0; nr_chips--, chipcfg++) { | 282 | for (; nr_chips > 0; nr_chips--, chipcfg++) { |
280 | if (!chipcfg->set_config) | 283 | if (!chipcfg->set_config) |
281 | chipcfg->set_config = s3c_gpio_setcfg_s3c64xx_4bit; | 284 | chipcfg->set_config = s3c_gpio_setcfg_s3c64xx_4bit; |
285 | if (!chipcfg->get_config) | ||
286 | chipcfg->get_config = s3c_gpio_getcfg_s3c64xx_4bit; | ||
282 | if (!chipcfg->set_pull) | 287 | if (!chipcfg->set_pull) |
283 | chipcfg->set_pull = s3c_gpio_setpull_updown; | 288 | chipcfg->set_pull = s3c_gpio_setpull_updown; |
284 | if (!chipcfg->get_pull) | 289 | if (!chipcfg->get_pull) |
diff --git a/arch/arm/mach-s5p6440/include/mach/pwm-clock.h b/arch/arm/mach-s5p6440/include/mach/pwm-clock.h index c4bb7c555477..6a2a02fdf12a 100644 --- a/arch/arm/mach-s5p6440/include/mach/pwm-clock.h +++ b/arch/arm/mach-s5p6440/include/mach/pwm-clock.h | |||
@@ -1,11 +1,14 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/pwm-clock.h | 1 | /* linux/arch/arm/mach-s5p6440/include/mach/pwm-clock.h |
2 | * | 2 | * |
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Copyright 2008 Openmoko, Inc. | ||
3 | * Copyright 2008 Simtec Electronics | 7 | * Copyright 2008 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 8 | * Ben Dooks <ben@simtec.co.uk> |
5 | * http://armlinux.simtec.co.uk/ | 9 | * http://armlinux.simtec.co.uk/ |
6 | * | 10 | * |
7 | * Copyright 2009 Samsung Electronics Co., Ltd. | 11 | * Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h |
8 | * http://www.samsung.com/ | ||
9 | * | 12 | * |
10 | * S5P6440 - pwm clock and timer support | 13 | * S5P6440 - pwm clock and timer support |
11 | * | 14 | * |
@@ -14,16 +17,19 @@ | |||
14 | * published by the Free Software Foundation. | 17 | * published by the Free Software Foundation. |
15 | */ | 18 | */ |
16 | 19 | ||
20 | #ifndef __ASM_ARCH_PWMCLK_H | ||
21 | #define __ASM_ARCH_PWMCLK_H __FILE__ | ||
22 | |||
17 | /** | 23 | /** |
18 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk | 24 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk |
19 | * @cfg: The timer TCFG1 register bits shifted down to 0. | 25 | * @tcfg: The timer TCFG1 register bits shifted down to 0. |
20 | * | 26 | * |
21 | * Return true if the given configuration from TCFG1 is a TCLK instead | 27 | * Return true if the given configuration from TCFG1 is a TCLK instead |
22 | * any of the TDIV clocks. | 28 | * any of the TDIV clocks. |
23 | */ | 29 | */ |
24 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | 30 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) |
25 | { | 31 | { |
26 | return tcfg == S3C2410_TCFG1_MUX_TCLK; | 32 | return 0; |
27 | } | 33 | } |
28 | 34 | ||
29 | /** | 35 | /** |
@@ -35,7 +41,7 @@ static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | |||
35 | */ | 41 | */ |
36 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | 42 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) |
37 | { | 43 | { |
38 | return 1 << (1 + tcfg1); | 44 | return 1 << tcfg1; |
39 | } | 45 | } |
40 | 46 | ||
41 | /** | 47 | /** |
@@ -45,7 +51,7 @@ static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | |||
45 | */ | 51 | */ |
46 | static inline unsigned int pwm_tdiv_has_div1(void) | 52 | static inline unsigned int pwm_tdiv_has_div1(void) |
47 | { | 53 | { |
48 | return 0; | 54 | return 1; |
49 | } | 55 | } |
50 | 56 | ||
51 | /** | 57 | /** |
@@ -56,7 +62,9 @@ static inline unsigned int pwm_tdiv_has_div1(void) | |||
56 | */ | 62 | */ |
57 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) | 63 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) |
58 | { | 64 | { |
59 | return ilog2(div) - 1; | 65 | return ilog2(div); |
60 | } | 66 | } |
61 | 67 | ||
62 | #define S3C_TCFG1_MUX_TCLK S3C2410_TCFG1_MUX_TCLK | 68 | #define S3C_TCFG1_MUX_TCLK 0 |
69 | |||
70 | #endif /* __ASM_ARCH_PWMCLK_H */ | ||
diff --git a/arch/arm/mach-s5p6442/cpu.c b/arch/arm/mach-s5p6442/cpu.c index bc2524df89b3..a48fb553fd01 100644 --- a/arch/arm/mach-s5p6442/cpu.c +++ b/arch/arm/mach-s5p6442/cpu.c | |||
@@ -95,7 +95,7 @@ void __init s5p6442_init_irq(void) | |||
95 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | 95 | s5p_init_irq(vic, ARRAY_SIZE(vic)); |
96 | } | 96 | } |
97 | 97 | ||
98 | static struct sysdev_class s5p6442_sysclass = { | 98 | struct sysdev_class s5p6442_sysclass = { |
99 | .name = "s5p6442-core", | 99 | .name = "s5p6442-core", |
100 | }; | 100 | }; |
101 | 101 | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/pwm-clock.h b/arch/arm/mach-s5p6442/include/mach/pwm-clock.h index 15e8525da0f1..2724b37def31 100644 --- a/arch/arm/mach-s5p6442/include/mach/pwm-clock.h +++ b/arch/arm/mach-s5p6442/include/mach/pwm-clock.h | |||
@@ -1,13 +1,14 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/pwm-clock.h | 1 | /* linux/arch/arm/mach-s5p6442/include/mach/pwm-clock.h |
2 | * | 2 | * |
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Copyright 2008 Openmoko, Inc. | ||
3 | * Copyright 2008 Simtec Electronics | 7 | * Copyright 2008 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 8 | * Ben Dooks <ben@simtec.co.uk> |
5 | * http://armlinux.simtec.co.uk/ | 9 | * http://armlinux.simtec.co.uk/ |
6 | * | 10 | * |
7 | * Copyright 2010 Samsung Electronics Co., Ltd. | 11 | * Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h |
8 | * http://www.samsung.com/ | ||
9 | * | ||
10 | * Based on arch/arm/plat-s3c24xx/include/mach/pwm-clock.h | ||
11 | * | 12 | * |
12 | * S5P6442 - pwm clock and timer support | 13 | * S5P6442 - pwm clock and timer support |
13 | * | 14 | * |
@@ -21,14 +22,14 @@ | |||
21 | 22 | ||
22 | /** | 23 | /** |
23 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk | 24 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk |
24 | * @cfg: The timer TCFG1 register bits shifted down to 0. | 25 | * @tcfg: The timer TCFG1 register bits shifted down to 0. |
25 | * | 26 | * |
26 | * Return true if the given configuration from TCFG1 is a TCLK instead | 27 | * Return true if the given configuration from TCFG1 is a TCLK instead |
27 | * any of the TDIV clocks. | 28 | * any of the TDIV clocks. |
28 | */ | 29 | */ |
29 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | 30 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) |
30 | { | 31 | { |
31 | return tcfg == S3C2410_TCFG1_MUX_TCLK; | 32 | return tcfg == S3C64XX_TCFG1_MUX_TCLK; |
32 | } | 33 | } |
33 | 34 | ||
34 | /** | 35 | /** |
@@ -40,7 +41,7 @@ static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | |||
40 | */ | 41 | */ |
41 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | 42 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) |
42 | { | 43 | { |
43 | return 1 << (1 + tcfg1); | 44 | return 1 << tcfg1; |
44 | } | 45 | } |
45 | 46 | ||
46 | /** | 47 | /** |
@@ -50,7 +51,7 @@ static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | |||
50 | */ | 51 | */ |
51 | static inline unsigned int pwm_tdiv_has_div1(void) | 52 | static inline unsigned int pwm_tdiv_has_div1(void) |
52 | { | 53 | { |
53 | return 0; | 54 | return 1; |
54 | } | 55 | } |
55 | 56 | ||
56 | /** | 57 | /** |
@@ -61,9 +62,9 @@ static inline unsigned int pwm_tdiv_has_div1(void) | |||
61 | */ | 62 | */ |
62 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) | 63 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) |
63 | { | 64 | { |
64 | return ilog2(div) - 1; | 65 | return ilog2(div); |
65 | } | 66 | } |
66 | 67 | ||
67 | #define S3C_TCFG1_MUX_TCLK S3C2410_TCFG1_MUX_TCLK | 68 | #define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK |
68 | 69 | ||
69 | #endif /* __ASM_ARCH_PWMCLK_H */ | 70 | #endif /* __ASM_ARCH_PWMCLK_H */ |
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile index 8ebf51c52a01..0acbdb34b560 100644 --- a/arch/arm/mach-s5pv210/Makefile +++ b/arch/arm/mach-s5pv210/Makefile | |||
@@ -12,7 +12,7 @@ obj- := | |||
12 | 12 | ||
13 | # Core support for S5PV210 system | 13 | # Core support for S5PV210 system |
14 | 14 | ||
15 | obj-$(CONFIG_CPU_S5PV210) += cpu.o init.o clock.o | 15 | obj-$(CONFIG_CPU_S5PV210) += cpu.o init.o clock.o gpiolib.o |
16 | 16 | ||
17 | # machine support | 17 | # machine support |
18 | 18 | ||
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c index 0e0f8fde2aa6..2b776eb5d150 100644 --- a/arch/arm/mach-s5pv210/cpu.c +++ b/arch/arm/mach-s5pv210/cpu.c | |||
@@ -100,7 +100,7 @@ void __init s5pv210_init_irq(void) | |||
100 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | 100 | s5p_init_irq(vic, ARRAY_SIZE(vic)); |
101 | } | 101 | } |
102 | 102 | ||
103 | static struct sysdev_class s5pv210_sysclass = { | 103 | struct sysdev_class s5pv210_sysclass = { |
104 | .name = "s5pv210-core", | 104 | .name = "s5pv210-core", |
105 | }; | 105 | }; |
106 | 106 | ||
diff --git a/arch/arm/mach-s5pv210/gpiolib.c b/arch/arm/mach-s5pv210/gpiolib.c new file mode 100644 index 000000000000..9ea8972e023d --- /dev/null +++ b/arch/arm/mach-s5pv210/gpiolib.c | |||
@@ -0,0 +1,261 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/gpiolib.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5PV210 - GPIOlib support | ||
7 | * | ||
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. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/irq.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/gpio.h> | ||
17 | #include <plat/gpio-core.h> | ||
18 | #include <plat/gpio-cfg.h> | ||
19 | #include <plat/gpio-cfg-helpers.h> | ||
20 | #include <mach/map.h> | ||
21 | |||
22 | static struct s3c_gpio_cfg gpio_cfg = { | ||
23 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, | ||
24 | .set_pull = s3c_gpio_setpull_updown, | ||
25 | .get_pull = s3c_gpio_getpull_updown, | ||
26 | }; | ||
27 | |||
28 | static struct s3c_gpio_cfg gpio_cfg_noint = { | ||
29 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, | ||
30 | .set_pull = s3c_gpio_setpull_updown, | ||
31 | .get_pull = s3c_gpio_getpull_updown, | ||
32 | }; | ||
33 | |||
34 | /* GPIO bank's base address given the index of the bank in the | ||
35 | * list of all gpio banks. | ||
36 | */ | ||
37 | #define S5PV210_BANK_BASE(bank_nr) (S5P_VA_GPIO + ((bank_nr) * 0x20)) | ||
38 | |||
39 | /* | ||
40 | * Following are the gpio banks in v210. | ||
41 | * | ||
42 | * The 'config' member when left to NULL, is initialized to the default | ||
43 | * structure gpio_cfg in the init function below. | ||
44 | * | ||
45 | * The 'base' member is also initialized in the init function below. | ||
46 | * Note: The initialization of 'base' member of s3c_gpio_chip structure | ||
47 | * uses the above macro and depends on the banks being listed in order here. | ||
48 | */ | ||
49 | static struct s3c_gpio_chip s5pv210_gpio_4bit[] = { | ||
50 | { | ||
51 | .chip = { | ||
52 | .base = S5PV210_GPA0(0), | ||
53 | .ngpio = S5PV210_GPIO_A0_NR, | ||
54 | .label = "GPA0", | ||
55 | }, | ||
56 | }, { | ||
57 | .chip = { | ||
58 | .base = S5PV210_GPA1(0), | ||
59 | .ngpio = S5PV210_GPIO_A1_NR, | ||
60 | .label = "GPA1", | ||
61 | }, | ||
62 | }, { | ||
63 | .chip = { | ||
64 | .base = S5PV210_GPB(0), | ||
65 | .ngpio = S5PV210_GPIO_B_NR, | ||
66 | .label = "GPB", | ||
67 | }, | ||
68 | }, { | ||
69 | .chip = { | ||
70 | .base = S5PV210_GPC0(0), | ||
71 | .ngpio = S5PV210_GPIO_C0_NR, | ||
72 | .label = "GPC0", | ||
73 | }, | ||
74 | }, { | ||
75 | .chip = { | ||
76 | .base = S5PV210_GPC1(0), | ||
77 | .ngpio = S5PV210_GPIO_C1_NR, | ||
78 | .label = "GPC1", | ||
79 | }, | ||
80 | }, { | ||
81 | .chip = { | ||
82 | .base = S5PV210_GPD0(0), | ||
83 | .ngpio = S5PV210_GPIO_D0_NR, | ||
84 | .label = "GPD0", | ||
85 | }, | ||
86 | }, { | ||
87 | .chip = { | ||
88 | .base = S5PV210_GPD1(0), | ||
89 | .ngpio = S5PV210_GPIO_D1_NR, | ||
90 | .label = "GPD1", | ||
91 | }, | ||
92 | }, { | ||
93 | .chip = { | ||
94 | .base = S5PV210_GPE0(0), | ||
95 | .ngpio = S5PV210_GPIO_E0_NR, | ||
96 | .label = "GPE0", | ||
97 | }, | ||
98 | }, { | ||
99 | .chip = { | ||
100 | .base = S5PV210_GPE1(0), | ||
101 | .ngpio = S5PV210_GPIO_E1_NR, | ||
102 | .label = "GPE1", | ||
103 | }, | ||
104 | }, { | ||
105 | .chip = { | ||
106 | .base = S5PV210_GPF0(0), | ||
107 | .ngpio = S5PV210_GPIO_F0_NR, | ||
108 | .label = "GPF0", | ||
109 | }, | ||
110 | }, { | ||
111 | .chip = { | ||
112 | .base = S5PV210_GPF1(0), | ||
113 | .ngpio = S5PV210_GPIO_F1_NR, | ||
114 | .label = "GPF1", | ||
115 | }, | ||
116 | }, { | ||
117 | .chip = { | ||
118 | .base = S5PV210_GPF2(0), | ||
119 | .ngpio = S5PV210_GPIO_F2_NR, | ||
120 | .label = "GPF2", | ||
121 | }, | ||
122 | }, { | ||
123 | .chip = { | ||
124 | .base = S5PV210_GPF3(0), | ||
125 | .ngpio = S5PV210_GPIO_F3_NR, | ||
126 | .label = "GPF3", | ||
127 | }, | ||
128 | }, { | ||
129 | .chip = { | ||
130 | .base = S5PV210_GPG0(0), | ||
131 | .ngpio = S5PV210_GPIO_G0_NR, | ||
132 | .label = "GPG0", | ||
133 | }, | ||
134 | }, { | ||
135 | .chip = { | ||
136 | .base = S5PV210_GPG1(0), | ||
137 | .ngpio = S5PV210_GPIO_G1_NR, | ||
138 | .label = "GPG1", | ||
139 | }, | ||
140 | }, { | ||
141 | .chip = { | ||
142 | .base = S5PV210_GPG2(0), | ||
143 | .ngpio = S5PV210_GPIO_G2_NR, | ||
144 | .label = "GPG2", | ||
145 | }, | ||
146 | }, { | ||
147 | .chip = { | ||
148 | .base = S5PV210_GPG3(0), | ||
149 | .ngpio = S5PV210_GPIO_G3_NR, | ||
150 | .label = "GPG3", | ||
151 | }, | ||
152 | }, { | ||
153 | .chip = { | ||
154 | .base = S5PV210_GPI(0), | ||
155 | .ngpio = S5PV210_GPIO_I_NR, | ||
156 | .label = "GPI", | ||
157 | }, | ||
158 | }, { | ||
159 | .chip = { | ||
160 | .base = S5PV210_GPJ0(0), | ||
161 | .ngpio = S5PV210_GPIO_J0_NR, | ||
162 | .label = "GPJ0", | ||
163 | }, | ||
164 | }, { | ||
165 | .chip = { | ||
166 | .base = S5PV210_GPJ1(0), | ||
167 | .ngpio = S5PV210_GPIO_J1_NR, | ||
168 | .label = "GPJ1", | ||
169 | }, | ||
170 | }, { | ||
171 | .chip = { | ||
172 | .base = S5PV210_GPJ2(0), | ||
173 | .ngpio = S5PV210_GPIO_J2_NR, | ||
174 | .label = "GPJ2", | ||
175 | }, | ||
176 | }, { | ||
177 | .chip = { | ||
178 | .base = S5PV210_GPJ3(0), | ||
179 | .ngpio = S5PV210_GPIO_J3_NR, | ||
180 | .label = "GPJ3", | ||
181 | }, | ||
182 | }, { | ||
183 | .chip = { | ||
184 | .base = S5PV210_GPJ4(0), | ||
185 | .ngpio = S5PV210_GPIO_J4_NR, | ||
186 | .label = "GPJ4", | ||
187 | }, | ||
188 | }, { | ||
189 | .config = &gpio_cfg_noint, | ||
190 | .chip = { | ||
191 | .base = S5PV210_MP01(0), | ||
192 | .ngpio = S5PV210_GPIO_MP01_NR, | ||
193 | .label = "MP01", | ||
194 | }, | ||
195 | }, { | ||
196 | .config = &gpio_cfg_noint, | ||
197 | .chip = { | ||
198 | .base = S5PV210_MP02(0), | ||
199 | .ngpio = S5PV210_GPIO_MP02_NR, | ||
200 | .label = "MP02", | ||
201 | }, | ||
202 | }, { | ||
203 | .config = &gpio_cfg_noint, | ||
204 | .chip = { | ||
205 | .base = S5PV210_MP03(0), | ||
206 | .ngpio = S5PV210_GPIO_MP03_NR, | ||
207 | .label = "MP03", | ||
208 | }, | ||
209 | }, { | ||
210 | .base = (S5P_VA_GPIO + 0xC00), | ||
211 | .config = &gpio_cfg_noint, | ||
212 | .chip = { | ||
213 | .base = S5PV210_GPH0(0), | ||
214 | .ngpio = S5PV210_GPIO_H0_NR, | ||
215 | .label = "GPH0", | ||
216 | }, | ||
217 | }, { | ||
218 | .base = (S5P_VA_GPIO + 0xC20), | ||
219 | .config = &gpio_cfg_noint, | ||
220 | .chip = { | ||
221 | .base = S5PV210_GPH1(0), | ||
222 | .ngpio = S5PV210_GPIO_H1_NR, | ||
223 | .label = "GPH1", | ||
224 | }, | ||
225 | }, { | ||
226 | .base = (S5P_VA_GPIO + 0xC40), | ||
227 | .config = &gpio_cfg_noint, | ||
228 | .chip = { | ||
229 | .base = S5PV210_GPH2(0), | ||
230 | .ngpio = S5PV210_GPIO_H2_NR, | ||
231 | .label = "GPH2", | ||
232 | }, | ||
233 | }, { | ||
234 | .base = (S5P_VA_GPIO + 0xC60), | ||
235 | .config = &gpio_cfg_noint, | ||
236 | .chip = { | ||
237 | .base = S5PV210_GPH3(0), | ||
238 | .ngpio = S5PV210_GPIO_H3_NR, | ||
239 | .label = "GPH3", | ||
240 | }, | ||
241 | }, | ||
242 | }; | ||
243 | |||
244 | static __init int s5pv210_gpiolib_init(void) | ||
245 | { | ||
246 | struct s3c_gpio_chip *chip = s5pv210_gpio_4bit; | ||
247 | int nr_chips = ARRAY_SIZE(s5pv210_gpio_4bit); | ||
248 | int i = 0; | ||
249 | |||
250 | for (i = 0; i < nr_chips; i++, chip++) { | ||
251 | if (chip->config == NULL) | ||
252 | chip->config = &gpio_cfg; | ||
253 | if (chip->base == NULL) | ||
254 | chip->base = S5PV210_BANK_BASE(i); | ||
255 | } | ||
256 | |||
257 | samsung_gpiolib_add_4bit_chips(s5pv210_gpio_4bit, nr_chips); | ||
258 | |||
259 | return 0; | ||
260 | } | ||
261 | core_initcall(s5pv210_gpiolib_init); | ||
diff --git a/arch/arm/mach-s5pv210/include/mach/gpio.h b/arch/arm/mach-s5pv210/include/mach/gpio.h index 533b020e21e9..d6461ba2b71d 100644 --- a/arch/arm/mach-s5pv210/include/mach/gpio.h +++ b/arch/arm/mach-s5pv210/include/mach/gpio.h | |||
@@ -18,6 +18,8 @@ | |||
18 | #define gpio_cansleep __gpio_cansleep | 18 | #define gpio_cansleep __gpio_cansleep |
19 | #define gpio_to_irq __gpio_to_irq | 19 | #define gpio_to_irq __gpio_to_irq |
20 | 20 | ||
21 | /* Practically, GPIO banks upto MP03 are the configurable gpio banks */ | ||
22 | |||
21 | /* GPIO bank sizes */ | 23 | /* GPIO bank sizes */ |
22 | #define S5PV210_GPIO_A0_NR (8) | 24 | #define S5PV210_GPIO_A0_NR (8) |
23 | #define S5PV210_GPIO_A1_NR (4) | 25 | #define S5PV210_GPIO_A1_NR (4) |
@@ -47,6 +49,10 @@ | |||
47 | #define S5PV210_GPIO_J3_NR (8) | 49 | #define S5PV210_GPIO_J3_NR (8) |
48 | #define S5PV210_GPIO_J4_NR (5) | 50 | #define S5PV210_GPIO_J4_NR (5) |
49 | 51 | ||
52 | #define S5PV210_GPIO_MP01_NR (8) | ||
53 | #define S5PV210_GPIO_MP02_NR (4) | ||
54 | #define S5PV210_GPIO_MP03_NR (8) | ||
55 | |||
50 | /* GPIO bank numbers */ | 56 | /* GPIO bank numbers */ |
51 | 57 | ||
52 | /* CONFIG_S3C_GPIO_SPACE allows the user to select extra | 58 | /* CONFIG_S3C_GPIO_SPACE allows the user to select extra |
@@ -85,6 +91,9 @@ enum s5p_gpio_number { | |||
85 | S5PV210_GPIO_J2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J1), | 91 | S5PV210_GPIO_J2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J1), |
86 | S5PV210_GPIO_J3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J2), | 92 | S5PV210_GPIO_J3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J2), |
87 | S5PV210_GPIO_J4_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J3), | 93 | S5PV210_GPIO_J4_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J3), |
94 | S5PV210_GPIO_MP01_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J4), | ||
95 | S5PV210_GPIO_MP02_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP01), | ||
96 | S5PV210_GPIO_MP03_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP02), | ||
88 | }; | 97 | }; |
89 | 98 | ||
90 | /* S5PV210 GPIO number definitions */ | 99 | /* S5PV210 GPIO number definitions */ |
@@ -115,13 +124,16 @@ enum s5p_gpio_number { | |||
115 | #define S5PV210_GPJ2(_nr) (S5PV210_GPIO_J2_START + (_nr)) | 124 | #define S5PV210_GPJ2(_nr) (S5PV210_GPIO_J2_START + (_nr)) |
116 | #define S5PV210_GPJ3(_nr) (S5PV210_GPIO_J3_START + (_nr)) | 125 | #define S5PV210_GPJ3(_nr) (S5PV210_GPIO_J3_START + (_nr)) |
117 | #define S5PV210_GPJ4(_nr) (S5PV210_GPIO_J4_START + (_nr)) | 126 | #define S5PV210_GPJ4(_nr) (S5PV210_GPIO_J4_START + (_nr)) |
127 | #define S5PV210_MP01(_nr) (S5PV210_GPIO_MP01_START + (_nr)) | ||
128 | #define S5PV210_MP02(_nr) (S5PV210_GPIO_MP02_START + (_nr)) | ||
129 | #define S5PV210_MP03(_nr) (S5PV210_GPIO_MP03_START + (_nr)) | ||
118 | 130 | ||
119 | /* the end of the S5PV210 specific gpios */ | 131 | /* the end of the S5PV210 specific gpios */ |
120 | #define S5PV210_GPIO_END (S5PV210_GPJ4(S5PV210_GPIO_J4_NR) + 1) | 132 | #define S5PV210_GPIO_END (S5PV210_MP03(S5PV210_GPIO_MP03_NR) + 1) |
121 | #define S3C_GPIO_END S5PV210_GPIO_END | 133 | #define S3C_GPIO_END S5PV210_GPIO_END |
122 | 134 | ||
123 | /* define the number of gpios we need to the one after the GPJ4() range */ | 135 | /* define the number of gpios we need to the one after the MP03() range */ |
124 | #define ARCH_NR_GPIOS (S5PV210_GPJ4(S5PV210_GPIO_J4_NR) + \ | 136 | #define ARCH_NR_GPIOS (S5PV210_MP03(S5PV210_GPIO_MP03_NR) + \ |
125 | CONFIG_SAMSUNG_GPIO_EXTRA + 1) | 137 | CONFIG_SAMSUNG_GPIO_EXTRA + 1) |
126 | 138 | ||
127 | #include <asm-generic/gpio.h> | 139 | #include <asm-generic/gpio.h> |
diff --git a/arch/arm/mach-s5pv210/include/mach/pwm-clock.h b/arch/arm/mach-s5pv210/include/mach/pwm-clock.h index 69027fea987a..f8a9f1b330e0 100644 --- a/arch/arm/mach-s5pv210/include/mach/pwm-clock.h +++ b/arch/arm/mach-s5pv210/include/mach/pwm-clock.h | |||
@@ -1,13 +1,14 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/include/mach/pwm-clock.h | 1 | /* linux/arch/arm/mach-s5pv210/include/mach/pwm-clock.h |
2 | * | 2 | * |
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Copyright 2008 Openmoko, Inc. | ||
3 | * Copyright 2008 Simtec Electronics | 7 | * Copyright 2008 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 8 | * Ben Dooks <ben@simtec.co.uk> |
5 | * http://armlinux.simtec.co.uk/ | 9 | * http://armlinux.simtec.co.uk/ |
6 | * | 10 | * |
7 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | 11 | * Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h |
8 | * http://www.samsung.com/ | ||
9 | * | ||
10 | * Based on arch/arm/plat-s3c24xx/include/mach/pwm-clock.h | ||
11 | * | 12 | * |
12 | * S5PV210 - pwm clock and timer support | 13 | * S5PV210 - pwm clock and timer support |
13 | * | 14 | * |
@@ -21,14 +22,14 @@ | |||
21 | 22 | ||
22 | /** | 23 | /** |
23 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk | 24 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk |
24 | * @cfg: The timer TCFG1 register bits shifted down to 0. | 25 | * @tcfg: The timer TCFG1 register bits shifted down to 0. |
25 | * | 26 | * |
26 | * Return true if the given configuration from TCFG1 is a TCLK instead | 27 | * Return true if the given configuration from TCFG1 is a TCLK instead |
27 | * any of the TDIV clocks. | 28 | * any of the TDIV clocks. |
28 | */ | 29 | */ |
29 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | 30 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) |
30 | { | 31 | { |
31 | return tcfg == S3C2410_TCFG1_MUX_TCLK; | 32 | return tcfg == S3C64XX_TCFG1_MUX_TCLK; |
32 | } | 33 | } |
33 | 34 | ||
34 | /** | 35 | /** |
@@ -40,7 +41,7 @@ static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | |||
40 | */ | 41 | */ |
41 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | 42 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) |
42 | { | 43 | { |
43 | return 1 << (1 + tcfg1); | 44 | return 1 << tcfg1; |
44 | } | 45 | } |
45 | 46 | ||
46 | /** | 47 | /** |
@@ -50,7 +51,7 @@ static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | |||
50 | */ | 51 | */ |
51 | static inline unsigned int pwm_tdiv_has_div1(void) | 52 | static inline unsigned int pwm_tdiv_has_div1(void) |
52 | { | 53 | { |
53 | return 0; | 54 | return 1; |
54 | } | 55 | } |
55 | 56 | ||
56 | /** | 57 | /** |
@@ -61,9 +62,9 @@ static inline unsigned int pwm_tdiv_has_div1(void) | |||
61 | */ | 62 | */ |
62 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) | 63 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) |
63 | { | 64 | { |
64 | return ilog2(div) - 1; | 65 | return ilog2(div); |
65 | } | 66 | } |
66 | 67 | ||
67 | #define S3C_TCFG1_MUX_TCLK S3C2410_TCFG1_MUX_TCLK | 68 | #define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK |
68 | 69 | ||
69 | #endif /* __ASM_ARCH_PWMCLK_H */ | 70 | #endif /* __ASM_ARCH_PWMCLK_H */ |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 241c24a1c18f..45a1bc275f0a 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -869,9 +869,10 @@ void __init reserve_node_zero(pg_data_t *pgdat) | |||
869 | if (machine_is_p720t()) | 869 | if (machine_is_p720t()) |
870 | res_size = 0x00014000; | 870 | res_size = 0x00014000; |
871 | 871 | ||
872 | /* H1940 and RX3715 need to reserve this for suspend */ | 872 | /* H1940, RX3715 and RX1950 need to reserve this for suspend */ |
873 | 873 | ||
874 | if (machine_is_h1940() || machine_is_rx3715()) { | 874 | if (machine_is_h1940() || machine_is_rx3715() |
875 | || machine_is_rx1950()) { | ||
875 | reserve_bootmem_node(pgdat, 0x30003000, 0x1000, | 876 | reserve_bootmem_node(pgdat, 0x30003000, 0x1000, |
876 | BOOTMEM_DEFAULT); | 877 | BOOTMEM_DEFAULT); |
877 | reserve_bootmem_node(pgdat, 0x30081000, 0x1000, | 878 | reserve_bootmem_node(pgdat, 0x30081000, 0x1000, |
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig index 6e93ef8f3d43..a830fad6f89e 100644 --- a/arch/arm/plat-s3c24xx/Kconfig +++ b/arch/arm/plat-s3c24xx/Kconfig | |||
@@ -9,6 +9,7 @@ config PLAT_S3C24XX | |||
9 | select NO_IOPORT | 9 | select NO_IOPORT |
10 | select ARCH_REQUIRE_GPIOLIB | 10 | select ARCH_REQUIRE_GPIOLIB |
11 | select S3C_DEVICE_NAND | 11 | select S3C_DEVICE_NAND |
12 | select S3C_GPIO_CFG_S3C24XX | ||
12 | help | 13 | help |
13 | Base platform code for any Samsung S3C24XX device | 14 | Base platform code for any Samsung S3C24XX device |
14 | 15 | ||
diff --git a/arch/arm/plat-s3c24xx/common-smdk.c b/arch/arm/plat-s3c24xx/common-smdk.c index 9e0e20ad2e46..7b44d0c592b5 100644 --- a/arch/arm/plat-s3c24xx/common-smdk.c +++ b/arch/arm/plat-s3c24xx/common-smdk.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <plat/nand.h> | 42 | #include <plat/nand.h> |
43 | 43 | ||
44 | #include <plat/common-smdk.h> | 44 | #include <plat/common-smdk.h> |
45 | #include <plat/gpio-cfg.h> | ||
45 | #include <plat/devs.h> | 46 | #include <plat/devs.h> |
46 | #include <plat/pm.h> | 47 | #include <plat/pm.h> |
47 | 48 | ||
@@ -185,10 +186,10 @@ void __init smdk_machine_init(void) | |||
185 | { | 186 | { |
186 | /* Configure the LEDs (even if we have no LED support)*/ | 187 | /* Configure the LEDs (even if we have no LED support)*/ |
187 | 188 | ||
188 | s3c2410_gpio_cfgpin(S3C2410_GPF(4), S3C2410_GPIO_OUTPUT); | 189 | s3c_gpio_cfgpin(S3C2410_GPF(4), S3C2410_GPIO_OUTPUT); |
189 | s3c2410_gpio_cfgpin(S3C2410_GPF(5), S3C2410_GPIO_OUTPUT); | 190 | s3c_gpio_cfgpin(S3C2410_GPF(5), S3C2410_GPIO_OUTPUT); |
190 | s3c2410_gpio_cfgpin(S3C2410_GPF(6), S3C2410_GPIO_OUTPUT); | 191 | s3c_gpio_cfgpin(S3C2410_GPF(6), S3C2410_GPIO_OUTPUT); |
191 | s3c2410_gpio_cfgpin(S3C2410_GPF(7), S3C2410_GPIO_OUTPUT); | 192 | s3c_gpio_cfgpin(S3C2410_GPF(7), S3C2410_GPIO_OUTPUT); |
192 | 193 | ||
193 | s3c2410_gpio_setpin(S3C2410_GPF(4), 1); | 194 | s3c2410_gpio_setpin(S3C2410_GPF(4), 1); |
194 | s3c2410_gpio_setpin(S3C2410_GPF(5), 1); | 195 | s3c2410_gpio_setpin(S3C2410_GPF(5), 1); |
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c index 9265f09bfa58..cd5b41d0b5a4 100644 --- a/arch/arm/plat-s3c24xx/devs.c +++ b/arch/arm/plat-s3c24xx/devs.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/string.h> | ||
24 | 25 | ||
25 | #include <asm/mach/arch.h> | 26 | #include <asm/mach/arch.h> |
26 | #include <asm/mach/map.h> | 27 | #include <asm/mach/map.h> |
@@ -149,10 +150,14 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd) | |||
149 | { | 150 | { |
150 | struct s3c2410fb_mach_info *npd; | 151 | struct s3c2410fb_mach_info *npd; |
151 | 152 | ||
152 | npd = kmalloc(sizeof(*npd), GFP_KERNEL); | 153 | npd = kmemdup(pd, sizeof(*npd), GFP_KERNEL); |
153 | if (npd) { | 154 | if (npd) { |
154 | memcpy(npd, pd, sizeof(*npd)); | ||
155 | s3c_device_lcd.dev.platform_data = npd; | 155 | s3c_device_lcd.dev.platform_data = npd; |
156 | npd->displays = kmemdup(pd->displays, | ||
157 | sizeof(struct s3c2410fb_display) * npd->num_displays, | ||
158 | GFP_KERNEL); | ||
159 | if (!npd->displays) | ||
160 | printk(KERN_ERR "no memory for LCD display data\n"); | ||
156 | } else { | 161 | } else { |
157 | printk(KERN_ERR "no memory for LCD platform data\n"); | 162 | printk(KERN_ERR "no memory for LCD platform data\n"); |
158 | } | 163 | } |
@@ -338,14 +343,6 @@ struct platform_device s3c_device_adc = { | |||
338 | .resource = s3c_adc_resource, | 343 | .resource = s3c_adc_resource, |
339 | }; | 344 | }; |
340 | 345 | ||
341 | /* HWMON */ | ||
342 | |||
343 | struct platform_device s3c_device_hwmon = { | ||
344 | .name = "s3c-hwmon", | ||
345 | .id = -1, | ||
346 | .dev.parent = &s3c_device_adc.dev, | ||
347 | }; | ||
348 | |||
349 | /* SDI */ | 346 | /* SDI */ |
350 | 347 | ||
351 | static struct resource s3c_sdi_resource[] = { | 348 | static struct resource s3c_sdi_resource[] = { |
@@ -371,7 +368,7 @@ struct platform_device s3c_device_sdi = { | |||
371 | 368 | ||
372 | EXPORT_SYMBOL(s3c_device_sdi); | 369 | EXPORT_SYMBOL(s3c_device_sdi); |
373 | 370 | ||
374 | void s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata) | 371 | void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata) |
375 | { | 372 | { |
376 | struct s3c24xx_mci_pdata *npd; | 373 | struct s3c24xx_mci_pdata *npd; |
377 | 374 | ||
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c index 93827b3d4e84..6ad274e7593d 100644 --- a/arch/arm/plat-s3c24xx/dma.c +++ b/arch/arm/plat-s3c24xx/dma.c | |||
@@ -1104,7 +1104,7 @@ EXPORT_SYMBOL(s3c2410_dma_config); | |||
1104 | * devaddr: physical address of the source | 1104 | * devaddr: physical address of the source |
1105 | */ | 1105 | */ |
1106 | 1106 | ||
1107 | int s3c2410_dma_devconfig(int channel, | 1107 | int s3c2410_dma_devconfig(unsigned int channel, |
1108 | enum s3c2410_dmasrc source, | 1108 | enum s3c2410_dmasrc source, |
1109 | unsigned long devaddr) | 1109 | unsigned long devaddr) |
1110 | { | 1110 | { |
diff --git a/arch/arm/plat-s3c24xx/gpio.c b/arch/arm/plat-s3c24xx/gpio.c index 5467470badfd..2f3d7c089dfa 100644 --- a/arch/arm/plat-s3c24xx/gpio.c +++ b/arch/arm/plat-s3c24xx/gpio.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/gpio.c | 1 | /* linux/arch/arm/plat-s3c24xx/gpio.c |
2 | * | 2 | * |
3 | * Copyright (c) 2004-2005 Simtec Electronics | 3 | * Copyright (c) 2004-2010 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 4 | * Ben Dooks <ben@simtec.co.uk> |
5 | * | 5 | * |
6 | * S3C24XX GPIO support | 6 | * S3C24XX GPIO support |
@@ -20,12 +20,12 @@ | |||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ | 21 | */ |
22 | 22 | ||
23 | |||
24 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
25 | #include <linux/init.h> | 24 | #include <linux/init.h> |
26 | #include <linux/module.h> | 25 | #include <linux/module.h> |
27 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
28 | #include <linux/ioport.h> | 27 | #include <linux/ioport.h> |
28 | #include <linux/gpio.h> | ||
29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
30 | 30 | ||
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
@@ -34,133 +34,46 @@ | |||
34 | 34 | ||
35 | #include <mach/regs-gpio.h> | 35 | #include <mach/regs-gpio.h> |
36 | 36 | ||
37 | void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function) | 37 | #include <plat/gpio-core.h> |
38 | { | ||
39 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | ||
40 | unsigned long mask; | ||
41 | unsigned long con; | ||
42 | unsigned long flags; | ||
43 | 38 | ||
44 | if (pin < S3C2410_GPIO_BANKB) { | 39 | /* gpiolib wrappers until these are totally eliminated */ |
45 | mask = 1 << S3C2410_GPIO_OFFSET(pin); | ||
46 | } else { | ||
47 | mask = 3 << S3C2410_GPIO_OFFSET(pin)*2; | ||
48 | } | ||
49 | |||
50 | switch (function) { | ||
51 | case S3C2410_GPIO_LEAVE: | ||
52 | mask = 0; | ||
53 | function = 0; | ||
54 | break; | ||
55 | |||
56 | case S3C2410_GPIO_INPUT: | ||
57 | case S3C2410_GPIO_OUTPUT: | ||
58 | case S3C2410_GPIO_SFN2: | ||
59 | case S3C2410_GPIO_SFN3: | ||
60 | if (pin < S3C2410_GPIO_BANKB) { | ||
61 | function -= 1; | ||
62 | function &= 1; | ||
63 | function <<= S3C2410_GPIO_OFFSET(pin); | ||
64 | } else { | ||
65 | function &= 3; | ||
66 | function <<= S3C2410_GPIO_OFFSET(pin)*2; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /* modify the specified register wwith IRQs off */ | ||
71 | |||
72 | local_irq_save(flags); | ||
73 | |||
74 | con = __raw_readl(base + 0x00); | ||
75 | con &= ~mask; | ||
76 | con |= function; | ||
77 | |||
78 | __raw_writel(con, base + 0x00); | ||
79 | |||
80 | local_irq_restore(flags); | ||
81 | } | ||
82 | |||
83 | EXPORT_SYMBOL(s3c2410_gpio_cfgpin); | ||
84 | |||
85 | unsigned int s3c2410_gpio_getcfg(unsigned int pin) | ||
86 | { | ||
87 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | ||
88 | unsigned long val = __raw_readl(base); | ||
89 | |||
90 | if (pin < S3C2410_GPIO_BANKB) { | ||
91 | val >>= S3C2410_GPIO_OFFSET(pin); | ||
92 | val &= 1; | ||
93 | val += 1; | ||
94 | } else { | ||
95 | val >>= S3C2410_GPIO_OFFSET(pin)*2; | ||
96 | val &= 3; | ||
97 | } | ||
98 | |||
99 | return val | S3C2410_GPIO_INPUT; | ||
100 | } | ||
101 | |||
102 | EXPORT_SYMBOL(s3c2410_gpio_getcfg); | ||
103 | 40 | ||
104 | void s3c2410_gpio_pullup(unsigned int pin, unsigned int to) | 41 | void s3c2410_gpio_pullup(unsigned int pin, unsigned int to) |
105 | { | 42 | { |
106 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | 43 | int ret; |
107 | unsigned long offs = S3C2410_GPIO_OFFSET(pin); | ||
108 | unsigned long flags; | ||
109 | unsigned long up; | ||
110 | 44 | ||
111 | if (pin < S3C2410_GPIO_BANKB) | 45 | WARN_ON(to); /* should be none of these left */ |
112 | return; | ||
113 | 46 | ||
114 | local_irq_save(flags); | 47 | if (!to) { |
115 | 48 | /* if pull is enabled, try first with up, and if that | |
116 | up = __raw_readl(base + 0x08); | 49 | * fails, try using down */ |
117 | up &= ~(1L << offs); | ||
118 | up |= to << offs; | ||
119 | __raw_writel(up, base + 0x08); | ||
120 | 50 | ||
121 | local_irq_restore(flags); | 51 | ret = s3c_gpio_setpull(pin, S3C_GPIO_PULL_UP); |
52 | if (ret) | ||
53 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_DOWN); | ||
54 | } else { | ||
55 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_NONE); | ||
56 | } | ||
122 | } | 57 | } |
123 | |||
124 | EXPORT_SYMBOL(s3c2410_gpio_pullup); | 58 | EXPORT_SYMBOL(s3c2410_gpio_pullup); |
125 | 59 | ||
126 | int s3c2410_gpio_getpull(unsigned int pin) | ||
127 | { | ||
128 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | ||
129 | unsigned long offs = S3C2410_GPIO_OFFSET(pin); | ||
130 | |||
131 | if (pin < S3C2410_GPIO_BANKB) | ||
132 | return -EINVAL; | ||
133 | |||
134 | return (__raw_readl(base + 0x08) & (1L << offs)) ? 1 : 0; | ||
135 | } | ||
136 | |||
137 | EXPORT_SYMBOL(s3c2410_gpio_getpull); | ||
138 | |||
139 | void s3c2410_gpio_setpin(unsigned int pin, unsigned int to) | 60 | void s3c2410_gpio_setpin(unsigned int pin, unsigned int to) |
140 | { | 61 | { |
141 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | 62 | /* do this via gpiolib until all users removed */ |
142 | unsigned long offs = S3C2410_GPIO_OFFSET(pin); | ||
143 | unsigned long flags; | ||
144 | unsigned long dat; | ||
145 | 63 | ||
146 | local_irq_save(flags); | 64 | gpio_request(pin, "temporary"); |
147 | 65 | gpio_set_value(pin, to); | |
148 | dat = __raw_readl(base + 0x04); | 66 | gpio_free(pin); |
149 | dat &= ~(1 << offs); | ||
150 | dat |= to << offs; | ||
151 | __raw_writel(dat, base + 0x04); | ||
152 | |||
153 | local_irq_restore(flags); | ||
154 | } | 67 | } |
155 | 68 | ||
156 | EXPORT_SYMBOL(s3c2410_gpio_setpin); | 69 | EXPORT_SYMBOL(s3c2410_gpio_setpin); |
157 | 70 | ||
158 | unsigned int s3c2410_gpio_getpin(unsigned int pin) | 71 | unsigned int s3c2410_gpio_getpin(unsigned int pin) |
159 | { | 72 | { |
160 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | 73 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); |
161 | unsigned long offs = S3C2410_GPIO_OFFSET(pin); | 74 | unsigned long offs = pin - chip->chip.base; |
162 | 75 | ||
163 | return __raw_readl(base + 0x04) & (1<< offs); | 76 | return __raw_readl(chip->base + 0x04) & (1<< offs); |
164 | } | 77 | } |
165 | 78 | ||
166 | EXPORT_SYMBOL(s3c2410_gpio_getpin); | 79 | EXPORT_SYMBOL(s3c2410_gpio_getpin); |
@@ -181,22 +94,3 @@ unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change) | |||
181 | } | 94 | } |
182 | 95 | ||
183 | EXPORT_SYMBOL(s3c2410_modify_misccr); | 96 | EXPORT_SYMBOL(s3c2410_modify_misccr); |
184 | |||
185 | int s3c2410_gpio_getirq(unsigned int pin) | ||
186 | { | ||
187 | if (pin < S3C2410_GPF(0) || pin > S3C2410_GPG(15)) | ||
188 | return -EINVAL; /* not valid interrupts */ | ||
189 | |||
190 | if (pin < S3C2410_GPG(0) && pin > S3C2410_GPF(7)) | ||
191 | return -EINVAL; /* not valid pin */ | ||
192 | |||
193 | if (pin < S3C2410_GPF(4)) | ||
194 | return (pin - S3C2410_GPF(0)) + IRQ_EINT0; | ||
195 | |||
196 | if (pin < S3C2410_GPG(0)) | ||
197 | return (pin - S3C2410_GPF(4)) + IRQ_EINT4; | ||
198 | |||
199 | return (pin - S3C2410_GPG(0)) + IRQ_EINT8; | ||
200 | } | ||
201 | |||
202 | EXPORT_SYMBOL(s3c2410_gpio_getirq); | ||
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c index 4f0f11a6a677..4c0896f2572d 100644 --- a/arch/arm/plat-s3c24xx/gpiolib.c +++ b/arch/arm/plat-s3c24xx/gpiolib.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/gpiolib.c | 1 | /* linux/arch/arm/plat-s3c24xx/gpiolib.c |
2 | * | 2 | * |
3 | * Copyright (c) 2008 Simtec Electronics | 3 | * Copyright (c) 2008-2010 Simtec Electronics |
4 | * http://armlinux.simtec.co.uk/ | 4 | * http://armlinux.simtec.co.uk/ |
5 | * Ben Dooks <ben@simtec.co.uk> | 5 | * Ben Dooks <ben@simtec.co.uk> |
6 | * | 6 | * |
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | 22 | ||
23 | #include <plat/gpio-core.h> | 23 | #include <plat/gpio-core.h> |
24 | #include <plat/gpio-cfg.h> | ||
25 | #include <plat/gpio-cfg-helpers.h> | ||
24 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
25 | #include <asm/irq.h> | 27 | #include <asm/irq.h> |
26 | #include <plat/pm.h> | 28 | #include <plat/pm.h> |
@@ -77,10 +79,21 @@ static int s3c24xx_gpiolib_bankg_toirq(struct gpio_chip *chip, unsigned offset) | |||
77 | return IRQ_EINT8 + offset; | 79 | return IRQ_EINT8 + offset; |
78 | } | 80 | } |
79 | 81 | ||
82 | static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = { | ||
83 | .set_config = s3c_gpio_setcfg_s3c24xx_a, | ||
84 | .get_config = s3c_gpio_getcfg_s3c24xx_a, | ||
85 | }; | ||
86 | |||
87 | struct s3c_gpio_cfg s3c24xx_gpiocfg_default = { | ||
88 | .set_config = s3c_gpio_setcfg_s3c24xx, | ||
89 | .get_config = s3c_gpio_getcfg_s3c24xx, | ||
90 | }; | ||
91 | |||
80 | struct s3c_gpio_chip s3c24xx_gpios[] = { | 92 | struct s3c_gpio_chip s3c24xx_gpios[] = { |
81 | [0] = { | 93 | [0] = { |
82 | .base = S3C2410_GPACON, | 94 | .base = S3C2410_GPACON, |
83 | .pm = __gpio_pm(&s3c_gpio_pm_1bit), | 95 | .pm = __gpio_pm(&s3c_gpio_pm_1bit), |
96 | .config = &s3c24xx_gpiocfg_banka, | ||
84 | .chip = { | 97 | .chip = { |
85 | .base = S3C2410_GPA(0), | 98 | .base = S3C2410_GPA(0), |
86 | .owner = THIS_MODULE, | 99 | .owner = THIS_MODULE, |
@@ -161,15 +174,58 @@ struct s3c_gpio_chip s3c24xx_gpios[] = { | |||
161 | .ngpio = 11, | 174 | .ngpio = 11, |
162 | }, | 175 | }, |
163 | }, | 176 | }, |
177 | /* GPIOS for the S3C2443 and later devices. */ | ||
178 | { | ||
179 | .base = S3C2440_GPJCON, | ||
180 | .pm = __gpio_pm(&s3c_gpio_pm_2bit), | ||
181 | .chip = { | ||
182 | .base = S3C2410_GPJ(0), | ||
183 | .owner = THIS_MODULE, | ||
184 | .label = "GPIOJ", | ||
185 | .ngpio = 16, | ||
186 | }, | ||
187 | }, { | ||
188 | .base = S3C2443_GPKCON, | ||
189 | .pm = __gpio_pm(&s3c_gpio_pm_2bit), | ||
190 | .chip = { | ||
191 | .base = S3C2410_GPK(0), | ||
192 | .owner = THIS_MODULE, | ||
193 | .label = "GPIOK", | ||
194 | .ngpio = 16, | ||
195 | }, | ||
196 | }, { | ||
197 | .base = S3C2443_GPLCON, | ||
198 | .pm = __gpio_pm(&s3c_gpio_pm_2bit), | ||
199 | .chip = { | ||
200 | .base = S3C2410_GPL(0), | ||
201 | .owner = THIS_MODULE, | ||
202 | .label = "GPIOL", | ||
203 | .ngpio = 15, | ||
204 | }, | ||
205 | }, { | ||
206 | .base = S3C2443_GPMCON, | ||
207 | .pm = __gpio_pm(&s3c_gpio_pm_2bit), | ||
208 | .chip = { | ||
209 | .base = S3C2410_GPM(0), | ||
210 | .owner = THIS_MODULE, | ||
211 | .label = "GPIOM", | ||
212 | .ngpio = 2, | ||
213 | }, | ||
214 | }, | ||
164 | }; | 215 | }; |
165 | 216 | ||
217 | |||
166 | static __init int s3c24xx_gpiolib_init(void) | 218 | static __init int s3c24xx_gpiolib_init(void) |
167 | { | 219 | { |
168 | struct s3c_gpio_chip *chip = s3c24xx_gpios; | 220 | struct s3c_gpio_chip *chip = s3c24xx_gpios; |
169 | int gpn; | 221 | int gpn; |
170 | 222 | ||
171 | for (gpn = 0; gpn < ARRAY_SIZE(s3c24xx_gpios); gpn++, chip++) | 223 | for (gpn = 0; gpn < ARRAY_SIZE(s3c24xx_gpios); gpn++, chip++) { |
224 | if (!chip->config) | ||
225 | chip->config = &s3c24xx_gpiocfg_default; | ||
226 | |||
172 | s3c_gpiolib_add(chip); | 227 | s3c_gpiolib_add(chip); |
228 | } | ||
173 | 229 | ||
174 | return 0; | 230 | return 0; |
175 | } | 231 | } |
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c index 3620dd299095..60627e63a254 100644 --- a/arch/arm/plat-s3c24xx/pm.c +++ b/arch/arm/plat-s3c24xx/pm.c | |||
@@ -43,6 +43,7 @@ | |||
43 | 43 | ||
44 | #include <asm/mach/time.h> | 44 | #include <asm/mach/time.h> |
45 | 45 | ||
46 | #include <plat/gpio-cfg.h> | ||
46 | #include <plat/pm.h> | 47 | #include <plat/pm.h> |
47 | 48 | ||
48 | #define PFX "s3c24xx-pm: " | 49 | #define PFX "s3c24xx-pm: " |
@@ -90,22 +91,22 @@ static void s3c_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs) | |||
90 | { | 91 | { |
91 | unsigned long irqstate; | 92 | unsigned long irqstate; |
92 | unsigned long pinstate; | 93 | unsigned long pinstate; |
93 | int irq = s3c2410_gpio_getirq(pin); | 94 | int irq = gpio_to_irq(pin); |
94 | 95 | ||
95 | if (irqoffs < 4) | 96 | if (irqoffs < 4) |
96 | irqstate = s3c_irqwake_intmask & (1L<<irqoffs); | 97 | irqstate = s3c_irqwake_intmask & (1L<<irqoffs); |
97 | else | 98 | else |
98 | irqstate = s3c_irqwake_eintmask & (1L<<irqoffs); | 99 | irqstate = s3c_irqwake_eintmask & (1L<<irqoffs); |
99 | 100 | ||
100 | pinstate = s3c2410_gpio_getcfg(pin); | 101 | pinstate = s3c_gpio_getcfg(pin); |
101 | 102 | ||
102 | if (!irqstate) { | 103 | if (!irqstate) { |
103 | if (pinstate == S3C2410_GPIO_IRQ) | 104 | if (pinstate == S3C2410_GPIO_IRQ) |
104 | S3C_PMDBG("Leaving IRQ %d (pin %d) enabled\n", irq, pin); | 105 | S3C_PMDBG("Leaving IRQ %d (pin %d) as is\n", irq, pin); |
105 | } else { | 106 | } else { |
106 | if (pinstate == S3C2410_GPIO_IRQ) { | 107 | if (pinstate == S3C2410_GPIO_IRQ) { |
107 | S3C_PMDBG("Disabling IRQ %d (pin %d)\n", irq, pin); | 108 | S3C_PMDBG("Disabling IRQ %d (pin %d)\n", irq, pin); |
108 | s3c2410_gpio_cfgpin(pin, S3C2410_GPIO_INPUT); | 109 | s3c_gpio_cfgpin(pin, S3C2410_GPIO_INPUT); |
109 | } | 110 | } |
110 | } | 111 | } |
111 | } | 112 | } |
diff --git a/arch/arm/plat-s3c24xx/setup-i2c.c b/arch/arm/plat-s3c24xx/setup-i2c.c index 71a6accf114e..9e90a7cbd1d6 100644 --- a/arch/arm/plat-s3c24xx/setup-i2c.c +++ b/arch/arm/plat-s3c24xx/setup-i2c.c | |||
@@ -15,12 +15,13 @@ | |||
15 | 15 | ||
16 | struct platform_device; | 16 | struct platform_device; |
17 | 17 | ||
18 | #include <plat/gpio-cfg.h> | ||
18 | #include <plat/iic.h> | 19 | #include <plat/iic.h> |
19 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
20 | #include <mach/regs-gpio.h> | 21 | #include <mach/regs-gpio.h> |
21 | 22 | ||
22 | void s3c_i2c0_cfg_gpio(struct platform_device *dev) | 23 | void s3c_i2c0_cfg_gpio(struct platform_device *dev) |
23 | { | 24 | { |
24 | s3c2410_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPE15_IICSDA); | 25 | s3c_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPE15_IICSDA); |
25 | s3c2410_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPE14_IICSCL); | 26 | s3c_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPE14_IICSCL); |
26 | } | 27 | } |
diff --git a/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c b/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c index da7a61728c18..9793544a6ace 100644 --- a/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c +++ b/arch/arm/plat-s3c24xx/spi-bus0-gpe11_12_13.c | |||
@@ -21,16 +21,16 @@ void s3c24xx_spi_gpiocfg_bus0_gpe11_12_13(struct s3c2410_spi_info *spi, | |||
21 | int enable) | 21 | int enable) |
22 | { | 22 | { |
23 | if (enable) { | 23 | if (enable) { |
24 | s3c2410_gpio_cfgpin(S3C2410_GPE(13), S3C2410_GPE13_SPICLK0); | 24 | s3c_gpio_cfgpin(S3C2410_GPE(13), S3C2410_GPE13_SPICLK0); |
25 | s3c2410_gpio_cfgpin(S3C2410_GPE(12), S3C2410_GPE12_SPIMOSI0); | 25 | s3c_gpio_cfgpin(S3C2410_GPE(12), S3C2410_GPE12_SPIMOSI0); |
26 | s3c2410_gpio_cfgpin(S3C2410_GPE(11), S3C2410_GPE11_SPIMISO0); | 26 | s3c_gpio_cfgpin(S3C2410_GPE(11), S3C2410_GPE11_SPIMISO0); |
27 | s3c2410_gpio_pullup(S3C2410_GPE(11), 0); | 27 | s3c2410_gpio_pullup(S3C2410_GPE(11), 0); |
28 | s3c2410_gpio_pullup(S3C2410_GPE(13), 0); | 28 | s3c2410_gpio_pullup(S3C2410_GPE(13), 0); |
29 | } else { | 29 | } else { |
30 | s3c2410_gpio_cfgpin(S3C2410_GPE(13), S3C2410_GPIO_INPUT); | 30 | s3c_gpio_cfgpin(S3C2410_GPE(13), S3C2410_GPIO_INPUT); |
31 | s3c2410_gpio_cfgpin(S3C2410_GPE(11), S3C2410_GPIO_INPUT); | 31 | s3c_gpio_cfgpin(S3C2410_GPE(11), S3C2410_GPIO_INPUT); |
32 | s3c2410_gpio_pullup(S3C2410_GPE(11), 1); | 32 | s3c_gpio_cfgpull(S3C2410_GPE(11), S3C_GPIO_PULL_NONE); |
33 | s3c2410_gpio_pullup(S3C2410_GPE(12), 1); | 33 | s3c_gpio_cfgpull(S3C2410_GPE(12), S3C_GPIO_PULL_NONE); |
34 | s3c2410_gpio_pullup(S3C2410_GPE(13), 1); | 34 | s3c_gpio_cfgpull(S3C2410_GPE(13), S3C_GPIO_PULL_NONE); |
35 | } | 35 | } |
36 | } | 36 | } |
diff --git a/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c b/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c index 89fcf5308cf6..db9e9e477ec1 100644 --- a/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c +++ b/arch/arm/plat-s3c24xx/spi-bus1-gpd8_9_10.c | |||
@@ -23,16 +23,16 @@ void s3c24xx_spi_gpiocfg_bus1_gpd8_9_10(struct s3c2410_spi_info *spi, | |||
23 | 23 | ||
24 | printk(KERN_INFO "%s(%d)\n", __func__, enable); | 24 | printk(KERN_INFO "%s(%d)\n", __func__, enable); |
25 | if (enable) { | 25 | if (enable) { |
26 | s3c2410_gpio_cfgpin(S3C2410_GPD(10), S3C2440_GPD10_SPICLK1); | 26 | s3c_gpio_cfgpin(S3C2410_GPD(10), S3C2440_GPD10_SPICLK1); |
27 | s3c2410_gpio_cfgpin(S3C2410_GPD(9), S3C2440_GPD9_SPIMOSI1); | 27 | s3c_gpio_cfgpin(S3C2410_GPD(9), S3C2440_GPD9_SPIMOSI1); |
28 | s3c2410_gpio_cfgpin(S3C2410_GPD(8), S3C2440_GPD8_SPIMISO1); | 28 | s3c_gpio_cfgpin(S3C2410_GPD(8), S3C2440_GPD8_SPIMISO1); |
29 | s3c2410_gpio_pullup(S3C2410_GPD(10), 0); | 29 | s3c2410_gpio_pullup(S3C2410_GPD(10), 0); |
30 | s3c2410_gpio_pullup(S3C2410_GPD(9), 0); | 30 | s3c2410_gpio_pullup(S3C2410_GPD(9), 0); |
31 | } else { | 31 | } else { |
32 | s3c2410_gpio_cfgpin(S3C2410_GPD(8), S3C2410_GPIO_INPUT); | 32 | s3c_gpio_cfgpin(S3C2410_GPD(8), S3C2410_GPIO_INPUT); |
33 | s3c2410_gpio_cfgpin(S3C2410_GPD(9), S3C2410_GPIO_INPUT); | 33 | s3c_gpio_cfgpin(S3C2410_GPD(9), S3C2410_GPIO_INPUT); |
34 | s3c2410_gpio_pullup(S3C2410_GPD(10), 1); | 34 | s3c_gpio_cfgpull(S3C2410_GPD(10), S3C_GPIO_PULL_NONE); |
35 | s3c2410_gpio_pullup(S3C2410_GPD(9), 1); | 35 | s3c_gpio_cfgpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE); |
36 | s3c2410_gpio_pullup(S3C2410_GPD(8), 1); | 36 | s3c_gpio_cfgpull(S3C2410_GPD(8), S3C_GPIO_PULL_NONE); |
37 | } | 37 | } |
38 | } | 38 | } |
diff --git a/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c b/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c index 86b9edc67413..8ea663a438bb 100644 --- a/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c +++ b/arch/arm/plat-s3c24xx/spi-bus1-gpg5_6_7.c | |||
@@ -21,16 +21,16 @@ void s3c24xx_spi_gpiocfg_bus1_gpg5_6_7(struct s3c2410_spi_info *spi, | |||
21 | int enable) | 21 | int enable) |
22 | { | 22 | { |
23 | if (enable) { | 23 | if (enable) { |
24 | s3c2410_gpio_cfgpin(S3C2410_GPG(7), S3C2410_GPG7_SPICLK1); | 24 | s3c_gpio_cfgpin(S3C2410_GPG(7), S3C2410_GPG7_SPICLK1); |
25 | s3c2410_gpio_cfgpin(S3C2410_GPG(6), S3C2410_GPG6_SPIMOSI1); | 25 | s3c_gpio_cfgpin(S3C2410_GPG(6), S3C2410_GPG6_SPIMOSI1); |
26 | s3c2410_gpio_cfgpin(S3C2410_GPG(5), S3C2410_GPG5_SPIMISO1); | 26 | s3c_gpio_cfgpin(S3C2410_GPG(5), S3C2410_GPG5_SPIMISO1); |
27 | s3c2410_gpio_pullup(S3C2410_GPG(5), 0); | 27 | s3c2410_gpio_pullup(S3C2410_GPG(5), 0); |
28 | s3c2410_gpio_pullup(S3C2410_GPG(6), 0); | 28 | s3c2410_gpio_pullup(S3C2410_GPG(6), 0); |
29 | } else { | 29 | } else { |
30 | s3c2410_gpio_cfgpin(S3C2410_GPG(7), S3C2410_GPIO_INPUT); | 30 | s3c_gpio_cfgpin(S3C2410_GPG(7), S3C2410_GPIO_INPUT); |
31 | s3c2410_gpio_cfgpin(S3C2410_GPG(5), S3C2410_GPIO_INPUT); | 31 | s3c_gpio_cfgpin(S3C2410_GPG(5), S3C2410_GPIO_INPUT); |
32 | s3c2410_gpio_pullup(S3C2410_GPG(5), 1); | 32 | s3c_gpio_cfgpull(S3C2410_GPG(5), S3C_GPIO_PULL_NONE); |
33 | s3c2410_gpio_pullup(S3C2410_GPG(6), 1); | 33 | s3c_gpio_cfgpull(S3C2410_GPG(6), S3C_GPIO_PULL_NONE); |
34 | s3c2410_gpio_pullup(S3C2410_GPG(7), 1); | 34 | s3c_gpio_cfgpull(S3C2410_GPG(7), S3C_GPIO_PULL_NONE); |
35 | } | 35 | } |
36 | } | 36 | } |
diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c index 4ca0759fa228..a8bfabf4b6bc 100644 --- a/arch/arm/plat-s5p/clock.c +++ b/arch/arm/plat-s5p/clock.c | |||
@@ -33,6 +33,11 @@ struct clk clk_ext_xtal_mux = { | |||
33 | .id = -1, | 33 | .id = -1, |
34 | }; | 34 | }; |
35 | 35 | ||
36 | struct clk clk_xusbxti = { | ||
37 | .name = "xusbxti", | ||
38 | .id = -1, | ||
39 | }; | ||
40 | |||
36 | static struct clk s5p_clk_27m = { | 41 | static struct clk s5p_clk_27m = { |
37 | .name = "clk_27m", | 42 | .name = "clk_27m", |
38 | .id = -1, | 43 | .id = -1, |
diff --git a/arch/arm/plat-s5p/include/plat/irqs.h b/arch/arm/plat-s5p/include/plat/irqs.h index 42e757f2e40c..9ff3d718be39 100644 --- a/arch/arm/plat-s5p/include/plat/irqs.h +++ b/arch/arm/plat-s5p/include/plat/irqs.h | |||
@@ -79,7 +79,7 @@ | |||
79 | #define S5P_IRQ_VIC2(x) (S5P_VIC2_BASE + (x)) | 79 | #define S5P_IRQ_VIC2(x) (S5P_VIC2_BASE + (x)) |
80 | #define S5P_IRQ_VIC3(x) (S5P_VIC3_BASE + (x)) | 80 | #define S5P_IRQ_VIC3(x) (S5P_VIC3_BASE + (x)) |
81 | 81 | ||
82 | #define S5P_TIMER_IRQ(x) S5P_IRQ(11 + (x)) | 82 | #define S5P_TIMER_IRQ(x) (11 + (x)) |
83 | 83 | ||
84 | #define IRQ_TIMER0 S5P_TIMER_IRQ(0) | 84 | #define IRQ_TIMER0 S5P_TIMER_IRQ(0) |
85 | #define IRQ_TIMER1 S5P_TIMER_IRQ(1) | 85 | #define IRQ_TIMER1 S5P_TIMER_IRQ(1) |
diff --git a/arch/arm/plat-s5p/include/plat/s5p-clock.h b/arch/arm/plat-s5p/include/plat/s5p-clock.h index 5ae8866b7989..aa0447a18903 100644 --- a/arch/arm/plat-s5p/include/plat/s5p-clock.h +++ b/arch/arm/plat-s5p/include/plat/s5p-clock.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define clk_fin_vpll clk_ext_xtal_mux | 23 | #define clk_fin_vpll clk_ext_xtal_mux |
24 | 24 | ||
25 | extern struct clk clk_ext_xtal_mux; | 25 | extern struct clk clk_ext_xtal_mux; |
26 | extern struct clk clk_xusbxti; | ||
26 | extern struct clk clk_48m; | 27 | extern struct clk clk_48m; |
27 | extern struct clk clk_fout_apll; | 28 | extern struct clk clk_fout_apll; |
28 | extern struct clk clk_fout_mpll; | 29 | extern struct clk clk_fout_mpll; |
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index d552c65fa1b0..7a36cf85e138 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -160,6 +160,11 @@ config S3C_DEV_HSMMC2 | |||
160 | help | 160 | help |
161 | Compile in platform device definitions for HSMMC channel 2 | 161 | Compile in platform device definitions for HSMMC channel 2 |
162 | 162 | ||
163 | config S3C_DEV_HWMON | ||
164 | bool | ||
165 | help | ||
166 | Compile in platform device definitions for HWMON | ||
167 | |||
163 | config S3C_DEV_I2C1 | 168 | config S3C_DEV_I2C1 |
164 | bool | 169 | bool |
165 | help | 170 | help |
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 22c89d08f6e5..0ad820acc385 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile | |||
@@ -33,6 +33,7 @@ obj-$(CONFIG_S3C_ADC) += adc.o | |||
33 | obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o | 33 | obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o |
34 | obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o | 34 | obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o |
35 | obj-$(CONFIG_S3C_DEV_HSMMC2) += dev-hsmmc2.o | 35 | obj-$(CONFIG_S3C_DEV_HSMMC2) += dev-hsmmc2.o |
36 | obj-$(CONFIG_S3C_DEV_HWMON) += dev-hwmon.o | ||
36 | obj-y += dev-i2c0.o | 37 | obj-y += dev-i2c0.o |
37 | obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o | 38 | obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o |
38 | obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o | 39 | obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o |
diff --git a/arch/arm/plat-samsung/dev-hwmon.c b/arch/arm/plat-samsung/dev-hwmon.c new file mode 100644 index 000000000000..b3ffb9587250 --- /dev/null +++ b/arch/arm/plat-samsung/dev-hwmon.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-hwmon.c | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * Adapted for HWMON by Maurus Cuelenaere | ||
8 | * | ||
9 | * Samsung series device definition for HWMON | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | #include <plat/devs.h> | ||
20 | #include <plat/hwmon.h> | ||
21 | |||
22 | struct platform_device s3c_device_hwmon = { | ||
23 | .name = "s3c-hwmon", | ||
24 | .id = -1, | ||
25 | .dev.parent = &s3c_device_adc.dev, | ||
26 | }; | ||
27 | |||
28 | void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd) | ||
29 | { | ||
30 | struct s3c_hwmon_pdata *npd; | ||
31 | |||
32 | if (!pd) { | ||
33 | printk(KERN_ERR "%s: no platform data\n", __func__); | ||
34 | return; | ||
35 | } | ||
36 | |||
37 | npd = kmemdup(pd, sizeof(struct s3c_hwmon_pdata), GFP_KERNEL); | ||
38 | if (!npd) | ||
39 | printk(KERN_ERR "%s: no memory for platform data\n", __func__); | ||
40 | |||
41 | s3c_device_hwmon.dev.platform_data = npd; | ||
42 | } | ||
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c index 44a84e896546..a76eef533392 100644 --- a/arch/arm/plat-samsung/gpio-config.c +++ b/arch/arm/plat-samsung/gpio-config.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* linux/arch/arm/plat-s3c/gpio-config.c | 1 | /* linux/arch/arm/plat-s3c/gpio-config.c |
2 | * | 2 | * |
3 | * Copyright 2008 Openmoko, Inc. | 3 | * Copyright 2008 Openmoko, Inc. |
4 | * Copyright 2008 Simtec Electronics | 4 | * Copyright 2008-2010 Simtec Electronics |
5 | * Ben Dooks <ben@simtec.co.uk> | 5 | * Ben Dooks <ben@simtec.co.uk> |
6 | * http://armlinux.simtec.co.uk/ | 6 | * http://armlinux.simtec.co.uk/ |
7 | * | 7 | * |
@@ -33,14 +33,34 @@ int s3c_gpio_cfgpin(unsigned int pin, unsigned int config) | |||
33 | 33 | ||
34 | offset = pin - chip->chip.base; | 34 | offset = pin - chip->chip.base; |
35 | 35 | ||
36 | local_irq_save(flags); | 36 | s3c_gpio_lock(chip, flags); |
37 | ret = s3c_gpio_do_setcfg(chip, offset, config); | 37 | ret = s3c_gpio_do_setcfg(chip, offset, config); |
38 | local_irq_restore(flags); | 38 | s3c_gpio_unlock(chip, flags); |
39 | 39 | ||
40 | return ret; | 40 | return ret; |
41 | } | 41 | } |
42 | EXPORT_SYMBOL(s3c_gpio_cfgpin); | 42 | EXPORT_SYMBOL(s3c_gpio_cfgpin); |
43 | 43 | ||
44 | unsigned s3c_gpio_getcfg(unsigned int pin) | ||
45 | { | ||
46 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
47 | unsigned long flags; | ||
48 | unsigned ret = 0; | ||
49 | int offset; | ||
50 | |||
51 | if (chip) { | ||
52 | offset = pin - chip->chip.base; | ||
53 | |||
54 | s3c_gpio_lock(chip, flags); | ||
55 | ret = s3c_gpio_do_getcfg(chip, offset); | ||
56 | s3c_gpio_unlock(chip, flags); | ||
57 | } | ||
58 | |||
59 | return ret; | ||
60 | } | ||
61 | EXPORT_SYMBOL(s3c_gpio_getcfg); | ||
62 | |||
63 | |||
44 | int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull) | 64 | int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull) |
45 | { | 65 | { |
46 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | 66 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); |
@@ -52,17 +72,17 @@ int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull) | |||
52 | 72 | ||
53 | offset = pin - chip->chip.base; | 73 | offset = pin - chip->chip.base; |
54 | 74 | ||
55 | local_irq_save(flags); | 75 | s3c_gpio_lock(chip, flags); |
56 | ret = s3c_gpio_do_setpull(chip, offset, pull); | 76 | ret = s3c_gpio_do_setpull(chip, offset, pull); |
57 | local_irq_restore(flags); | 77 | s3c_gpio_unlock(chip, flags); |
58 | 78 | ||
59 | return ret; | 79 | return ret; |
60 | } | 80 | } |
61 | EXPORT_SYMBOL(s3c_gpio_setpull); | 81 | EXPORT_SYMBOL(s3c_gpio_setpull); |
62 | 82 | ||
63 | #ifdef CONFIG_S3C_GPIO_CFG_S3C24XX | 83 | #ifdef CONFIG_S3C_GPIO_CFG_S3C24XX |
64 | int s3c_gpio_setcfg_s3c24xx_banka(struct s3c_gpio_chip *chip, | 84 | int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip, |
65 | unsigned int off, unsigned int cfg) | 85 | unsigned int off, unsigned int cfg) |
66 | { | 86 | { |
67 | void __iomem *reg = chip->base; | 87 | void __iomem *reg = chip->base; |
68 | unsigned int shift = off; | 88 | unsigned int shift = off; |
@@ -87,6 +107,19 @@ int s3c_gpio_setcfg_s3c24xx_banka(struct s3c_gpio_chip *chip, | |||
87 | return 0; | 107 | return 0; |
88 | } | 108 | } |
89 | 109 | ||
110 | unsigned s3c_gpio_getcfg_s3c24xx_a(struct s3c_gpio_chip *chip, | ||
111 | unsigned int off) | ||
112 | { | ||
113 | u32 con; | ||
114 | |||
115 | con = __raw_readl(chip->base); | ||
116 | con >>= off; | ||
117 | con &= 1; | ||
118 | con++; | ||
119 | |||
120 | return S3C_GPIO_SFN(con); | ||
121 | } | ||
122 | |||
90 | int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, | 123 | int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, |
91 | unsigned int off, unsigned int cfg) | 124 | unsigned int off, unsigned int cfg) |
92 | { | 125 | { |
@@ -109,6 +142,19 @@ int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, | |||
109 | 142 | ||
110 | return 0; | 143 | return 0; |
111 | } | 144 | } |
145 | |||
146 | unsigned int s3c_gpio_getcfg_s3c24xx(struct s3c_gpio_chip *chip, | ||
147 | unsigned int off) | ||
148 | { | ||
149 | u32 con; | ||
150 | |||
151 | con = __raw_readl(chip->base); | ||
152 | con >>= off * 2; | ||
153 | con &= 3; | ||
154 | |||
155 | /* this conversion works for IN and OUT as well as special mode */ | ||
156 | return S3C_GPIO_SPECIAL(con); | ||
157 | } | ||
112 | #endif | 158 | #endif |
113 | 159 | ||
114 | #ifdef CONFIG_S3C_GPIO_CFG_S3C64XX | 160 | #ifdef CONFIG_S3C_GPIO_CFG_S3C64XX |
@@ -134,6 +180,25 @@ int s3c_gpio_setcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | |||
134 | 180 | ||
135 | return 0; | 181 | return 0; |
136 | } | 182 | } |
183 | |||
184 | unsigned s3c_gpio_getcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | ||
185 | unsigned int off) | ||
186 | { | ||
187 | void __iomem *reg = chip->base; | ||
188 | unsigned int shift = (off & 7) * 4; | ||
189 | u32 con; | ||
190 | |||
191 | if (off < 8 && chip->chip.ngpio > 8) | ||
192 | reg -= 4; | ||
193 | |||
194 | con = __raw_readl(reg); | ||
195 | con >>= shift; | ||
196 | con &= 0xf; | ||
197 | |||
198 | /* this conversion works for IN and OUT as well as special mode */ | ||
199 | return S3C_GPIO_SPECIAL(con); | ||
200 | } | ||
201 | |||
137 | #endif /* CONFIG_S3C_GPIO_CFG_S3C64XX */ | 202 | #endif /* CONFIG_S3C_GPIO_CFG_S3C64XX */ |
138 | 203 | ||
139 | #ifdef CONFIG_S3C_GPIO_PULL_UPDOWN | 204 | #ifdef CONFIG_S3C_GPIO_PULL_UPDOWN |
@@ -164,3 +229,35 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip, | |||
164 | return (__force s3c_gpio_pull_t)pup; | 229 | return (__force s3c_gpio_pull_t)pup; |
165 | } | 230 | } |
166 | #endif | 231 | #endif |
232 | |||
233 | #ifdef CONFIG_S3C_GPIO_PULL_UP | ||
234 | int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip, | ||
235 | unsigned int off, s3c_gpio_pull_t pull) | ||
236 | { | ||
237 | void __iomem *reg = chip->base + 0x08; | ||
238 | u32 pup = __raw_readl(reg); | ||
239 | |||
240 | pup = __raw_readl(reg); | ||
241 | |||
242 | if (pup == S3C_GPIO_PULL_UP) | ||
243 | pup &= ~(1 << off); | ||
244 | else if (pup == S3C_GPIO_PULL_NONE) | ||
245 | pup |= (1 << off); | ||
246 | else | ||
247 | return -EINVAL; | ||
248 | |||
249 | __raw_writel(pup, reg); | ||
250 | return 0; | ||
251 | } | ||
252 | |||
253 | s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, | ||
254 | unsigned int off) | ||
255 | { | ||
256 | void __iomem *reg = chip->base + 0x08; | ||
257 | u32 pup = __raw_readl(reg); | ||
258 | |||
259 | pup &= (1 << off); | ||
260 | return pup ? S3C_GPIO_PULL_NONE : S3C_GPIO_PULL_UP; | ||
261 | } | ||
262 | #endif /* CONFIG_S3C_GPIO_PULL_UP */ | ||
263 | |||
diff --git a/arch/arm/plat-samsung/gpio.c b/arch/arm/plat-samsung/gpio.c index 28d2ab8a08db..b83a83351cea 100644 --- a/arch/arm/plat-samsung/gpio.c +++ b/arch/arm/plat-samsung/gpio.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
18 | #include <linux/spinlock.h> | ||
18 | 19 | ||
19 | #include <plat/gpio-core.h> | 20 | #include <plat/gpio-core.h> |
20 | 21 | ||
@@ -52,14 +53,14 @@ static int s3c_gpiolib_input(struct gpio_chip *chip, unsigned offset) | |||
52 | unsigned long flags; | 53 | unsigned long flags; |
53 | unsigned long con; | 54 | unsigned long con; |
54 | 55 | ||
55 | local_irq_save(flags); | 56 | s3c_gpio_lock(ourchip, flags); |
56 | 57 | ||
57 | con = __raw_readl(base + 0x00); | 58 | con = __raw_readl(base + 0x00); |
58 | con &= ~(3 << (offset * 2)); | 59 | con &= ~(3 << (offset * 2)); |
59 | 60 | ||
60 | __raw_writel(con, base + 0x00); | 61 | __raw_writel(con, base + 0x00); |
61 | 62 | ||
62 | local_irq_restore(flags); | 63 | s3c_gpio_unlock(ourchip, flags); |
63 | return 0; | 64 | return 0; |
64 | } | 65 | } |
65 | 66 | ||
@@ -72,7 +73,7 @@ static int s3c_gpiolib_output(struct gpio_chip *chip, | |||
72 | unsigned long dat; | 73 | unsigned long dat; |
73 | unsigned long con; | 74 | unsigned long con; |
74 | 75 | ||
75 | local_irq_save(flags); | 76 | s3c_gpio_lock(ourchip, flags); |
76 | 77 | ||
77 | dat = __raw_readl(base + 0x04); | 78 | dat = __raw_readl(base + 0x04); |
78 | dat &= ~(1 << offset); | 79 | dat &= ~(1 << offset); |
@@ -87,7 +88,7 @@ static int s3c_gpiolib_output(struct gpio_chip *chip, | |||
87 | __raw_writel(con, base + 0x00); | 88 | __raw_writel(con, base + 0x00); |
88 | __raw_writel(dat, base + 0x04); | 89 | __raw_writel(dat, base + 0x04); |
89 | 90 | ||
90 | local_irq_restore(flags); | 91 | s3c_gpio_unlock(ourchip, flags); |
91 | return 0; | 92 | return 0; |
92 | } | 93 | } |
93 | 94 | ||
@@ -99,7 +100,7 @@ static void s3c_gpiolib_set(struct gpio_chip *chip, | |||
99 | unsigned long flags; | 100 | unsigned long flags; |
100 | unsigned long dat; | 101 | unsigned long dat; |
101 | 102 | ||
102 | local_irq_save(flags); | 103 | s3c_gpio_lock(ourchip, flags); |
103 | 104 | ||
104 | dat = __raw_readl(base + 0x04); | 105 | dat = __raw_readl(base + 0x04); |
105 | dat &= ~(1 << offset); | 106 | dat &= ~(1 << offset); |
@@ -107,7 +108,7 @@ static void s3c_gpiolib_set(struct gpio_chip *chip, | |||
107 | dat |= 1 << offset; | 108 | dat |= 1 << offset; |
108 | __raw_writel(dat, base + 0x04); | 109 | __raw_writel(dat, base + 0x04); |
109 | 110 | ||
110 | local_irq_restore(flags); | 111 | s3c_gpio_unlock(ourchip, flags); |
111 | } | 112 | } |
112 | 113 | ||
113 | static int s3c_gpiolib_get(struct gpio_chip *chip, unsigned offset) | 114 | static int s3c_gpiolib_get(struct gpio_chip *chip, unsigned offset) |
@@ -131,6 +132,8 @@ __init void s3c_gpiolib_add(struct s3c_gpio_chip *chip) | |||
131 | BUG_ON(!gc->label); | 132 | BUG_ON(!gc->label); |
132 | BUG_ON(!gc->ngpio); | 133 | BUG_ON(!gc->ngpio); |
133 | 134 | ||
135 | spin_lock_init(&chip->lock); | ||
136 | |||
134 | if (!gc->direction_input) | 137 | if (!gc->direction_input) |
135 | gc->direction_input = s3c_gpiolib_input; | 138 | gc->direction_input = s3c_gpiolib_input; |
136 | if (!gc->direction_output) | 139 | if (!gc->direction_output) |
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h index 60b62692ac7a..efbc984640c3 100644 --- a/arch/arm/plat-samsung/include/plat/clock.h +++ b/arch/arm/plat-samsung/include/plat/clock.h | |||
@@ -74,6 +74,7 @@ extern struct clk clk_ext; | |||
74 | extern struct clk clk_h2; | 74 | extern struct clk clk_h2; |
75 | extern struct clk clk_27m; | 75 | extern struct clk clk_27m; |
76 | extern struct clk clk_48m; | 76 | extern struct clk clk_48m; |
77 | extern struct clk clk_xusbxti; | ||
77 | 78 | ||
78 | extern int clk_default_setrate(struct clk *clk, unsigned long rate); | 79 | extern int clk_default_setrate(struct clk *clk, unsigned long rate); |
79 | extern struct clk_ops clk_ops_def_setrate; | 80 | extern struct clk_ops clk_ops_def_setrate; |
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index d316b4a579f4..c54f318991b6 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h | |||
@@ -78,6 +78,9 @@ extern struct sysdev_class s3c2442_sysclass; | |||
78 | extern struct sysdev_class s3c2443_sysclass; | 78 | extern struct sysdev_class s3c2443_sysclass; |
79 | extern struct sysdev_class s3c6410_sysclass; | 79 | extern struct sysdev_class s3c6410_sysclass; |
80 | extern struct sysdev_class s3c64xx_sysclass; | 80 | extern struct sysdev_class s3c64xx_sysclass; |
81 | extern struct sysdev_class s5p6440_sysclass; | ||
82 | extern struct sysdev_class s5p6442_sysclass; | ||
83 | extern struct sysdev_class s5pv210_sysclass; | ||
81 | 84 | ||
82 | extern void (*s5pc1xx_idle)(void); | 85 | extern void (*s5pc1xx_idle)(void); |
83 | 86 | ||
diff --git a/arch/arm/plat-samsung/include/plat/dma.h b/arch/arm/plat-samsung/include/plat/dma.h index 7584d751ed51..2e8f8c6560d7 100644 --- a/arch/arm/plat-samsung/include/plat/dma.h +++ b/arch/arm/plat-samsung/include/plat/dma.h | |||
@@ -110,8 +110,8 @@ extern int s3c2410_dma_config(unsigned int channel, int xferunit); | |||
110 | * configure the device we're talking to | 110 | * configure the device we're talking to |
111 | */ | 111 | */ |
112 | 112 | ||
113 | extern int s3c2410_dma_devconfig(int channel, enum s3c2410_dmasrc source, | 113 | extern int s3c2410_dma_devconfig(unsigned int channel, |
114 | unsigned long devaddr); | 114 | enum s3c2410_dmasrc source, unsigned long devaddr); |
115 | 115 | ||
116 | /* s3c2410_dma_getposition | 116 | /* s3c2410_dma_getposition |
117 | * | 117 | * |
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h index dda19da037ad..3e21c75feefa 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h +++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h | |||
@@ -30,6 +30,12 @@ static inline int s3c_gpio_do_setcfg(struct s3c_gpio_chip *chip, | |||
30 | return (chip->config->set_config)(chip, off, config); | 30 | return (chip->config->set_config)(chip, off, config); |
31 | } | 31 | } |
32 | 32 | ||
33 | static inline unsigned s3c_gpio_do_getcfg(struct s3c_gpio_chip *chip, | ||
34 | unsigned int off) | ||
35 | { | ||
36 | return (chip->config->get_config)(chip, off); | ||
37 | } | ||
38 | |||
33 | static inline int s3c_gpio_do_setpull(struct s3c_gpio_chip *chip, | 39 | static inline int s3c_gpio_do_setpull(struct s3c_gpio_chip *chip, |
34 | unsigned int off, s3c_gpio_pull_t pull) | 40 | unsigned int off, s3c_gpio_pull_t pull) |
35 | { | 41 | { |
@@ -53,6 +59,18 @@ extern int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, | |||
53 | unsigned int off, unsigned int cfg); | 59 | unsigned int off, unsigned int cfg); |
54 | 60 | ||
55 | /** | 61 | /** |
62 | * s3c_gpio_getcfg_s3c24xx - S3C24XX style GPIO configuration read. | ||
63 | * @chip: The gpio chip that is being configured. | ||
64 | * @off: The offset for the GPIO being configured. | ||
65 | * | ||
66 | * The reverse of s3c_gpio_setcfg_s3c24xx(). Will return a value whicg | ||
67 | * could be directly passed back to s3c_gpio_setcfg_s3c24xx(), from the | ||
68 | * S3C_GPIO_SPECIAL() macro. | ||
69 | */ | ||
70 | unsigned int s3c_gpio_getcfg_s3c24xx(struct s3c_gpio_chip *chip, | ||
71 | unsigned int off); | ||
72 | |||
73 | /** | ||
56 | * s3c_gpio_setcfg_s3c24xx_a - S3C24XX style GPIO configuration (Bank A) | 74 | * s3c_gpio_setcfg_s3c24xx_a - S3C24XX style GPIO configuration (Bank A) |
57 | * @chip: The gpio chip that is being configured. | 75 | * @chip: The gpio chip that is being configured. |
58 | * @off: The offset for the GPIO being configured. | 76 | * @off: The offset for the GPIO being configured. |
@@ -65,6 +83,21 @@ extern int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, | |||
65 | extern int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip, | 83 | extern int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip, |
66 | unsigned int off, unsigned int cfg); | 84 | unsigned int off, unsigned int cfg); |
67 | 85 | ||
86 | |||
87 | /** | ||
88 | * s3c_gpio_getcfg_s3c24xx_a - S3C24XX style GPIO configuration read (Bank A) | ||
89 | * @chip: The gpio chip that is being configured. | ||
90 | * @off: The offset for the GPIO being configured. | ||
91 | * | ||
92 | * The reverse of s3c_gpio_setcfg_s3c24xx_a() turning an GPIO into a usable | ||
93 | * GPIO configuration value. | ||
94 | * | ||
95 | * @sa s3c_gpio_getcfg_s3c24xx | ||
96 | * @sa s3c_gpio_getcfg_s3c64xx_4bit | ||
97 | */ | ||
98 | extern unsigned s3c_gpio_getcfg_s3c24xx_a(struct s3c_gpio_chip *chip, | ||
99 | unsigned int off); | ||
100 | |||
68 | /** | 101 | /** |
69 | * s3c_gpio_setcfg_s3c64xx_4bit - S3C64XX 4bit single register GPIO config. | 102 | * s3c_gpio_setcfg_s3c64xx_4bit - S3C64XX 4bit single register GPIO config. |
70 | * @chip: The gpio chip that is being configured. | 103 | * @chip: The gpio chip that is being configured. |
@@ -85,6 +118,20 @@ extern int s3c_gpio_setcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | |||
85 | unsigned int off, unsigned int cfg); | 118 | unsigned int off, unsigned int cfg); |
86 | 119 | ||
87 | 120 | ||
121 | /** | ||
122 | * s3c_gpio_getcfg_s3c64xx_4bit - S3C64XX 4bit single register GPIO config read. | ||
123 | * @chip: The gpio chip that is being configured. | ||
124 | * @off: The offset for the GPIO being configured. | ||
125 | * | ||
126 | * The reverse of s3c_gpio_setcfg_s3c64xx_4bit(), turning a gpio configuration | ||
127 | * register setting into a value the software can use, such as could be passed | ||
128 | * to s3c_gpio_setcfg_s3c64xx_4bit(). | ||
129 | * | ||
130 | * @sa s3c_gpio_getcfg_s3c24xx | ||
131 | */ | ||
132 | extern unsigned s3c_gpio_getcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | ||
133 | unsigned int off); | ||
134 | |||
88 | /* Pull-{up,down} resistor controls. | 135 | /* Pull-{up,down} resistor controls. |
89 | * | 136 | * |
90 | * S3C2410,S3C2440,S3C24A0 = Pull-UP, | 137 | * S3C2410,S3C2440,S3C24A0 = Pull-UP, |
@@ -146,6 +193,17 @@ extern s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip, | |||
146 | unsigned int off); | 193 | unsigned int off); |
147 | 194 | ||
148 | /** | 195 | /** |
196 | * s3c_gpio_getpull_1up() - Get configuration for choice of up or none | ||
197 | * @chip: The gpio chip that the GPIO pin belongs to | ||
198 | * @off: The offset to the pin to get the configuration of. | ||
199 | * | ||
200 | * This helper function reads the state of the pull-up resistor for the | ||
201 | * given GPIO in the same case as s3c_gpio_setpull_1up. | ||
202 | */ | ||
203 | extern s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, | ||
204 | unsigned int off); | ||
205 | |||
206 | /** | ||
149 | * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443. | 207 | * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443. |
150 | * @chip: The gpio chip that is being configured. | 208 | * @chip: The gpio chip that is being configured. |
151 | * @off: The offset for the GPIO being configured. | 209 | * @off: The offset for the GPIO being configured. |
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h index 29cd6a86cade..8d01e853df39 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h +++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h | |||
@@ -77,6 +77,17 @@ struct s3c_gpio_cfg { | |||
77 | */ | 77 | */ |
78 | extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to); | 78 | extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to); |
79 | 79 | ||
80 | /** | ||
81 | * s3c_gpio_getcfg - Read the current function for a GPIO pin | ||
82 | * @pin: The pin to read the configuration value for. | ||
83 | * | ||
84 | * Read the configuration state of the given @pin, returning a value that | ||
85 | * could be passed back to s3c_gpio_cfgpin(). | ||
86 | * | ||
87 | * @sa s3c_gpio_cfgpin | ||
88 | */ | ||
89 | extern unsigned s3c_gpio_getcfg(unsigned int pin); | ||
90 | |||
80 | /* Define values for the pull-{up,down} available for each gpio pin. | 91 | /* Define values for the pull-{up,down} available for each gpio pin. |
81 | * | 92 | * |
82 | * These values control the state of the weak pull-{up,down} resistors | 93 | * These values control the state of the weak pull-{up,down} resistors |
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h index 49ff406a7066..f3a68d1a07b9 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-core.h +++ b/arch/arm/plat-samsung/include/plat/gpio-core.h | |||
@@ -44,16 +44,26 @@ struct s3c_gpio_cfg; | |||
44 | * @chip: The chip structure to be exported via gpiolib. | 44 | * @chip: The chip structure to be exported via gpiolib. |
45 | * @base: The base pointer to the gpio configuration registers. | 45 | * @base: The base pointer to the gpio configuration registers. |
46 | * @config: special function and pull-resistor control information. | 46 | * @config: special function and pull-resistor control information. |
47 | * @lock: Lock for exclusive access to this gpio bank. | ||
47 | * @pm_save: Save information for suspend/resume support. | 48 | * @pm_save: Save information for suspend/resume support. |
48 | * | 49 | * |
49 | * This wrapper provides the necessary information for the Samsung | 50 | * This wrapper provides the necessary information for the Samsung |
50 | * specific gpios being registered with gpiolib. | 51 | * specific gpios being registered with gpiolib. |
52 | * | ||
53 | * The lock protects each gpio bank from multiple access of the shared | ||
54 | * configuration registers, or from reading of data whilst another thread | ||
55 | * is writing to the register set. | ||
56 | * | ||
57 | * Each chip has its own lock to avoid any contention between different | ||
58 | * CPU cores trying to get one lock for different GPIO banks, where each | ||
59 | * bank of GPIO has its own register space and configuration registers. | ||
51 | */ | 60 | */ |
52 | struct s3c_gpio_chip { | 61 | struct s3c_gpio_chip { |
53 | struct gpio_chip chip; | 62 | struct gpio_chip chip; |
54 | struct s3c_gpio_cfg *config; | 63 | struct s3c_gpio_cfg *config; |
55 | struct s3c_gpio_pm *pm; | 64 | struct s3c_gpio_pm *pm; |
56 | void __iomem *base; | 65 | void __iomem *base; |
66 | spinlock_t lock; | ||
57 | #ifdef CONFIG_PM | 67 | #ifdef CONFIG_PM |
58 | u32 pm_save[4]; | 68 | u32 pm_save[4]; |
59 | #endif | 69 | #endif |
@@ -108,6 +118,9 @@ extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip, | |||
108 | extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip); | 118 | extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip); |
109 | extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip); | 119 | extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip); |
110 | 120 | ||
121 | /* exported for core SoC support to change */ | ||
122 | extern struct s3c_gpio_cfg s3c24xx_gpiocfg_default; | ||
123 | |||
111 | #ifdef CONFIG_S3C_GPIO_TRACK | 124 | #ifdef CONFIG_S3C_GPIO_TRACK |
112 | extern struct s3c_gpio_chip *s3c_gpios[S3C_GPIO_END]; | 125 | extern struct s3c_gpio_chip *s3c_gpios[S3C_GPIO_END]; |
113 | 126 | ||
@@ -135,3 +148,7 @@ extern struct s3c_gpio_pm s3c_gpio_pm_4bit; | |||
135 | #define __gpio_pm(x) NULL | 148 | #define __gpio_pm(x) NULL |
136 | 149 | ||
137 | #endif /* CONFIG_PM */ | 150 | #endif /* CONFIG_PM */ |
151 | |||
152 | /* locking wrappers to deal with multiple access to the same gpio bank */ | ||
153 | #define s3c_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl) | ||
154 | #define s3c_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl) | ||
diff --git a/arch/arm/plat-samsung/include/plat/hwmon.h b/arch/arm/plat-samsung/include/plat/hwmon.h index 1ba88ea0aa31..c167e4429bc7 100644 --- a/arch/arm/plat-samsung/include/plat/hwmon.h +++ b/arch/arm/plat-samsung/include/plat/hwmon.h | |||
@@ -37,5 +37,15 @@ struct s3c_hwmon_pdata { | |||
37 | struct s3c_hwmon_chcfg *in[8]; | 37 | struct s3c_hwmon_chcfg *in[8]; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | /** | ||
41 | * s3c_hwmon_set_platdata - Set platform data for S3C HWMON device | ||
42 | * @pd: Platform data to register to device. | ||
43 | * | ||
44 | * Register the given platform data for use with the S3C HWMON device. | ||
45 | * The call will copy the platform data, so the board definitions can | ||
46 | * make the structure itself __initdata. | ||
47 | */ | ||
48 | extern void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd); | ||
49 | |||
40 | #endif /* __ASM_ARCH_ADC_HWMON_H */ | 50 | #endif /* __ASM_ARCH_ADC_HWMON_H */ |
41 | 51 | ||
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c index 69a4c7f02e25..d50ab9d2af53 100644 --- a/arch/arm/plat-samsung/pm-gpio.c +++ b/arch/arm/plat-samsung/pm-gpio.c | |||
@@ -329,7 +329,7 @@ void s3c_pm_save_gpios(void) | |||
329 | struct s3c_gpio_chip *ourchip; | 329 | struct s3c_gpio_chip *ourchip; |
330 | unsigned int gpio_nr; | 330 | unsigned int gpio_nr; |
331 | 331 | ||
332 | for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) { | 332 | for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) { |
333 | ourchip = s3c_gpiolib_getchip(gpio_nr); | 333 | ourchip = s3c_gpiolib_getchip(gpio_nr); |
334 | if (!ourchip) | 334 | if (!ourchip) |
335 | continue; | 335 | continue; |
@@ -367,7 +367,7 @@ void s3c_pm_restore_gpios(void) | |||
367 | struct s3c_gpio_chip *ourchip; | 367 | struct s3c_gpio_chip *ourchip; |
368 | unsigned int gpio_nr; | 368 | unsigned int gpio_nr; |
369 | 369 | ||
370 | for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) { | 370 | for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) { |
371 | ourchip = s3c_gpiolib_getchip(gpio_nr); | 371 | ourchip = s3c_gpiolib_getchip(gpio_nr); |
372 | if (!ourchip) | 372 | if (!ourchip) |
373 | continue; | 373 | continue; |