aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/Kconfig26
-rw-r--r--arch/arm/plat-samsung/Makefile5
-rw-r--r--arch/arm/plat-samsung/adc.c26
-rw-r--r--arch/arm/plat-samsung/dev-i2c2.c70
-rw-r--r--arch/arm/plat-samsung/dev-onenand.c55
-rw-r--r--arch/arm/plat-samsung/dev-wdt.c40
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h20
-rw-r--r--arch/arm/plat-samsung/include/plat/fb.h7
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg.h23
-rw-r--r--arch/arm/plat-samsung/include/plat/iic-core.h7
-rw-r--r--arch/arm/plat-samsung/include/plat/iic.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/onenand-core.h37
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-onenand.h63
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-rtc.h4
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c64xx-spi.h4
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h55
-rw-r--r--arch/arm/plat-samsung/include/plat/wakeup-mask.h44
-rw-r--r--arch/arm/plat-samsung/pm-gpio.c8
-rw-r--r--arch/arm/plat-samsung/wakeup-mask.c47
19 files changed, 533 insertions, 10 deletions
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 229919e9744c..2753fb3e4f73 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -6,7 +6,7 @@
6 6
7config PLAT_SAMSUNG 7config PLAT_SAMSUNG
8 bool 8 bool
9 depends on ARCH_S3C2410 || ARCH_S3C24A0 || ARCH_S3C64XX || ARCH_S5PC1XX 9 depends on ARCH_S3C2410 || ARCH_S3C24A0 || ARCH_S3C64XX
10 select NO_IOPORT 10 select NO_IOPORT
11 default y 11 default y
12 help 12 help
@@ -170,6 +170,11 @@ config S3C_DEV_I2C1
170 help 170 help
171 Compile in platform device definitions for I2C channel 1 171 Compile in platform device definitions for I2C channel 1
172 172
173config S3C_DEV_I2C2
174 bool
175 help
176 Compile in platform device definitions for I2C channel 2
177
173config S3C_DEV_FB 178config S3C_DEV_FB
174 bool 179 bool
175 help 180 help
@@ -185,11 +190,22 @@ config S3C_DEV_USB_HSOTG
185 help 190 help
186 Compile in platform device definition for USB high-speed OtG 191 Compile in platform device definition for USB high-speed OtG
187 192
193config S3C_DEV_WDT
194 bool
195 default y if ARCH_S3C2410
196 help
197 Complie in platform device definition for Watchdog Timer
198
188config S3C_DEV_NAND 199config S3C_DEV_NAND
189 bool 200 bool
190 help 201 help
191 Compile in platform device definition for NAND controller 202 Compile in platform device definition for NAND controller
192 203
204config S3C_DEV_ONENAND
205 bool
206 help
207 Compile in platform device definition for OneNAND controller
208
193config S3C_DEV_RTC 209config S3C_DEV_RTC
194 bool 210 bool
195 help 211 help
@@ -269,4 +285,12 @@ config SAMSUNG_PM_CHECK_CHUNKSIZE
269 285
270 See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt> 286 See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
271 287
288config SAMSUNG_WAKEMASK
289 bool
290 depends on PM
291 help
292 Compile support for wakeup-mask controls found on the S3C6400
293 and above. This code allows a set of interrupt to wakeup-mask
294 mappings. See <plat/wakeup-mask.h>
295
272endif 296endif
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 48288499a3b9..b1d82cc5e716 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -36,11 +36,14 @@ obj-$(CONFIG_S3C_DEV_HSMMC2) += dev-hsmmc2.o
36obj-$(CONFIG_S3C_DEV_HWMON) += dev-hwmon.o 36obj-$(CONFIG_S3C_DEV_HWMON) += dev-hwmon.o
37obj-y += dev-i2c0.o 37obj-y += dev-i2c0.o
38obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o 38obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o
39obj-$(CONFIG_S3C_DEV_I2C2) += dev-i2c2.o
39obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o 40obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o
40obj-y += dev-uart.o 41obj-y += dev-uart.o
41obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o 42obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o
42obj-$(CONFIG_S3C_DEV_USB_HSOTG) += dev-usb-hsotg.o 43obj-$(CONFIG_S3C_DEV_USB_HSOTG) += dev-usb-hsotg.o
44obj-$(CONFIG_S3C_DEV_WDT) += dev-wdt.o
43obj-$(CONFIG_S3C_DEV_NAND) += dev-nand.o 45obj-$(CONFIG_S3C_DEV_NAND) += dev-nand.o
46obj-$(CONFIG_S3C_DEV_ONENAND) += dev-onenand.o
44obj-$(CONFIG_S3C_DEV_RTC) += dev-rtc.o 47obj-$(CONFIG_S3C_DEV_RTC) += dev-rtc.o
45 48
46obj-$(CONFIG_SAMSUNG_DEV_ADC) += dev-adc.o 49obj-$(CONFIG_SAMSUNG_DEV_ADC) += dev-adc.o
@@ -58,6 +61,8 @@ obj-$(CONFIG_PM) += pm.o
58obj-$(CONFIG_PM) += pm-gpio.o 61obj-$(CONFIG_PM) += pm-gpio.o
59obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o 62obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o
60 63
64obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
65
61# PWM support 66# PWM support
62 67
63obj-$(CONFIG_HAVE_PWM) += pwm.o 68obj-$(CONFIG_HAVE_PWM) += pwm.o
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 210030d5cfe1..04d9521ddc9f 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -66,6 +66,7 @@ struct adc_device {
66 struct s3c_adc_client *cur; 66 struct s3c_adc_client *cur;
67 struct s3c_adc_client *ts_pend; 67 struct s3c_adc_client *ts_pend;
68 void __iomem *regs; 68 void __iomem *regs;
69 spinlock_t lock;
69 70
70 unsigned int prescale; 71 unsigned int prescale;
71 72
@@ -74,7 +75,7 @@ struct adc_device {
74 75
75static struct adc_device *adc_dev; 76static struct adc_device *adc_dev;
76 77
77static LIST_HEAD(adc_pending); 78static LIST_HEAD(adc_pending); /* protected by adc_device.lock */
78 79
79#define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg) 80#define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg)
80 81
@@ -145,7 +146,7 @@ int s3c_adc_start(struct s3c_adc_client *client,
145 if (client->is_ts && adc->ts_pend) 146 if (client->is_ts && adc->ts_pend)
146 return -EAGAIN; 147 return -EAGAIN;
147 148
148 local_irq_save(flags); 149 spin_lock_irqsave(&adc->lock, flags);
149 150
150 client->channel = channel; 151 client->channel = channel;
151 client->nr_samples = nr_samples; 152 client->nr_samples = nr_samples;
@@ -157,7 +158,8 @@ int s3c_adc_start(struct s3c_adc_client *client,
157 158
158 if (!adc->cur) 159 if (!adc->cur)
159 s3c_adc_try(adc); 160 s3c_adc_try(adc);
160 local_irq_restore(flags); 161
162 spin_unlock_irqrestore(&adc->lock, flags);
161 163
162 return 0; 164 return 0;
163} 165}
@@ -237,6 +239,10 @@ EXPORT_SYMBOL_GPL(s3c_adc_register);
237 239
238void s3c_adc_release(struct s3c_adc_client *client) 240void s3c_adc_release(struct s3c_adc_client *client)
239{ 241{
242 unsigned long flags;
243
244 spin_lock_irqsave(&adc_dev->lock, flags);
245
240 /* We should really check that nothing is in progress. */ 246 /* We should really check that nothing is in progress. */
241 if (adc_dev->cur == client) 247 if (adc_dev->cur == client)
242 adc_dev->cur = NULL; 248 adc_dev->cur = NULL;
@@ -255,6 +261,8 @@ void s3c_adc_release(struct s3c_adc_client *client)
255 261
256 if (adc_dev->cur == NULL) 262 if (adc_dev->cur == NULL)
257 s3c_adc_try(adc_dev); 263 s3c_adc_try(adc_dev);
264
265 spin_unlock_irqrestore(&adc_dev->lock, flags);
258 kfree(client); 266 kfree(client);
259} 267}
260EXPORT_SYMBOL_GPL(s3c_adc_release); 268EXPORT_SYMBOL_GPL(s3c_adc_release);
@@ -264,7 +272,6 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
264 struct adc_device *adc = pw; 272 struct adc_device *adc = pw;
265 struct s3c_adc_client *client = adc->cur; 273 struct s3c_adc_client *client = adc->cur;
266 enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data; 274 enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
267 unsigned long flags;
268 unsigned data0, data1; 275 unsigned data0, data1;
269 276
270 if (!client) { 277 if (!client) {
@@ -296,12 +303,12 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
296 client->select_cb(client, 1); 303 client->select_cb(client, 1);
297 s3c_adc_convert(adc); 304 s3c_adc_convert(adc);
298 } else { 305 } else {
299 local_irq_save(flags); 306 spin_lock(&adc->lock);
300 (client->select_cb)(client, 0); 307 (client->select_cb)(client, 0);
301 adc->cur = NULL; 308 adc->cur = NULL;
302 309
303 s3c_adc_try(adc); 310 s3c_adc_try(adc);
304 local_irq_restore(flags); 311 spin_unlock(&adc->lock);
305 } 312 }
306 313
307exit: 314exit:
@@ -326,6 +333,8 @@ static int s3c_adc_probe(struct platform_device *pdev)
326 return -ENOMEM; 333 return -ENOMEM;
327 } 334 }
328 335
336 spin_lock_init(&adc->lock);
337
329 adc->pdev = pdev; 338 adc->pdev = pdev;
330 adc->prescale = S3C2410_ADCCON_PRSCVL(49); 339 adc->prescale = S3C2410_ADCCON_PRSCVL(49);
331 340
@@ -407,13 +416,17 @@ static int __devexit s3c_adc_remove(struct platform_device *pdev)
407static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state) 416static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state)
408{ 417{
409 struct adc_device *adc = platform_get_drvdata(pdev); 418 struct adc_device *adc = platform_get_drvdata(pdev);
419 unsigned long flags;
410 u32 con; 420 u32 con;
411 421
422 spin_lock_irqsave(&adc->lock, flags);
423
412 con = readl(adc->regs + S3C2410_ADCCON); 424 con = readl(adc->regs + S3C2410_ADCCON);
413 con |= S3C2410_ADCCON_STDBM; 425 con |= S3C2410_ADCCON_STDBM;
414 writel(con, adc->regs + S3C2410_ADCCON); 426 writel(con, adc->regs + S3C2410_ADCCON);
415 427
416 disable_irq(adc->irq); 428 disable_irq(adc->irq);
429 spin_unlock_irqrestore(&adc->lock, flags);
417 clk_disable(adc->clk); 430 clk_disable(adc->clk);
418 431
419 return 0; 432 return 0;
@@ -422,6 +435,7 @@ static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state)
422static int s3c_adc_resume(struct platform_device *pdev) 435static int s3c_adc_resume(struct platform_device *pdev)
423{ 436{
424 struct adc_device *adc = platform_get_drvdata(pdev); 437 struct adc_device *adc = platform_get_drvdata(pdev);
438 unsigned long flags;
425 439
426 clk_enable(adc->clk); 440 clk_enable(adc->clk);
427 enable_irq(adc->irq); 441 enable_irq(adc->irq);
diff --git a/arch/arm/plat-samsung/dev-i2c2.c b/arch/arm/plat-samsung/dev-i2c2.c
new file mode 100644
index 000000000000..07036dee09e7
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c2.c
@@ -0,0 +1,70 @@
1/* linux/arch/arm/plat-s3c/dev-i2c2.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S3C series device definition for i2c device 2
7 *
8 * Based on plat-samsung/dev-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/gfp.h>
16#include <linux/kernel.h>
17#include <linux/string.h>
18#include <linux/platform_device.h>
19
20#include <mach/irqs.h>
21#include <mach/map.h>
22
23#include <plat/regs-iic.h>
24#include <plat/iic.h>
25#include <plat/devs.h>
26#include <plat/cpu.h>
27
28static struct resource s3c_i2c_resource[] = {
29 [0] = {
30 .start = S3C_PA_IIC2,
31 .end = S3C_PA_IIC2 + SZ_4K - 1,
32 .flags = IORESOURCE_MEM,
33 },
34 [1] = {
35 .start = IRQ_CAN0,
36 .end = IRQ_CAN0,
37 .flags = IORESOURCE_IRQ,
38 },
39};
40
41struct platform_device s3c_device_i2c2 = {
42 .name = "s3c2410-i2c",
43 .id = 2,
44 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
45 .resource = s3c_i2c_resource,
46};
47
48static struct s3c2410_platform_i2c default_i2c_data2 __initdata = {
49 .flags = 0,
50 .bus_num = 2,
51 .slave_addr = 0x10,
52 .frequency = 100*1000,
53 .sda_delay = 100,
54};
55
56void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
57{
58 struct s3c2410_platform_i2c *npd;
59
60 if (!pd)
61 pd = &default_i2c_data2;
62
63 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL);
64 if (!npd)
65 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
66 else if (!npd->cfg_gpio)
67 npd->cfg_gpio = s3c_i2c2_cfg_gpio;
68
69 s3c_device_i2c2.dev.platform_data = npd;
70}
diff --git a/arch/arm/plat-samsung/dev-onenand.c b/arch/arm/plat-samsung/dev-onenand.c
new file mode 100644
index 000000000000..45ec73287d8c
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-onenand.c
@@ -0,0 +1,55 @@
1/*
2 * linux/arch/arm/plat-samsung/dev-onenand.c
3 *
4 * Copyright (c) 2008-2010 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 *
7 * S3C64XX/S5PC100 series device definition for OneNAND devices
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/mtd/mtd.h>
17#include <linux/mtd/onenand.h>
18
19#include <mach/irqs.h>
20#include <mach/map.h>
21
22static struct resource s3c_onenand_resources[] = {
23 [0] = {
24 .start = S3C_PA_ONENAND,
25 .end = S3C_PA_ONENAND + 0x400 - 1,
26 .flags = IORESOURCE_MEM,
27 },
28 [1] = {
29 .start = S3C_PA_ONENAND_BUF,
30 .end = S3C_PA_ONENAND_BUF + S3C_SZ_ONENAND_BUF - 1,
31 .flags = IORESOURCE_MEM,
32 },
33 [2] = {
34 .start = IRQ_ONENAND,
35 .end = IRQ_ONENAND,
36 .flags = IORESOURCE_IRQ,
37 },
38};
39
40struct platform_device s3c_device_onenand = {
41 .name = "samsung-onenand",
42 .id = 0,
43 .num_resources = ARRAY_SIZE(s3c_onenand_resources),
44 .resource = s3c_onenand_resources,
45};
46
47void s3c_onenand_set_platdata(struct onenand_platform_data *pdata)
48{
49 struct onenand_platform_data *pd;
50
51 pd = kmemdup(pdata, sizeof(struct onenand_platform_data), GFP_KERNEL);
52 if (!pd)
53 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
54 s3c_device_onenand.dev.platform_data = pd;
55}
diff --git a/arch/arm/plat-samsung/dev-wdt.c b/arch/arm/plat-samsung/dev-wdt.c
new file mode 100644
index 000000000000..5efca87cddbd
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-wdt.c
@@ -0,0 +1,40 @@
1/* linux/arch/arm/plat-samsung/dev-wdt.c
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C series device definition for the watchdog timer
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/platform_device.h>
15
16#include <mach/irqs.h>
17#include <mach/map.h>
18
19#include <plat/devs.h>
20
21static struct resource s3c_wdt_resource[] = {
22 [0] = {
23 .start = S3C_PA_WDT,
24 .end = S3C_PA_WDT + SZ_1M - 1,
25 .flags = IORESOURCE_MEM,
26 },
27 [1] = {
28 .start = IRQ_WDT,
29 .end = IRQ_WDT,
30 .flags = IORESOURCE_IRQ,
31 }
32};
33
34struct platform_device s3c_device_wdt = {
35 .name = "s3c2410-wdt",
36 .id = -1,
37 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
38 .resource = s3c_wdt_resource,
39};
40EXPORT_SYMBOL(s3c_device_wdt);
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index ef69e56b2885..e6144e4b9118 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -45,6 +45,7 @@ extern struct platform_device s3c_device_lcd;
45extern struct platform_device s3c_device_wdt; 45extern struct platform_device s3c_device_wdt;
46extern struct platform_device s3c_device_i2c0; 46extern struct platform_device s3c_device_i2c0;
47extern struct platform_device s3c_device_i2c1; 47extern struct platform_device s3c_device_i2c1;
48extern struct platform_device s3c_device_i2c2;
48extern struct platform_device s3c_device_rtc; 49extern struct platform_device s3c_device_rtc;
49extern struct platform_device s3c_device_adc; 50extern struct platform_device s3c_device_adc;
50extern struct platform_device s3c_device_sdi; 51extern struct platform_device s3c_device_sdi;
@@ -57,9 +58,20 @@ extern struct platform_device s3c_device_hsmmc2;
57extern struct platform_device s3c_device_spi0; 58extern struct platform_device s3c_device_spi0;
58extern struct platform_device s3c_device_spi1; 59extern struct platform_device s3c_device_spi1;
59 60
61extern struct platform_device s5pc100_device_spi0;
62extern struct platform_device s5pc100_device_spi1;
63extern struct platform_device s5pc100_device_spi2;
64extern struct platform_device s5pv210_device_spi0;
65extern struct platform_device s5pv210_device_spi1;
66extern struct platform_device s5p6440_device_spi0;
67extern struct platform_device s5p6440_device_spi1;
68
60extern struct platform_device s3c_device_hwmon; 69extern struct platform_device s3c_device_hwmon;
61 70
62extern struct platform_device s3c_device_nand; 71extern struct platform_device s3c_device_nand;
72extern struct platform_device s3c_device_onenand;
73extern struct platform_device s3c64xx_device_onenand1;
74extern struct platform_device s5pc110_device_onenand;
63 75
64extern struct platform_device s3c_device_usbgadget; 76extern struct platform_device s3c_device_usbgadget;
65extern struct platform_device s3c_device_usb_hsotg; 77extern struct platform_device s3c_device_usb_hsotg;
@@ -76,10 +88,18 @@ extern struct platform_device s5p6442_device_pcm0;
76extern struct platform_device s5p6442_device_pcm1; 88extern struct platform_device s5p6442_device_pcm1;
77extern struct platform_device s5p6442_device_iis0; 89extern struct platform_device s5p6442_device_iis0;
78extern struct platform_device s5p6442_device_iis1; 90extern struct platform_device s5p6442_device_iis1;
91extern struct platform_device s5p6442_device_spi;
79 92
80extern struct platform_device s5p6440_device_pcm; 93extern struct platform_device s5p6440_device_pcm;
81extern struct platform_device s5p6440_device_iis; 94extern struct platform_device s5p6440_device_iis;
82 95
96extern struct platform_device s5pc100_device_ac97;
97extern struct platform_device s5pc100_device_pcm0;
98extern struct platform_device s5pc100_device_pcm1;
99extern struct platform_device s5pc100_device_iis0;
100extern struct platform_device s5pc100_device_iis1;
101extern struct platform_device s5pc100_device_iis2;
102
83/* s3c2440 specific devices */ 103/* s3c2440 specific devices */
84 104
85#ifdef CONFIG_CPU_S3C2440 105#ifdef CONFIG_CPU_S3C2440
diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h
index 1f85649d8c18..27d3b497b55b 100644
--- a/arch/arm/plat-samsung/include/plat/fb.h
+++ b/arch/arm/plat-samsung/include/plat/fb.h
@@ -84,4 +84,11 @@ extern void s3c64xx_fb_gpio_setup_24bpp(void);
84 */ 84 */
85extern void s5pc100_fb_gpio_setup_24bpp(void); 85extern void s5pc100_fb_gpio_setup_24bpp(void);
86 86
87/**
88 * s5pv210_fb_gpio_setup_24bpp() - S5PV210/S5PC110 setup function for 24bpp LCD
89 *
90 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
91 */
92extern void s5pv210_fb_gpio_setup_24bpp(void);
93
87#endif /* __PLAT_S3C_FB_H */ 94#endif /* __PLAT_S3C_FB_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
index 34efdd2b032c..db4112c6f2be 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
@@ -43,6 +43,11 @@ struct s3c_gpio_chip;
43 * layouts. Provide an point to vector control routine and provide any 43 * layouts. Provide an point to vector control routine and provide any
44 * per-bank configuration information that other systems such as the 44 * per-bank configuration information that other systems such as the
45 * external interrupt code will need. 45 * external interrupt code will need.
46 *
47 * @sa s3c_gpio_cfgpin
48 * @sa s3c_gpio_getcfg
49 * @sa s3c_gpio_setpull
50 * @sa s3c_gpio_getpull
46 */ 51 */
47struct s3c_gpio_cfg { 52struct s3c_gpio_cfg {
48 unsigned int cfg_eint; 53 unsigned int cfg_eint;
@@ -70,11 +75,25 @@ struct s3c_gpio_cfg {
70/** 75/**
71 * s3c_gpio_cfgpin() - Change the GPIO function of a pin. 76 * s3c_gpio_cfgpin() - Change the GPIO function of a pin.
72 * @pin pin The pin number to configure. 77 * @pin pin The pin number to configure.
73 * @pin to The configuration for the pin's function. 78 * @to to The configuration for the pin's function.
74 * 79 *
75 * Configure which function is actually connected to the external 80 * Configure which function is actually connected to the external
76 * pin, such as an gpio input, output or some form of special function 81 * pin, such as an gpio input, output or some form of special function
77 * connected to an internal peripheral block. 82 * connected to an internal peripheral block.
83 *
84 * The @to parameter can be one of the generic S3C_GPIO_INPUT, S3C_GPIO_OUTPUT
85 * or S3C_GPIO_SFN() to indicate one of the possible values that the helper
86 * will then generate the correct bit mask and shift for the configuration.
87 *
88 * If a bank of GPIOs all needs to be set to special-function 2, then
89 * the following code will work:
90 *
91 * for (gpio = start; gpio < end; gpio++)
92 * s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
93 *
94 * The @to parameter can also be a specific value already shifted to the
95 * correct position in the control register, although these are discouraged
96 * in newer kernels and are only being kept for compatibility.
78 */ 97 */
79extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to); 98extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to);
80 99
@@ -108,6 +127,8 @@ extern unsigned s3c_gpio_getcfg(unsigned int pin);
108 * This function sets the state of the pull-{up,down} resistor for the 127 * This function sets the state of the pull-{up,down} resistor for the
109 * specified pin. It will return 0 if successfull, or a negative error 128 * specified pin. It will return 0 if successfull, or a negative error
110 * code if the pin cannot support the requested pull setting. 129 * code if the pin cannot support the requested pull setting.
130 *
131 * @pull is one of S3C_GPIO_PULL_NONE, S3C_GPIO_PULL_DOWN or S3C_GPIO_PULL_UP.
111*/ 132*/
112extern int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull); 133extern int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull);
113 134
diff --git a/arch/arm/plat-samsung/include/plat/iic-core.h b/arch/arm/plat-samsung/include/plat/iic-core.h
index 36397ca20962..f182669b8e8e 100644
--- a/arch/arm/plat-samsung/include/plat/iic-core.h
+++ b/arch/arm/plat-samsung/include/plat/iic-core.h
@@ -32,4 +32,11 @@ static inline void s3c_i2c1_setname(char *name)
32#endif 32#endif
33} 33}
34 34
35static inline void s3c_i2c2_setname(char *name)
36{
37#ifdef CONFIG_S3C_DEV_I2C2
38 s3c_device_i2c2.name = name;
39#endif
40}
41
35#endif /* __ASM_ARCH_IIC_H */ 42#endif /* __ASM_ARCH_IIC_H */
diff --git a/arch/arm/plat-samsung/include/plat/iic.h b/arch/arm/plat-samsung/include/plat/iic.h
index 3083df00dee6..133308bf595d 100644
--- a/arch/arm/plat-samsung/include/plat/iic.h
+++ b/arch/arm/plat-samsung/include/plat/iic.h
@@ -54,9 +54,11 @@ struct s3c2410_platform_i2c {
54 */ 54 */
55extern void s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *i2c); 55extern void s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *i2c);
56extern void s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *i2c); 56extern void s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *i2c);
57extern void s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *i2c);
57 58
58/* defined by architecture to configure gpio */ 59/* defined by architecture to configure gpio */
59extern void s3c_i2c0_cfg_gpio(struct platform_device *dev); 60extern void s3c_i2c0_cfg_gpio(struct platform_device *dev);
60extern void s3c_i2c1_cfg_gpio(struct platform_device *dev); 61extern void s3c_i2c1_cfg_gpio(struct platform_device *dev);
62extern void s3c_i2c2_cfg_gpio(struct platform_device *dev);
61 63
62#endif /* __ASM_ARCH_IIC_H */ 64#endif /* __ASM_ARCH_IIC_H */
diff --git a/arch/arm/plat-samsung/include/plat/onenand-core.h b/arch/arm/plat-samsung/include/plat/onenand-core.h
new file mode 100644
index 000000000000..7701cb7020c8
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/onenand-core.h
@@ -0,0 +1,37 @@
1/*
2 * linux/arch/arm/plat-samsung/onenand-core.h
3 *
4 * Copyright (c) 2010 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Marek Szyprowski <m.szyprowski@samsung.com>
7 *
8 * Samsung OneNAD Controller core functions
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_ONENAND_CORE_H
16#define __ASM_ARCH_ONENAND_CORE_H __FILE__
17
18/* These functions are only for use with the core support code, such as
19 * the cpu specific initialisation code
20 */
21
22/* re-define device name depending on support. */
23static inline void s3c_onenand_setname(char *name)
24{
25#ifdef CONFIG_S3C_DEV_ONENAND
26 s3c_device_onenand.name = name;
27#endif
28}
29
30static inline void s3c64xx_onenand1_setname(char *name)
31{
32#ifdef CONFIG_S3C64XX_DEV_ONENAND1
33 s3c64xx_device_onenand1.name = name;
34#endif
35}
36
37#endif /* __ASM_ARCH_ONENAND_CORE_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-onenand.h b/arch/arm/plat-samsung/include/plat/regs-onenand.h
new file mode 100644
index 000000000000..930ea8b88ed3
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/regs-onenand.h
@@ -0,0 +1,63 @@
1/*
2 * linux/arch/arm/plat-s3c/include/plat/regs-onenand.h
3 *
4 * Copyright (C) 2008-2010 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __SAMSUNG_ONENAND_H__
12#define __SAMSUNG_ONENAND_H__
13
14#include <mach/hardware.h>
15
16/*
17 * OneNAND Controller
18 */
19#define MEM_CFG_OFFSET 0x0000
20#define BURST_LEN_OFFSET 0x0010
21#define MEM_RESET_OFFSET 0x0020
22#define INT_ERR_STAT_OFFSET 0x0030
23#define INT_ERR_MASK_OFFSET 0x0040
24#define INT_ERR_ACK_OFFSET 0x0050
25#define ECC_ERR_STAT_OFFSET 0x0060
26#define MANUFACT_ID_OFFSET 0x0070
27#define DEVICE_ID_OFFSET 0x0080
28#define DATA_BUF_SIZE_OFFSET 0x0090
29#define BOOT_BUF_SIZE_OFFSET 0x00A0
30#define BUF_AMOUNT_OFFSET 0x00B0
31#define TECH_OFFSET 0x00C0
32#define FBA_WIDTH_OFFSET 0x00D0
33#define FPA_WIDTH_OFFSET 0x00E0
34#define FSA_WIDTH_OFFSET 0x00F0
35#define TRANS_SPARE_OFFSET 0x0140
36#define DBS_DFS_WIDTH_OFFSET 0x0160
37#define INT_PIN_ENABLE_OFFSET 0x01A0
38#define ACC_CLOCK_OFFSET 0x01C0
39#define FLASH_VER_ID_OFFSET 0x01F0
40#define FLASH_AUX_CNTRL_OFFSET 0x0300 /* s3c64xx only */
41
42#define ONENAND_MEM_RESET_HOT 0x3
43#define ONENAND_MEM_RESET_COLD 0x2
44#define ONENAND_MEM_RESET_WARM 0x1
45
46#define CACHE_OP_ERR (1 << 13)
47#define RST_CMP (1 << 12)
48#define RDY_ACT (1 << 11)
49#define INT_ACT (1 << 10)
50#define UNSUP_CMD (1 << 9)
51#define LOCKED_BLK (1 << 8)
52#define BLK_RW_CMP (1 << 7)
53#define ERS_CMP (1 << 6)
54#define PGM_CMP (1 << 5)
55#define LOAD_CMP (1 << 4)
56#define ERS_FAIL (1 << 3)
57#define PGM_FAIL (1 << 2)
58#define INT_TO (1 << 1)
59#define LD_FAIL_ECC_ERR (1 << 0)
60
61#define TSRF (1 << 0)
62
63#endif
diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
index d5837cf8e402..65c190d142dd 100644
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h
@@ -20,6 +20,10 @@
20#define S3C2410_RTCCON_CLKSEL (1<<1) 20#define S3C2410_RTCCON_CLKSEL (1<<1)
21#define S3C2410_RTCCON_CNTSEL (1<<2) 21#define S3C2410_RTCCON_CNTSEL (1<<2)
22#define S3C2410_RTCCON_CLKRST (1<<3) 22#define S3C2410_RTCCON_CLKRST (1<<3)
23#define S3C64XX_RTCCON_TICEN (1<<8)
24
25#define S3C64XX_RTCCON_TICMSK (0xF<<7)
26#define S3C64XX_RTCCON_TICSHT (7)
23 27
24#define S3C2410_TICNT S3C2410_RTCREG(0x44) 28#define S3C2410_TICNT S3C2410_RTCREG(0x44)
25#define S3C2410_TICNT_ENABLE (1<<7) 29#define S3C2410_TICNT_ENABLE (1<<7)
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
index d17724149315..e5aba8f95b79 100644
--- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
+++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
@@ -63,5 +63,9 @@ struct s3c64xx_spi_info {
63 * has some chips attached to it. 63 * has some chips attached to it.
64 */ 64 */
65extern void s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); 65extern void s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
66extern void s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
67extern void s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
68extern void s5p6440_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
69extern void s5p6442_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
66 70
67#endif /* __S3C64XX_PLAT_SPI_H */ 71#endif /* __S3C64XX_PLAT_SPI_H */
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 7d07cd7aa4f2..13f9fb20900a 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -75,6 +75,9 @@ extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
75extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 75extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
76extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 76extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
77extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 77extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
78extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
79extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
80extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
78 81
79/* S3C6400 SDHCI setup */ 82/* S3C6400 SDHCI setup */
80 83
@@ -218,4 +221,56 @@ static inline void s5pc100_default_sdhci1(void) { }
218static inline void s5pc100_default_sdhci2(void) { } 221static inline void s5pc100_default_sdhci2(void) { }
219#endif /* CONFIG_S5PC100_SETUP_SDHCI */ 222#endif /* CONFIG_S5PC100_SETUP_SDHCI */
220 223
224
225/* S5PC110 SDHCI setup */
226#ifdef CONFIG_S5PV210_SETUP_SDHCI
227extern char *s5pv210_hsmmc_clksrcs[4];
228
229extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
230 void __iomem *r,
231 struct mmc_ios *ios,
232 struct mmc_card *card);
233
234#ifdef CONFIG_S3C_DEV_HSMMC
235static inline void s5pv210_default_sdhci0(void)
236{
237 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
238 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
239 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
240}
241#else
242static inline void s5pc100_default_sdhci0(void) { }
243#endif /* CONFIG_S3C_DEV_HSMMC */
244
245#ifdef CONFIG_S3C_DEV_HSMMC1
246static inline void s5pv210_default_sdhci1(void)
247{
248 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
249 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
250 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
251}
252#else
253static inline void s5pv210_default_sdhci1(void) { }
254#endif /* CONFIG_S3C_DEV_HSMMC1 */
255
256#ifdef CONFIG_S3C_DEV_HSMMC2
257static inline void s5pv210_default_sdhci2(void)
258{
259 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
260 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
261 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
262}
263#else
264static inline void s5pv210_default_sdhci2(void) { }
265#endif /* CONFIG_S3C_DEV_HSMMC2 */
266
267#else
268static inline void s5pv210_default_sdhci0(void) { }
269static inline void s5pv210_default_sdhci1(void) { }
270static inline void s5pv210_default_sdhci2(void) { }
271#endif /* CONFIG_S5PC100_SETUP_SDHCI */
272
273
274
275
221#endif /* __PLAT_S3C_SDHCI_H */ 276#endif /* __PLAT_S3C_SDHCI_H */
diff --git a/arch/arm/plat-samsung/include/plat/wakeup-mask.h b/arch/arm/plat-samsung/include/plat/wakeup-mask.h
new file mode 100644
index 000000000000..43e4acd2e1c6
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/wakeup-mask.h
@@ -0,0 +1,44 @@
1/* arch/arm/plat-samsung/include/plat/wakeup-mask.h
2 *
3 * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
4 *
5 * Support for wakeup mask interrupts on newer SoCs
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11*/
12
13#ifndef __PLAT_WAKEUP_MASK_H
14#define __PLAT_WAKEUP_MASK_H __file__
15
16/* if no irq yet defined, but still want to mask */
17#define NO_WAKEUP_IRQ (0x90000000)
18
19/**
20 * struct samsung_wakeup_mask - wakeup mask information
21 * @irq: The interrupt associated with this wakeup.
22 * @bit: The bit, as a (1 << bitno) controlling this source.
23 */
24struct samsung_wakeup_mask {
25 unsigned int irq;
26 u32 bit;
27};
28
29/**
30 * samsung_sync_wakemask - sync wakeup mask information for pm
31 * @reg: The register that is used.
32 * @masks: The list of masks to use.
33 * @nr_masks: The number of entries pointed to buy @masks.
34 *
35 * Synchronise the wakeup mask information at suspend time from the list
36 * of interrupts and control bits in @masks. We do this at suspend time
37 * as overriding the relevant irq chips is harder and the register is only
38 * required to be correct before we enter sleep.
39 */
40extern void samsung_sync_wakemask(void __iomem *reg,
41 struct samsung_wakeup_mask *masks,
42 int nr_masks);
43
44#endif /* __PLAT_WAKEUP_MASK_H */
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index d50ab9d2af53..7df03f87fbfa 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -331,8 +331,10 @@ void s3c_pm_save_gpios(void)
331 331
332 for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) { 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 gpio_nr++;
335 continue; 336 continue;
337 }
336 338
337 s3c_pm_save_gpio(ourchip); 339 s3c_pm_save_gpio(ourchip);
338 340
@@ -369,8 +371,10 @@ void s3c_pm_restore_gpios(void)
369 371
370 for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) { 372 for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
371 ourchip = s3c_gpiolib_getchip(gpio_nr); 373 ourchip = s3c_gpiolib_getchip(gpio_nr);
372 if (!ourchip) 374 if (!ourchip) {
375 gpio_nr++;
373 continue; 376 continue;
377 }
374 378
375 s3c_pm_resume_gpio(ourchip); 379 s3c_pm_resume_gpio(ourchip);
376 380
diff --git a/arch/arm/plat-samsung/wakeup-mask.c b/arch/arm/plat-samsung/wakeup-mask.c
new file mode 100644
index 000000000000..2e09b6ad84ca
--- /dev/null
+++ b/arch/arm/plat-samsung/wakeup-mask.c
@@ -0,0 +1,47 @@
1/* arch/arm/plat-samsung/wakeup-mask.c
2 *
3 * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
4 *
5 * Support for wakeup mask interrupts on newer SoCs
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/spinlock.h>
14#include <linux/sysdev.h>
15#include <linux/types.h>
16#include <linux/irq.h>
17#include <linux/io.h>
18
19#include <plat/wakeup-mask.h>
20#include <plat/pm.h>
21
22void samsung_sync_wakemask(void __iomem *reg,
23 struct samsung_wakeup_mask *mask, int nr_mask)
24{
25 struct irq_desc *desc;
26 u32 val;
27
28 val = __raw_readl(reg);
29
30 for (; nr_mask > 0; nr_mask--, mask++) {
31 if (mask->irq == NO_WAKEUP_IRQ) {
32 val |= mask->bit;
33 continue;
34 }
35
36 desc = irq_to_desc(mask->irq);
37
38 /* bit of a liberty to read this directly from irq_desc. */
39 if (desc->wake_depth > 0)
40 val &= ~mask->bit;
41 else
42 val |= mask->bit;
43 }
44
45 printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
46 __raw_writel(val, reg);
47}