diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-11-29 04:51:07 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-11-29 04:51:07 -0500 |
commit | 0d2cd91bf7b1a7cc1d638296111fcc2bcf5c0bb4 (patch) | |
tree | d2ca69347816c27f9dc352581f5d0fe76811cd49 /arch/arm/plat-samsung | |
parent | 3d95fd6ad8d3cf582a70ed65660017114b6e4065 (diff) | |
parent | caca6a03d365883564885f2c1da3e88dcf65d139 (diff) |
Merge commit 'v3.2-rc3' into next
Diffstat (limited to 'arch/arm/plat-samsung')
108 files changed, 5020 insertions, 4086 deletions
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index b3e10659e4b8..313eb26cfa62 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -65,11 +65,6 @@ config SAMSUNG_IRQ_VIC_TIMER | |||
65 | help | 65 | help |
66 | Internal configuration to build the VIC timer interrupt code. | 66 | Internal configuration to build the VIC timer interrupt code. |
67 | 67 | ||
68 | config SAMSUNG_IRQ_UART | ||
69 | bool | ||
70 | help | ||
71 | Internal configuration to build the IRQ UART demux code. | ||
72 | |||
73 | # options for gpio configuration support | 68 | # options for gpio configuration support |
74 | 69 | ||
75 | config SAMSUNG_GPIOLIB_4BIT | 70 | config SAMSUNG_GPIOLIB_4BIT |
@@ -79,39 +74,12 @@ config SAMSUNG_GPIOLIB_4BIT | |||
79 | configuration. GPIOlib shall be compiled only for S3C64XX and S5P | 74 | configuration. GPIOlib shall be compiled only for S3C64XX and S5P |
80 | series of processors. | 75 | series of processors. |
81 | 76 | ||
82 | config S3C_GPIO_CFG_S3C24XX | ||
83 | bool | ||
84 | help | ||
85 | Internal configuration to enable S3C24XX style GPIO configuration | ||
86 | functions. | ||
87 | |||
88 | config S3C_GPIO_CFG_S3C64XX | 77 | config S3C_GPIO_CFG_S3C64XX |
89 | bool | 78 | bool |
90 | help | 79 | help |
91 | Internal configuration to enable S3C64XX style GPIO configuration | 80 | Internal configuration to enable S3C64XX style GPIO configuration |
92 | functions. | 81 | functions. |
93 | 82 | ||
94 | config S3C_GPIO_PULL_UPDOWN | ||
95 | bool | ||
96 | help | ||
97 | Internal configuration to enable the correct GPIO pull helper | ||
98 | |||
99 | config S3C_GPIO_PULL_S3C2443 | ||
100 | bool | ||
101 | select S3C_GPIO_PULL_UPDOWN | ||
102 | help | ||
103 | Internal configuration to enable the correct GPIO pull helper for S3C2443-style GPIO | ||
104 | |||
105 | config S3C_GPIO_PULL_DOWN | ||
106 | bool | ||
107 | help | ||
108 | Internal configuration to enable the correct GPIO pull helper | ||
109 | |||
110 | config S3C_GPIO_PULL_UP | ||
111 | bool | ||
112 | help | ||
113 | Internal configuration to enable the correct GPIO pull helper | ||
114 | |||
115 | config S5P_GPIO_DRVSTR | 83 | config S5P_GPIO_DRVSTR |
116 | bool | 84 | bool |
117 | help | 85 | help |
@@ -300,11 +268,14 @@ config S3C_DMA | |||
300 | help | 268 | help |
301 | Internal configuration for S3C DMA core | 269 | Internal configuration for S3C DMA core |
302 | 270 | ||
303 | config S3C_PL330_DMA | 271 | config SAMSUNG_DMADEV |
304 | bool | 272 | bool |
305 | select PL330 | 273 | select DMADEVICES |
274 | select PL330_DMA if (CPU_EXYNOS4210 || CPU_S5PV210 || CPU_S5PC100 || \ | ||
275 | CPU_S5P6450 || CPU_S5P6440) | ||
276 | select ARM_AMBA | ||
306 | help | 277 | help |
307 | S3C DMA API Driver for PL330 DMAC. | 278 | Use DMA device engine for PL330 DMAC. |
308 | 279 | ||
309 | comment "Power management" | 280 | comment "Power management" |
310 | 281 | ||
@@ -367,4 +338,11 @@ config SAMSUNG_PD | |||
367 | help | 338 | help |
368 | Say Y here if you want to control Power Domain by Runtime PM. | 339 | Say Y here if you want to control Power Domain by Runtime PM. |
369 | 340 | ||
341 | config DEBUG_S3C_UART | ||
342 | depends on PLAT_SAMSUNG | ||
343 | int | ||
344 | default "0" if DEBUG_S3C_UART0 | ||
345 | default "1" if DEBUG_S3C_UART1 | ||
346 | default "2" if DEBUG_S3C_UART2 | ||
347 | |||
370 | endif | 348 | endif |
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 853764ba8cc5..6012366f33cb 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # arch/arm/plat-s3c64xx/Makefile | 1 | # arch/arm/plat-samsung/Makefile |
2 | # | 2 | # |
3 | # Copyright 2009 Simtec Electronics | 3 | # Copyright 2009 Simtec Electronics |
4 | # | 4 | # |
@@ -11,17 +11,13 @@ obj- := | |||
11 | 11 | ||
12 | # Objects we always build independent of SoC choice | 12 | # Objects we always build independent of SoC choice |
13 | 13 | ||
14 | obj-y += init.o | 14 | obj-y += init.o cpu.o |
15 | obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET) += time.o | 15 | obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET) += time.o |
16 | obj-y += clock.o | 16 | obj-y += clock.o |
17 | obj-y += pwm-clock.o | 17 | obj-y += pwm-clock.o |
18 | obj-y += gpio.o | ||
19 | obj-y += gpio-config.o | ||
20 | obj-y += dev-asocdma.o | ||
21 | 18 | ||
22 | obj-$(CONFIG_SAMSUNG_CLKSRC) += clock-clksrc.o | 19 | obj-$(CONFIG_SAMSUNG_CLKSRC) += clock-clksrc.o |
23 | 20 | ||
24 | obj-$(CONFIG_SAMSUNG_IRQ_UART) += irq-uart.o | ||
25 | obj-$(CONFIG_SAMSUNG_IRQ_VIC_TIMER) += irq-vic-timer.o | 21 | obj-$(CONFIG_SAMSUNG_IRQ_VIC_TIMER) += irq-vic-timer.o |
26 | 22 | ||
27 | # ADC | 23 | # ADC |
@@ -32,40 +28,16 @@ obj-$(CONFIG_S3C_ADC) += adc.o | |||
32 | 28 | ||
33 | obj-y += platformdata.o | 29 | obj-y += platformdata.o |
34 | 30 | ||
35 | obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o | 31 | obj-y += devs.o |
36 | obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o | ||
37 | obj-$(CONFIG_S3C_DEV_HSMMC2) += dev-hsmmc2.o | ||
38 | obj-$(CONFIG_S3C_DEV_HSMMC3) += dev-hsmmc3.o | ||
39 | obj-$(CONFIG_S3C_DEV_HWMON) += dev-hwmon.o | ||
40 | obj-y += dev-i2c0.o | ||
41 | obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o | ||
42 | obj-$(CONFIG_S3C_DEV_I2C2) += dev-i2c2.o | ||
43 | obj-$(CONFIG_S3C_DEV_I2C3) += dev-i2c3.o | ||
44 | obj-$(CONFIG_S3C_DEV_I2C4) += dev-i2c4.o | ||
45 | obj-$(CONFIG_S3C_DEV_I2C5) += dev-i2c5.o | ||
46 | obj-$(CONFIG_S3C_DEV_I2C6) += dev-i2c6.o | ||
47 | obj-$(CONFIG_S3C_DEV_I2C7) += dev-i2c7.o | ||
48 | obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o | ||
49 | obj-y += dev-uart.o | 32 | obj-y += dev-uart.o |
50 | obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o | 33 | |
51 | obj-$(CONFIG_S3C_DEV_USB_HSOTG) += dev-usb-hsotg.o | ||
52 | obj-$(CONFIG_S3C_DEV_WDT) += dev-wdt.o | ||
53 | obj-$(CONFIG_S3C_DEV_NAND) += dev-nand.o | ||
54 | obj-$(CONFIG_S3C_DEV_ONENAND) += dev-onenand.o | ||
55 | obj-$(CONFIG_S3C_DEV_RTC) += dev-rtc.o | ||
56 | |||
57 | obj-$(CONFIG_SAMSUNG_DEV_ADC) += dev-adc.o | ||
58 | obj-$(CONFIG_SAMSUNG_DEV_IDE) += dev-ide.o | ||
59 | obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o | ||
60 | obj-$(CONFIG_SAMSUNG_DEV_KEYPAD) += dev-keypad.o | ||
61 | obj-$(CONFIG_SAMSUNG_DEV_PWM) += dev-pwm.o | ||
62 | obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o | 34 | obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o |
63 | 35 | ||
64 | # DMA support | 36 | # DMA support |
65 | 37 | ||
66 | obj-$(CONFIG_S3C_DMA) += dma.o | 38 | obj-$(CONFIG_S3C_DMA) += dma.o s3c-dma-ops.o |
67 | 39 | ||
68 | obj-$(CONFIG_S3C_PL330_DMA) += s3c-pl330.o | 40 | obj-$(CONFIG_SAMSUNG_DMADEV) += dma-ops.o |
69 | 41 | ||
70 | # PM support | 42 | # PM support |
71 | 43 | ||
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c index ee8deef19481..33ecd0c9f0c3 100644 --- a/arch/arm/plat-samsung/adc.c +++ b/arch/arm/plat-samsung/adc.c | |||
@@ -41,6 +41,8 @@ | |||
41 | 41 | ||
42 | enum s3c_cpu_type { | 42 | enum s3c_cpu_type { |
43 | TYPE_ADCV1, /* S3C24XX */ | 43 | TYPE_ADCV1, /* S3C24XX */ |
44 | TYPE_ADCV11, /* S3C2443 */ | ||
45 | TYPE_ADCV12, /* S3C2416, S3C2450 */ | ||
44 | TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */ | 46 | TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */ |
45 | TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */ | 47 | TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */ |
46 | }; | 48 | }; |
@@ -98,13 +100,17 @@ static inline void s3c_adc_select(struct adc_device *adc, | |||
98 | 100 | ||
99 | client->select_cb(client, 1); | 101 | client->select_cb(client, 1); |
100 | 102 | ||
101 | con &= ~S3C2410_ADCCON_MUXMASK; | 103 | if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2) |
104 | con &= ~S3C2410_ADCCON_MUXMASK; | ||
102 | con &= ~S3C2410_ADCCON_STDBM; | 105 | con &= ~S3C2410_ADCCON_STDBM; |
103 | con &= ~S3C2410_ADCCON_STARTMASK; | 106 | con &= ~S3C2410_ADCCON_STARTMASK; |
104 | 107 | ||
105 | if (!client->is_ts) { | 108 | if (!client->is_ts) { |
106 | if (cpu == TYPE_ADCV3) | 109 | if (cpu == TYPE_ADCV3) |
107 | writel(client->channel & 0xf, adc->regs + S5P_ADCMUX); | 110 | writel(client->channel & 0xf, adc->regs + S5P_ADCMUX); |
111 | else if (cpu == TYPE_ADCV11 || cpu == TYPE_ADCV12) | ||
112 | writel(client->channel & 0xf, | ||
113 | adc->regs + S3C2443_ADCMUX); | ||
108 | else | 114 | else |
109 | con |= S3C2410_ADCCON_SELMUX(client->channel); | 115 | con |= S3C2410_ADCCON_SELMUX(client->channel); |
110 | } | 116 | } |
@@ -293,13 +299,13 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) | |||
293 | 299 | ||
294 | client->nr_samples--; | 300 | client->nr_samples--; |
295 | 301 | ||
296 | if (cpu != TYPE_ADCV1) { | 302 | if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV11) { |
297 | /* S3C64XX/S5P ADC resolution is 12-bit */ | ||
298 | data0 &= 0xfff; | ||
299 | data1 &= 0xfff; | ||
300 | } else { | ||
301 | data0 &= 0x3ff; | 303 | data0 &= 0x3ff; |
302 | data1 &= 0x3ff; | 304 | data1 &= 0x3ff; |
305 | } else { | ||
306 | /* S3C2416/S3C64XX/S5P ADC resolution is 12-bit */ | ||
307 | data0 &= 0xfff; | ||
308 | data1 &= 0xfff; | ||
303 | } | 309 | } |
304 | 310 | ||
305 | if (client->convert_cb) | 311 | if (client->convert_cb) |
@@ -320,7 +326,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) | |||
320 | } | 326 | } |
321 | 327 | ||
322 | exit: | 328 | exit: |
323 | if (cpu != TYPE_ADCV1) { | 329 | if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) { |
324 | /* Clear ADC interrupt */ | 330 | /* Clear ADC interrupt */ |
325 | writel(0, adc->regs + S3C64XX_ADCCLRINT); | 331 | writel(0, adc->regs + S3C64XX_ADCCLRINT); |
326 | } | 332 | } |
@@ -332,6 +338,7 @@ static int s3c_adc_probe(struct platform_device *pdev) | |||
332 | struct device *dev = &pdev->dev; | 338 | struct device *dev = &pdev->dev; |
333 | struct adc_device *adc; | 339 | struct adc_device *adc; |
334 | struct resource *regs; | 340 | struct resource *regs; |
341 | enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data; | ||
335 | int ret; | 342 | int ret; |
336 | unsigned tmp; | 343 | unsigned tmp; |
337 | 344 | ||
@@ -394,10 +401,13 @@ static int s3c_adc_probe(struct platform_device *pdev) | |||
394 | clk_enable(adc->clk); | 401 | clk_enable(adc->clk); |
395 | 402 | ||
396 | tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; | 403 | tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; |
397 | if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) { | 404 | |
398 | /* Enable 12-bit ADC resolution */ | 405 | /* Enable 12-bit ADC resolution */ |
406 | if (cpu == TYPE_ADCV12) | ||
407 | tmp |= S3C2416_ADCCON_RESSEL; | ||
408 | if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) | ||
399 | tmp |= S3C64XX_ADCCON_RESSEL; | 409 | tmp |= S3C64XX_ADCCON_RESSEL; |
400 | } | 410 | |
401 | writel(tmp, adc->regs + S3C2410_ADCCON); | 411 | writel(tmp, adc->regs + S3C2410_ADCCON); |
402 | 412 | ||
403 | dev_info(dev, "attached adc driver\n"); | 413 | dev_info(dev, "attached adc driver\n"); |
@@ -464,6 +474,7 @@ static int s3c_adc_resume(struct device *dev) | |||
464 | struct platform_device *pdev = container_of(dev, | 474 | struct platform_device *pdev = container_of(dev, |
465 | struct platform_device, dev); | 475 | struct platform_device, dev); |
466 | struct adc_device *adc = platform_get_drvdata(pdev); | 476 | struct adc_device *adc = platform_get_drvdata(pdev); |
477 | enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data; | ||
467 | int ret; | 478 | int ret; |
468 | unsigned long tmp; | 479 | unsigned long tmp; |
469 | 480 | ||
@@ -474,9 +485,13 @@ static int s3c_adc_resume(struct device *dev) | |||
474 | enable_irq(adc->irq); | 485 | enable_irq(adc->irq); |
475 | 486 | ||
476 | tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; | 487 | tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; |
488 | |||
477 | /* Enable 12-bit ADC resolution */ | 489 | /* Enable 12-bit ADC resolution */ |
478 | if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) | 490 | if (cpu == TYPE_ADCV12) |
491 | tmp |= S3C2416_ADCCON_RESSEL; | ||
492 | if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) | ||
479 | tmp |= S3C64XX_ADCCON_RESSEL; | 493 | tmp |= S3C64XX_ADCCON_RESSEL; |
494 | |||
480 | writel(tmp, adc->regs + S3C2410_ADCCON); | 495 | writel(tmp, adc->regs + S3C2410_ADCCON); |
481 | 496 | ||
482 | return 0; | 497 | return 0; |
@@ -492,6 +507,12 @@ static struct platform_device_id s3c_adc_driver_ids[] = { | |||
492 | .name = "s3c24xx-adc", | 507 | .name = "s3c24xx-adc", |
493 | .driver_data = TYPE_ADCV1, | 508 | .driver_data = TYPE_ADCV1, |
494 | }, { | 509 | }, { |
510 | .name = "s3c2443-adc", | ||
511 | .driver_data = TYPE_ADCV11, | ||
512 | }, { | ||
513 | .name = "s3c2416-adc", | ||
514 | .driver_data = TYPE_ADCV12, | ||
515 | }, { | ||
495 | .name = "s3c64xx-adc", | 516 | .name = "s3c64xx-adc", |
496 | .driver_data = TYPE_ADCV2, | 517 | .driver_data = TYPE_ADCV2, |
497 | }, { | 518 | }, { |
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index 302c42670bd1..3b4451979d1b 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c | |||
@@ -64,6 +64,17 @@ static LIST_HEAD(clocks); | |||
64 | */ | 64 | */ |
65 | DEFINE_SPINLOCK(clocks_lock); | 65 | DEFINE_SPINLOCK(clocks_lock); |
66 | 66 | ||
67 | /* Global watchdog clock used by arch_wtd_reset() callback */ | ||
68 | struct clk *s3c2410_wdtclk; | ||
69 | static int __init s3c_wdt_reset_init(void) | ||
70 | { | ||
71 | s3c2410_wdtclk = clk_get(NULL, "watchdog"); | ||
72 | if (IS_ERR(s3c2410_wdtclk)) | ||
73 | printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__); | ||
74 | return 0; | ||
75 | } | ||
76 | arch_initcall(s3c_wdt_reset_init); | ||
77 | |||
67 | /* enable and disable calls for use with the clk struct */ | 78 | /* enable and disable calls for use with the clk struct */ |
68 | 79 | ||
69 | static int clk_null_enable(struct clk *clk, int enable) | 80 | static int clk_null_enable(struct clk *clk, int enable) |
diff --git a/arch/arm/plat-samsung/cpu.c b/arch/arm/plat-samsung/cpu.c new file mode 100644 index 000000000000..81c06d44c11e --- /dev/null +++ b/arch/arm/plat-samsung/cpu.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* linux/arch/arm/plat-samsung/cpu.c | ||
2 | * | ||
3 | * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Samsung CPU 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/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include <asm/system.h> | ||
19 | |||
20 | #include <mach/map.h> | ||
21 | #include <plat/cpu.h> | ||
22 | |||
23 | unsigned long samsung_cpu_id; | ||
24 | static unsigned int samsung_cpu_rev; | ||
25 | |||
26 | unsigned int samsung_rev(void) | ||
27 | { | ||
28 | return samsung_cpu_rev; | ||
29 | } | ||
30 | EXPORT_SYMBOL(samsung_rev); | ||
31 | |||
32 | void __init s3c24xx_init_cpu(void) | ||
33 | { | ||
34 | /* nothing here yet */ | ||
35 | |||
36 | samsung_cpu_rev = 0; | ||
37 | } | ||
38 | |||
39 | void __init s3c64xx_init_cpu(void) | ||
40 | { | ||
41 | samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0x118); | ||
42 | if (!samsung_cpu_id) { | ||
43 | /* | ||
44 | * S3C6400 has the ID register in a different place, | ||
45 | * and needs a write before it can be read. | ||
46 | */ | ||
47 | __raw_writel(0x0, S3C_VA_SYS + 0xA1C); | ||
48 | samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0xA1C); | ||
49 | } | ||
50 | |||
51 | samsung_cpu_rev = 0; | ||
52 | } | ||
53 | |||
54 | void __init s5p_init_cpu(void __iomem *cpuid_addr) | ||
55 | { | ||
56 | samsung_cpu_id = __raw_readl(cpuid_addr); | ||
57 | samsung_cpu_rev = samsung_cpu_id & 0xFF; | ||
58 | } | ||
diff --git a/arch/arm/plat-samsung/dev-adc.c b/arch/arm/plat-samsung/dev-adc.c deleted file mode 100644 index 9d903d4095ed..000000000000 --- a/arch/arm/plat-samsung/dev-adc.c +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-adc.c | ||
2 | * | ||
3 | * Copyright 2010 Maurus Cuelenaere | ||
4 | * | ||
5 | * S3C64xx series device definition for ADC device | ||
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/string.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | #include <mach/irqs.h> | ||
17 | #include <mach/map.h> | ||
18 | |||
19 | #include <plat/adc.h> | ||
20 | #include <plat/devs.h> | ||
21 | #include <plat/cpu.h> | ||
22 | |||
23 | static struct resource s3c_adc_resource[] = { | ||
24 | [0] = { | ||
25 | .start = SAMSUNG_PA_ADC, | ||
26 | .end = SAMSUNG_PA_ADC + SZ_256 - 1, | ||
27 | .flags = IORESOURCE_MEM, | ||
28 | }, | ||
29 | [1] = { | ||
30 | .start = IRQ_TC, | ||
31 | .end = IRQ_TC, | ||
32 | .flags = IORESOURCE_IRQ, | ||
33 | }, | ||
34 | [2] = { | ||
35 | .start = IRQ_ADC, | ||
36 | .end = IRQ_ADC, | ||
37 | .flags = IORESOURCE_IRQ, | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | struct platform_device s3c_device_adc = { | ||
42 | .name = "samsung-adc", | ||
43 | .id = -1, | ||
44 | .num_resources = ARRAY_SIZE(s3c_adc_resource), | ||
45 | .resource = s3c_adc_resource, | ||
46 | }; | ||
diff --git a/arch/arm/plat-samsung/dev-asocdma.c b/arch/arm/plat-samsung/dev-asocdma.c deleted file mode 100644 index 97e35d3c064d..000000000000 --- a/arch/arm/plat-samsung/dev-asocdma.c +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-asocdma.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co. Ltd | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/dma-mapping.h> | ||
13 | #include <plat/devs.h> | ||
14 | |||
15 | static u64 audio_dmamask = DMA_BIT_MASK(32); | ||
16 | |||
17 | struct platform_device samsung_asoc_dma = { | ||
18 | .name = "samsung-audio", | ||
19 | .id = -1, | ||
20 | .dev = { | ||
21 | .dma_mask = &audio_dmamask, | ||
22 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
23 | } | ||
24 | }; | ||
25 | EXPORT_SYMBOL(samsung_asoc_dma); | ||
26 | |||
27 | struct platform_device samsung_asoc_idma = { | ||
28 | .name = "samsung-idma", | ||
29 | .id = -1, | ||
30 | .dev = { | ||
31 | .dma_mask = &audio_dmamask, | ||
32 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
33 | } | ||
34 | }; | ||
35 | EXPORT_SYMBOL(samsung_asoc_idma); | ||
diff --git a/arch/arm/plat-samsung/dev-backlight.c b/arch/arm/plat-samsung/dev-backlight.c index 3cedd4c407af..e657305644cc 100644 --- a/arch/arm/plat-samsung/dev-backlight.c +++ b/arch/arm/plat-samsung/dev-backlight.c | |||
@@ -12,8 +12,10 @@ | |||
12 | 12 | ||
13 | #include <linux/gpio.h> | 13 | #include <linux/gpio.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/io.h> | 16 | #include <linux/io.h> |
16 | #include <linux/pwm_backlight.h> | 17 | #include <linux/pwm_backlight.h> |
18 | #include <linux/slab.h> | ||
17 | 19 | ||
18 | #include <plat/devs.h> | 20 | #include <plat/devs.h> |
19 | #include <plat/gpio-cfg.h> | 21 | #include <plat/gpio-cfg.h> |
diff --git a/arch/arm/plat-samsung/dev-fb.c b/arch/arm/plat-samsung/dev-fb.c deleted file mode 100644 index 49a1362fd25b..000000000000 --- a/arch/arm/plat-samsung/dev-fb.c +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dev-fb.c | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C series device definition for framebuffer device | ||
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/string.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/fb.h> | ||
18 | #include <linux/gfp.h> | ||
19 | |||
20 | #include <mach/irqs.h> | ||
21 | #include <mach/map.h> | ||
22 | |||
23 | #include <plat/fb.h> | ||
24 | #include <plat/devs.h> | ||
25 | #include <plat/cpu.h> | ||
26 | |||
27 | static struct resource s3c_fb_resource[] = { | ||
28 | [0] = { | ||
29 | .start = S3C_PA_FB, | ||
30 | .end = S3C_PA_FB + SZ_16K - 1, | ||
31 | .flags = IORESOURCE_MEM, | ||
32 | }, | ||
33 | [1] = { | ||
34 | .start = IRQ_LCD_VSYNC, | ||
35 | .end = IRQ_LCD_VSYNC, | ||
36 | .flags = IORESOURCE_IRQ, | ||
37 | }, | ||
38 | [2] = { | ||
39 | .start = IRQ_LCD_FIFO, | ||
40 | .end = IRQ_LCD_FIFO, | ||
41 | .flags = IORESOURCE_IRQ, | ||
42 | }, | ||
43 | [3] = { | ||
44 | .start = IRQ_LCD_SYSTEM, | ||
45 | .end = IRQ_LCD_SYSTEM, | ||
46 | .flags = IORESOURCE_IRQ, | ||
47 | }, | ||
48 | }; | ||
49 | |||
50 | struct platform_device s3c_device_fb = { | ||
51 | .name = "s3c-fb", | ||
52 | .id = -1, | ||
53 | .num_resources = ARRAY_SIZE(s3c_fb_resource), | ||
54 | .resource = s3c_fb_resource, | ||
55 | .dev.dma_mask = &s3c_device_fb.dev.coherent_dma_mask, | ||
56 | .dev.coherent_dma_mask = 0xffffffffUL, | ||
57 | }; | ||
58 | |||
59 | void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd) | ||
60 | { | ||
61 | s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata), | ||
62 | &s3c_device_fb); | ||
63 | } | ||
diff --git a/arch/arm/plat-samsung/dev-hsmmc.c b/arch/arm/plat-samsung/dev-hsmmc.c deleted file mode 100644 index db7a65c7f127..000000000000 --- a/arch/arm/plat-samsung/dev-hsmmc.c +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dev-hsmmc.c | ||
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C series device definition for hsmmc 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/mmc/host.h> | ||
17 | |||
18 | #include <mach/map.h> | ||
19 | #include <plat/sdhci.h> | ||
20 | #include <plat/devs.h> | ||
21 | #include <plat/cpu.h> | ||
22 | |||
23 | #define S3C_SZ_HSMMC (0x1000) | ||
24 | |||
25 | static struct resource s3c_hsmmc_resource[] = { | ||
26 | [0] = { | ||
27 | .start = S3C_PA_HSMMC0, | ||
28 | .end = S3C_PA_HSMMC0 + S3C_SZ_HSMMC - 1, | ||
29 | .flags = IORESOURCE_MEM, | ||
30 | }, | ||
31 | [1] = { | ||
32 | .start = IRQ_HSMMC0, | ||
33 | .end = IRQ_HSMMC0, | ||
34 | .flags = IORESOURCE_IRQ, | ||
35 | } | ||
36 | }; | ||
37 | |||
38 | static u64 s3c_device_hsmmc_dmamask = 0xffffffffUL; | ||
39 | |||
40 | struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = { | ||
41 | .max_width = 4, | ||
42 | .host_caps = (MMC_CAP_4_BIT_DATA | | ||
43 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | ||
44 | .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL, | ||
45 | }; | ||
46 | |||
47 | struct platform_device s3c_device_hsmmc0 = { | ||
48 | .name = "s3c-sdhci", | ||
49 | .id = 0, | ||
50 | .num_resources = ARRAY_SIZE(s3c_hsmmc_resource), | ||
51 | .resource = s3c_hsmmc_resource, | ||
52 | .dev = { | ||
53 | .dma_mask = &s3c_device_hsmmc_dmamask, | ||
54 | .coherent_dma_mask = 0xffffffffUL, | ||
55 | .platform_data = &s3c_hsmmc0_def_platdata, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd) | ||
60 | { | ||
61 | struct s3c_sdhci_platdata *set = &s3c_hsmmc0_def_platdata; | ||
62 | |||
63 | set->cd_type = pd->cd_type; | ||
64 | set->ext_cd_init = pd->ext_cd_init; | ||
65 | set->ext_cd_cleanup = pd->ext_cd_cleanup; | ||
66 | set->ext_cd_gpio = pd->ext_cd_gpio; | ||
67 | set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert; | ||
68 | |||
69 | if (pd->max_width) | ||
70 | set->max_width = pd->max_width; | ||
71 | if (pd->cfg_gpio) | ||
72 | set->cfg_gpio = pd->cfg_gpio; | ||
73 | if (pd->cfg_card) | ||
74 | set->cfg_card = pd->cfg_card; | ||
75 | if (pd->host_caps) | ||
76 | set->host_caps |= pd->host_caps; | ||
77 | if (pd->clk_type) | ||
78 | set->clk_type = pd->clk_type; | ||
79 | } | ||
diff --git a/arch/arm/plat-samsung/dev-hsmmc1.c b/arch/arm/plat-samsung/dev-hsmmc1.c deleted file mode 100644 index 2497321f08d7..000000000000 --- a/arch/arm/plat-samsung/dev-hsmmc1.c +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dev-hsmmc1.c | ||
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C series device definition for hsmmc device 1 | ||
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/mmc/host.h> | ||
17 | |||
18 | #include <mach/map.h> | ||
19 | #include <plat/sdhci.h> | ||
20 | #include <plat/devs.h> | ||
21 | #include <plat/cpu.h> | ||
22 | |||
23 | #define S3C_SZ_HSMMC (0x1000) | ||
24 | |||
25 | static struct resource s3c_hsmmc1_resource[] = { | ||
26 | [0] = { | ||
27 | .start = S3C_PA_HSMMC1, | ||
28 | .end = S3C_PA_HSMMC1 + S3C_SZ_HSMMC - 1, | ||
29 | .flags = IORESOURCE_MEM, | ||
30 | }, | ||
31 | [1] = { | ||
32 | .start = IRQ_HSMMC1, | ||
33 | .end = IRQ_HSMMC1, | ||
34 | .flags = IORESOURCE_IRQ, | ||
35 | } | ||
36 | }; | ||
37 | |||
38 | static u64 s3c_device_hsmmc1_dmamask = 0xffffffffUL; | ||
39 | |||
40 | struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = { | ||
41 | .max_width = 4, | ||
42 | .host_caps = (MMC_CAP_4_BIT_DATA | | ||
43 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | ||
44 | .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL, | ||
45 | }; | ||
46 | |||
47 | struct platform_device s3c_device_hsmmc1 = { | ||
48 | .name = "s3c-sdhci", | ||
49 | .id = 1, | ||
50 | .num_resources = ARRAY_SIZE(s3c_hsmmc1_resource), | ||
51 | .resource = s3c_hsmmc1_resource, | ||
52 | .dev = { | ||
53 | .dma_mask = &s3c_device_hsmmc1_dmamask, | ||
54 | .coherent_dma_mask = 0xffffffffUL, | ||
55 | .platform_data = &s3c_hsmmc1_def_platdata, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd) | ||
60 | { | ||
61 | struct s3c_sdhci_platdata *set = &s3c_hsmmc1_def_platdata; | ||
62 | |||
63 | set->cd_type = pd->cd_type; | ||
64 | set->ext_cd_init = pd->ext_cd_init; | ||
65 | set->ext_cd_cleanup = pd->ext_cd_cleanup; | ||
66 | set->ext_cd_gpio = pd->ext_cd_gpio; | ||
67 | set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert; | ||
68 | |||
69 | if (pd->max_width) | ||
70 | set->max_width = pd->max_width; | ||
71 | if (pd->cfg_gpio) | ||
72 | set->cfg_gpio = pd->cfg_gpio; | ||
73 | if (pd->cfg_card) | ||
74 | set->cfg_card = pd->cfg_card; | ||
75 | if (pd->host_caps) | ||
76 | set->host_caps |= pd->host_caps; | ||
77 | if (pd->clk_type) | ||
78 | set->clk_type = pd->clk_type; | ||
79 | } | ||
diff --git a/arch/arm/plat-samsung/dev-hsmmc2.c b/arch/arm/plat-samsung/dev-hsmmc2.c deleted file mode 100644 index f60aedba417c..000000000000 --- a/arch/arm/plat-samsung/dev-hsmmc2.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dev-hsmmc2.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics | ||
4 | * Copyright (c) 2009 Maurus Cuelenaere | ||
5 | * | ||
6 | * Based on arch/arm/plat-s3c/dev-hsmmc1.c | ||
7 | * original file Copyright (c) 2008 Simtec Electronics | ||
8 | * | ||
9 | * S3C series device definition for hsmmc device 2 | ||
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 | #include <linux/mmc/host.h> | ||
19 | |||
20 | #include <mach/map.h> | ||
21 | #include <plat/sdhci.h> | ||
22 | #include <plat/devs.h> | ||
23 | |||
24 | #define S3C_SZ_HSMMC (0x1000) | ||
25 | |||
26 | static struct resource s3c_hsmmc2_resource[] = { | ||
27 | [0] = { | ||
28 | .start = S3C_PA_HSMMC2, | ||
29 | .end = S3C_PA_HSMMC2 + S3C_SZ_HSMMC - 1, | ||
30 | .flags = IORESOURCE_MEM, | ||
31 | }, | ||
32 | [1] = { | ||
33 | .start = IRQ_HSMMC2, | ||
34 | .end = IRQ_HSMMC2, | ||
35 | .flags = IORESOURCE_IRQ, | ||
36 | } | ||
37 | }; | ||
38 | |||
39 | static u64 s3c_device_hsmmc2_dmamask = 0xffffffffUL; | ||
40 | |||
41 | struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = { | ||
42 | .max_width = 4, | ||
43 | .host_caps = (MMC_CAP_4_BIT_DATA | | ||
44 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | ||
45 | .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL, | ||
46 | }; | ||
47 | |||
48 | struct platform_device s3c_device_hsmmc2 = { | ||
49 | .name = "s3c-sdhci", | ||
50 | .id = 2, | ||
51 | .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource), | ||
52 | .resource = s3c_hsmmc2_resource, | ||
53 | .dev = { | ||
54 | .dma_mask = &s3c_device_hsmmc2_dmamask, | ||
55 | .coherent_dma_mask = 0xffffffffUL, | ||
56 | .platform_data = &s3c_hsmmc2_def_platdata, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd) | ||
61 | { | ||
62 | struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata; | ||
63 | |||
64 | set->cd_type = pd->cd_type; | ||
65 | set->ext_cd_init = pd->ext_cd_init; | ||
66 | set->ext_cd_cleanup = pd->ext_cd_cleanup; | ||
67 | set->ext_cd_gpio = pd->ext_cd_gpio; | ||
68 | set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert; | ||
69 | |||
70 | if (pd->max_width) | ||
71 | set->max_width = pd->max_width; | ||
72 | if (pd->cfg_gpio) | ||
73 | set->cfg_gpio = pd->cfg_gpio; | ||
74 | if (pd->cfg_card) | ||
75 | set->cfg_card = pd->cfg_card; | ||
76 | if (pd->host_caps) | ||
77 | set->host_caps |= pd->host_caps; | ||
78 | if (pd->clk_type) | ||
79 | set->clk_type = pd->clk_type; | ||
80 | } | ||
diff --git a/arch/arm/plat-samsung/dev-hsmmc3.c b/arch/arm/plat-samsung/dev-hsmmc3.c deleted file mode 100644 index ede776f20e62..000000000000 --- a/arch/arm/plat-samsung/dev-hsmmc3.c +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-hsmmc3.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright (c) 2008 Simtec Electronics | ||
7 | * Ben Dooks <ben@simtec.co.uk> | ||
8 | * http://armlinux.simtec.co.uk/ | ||
9 | * | ||
10 | * Based on arch/arm/plat-samsung/dev-hsmmc1.c | ||
11 | * | ||
12 | * Samsung device definition for hsmmc device 3 | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | */ | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/mmc/host.h> | ||
22 | |||
23 | #include <mach/map.h> | ||
24 | #include <plat/sdhci.h> | ||
25 | #include <plat/devs.h> | ||
26 | |||
27 | #define S3C_SZ_HSMMC (0x1000) | ||
28 | |||
29 | static struct resource s3c_hsmmc3_resource[] = { | ||
30 | [0] = { | ||
31 | .start = S3C_PA_HSMMC3, | ||
32 | .end = S3C_PA_HSMMC3 + S3C_SZ_HSMMC - 1, | ||
33 | .flags = IORESOURCE_MEM, | ||
34 | }, | ||
35 | [1] = { | ||
36 | .start = IRQ_HSMMC3, | ||
37 | .end = IRQ_HSMMC3, | ||
38 | .flags = IORESOURCE_IRQ, | ||
39 | } | ||
40 | }; | ||
41 | |||
42 | static u64 s3c_device_hsmmc3_dmamask = 0xffffffffUL; | ||
43 | |||
44 | struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = { | ||
45 | .max_width = 4, | ||
46 | .host_caps = (MMC_CAP_4_BIT_DATA | | ||
47 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | ||
48 | .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL, | ||
49 | }; | ||
50 | |||
51 | struct platform_device s3c_device_hsmmc3 = { | ||
52 | .name = "s3c-sdhci", | ||
53 | .id = 3, | ||
54 | .num_resources = ARRAY_SIZE(s3c_hsmmc3_resource), | ||
55 | .resource = s3c_hsmmc3_resource, | ||
56 | .dev = { | ||
57 | .dma_mask = &s3c_device_hsmmc3_dmamask, | ||
58 | .coherent_dma_mask = 0xffffffffUL, | ||
59 | .platform_data = &s3c_hsmmc3_def_platdata, | ||
60 | }, | ||
61 | }; | ||
62 | |||
63 | void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd) | ||
64 | { | ||
65 | struct s3c_sdhci_platdata *set = &s3c_hsmmc3_def_platdata; | ||
66 | |||
67 | set->cd_type = pd->cd_type; | ||
68 | set->ext_cd_init = pd->ext_cd_init; | ||
69 | set->ext_cd_cleanup = pd->ext_cd_cleanup; | ||
70 | set->ext_cd_gpio = pd->ext_cd_gpio; | ||
71 | set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert; | ||
72 | |||
73 | if (pd->max_width) | ||
74 | set->max_width = pd->max_width; | ||
75 | if (pd->cfg_gpio) | ||
76 | set->cfg_gpio = pd->cfg_gpio; | ||
77 | if (pd->cfg_card) | ||
78 | set->cfg_card = pd->cfg_card; | ||
79 | if (pd->host_caps) | ||
80 | set->host_caps |= pd->host_caps; | ||
81 | if (pd->clk_type) | ||
82 | set->clk_type = pd->clk_type; | ||
83 | } | ||
diff --git a/arch/arm/plat-samsung/dev-hwmon.c b/arch/arm/plat-samsung/dev-hwmon.c deleted file mode 100644 index c91a79ce8f39..000000000000 --- a/arch/arm/plat-samsung/dev-hwmon.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
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 | s3c_set_platdata(pd, sizeof(struct s3c_hwmon_pdata), | ||
31 | &s3c_device_hwmon); | ||
32 | } | ||
diff --git a/arch/arm/plat-samsung/dev-i2c0.c b/arch/arm/plat-samsung/dev-i2c0.c deleted file mode 100644 index f8251f5098bd..000000000000 --- a/arch/arm/plat-samsung/dev-i2c0.c +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dev-i2c0.c | ||
2 | * | ||
3 | * Copyright 2008-2009 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C series device definition for i2c device 0 | ||
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/gfp.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | #include <mach/irqs.h> | ||
20 | #include <mach/map.h> | ||
21 | |||
22 | #include <plat/regs-iic.h> | ||
23 | #include <plat/iic.h> | ||
24 | #include <plat/devs.h> | ||
25 | #include <plat/cpu.h> | ||
26 | |||
27 | static struct resource s3c_i2c_resource[] = { | ||
28 | [0] = { | ||
29 | .start = S3C_PA_IIC, | ||
30 | .end = S3C_PA_IIC + SZ_4K - 1, | ||
31 | .flags = IORESOURCE_MEM, | ||
32 | }, | ||
33 | [1] = { | ||
34 | .start = IRQ_IIC, | ||
35 | .end = IRQ_IIC, | ||
36 | .flags = IORESOURCE_IRQ, | ||
37 | }, | ||
38 | }; | ||
39 | |||
40 | struct platform_device s3c_device_i2c0 = { | ||
41 | .name = "s3c2410-i2c", | ||
42 | #ifdef CONFIG_S3C_DEV_I2C1 | ||
43 | .id = 0, | ||
44 | #else | ||
45 | .id = -1, | ||
46 | #endif | ||
47 | .num_resources = ARRAY_SIZE(s3c_i2c_resource), | ||
48 | .resource = s3c_i2c_resource, | ||
49 | }; | ||
50 | |||
51 | struct s3c2410_platform_i2c default_i2c_data __initdata = { | ||
52 | .flags = 0, | ||
53 | .slave_addr = 0x10, | ||
54 | .frequency = 100*1000, | ||
55 | .sda_delay = 100, | ||
56 | }; | ||
57 | |||
58 | void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd) | ||
59 | { | ||
60 | struct s3c2410_platform_i2c *npd; | ||
61 | |||
62 | if (!pd) | ||
63 | pd = &default_i2c_data; | ||
64 | |||
65 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
66 | &s3c_device_i2c0); | ||
67 | |||
68 | if (!npd->cfg_gpio) | ||
69 | npd->cfg_gpio = s3c_i2c0_cfg_gpio; | ||
70 | } | ||
diff --git a/arch/arm/plat-samsung/dev-i2c1.c b/arch/arm/plat-samsung/dev-i2c1.c deleted file mode 100644 index 3b7c7bec1cf9..000000000000 --- a/arch/arm/plat-samsung/dev-i2c1.c +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dev-i2c1.c | ||
2 | * | ||
3 | * Copyright 2008-2009 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C series device definition for i2c device 1 | ||
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/gfp.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | #include <mach/irqs.h> | ||
20 | #include <mach/map.h> | ||
21 | |||
22 | #include <plat/regs-iic.h> | ||
23 | #include <plat/iic.h> | ||
24 | #include <plat/devs.h> | ||
25 | #include <plat/cpu.h> | ||
26 | |||
27 | static struct resource s3c_i2c_resource[] = { | ||
28 | [0] = { | ||
29 | .start = S3C_PA_IIC1, | ||
30 | .end = S3C_PA_IIC1 + SZ_4K - 1, | ||
31 | .flags = IORESOURCE_MEM, | ||
32 | }, | ||
33 | [1] = { | ||
34 | .start = IRQ_IIC1, | ||
35 | .end = IRQ_IIC1, | ||
36 | .flags = IORESOURCE_IRQ, | ||
37 | }, | ||
38 | }; | ||
39 | |||
40 | struct platform_device s3c_device_i2c1 = { | ||
41 | .name = "s3c2410-i2c", | ||
42 | .id = 1, | ||
43 | .num_resources = ARRAY_SIZE(s3c_i2c_resource), | ||
44 | .resource = s3c_i2c_resource, | ||
45 | }; | ||
46 | |||
47 | void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd) | ||
48 | { | ||
49 | struct s3c2410_platform_i2c *npd; | ||
50 | |||
51 | if (!pd) { | ||
52 | pd = &default_i2c_data; | ||
53 | pd->bus_num = 1; | ||
54 | } | ||
55 | |||
56 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
57 | &s3c_device_i2c1); | ||
58 | |||
59 | if (!npd->cfg_gpio) | ||
60 | npd->cfg_gpio = s3c_i2c1_cfg_gpio; | ||
61 | } | ||
diff --git a/arch/arm/plat-samsung/dev-i2c2.c b/arch/arm/plat-samsung/dev-i2c2.c deleted file mode 100644 index 07e9fd0b1b8b..000000000000 --- a/arch/arm/plat-samsung/dev-i2c2.c +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
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 | |||
28 | static 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_IIC2, | ||
36 | .end = IRQ_IIC2, | ||
37 | .flags = IORESOURCE_IRQ, | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | struct 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 | |||
48 | void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd) | ||
49 | { | ||
50 | struct s3c2410_platform_i2c *npd; | ||
51 | |||
52 | if (!pd) { | ||
53 | pd = &default_i2c_data; | ||
54 | pd->bus_num = 2; | ||
55 | } | ||
56 | |||
57 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
58 | &s3c_device_i2c2); | ||
59 | |||
60 | if (!npd->cfg_gpio) | ||
61 | npd->cfg_gpio = s3c_i2c2_cfg_gpio; | ||
62 | } | ||
diff --git a/arch/arm/plat-samsung/dev-i2c3.c b/arch/arm/plat-samsung/dev-i2c3.c deleted file mode 100644 index d48efa93c6e7..000000000000 --- a/arch/arm/plat-samsung/dev-i2c3.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-i2c3.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P series device definition for i2c device 3 | ||
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/gfp.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #include <mach/irqs.h> | ||
19 | #include <mach/map.h> | ||
20 | |||
21 | #include <plat/regs-iic.h> | ||
22 | #include <plat/iic.h> | ||
23 | #include <plat/devs.h> | ||
24 | #include <plat/cpu.h> | ||
25 | |||
26 | static struct resource s3c_i2c_resource[] = { | ||
27 | [0] = { | ||
28 | .start = S3C_PA_IIC3, | ||
29 | .end = S3C_PA_IIC3 + SZ_4K - 1, | ||
30 | .flags = IORESOURCE_MEM, | ||
31 | }, | ||
32 | [1] = { | ||
33 | .start = IRQ_IIC3, | ||
34 | .end = IRQ_IIC3, | ||
35 | .flags = IORESOURCE_IRQ, | ||
36 | }, | ||
37 | }; | ||
38 | |||
39 | struct platform_device s3c_device_i2c3 = { | ||
40 | .name = "s3c2440-i2c", | ||
41 | .id = 3, | ||
42 | .num_resources = ARRAY_SIZE(s3c_i2c_resource), | ||
43 | .resource = s3c_i2c_resource, | ||
44 | }; | ||
45 | |||
46 | void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd) | ||
47 | { | ||
48 | struct s3c2410_platform_i2c *npd; | ||
49 | |||
50 | if (!pd) { | ||
51 | pd = &default_i2c_data; | ||
52 | pd->bus_num = 3; | ||
53 | } | ||
54 | |||
55 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
56 | &s3c_device_i2c3); | ||
57 | |||
58 | if (!npd->cfg_gpio) | ||
59 | npd->cfg_gpio = s3c_i2c3_cfg_gpio; | ||
60 | } | ||
diff --git a/arch/arm/plat-samsung/dev-i2c4.c b/arch/arm/plat-samsung/dev-i2c4.c deleted file mode 100644 index 07e26444efe6..000000000000 --- a/arch/arm/plat-samsung/dev-i2c4.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-i2c4.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P series device definition for i2c device 3 | ||
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/gfp.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #include <mach/irqs.h> | ||
19 | #include <mach/map.h> | ||
20 | |||
21 | #include <plat/regs-iic.h> | ||
22 | #include <plat/iic.h> | ||
23 | #include <plat/devs.h> | ||
24 | #include <plat/cpu.h> | ||
25 | |||
26 | static struct resource s3c_i2c_resource[] = { | ||
27 | [0] = { | ||
28 | .start = S3C_PA_IIC4, | ||
29 | .end = S3C_PA_IIC4 + SZ_4K - 1, | ||
30 | .flags = IORESOURCE_MEM, | ||
31 | }, | ||
32 | [1] = { | ||
33 | .start = IRQ_IIC4, | ||
34 | .end = IRQ_IIC4, | ||
35 | .flags = IORESOURCE_IRQ, | ||
36 | }, | ||
37 | }; | ||
38 | |||
39 | struct platform_device s3c_device_i2c4 = { | ||
40 | .name = "s3c2440-i2c", | ||
41 | .id = 4, | ||
42 | .num_resources = ARRAY_SIZE(s3c_i2c_resource), | ||
43 | .resource = s3c_i2c_resource, | ||
44 | }; | ||
45 | |||
46 | void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd) | ||
47 | { | ||
48 | struct s3c2410_platform_i2c *npd; | ||
49 | |||
50 | if (!pd) { | ||
51 | pd = &default_i2c_data; | ||
52 | pd->bus_num = 4; | ||
53 | } | ||
54 | |||
55 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
56 | &s3c_device_i2c4); | ||
57 | |||
58 | if (!npd->cfg_gpio) | ||
59 | npd->cfg_gpio = s3c_i2c4_cfg_gpio; | ||
60 | } | ||
diff --git a/arch/arm/plat-samsung/dev-i2c5.c b/arch/arm/plat-samsung/dev-i2c5.c deleted file mode 100644 index f49655784563..000000000000 --- a/arch/arm/plat-samsung/dev-i2c5.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-i2c3.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P series device definition for i2c device 3 | ||
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/gfp.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #include <mach/irqs.h> | ||
19 | #include <mach/map.h> | ||
20 | |||
21 | #include <plat/regs-iic.h> | ||
22 | #include <plat/iic.h> | ||
23 | #include <plat/devs.h> | ||
24 | #include <plat/cpu.h> | ||
25 | |||
26 | static struct resource s3c_i2c_resource[] = { | ||
27 | [0] = { | ||
28 | .start = S3C_PA_IIC5, | ||
29 | .end = S3C_PA_IIC5 + SZ_4K - 1, | ||
30 | .flags = IORESOURCE_MEM, | ||
31 | }, | ||
32 | [1] = { | ||
33 | .start = IRQ_IIC5, | ||
34 | .end = IRQ_IIC5, | ||
35 | .flags = IORESOURCE_IRQ, | ||
36 | }, | ||
37 | }; | ||
38 | |||
39 | struct platform_device s3c_device_i2c5 = { | ||
40 | .name = "s3c2440-i2c", | ||
41 | .id = 5, | ||
42 | .num_resources = ARRAY_SIZE(s3c_i2c_resource), | ||
43 | .resource = s3c_i2c_resource, | ||
44 | }; | ||
45 | |||
46 | void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd) | ||
47 | { | ||
48 | struct s3c2410_platform_i2c *npd; | ||
49 | |||
50 | if (!pd) { | ||
51 | pd = &default_i2c_data; | ||
52 | pd->bus_num = 5; | ||
53 | } | ||
54 | |||
55 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
56 | &s3c_device_i2c5); | ||
57 | |||
58 | if (!npd->cfg_gpio) | ||
59 | npd->cfg_gpio = s3c_i2c5_cfg_gpio; | ||
60 | } | ||
diff --git a/arch/arm/plat-samsung/dev-i2c6.c b/arch/arm/plat-samsung/dev-i2c6.c deleted file mode 100644 index 141d799944e2..000000000000 --- a/arch/arm/plat-samsung/dev-i2c6.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-i2c6.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P series device definition for i2c device 6 | ||
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/gfp.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #include <mach/irqs.h> | ||
19 | #include <mach/map.h> | ||
20 | |||
21 | #include <plat/regs-iic.h> | ||
22 | #include <plat/iic.h> | ||
23 | #include <plat/devs.h> | ||
24 | #include <plat/cpu.h> | ||
25 | |||
26 | static struct resource s3c_i2c_resource[] = { | ||
27 | [0] = { | ||
28 | .start = S3C_PA_IIC6, | ||
29 | .end = S3C_PA_IIC6 + SZ_4K - 1, | ||
30 | .flags = IORESOURCE_MEM, | ||
31 | }, | ||
32 | [1] = { | ||
33 | .start = IRQ_IIC6, | ||
34 | .end = IRQ_IIC6, | ||
35 | .flags = IORESOURCE_IRQ, | ||
36 | }, | ||
37 | }; | ||
38 | |||
39 | struct platform_device s3c_device_i2c6 = { | ||
40 | .name = "s3c2440-i2c", | ||
41 | .id = 6, | ||
42 | .num_resources = ARRAY_SIZE(s3c_i2c_resource), | ||
43 | .resource = s3c_i2c_resource, | ||
44 | }; | ||
45 | |||
46 | void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd) | ||
47 | { | ||
48 | struct s3c2410_platform_i2c *npd; | ||
49 | |||
50 | if (!pd) { | ||
51 | pd = &default_i2c_data; | ||
52 | pd->bus_num = 6; | ||
53 | } | ||
54 | |||
55 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
56 | &s3c_device_i2c6); | ||
57 | |||
58 | if (!npd->cfg_gpio) | ||
59 | npd->cfg_gpio = s3c_i2c6_cfg_gpio; | ||
60 | } | ||
diff --git a/arch/arm/plat-samsung/dev-i2c7.c b/arch/arm/plat-samsung/dev-i2c7.c deleted file mode 100644 index 9dddcd1665b5..000000000000 --- a/arch/arm/plat-samsung/dev-i2c7.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-i2c7.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P series device definition for i2c device 7 | ||
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/gfp.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #include <mach/irqs.h> | ||
19 | #include <mach/map.h> | ||
20 | |||
21 | #include <plat/regs-iic.h> | ||
22 | #include <plat/iic.h> | ||
23 | #include <plat/devs.h> | ||
24 | #include <plat/cpu.h> | ||
25 | |||
26 | static struct resource s3c_i2c_resource[] = { | ||
27 | [0] = { | ||
28 | .start = S3C_PA_IIC7, | ||
29 | .end = S3C_PA_IIC7 + SZ_4K - 1, | ||
30 | .flags = IORESOURCE_MEM, | ||
31 | }, | ||
32 | [1] = { | ||
33 | .start = IRQ_IIC7, | ||
34 | .end = IRQ_IIC7, | ||
35 | .flags = IORESOURCE_IRQ, | ||
36 | }, | ||
37 | }; | ||
38 | |||
39 | struct platform_device s3c_device_i2c7 = { | ||
40 | .name = "s3c2440-i2c", | ||
41 | .id = 7, | ||
42 | .num_resources = ARRAY_SIZE(s3c_i2c_resource), | ||
43 | .resource = s3c_i2c_resource, | ||
44 | }; | ||
45 | |||
46 | void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd) | ||
47 | { | ||
48 | struct s3c2410_platform_i2c *npd; | ||
49 | |||
50 | if (!pd) { | ||
51 | pd = &default_i2c_data; | ||
52 | pd->bus_num = 7; | ||
53 | } | ||
54 | |||
55 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
56 | &s3c_device_i2c7); | ||
57 | |||
58 | if (!npd->cfg_gpio) | ||
59 | npd->cfg_gpio = s3c_i2c7_cfg_gpio; | ||
60 | } | ||
diff --git a/arch/arm/plat-samsung/dev-ide.c b/arch/arm/plat-samsung/dev-ide.c deleted file mode 100644 index b497982795a7..000000000000 --- a/arch/arm/plat-samsung/dev-ide.c +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-ide.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Samsung CF-ATA device definition. | ||
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/interrupt.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #include <mach/map.h> | ||
18 | #include <plat/ata.h> | ||
19 | #include <plat/devs.h> | ||
20 | |||
21 | static struct resource s3c_cfcon_resource[] = { | ||
22 | [0] = { | ||
23 | .start = SAMSUNG_PA_CFCON, | ||
24 | .end = SAMSUNG_PA_CFCON + SZ_16K - 1, | ||
25 | .flags = IORESOURCE_MEM, | ||
26 | }, | ||
27 | [1] = { | ||
28 | .start = IRQ_CFCON, | ||
29 | .end = IRQ_CFCON, | ||
30 | .flags = IORESOURCE_IRQ, | ||
31 | }, | ||
32 | }; | ||
33 | |||
34 | struct platform_device s3c_device_cfcon = { | ||
35 | .id = 0, | ||
36 | .num_resources = ARRAY_SIZE(s3c_cfcon_resource), | ||
37 | .resource = s3c_cfcon_resource, | ||
38 | }; | ||
39 | |||
40 | void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata) | ||
41 | { | ||
42 | s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata), | ||
43 | &s3c_device_cfcon); | ||
44 | } | ||
diff --git a/arch/arm/plat-samsung/dev-keypad.c b/arch/arm/plat-samsung/dev-keypad.c deleted file mode 100644 index 677c2d731b65..000000000000 --- a/arch/arm/plat-samsung/dev-keypad.c +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-samsung/dev-keypad.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Samsung Electronics Co.Ltd | ||
5 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/platform_device.h> | ||
15 | #include <mach/irqs.h> | ||
16 | #include <mach/map.h> | ||
17 | #include <plat/cpu.h> | ||
18 | #include <plat/devs.h> | ||
19 | #include <plat/keypad.h> | ||
20 | |||
21 | static struct resource samsung_keypad_resources[] = { | ||
22 | [0] = { | ||
23 | .start = SAMSUNG_PA_KEYPAD, | ||
24 | .end = SAMSUNG_PA_KEYPAD + 0x20 - 1, | ||
25 | .flags = IORESOURCE_MEM, | ||
26 | }, | ||
27 | [1] = { | ||
28 | .start = IRQ_KEYPAD, | ||
29 | .end = IRQ_KEYPAD, | ||
30 | .flags = IORESOURCE_IRQ, | ||
31 | }, | ||
32 | }; | ||
33 | |||
34 | struct platform_device samsung_device_keypad = { | ||
35 | .name = "samsung-keypad", | ||
36 | .id = -1, | ||
37 | .num_resources = ARRAY_SIZE(samsung_keypad_resources), | ||
38 | .resource = samsung_keypad_resources, | ||
39 | }; | ||
40 | |||
41 | void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd) | ||
42 | { | ||
43 | struct samsung_keypad_platdata *npd; | ||
44 | |||
45 | npd = s3c_set_platdata(pd, sizeof(struct samsung_keypad_platdata), | ||
46 | &samsung_device_keypad); | ||
47 | |||
48 | if (!npd->cfg_gpio) | ||
49 | npd->cfg_gpio = samsung_keypad_cfg_gpio; | ||
50 | } | ||
diff --git a/arch/arm/plat-samsung/dev-nand.c b/arch/arm/plat-samsung/dev-nand.c deleted file mode 100644 index b8e30ec6ac26..000000000000 --- a/arch/arm/plat-samsung/dev-nand.c +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | /* | ||
2 | * S3C series device definition for nand device | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include <linux/gfp.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/platform_device.h> | ||
12 | |||
13 | #include <linux/mtd/mtd.h> | ||
14 | #include <linux/mtd/partitions.h> | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | #include <plat/devs.h> | ||
18 | #include <plat/nand.h> | ||
19 | |||
20 | static struct resource s3c_nand_resource[] = { | ||
21 | [0] = { | ||
22 | .start = S3C_PA_NAND, | ||
23 | .end = S3C_PA_NAND + SZ_1M, | ||
24 | .flags = IORESOURCE_MEM, | ||
25 | } | ||
26 | }; | ||
27 | |||
28 | struct platform_device s3c_device_nand = { | ||
29 | .name = "s3c2410-nand", | ||
30 | .id = -1, | ||
31 | .num_resources = ARRAY_SIZE(s3c_nand_resource), | ||
32 | .resource = s3c_nand_resource, | ||
33 | }; | ||
34 | |||
35 | EXPORT_SYMBOL(s3c_device_nand); | ||
36 | |||
37 | /** | ||
38 | * s3c_nand_copy_set() - copy nand set data | ||
39 | * @set: The new structure, directly copied from the old. | ||
40 | * | ||
41 | * Copy all the fields from the NAND set field from what is probably __initdata | ||
42 | * to new kernel memory. The code returns 0 if the copy happened correctly or | ||
43 | * an error code for the calling function to display. | ||
44 | * | ||
45 | * Note, we currently do not try and look to see if we've already copied the | ||
46 | * data in a previous set. | ||
47 | */ | ||
48 | static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set) | ||
49 | { | ||
50 | void *ptr; | ||
51 | int size; | ||
52 | |||
53 | size = sizeof(struct mtd_partition) * set->nr_partitions; | ||
54 | if (size) { | ||
55 | ptr = kmemdup(set->partitions, size, GFP_KERNEL); | ||
56 | set->partitions = ptr; | ||
57 | |||
58 | if (!ptr) | ||
59 | return -ENOMEM; | ||
60 | } | ||
61 | |||
62 | if (set->nr_map && set->nr_chips) { | ||
63 | size = sizeof(int) * set->nr_chips; | ||
64 | ptr = kmemdup(set->nr_map, size, GFP_KERNEL); | ||
65 | set->nr_map = ptr; | ||
66 | |||
67 | if (!ptr) | ||
68 | return -ENOMEM; | ||
69 | } | ||
70 | |||
71 | if (set->ecc_layout) { | ||
72 | ptr = kmemdup(set->ecc_layout, | ||
73 | sizeof(struct nand_ecclayout), GFP_KERNEL); | ||
74 | set->ecc_layout = ptr; | ||
75 | |||
76 | if (!ptr) | ||
77 | return -ENOMEM; | ||
78 | } | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand) | ||
84 | { | ||
85 | struct s3c2410_platform_nand *npd; | ||
86 | int size; | ||
87 | int ret; | ||
88 | |||
89 | /* note, if we get a failure in allocation, we simply drop out of the | ||
90 | * function. If there is so little memory available at initialisation | ||
91 | * time then there is little chance the system is going to run. | ||
92 | */ | ||
93 | |||
94 | npd = s3c_set_platdata(nand, sizeof(struct s3c2410_platform_nand), | ||
95 | &s3c_device_nand); | ||
96 | if (!npd) | ||
97 | return; | ||
98 | |||
99 | /* now see if we need to copy any of the nand set data */ | ||
100 | |||
101 | size = sizeof(struct s3c2410_nand_set) * npd->nr_sets; | ||
102 | if (size) { | ||
103 | struct s3c2410_nand_set *from = npd->sets; | ||
104 | struct s3c2410_nand_set *to; | ||
105 | int i; | ||
106 | |||
107 | to = kmemdup(from, size, GFP_KERNEL); | ||
108 | npd->sets = to; /* set, even if we failed */ | ||
109 | |||
110 | if (!to) { | ||
111 | printk(KERN_ERR "%s: no memory for sets\n", __func__); | ||
112 | return; | ||
113 | } | ||
114 | |||
115 | for (i = 0; i < npd->nr_sets; i++) { | ||
116 | ret = s3c_nand_copy_set(to); | ||
117 | if (ret) { | ||
118 | printk(KERN_ERR "%s: failed to copy set %d\n", | ||
119 | __func__, i); | ||
120 | return; | ||
121 | } | ||
122 | to++; | ||
123 | } | ||
124 | } | ||
125 | } | ||
diff --git a/arch/arm/plat-samsung/dev-onenand.c b/arch/arm/plat-samsung/dev-onenand.c deleted file mode 100644 index f54ae71f0cd2..000000000000 --- a/arch/arm/plat-samsung/dev-onenand.c +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
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 | |||
17 | #include <mach/irqs.h> | ||
18 | #include <mach/map.h> | ||
19 | |||
20 | static struct resource s3c_onenand_resources[] = { | ||
21 | [0] = { | ||
22 | .start = S3C_PA_ONENAND, | ||
23 | .end = S3C_PA_ONENAND + 0x400 - 1, | ||
24 | .flags = IORESOURCE_MEM, | ||
25 | }, | ||
26 | [1] = { | ||
27 | .start = S3C_PA_ONENAND_BUF, | ||
28 | .end = S3C_PA_ONENAND_BUF + S3C_SZ_ONENAND_BUF - 1, | ||
29 | .flags = IORESOURCE_MEM, | ||
30 | }, | ||
31 | [2] = { | ||
32 | .start = IRQ_ONENAND, | ||
33 | .end = IRQ_ONENAND, | ||
34 | .flags = IORESOURCE_IRQ, | ||
35 | }, | ||
36 | }; | ||
37 | |||
38 | struct platform_device s3c_device_onenand = { | ||
39 | .name = "samsung-onenand", | ||
40 | .id = 0, | ||
41 | .num_resources = ARRAY_SIZE(s3c_onenand_resources), | ||
42 | .resource = s3c_onenand_resources, | ||
43 | }; | ||
diff --git a/arch/arm/plat-samsung/dev-pwm.c b/arch/arm/plat-samsung/dev-pwm.c deleted file mode 100644 index dab47b0e1900..000000000000 --- a/arch/arm/plat-samsung/dev-pwm.c +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-pwm.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright (c) 2007 Ben Dooks | ||
7 | * Copyright (c) 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org> | ||
9 | * | ||
10 | * S3C series device definition for the PWM timer | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | |||
20 | #include <mach/irqs.h> | ||
21 | |||
22 | #include <plat/devs.h> | ||
23 | |||
24 | #define TIMER_RESOURCE_SIZE (1) | ||
25 | |||
26 | #define TIMER_RESOURCE(_tmr, _irq) \ | ||
27 | (struct resource [TIMER_RESOURCE_SIZE]) { \ | ||
28 | [0] = { \ | ||
29 | .start = _irq, \ | ||
30 | .end = _irq, \ | ||
31 | .flags = IORESOURCE_IRQ \ | ||
32 | } \ | ||
33 | } | ||
34 | |||
35 | #define DEFINE_S3C_TIMER(_tmr_no, _irq) \ | ||
36 | .name = "s3c24xx-pwm", \ | ||
37 | .id = _tmr_no, \ | ||
38 | .num_resources = TIMER_RESOURCE_SIZE, \ | ||
39 | .resource = TIMER_RESOURCE(_tmr_no, _irq), \ | ||
40 | |||
41 | /* | ||
42 | * since we already have an static mapping for the timer, | ||
43 | * we do not bother setting any IO resource for the base. | ||
44 | */ | ||
45 | |||
46 | struct platform_device s3c_device_timer[] = { | ||
47 | [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) }, | ||
48 | [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) }, | ||
49 | [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) }, | ||
50 | [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) }, | ||
51 | [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) }, | ||
52 | }; | ||
53 | EXPORT_SYMBOL(s3c_device_timer); | ||
diff --git a/arch/arm/plat-samsung/dev-rtc.c b/arch/arm/plat-samsung/dev-rtc.c deleted file mode 100644 index bf4e2267333c..000000000000 --- a/arch/arm/plat-samsung/dev-rtc.c +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-rtc.c | ||
2 | * | ||
3 | * Copyright 2009 by Maurus Cuelenaere <mcuelenaere@gmail.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/string.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | |||
14 | #include <mach/irqs.h> | ||
15 | #include <mach/map.h> | ||
16 | |||
17 | #include <plat/devs.h> | ||
18 | |||
19 | static struct resource s3c_rtc_resource[] = { | ||
20 | [0] = { | ||
21 | .start = S3C_PA_RTC, | ||
22 | .end = S3C_PA_RTC + 0xff, | ||
23 | .flags = IORESOURCE_MEM, | ||
24 | }, | ||
25 | [1] = { | ||
26 | .start = IRQ_RTC_ALARM, | ||
27 | .end = IRQ_RTC_ALARM, | ||
28 | .flags = IORESOURCE_IRQ, | ||
29 | }, | ||
30 | [2] = { | ||
31 | .start = IRQ_RTC_TIC, | ||
32 | .end = IRQ_RTC_TIC, | ||
33 | .flags = IORESOURCE_IRQ | ||
34 | } | ||
35 | }; | ||
36 | |||
37 | struct platform_device s3c_device_rtc = { | ||
38 | .name = "s3c64xx-rtc", | ||
39 | .id = -1, | ||
40 | .num_resources = ARRAY_SIZE(s3c_rtc_resource), | ||
41 | .resource = s3c_rtc_resource, | ||
42 | }; | ||
43 | EXPORT_SYMBOL(s3c_device_rtc); | ||
diff --git a/arch/arm/plat-samsung/dev-ts.c b/arch/arm/plat-samsung/dev-ts.c deleted file mode 100644 index 82543f0248ac..000000000000 --- a/arch/arm/plat-samsung/dev-ts.c +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s3c64xx/dev-ts.c | ||
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org> | ||
6 | * | ||
7 | * Adapted by Maurus Cuelenaere for s3c64xx | ||
8 | * | ||
9 | * S3C64XX series device definition for touchscreen device | ||
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/string.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | |||
20 | #include <mach/irqs.h> | ||
21 | #include <mach/map.h> | ||
22 | |||
23 | #include <plat/devs.h> | ||
24 | #include <plat/ts.h> | ||
25 | |||
26 | static struct resource s3c_ts_resource[] = { | ||
27 | [0] = { | ||
28 | .start = SAMSUNG_PA_ADC, | ||
29 | .end = SAMSUNG_PA_ADC + SZ_256 - 1, | ||
30 | .flags = IORESOURCE_MEM, | ||
31 | }, | ||
32 | [1] = { | ||
33 | .start = IRQ_TC, | ||
34 | .end = IRQ_TC, | ||
35 | .flags = IORESOURCE_IRQ, | ||
36 | }, | ||
37 | }; | ||
38 | |||
39 | struct platform_device s3c_device_ts = { | ||
40 | .name = "s3c64xx-ts", | ||
41 | .id = -1, | ||
42 | .num_resources = ARRAY_SIZE(s3c_ts_resource), | ||
43 | .resource = s3c_ts_resource, | ||
44 | }; | ||
45 | |||
46 | void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd) | ||
47 | { | ||
48 | s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info), | ||
49 | &s3c_device_ts); | ||
50 | } | ||
diff --git a/arch/arm/plat-samsung/dev-usb-hsotg.c b/arch/arm/plat-samsung/dev-usb-hsotg.c deleted file mode 100644 index 33a844ab6917..000000000000 --- a/arch/arm/plat-samsung/dev-usb-hsotg.c +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dev-usb-hsotg.c | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C series device definition for USB high-speed UDC/OtG block | ||
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/string.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/dma-mapping.h> | ||
18 | |||
19 | #include <mach/irqs.h> | ||
20 | #include <mach/map.h> | ||
21 | |||
22 | #include <plat/devs.h> | ||
23 | |||
24 | static struct resource s3c_usb_hsotg_resources[] = { | ||
25 | [0] = { | ||
26 | .start = S3C_PA_USB_HSOTG, | ||
27 | .end = S3C_PA_USB_HSOTG + 0x10000 - 1, | ||
28 | .flags = IORESOURCE_MEM, | ||
29 | }, | ||
30 | [1] = { | ||
31 | .start = IRQ_OTG, | ||
32 | .end = IRQ_OTG, | ||
33 | .flags = IORESOURCE_IRQ, | ||
34 | }, | ||
35 | }; | ||
36 | |||
37 | static u64 s3c_hsotg_dmamask = DMA_BIT_MASK(32); | ||
38 | |||
39 | struct platform_device s3c_device_usb_hsotg = { | ||
40 | .name = "s3c-hsotg", | ||
41 | .id = -1, | ||
42 | .num_resources = ARRAY_SIZE(s3c_usb_hsotg_resources), | ||
43 | .resource = s3c_usb_hsotg_resources, | ||
44 | .dev = { | ||
45 | .dma_mask = &s3c_hsotg_dmamask, | ||
46 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
47 | }, | ||
48 | }; | ||
diff --git a/arch/arm/plat-samsung/dev-usb.c b/arch/arm/plat-samsung/dev-usb.c deleted file mode 100644 index 33fbaa967700..000000000000 --- a/arch/arm/plat-samsung/dev-usb.c +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dev-usb.c | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C series device definition for USB host | ||
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/gfp.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | #include <mach/irqs.h> | ||
20 | #include <mach/map.h> | ||
21 | |||
22 | #include <plat/devs.h> | ||
23 | #include <plat/usb-control.h> | ||
24 | |||
25 | static struct resource s3c_usb_resource[] = { | ||
26 | [0] = { | ||
27 | .start = S3C_PA_USBHOST, | ||
28 | .end = S3C_PA_USBHOST + 0x100 - 1, | ||
29 | .flags = IORESOURCE_MEM, | ||
30 | }, | ||
31 | [1] = { | ||
32 | .start = IRQ_USBH, | ||
33 | .end = IRQ_USBH, | ||
34 | .flags = IORESOURCE_IRQ, | ||
35 | } | ||
36 | }; | ||
37 | |||
38 | static u64 s3c_device_usb_dmamask = 0xffffffffUL; | ||
39 | |||
40 | struct platform_device s3c_device_ohci = { | ||
41 | .name = "s3c2410-ohci", | ||
42 | .id = -1, | ||
43 | .num_resources = ARRAY_SIZE(s3c_usb_resource), | ||
44 | .resource = s3c_usb_resource, | ||
45 | .dev = { | ||
46 | .dma_mask = &s3c_device_usb_dmamask, | ||
47 | .coherent_dma_mask = 0xffffffffUL | ||
48 | } | ||
49 | }; | ||
50 | |||
51 | EXPORT_SYMBOL(s3c_device_ohci); | ||
52 | |||
53 | /** | ||
54 | * s3c_ohci_set_platdata - initialise OHCI device platform data | ||
55 | * @info: The platform data. | ||
56 | * | ||
57 | * This call copies the @info passed in and sets the device .platform_data | ||
58 | * field to that copy. The @info is copied so that the original can be marked | ||
59 | * __initdata. | ||
60 | */ | ||
61 | void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info) | ||
62 | { | ||
63 | s3c_set_platdata(info, sizeof(struct s3c2410_hcd_info), | ||
64 | &s3c_device_ohci); | ||
65 | } | ||
diff --git a/arch/arm/plat-samsung/dev-wdt.c b/arch/arm/plat-samsung/dev-wdt.c deleted file mode 100644 index 019b5b8cf14c..000000000000 --- a/arch/arm/plat-samsung/dev-wdt.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
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 | |||
21 | static struct resource s3c_wdt_resource[] = { | ||
22 | [0] = { | ||
23 | .start = S3C_PA_WDT, | ||
24 | .end = S3C_PA_WDT + SZ_1K, | ||
25 | .flags = IORESOURCE_MEM, | ||
26 | }, | ||
27 | [1] = { | ||
28 | .start = IRQ_WDT, | ||
29 | .end = IRQ_WDT, | ||
30 | .flags = IORESOURCE_IRQ, | ||
31 | } | ||
32 | }; | ||
33 | |||
34 | struct 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 | }; | ||
40 | EXPORT_SYMBOL(s3c_device_wdt); | ||
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c new file mode 100644 index 000000000000..4ca8b571f971 --- /dev/null +++ b/arch/arm/plat-samsung/devs.c | |||
@@ -0,0 +1,1463 @@ | |||
1 | /* linux/arch/arm/plat-samsung/devs.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Base SAMSUNG platform device definitions | ||
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/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/serial_core.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <linux/dma-mapping.h> | ||
25 | #include <linux/fb.h> | ||
26 | #include <linux/gfp.h> | ||
27 | #include <linux/mtd/mtd.h> | ||
28 | #include <linux/mtd/onenand.h> | ||
29 | #include <linux/mtd/partitions.h> | ||
30 | #include <linux/mmc/host.h> | ||
31 | #include <linux/ioport.h> | ||
32 | |||
33 | #include <asm/irq.h> | ||
34 | #include <asm/pmu.h> | ||
35 | #include <asm/mach/arch.h> | ||
36 | #include <asm/mach/map.h> | ||
37 | #include <asm/mach/irq.h> | ||
38 | |||
39 | #include <mach/hardware.h> | ||
40 | #include <mach/dma.h> | ||
41 | #include <mach/irqs.h> | ||
42 | #include <mach/map.h> | ||
43 | |||
44 | #include <plat/cpu.h> | ||
45 | #include <plat/devs.h> | ||
46 | #include <plat/adc.h> | ||
47 | #include <plat/ata.h> | ||
48 | #include <plat/ehci.h> | ||
49 | #include <plat/fb.h> | ||
50 | #include <plat/fb-s3c2410.h> | ||
51 | #include <plat/hwmon.h> | ||
52 | #include <plat/iic.h> | ||
53 | #include <plat/keypad.h> | ||
54 | #include <plat/mci.h> | ||
55 | #include <plat/nand.h> | ||
56 | #include <plat/sdhci.h> | ||
57 | #include <plat/ts.h> | ||
58 | #include <plat/udc.h> | ||
59 | #include <plat/usb-control.h> | ||
60 | #include <plat/usb-phy.h> | ||
61 | #include <plat/regs-iic.h> | ||
62 | #include <plat/regs-serial.h> | ||
63 | #include <plat/regs-spi.h> | ||
64 | |||
65 | static u64 samsung_device_dma_mask = DMA_BIT_MASK(32); | ||
66 | |||
67 | /* AC97 */ | ||
68 | #ifdef CONFIG_CPU_S3C2440 | ||
69 | static struct resource s3c_ac97_resource[] = { | ||
70 | [0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97), | ||
71 | [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97), | ||
72 | [2] = DEFINE_RES_DMA_NAMED(DMACH_PCM_OUT, "PCM out"), | ||
73 | [3] = DEFINE_RES_DMA_NAMED(DMACH_PCM_IN, "PCM in"), | ||
74 | [4] = DEFINE_RES_DMA_NAMED(DMACH_MIC_IN, "Mic in"), | ||
75 | }; | ||
76 | |||
77 | struct platform_device s3c_device_ac97 = { | ||
78 | .name = "samsung-ac97", | ||
79 | .id = -1, | ||
80 | .num_resources = ARRAY_SIZE(s3c_ac97_resource), | ||
81 | .resource = s3c_ac97_resource, | ||
82 | .dev = { | ||
83 | .dma_mask = &samsung_device_dma_mask, | ||
84 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
85 | } | ||
86 | }; | ||
87 | #endif /* CONFIG_CPU_S3C2440 */ | ||
88 | |||
89 | /* ADC */ | ||
90 | |||
91 | #ifdef CONFIG_PLAT_S3C24XX | ||
92 | static struct resource s3c_adc_resource[] = { | ||
93 | [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC), | ||
94 | [1] = DEFINE_RES_IRQ(IRQ_TC), | ||
95 | [2] = DEFINE_RES_IRQ(IRQ_ADC), | ||
96 | }; | ||
97 | |||
98 | struct platform_device s3c_device_adc = { | ||
99 | .name = "s3c24xx-adc", | ||
100 | .id = -1, | ||
101 | .num_resources = ARRAY_SIZE(s3c_adc_resource), | ||
102 | .resource = s3c_adc_resource, | ||
103 | }; | ||
104 | #endif /* CONFIG_PLAT_S3C24XX */ | ||
105 | |||
106 | #if defined(CONFIG_SAMSUNG_DEV_ADC) | ||
107 | static struct resource s3c_adc_resource[] = { | ||
108 | [0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256), | ||
109 | [1] = DEFINE_RES_IRQ(IRQ_TC), | ||
110 | [2] = DEFINE_RES_IRQ(IRQ_ADC), | ||
111 | }; | ||
112 | |||
113 | struct platform_device s3c_device_adc = { | ||
114 | .name = "samsung-adc", | ||
115 | .id = -1, | ||
116 | .num_resources = ARRAY_SIZE(s3c_adc_resource), | ||
117 | .resource = s3c_adc_resource, | ||
118 | }; | ||
119 | #endif /* CONFIG_SAMSUNG_DEV_ADC */ | ||
120 | |||
121 | /* Camif Controller */ | ||
122 | |||
123 | #ifdef CONFIG_CPU_S3C2440 | ||
124 | static struct resource s3c_camif_resource[] = { | ||
125 | [0] = DEFINE_RES_MEM(S3C2440_PA_CAMIF, S3C2440_SZ_CAMIF), | ||
126 | [1] = DEFINE_RES_IRQ(IRQ_CAM), | ||
127 | }; | ||
128 | |||
129 | struct platform_device s3c_device_camif = { | ||
130 | .name = "s3c2440-camif", | ||
131 | .id = -1, | ||
132 | .num_resources = ARRAY_SIZE(s3c_camif_resource), | ||
133 | .resource = s3c_camif_resource, | ||
134 | .dev = { | ||
135 | .dma_mask = &samsung_device_dma_mask, | ||
136 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
137 | } | ||
138 | }; | ||
139 | #endif /* CONFIG_CPU_S3C2440 */ | ||
140 | |||
141 | /* ASOC DMA */ | ||
142 | |||
143 | struct platform_device samsung_asoc_dma = { | ||
144 | .name = "samsung-audio", | ||
145 | .id = -1, | ||
146 | .dev = { | ||
147 | .dma_mask = &samsung_device_dma_mask, | ||
148 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
149 | } | ||
150 | }; | ||
151 | |||
152 | struct platform_device samsung_asoc_idma = { | ||
153 | .name = "samsung-idma", | ||
154 | .id = -1, | ||
155 | .dev = { | ||
156 | .dma_mask = &samsung_device_dma_mask, | ||
157 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
158 | } | ||
159 | }; | ||
160 | |||
161 | /* FB */ | ||
162 | |||
163 | #ifdef CONFIG_S3C_DEV_FB | ||
164 | static struct resource s3c_fb_resource[] = { | ||
165 | [0] = DEFINE_RES_MEM(S3C_PA_FB, SZ_16K), | ||
166 | [1] = DEFINE_RES_IRQ(IRQ_LCD_VSYNC), | ||
167 | [2] = DEFINE_RES_IRQ(IRQ_LCD_FIFO), | ||
168 | [3] = DEFINE_RES_IRQ(IRQ_LCD_SYSTEM), | ||
169 | }; | ||
170 | |||
171 | struct platform_device s3c_device_fb = { | ||
172 | .name = "s3c-fb", | ||
173 | .id = -1, | ||
174 | .num_resources = ARRAY_SIZE(s3c_fb_resource), | ||
175 | .resource = s3c_fb_resource, | ||
176 | .dev = { | ||
177 | .dma_mask = &samsung_device_dma_mask, | ||
178 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
179 | }, | ||
180 | }; | ||
181 | |||
182 | void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd) | ||
183 | { | ||
184 | s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata), | ||
185 | &s3c_device_fb); | ||
186 | } | ||
187 | #endif /* CONFIG_S3C_DEV_FB */ | ||
188 | |||
189 | /* FIMC */ | ||
190 | |||
191 | #ifdef CONFIG_S5P_DEV_FIMC0 | ||
192 | static struct resource s5p_fimc0_resource[] = { | ||
193 | [0] = DEFINE_RES_MEM(S5P_PA_FIMC0, SZ_4K), | ||
194 | [1] = DEFINE_RES_IRQ(IRQ_FIMC0), | ||
195 | }; | ||
196 | |||
197 | struct platform_device s5p_device_fimc0 = { | ||
198 | .name = "s5p-fimc", | ||
199 | .id = 0, | ||
200 | .num_resources = ARRAY_SIZE(s5p_fimc0_resource), | ||
201 | .resource = s5p_fimc0_resource, | ||
202 | .dev = { | ||
203 | .dma_mask = &samsung_device_dma_mask, | ||
204 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
205 | }, | ||
206 | }; | ||
207 | |||
208 | struct platform_device s5p_device_fimc_md = { | ||
209 | .name = "s5p-fimc-md", | ||
210 | .id = -1, | ||
211 | }; | ||
212 | #endif /* CONFIG_S5P_DEV_FIMC0 */ | ||
213 | |||
214 | #ifdef CONFIG_S5P_DEV_FIMC1 | ||
215 | static struct resource s5p_fimc1_resource[] = { | ||
216 | [0] = DEFINE_RES_MEM(S5P_PA_FIMC1, SZ_4K), | ||
217 | [1] = DEFINE_RES_IRQ(IRQ_FIMC1), | ||
218 | }; | ||
219 | |||
220 | struct platform_device s5p_device_fimc1 = { | ||
221 | .name = "s5p-fimc", | ||
222 | .id = 1, | ||
223 | .num_resources = ARRAY_SIZE(s5p_fimc1_resource), | ||
224 | .resource = s5p_fimc1_resource, | ||
225 | .dev = { | ||
226 | .dma_mask = &samsung_device_dma_mask, | ||
227 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
228 | }, | ||
229 | }; | ||
230 | #endif /* CONFIG_S5P_DEV_FIMC1 */ | ||
231 | |||
232 | #ifdef CONFIG_S5P_DEV_FIMC2 | ||
233 | static struct resource s5p_fimc2_resource[] = { | ||
234 | [0] = DEFINE_RES_MEM(S5P_PA_FIMC2, SZ_4K), | ||
235 | [1] = DEFINE_RES_IRQ(IRQ_FIMC2), | ||
236 | }; | ||
237 | |||
238 | struct platform_device s5p_device_fimc2 = { | ||
239 | .name = "s5p-fimc", | ||
240 | .id = 2, | ||
241 | .num_resources = ARRAY_SIZE(s5p_fimc2_resource), | ||
242 | .resource = s5p_fimc2_resource, | ||
243 | .dev = { | ||
244 | .dma_mask = &samsung_device_dma_mask, | ||
245 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
246 | }, | ||
247 | }; | ||
248 | #endif /* CONFIG_S5P_DEV_FIMC2 */ | ||
249 | |||
250 | #ifdef CONFIG_S5P_DEV_FIMC3 | ||
251 | static struct resource s5p_fimc3_resource[] = { | ||
252 | [0] = DEFINE_RES_MEM(S5P_PA_FIMC3, SZ_4K), | ||
253 | [1] = DEFINE_RES_IRQ(IRQ_FIMC3), | ||
254 | }; | ||
255 | |||
256 | struct platform_device s5p_device_fimc3 = { | ||
257 | .name = "s5p-fimc", | ||
258 | .id = 3, | ||
259 | .num_resources = ARRAY_SIZE(s5p_fimc3_resource), | ||
260 | .resource = s5p_fimc3_resource, | ||
261 | .dev = { | ||
262 | .dma_mask = &samsung_device_dma_mask, | ||
263 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
264 | }, | ||
265 | }; | ||
266 | #endif /* CONFIG_S5P_DEV_FIMC3 */ | ||
267 | |||
268 | /* FIMD0 */ | ||
269 | |||
270 | #ifdef CONFIG_S5P_DEV_FIMD0 | ||
271 | static struct resource s5p_fimd0_resource[] = { | ||
272 | [0] = DEFINE_RES_MEM(S5P_PA_FIMD0, SZ_32K), | ||
273 | [1] = DEFINE_RES_IRQ(IRQ_FIMD0_VSYNC), | ||
274 | [2] = DEFINE_RES_IRQ(IRQ_FIMD0_FIFO), | ||
275 | [3] = DEFINE_RES_IRQ(IRQ_FIMD0_SYSTEM), | ||
276 | }; | ||
277 | |||
278 | struct platform_device s5p_device_fimd0 = { | ||
279 | .name = "s5p-fb", | ||
280 | .id = 0, | ||
281 | .num_resources = ARRAY_SIZE(s5p_fimd0_resource), | ||
282 | .resource = s5p_fimd0_resource, | ||
283 | .dev = { | ||
284 | .dma_mask = &samsung_device_dma_mask, | ||
285 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
286 | }, | ||
287 | }; | ||
288 | |||
289 | void __init s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd) | ||
290 | { | ||
291 | s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata), | ||
292 | &s5p_device_fimd0); | ||
293 | } | ||
294 | #endif /* CONFIG_S5P_DEV_FIMD0 */ | ||
295 | |||
296 | /* HWMON */ | ||
297 | |||
298 | #ifdef CONFIG_S3C_DEV_HWMON | ||
299 | struct platform_device s3c_device_hwmon = { | ||
300 | .name = "s3c-hwmon", | ||
301 | .id = -1, | ||
302 | .dev.parent = &s3c_device_adc.dev, | ||
303 | }; | ||
304 | |||
305 | void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd) | ||
306 | { | ||
307 | s3c_set_platdata(pd, sizeof(struct s3c_hwmon_pdata), | ||
308 | &s3c_device_hwmon); | ||
309 | } | ||
310 | #endif /* CONFIG_S3C_DEV_HWMON */ | ||
311 | |||
312 | /* HSMMC */ | ||
313 | |||
314 | #ifdef CONFIG_S3C_DEV_HSMMC | ||
315 | static struct resource s3c_hsmmc_resource[] = { | ||
316 | [0] = DEFINE_RES_MEM(S3C_PA_HSMMC0, SZ_4K), | ||
317 | [1] = DEFINE_RES_IRQ(IRQ_HSMMC0), | ||
318 | }; | ||
319 | |||
320 | struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = { | ||
321 | .max_width = 4, | ||
322 | .host_caps = (MMC_CAP_4_BIT_DATA | | ||
323 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | ||
324 | .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL, | ||
325 | }; | ||
326 | |||
327 | struct platform_device s3c_device_hsmmc0 = { | ||
328 | .name = "s3c-sdhci", | ||
329 | .id = 0, | ||
330 | .num_resources = ARRAY_SIZE(s3c_hsmmc_resource), | ||
331 | .resource = s3c_hsmmc_resource, | ||
332 | .dev = { | ||
333 | .dma_mask = &samsung_device_dma_mask, | ||
334 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
335 | .platform_data = &s3c_hsmmc0_def_platdata, | ||
336 | }, | ||
337 | }; | ||
338 | |||
339 | void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd) | ||
340 | { | ||
341 | s3c_sdhci_set_platdata(pd, &s3c_hsmmc0_def_platdata); | ||
342 | } | ||
343 | #endif /* CONFIG_S3C_DEV_HSMMC */ | ||
344 | |||
345 | #ifdef CONFIG_S3C_DEV_HSMMC1 | ||
346 | static struct resource s3c_hsmmc1_resource[] = { | ||
347 | [0] = DEFINE_RES_MEM(S3C_PA_HSMMC1, SZ_4K), | ||
348 | [1] = DEFINE_RES_IRQ(IRQ_HSMMC1), | ||
349 | }; | ||
350 | |||
351 | struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = { | ||
352 | .max_width = 4, | ||
353 | .host_caps = (MMC_CAP_4_BIT_DATA | | ||
354 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | ||
355 | .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL, | ||
356 | }; | ||
357 | |||
358 | struct platform_device s3c_device_hsmmc1 = { | ||
359 | .name = "s3c-sdhci", | ||
360 | .id = 1, | ||
361 | .num_resources = ARRAY_SIZE(s3c_hsmmc1_resource), | ||
362 | .resource = s3c_hsmmc1_resource, | ||
363 | .dev = { | ||
364 | .dma_mask = &samsung_device_dma_mask, | ||
365 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
366 | .platform_data = &s3c_hsmmc1_def_platdata, | ||
367 | }, | ||
368 | }; | ||
369 | |||
370 | void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd) | ||
371 | { | ||
372 | s3c_sdhci_set_platdata(pd, &s3c_hsmmc1_def_platdata); | ||
373 | } | ||
374 | #endif /* CONFIG_S3C_DEV_HSMMC1 */ | ||
375 | |||
376 | /* HSMMC2 */ | ||
377 | |||
378 | #ifdef CONFIG_S3C_DEV_HSMMC2 | ||
379 | static struct resource s3c_hsmmc2_resource[] = { | ||
380 | [0] = DEFINE_RES_MEM(S3C_PA_HSMMC2, SZ_4K), | ||
381 | [1] = DEFINE_RES_IRQ(IRQ_HSMMC2), | ||
382 | }; | ||
383 | |||
384 | struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = { | ||
385 | .max_width = 4, | ||
386 | .host_caps = (MMC_CAP_4_BIT_DATA | | ||
387 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | ||
388 | .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL, | ||
389 | }; | ||
390 | |||
391 | struct platform_device s3c_device_hsmmc2 = { | ||
392 | .name = "s3c-sdhci", | ||
393 | .id = 2, | ||
394 | .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource), | ||
395 | .resource = s3c_hsmmc2_resource, | ||
396 | .dev = { | ||
397 | .dma_mask = &samsung_device_dma_mask, | ||
398 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
399 | .platform_data = &s3c_hsmmc2_def_platdata, | ||
400 | }, | ||
401 | }; | ||
402 | |||
403 | void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd) | ||
404 | { | ||
405 | s3c_sdhci_set_platdata(pd, &s3c_hsmmc2_def_platdata); | ||
406 | } | ||
407 | #endif /* CONFIG_S3C_DEV_HSMMC2 */ | ||
408 | |||
409 | #ifdef CONFIG_S3C_DEV_HSMMC3 | ||
410 | static struct resource s3c_hsmmc3_resource[] = { | ||
411 | [0] = DEFINE_RES_MEM(S3C_PA_HSMMC3, SZ_4K), | ||
412 | [1] = DEFINE_RES_IRQ(IRQ_HSMMC3), | ||
413 | }; | ||
414 | |||
415 | struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = { | ||
416 | .max_width = 4, | ||
417 | .host_caps = (MMC_CAP_4_BIT_DATA | | ||
418 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | ||
419 | .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL, | ||
420 | }; | ||
421 | |||
422 | struct platform_device s3c_device_hsmmc3 = { | ||
423 | .name = "s3c-sdhci", | ||
424 | .id = 3, | ||
425 | .num_resources = ARRAY_SIZE(s3c_hsmmc3_resource), | ||
426 | .resource = s3c_hsmmc3_resource, | ||
427 | .dev = { | ||
428 | .dma_mask = &samsung_device_dma_mask, | ||
429 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
430 | .platform_data = &s3c_hsmmc3_def_platdata, | ||
431 | }, | ||
432 | }; | ||
433 | |||
434 | void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd) | ||
435 | { | ||
436 | s3c_sdhci_set_platdata(pd, &s3c_hsmmc3_def_platdata); | ||
437 | } | ||
438 | #endif /* CONFIG_S3C_DEV_HSMMC3 */ | ||
439 | |||
440 | /* I2C */ | ||
441 | |||
442 | static struct resource s3c_i2c0_resource[] = { | ||
443 | [0] = DEFINE_RES_MEM(S3C_PA_IIC, SZ_4K), | ||
444 | [1] = DEFINE_RES_IRQ(IRQ_IIC), | ||
445 | }; | ||
446 | |||
447 | struct platform_device s3c_device_i2c0 = { | ||
448 | .name = "s3c2410-i2c", | ||
449 | #ifdef CONFIG_S3C_DEV_I2C1 | ||
450 | .id = 0, | ||
451 | #else | ||
452 | .id = -1, | ||
453 | #endif | ||
454 | .num_resources = ARRAY_SIZE(s3c_i2c0_resource), | ||
455 | .resource = s3c_i2c0_resource, | ||
456 | }; | ||
457 | |||
458 | struct s3c2410_platform_i2c default_i2c_data __initdata = { | ||
459 | .flags = 0, | ||
460 | .slave_addr = 0x10, | ||
461 | .frequency = 100*1000, | ||
462 | .sda_delay = 100, | ||
463 | }; | ||
464 | |||
465 | void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd) | ||
466 | { | ||
467 | struct s3c2410_platform_i2c *npd; | ||
468 | |||
469 | if (!pd) | ||
470 | pd = &default_i2c_data; | ||
471 | |||
472 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
473 | &s3c_device_i2c0); | ||
474 | |||
475 | if (!npd->cfg_gpio) | ||
476 | npd->cfg_gpio = s3c_i2c0_cfg_gpio; | ||
477 | } | ||
478 | |||
479 | #ifdef CONFIG_S3C_DEV_I2C1 | ||
480 | static struct resource s3c_i2c1_resource[] = { | ||
481 | [0] = DEFINE_RES_MEM(S3C_PA_IIC1, SZ_4K), | ||
482 | [1] = DEFINE_RES_IRQ(IRQ_IIC1), | ||
483 | }; | ||
484 | |||
485 | struct platform_device s3c_device_i2c1 = { | ||
486 | .name = "s3c2410-i2c", | ||
487 | .id = 1, | ||
488 | .num_resources = ARRAY_SIZE(s3c_i2c1_resource), | ||
489 | .resource = s3c_i2c1_resource, | ||
490 | }; | ||
491 | |||
492 | void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd) | ||
493 | { | ||
494 | struct s3c2410_platform_i2c *npd; | ||
495 | |||
496 | if (!pd) { | ||
497 | pd = &default_i2c_data; | ||
498 | pd->bus_num = 1; | ||
499 | } | ||
500 | |||
501 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
502 | &s3c_device_i2c1); | ||
503 | |||
504 | if (!npd->cfg_gpio) | ||
505 | npd->cfg_gpio = s3c_i2c1_cfg_gpio; | ||
506 | } | ||
507 | #endif /* CONFIG_S3C_DEV_I2C1 */ | ||
508 | |||
509 | #ifdef CONFIG_S3C_DEV_I2C2 | ||
510 | static struct resource s3c_i2c2_resource[] = { | ||
511 | [0] = DEFINE_RES_MEM(S3C_PA_IIC2, SZ_4K), | ||
512 | [1] = DEFINE_RES_IRQ(IRQ_IIC2), | ||
513 | }; | ||
514 | |||
515 | struct platform_device s3c_device_i2c2 = { | ||
516 | .name = "s3c2410-i2c", | ||
517 | .id = 2, | ||
518 | .num_resources = ARRAY_SIZE(s3c_i2c2_resource), | ||
519 | .resource = s3c_i2c2_resource, | ||
520 | }; | ||
521 | |||
522 | void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd) | ||
523 | { | ||
524 | struct s3c2410_platform_i2c *npd; | ||
525 | |||
526 | if (!pd) { | ||
527 | pd = &default_i2c_data; | ||
528 | pd->bus_num = 2; | ||
529 | } | ||
530 | |||
531 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
532 | &s3c_device_i2c2); | ||
533 | |||
534 | if (!npd->cfg_gpio) | ||
535 | npd->cfg_gpio = s3c_i2c2_cfg_gpio; | ||
536 | } | ||
537 | #endif /* CONFIG_S3C_DEV_I2C2 */ | ||
538 | |||
539 | #ifdef CONFIG_S3C_DEV_I2C3 | ||
540 | static struct resource s3c_i2c3_resource[] = { | ||
541 | [0] = DEFINE_RES_MEM(S3C_PA_IIC3, SZ_4K), | ||
542 | [1] = DEFINE_RES_IRQ(IRQ_IIC3), | ||
543 | }; | ||
544 | |||
545 | struct platform_device s3c_device_i2c3 = { | ||
546 | .name = "s3c2440-i2c", | ||
547 | .id = 3, | ||
548 | .num_resources = ARRAY_SIZE(s3c_i2c3_resource), | ||
549 | .resource = s3c_i2c3_resource, | ||
550 | }; | ||
551 | |||
552 | void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd) | ||
553 | { | ||
554 | struct s3c2410_platform_i2c *npd; | ||
555 | |||
556 | if (!pd) { | ||
557 | pd = &default_i2c_data; | ||
558 | pd->bus_num = 3; | ||
559 | } | ||
560 | |||
561 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
562 | &s3c_device_i2c3); | ||
563 | |||
564 | if (!npd->cfg_gpio) | ||
565 | npd->cfg_gpio = s3c_i2c3_cfg_gpio; | ||
566 | } | ||
567 | #endif /*CONFIG_S3C_DEV_I2C3 */ | ||
568 | |||
569 | #ifdef CONFIG_S3C_DEV_I2C4 | ||
570 | static struct resource s3c_i2c4_resource[] = { | ||
571 | [0] = DEFINE_RES_MEM(S3C_PA_IIC4, SZ_4K), | ||
572 | [1] = DEFINE_RES_IRQ(IRQ_IIC4), | ||
573 | }; | ||
574 | |||
575 | struct platform_device s3c_device_i2c4 = { | ||
576 | .name = "s3c2440-i2c", | ||
577 | .id = 4, | ||
578 | .num_resources = ARRAY_SIZE(s3c_i2c4_resource), | ||
579 | .resource = s3c_i2c4_resource, | ||
580 | }; | ||
581 | |||
582 | void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd) | ||
583 | { | ||
584 | struct s3c2410_platform_i2c *npd; | ||
585 | |||
586 | if (!pd) { | ||
587 | pd = &default_i2c_data; | ||
588 | pd->bus_num = 4; | ||
589 | } | ||
590 | |||
591 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
592 | &s3c_device_i2c4); | ||
593 | |||
594 | if (!npd->cfg_gpio) | ||
595 | npd->cfg_gpio = s3c_i2c4_cfg_gpio; | ||
596 | } | ||
597 | #endif /*CONFIG_S3C_DEV_I2C4 */ | ||
598 | |||
599 | #ifdef CONFIG_S3C_DEV_I2C5 | ||
600 | static struct resource s3c_i2c5_resource[] = { | ||
601 | [0] = DEFINE_RES_MEM(S3C_PA_IIC5, SZ_4K), | ||
602 | [1] = DEFINE_RES_IRQ(IRQ_IIC5), | ||
603 | }; | ||
604 | |||
605 | struct platform_device s3c_device_i2c5 = { | ||
606 | .name = "s3c2440-i2c", | ||
607 | .id = 5, | ||
608 | .num_resources = ARRAY_SIZE(s3c_i2c5_resource), | ||
609 | .resource = s3c_i2c5_resource, | ||
610 | }; | ||
611 | |||
612 | void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd) | ||
613 | { | ||
614 | struct s3c2410_platform_i2c *npd; | ||
615 | |||
616 | if (!pd) { | ||
617 | pd = &default_i2c_data; | ||
618 | pd->bus_num = 5; | ||
619 | } | ||
620 | |||
621 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
622 | &s3c_device_i2c5); | ||
623 | |||
624 | if (!npd->cfg_gpio) | ||
625 | npd->cfg_gpio = s3c_i2c5_cfg_gpio; | ||
626 | } | ||
627 | #endif /*CONFIG_S3C_DEV_I2C5 */ | ||
628 | |||
629 | #ifdef CONFIG_S3C_DEV_I2C6 | ||
630 | static struct resource s3c_i2c6_resource[] = { | ||
631 | [0] = DEFINE_RES_MEM(S3C_PA_IIC6, SZ_4K), | ||
632 | [1] = DEFINE_RES_IRQ(IRQ_IIC6), | ||
633 | }; | ||
634 | |||
635 | struct platform_device s3c_device_i2c6 = { | ||
636 | .name = "s3c2440-i2c", | ||
637 | .id = 6, | ||
638 | .num_resources = ARRAY_SIZE(s3c_i2c6_resource), | ||
639 | .resource = s3c_i2c6_resource, | ||
640 | }; | ||
641 | |||
642 | void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd) | ||
643 | { | ||
644 | struct s3c2410_platform_i2c *npd; | ||
645 | |||
646 | if (!pd) { | ||
647 | pd = &default_i2c_data; | ||
648 | pd->bus_num = 6; | ||
649 | } | ||
650 | |||
651 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
652 | &s3c_device_i2c6); | ||
653 | |||
654 | if (!npd->cfg_gpio) | ||
655 | npd->cfg_gpio = s3c_i2c6_cfg_gpio; | ||
656 | } | ||
657 | #endif /* CONFIG_S3C_DEV_I2C6 */ | ||
658 | |||
659 | #ifdef CONFIG_S3C_DEV_I2C7 | ||
660 | static struct resource s3c_i2c7_resource[] = { | ||
661 | [0] = DEFINE_RES_MEM(S3C_PA_IIC7, SZ_4K), | ||
662 | [1] = DEFINE_RES_IRQ(IRQ_IIC7), | ||
663 | }; | ||
664 | |||
665 | struct platform_device s3c_device_i2c7 = { | ||
666 | .name = "s3c2440-i2c", | ||
667 | .id = 7, | ||
668 | .num_resources = ARRAY_SIZE(s3c_i2c7_resource), | ||
669 | .resource = s3c_i2c7_resource, | ||
670 | }; | ||
671 | |||
672 | void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd) | ||
673 | { | ||
674 | struct s3c2410_platform_i2c *npd; | ||
675 | |||
676 | if (!pd) { | ||
677 | pd = &default_i2c_data; | ||
678 | pd->bus_num = 7; | ||
679 | } | ||
680 | |||
681 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
682 | &s3c_device_i2c7); | ||
683 | |||
684 | if (!npd->cfg_gpio) | ||
685 | npd->cfg_gpio = s3c_i2c7_cfg_gpio; | ||
686 | } | ||
687 | #endif /* CONFIG_S3C_DEV_I2C7 */ | ||
688 | |||
689 | /* I2C HDMIPHY */ | ||
690 | |||
691 | #ifdef CONFIG_S5P_DEV_I2C_HDMIPHY | ||
692 | static struct resource s5p_i2c_resource[] = { | ||
693 | [0] = DEFINE_RES_MEM(S5P_PA_IIC_HDMIPHY, SZ_4K), | ||
694 | [1] = DEFINE_RES_IRQ(IRQ_IIC_HDMIPHY), | ||
695 | }; | ||
696 | |||
697 | struct platform_device s5p_device_i2c_hdmiphy = { | ||
698 | .name = "s3c2440-hdmiphy-i2c", | ||
699 | .id = -1, | ||
700 | .num_resources = ARRAY_SIZE(s5p_i2c_resource), | ||
701 | .resource = s5p_i2c_resource, | ||
702 | }; | ||
703 | |||
704 | void __init s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *pd) | ||
705 | { | ||
706 | struct s3c2410_platform_i2c *npd; | ||
707 | |||
708 | if (!pd) { | ||
709 | pd = &default_i2c_data; | ||
710 | |||
711 | if (soc_is_exynos4210()) | ||
712 | pd->bus_num = 8; | ||
713 | else if (soc_is_s5pv210()) | ||
714 | pd->bus_num = 3; | ||
715 | else | ||
716 | pd->bus_num = 0; | ||
717 | } | ||
718 | |||
719 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), | ||
720 | &s5p_device_i2c_hdmiphy); | ||
721 | } | ||
722 | #endif /* CONFIG_S5P_DEV_I2C_HDMIPHY */ | ||
723 | |||
724 | /* I2S */ | ||
725 | |||
726 | #ifdef CONFIG_PLAT_S3C24XX | ||
727 | static struct resource s3c_iis_resource[] = { | ||
728 | [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS), | ||
729 | }; | ||
730 | |||
731 | struct platform_device s3c_device_iis = { | ||
732 | .name = "s3c24xx-iis", | ||
733 | .id = -1, | ||
734 | .num_resources = ARRAY_SIZE(s3c_iis_resource), | ||
735 | .resource = s3c_iis_resource, | ||
736 | .dev = { | ||
737 | .dma_mask = &samsung_device_dma_mask, | ||
738 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
739 | } | ||
740 | }; | ||
741 | #endif /* CONFIG_PLAT_S3C24XX */ | ||
742 | |||
743 | #ifdef CONFIG_CPU_S3C2440 | ||
744 | struct platform_device s3c2412_device_iis = { | ||
745 | .name = "s3c2412-iis", | ||
746 | .id = -1, | ||
747 | .dev = { | ||
748 | .dma_mask = &samsung_device_dma_mask, | ||
749 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
750 | } | ||
751 | }; | ||
752 | #endif /* CONFIG_CPU_S3C2440 */ | ||
753 | |||
754 | /* IDE CFCON */ | ||
755 | |||
756 | #ifdef CONFIG_SAMSUNG_DEV_IDE | ||
757 | static struct resource s3c_cfcon_resource[] = { | ||
758 | [0] = DEFINE_RES_MEM(SAMSUNG_PA_CFCON, SZ_16K), | ||
759 | [1] = DEFINE_RES_IRQ(IRQ_CFCON), | ||
760 | }; | ||
761 | |||
762 | struct platform_device s3c_device_cfcon = { | ||
763 | .id = 0, | ||
764 | .num_resources = ARRAY_SIZE(s3c_cfcon_resource), | ||
765 | .resource = s3c_cfcon_resource, | ||
766 | }; | ||
767 | |||
768 | void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata) | ||
769 | { | ||
770 | s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata), | ||
771 | &s3c_device_cfcon); | ||
772 | } | ||
773 | #endif /* CONFIG_SAMSUNG_DEV_IDE */ | ||
774 | |||
775 | /* KEYPAD */ | ||
776 | |||
777 | #ifdef CONFIG_SAMSUNG_DEV_KEYPAD | ||
778 | static struct resource samsung_keypad_resources[] = { | ||
779 | [0] = DEFINE_RES_MEM(SAMSUNG_PA_KEYPAD, SZ_32), | ||
780 | [1] = DEFINE_RES_IRQ(IRQ_KEYPAD), | ||
781 | }; | ||
782 | |||
783 | struct platform_device samsung_device_keypad = { | ||
784 | .name = "samsung-keypad", | ||
785 | .id = -1, | ||
786 | .num_resources = ARRAY_SIZE(samsung_keypad_resources), | ||
787 | .resource = samsung_keypad_resources, | ||
788 | }; | ||
789 | |||
790 | void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd) | ||
791 | { | ||
792 | struct samsung_keypad_platdata *npd; | ||
793 | |||
794 | npd = s3c_set_platdata(pd, sizeof(struct samsung_keypad_platdata), | ||
795 | &samsung_device_keypad); | ||
796 | |||
797 | if (!npd->cfg_gpio) | ||
798 | npd->cfg_gpio = samsung_keypad_cfg_gpio; | ||
799 | } | ||
800 | #endif /* CONFIG_SAMSUNG_DEV_KEYPAD */ | ||
801 | |||
802 | /* LCD Controller */ | ||
803 | |||
804 | #ifdef CONFIG_PLAT_S3C24XX | ||
805 | static struct resource s3c_lcd_resource[] = { | ||
806 | [0] = DEFINE_RES_MEM(S3C24XX_PA_LCD, S3C24XX_SZ_LCD), | ||
807 | [1] = DEFINE_RES_IRQ(IRQ_LCD), | ||
808 | }; | ||
809 | |||
810 | struct platform_device s3c_device_lcd = { | ||
811 | .name = "s3c2410-lcd", | ||
812 | .id = -1, | ||
813 | .num_resources = ARRAY_SIZE(s3c_lcd_resource), | ||
814 | .resource = s3c_lcd_resource, | ||
815 | .dev = { | ||
816 | .dma_mask = &samsung_device_dma_mask, | ||
817 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
818 | } | ||
819 | }; | ||
820 | |||
821 | void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd) | ||
822 | { | ||
823 | struct s3c2410fb_mach_info *npd; | ||
824 | |||
825 | npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_lcd); | ||
826 | if (npd) { | ||
827 | npd->displays = kmemdup(pd->displays, | ||
828 | sizeof(struct s3c2410fb_display) * npd->num_displays, | ||
829 | GFP_KERNEL); | ||
830 | if (!npd->displays) | ||
831 | printk(KERN_ERR "no memory for LCD display data\n"); | ||
832 | } else { | ||
833 | printk(KERN_ERR "no memory for LCD platform data\n"); | ||
834 | } | ||
835 | } | ||
836 | #endif /* CONFIG_PLAT_S3C24XX */ | ||
837 | |||
838 | /* MFC */ | ||
839 | |||
840 | #ifdef CONFIG_S5P_DEV_MFC | ||
841 | static struct resource s5p_mfc_resource[] = { | ||
842 | [0] = DEFINE_RES_MEM(S5P_PA_MFC, SZ_64K), | ||
843 | [1] = DEFINE_RES_IRQ(IRQ_MFC), | ||
844 | }; | ||
845 | |||
846 | struct platform_device s5p_device_mfc = { | ||
847 | .name = "s5p-mfc", | ||
848 | .id = -1, | ||
849 | .num_resources = ARRAY_SIZE(s5p_mfc_resource), | ||
850 | .resource = s5p_mfc_resource, | ||
851 | }; | ||
852 | |||
853 | /* | ||
854 | * MFC hardware has 2 memory interfaces which are modelled as two separate | ||
855 | * platform devices to let dma-mapping distinguish between them. | ||
856 | * | ||
857 | * MFC parent device (s5p_device_mfc) must be registered before memory | ||
858 | * interface specific devices (s5p_device_mfc_l and s5p_device_mfc_r). | ||
859 | */ | ||
860 | |||
861 | struct platform_device s5p_device_mfc_l = { | ||
862 | .name = "s5p-mfc-l", | ||
863 | .id = -1, | ||
864 | .dev = { | ||
865 | .parent = &s5p_device_mfc.dev, | ||
866 | .dma_mask = &samsung_device_dma_mask, | ||
867 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
868 | }, | ||
869 | }; | ||
870 | |||
871 | struct platform_device s5p_device_mfc_r = { | ||
872 | .name = "s5p-mfc-r", | ||
873 | .id = -1, | ||
874 | .dev = { | ||
875 | .parent = &s5p_device_mfc.dev, | ||
876 | .dma_mask = &samsung_device_dma_mask, | ||
877 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
878 | }, | ||
879 | }; | ||
880 | #endif /* CONFIG_S5P_DEV_MFC */ | ||
881 | |||
882 | /* MIPI CSIS */ | ||
883 | |||
884 | #ifdef CONFIG_S5P_DEV_CSIS0 | ||
885 | static struct resource s5p_mipi_csis0_resource[] = { | ||
886 | [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS0, SZ_4K), | ||
887 | [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS0), | ||
888 | }; | ||
889 | |||
890 | struct platform_device s5p_device_mipi_csis0 = { | ||
891 | .name = "s5p-mipi-csis", | ||
892 | .id = 0, | ||
893 | .num_resources = ARRAY_SIZE(s5p_mipi_csis0_resource), | ||
894 | .resource = s5p_mipi_csis0_resource, | ||
895 | }; | ||
896 | #endif /* CONFIG_S5P_DEV_CSIS0 */ | ||
897 | |||
898 | #ifdef CONFIG_S5P_DEV_CSIS1 | ||
899 | static struct resource s5p_mipi_csis1_resource[] = { | ||
900 | [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS1, SZ_4K), | ||
901 | [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS1), | ||
902 | }; | ||
903 | |||
904 | struct platform_device s5p_device_mipi_csis1 = { | ||
905 | .name = "s5p-mipi-csis", | ||
906 | .id = 1, | ||
907 | .num_resources = ARRAY_SIZE(s5p_mipi_csis1_resource), | ||
908 | .resource = s5p_mipi_csis1_resource, | ||
909 | }; | ||
910 | #endif | ||
911 | |||
912 | /* NAND */ | ||
913 | |||
914 | #ifdef CONFIG_S3C_DEV_NAND | ||
915 | static struct resource s3c_nand_resource[] = { | ||
916 | [0] = DEFINE_RES_MEM(S3C_PA_NAND, SZ_1M), | ||
917 | }; | ||
918 | |||
919 | struct platform_device s3c_device_nand = { | ||
920 | .name = "s3c2410-nand", | ||
921 | .id = -1, | ||
922 | .num_resources = ARRAY_SIZE(s3c_nand_resource), | ||
923 | .resource = s3c_nand_resource, | ||
924 | }; | ||
925 | |||
926 | /* | ||
927 | * s3c_nand_copy_set() - copy nand set data | ||
928 | * @set: The new structure, directly copied from the old. | ||
929 | * | ||
930 | * Copy all the fields from the NAND set field from what is probably __initdata | ||
931 | * to new kernel memory. The code returns 0 if the copy happened correctly or | ||
932 | * an error code for the calling function to display. | ||
933 | * | ||
934 | * Note, we currently do not try and look to see if we've already copied the | ||
935 | * data in a previous set. | ||
936 | */ | ||
937 | static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set) | ||
938 | { | ||
939 | void *ptr; | ||
940 | int size; | ||
941 | |||
942 | size = sizeof(struct mtd_partition) * set->nr_partitions; | ||
943 | if (size) { | ||
944 | ptr = kmemdup(set->partitions, size, GFP_KERNEL); | ||
945 | set->partitions = ptr; | ||
946 | |||
947 | if (!ptr) | ||
948 | return -ENOMEM; | ||
949 | } | ||
950 | |||
951 | if (set->nr_map && set->nr_chips) { | ||
952 | size = sizeof(int) * set->nr_chips; | ||
953 | ptr = kmemdup(set->nr_map, size, GFP_KERNEL); | ||
954 | set->nr_map = ptr; | ||
955 | |||
956 | if (!ptr) | ||
957 | return -ENOMEM; | ||
958 | } | ||
959 | |||
960 | if (set->ecc_layout) { | ||
961 | ptr = kmemdup(set->ecc_layout, | ||
962 | sizeof(struct nand_ecclayout), GFP_KERNEL); | ||
963 | set->ecc_layout = ptr; | ||
964 | |||
965 | if (!ptr) | ||
966 | return -ENOMEM; | ||
967 | } | ||
968 | |||
969 | return 0; | ||
970 | } | ||
971 | |||
972 | void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand) | ||
973 | { | ||
974 | struct s3c2410_platform_nand *npd; | ||
975 | int size; | ||
976 | int ret; | ||
977 | |||
978 | /* note, if we get a failure in allocation, we simply drop out of the | ||
979 | * function. If there is so little memory available at initialisation | ||
980 | * time then there is little chance the system is going to run. | ||
981 | */ | ||
982 | |||
983 | npd = s3c_set_platdata(nand, sizeof(struct s3c2410_platform_nand), | ||
984 | &s3c_device_nand); | ||
985 | if (!npd) | ||
986 | return; | ||
987 | |||
988 | /* now see if we need to copy any of the nand set data */ | ||
989 | |||
990 | size = sizeof(struct s3c2410_nand_set) * npd->nr_sets; | ||
991 | if (size) { | ||
992 | struct s3c2410_nand_set *from = npd->sets; | ||
993 | struct s3c2410_nand_set *to; | ||
994 | int i; | ||
995 | |||
996 | to = kmemdup(from, size, GFP_KERNEL); | ||
997 | npd->sets = to; /* set, even if we failed */ | ||
998 | |||
999 | if (!to) { | ||
1000 | printk(KERN_ERR "%s: no memory for sets\n", __func__); | ||
1001 | return; | ||
1002 | } | ||
1003 | |||
1004 | for (i = 0; i < npd->nr_sets; i++) { | ||
1005 | ret = s3c_nand_copy_set(to); | ||
1006 | if (ret) { | ||
1007 | printk(KERN_ERR "%s: failed to copy set %d\n", | ||
1008 | __func__, i); | ||
1009 | return; | ||
1010 | } | ||
1011 | to++; | ||
1012 | } | ||
1013 | } | ||
1014 | } | ||
1015 | #endif /* CONFIG_S3C_DEV_NAND */ | ||
1016 | |||
1017 | /* ONENAND */ | ||
1018 | |||
1019 | #ifdef CONFIG_S3C_DEV_ONENAND | ||
1020 | static struct resource s3c_onenand_resources[] = { | ||
1021 | [0] = DEFINE_RES_MEM(S3C_PA_ONENAND, SZ_1K), | ||
1022 | [1] = DEFINE_RES_MEM(S3C_PA_ONENAND_BUF, S3C_SZ_ONENAND_BUF), | ||
1023 | [2] = DEFINE_RES_IRQ(IRQ_ONENAND), | ||
1024 | }; | ||
1025 | |||
1026 | struct platform_device s3c_device_onenand = { | ||
1027 | .name = "samsung-onenand", | ||
1028 | .id = 0, | ||
1029 | .num_resources = ARRAY_SIZE(s3c_onenand_resources), | ||
1030 | .resource = s3c_onenand_resources, | ||
1031 | }; | ||
1032 | #endif /* CONFIG_S3C_DEV_ONENAND */ | ||
1033 | |||
1034 | #ifdef CONFIG_S3C64XX_DEV_ONENAND1 | ||
1035 | static struct resource s3c64xx_onenand1_resources[] = { | ||
1036 | [0] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1, SZ_1K), | ||
1037 | [1] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1_BUF, S3C64XX_SZ_ONENAND1_BUF), | ||
1038 | [2] = DEFINE_RES_IRQ(IRQ_ONENAND1), | ||
1039 | }; | ||
1040 | |||
1041 | struct platform_device s3c64xx_device_onenand1 = { | ||
1042 | .name = "samsung-onenand", | ||
1043 | .id = 1, | ||
1044 | .num_resources = ARRAY_SIZE(s3c64xx_onenand1_resources), | ||
1045 | .resource = s3c64xx_onenand1_resources, | ||
1046 | }; | ||
1047 | |||
1048 | void s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata) | ||
1049 | { | ||
1050 | s3c_set_platdata(pdata, sizeof(struct onenand_platform_data), | ||
1051 | &s3c64xx_device_onenand1); | ||
1052 | } | ||
1053 | #endif /* CONFIG_S3C64XX_DEV_ONENAND1 */ | ||
1054 | |||
1055 | #ifdef CONFIG_S5P_DEV_ONENAND | ||
1056 | static struct resource s5p_onenand_resources[] = { | ||
1057 | [0] = DEFINE_RES_MEM(S5P_PA_ONENAND, SZ_128K), | ||
1058 | [1] = DEFINE_RES_MEM(S5P_PA_ONENAND_DMA, SZ_8K), | ||
1059 | [2] = DEFINE_RES_IRQ(IRQ_ONENAND_AUDI), | ||
1060 | }; | ||
1061 | |||
1062 | struct platform_device s5p_device_onenand = { | ||
1063 | .name = "s5pc110-onenand", | ||
1064 | .id = -1, | ||
1065 | .num_resources = ARRAY_SIZE(s5p_onenand_resources), | ||
1066 | .resource = s5p_onenand_resources, | ||
1067 | }; | ||
1068 | #endif /* CONFIG_S5P_DEV_ONENAND */ | ||
1069 | |||
1070 | /* PMU */ | ||
1071 | |||
1072 | #ifdef CONFIG_PLAT_S5P | ||
1073 | static struct resource s5p_pmu_resource[] = { | ||
1074 | DEFINE_RES_IRQ(IRQ_PMU) | ||
1075 | }; | ||
1076 | |||
1077 | struct platform_device s5p_device_pmu = { | ||
1078 | .name = "arm-pmu", | ||
1079 | .id = ARM_PMU_DEVICE_CPU, | ||
1080 | .num_resources = ARRAY_SIZE(s5p_pmu_resource), | ||
1081 | .resource = s5p_pmu_resource, | ||
1082 | }; | ||
1083 | |||
1084 | static int __init s5p_pmu_init(void) | ||
1085 | { | ||
1086 | platform_device_register(&s5p_device_pmu); | ||
1087 | return 0; | ||
1088 | } | ||
1089 | arch_initcall(s5p_pmu_init); | ||
1090 | #endif /* CONFIG_PLAT_S5P */ | ||
1091 | |||
1092 | /* PWM Timer */ | ||
1093 | |||
1094 | #ifdef CONFIG_SAMSUNG_DEV_PWM | ||
1095 | |||
1096 | #define TIMER_RESOURCE_SIZE (1) | ||
1097 | |||
1098 | #define TIMER_RESOURCE(_tmr, _irq) \ | ||
1099 | (struct resource [TIMER_RESOURCE_SIZE]) { \ | ||
1100 | [0] = { \ | ||
1101 | .start = _irq, \ | ||
1102 | .end = _irq, \ | ||
1103 | .flags = IORESOURCE_IRQ \ | ||
1104 | } \ | ||
1105 | } | ||
1106 | |||
1107 | #define DEFINE_S3C_TIMER(_tmr_no, _irq) \ | ||
1108 | .name = "s3c24xx-pwm", \ | ||
1109 | .id = _tmr_no, \ | ||
1110 | .num_resources = TIMER_RESOURCE_SIZE, \ | ||
1111 | .resource = TIMER_RESOURCE(_tmr_no, _irq), \ | ||
1112 | |||
1113 | /* | ||
1114 | * since we already have an static mapping for the timer, | ||
1115 | * we do not bother setting any IO resource for the base. | ||
1116 | */ | ||
1117 | |||
1118 | struct platform_device s3c_device_timer[] = { | ||
1119 | [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) }, | ||
1120 | [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) }, | ||
1121 | [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) }, | ||
1122 | [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) }, | ||
1123 | [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) }, | ||
1124 | }; | ||
1125 | #endif /* CONFIG_SAMSUNG_DEV_PWM */ | ||
1126 | |||
1127 | /* RTC */ | ||
1128 | |||
1129 | #ifdef CONFIG_PLAT_S3C24XX | ||
1130 | static struct resource s3c_rtc_resource[] = { | ||
1131 | [0] = DEFINE_RES_MEM(S3C24XX_PA_RTC, SZ_256), | ||
1132 | [1] = DEFINE_RES_IRQ(IRQ_RTC), | ||
1133 | [2] = DEFINE_RES_IRQ(IRQ_TICK), | ||
1134 | }; | ||
1135 | |||
1136 | struct platform_device s3c_device_rtc = { | ||
1137 | .name = "s3c2410-rtc", | ||
1138 | .id = -1, | ||
1139 | .num_resources = ARRAY_SIZE(s3c_rtc_resource), | ||
1140 | .resource = s3c_rtc_resource, | ||
1141 | }; | ||
1142 | #endif /* CONFIG_PLAT_S3C24XX */ | ||
1143 | |||
1144 | #ifdef CONFIG_S3C_DEV_RTC | ||
1145 | static struct resource s3c_rtc_resource[] = { | ||
1146 | [0] = DEFINE_RES_MEM(S3C_PA_RTC, SZ_256), | ||
1147 | [1] = DEFINE_RES_IRQ(IRQ_RTC_ALARM), | ||
1148 | [2] = DEFINE_RES_IRQ(IRQ_RTC_TIC), | ||
1149 | }; | ||
1150 | |||
1151 | struct platform_device s3c_device_rtc = { | ||
1152 | .name = "s3c64xx-rtc", | ||
1153 | .id = -1, | ||
1154 | .num_resources = ARRAY_SIZE(s3c_rtc_resource), | ||
1155 | .resource = s3c_rtc_resource, | ||
1156 | }; | ||
1157 | #endif /* CONFIG_S3C_DEV_RTC */ | ||
1158 | |||
1159 | /* SDI */ | ||
1160 | |||
1161 | #ifdef CONFIG_PLAT_S3C24XX | ||
1162 | static struct resource s3c_sdi_resource[] = { | ||
1163 | [0] = DEFINE_RES_MEM(S3C24XX_PA_SDI, S3C24XX_SZ_SDI), | ||
1164 | [1] = DEFINE_RES_IRQ(IRQ_SDI), | ||
1165 | }; | ||
1166 | |||
1167 | struct platform_device s3c_device_sdi = { | ||
1168 | .name = "s3c2410-sdi", | ||
1169 | .id = -1, | ||
1170 | .num_resources = ARRAY_SIZE(s3c_sdi_resource), | ||
1171 | .resource = s3c_sdi_resource, | ||
1172 | }; | ||
1173 | |||
1174 | void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata) | ||
1175 | { | ||
1176 | s3c_set_platdata(pdata, sizeof(struct s3c24xx_mci_pdata), | ||
1177 | &s3c_device_sdi); | ||
1178 | } | ||
1179 | #endif /* CONFIG_PLAT_S3C24XX */ | ||
1180 | |||
1181 | /* SPI */ | ||
1182 | |||
1183 | #ifdef CONFIG_PLAT_S3C24XX | ||
1184 | static struct resource s3c_spi0_resource[] = { | ||
1185 | [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI, SZ_32), | ||
1186 | [1] = DEFINE_RES_IRQ(IRQ_SPI0), | ||
1187 | }; | ||
1188 | |||
1189 | struct platform_device s3c_device_spi0 = { | ||
1190 | .name = "s3c2410-spi", | ||
1191 | .id = 0, | ||
1192 | .num_resources = ARRAY_SIZE(s3c_spi0_resource), | ||
1193 | .resource = s3c_spi0_resource, | ||
1194 | .dev = { | ||
1195 | .dma_mask = &samsung_device_dma_mask, | ||
1196 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1197 | } | ||
1198 | }; | ||
1199 | |||
1200 | static struct resource s3c_spi1_resource[] = { | ||
1201 | [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI1, SZ_32), | ||
1202 | [1] = DEFINE_RES_IRQ(IRQ_SPI1), | ||
1203 | }; | ||
1204 | |||
1205 | struct platform_device s3c_device_spi1 = { | ||
1206 | .name = "s3c2410-spi", | ||
1207 | .id = 1, | ||
1208 | .num_resources = ARRAY_SIZE(s3c_spi1_resource), | ||
1209 | .resource = s3c_spi1_resource, | ||
1210 | .dev = { | ||
1211 | .dma_mask = &samsung_device_dma_mask, | ||
1212 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1213 | } | ||
1214 | }; | ||
1215 | #endif /* CONFIG_PLAT_S3C24XX */ | ||
1216 | |||
1217 | /* Touchscreen */ | ||
1218 | |||
1219 | #ifdef CONFIG_PLAT_S3C24XX | ||
1220 | static struct resource s3c_ts_resource[] = { | ||
1221 | [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC), | ||
1222 | [1] = DEFINE_RES_IRQ(IRQ_TC), | ||
1223 | }; | ||
1224 | |||
1225 | struct platform_device s3c_device_ts = { | ||
1226 | .name = "s3c2410-ts", | ||
1227 | .id = -1, | ||
1228 | .dev.parent = &s3c_device_adc.dev, | ||
1229 | .num_resources = ARRAY_SIZE(s3c_ts_resource), | ||
1230 | .resource = s3c_ts_resource, | ||
1231 | }; | ||
1232 | |||
1233 | void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info) | ||
1234 | { | ||
1235 | s3c_set_platdata(hard_s3c2410ts_info, | ||
1236 | sizeof(struct s3c2410_ts_mach_info), &s3c_device_ts); | ||
1237 | } | ||
1238 | #endif /* CONFIG_PLAT_S3C24XX */ | ||
1239 | |||
1240 | #ifdef CONFIG_SAMSUNG_DEV_TS | ||
1241 | static struct resource s3c_ts_resource[] = { | ||
1242 | [0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256), | ||
1243 | [1] = DEFINE_RES_IRQ(IRQ_TC), | ||
1244 | }; | ||
1245 | |||
1246 | static struct s3c2410_ts_mach_info default_ts_data __initdata = { | ||
1247 | .delay = 10000, | ||
1248 | .presc = 49, | ||
1249 | .oversampling_shift = 2, | ||
1250 | }; | ||
1251 | |||
1252 | struct platform_device s3c_device_ts = { | ||
1253 | .name = "s3c64xx-ts", | ||
1254 | .id = -1, | ||
1255 | .num_resources = ARRAY_SIZE(s3c_ts_resource), | ||
1256 | .resource = s3c_ts_resource, | ||
1257 | }; | ||
1258 | |||
1259 | void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd) | ||
1260 | { | ||
1261 | if (!pd) | ||
1262 | pd = &default_ts_data; | ||
1263 | |||
1264 | s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info), | ||
1265 | &s3c_device_ts); | ||
1266 | } | ||
1267 | #endif /* CONFIG_SAMSUNG_DEV_TS */ | ||
1268 | |||
1269 | /* TV */ | ||
1270 | |||
1271 | #ifdef CONFIG_S5P_DEV_TV | ||
1272 | |||
1273 | static struct resource s5p_hdmi_resources[] = { | ||
1274 | [0] = DEFINE_RES_MEM(S5P_PA_HDMI, SZ_1M), | ||
1275 | [1] = DEFINE_RES_IRQ(IRQ_HDMI), | ||
1276 | }; | ||
1277 | |||
1278 | struct platform_device s5p_device_hdmi = { | ||
1279 | .name = "s5p-hdmi", | ||
1280 | .id = -1, | ||
1281 | .num_resources = ARRAY_SIZE(s5p_hdmi_resources), | ||
1282 | .resource = s5p_hdmi_resources, | ||
1283 | }; | ||
1284 | |||
1285 | static struct resource s5p_sdo_resources[] = { | ||
1286 | [0] = DEFINE_RES_MEM(S5P_PA_SDO, SZ_64K), | ||
1287 | [1] = DEFINE_RES_IRQ(IRQ_SDO), | ||
1288 | }; | ||
1289 | |||
1290 | struct platform_device s5p_device_sdo = { | ||
1291 | .name = "s5p-sdo", | ||
1292 | .id = -1, | ||
1293 | .num_resources = ARRAY_SIZE(s5p_sdo_resources), | ||
1294 | .resource = s5p_sdo_resources, | ||
1295 | }; | ||
1296 | |||
1297 | static struct resource s5p_mixer_resources[] = { | ||
1298 | [0] = DEFINE_RES_MEM_NAMED(S5P_PA_MIXER, SZ_64K, "mxr"), | ||
1299 | [1] = DEFINE_RES_MEM_NAMED(S5P_PA_VP, SZ_64K, "vp"), | ||
1300 | [2] = DEFINE_RES_IRQ_NAMED(IRQ_MIXER, "irq"), | ||
1301 | }; | ||
1302 | |||
1303 | struct platform_device s5p_device_mixer = { | ||
1304 | .name = "s5p-mixer", | ||
1305 | .id = -1, | ||
1306 | .num_resources = ARRAY_SIZE(s5p_mixer_resources), | ||
1307 | .resource = s5p_mixer_resources, | ||
1308 | .dev = { | ||
1309 | .dma_mask = &samsung_device_dma_mask, | ||
1310 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1311 | } | ||
1312 | }; | ||
1313 | #endif /* CONFIG_S5P_DEV_TV */ | ||
1314 | |||
1315 | /* USB */ | ||
1316 | |||
1317 | #ifdef CONFIG_S3C_DEV_USB_HOST | ||
1318 | static struct resource s3c_usb_resource[] = { | ||
1319 | [0] = DEFINE_RES_MEM(S3C_PA_USBHOST, SZ_256), | ||
1320 | [1] = DEFINE_RES_IRQ(IRQ_USBH), | ||
1321 | }; | ||
1322 | |||
1323 | struct platform_device s3c_device_ohci = { | ||
1324 | .name = "s3c2410-ohci", | ||
1325 | .id = -1, | ||
1326 | .num_resources = ARRAY_SIZE(s3c_usb_resource), | ||
1327 | .resource = s3c_usb_resource, | ||
1328 | .dev = { | ||
1329 | .dma_mask = &samsung_device_dma_mask, | ||
1330 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1331 | } | ||
1332 | }; | ||
1333 | |||
1334 | /* | ||
1335 | * s3c_ohci_set_platdata - initialise OHCI device platform data | ||
1336 | * @info: The platform data. | ||
1337 | * | ||
1338 | * This call copies the @info passed in and sets the device .platform_data | ||
1339 | * field to that copy. The @info is copied so that the original can be marked | ||
1340 | * __initdata. | ||
1341 | */ | ||
1342 | |||
1343 | void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info) | ||
1344 | { | ||
1345 | s3c_set_platdata(info, sizeof(struct s3c2410_hcd_info), | ||
1346 | &s3c_device_ohci); | ||
1347 | } | ||
1348 | #endif /* CONFIG_S3C_DEV_USB_HOST */ | ||
1349 | |||
1350 | /* USB Device (Gadget) */ | ||
1351 | |||
1352 | #ifdef CONFIG_PLAT_S3C24XX | ||
1353 | static struct resource s3c_usbgadget_resource[] = { | ||
1354 | [0] = DEFINE_RES_MEM(S3C24XX_PA_USBDEV, S3C24XX_SZ_USBDEV), | ||
1355 | [1] = DEFINE_RES_IRQ(IRQ_USBD), | ||
1356 | }; | ||
1357 | |||
1358 | struct platform_device s3c_device_usbgadget = { | ||
1359 | .name = "s3c2410-usbgadget", | ||
1360 | .id = -1, | ||
1361 | .num_resources = ARRAY_SIZE(s3c_usbgadget_resource), | ||
1362 | .resource = s3c_usbgadget_resource, | ||
1363 | }; | ||
1364 | |||
1365 | void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd) | ||
1366 | { | ||
1367 | s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usbgadget); | ||
1368 | } | ||
1369 | #endif /* CONFIG_PLAT_S3C24XX */ | ||
1370 | |||
1371 | /* USB EHCI Host Controller */ | ||
1372 | |||
1373 | #ifdef CONFIG_S5P_DEV_USB_EHCI | ||
1374 | static struct resource s5p_ehci_resource[] = { | ||
1375 | [0] = DEFINE_RES_MEM(S5P_PA_EHCI, SZ_256), | ||
1376 | [1] = DEFINE_RES_IRQ(IRQ_USB_HOST), | ||
1377 | }; | ||
1378 | |||
1379 | struct platform_device s5p_device_ehci = { | ||
1380 | .name = "s5p-ehci", | ||
1381 | .id = -1, | ||
1382 | .num_resources = ARRAY_SIZE(s5p_ehci_resource), | ||
1383 | .resource = s5p_ehci_resource, | ||
1384 | .dev = { | ||
1385 | .dma_mask = &samsung_device_dma_mask, | ||
1386 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1387 | } | ||
1388 | }; | ||
1389 | |||
1390 | void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd) | ||
1391 | { | ||
1392 | struct s5p_ehci_platdata *npd; | ||
1393 | |||
1394 | npd = s3c_set_platdata(pd, sizeof(struct s5p_ehci_platdata), | ||
1395 | &s5p_device_ehci); | ||
1396 | |||
1397 | if (!npd->phy_init) | ||
1398 | npd->phy_init = s5p_usb_phy_init; | ||
1399 | if (!npd->phy_exit) | ||
1400 | npd->phy_exit = s5p_usb_phy_exit; | ||
1401 | } | ||
1402 | #endif /* CONFIG_S5P_DEV_USB_EHCI */ | ||
1403 | |||
1404 | /* USB HSOTG */ | ||
1405 | |||
1406 | #ifdef CONFIG_S3C_DEV_USB_HSOTG | ||
1407 | static struct resource s3c_usb_hsotg_resources[] = { | ||
1408 | [0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_16K), | ||
1409 | [1] = DEFINE_RES_IRQ(IRQ_OTG), | ||
1410 | }; | ||
1411 | |||
1412 | struct platform_device s3c_device_usb_hsotg = { | ||
1413 | .name = "s3c-hsotg", | ||
1414 | .id = -1, | ||
1415 | .num_resources = ARRAY_SIZE(s3c_usb_hsotg_resources), | ||
1416 | .resource = s3c_usb_hsotg_resources, | ||
1417 | .dev = { | ||
1418 | .dma_mask = &samsung_device_dma_mask, | ||
1419 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1420 | }, | ||
1421 | }; | ||
1422 | #endif /* CONFIG_S3C_DEV_USB_HSOTG */ | ||
1423 | |||
1424 | /* USB High Spped 2.0 Device (Gadget) */ | ||
1425 | |||
1426 | #ifdef CONFIG_PLAT_S3C24XX | ||
1427 | static struct resource s3c_hsudc_resource[] = { | ||
1428 | [0] = DEFINE_RES_MEM(S3C2416_PA_HSUDC, S3C2416_SZ_HSUDC), | ||
1429 | [1] = DEFINE_RES_IRQ(IRQ_USBD), | ||
1430 | }; | ||
1431 | |||
1432 | struct platform_device s3c_device_usb_hsudc = { | ||
1433 | .name = "s3c-hsudc", | ||
1434 | .id = -1, | ||
1435 | .num_resources = ARRAY_SIZE(s3c_hsudc_resource), | ||
1436 | .resource = s3c_hsudc_resource, | ||
1437 | .dev = { | ||
1438 | .dma_mask = &samsung_device_dma_mask, | ||
1439 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1440 | }, | ||
1441 | }; | ||
1442 | |||
1443 | void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd) | ||
1444 | { | ||
1445 | s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc); | ||
1446 | } | ||
1447 | #endif /* CONFIG_PLAT_S3C24XX */ | ||
1448 | |||
1449 | /* WDT */ | ||
1450 | |||
1451 | #ifdef CONFIG_S3C_DEV_WDT | ||
1452 | static struct resource s3c_wdt_resource[] = { | ||
1453 | [0] = DEFINE_RES_MEM(S3C_PA_WDT, SZ_1K), | ||
1454 | [1] = DEFINE_RES_IRQ(IRQ_WDT), | ||
1455 | }; | ||
1456 | |||
1457 | struct platform_device s3c_device_wdt = { | ||
1458 | .name = "s3c2410-wdt", | ||
1459 | .id = -1, | ||
1460 | .num_resources = ARRAY_SIZE(s3c_wdt_resource), | ||
1461 | .resource = s3c_wdt_resource, | ||
1462 | }; | ||
1463 | #endif /* CONFIG_S3C_DEV_WDT */ | ||
diff --git a/arch/arm/plat-samsung/dma-ops.c b/arch/arm/plat-samsung/dma-ops.c new file mode 100644 index 000000000000..93a994a5dd8f --- /dev/null +++ b/arch/arm/plat-samsung/dma-ops.c | |||
@@ -0,0 +1,132 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dma-ops.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Samsung DMA Operations | ||
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/errno.h> | ||
15 | #include <linux/amba/pl330.h> | ||
16 | #include <linux/scatterlist.h> | ||
17 | #include <linux/export.h> | ||
18 | |||
19 | #include <mach/dma.h> | ||
20 | |||
21 | static inline bool pl330_filter(struct dma_chan *chan, void *param) | ||
22 | { | ||
23 | struct dma_pl330_peri *peri = chan->private; | ||
24 | return peri->peri_id == (unsigned)param; | ||
25 | } | ||
26 | |||
27 | static unsigned samsung_dmadev_request(enum dma_ch dma_ch, | ||
28 | struct samsung_dma_info *info) | ||
29 | { | ||
30 | struct dma_chan *chan; | ||
31 | dma_cap_mask_t mask; | ||
32 | struct dma_slave_config slave_config; | ||
33 | |||
34 | dma_cap_zero(mask); | ||
35 | dma_cap_set(info->cap, mask); | ||
36 | |||
37 | chan = dma_request_channel(mask, pl330_filter, (void *)dma_ch); | ||
38 | |||
39 | if (info->direction == DMA_FROM_DEVICE) { | ||
40 | memset(&slave_config, 0, sizeof(struct dma_slave_config)); | ||
41 | slave_config.direction = info->direction; | ||
42 | slave_config.src_addr = info->fifo; | ||
43 | slave_config.src_addr_width = info->width; | ||
44 | slave_config.src_maxburst = 1; | ||
45 | dmaengine_slave_config(chan, &slave_config); | ||
46 | } else if (info->direction == DMA_TO_DEVICE) { | ||
47 | memset(&slave_config, 0, sizeof(struct dma_slave_config)); | ||
48 | slave_config.direction = info->direction; | ||
49 | slave_config.dst_addr = info->fifo; | ||
50 | slave_config.dst_addr_width = info->width; | ||
51 | slave_config.dst_maxburst = 1; | ||
52 | dmaengine_slave_config(chan, &slave_config); | ||
53 | } | ||
54 | |||
55 | return (unsigned)chan; | ||
56 | } | ||
57 | |||
58 | static int samsung_dmadev_release(unsigned ch, | ||
59 | struct s3c2410_dma_client *client) | ||
60 | { | ||
61 | dma_release_channel((struct dma_chan *)ch); | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static int samsung_dmadev_prepare(unsigned ch, | ||
67 | struct samsung_dma_prep_info *info) | ||
68 | { | ||
69 | struct scatterlist sg; | ||
70 | struct dma_chan *chan = (struct dma_chan *)ch; | ||
71 | struct dma_async_tx_descriptor *desc; | ||
72 | |||
73 | switch (info->cap) { | ||
74 | case DMA_SLAVE: | ||
75 | sg_init_table(&sg, 1); | ||
76 | sg_dma_len(&sg) = info->len; | ||
77 | sg_set_page(&sg, pfn_to_page(PFN_DOWN(info->buf)), | ||
78 | info->len, offset_in_page(info->buf)); | ||
79 | sg_dma_address(&sg) = info->buf; | ||
80 | |||
81 | desc = chan->device->device_prep_slave_sg(chan, | ||
82 | &sg, 1, info->direction, DMA_PREP_INTERRUPT); | ||
83 | break; | ||
84 | case DMA_CYCLIC: | ||
85 | desc = chan->device->device_prep_dma_cyclic(chan, | ||
86 | info->buf, info->len, info->period, info->direction); | ||
87 | break; | ||
88 | default: | ||
89 | dev_err(&chan->dev->device, "unsupported format\n"); | ||
90 | return -EFAULT; | ||
91 | } | ||
92 | |||
93 | if (!desc) { | ||
94 | dev_err(&chan->dev->device, "cannot prepare cyclic dma\n"); | ||
95 | return -EFAULT; | ||
96 | } | ||
97 | |||
98 | desc->callback = info->fp; | ||
99 | desc->callback_param = info->fp_param; | ||
100 | |||
101 | dmaengine_submit((struct dma_async_tx_descriptor *)desc); | ||
102 | |||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | static inline int samsung_dmadev_trigger(unsigned ch) | ||
107 | { | ||
108 | dma_async_issue_pending((struct dma_chan *)ch); | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | static inline int samsung_dmadev_flush(unsigned ch) | ||
114 | { | ||
115 | return dmaengine_terminate_all((struct dma_chan *)ch); | ||
116 | } | ||
117 | |||
118 | struct samsung_dma_ops dmadev_ops = { | ||
119 | .request = samsung_dmadev_request, | ||
120 | .release = samsung_dmadev_release, | ||
121 | .prepare = samsung_dmadev_prepare, | ||
122 | .trigger = samsung_dmadev_trigger, | ||
123 | .started = NULL, | ||
124 | .flush = samsung_dmadev_flush, | ||
125 | .stop = samsung_dmadev_flush, | ||
126 | }; | ||
127 | |||
128 | void *samsung_dmadev_get_ops(void) | ||
129 | { | ||
130 | return &dmadev_ops; | ||
131 | } | ||
132 | EXPORT_SYMBOL(samsung_dmadev_get_ops); | ||
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c deleted file mode 100644 index 1c0b0401594b..000000000000 --- a/arch/arm/plat-samsung/gpio-config.c +++ /dev/null | |||
@@ -1,431 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/gpio-config.c | ||
2 | * | ||
3 | * Copyright 2008 Openmoko, Inc. | ||
4 | * Copyright 2008-2010 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * S3C series GPIO configuration core | ||
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/kernel.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/io.h> | ||
19 | |||
20 | #include <plat/gpio-core.h> | ||
21 | #include <plat/gpio-cfg.h> | ||
22 | #include <plat/gpio-cfg-helpers.h> | ||
23 | |||
24 | int s3c_gpio_cfgpin(unsigned int pin, unsigned int config) | ||
25 | { | ||
26 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
27 | unsigned long flags; | ||
28 | int offset; | ||
29 | int ret; | ||
30 | |||
31 | if (!chip) | ||
32 | return -EINVAL; | ||
33 | |||
34 | offset = pin - chip->chip.base; | ||
35 | |||
36 | s3c_gpio_lock(chip, flags); | ||
37 | ret = s3c_gpio_do_setcfg(chip, offset, config); | ||
38 | s3c_gpio_unlock(chip, flags); | ||
39 | |||
40 | return ret; | ||
41 | } | ||
42 | EXPORT_SYMBOL(s3c_gpio_cfgpin); | ||
43 | |||
44 | int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr, | ||
45 | unsigned int cfg) | ||
46 | { | ||
47 | int ret; | ||
48 | |||
49 | for (; nr > 0; nr--, start++) { | ||
50 | ret = s3c_gpio_cfgpin(start, cfg); | ||
51 | if (ret != 0) | ||
52 | return ret; | ||
53 | } | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | EXPORT_SYMBOL_GPL(s3c_gpio_cfgpin_range); | ||
58 | |||
59 | int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr, | ||
60 | unsigned int cfg, s3c_gpio_pull_t pull) | ||
61 | { | ||
62 | int ret; | ||
63 | |||
64 | for (; nr > 0; nr--, start++) { | ||
65 | s3c_gpio_setpull(start, pull); | ||
66 | ret = s3c_gpio_cfgpin(start, cfg); | ||
67 | if (ret != 0) | ||
68 | return ret; | ||
69 | } | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | EXPORT_SYMBOL_GPL(s3c_gpio_cfgall_range); | ||
74 | |||
75 | unsigned s3c_gpio_getcfg(unsigned int pin) | ||
76 | { | ||
77 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
78 | unsigned long flags; | ||
79 | unsigned ret = 0; | ||
80 | int offset; | ||
81 | |||
82 | if (chip) { | ||
83 | offset = pin - chip->chip.base; | ||
84 | |||
85 | s3c_gpio_lock(chip, flags); | ||
86 | ret = s3c_gpio_do_getcfg(chip, offset); | ||
87 | s3c_gpio_unlock(chip, flags); | ||
88 | } | ||
89 | |||
90 | return ret; | ||
91 | } | ||
92 | EXPORT_SYMBOL(s3c_gpio_getcfg); | ||
93 | |||
94 | |||
95 | int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull) | ||
96 | { | ||
97 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
98 | unsigned long flags; | ||
99 | int offset, ret; | ||
100 | |||
101 | if (!chip) | ||
102 | return -EINVAL; | ||
103 | |||
104 | offset = pin - chip->chip.base; | ||
105 | |||
106 | s3c_gpio_lock(chip, flags); | ||
107 | ret = s3c_gpio_do_setpull(chip, offset, pull); | ||
108 | s3c_gpio_unlock(chip, flags); | ||
109 | |||
110 | return ret; | ||
111 | } | ||
112 | EXPORT_SYMBOL(s3c_gpio_setpull); | ||
113 | |||
114 | s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin) | ||
115 | { | ||
116 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
117 | unsigned long flags; | ||
118 | int offset; | ||
119 | u32 pup = 0; | ||
120 | |||
121 | if (chip) { | ||
122 | offset = pin - chip->chip.base; | ||
123 | |||
124 | s3c_gpio_lock(chip, flags); | ||
125 | pup = s3c_gpio_do_getpull(chip, offset); | ||
126 | s3c_gpio_unlock(chip, flags); | ||
127 | } | ||
128 | |||
129 | return (__force s3c_gpio_pull_t)pup; | ||
130 | } | ||
131 | EXPORT_SYMBOL(s3c_gpio_getpull); | ||
132 | |||
133 | #ifdef CONFIG_S3C_GPIO_CFG_S3C24XX | ||
134 | int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip, | ||
135 | unsigned int off, unsigned int cfg) | ||
136 | { | ||
137 | void __iomem *reg = chip->base; | ||
138 | unsigned int shift = off; | ||
139 | u32 con; | ||
140 | |||
141 | if (s3c_gpio_is_cfg_special(cfg)) { | ||
142 | cfg &= 0xf; | ||
143 | |||
144 | /* Map output to 0, and SFN2 to 1 */ | ||
145 | cfg -= 1; | ||
146 | if (cfg > 1) | ||
147 | return -EINVAL; | ||
148 | |||
149 | cfg <<= shift; | ||
150 | } | ||
151 | |||
152 | con = __raw_readl(reg); | ||
153 | con &= ~(0x1 << shift); | ||
154 | con |= cfg; | ||
155 | __raw_writel(con, reg); | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | unsigned s3c_gpio_getcfg_s3c24xx_a(struct s3c_gpio_chip *chip, | ||
161 | unsigned int off) | ||
162 | { | ||
163 | u32 con; | ||
164 | |||
165 | con = __raw_readl(chip->base); | ||
166 | con >>= off; | ||
167 | con &= 1; | ||
168 | con++; | ||
169 | |||
170 | return S3C_GPIO_SFN(con); | ||
171 | } | ||
172 | |||
173 | int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, | ||
174 | unsigned int off, unsigned int cfg) | ||
175 | { | ||
176 | void __iomem *reg = chip->base; | ||
177 | unsigned int shift = off * 2; | ||
178 | u32 con; | ||
179 | |||
180 | if (s3c_gpio_is_cfg_special(cfg)) { | ||
181 | cfg &= 0xf; | ||
182 | if (cfg > 3) | ||
183 | return -EINVAL; | ||
184 | |||
185 | cfg <<= shift; | ||
186 | } | ||
187 | |||
188 | con = __raw_readl(reg); | ||
189 | con &= ~(0x3 << shift); | ||
190 | con |= cfg; | ||
191 | __raw_writel(con, reg); | ||
192 | |||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | unsigned int s3c_gpio_getcfg_s3c24xx(struct s3c_gpio_chip *chip, | ||
197 | unsigned int off) | ||
198 | { | ||
199 | u32 con; | ||
200 | |||
201 | con = __raw_readl(chip->base); | ||
202 | con >>= off * 2; | ||
203 | con &= 3; | ||
204 | |||
205 | /* this conversion works for IN and OUT as well as special mode */ | ||
206 | return S3C_GPIO_SPECIAL(con); | ||
207 | } | ||
208 | #endif | ||
209 | |||
210 | #ifdef CONFIG_S3C_GPIO_CFG_S3C64XX | ||
211 | int s3c_gpio_setcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | ||
212 | unsigned int off, unsigned int cfg) | ||
213 | { | ||
214 | void __iomem *reg = chip->base; | ||
215 | unsigned int shift = (off & 7) * 4; | ||
216 | u32 con; | ||
217 | |||
218 | if (off < 8 && chip->chip.ngpio > 8) | ||
219 | reg -= 4; | ||
220 | |||
221 | if (s3c_gpio_is_cfg_special(cfg)) { | ||
222 | cfg &= 0xf; | ||
223 | cfg <<= shift; | ||
224 | } | ||
225 | |||
226 | con = __raw_readl(reg); | ||
227 | con &= ~(0xf << shift); | ||
228 | con |= cfg; | ||
229 | __raw_writel(con, reg); | ||
230 | |||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | unsigned s3c_gpio_getcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | ||
235 | unsigned int off) | ||
236 | { | ||
237 | void __iomem *reg = chip->base; | ||
238 | unsigned int shift = (off & 7) * 4; | ||
239 | u32 con; | ||
240 | |||
241 | if (off < 8 && chip->chip.ngpio > 8) | ||
242 | reg -= 4; | ||
243 | |||
244 | con = __raw_readl(reg); | ||
245 | con >>= shift; | ||
246 | con &= 0xf; | ||
247 | |||
248 | /* this conversion works for IN and OUT as well as special mode */ | ||
249 | return S3C_GPIO_SPECIAL(con); | ||
250 | } | ||
251 | |||
252 | #endif /* CONFIG_S3C_GPIO_CFG_S3C64XX */ | ||
253 | |||
254 | #ifdef CONFIG_S3C_GPIO_PULL_UPDOWN | ||
255 | int s3c_gpio_setpull_updown(struct s3c_gpio_chip *chip, | ||
256 | unsigned int off, s3c_gpio_pull_t pull) | ||
257 | { | ||
258 | void __iomem *reg = chip->base + 0x08; | ||
259 | int shift = off * 2; | ||
260 | u32 pup; | ||
261 | |||
262 | pup = __raw_readl(reg); | ||
263 | pup &= ~(3 << shift); | ||
264 | pup |= pull << shift; | ||
265 | __raw_writel(pup, reg); | ||
266 | |||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip, | ||
271 | unsigned int off) | ||
272 | { | ||
273 | void __iomem *reg = chip->base + 0x08; | ||
274 | int shift = off * 2; | ||
275 | u32 pup = __raw_readl(reg); | ||
276 | |||
277 | pup >>= shift; | ||
278 | pup &= 0x3; | ||
279 | return (__force s3c_gpio_pull_t)pup; | ||
280 | } | ||
281 | |||
282 | #ifdef CONFIG_S3C_GPIO_PULL_S3C2443 | ||
283 | int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip, | ||
284 | unsigned int off, s3c_gpio_pull_t pull) | ||
285 | { | ||
286 | switch (pull) { | ||
287 | case S3C_GPIO_PULL_NONE: | ||
288 | pull = 0x01; | ||
289 | break; | ||
290 | case S3C_GPIO_PULL_UP: | ||
291 | pull = 0x00; | ||
292 | break; | ||
293 | case S3C_GPIO_PULL_DOWN: | ||
294 | pull = 0x02; | ||
295 | break; | ||
296 | } | ||
297 | return s3c_gpio_setpull_updown(chip, off, pull); | ||
298 | } | ||
299 | |||
300 | s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip, | ||
301 | unsigned int off) | ||
302 | { | ||
303 | s3c_gpio_pull_t pull; | ||
304 | |||
305 | pull = s3c_gpio_getpull_updown(chip, off); | ||
306 | |||
307 | switch (pull) { | ||
308 | case 0x00: | ||
309 | pull = S3C_GPIO_PULL_UP; | ||
310 | break; | ||
311 | case 0x01: | ||
312 | case 0x03: | ||
313 | pull = S3C_GPIO_PULL_NONE; | ||
314 | break; | ||
315 | case 0x02: | ||
316 | pull = S3C_GPIO_PULL_DOWN; | ||
317 | break; | ||
318 | } | ||
319 | |||
320 | return pull; | ||
321 | } | ||
322 | #endif | ||
323 | #endif | ||
324 | |||
325 | #if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN) | ||
326 | static int s3c_gpio_setpull_1(struct s3c_gpio_chip *chip, | ||
327 | unsigned int off, s3c_gpio_pull_t pull, | ||
328 | s3c_gpio_pull_t updown) | ||
329 | { | ||
330 | void __iomem *reg = chip->base + 0x08; | ||
331 | u32 pup = __raw_readl(reg); | ||
332 | |||
333 | if (pull == updown) | ||
334 | pup &= ~(1 << off); | ||
335 | else if (pull == S3C_GPIO_PULL_NONE) | ||
336 | pup |= (1 << off); | ||
337 | else | ||
338 | return -EINVAL; | ||
339 | |||
340 | __raw_writel(pup, reg); | ||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static s3c_gpio_pull_t s3c_gpio_getpull_1(struct s3c_gpio_chip *chip, | ||
345 | unsigned int off, s3c_gpio_pull_t updown) | ||
346 | { | ||
347 | void __iomem *reg = chip->base + 0x08; | ||
348 | u32 pup = __raw_readl(reg); | ||
349 | |||
350 | pup &= (1 << off); | ||
351 | return pup ? S3C_GPIO_PULL_NONE : updown; | ||
352 | } | ||
353 | #endif /* CONFIG_S3C_GPIO_PULL_UP || CONFIG_S3C_GPIO_PULL_DOWN */ | ||
354 | |||
355 | #ifdef CONFIG_S3C_GPIO_PULL_UP | ||
356 | s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, | ||
357 | unsigned int off) | ||
358 | { | ||
359 | return s3c_gpio_getpull_1(chip, off, S3C_GPIO_PULL_UP); | ||
360 | } | ||
361 | |||
362 | int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip, | ||
363 | unsigned int off, s3c_gpio_pull_t pull) | ||
364 | { | ||
365 | return s3c_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_UP); | ||
366 | } | ||
367 | #endif /* CONFIG_S3C_GPIO_PULL_UP */ | ||
368 | |||
369 | #ifdef CONFIG_S3C_GPIO_PULL_DOWN | ||
370 | s3c_gpio_pull_t s3c_gpio_getpull_1down(struct s3c_gpio_chip *chip, | ||
371 | unsigned int off) | ||
372 | { | ||
373 | return s3c_gpio_getpull_1(chip, off, S3C_GPIO_PULL_DOWN); | ||
374 | } | ||
375 | |||
376 | int s3c_gpio_setpull_1down(struct s3c_gpio_chip *chip, | ||
377 | unsigned int off, s3c_gpio_pull_t pull) | ||
378 | { | ||
379 | return s3c_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_DOWN); | ||
380 | } | ||
381 | #endif /* CONFIG_S3C_GPIO_PULL_DOWN */ | ||
382 | |||
383 | #ifdef CONFIG_S5P_GPIO_DRVSTR | ||
384 | s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin) | ||
385 | { | ||
386 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
387 | unsigned int off; | ||
388 | void __iomem *reg; | ||
389 | int shift; | ||
390 | u32 drvstr; | ||
391 | |||
392 | if (!chip) | ||
393 | return -EINVAL; | ||
394 | |||
395 | off = pin - chip->chip.base; | ||
396 | shift = off * 2; | ||
397 | reg = chip->base + 0x0C; | ||
398 | |||
399 | drvstr = __raw_readl(reg); | ||
400 | drvstr = drvstr >> shift; | ||
401 | drvstr &= 0x3; | ||
402 | |||
403 | return (__force s5p_gpio_drvstr_t)drvstr; | ||
404 | } | ||
405 | EXPORT_SYMBOL(s5p_gpio_get_drvstr); | ||
406 | |||
407 | int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr) | ||
408 | { | ||
409 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
410 | unsigned int off; | ||
411 | void __iomem *reg; | ||
412 | int shift; | ||
413 | u32 tmp; | ||
414 | |||
415 | if (!chip) | ||
416 | return -EINVAL; | ||
417 | |||
418 | off = pin - chip->chip.base; | ||
419 | shift = off * 2; | ||
420 | reg = chip->base + 0x0C; | ||
421 | |||
422 | tmp = __raw_readl(reg); | ||
423 | tmp &= ~(0x3 << shift); | ||
424 | tmp |= drvstr << shift; | ||
425 | |||
426 | __raw_writel(tmp, reg); | ||
427 | |||
428 | return 0; | ||
429 | } | ||
430 | EXPORT_SYMBOL(s5p_gpio_set_drvstr); | ||
431 | #endif /* CONFIG_S5P_GPIO_DRVSTR */ | ||
diff --git a/arch/arm/plat-samsung/gpio.c b/arch/arm/plat-samsung/gpio.c deleted file mode 100644 index 7743c4b8b2fb..000000000000 --- a/arch/arm/plat-samsung/gpio.c +++ /dev/null | |||
@@ -1,167 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c/gpio.c | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * S3C series GPIO core | ||
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/init.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/spinlock.h> | ||
19 | |||
20 | #include <plat/gpio-core.h> | ||
21 | |||
22 | #ifdef CONFIG_S3C_GPIO_TRACK | ||
23 | struct s3c_gpio_chip *s3c_gpios[S3C_GPIO_END]; | ||
24 | |||
25 | static __init void s3c_gpiolib_track(struct s3c_gpio_chip *chip) | ||
26 | { | ||
27 | unsigned int gpn; | ||
28 | int i; | ||
29 | |||
30 | gpn = chip->chip.base; | ||
31 | for (i = 0; i < chip->chip.ngpio; i++, gpn++) { | ||
32 | BUG_ON(gpn >= ARRAY_SIZE(s3c_gpios)); | ||
33 | s3c_gpios[gpn] = chip; | ||
34 | } | ||
35 | } | ||
36 | #endif /* CONFIG_S3C_GPIO_TRACK */ | ||
37 | |||
38 | /* Default routines for controlling GPIO, based on the original S3C24XX | ||
39 | * GPIO functions which deal with the case where each gpio bank of the | ||
40 | * chip is as following: | ||
41 | * | ||
42 | * base + 0x00: Control register, 2 bits per gpio | ||
43 | * gpio n: 2 bits starting at (2*n) | ||
44 | * 00 = input, 01 = output, others mean special-function | ||
45 | * base + 0x04: Data register, 1 bit per gpio | ||
46 | * bit n: data bit n | ||
47 | */ | ||
48 | |||
49 | static int s3c_gpiolib_input(struct gpio_chip *chip, unsigned offset) | ||
50 | { | ||
51 | struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip); | ||
52 | void __iomem *base = ourchip->base; | ||
53 | unsigned long flags; | ||
54 | unsigned long con; | ||
55 | |||
56 | s3c_gpio_lock(ourchip, flags); | ||
57 | |||
58 | con = __raw_readl(base + 0x00); | ||
59 | con &= ~(3 << (offset * 2)); | ||
60 | |||
61 | __raw_writel(con, base + 0x00); | ||
62 | |||
63 | s3c_gpio_unlock(ourchip, flags); | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int s3c_gpiolib_output(struct gpio_chip *chip, | ||
68 | unsigned offset, int value) | ||
69 | { | ||
70 | struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip); | ||
71 | void __iomem *base = ourchip->base; | ||
72 | unsigned long flags; | ||
73 | unsigned long dat; | ||
74 | unsigned long con; | ||
75 | |||
76 | s3c_gpio_lock(ourchip, flags); | ||
77 | |||
78 | dat = __raw_readl(base + 0x04); | ||
79 | dat &= ~(1 << offset); | ||
80 | if (value) | ||
81 | dat |= 1 << offset; | ||
82 | __raw_writel(dat, base + 0x04); | ||
83 | |||
84 | con = __raw_readl(base + 0x00); | ||
85 | con &= ~(3 << (offset * 2)); | ||
86 | con |= 1 << (offset * 2); | ||
87 | |||
88 | __raw_writel(con, base + 0x00); | ||
89 | __raw_writel(dat, base + 0x04); | ||
90 | |||
91 | s3c_gpio_unlock(ourchip, flags); | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static void s3c_gpiolib_set(struct gpio_chip *chip, | ||
96 | unsigned offset, int value) | ||
97 | { | ||
98 | struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip); | ||
99 | void __iomem *base = ourchip->base; | ||
100 | unsigned long flags; | ||
101 | unsigned long dat; | ||
102 | |||
103 | s3c_gpio_lock(ourchip, flags); | ||
104 | |||
105 | dat = __raw_readl(base + 0x04); | ||
106 | dat &= ~(1 << offset); | ||
107 | if (value) | ||
108 | dat |= 1 << offset; | ||
109 | __raw_writel(dat, base + 0x04); | ||
110 | |||
111 | s3c_gpio_unlock(ourchip, flags); | ||
112 | } | ||
113 | |||
114 | static int s3c_gpiolib_get(struct gpio_chip *chip, unsigned offset) | ||
115 | { | ||
116 | struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip); | ||
117 | unsigned long val; | ||
118 | |||
119 | val = __raw_readl(ourchip->base + 0x04); | ||
120 | val >>= offset; | ||
121 | val &= 1; | ||
122 | |||
123 | return val; | ||
124 | } | ||
125 | |||
126 | __init void s3c_gpiolib_add(struct s3c_gpio_chip *chip) | ||
127 | { | ||
128 | struct gpio_chip *gc = &chip->chip; | ||
129 | int ret; | ||
130 | |||
131 | BUG_ON(!chip->base); | ||
132 | BUG_ON(!gc->label); | ||
133 | BUG_ON(!gc->ngpio); | ||
134 | |||
135 | spin_lock_init(&chip->lock); | ||
136 | |||
137 | if (!gc->direction_input) | ||
138 | gc->direction_input = s3c_gpiolib_input; | ||
139 | if (!gc->direction_output) | ||
140 | gc->direction_output = s3c_gpiolib_output; | ||
141 | if (!gc->set) | ||
142 | gc->set = s3c_gpiolib_set; | ||
143 | if (!gc->get) | ||
144 | gc->get = s3c_gpiolib_get; | ||
145 | |||
146 | #ifdef CONFIG_PM | ||
147 | if (chip->pm != NULL) { | ||
148 | if (!chip->pm->save || !chip->pm->resume) | ||
149 | printk(KERN_ERR "gpio: %s has missing PM functions\n", | ||
150 | gc->label); | ||
151 | } else | ||
152 | printk(KERN_ERR "gpio: %s has no PM function\n", gc->label); | ||
153 | #endif | ||
154 | |||
155 | /* gpiochip_add() prints own failure message on error. */ | ||
156 | ret = gpiochip_add(gc); | ||
157 | if (ret >= 0) | ||
158 | s3c_gpiolib_track(chip); | ||
159 | } | ||
160 | |||
161 | int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset) | ||
162 | { | ||
163 | struct s3c_gpio_chip *s3c_chip = container_of(chip, | ||
164 | struct s3c_gpio_chip, chip); | ||
165 | |||
166 | return s3c_chip->irq_base + offset; | ||
167 | } | ||
diff --git a/arch/arm/plat-samsung/include/plat/adc-core.h b/arch/arm/plat-samsung/include/plat/adc-core.h index a281568d5856..a927bee55359 100644 --- a/arch/arm/plat-samsung/include/plat/adc-core.h +++ b/arch/arm/plat-samsung/include/plat/adc-core.h | |||
@@ -20,7 +20,7 @@ | |||
20 | /* re-define device name depending on support. */ | 20 | /* re-define device name depending on support. */ |
21 | static inline void s3c_adc_setname(char *name) | 21 | static inline void s3c_adc_setname(char *name) |
22 | { | 22 | { |
23 | #ifdef CONFIG_SAMSUNG_DEV_ADC | 23 | #if defined(CONFIG_SAMSUNG_DEV_ADC) || defined(CONFIG_PLAT_S3C24XX) |
24 | s3c_device_adc.name = name; | 24 | s3c_device_adc.name = name; |
25 | #endif | 25 | #endif |
26 | } | 26 | } |
diff --git a/arch/arm/plat-samsung/include/plat/audio-simtec.h b/arch/arm/plat-samsung/include/plat/audio-simtec.h new file mode 100644 index 000000000000..5345364e7420 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/audio-simtec.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/audio-simtec.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
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 | * Simtec Audio support. | ||
12 | */ | ||
13 | |||
14 | /** | ||
15 | * struct s3c24xx_audio_simtec_pdata - platform data for simtec audio | ||
16 | * @use_mpllin: Select codec clock from MPLLin | ||
17 | * @output_cdclk: Need to output CDCLK to the codec | ||
18 | * @have_mic: Set if we have a MIC socket | ||
19 | * @have_lout: Set if we have a LineOut socket | ||
20 | * @amp_gpio: GPIO pin to enable the AMP | ||
21 | * @amp_gain: Option GPIO to control AMP gain | ||
22 | */ | ||
23 | struct s3c24xx_audio_simtec_pdata { | ||
24 | unsigned int use_mpllin:1; | ||
25 | unsigned int output_cdclk:1; | ||
26 | |||
27 | unsigned int have_mic:1; | ||
28 | unsigned int have_lout:1; | ||
29 | |||
30 | int amp_gpio; | ||
31 | int amp_gain[2]; | ||
32 | |||
33 | void (*startup)(void); | ||
34 | }; | ||
35 | |||
36 | extern int simtec_audio_add(const char *codec_name, bool has_lr_routing, | ||
37 | struct s3c24xx_audio_simtec_pdata *pdata); | ||
diff --git a/arch/arm/plat-samsung/include/plat/backlight.h b/arch/arm/plat-samsung/include/plat/backlight.h index 51d8da846a62..ad530c78fe8c 100644 --- a/arch/arm/plat-samsung/include/plat/backlight.h +++ b/arch/arm/plat-samsung/include/plat/backlight.h | |||
@@ -20,7 +20,7 @@ struct samsung_bl_gpio_info { | |||
20 | int func; | 20 | int func; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | extern void samsung_bl_set(struct samsung_bl_gpio_info *gpio_info, | 23 | extern void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info, |
24 | struct platform_pwm_backlight_data *bl_data); | 24 | struct platform_pwm_backlight_data *bl_data); |
25 | 25 | ||
26 | #endif /* __ASM_PLAT_BACKLIGHT_H */ | 26 | #endif /* __ASM_PLAT_BACKLIGHT_H */ |
diff --git a/arch/arm/plat-samsung/include/plat/camport.h b/arch/arm/plat-samsung/include/plat/camport.h new file mode 100644 index 000000000000..a5708bf84b3a --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/camport.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Samsung Electronics Co., Ltd. | ||
3 | * | ||
4 | * S5P series camera interface helper functions | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __PLAT_SAMSUNG_CAMPORT_H_ | ||
12 | #define __PLAT_SAMSUNG_CAMPORT_H_ __FILE__ | ||
13 | |||
14 | enum s5p_camport_id { | ||
15 | S5P_CAMPORT_A, | ||
16 | S5P_CAMPORT_B, | ||
17 | }; | ||
18 | |||
19 | /* | ||
20 | * The helper functions to configure GPIO for the camera parallel bus. | ||
21 | * The camera port can be multiplexed with any FIMC entity, even multiple | ||
22 | * FIMC entities are allowed to be attached to a single port simultaneously. | ||
23 | * These functions are to be used in the board setup code. | ||
24 | */ | ||
25 | int s5pv210_fimc_setup_gpio(enum s5p_camport_id id); | ||
26 | int exynos4_fimc_setup_gpio(enum s5p_camport_id id); | ||
27 | |||
28 | #endif /* __PLAT_SAMSUNG_CAMPORT_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h index 87d5b38a86fb..73c66d4d10fa 100644 --- a/arch/arm/plat-samsung/include/plat/clock.h +++ b/arch/arm/plat-samsung/include/plat/clock.h | |||
@@ -9,6 +9,9 @@ | |||
9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #ifndef __ASM_PLAT_CLOCK_H | ||
13 | #define __ASM_PLAT_CLOCK_H __FILE__ | ||
14 | |||
12 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
13 | #include <linux/clkdev.h> | 16 | #include <linux/clkdev.h> |
14 | 17 | ||
@@ -121,3 +124,8 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable); | |||
121 | 124 | ||
122 | extern void s3c_pwmclk_init(void); | 125 | extern void s3c_pwmclk_init(void); |
123 | 126 | ||
127 | /* Global watchdog clock used by arch_wtd_reset() callback */ | ||
128 | |||
129 | extern struct clk *s3c2410_wdtclk; | ||
130 | |||
131 | #endif /* __ASM_PLAT_CLOCK_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/common-smdk.h b/arch/arm/plat-samsung/include/plat/common-smdk.h new file mode 100644 index 000000000000..ba028f1ed30b --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/common-smdk.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/common-smdk.h | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Common code for SMDK2410 and SMDK2440 boards | ||
7 | * | ||
8 | * http://www.fluff.org/ben/smdk2440/ | ||
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 | extern void smdk_machine_init(void); | ||
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h new file mode 100644 index 000000000000..dac4760c0f0a --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h | |||
@@ -0,0 +1,288 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/cpu-freq-core.h | ||
2 | * | ||
3 | * Copyright (c) 2006-2009 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * S3C CPU frequency scaling support - core support | ||
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 <plat/cpu-freq.h> | ||
15 | |||
16 | struct seq_file; | ||
17 | |||
18 | #define MAX_BANKS (8) | ||
19 | #define S3C2412_MAX_IO (8) | ||
20 | |||
21 | /** | ||
22 | * struct s3c2410_iobank_timing - IO bank timings for S3C2410 style timings | ||
23 | * @bankcon: The cached version of settings in this structure. | ||
24 | * @tacp: | ||
25 | * @tacs: Time from address valid to nCS asserted. | ||
26 | * @tcos: Time from nCS asserted to nOE or nWE asserted. | ||
27 | * @tacc: Time that nOE or nWE is asserted. | ||
28 | * @tcoh: Time nCS is held after nOE or nWE are released. | ||
29 | * @tcah: Time address is held for after | ||
30 | * @nwait_en: Whether nWAIT is enabled for this bank. | ||
31 | * | ||
32 | * This structure represents the IO timings for a S3C2410 style IO bank | ||
33 | * used by the CPU frequency support if it needs to change the settings | ||
34 | * of the IO. | ||
35 | */ | ||
36 | struct s3c2410_iobank_timing { | ||
37 | unsigned long bankcon; | ||
38 | unsigned int tacp; | ||
39 | unsigned int tacs; | ||
40 | unsigned int tcos; | ||
41 | unsigned int tacc; | ||
42 | unsigned int tcoh; /* nCS hold afrer nOE/nWE */ | ||
43 | unsigned int tcah; /* Address hold after nCS */ | ||
44 | unsigned char nwait_en; /* nWait enabled for bank. */ | ||
45 | }; | ||
46 | |||
47 | /** | ||
48 | * struct s3c2412_iobank_timing - io timings for PL092 (S3C2412) style IO | ||
49 | * @idcy: The idle cycle time between transactions. | ||
50 | * @wstrd: nCS release to end of read cycle. | ||
51 | * @wstwr: nCS release to end of write cycle. | ||
52 | * @wstoen: nCS assertion to nOE assertion time. | ||
53 | * @wstwen: nCS assertion to nWE assertion time. | ||
54 | * @wstbrd: Burst ready delay. | ||
55 | * @smbidcyr: Register cache for smbidcyr value. | ||
56 | * @smbwstrd: Register cache for smbwstrd value. | ||
57 | * @smbwstwr: Register cache for smbwstwr value. | ||
58 | * @smbwstoen: Register cache for smbwstoen value. | ||
59 | * @smbwstwen: Register cache for smbwstwen value. | ||
60 | * @smbwstbrd: Register cache for smbwstbrd value. | ||
61 | * | ||
62 | * Timing information for a IO bank on an S3C2412 or similar system which | ||
63 | * uses a PL093 block. | ||
64 | */ | ||
65 | struct s3c2412_iobank_timing { | ||
66 | unsigned int idcy; | ||
67 | unsigned int wstrd; | ||
68 | unsigned int wstwr; | ||
69 | unsigned int wstoen; | ||
70 | unsigned int wstwen; | ||
71 | unsigned int wstbrd; | ||
72 | |||
73 | /* register cache */ | ||
74 | unsigned char smbidcyr; | ||
75 | unsigned char smbwstrd; | ||
76 | unsigned char smbwstwr; | ||
77 | unsigned char smbwstoen; | ||
78 | unsigned char smbwstwen; | ||
79 | unsigned char smbwstbrd; | ||
80 | }; | ||
81 | |||
82 | union s3c_iobank { | ||
83 | struct s3c2410_iobank_timing *io_2410; | ||
84 | struct s3c2412_iobank_timing *io_2412; | ||
85 | }; | ||
86 | |||
87 | /** | ||
88 | * struct s3c_iotimings - Chip IO timings holder | ||
89 | * @bank: The timings for each IO bank. | ||
90 | */ | ||
91 | struct s3c_iotimings { | ||
92 | union s3c_iobank bank[MAX_BANKS]; | ||
93 | }; | ||
94 | |||
95 | /** | ||
96 | * struct s3c_plltab - PLL table information. | ||
97 | * @vals: List of PLL values. | ||
98 | * @size: Size of the PLL table @vals. | ||
99 | */ | ||
100 | struct s3c_plltab { | ||
101 | struct s3c_pllval *vals; | ||
102 | int size; | ||
103 | }; | ||
104 | |||
105 | /** | ||
106 | * struct s3c_cpufreq_config - current cpu frequency configuration | ||
107 | * @freq: The current settings for the core clocks. | ||
108 | * @max: Maxium settings, derived from core, board and user settings. | ||
109 | * @pll: The PLL table entry for the current PLL settings. | ||
110 | * @divs: The divisor settings for the core clocks. | ||
111 | * @info: The current core driver information. | ||
112 | * @board: The information for the board we are running on. | ||
113 | * @lock_pll: Set if the PLL settings cannot be changed. | ||
114 | * | ||
115 | * This is for the core drivers that need to know information about | ||
116 | * the current settings and values. It should not be needed by any | ||
117 | * device drivers. | ||
118 | */ | ||
119 | struct s3c_cpufreq_config { | ||
120 | struct s3c_freq freq; | ||
121 | struct s3c_freq max; | ||
122 | struct cpufreq_frequency_table pll; | ||
123 | struct s3c_clkdivs divs; | ||
124 | struct s3c_cpufreq_info *info; /* for core, not drivers */ | ||
125 | struct s3c_cpufreq_board *board; | ||
126 | |||
127 | unsigned int lock_pll:1; | ||
128 | }; | ||
129 | |||
130 | /** | ||
131 | * struct s3c_cpufreq_info - Information for the CPU frequency driver. | ||
132 | * @name: The name of this implementation. | ||
133 | * @max: The maximum frequencies for the system. | ||
134 | * @latency: Transition latency to give to cpufreq. | ||
135 | * @locktime_m: The lock-time in uS for the MPLL. | ||
136 | * @locktime_u: The lock-time in uS for the UPLL. | ||
137 | * @locttime_bits: The number of bits each LOCKTIME field. | ||
138 | * @need_pll: Set if this driver needs to change the PLL values to achieve | ||
139 | * any frequency changes. This is really only need by devices like the | ||
140 | * S3C2410 where there is no or limited divider between the PLL and the | ||
141 | * ARMCLK. | ||
142 | * @resume_clocks: Update the clocks on resume. | ||
143 | * @get_iotiming: Get the current IO timing data, mainly for use at start. | ||
144 | * @set_iotiming: Update the IO timings from the cached copies calculated | ||
145 | * from the @calc_iotiming entry when changing the frequency. | ||
146 | * @calc_iotiming: Calculate and update the cached copies of the IO timings | ||
147 | * from the newly calculated frequencies. | ||
148 | * @calc_freqtable: Calculate (fill in) the given frequency table from the | ||
149 | * current frequency configuration. If the table passed in is NULL, | ||
150 | * then the return is the number of elements to be filled for allocation | ||
151 | * of the table. | ||
152 | * @set_refresh: Set the memory refresh configuration. | ||
153 | * @set_fvco: Set the PLL frequencies. | ||
154 | * @set_divs: Update the clock divisors. | ||
155 | * @calc_divs: Calculate the clock divisors. | ||
156 | */ | ||
157 | struct s3c_cpufreq_info { | ||
158 | const char *name; | ||
159 | struct s3c_freq max; | ||
160 | |||
161 | unsigned int latency; | ||
162 | |||
163 | unsigned int locktime_m; | ||
164 | unsigned int locktime_u; | ||
165 | unsigned char locktime_bits; | ||
166 | |||
167 | unsigned int need_pll:1; | ||
168 | |||
169 | /* driver routines */ | ||
170 | |||
171 | void (*resume_clocks)(void); | ||
172 | |||
173 | int (*get_iotiming)(struct s3c_cpufreq_config *cfg, | ||
174 | struct s3c_iotimings *timings); | ||
175 | |||
176 | void (*set_iotiming)(struct s3c_cpufreq_config *cfg, | ||
177 | struct s3c_iotimings *timings); | ||
178 | |||
179 | int (*calc_iotiming)(struct s3c_cpufreq_config *cfg, | ||
180 | struct s3c_iotimings *timings); | ||
181 | |||
182 | int (*calc_freqtable)(struct s3c_cpufreq_config *cfg, | ||
183 | struct cpufreq_frequency_table *t, | ||
184 | size_t table_size); | ||
185 | |||
186 | void (*debug_io_show)(struct seq_file *seq, | ||
187 | struct s3c_cpufreq_config *cfg, | ||
188 | union s3c_iobank *iob); | ||
189 | |||
190 | void (*set_refresh)(struct s3c_cpufreq_config *cfg); | ||
191 | void (*set_fvco)(struct s3c_cpufreq_config *cfg); | ||
192 | void (*set_divs)(struct s3c_cpufreq_config *cfg); | ||
193 | int (*calc_divs)(struct s3c_cpufreq_config *cfg); | ||
194 | }; | ||
195 | |||
196 | extern int s3c_cpufreq_register(struct s3c_cpufreq_info *info); | ||
197 | |||
198 | extern int s3c_plltab_register(struct cpufreq_frequency_table *plls, | ||
199 | unsigned int plls_no); | ||
200 | |||
201 | /* exports and utilities for debugfs */ | ||
202 | extern struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void); | ||
203 | extern struct s3c_iotimings *s3c_cpufreq_getiotimings(void); | ||
204 | |||
205 | extern void s3c2410_iotiming_debugfs(struct seq_file *seq, | ||
206 | struct s3c_cpufreq_config *cfg, | ||
207 | union s3c_iobank *iob); | ||
208 | |||
209 | extern void s3c2412_iotiming_debugfs(struct seq_file *seq, | ||
210 | struct s3c_cpufreq_config *cfg, | ||
211 | union s3c_iobank *iob); | ||
212 | |||
213 | #ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS | ||
214 | #define s3c_cpufreq_debugfs_call(x) x | ||
215 | #else | ||
216 | #define s3c_cpufreq_debugfs_call(x) NULL | ||
217 | #endif | ||
218 | |||
219 | /* Useful utility functions. */ | ||
220 | |||
221 | extern struct clk *s3c_cpufreq_clk_get(struct device *, const char *); | ||
222 | |||
223 | /* S3C2410 and compatible exported functions */ | ||
224 | |||
225 | extern void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg); | ||
226 | extern void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg); | ||
227 | |||
228 | #ifdef CONFIG_S3C2410_IOTIMING | ||
229 | extern int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg, | ||
230 | struct s3c_iotimings *iot); | ||
231 | |||
232 | extern int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg, | ||
233 | struct s3c_iotimings *timings); | ||
234 | |||
235 | extern void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg, | ||
236 | struct s3c_iotimings *iot); | ||
237 | #else | ||
238 | #define s3c2410_iotiming_calc NULL | ||
239 | #define s3c2410_iotiming_get NULL | ||
240 | #define s3c2410_iotiming_set NULL | ||
241 | #endif /* CONFIG_S3C2410_IOTIMING */ | ||
242 | |||
243 | /* S3C2412 compatible routines */ | ||
244 | |||
245 | extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg, | ||
246 | struct s3c_iotimings *timings); | ||
247 | |||
248 | extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg, | ||
249 | struct s3c_iotimings *timings); | ||
250 | |||
251 | extern int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg, | ||
252 | struct s3c_iotimings *iot); | ||
253 | |||
254 | extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg, | ||
255 | struct s3c_iotimings *iot); | ||
256 | |||
257 | #ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUG | ||
258 | #define s3c_freq_dbg(x...) printk(KERN_INFO x) | ||
259 | #else | ||
260 | #define s3c_freq_dbg(x...) do { if (0) printk(x); } while (0) | ||
261 | #endif /* CONFIG_CPU_FREQ_S3C24XX_DEBUG */ | ||
262 | |||
263 | #ifdef CONFIG_CPU_FREQ_S3C24XX_IODEBUG | ||
264 | #define s3c_freq_iodbg(x...) printk(KERN_INFO x) | ||
265 | #else | ||
266 | #define s3c_freq_iodbg(x...) do { if (0) printk(x); } while (0) | ||
267 | #endif /* CONFIG_CPU_FREQ_S3C24XX_IODEBUG */ | ||
268 | |||
269 | static inline int s3c_cpufreq_addfreq(struct cpufreq_frequency_table *table, | ||
270 | int index, size_t table_size, | ||
271 | unsigned int freq) | ||
272 | { | ||
273 | if (index < 0) | ||
274 | return index; | ||
275 | |||
276 | if (table) { | ||
277 | if (index >= table_size) | ||
278 | return -ENOMEM; | ||
279 | |||
280 | s3c_freq_dbg("%s: { %d = %u kHz }\n", | ||
281 | __func__, index, freq); | ||
282 | |||
283 | table[index].index = index; | ||
284 | table[index].frequency = freq; | ||
285 | } | ||
286 | |||
287 | return index + 1; | ||
288 | } | ||
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index c0a5741b23e6..40fd7b6b5e66 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h | |||
@@ -1,9 +1,12 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/cpu.h | 1 | /* linux/arch/arm/plat-samsung/include/plat/cpu.h |
2 | * | 2 | * |
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | 6 | * Copyright (c) 2004-2005 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 7 | * Ben Dooks <ben@simtec.co.uk> |
5 | * | 8 | * |
6 | * Header file for S3C24XX CPU support | 9 | * Header file for Samsung CPU support |
7 | * | 10 | * |
8 | * This program is free software; you can redistribute it and/or modify | 11 | * 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 | 12 | * it under the terms of the GNU General Public License version 2 as |
@@ -15,6 +18,108 @@ | |||
15 | #ifndef __SAMSUNG_PLAT_CPU_H | 18 | #ifndef __SAMSUNG_PLAT_CPU_H |
16 | #define __SAMSUNG_PLAT_CPU_H | 19 | #define __SAMSUNG_PLAT_CPU_H |
17 | 20 | ||
21 | extern unsigned long samsung_cpu_id; | ||
22 | |||
23 | #define S3C24XX_CPU_ID 0x32400000 | ||
24 | #define S3C24XX_CPU_MASK 0xFFF00000 | ||
25 | |||
26 | #define S3C6400_CPU_ID 0x36400000 | ||
27 | #define S3C6410_CPU_ID 0x36410000 | ||
28 | #define S3C64XX_CPU_MASK 0xFFFFF000 | ||
29 | |||
30 | #define S5P6440_CPU_ID 0x56440000 | ||
31 | #define S5P6450_CPU_ID 0x36450000 | ||
32 | #define S5P64XX_CPU_MASK 0xFFFFF000 | ||
33 | |||
34 | #define S5PC100_CPU_ID 0x43100000 | ||
35 | #define S5PC100_CPU_MASK 0xFFFFF000 | ||
36 | |||
37 | #define S5PV210_CPU_ID 0x43110000 | ||
38 | #define S5PV210_CPU_MASK 0xFFFFF000 | ||
39 | |||
40 | #define EXYNOS4210_CPU_ID 0x43210000 | ||
41 | #define EXYNOS4212_CPU_ID 0x43220000 | ||
42 | #define EXYNOS4412_CPU_ID 0xE4412200 | ||
43 | #define EXYNOS4_CPU_MASK 0xFFFE0000 | ||
44 | |||
45 | #define IS_SAMSUNG_CPU(name, id, mask) \ | ||
46 | static inline int is_samsung_##name(void) \ | ||
47 | { \ | ||
48 | return ((samsung_cpu_id & mask) == (id & mask)); \ | ||
49 | } | ||
50 | |||
51 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) | ||
52 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) | ||
53 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) | ||
54 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) | ||
55 | IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) | ||
56 | IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) | ||
57 | IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK) | ||
58 | IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK) | ||
59 | IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) | ||
60 | IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) | ||
61 | |||
62 | #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ | ||
63 | defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ | ||
64 | defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \ | ||
65 | defined(CONFIG_CPU_S3C2443) | ||
66 | # define soc_is_s3c24xx() is_samsung_s3c24xx() | ||
67 | #else | ||
68 | # define soc_is_s3c24xx() 0 | ||
69 | #endif | ||
70 | |||
71 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) | ||
72 | # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) | ||
73 | #else | ||
74 | # define soc_is_s3c64xx() 0 | ||
75 | #endif | ||
76 | |||
77 | #if defined(CONFIG_CPU_S5P6440) | ||
78 | # define soc_is_s5p6440() is_samsung_s5p6440() | ||
79 | #else | ||
80 | # define soc_is_s5p6440() 0 | ||
81 | #endif | ||
82 | |||
83 | #if defined(CONFIG_CPU_S5P6450) | ||
84 | # define soc_is_s5p6450() is_samsung_s5p6450() | ||
85 | #else | ||
86 | # define soc_is_s5p6450() 0 | ||
87 | #endif | ||
88 | |||
89 | #if defined(CONFIG_CPU_S5PC100) | ||
90 | # define soc_is_s5pc100() is_samsung_s5pc100() | ||
91 | #else | ||
92 | # define soc_is_s5pc100() 0 | ||
93 | #endif | ||
94 | |||
95 | #if defined(CONFIG_CPU_S5PV210) | ||
96 | # define soc_is_s5pv210() is_samsung_s5pv210() | ||
97 | #else | ||
98 | # define soc_is_s5pv210() 0 | ||
99 | #endif | ||
100 | |||
101 | #if defined(CONFIG_CPU_EXYNOS4210) | ||
102 | # define soc_is_exynos4210() is_samsung_exynos4210() | ||
103 | #else | ||
104 | # define soc_is_exynos4210() 0 | ||
105 | #endif | ||
106 | |||
107 | #if defined(CONFIG_SOC_EXYNOS4212) | ||
108 | # define soc_is_exynos4212() is_samsung_exynos4212() | ||
109 | #else | ||
110 | # define soc_is_exynos4212() 0 | ||
111 | #endif | ||
112 | |||
113 | #if defined(CONFIG_SOC_EXYNOS4412) | ||
114 | # define soc_is_exynos4412() is_samsung_exynos4412() | ||
115 | #else | ||
116 | # define soc_is_exynos4412() 0 | ||
117 | #endif | ||
118 | |||
119 | #define EXYNOS4210_REV_0 (0x0) | ||
120 | #define EXYNOS4210_REV_1_0 (0x10) | ||
121 | #define EXYNOS4210_REV_1_1 (0x11) | ||
122 | |||
18 | #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } | 123 | #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } |
19 | 124 | ||
20 | #ifndef MHZ | 125 | #ifndef MHZ |
@@ -55,6 +160,12 @@ extern void s3c64xx_init_io(struct map_desc *mach_desc, int size); | |||
55 | extern void s5p_init_io(struct map_desc *mach_desc, | 160 | extern void s5p_init_io(struct map_desc *mach_desc, |
56 | int size, void __iomem *cpuid_addr); | 161 | int size, void __iomem *cpuid_addr); |
57 | 162 | ||
163 | extern void s3c24xx_init_cpu(void); | ||
164 | extern void s3c64xx_init_cpu(void); | ||
165 | extern void s5p_init_cpu(void __iomem *cpuid_addr); | ||
166 | |||
167 | extern unsigned int samsung_rev(void); | ||
168 | |||
58 | extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); | 169 | extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); |
59 | 170 | ||
60 | extern void s3c24xx_init_clocks(int xtal); | 171 | extern void s3c24xx_init_clocks(int xtal); |
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h index 24ebb1e1de41..ab633c9c2aec 100644 --- a/arch/arm/plat-samsung/include/plat/devs.h +++ b/arch/arm/plat-samsung/include/plat/devs.h | |||
@@ -30,30 +30,24 @@ extern struct s3c24xx_uart_resources s5p_uart_resources[]; | |||
30 | extern struct platform_device *s3c24xx_uart_devs[]; | 30 | extern struct platform_device *s3c24xx_uart_devs[]; |
31 | extern struct platform_device *s3c24xx_uart_src[]; | 31 | extern struct platform_device *s3c24xx_uart_src[]; |
32 | 32 | ||
33 | extern struct platform_device s3c_device_timer[]; | 33 | extern struct platform_device s3c64xx_device_ac97; |
34 | |||
35 | extern struct platform_device s3c64xx_device_iis0; | 34 | extern struct platform_device s3c64xx_device_iis0; |
36 | extern struct platform_device s3c64xx_device_iis1; | 35 | extern struct platform_device s3c64xx_device_iis1; |
37 | extern struct platform_device s3c64xx_device_iisv4; | 36 | extern struct platform_device s3c64xx_device_iisv4; |
38 | 37 | extern struct platform_device s3c64xx_device_onenand1; | |
39 | extern struct platform_device s3c64xx_device_spi0; | ||
40 | extern struct platform_device s3c64xx_device_spi1; | ||
41 | |||
42 | extern struct platform_device samsung_asoc_dma; | ||
43 | extern struct platform_device samsung_asoc_idma; | ||
44 | |||
45 | extern struct platform_device s3c64xx_device_pcm0; | 38 | extern struct platform_device s3c64xx_device_pcm0; |
46 | extern struct platform_device s3c64xx_device_pcm1; | 39 | extern struct platform_device s3c64xx_device_pcm1; |
40 | extern struct platform_device s3c64xx_device_spi0; | ||
41 | extern struct platform_device s3c64xx_device_spi1; | ||
47 | 42 | ||
48 | extern struct platform_device s3c64xx_device_ac97; | 43 | extern struct platform_device s3c_device_adc; |
49 | 44 | extern struct platform_device s3c_device_cfcon; | |
50 | extern struct platform_device s3c_device_ts; | ||
51 | |||
52 | extern struct platform_device s3c_device_fb; | 45 | extern struct platform_device s3c_device_fb; |
53 | extern struct platform_device s5p_device_fimd0; | 46 | extern struct platform_device s3c_device_hwmon; |
54 | extern struct platform_device s3c_device_ohci; | 47 | extern struct platform_device s3c_device_hsmmc0; |
55 | extern struct platform_device s3c_device_lcd; | 48 | extern struct platform_device s3c_device_hsmmc1; |
56 | extern struct platform_device s3c_device_wdt; | 49 | extern struct platform_device s3c_device_hsmmc2; |
50 | extern struct platform_device s3c_device_hsmmc3; | ||
57 | extern struct platform_device s3c_device_i2c0; | 51 | extern struct platform_device s3c_device_i2c0; |
58 | extern struct platform_device s3c_device_i2c1; | 52 | extern struct platform_device s3c_device_i2c1; |
59 | extern struct platform_device s3c_device_i2c2; | 53 | extern struct platform_device s3c_device_i2c2; |
@@ -62,93 +56,90 @@ extern struct platform_device s3c_device_i2c4; | |||
62 | extern struct platform_device s3c_device_i2c5; | 56 | extern struct platform_device s3c_device_i2c5; |
63 | extern struct platform_device s3c_device_i2c6; | 57 | extern struct platform_device s3c_device_i2c6; |
64 | extern struct platform_device s3c_device_i2c7; | 58 | extern struct platform_device s3c_device_i2c7; |
59 | extern struct platform_device s3c_device_iis; | ||
60 | extern struct platform_device s3c_device_lcd; | ||
61 | extern struct platform_device s3c_device_nand; | ||
62 | extern struct platform_device s3c_device_ohci; | ||
63 | extern struct platform_device s3c_device_onenand; | ||
65 | extern struct platform_device s3c_device_rtc; | 64 | extern struct platform_device s3c_device_rtc; |
66 | extern struct platform_device s3c_device_adc; | ||
67 | extern struct platform_device s3c_device_sdi; | 65 | extern struct platform_device s3c_device_sdi; |
68 | extern struct platform_device s3c_device_iis; | ||
69 | extern struct platform_device s3c_device_hwmon; | ||
70 | extern struct platform_device s3c_device_hsmmc0; | ||
71 | extern struct platform_device s3c_device_hsmmc1; | ||
72 | extern struct platform_device s3c_device_hsmmc2; | ||
73 | extern struct platform_device s3c_device_hsmmc3; | ||
74 | extern struct platform_device s3c_device_cfcon; | ||
75 | |||
76 | extern struct platform_device s3c_device_spi0; | 66 | extern struct platform_device s3c_device_spi0; |
77 | extern struct platform_device s3c_device_spi1; | 67 | extern struct platform_device s3c_device_spi1; |
78 | 68 | extern struct platform_device s3c_device_ts; | |
79 | extern struct platform_device s5pc100_device_spi0; | 69 | extern struct platform_device s3c_device_timer[]; |
80 | extern struct platform_device s5pc100_device_spi1; | ||
81 | extern struct platform_device s5pc100_device_spi2; | ||
82 | extern struct platform_device s5pv210_device_spi0; | ||
83 | extern struct platform_device s5pv210_device_spi1; | ||
84 | extern struct platform_device s5p64x0_device_spi0; | ||
85 | extern struct platform_device s5p64x0_device_spi1; | ||
86 | |||
87 | extern struct platform_device s3c_device_hwmon; | ||
88 | |||
89 | extern struct platform_device s3c_device_nand; | ||
90 | extern struct platform_device s3c_device_onenand; | ||
91 | extern struct platform_device s3c64xx_device_onenand1; | ||
92 | extern struct platform_device s5p_device_onenand; | ||
93 | |||
94 | extern struct platform_device s3c_device_usbgadget; | 70 | extern struct platform_device s3c_device_usbgadget; |
95 | extern struct platform_device s3c_device_usb_hsudc; | ||
96 | extern struct platform_device s3c_device_usb_hsotg; | 71 | extern struct platform_device s3c_device_usb_hsotg; |
72 | extern struct platform_device s3c_device_usb_hsudc; | ||
73 | extern struct platform_device s3c_device_wdt; | ||
97 | 74 | ||
98 | extern struct platform_device s5pv210_device_ac97; | 75 | extern struct platform_device s5p_device_ehci; |
99 | extern struct platform_device s5pv210_device_pcm0; | 76 | extern struct platform_device s5p_device_fimc0; |
100 | extern struct platform_device s5pv210_device_pcm1; | 77 | extern struct platform_device s5p_device_fimc1; |
101 | extern struct platform_device s5pv210_device_pcm2; | 78 | extern struct platform_device s5p_device_fimc2; |
102 | extern struct platform_device s5pv210_device_iis0; | 79 | extern struct platform_device s5p_device_fimc3; |
103 | extern struct platform_device s5pv210_device_iis1; | 80 | extern struct platform_device s5p_device_fimc_md; |
104 | extern struct platform_device s5pv210_device_iis2; | 81 | extern struct platform_device s5p_device_fimd0; |
105 | extern struct platform_device s5pv210_device_spdif; | 82 | extern struct platform_device s5p_device_hdmi; |
106 | 83 | extern struct platform_device s5p_device_i2c_hdmiphy; | |
107 | extern struct platform_device exynos4_device_ac97; | 84 | extern struct platform_device s5p_device_mfc; |
108 | extern struct platform_device exynos4_device_pcm0; | 85 | extern struct platform_device s5p_device_mfc_l; |
109 | extern struct platform_device exynos4_device_pcm1; | 86 | extern struct platform_device s5p_device_mfc_r; |
110 | extern struct platform_device exynos4_device_pcm2; | 87 | extern struct platform_device s5p_device_mipi_csis0; |
111 | extern struct platform_device exynos4_device_i2s0; | 88 | extern struct platform_device s5p_device_mipi_csis1; |
112 | extern struct platform_device exynos4_device_i2s1; | 89 | extern struct platform_device s5p_device_mixer; |
113 | extern struct platform_device exynos4_device_i2s2; | 90 | extern struct platform_device s5p_device_onenand; |
114 | extern struct platform_device exynos4_device_spdif; | 91 | extern struct platform_device s5p_device_sdo; |
115 | extern struct platform_device exynos4_device_pd[]; | ||
116 | extern struct platform_device exynos4_device_ahci; | ||
117 | extern struct platform_device exynos4_device_dwmci; | ||
118 | 92 | ||
119 | extern struct platform_device s5p6440_device_pcm; | ||
120 | extern struct platform_device s5p6440_device_iis; | 93 | extern struct platform_device s5p6440_device_iis; |
94 | extern struct platform_device s5p6440_device_pcm; | ||
121 | 95 | ||
122 | extern struct platform_device s5p6450_device_iis0; | 96 | extern struct platform_device s5p6450_device_iis0; |
123 | extern struct platform_device s5p6450_device_iis1; | 97 | extern struct platform_device s5p6450_device_iis1; |
124 | extern struct platform_device s5p6450_device_iis2; | 98 | extern struct platform_device s5p6450_device_iis2; |
125 | extern struct platform_device s5p6450_device_pcm0; | 99 | extern struct platform_device s5p6450_device_pcm0; |
126 | 100 | ||
101 | extern struct platform_device s5p64x0_device_spi0; | ||
102 | extern struct platform_device s5p64x0_device_spi1; | ||
103 | |||
127 | extern struct platform_device s5pc100_device_ac97; | 104 | extern struct platform_device s5pc100_device_ac97; |
128 | extern struct platform_device s5pc100_device_pcm0; | ||
129 | extern struct platform_device s5pc100_device_pcm1; | ||
130 | extern struct platform_device s5pc100_device_iis0; | 105 | extern struct platform_device s5pc100_device_iis0; |
131 | extern struct platform_device s5pc100_device_iis1; | 106 | extern struct platform_device s5pc100_device_iis1; |
132 | extern struct platform_device s5pc100_device_iis2; | 107 | extern struct platform_device s5pc100_device_iis2; |
108 | extern struct platform_device s5pc100_device_pcm0; | ||
109 | extern struct platform_device s5pc100_device_pcm1; | ||
133 | extern struct platform_device s5pc100_device_spdif; | 110 | extern struct platform_device s5pc100_device_spdif; |
111 | extern struct platform_device s5pc100_device_spi0; | ||
112 | extern struct platform_device s5pc100_device_spi1; | ||
113 | extern struct platform_device s5pc100_device_spi2; | ||
134 | 114 | ||
135 | extern struct platform_device samsung_device_keypad; | 115 | extern struct platform_device s5pv210_device_ac97; |
136 | 116 | extern struct platform_device s5pv210_device_iis0; | |
137 | extern struct platform_device s5p_device_fimc0; | 117 | extern struct platform_device s5pv210_device_iis1; |
138 | extern struct platform_device s5p_device_fimc1; | 118 | extern struct platform_device s5pv210_device_iis2; |
139 | extern struct platform_device s5p_device_fimc2; | 119 | extern struct platform_device s5pv210_device_pcm0; |
140 | extern struct platform_device s5p_device_fimc3; | 120 | extern struct platform_device s5pv210_device_pcm1; |
141 | 121 | extern struct platform_device s5pv210_device_pcm2; | |
142 | extern struct platform_device s5p_device_mfc; | 122 | extern struct platform_device s5pv210_device_spdif; |
143 | extern struct platform_device s5p_device_mfc_l; | 123 | extern struct platform_device s5pv210_device_spi0; |
144 | extern struct platform_device s5p_device_mfc_r; | 124 | extern struct platform_device s5pv210_device_spi1; |
145 | extern struct platform_device s5p_device_mipi_csis0; | ||
146 | extern struct platform_device s5p_device_mipi_csis1; | ||
147 | |||
148 | extern struct platform_device s5p_device_ehci; | ||
149 | 125 | ||
126 | extern struct platform_device exynos4_device_ac97; | ||
127 | extern struct platform_device exynos4_device_ahci; | ||
128 | extern struct platform_device exynos4_device_dwmci; | ||
129 | extern struct platform_device exynos4_device_i2s0; | ||
130 | extern struct platform_device exynos4_device_i2s1; | ||
131 | extern struct platform_device exynos4_device_i2s2; | ||
132 | extern struct platform_device exynos4_device_pcm0; | ||
133 | extern struct platform_device exynos4_device_pcm1; | ||
134 | extern struct platform_device exynos4_device_pcm2; | ||
135 | extern struct platform_device exynos4_device_pd[]; | ||
136 | extern struct platform_device exynos4_device_spdif; | ||
150 | extern struct platform_device exynos4_device_sysmmu; | 137 | extern struct platform_device exynos4_device_sysmmu; |
151 | 138 | ||
139 | extern struct platform_device samsung_asoc_dma; | ||
140 | extern struct platform_device samsung_asoc_idma; | ||
141 | extern struct platform_device samsung_device_keypad; | ||
142 | |||
152 | /* s3c2440 specific devices */ | 143 | /* s3c2440 specific devices */ |
153 | 144 | ||
154 | #ifdef CONFIG_CPU_S3C2440 | 145 | #ifdef CONFIG_CPU_S3C2440 |
diff --git a/arch/arm/plat-samsung/include/plat/dma-ops.h b/arch/arm/plat-samsung/include/plat/dma-ops.h new file mode 100644 index 000000000000..4c1a363526cf --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/dma-ops.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/dma-ops.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Samsung DMA 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 | #ifndef __SAMSUNG_DMA_OPS_H_ | ||
14 | #define __SAMSUNG_DMA_OPS_H_ __FILE__ | ||
15 | |||
16 | #include <linux/dmaengine.h> | ||
17 | |||
18 | struct samsung_dma_prep_info { | ||
19 | enum dma_transaction_type cap; | ||
20 | enum dma_data_direction direction; | ||
21 | dma_addr_t buf; | ||
22 | unsigned long period; | ||
23 | unsigned long len; | ||
24 | void (*fp)(void *data); | ||
25 | void *fp_param; | ||
26 | }; | ||
27 | |||
28 | struct samsung_dma_info { | ||
29 | enum dma_transaction_type cap; | ||
30 | enum dma_data_direction direction; | ||
31 | enum dma_slave_buswidth width; | ||
32 | dma_addr_t fifo; | ||
33 | struct s3c2410_dma_client *client; | ||
34 | }; | ||
35 | |||
36 | struct samsung_dma_ops { | ||
37 | unsigned (*request)(enum dma_ch ch, struct samsung_dma_info *info); | ||
38 | int (*release)(unsigned ch, struct s3c2410_dma_client *client); | ||
39 | int (*prepare)(unsigned ch, struct samsung_dma_prep_info *info); | ||
40 | int (*trigger)(unsigned ch); | ||
41 | int (*started)(unsigned ch); | ||
42 | int (*flush)(unsigned ch); | ||
43 | int (*stop)(unsigned ch); | ||
44 | }; | ||
45 | |||
46 | extern void *samsung_dmadev_get_ops(void); | ||
47 | extern void *s3c_dma_get_ops(void); | ||
48 | |||
49 | static inline void *__samsung_dma_get_ops(void) | ||
50 | { | ||
51 | if (samsung_dma_is_dmadev()) | ||
52 | return samsung_dmadev_get_ops(); | ||
53 | else | ||
54 | return s3c_dma_get_ops(); | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * samsung_dma_get_ops | ||
59 | * get the set of samsung dma operations | ||
60 | */ | ||
61 | #define samsung_dma_get_ops() __samsung_dma_get_ops() | ||
62 | |||
63 | #endif /* __SAMSUNG_DMA_OPS_H_ */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h b/arch/arm/plat-samsung/include/plat/dma-pl330.h index 810744213120..2e55e5958674 100644 --- a/arch/arm/plat-samsung/include/plat/s3c-dma-pl330.h +++ b/arch/arm/plat-samsung/include/plat/dma-pl330.h | |||
@@ -8,11 +8,8 @@ | |||
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __S3C_DMA_PL330_H_ | 11 | #ifndef __DMA_PL330_H_ |
12 | #define __S3C_DMA_PL330_H_ | 12 | #define __DMA_PL330_H_ __FILE__ |
13 | |||
14 | #define S3C2410_DMAF_AUTOSTART (1 << 0) | ||
15 | #define S3C2410_DMAF_CIRCULAR (1 << 1) | ||
16 | 13 | ||
17 | /* | 14 | /* |
18 | * PL330 can assign any channel to communicate with | 15 | * PL330 can assign any channel to communicate with |
@@ -20,7 +17,7 @@ | |||
20 | * For the sake of consistency across client drivers, | 17 | * For the sake of consistency across client drivers, |
21 | * We keep the channel names unchanged and only add | 18 | * We keep the channel names unchanged and only add |
22 | * missing peripherals are added. | 19 | * missing peripherals are added. |
23 | * Order is not important since S3C PL330 API driver | 20 | * Order is not important since DMA PL330 API driver |
24 | * use these just as IDs. | 21 | * use these just as IDs. |
25 | */ | 22 | */ |
26 | enum dma_ch { | 23 | enum dma_ch { |
@@ -88,11 +85,20 @@ enum dma_ch { | |||
88 | DMACH_MAX, | 85 | DMACH_MAX, |
89 | }; | 86 | }; |
90 | 87 | ||
91 | static inline bool s3c_dma_has_circular(void) | 88 | struct s3c2410_dma_client { |
89 | char *name; | ||
90 | }; | ||
91 | |||
92 | static inline bool samsung_dma_has_circular(void) | ||
93 | { | ||
94 | return true; | ||
95 | } | ||
96 | |||
97 | static inline bool samsung_dma_is_dmadev(void) | ||
92 | { | 98 | { |
93 | return true; | 99 | return true; |
94 | } | 100 | } |
95 | 101 | ||
96 | #include <plat/dma.h> | 102 | #include <plat/dma-ops.h> |
97 | 103 | ||
98 | #endif /* __S3C_DMA_PL330_H_ */ | 104 | #endif /* __DMA_PL330_H_ */ |
diff --git a/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h b/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h index 336d5ac02035..1c1ed5481253 100644 --- a/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h +++ b/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h | |||
@@ -18,11 +18,6 @@ extern struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS]; | |||
18 | #define DMA_CH_VALID (1<<31) | 18 | #define DMA_CH_VALID (1<<31) |
19 | #define DMA_CH_NEVER (1<<30) | 19 | #define DMA_CH_NEVER (1<<30) |
20 | 20 | ||
21 | struct s3c24xx_dma_addr { | ||
22 | unsigned long from; | ||
23 | unsigned long to; | ||
24 | }; | ||
25 | |||
26 | /* struct s3c24xx_dma_map | 21 | /* struct s3c24xx_dma_map |
27 | * | 22 | * |
28 | * this holds the mapping information for the channel selected | 23 | * this holds the mapping information for the channel selected |
@@ -31,7 +26,6 @@ struct s3c24xx_dma_addr { | |||
31 | 26 | ||
32 | struct s3c24xx_dma_map { | 27 | struct s3c24xx_dma_map { |
33 | const char *name; | 28 | const char *name; |
34 | struct s3c24xx_dma_addr hw_addr; | ||
35 | 29 | ||
36 | unsigned long channels[S3C_DMA_CHANNELS]; | 30 | unsigned long channels[S3C_DMA_CHANNELS]; |
37 | unsigned long channels_rx[S3C_DMA_CHANNELS]; | 31 | unsigned long channels_rx[S3C_DMA_CHANNELS]; |
@@ -47,7 +41,7 @@ struct s3c24xx_dma_selection { | |||
47 | 41 | ||
48 | void (*direction)(struct s3c2410_dma_chan *chan, | 42 | void (*direction)(struct s3c2410_dma_chan *chan, |
49 | struct s3c24xx_dma_map *map, | 43 | struct s3c24xx_dma_map *map, |
50 | enum s3c2410_dmasrc dir); | 44 | enum dma_data_direction dir); |
51 | }; | 45 | }; |
52 | 46 | ||
53 | extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel); | 47 | extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel); |
diff --git a/arch/arm/plat-samsung/include/plat/dma.h b/arch/arm/plat-samsung/include/plat/dma.h index 8c273b7a6f56..b9061128abde 100644 --- a/arch/arm/plat-samsung/include/plat/dma.h +++ b/arch/arm/plat-samsung/include/plat/dma.h | |||
@@ -10,17 +10,14 @@ | |||
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/dma-mapping.h> | ||
14 | |||
13 | enum s3c2410_dma_buffresult { | 15 | enum s3c2410_dma_buffresult { |
14 | S3C2410_RES_OK, | 16 | S3C2410_RES_OK, |
15 | S3C2410_RES_ERR, | 17 | S3C2410_RES_ERR, |
16 | S3C2410_RES_ABORT | 18 | S3C2410_RES_ABORT |
17 | }; | 19 | }; |
18 | 20 | ||
19 | enum s3c2410_dmasrc { | ||
20 | S3C2410_DMASRC_HW, /* source is memory */ | ||
21 | S3C2410_DMASRC_MEM /* source is hardware */ | ||
22 | }; | ||
23 | |||
24 | /* enum s3c2410_chan_op | 21 | /* enum s3c2410_chan_op |
25 | * | 22 | * |
26 | * operation codes passed to the DMA code by the user, and also used | 23 | * operation codes passed to the DMA code by the user, and also used |
@@ -112,7 +109,7 @@ extern int s3c2410_dma_config(enum dma_ch channel, int xferunit); | |||
112 | */ | 109 | */ |
113 | 110 | ||
114 | extern int s3c2410_dma_devconfig(enum dma_ch channel, | 111 | extern int s3c2410_dma_devconfig(enum dma_ch channel, |
115 | enum s3c2410_dmasrc source, unsigned long devaddr); | 112 | enum dma_data_direction source, unsigned long devaddr); |
116 | 113 | ||
117 | /* s3c2410_dma_getposition | 114 | /* s3c2410_dma_getposition |
118 | * | 115 | * |
@@ -126,3 +123,4 @@ extern int s3c2410_dma_set_opfn(enum dma_ch, s3c2410_dma_opfn_t rtn); | |||
126 | extern int s3c2410_dma_set_buffdone_fn(enum dma_ch, s3c2410_dma_cbfn_t rtn); | 123 | extern int s3c2410_dma_set_buffdone_fn(enum dma_ch, s3c2410_dma_cbfn_t rtn); |
127 | 124 | ||
128 | 125 | ||
126 | #include <plat/dma-ops.h> | ||
diff --git a/arch/arm/plat-samsung/include/plat/ehci.h b/arch/arm/plat-samsung/include/plat/ehci.h new file mode 100644 index 000000000000..5f28cae18582 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/ehci.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Samsung Electronics Co.Ltd | ||
3 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef __PLAT_SAMSUNG_EHCI_H | ||
12 | #define __PLAT_SAMSUNG_EHCI_H __FILE__ | ||
13 | |||
14 | struct s5p_ehci_platdata { | ||
15 | int (*phy_init)(struct platform_device *pdev, int type); | ||
16 | int (*phy_exit)(struct platform_device *pdev, int type); | ||
17 | }; | ||
18 | |||
19 | extern void s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd); | ||
20 | |||
21 | #endif /* __PLAT_SAMSUNG_EHCI_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/exynos4.h b/arch/arm/plat-samsung/include/plat/exynos4.h new file mode 100644 index 000000000000..f546e88ebc94 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/exynos4.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/exynos4.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Header file for exynos4 cpu 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 | /* Common init code for EXYNOS4 related SoCs */ | ||
14 | |||
15 | extern void exynos4_common_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
16 | extern void exynos4_register_clocks(void); | ||
17 | extern void exynos4210_register_clocks(void); | ||
18 | extern void exynos4212_register_clocks(void); | ||
19 | extern void exynos4_setup_clocks(void); | ||
20 | |||
21 | #ifdef CONFIG_ARCH_EXYNOS | ||
22 | extern int exynos_init(void); | ||
23 | extern void exynos4_init_irq(void); | ||
24 | extern void exynos4_map_io(void); | ||
25 | extern void exynos4_init_clocks(int xtal); | ||
26 | extern struct sys_timer exynos4_timer; | ||
27 | |||
28 | #define exynos4_init_uarts exynos4_common_init_uarts | ||
29 | |||
30 | #else | ||
31 | #define exynos4_init_clocks NULL | ||
32 | #define exynos4_init_uarts NULL | ||
33 | #define exynos4_map_io NULL | ||
34 | #define exynos_init NULL | ||
35 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/fb-s3c2410.h b/arch/arm/plat-samsung/include/plat/fb-s3c2410.h new file mode 100644 index 000000000000..4e5d9588b5ba --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/fb-s3c2410.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/fb-s3c2410.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org> | ||
4 | * | ||
5 | * Inspired by pxafb.h | ||
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 | #ifndef __ASM_PLAT_FB_S3C2410_H | ||
13 | #define __ASM_PLAT_FB_S3C2410_H __FILE__ | ||
14 | |||
15 | struct s3c2410fb_hw { | ||
16 | unsigned long lcdcon1; | ||
17 | unsigned long lcdcon2; | ||
18 | unsigned long lcdcon3; | ||
19 | unsigned long lcdcon4; | ||
20 | unsigned long lcdcon5; | ||
21 | }; | ||
22 | |||
23 | /* LCD description */ | ||
24 | struct s3c2410fb_display { | ||
25 | /* LCD type */ | ||
26 | unsigned type; | ||
27 | |||
28 | /* Screen size */ | ||
29 | unsigned short width; | ||
30 | unsigned short height; | ||
31 | |||
32 | /* Screen info */ | ||
33 | unsigned short xres; | ||
34 | unsigned short yres; | ||
35 | unsigned short bpp; | ||
36 | |||
37 | unsigned pixclock; /* pixclock in picoseconds */ | ||
38 | unsigned short left_margin; /* value in pixels (TFT) or HCLKs (STN) */ | ||
39 | unsigned short right_margin; /* value in pixels (TFT) or HCLKs (STN) */ | ||
40 | unsigned short hsync_len; /* value in pixels (TFT) or HCLKs (STN) */ | ||
41 | unsigned short upper_margin; /* value in lines (TFT) or 0 (STN) */ | ||
42 | unsigned short lower_margin; /* value in lines (TFT) or 0 (STN) */ | ||
43 | unsigned short vsync_len; /* value in lines (TFT) or 0 (STN) */ | ||
44 | |||
45 | /* lcd configuration registers */ | ||
46 | unsigned long lcdcon5; | ||
47 | }; | ||
48 | |||
49 | struct s3c2410fb_mach_info { | ||
50 | |||
51 | struct s3c2410fb_display *displays; /* attached diplays info */ | ||
52 | unsigned num_displays; /* number of defined displays */ | ||
53 | unsigned default_display; | ||
54 | |||
55 | /* GPIOs */ | ||
56 | |||
57 | unsigned long gpcup; | ||
58 | unsigned long gpcup_mask; | ||
59 | unsigned long gpccon; | ||
60 | unsigned long gpccon_mask; | ||
61 | unsigned long gpdup; | ||
62 | unsigned long gpdup_mask; | ||
63 | unsigned long gpdcon; | ||
64 | unsigned long gpdcon_mask; | ||
65 | |||
66 | /* lpc3600 control register */ | ||
67 | unsigned long lpcsel; | ||
68 | }; | ||
69 | |||
70 | extern void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *); | ||
71 | |||
72 | #endif /* __ASM_PLAT_FB_S3C2410_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h index 01f10e4d00c7..0fedf47fa502 100644 --- a/arch/arm/plat-samsung/include/plat/fb.h +++ b/arch/arm/plat-samsung/include/plat/fb.h | |||
@@ -109,4 +109,11 @@ extern void s5pv210_fb_gpio_setup_24bpp(void); | |||
109 | */ | 109 | */ |
110 | extern void exynos4_fimd0_gpio_setup_24bpp(void); | 110 | extern void exynos4_fimd0_gpio_setup_24bpp(void); |
111 | 111 | ||
112 | /** | ||
113 | * s5p64x0_fb_gpio_setup_24bpp() - S5P6440/S5P6450 setup function for 24bpp LCD | ||
114 | * | ||
115 | * Initialise the GPIO for an 24bpp LCD display on the RGB interface. | ||
116 | */ | ||
117 | extern void s5p64x0_fb_gpio_setup_24bpp(void); | ||
118 | |||
112 | #endif /* __PLAT_S3C_FB_H */ | 119 | #endif /* __PLAT_S3C_FB_H */ |
diff --git a/arch/arm/plat-samsung/include/plat/fiq.h b/arch/arm/plat-samsung/include/plat/fiq.h new file mode 100644 index 000000000000..535d06a35628 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/fiq.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/fiq.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for S3C24XX CPU FIQ 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 | extern int s3c24xx_set_fiq(unsigned int irq, bool on); | ||
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 9a4e53d52967..a181d7ce81cf 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h +++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h | |||
@@ -1,11 +1,11 @@ | |||
1 | /* linux/arch/arm/plat-s3c/include/plat/gpio-cfg-helper.h | 1 | /* linux/arch/arm/plat-samsung/include/plat/gpio-cfg-helper.h |
2 | * | 2 | * |
3 | * Copyright 2008 Openmoko, Inc. | 3 | * Copyright 2008 Openmoko, Inc. |
4 | * Copyright 2008 Simtec Electronics | 4 | * Copyright 2008 Simtec Electronics |
5 | * http://armlinux.simtec.co.uk/ | 5 | * http://armlinux.simtec.co.uk/ |
6 | * Ben Dooks <ben@simtec.co.uk> | 6 | * Ben Dooks <ben@simtec.co.uk> |
7 | * | 7 | * |
8 | * S3C Platform - GPIO pin configuration helper definitions | 8 | * Samsung Platform - GPIO pin configuration helper definitions |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 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 | 11 | * it under the terms of the GNU General Public License version 2 as |
@@ -24,120 +24,30 @@ | |||
24 | * by disabling interrupts. | 24 | * by disabling interrupts. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | static inline int s3c_gpio_do_setcfg(struct s3c_gpio_chip *chip, | 27 | static inline int samsung_gpio_do_setcfg(struct samsung_gpio_chip *chip, |
28 | unsigned int off, unsigned int config) | 28 | unsigned int off, unsigned int config) |
29 | { | 29 | { |
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, | 33 | static inline unsigned samsung_gpio_do_getcfg(struct samsung_gpio_chip *chip, |
34 | unsigned int off) | 34 | unsigned int off) |
35 | { | 35 | { |
36 | return (chip->config->get_config)(chip, off); | 36 | return (chip->config->get_config)(chip, off); |
37 | } | 37 | } |
38 | 38 | ||
39 | static inline int s3c_gpio_do_setpull(struct s3c_gpio_chip *chip, | 39 | static inline int samsung_gpio_do_setpull(struct samsung_gpio_chip *chip, |
40 | unsigned int off, s3c_gpio_pull_t pull) | 40 | unsigned int off, samsung_gpio_pull_t pull) |
41 | { | 41 | { |
42 | return (chip->config->set_pull)(chip, off, pull); | 42 | return (chip->config->set_pull)(chip, off, pull); |
43 | } | 43 | } |
44 | 44 | ||
45 | static inline s3c_gpio_pull_t s3c_gpio_do_getpull(struct s3c_gpio_chip *chip, | 45 | static inline samsung_gpio_pull_t samsung_gpio_do_getpull(struct samsung_gpio_chip *chip, |
46 | unsigned int off) | 46 | unsigned int off) |
47 | { | 47 | { |
48 | return chip->config->get_pull(chip, off); | 48 | return chip->config->get_pull(chip, off); |
49 | } | 49 | } |
50 | 50 | ||
51 | /** | ||
52 | * s3c_gpio_setcfg_s3c24xx - S3C24XX style GPIO configuration. | ||
53 | * @chip: The gpio chip that is being configured. | ||
54 | * @off: The offset for the GPIO being configured. | ||
55 | * @cfg: The configuration value to set. | ||
56 | * | ||
57 | * This helper deal with the GPIO cases where the control register | ||
58 | * has two bits of configuration per gpio, which have the following | ||
59 | * functions: | ||
60 | * 00 = input | ||
61 | * 01 = output | ||
62 | * 1x = special function | ||
63 | */ | ||
64 | extern int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, | ||
65 | unsigned int off, unsigned int cfg); | ||
66 | |||
67 | /** | ||
68 | * s3c_gpio_getcfg_s3c24xx - S3C24XX style GPIO configuration read. | ||
69 | * @chip: The gpio chip that is being configured. | ||
70 | * @off: The offset for the GPIO being configured. | ||
71 | * | ||
72 | * The reverse of s3c_gpio_setcfg_s3c24xx(). Will return a value whicg | ||
73 | * could be directly passed back to s3c_gpio_setcfg_s3c24xx(), from the | ||
74 | * S3C_GPIO_SPECIAL() macro. | ||
75 | */ | ||
76 | unsigned int s3c_gpio_getcfg_s3c24xx(struct s3c_gpio_chip *chip, | ||
77 | unsigned int off); | ||
78 | |||
79 | /** | ||
80 | * s3c_gpio_setcfg_s3c24xx_a - S3C24XX style GPIO configuration (Bank A) | ||
81 | * @chip: The gpio chip that is being configured. | ||
82 | * @off: The offset for the GPIO being configured. | ||
83 | * @cfg: The configuration value to set. | ||
84 | * | ||
85 | * This helper deal with the GPIO cases where the control register | ||
86 | * has one bit of configuration for the gpio, where setting the bit | ||
87 | * means the pin is in special function mode and unset means output. | ||
88 | */ | ||
89 | extern int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip, | ||
90 | unsigned int off, unsigned int cfg); | ||
91 | |||
92 | |||
93 | /** | ||
94 | * s3c_gpio_getcfg_s3c24xx_a - S3C24XX style GPIO configuration read (Bank A) | ||
95 | * @chip: The gpio chip that is being configured. | ||
96 | * @off: The offset for the GPIO being configured. | ||
97 | * | ||
98 | * The reverse of s3c_gpio_setcfg_s3c24xx_a() turning an GPIO into a usable | ||
99 | * GPIO configuration value. | ||
100 | * | ||
101 | * @sa s3c_gpio_getcfg_s3c24xx | ||
102 | * @sa s3c_gpio_getcfg_s3c64xx_4bit | ||
103 | */ | ||
104 | extern unsigned s3c_gpio_getcfg_s3c24xx_a(struct s3c_gpio_chip *chip, | ||
105 | unsigned int off); | ||
106 | |||
107 | /** | ||
108 | * s3c_gpio_setcfg_s3c64xx_4bit - S3C64XX 4bit single register GPIO config. | ||
109 | * @chip: The gpio chip that is being configured. | ||
110 | * @off: The offset for the GPIO being configured. | ||
111 | * @cfg: The configuration value to set. | ||
112 | * | ||
113 | * This helper deal with the GPIO cases where the control register has 4 bits | ||
114 | * of control per GPIO, generally in the form of: | ||
115 | * 0000 = Input | ||
116 | * 0001 = Output | ||
117 | * others = Special functions (dependent on bank) | ||
118 | * | ||
119 | * Note, since the code to deal with the case where there are two control | ||
120 | * registers instead of one, we do not have a separate set of functions for | ||
121 | * each case. | ||
122 | */ | ||
123 | extern int s3c_gpio_setcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | ||
124 | unsigned int off, unsigned int cfg); | ||
125 | |||
126 | |||
127 | /** | ||
128 | * s3c_gpio_getcfg_s3c64xx_4bit - S3C64XX 4bit single register GPIO config read. | ||
129 | * @chip: The gpio chip that is being configured. | ||
130 | * @off: The offset for the GPIO being configured. | ||
131 | * | ||
132 | * The reverse of s3c_gpio_setcfg_s3c64xx_4bit(), turning a gpio configuration | ||
133 | * register setting into a value the software can use, such as could be passed | ||
134 | * to s3c_gpio_setcfg_s3c64xx_4bit(). | ||
135 | * | ||
136 | * @sa s3c_gpio_getcfg_s3c24xx | ||
137 | */ | ||
138 | extern unsigned s3c_gpio_getcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | ||
139 | unsigned int off); | ||
140 | |||
141 | /* Pull-{up,down} resistor controls. | 51 | /* Pull-{up,down} resistor controls. |
142 | * | 52 | * |
143 | * S3C2410,S3C2440 = Pull-UP, | 53 | * S3C2410,S3C2440 = Pull-UP, |
@@ -147,7 +57,7 @@ extern unsigned s3c_gpio_getcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | |||
147 | */ | 57 | */ |
148 | 58 | ||
149 | /** | 59 | /** |
150 | * s3c_gpio_setpull_1up() - Pull configuration for choice of up or none. | 60 | * s3c24xx_gpio_setpull_1up() - Pull configuration for choice of up or none. |
151 | * @chip: The gpio chip that is being configured. | 61 | * @chip: The gpio chip that is being configured. |
152 | * @off: The offset for the GPIO being configured. | 62 | * @off: The offset for the GPIO being configured. |
153 | * @param: pull: The pull mode being requested. | 63 | * @param: pull: The pull mode being requested. |
@@ -155,11 +65,11 @@ extern unsigned s3c_gpio_getcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | |||
155 | * This is a helper function for the case where we have GPIOs with one | 65 | * This is a helper function for the case where we have GPIOs with one |
156 | * bit configuring the presence of a pull-up resistor. | 66 | * bit configuring the presence of a pull-up resistor. |
157 | */ | 67 | */ |
158 | extern int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip, | 68 | extern int s3c24xx_gpio_setpull_1up(struct samsung_gpio_chip *chip, |
159 | unsigned int off, s3c_gpio_pull_t pull); | 69 | unsigned int off, samsung_gpio_pull_t pull); |
160 | 70 | ||
161 | /** | 71 | /** |
162 | * s3c_gpio_setpull_1down() - Pull configuration for choice of down or none | 72 | * s3c24xx_gpio_setpull_1down() - Pull configuration for choice of down or none |
163 | * @chip: The gpio chip that is being configured | 73 | * @chip: The gpio chip that is being configured |
164 | * @off: The offset for the GPIO being configured | 74 | * @off: The offset for the GPIO being configured |
165 | * @param: pull: The pull mode being requested | 75 | * @param: pull: The pull mode being requested |
@@ -167,11 +77,13 @@ extern int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip, | |||
167 | * This is a helper function for the case where we have GPIOs with one | 77 | * This is a helper function for the case where we have GPIOs with one |
168 | * bit configuring the presence of a pull-down resistor. | 78 | * bit configuring the presence of a pull-down resistor. |
169 | */ | 79 | */ |
170 | extern int s3c_gpio_setpull_1down(struct s3c_gpio_chip *chip, | 80 | extern int s3c24xx_gpio_setpull_1down(struct samsung_gpio_chip *chip, |
171 | unsigned int off, s3c_gpio_pull_t pull); | 81 | unsigned int off, samsung_gpio_pull_t pull); |
172 | 82 | ||
173 | /** | 83 | /** |
174 | * s3c_gpio_setpull_upown() - Pull configuration for choice of up, down or none | 84 | * samsung_gpio_setpull_upown() - Pull configuration for choice of up, |
85 | * down or none | ||
86 | * | ||
175 | * @chip: The gpio chip that is being configured. | 87 | * @chip: The gpio chip that is being configured. |
176 | * @off: The offset for the GPIO being configured. | 88 | * @off: The offset for the GPIO being configured. |
177 | * @param: pull: The pull mode being requested. | 89 | * @param: pull: The pull mode being requested. |
@@ -183,45 +95,46 @@ extern int s3c_gpio_setpull_1down(struct s3c_gpio_chip *chip, | |||
183 | * 01 = Pull-up resistor connected | 95 | * 01 = Pull-up resistor connected |
184 | * 10 = Pull-down resistor connected | 96 | * 10 = Pull-down resistor connected |
185 | */ | 97 | */ |
186 | extern int s3c_gpio_setpull_updown(struct s3c_gpio_chip *chip, | 98 | extern int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip, |
187 | unsigned int off, s3c_gpio_pull_t pull); | 99 | unsigned int off, samsung_gpio_pull_t pull); |
188 | |||
189 | 100 | ||
190 | /** | 101 | /** |
191 | * s3c_gpio_getpull_updown() - Get configuration for choice of up, down or none | 102 | * samsung_gpio_getpull_updown() - Get configuration for choice of up, |
103 | * down or none | ||
104 | * | ||
192 | * @chip: The gpio chip that the GPIO pin belongs to | 105 | * @chip: The gpio chip that the GPIO pin belongs to |
193 | * @off: The offset to the pin to get the configuration of. | 106 | * @off: The offset to the pin to get the configuration of. |
194 | * | 107 | * |
195 | * This helper function reads the state of the pull-{up,down} resistor for the | 108 | * This helper function reads the state of the pull-{up,down} resistor |
196 | * given GPIO in the same case as s3c_gpio_setpull_upown. | 109 | * for the given GPIO in the same case as samsung_gpio_setpull_upown. |
197 | */ | 110 | */ |
198 | extern s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip, | 111 | extern samsung_gpio_pull_t samsung_gpio_getpull_updown(struct samsung_gpio_chip *chip, |
199 | unsigned int off); | 112 | unsigned int off); |
200 | 113 | ||
201 | /** | 114 | /** |
202 | * s3c_gpio_getpull_1up() - Get configuration for choice of up or none | 115 | * s3c24xx_gpio_getpull_1up() - Get configuration for choice of up or none |
203 | * @chip: The gpio chip that the GPIO pin belongs to | 116 | * @chip: The gpio chip that the GPIO pin belongs to |
204 | * @off: The offset to the pin to get the configuration of. | 117 | * @off: The offset to the pin to get the configuration of. |
205 | * | 118 | * |
206 | * This helper function reads the state of the pull-up resistor for the | 119 | * This helper function reads the state of the pull-up resistor for the |
207 | * given GPIO in the same case as s3c_gpio_setpull_1up. | 120 | * given GPIO in the same case as s3c24xx_gpio_setpull_1up. |
208 | */ | 121 | */ |
209 | extern s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, | 122 | extern samsung_gpio_pull_t s3c24xx_gpio_getpull_1up(struct samsung_gpio_chip *chip, |
210 | unsigned int off); | 123 | unsigned int off); |
211 | 124 | ||
212 | /** | 125 | /** |
213 | * s3c_gpio_getpull_1down() - Get configuration for choice of down or none | 126 | * s3c24xx_gpio_getpull_1down() - Get configuration for choice of down or none |
214 | * @chip: The gpio chip that the GPIO pin belongs to | 127 | * @chip: The gpio chip that the GPIO pin belongs to |
215 | * @off: The offset to the pin to get the configuration of. | 128 | * @off: The offset to the pin to get the configuration of. |
216 | * | 129 | * |
217 | * This helper function reads the state of the pull-down resistor for the | 130 | * This helper function reads the state of the pull-down resistor for the |
218 | * given GPIO in the same case as s3c_gpio_setpull_1down. | 131 | * given GPIO in the same case as s3c24xx_gpio_setpull_1down. |
219 | */ | 132 | */ |
220 | extern s3c_gpio_pull_t s3c_gpio_getpull_1down(struct s3c_gpio_chip *chip, | 133 | extern samsung_gpio_pull_t s3c24xx_gpio_getpull_1down(struct samsung_gpio_chip *chip, |
221 | unsigned int off); | 134 | unsigned int off); |
222 | 135 | ||
223 | /** | 136 | /** |
224 | * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443. | 137 | * s3c2443_gpio_setpull() - Pull configuration for s3c2443. |
225 | * @chip: The gpio chip that is being configured. | 138 | * @chip: The gpio chip that is being configured. |
226 | * @off: The offset for the GPIO being configured. | 139 | * @off: The offset for the GPIO being configured. |
227 | * @param: pull: The pull mode being requested. | 140 | * @param: pull: The pull mode being requested. |
@@ -233,19 +146,18 @@ extern s3c_gpio_pull_t s3c_gpio_getpull_1down(struct s3c_gpio_chip *chip, | |||
233 | * 10 = Pull-down resistor connected | 146 | * 10 = Pull-down resistor connected |
234 | * x1 = No pull up resistor | 147 | * x1 = No pull up resistor |
235 | */ | 148 | */ |
236 | extern int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip, | 149 | extern int s3c2443_gpio_setpull(struct samsung_gpio_chip *chip, |
237 | unsigned int off, s3c_gpio_pull_t pull); | 150 | unsigned int off, samsung_gpio_pull_t pull); |
238 | 151 | ||
239 | /** | 152 | /** |
240 | * s3c_gpio_getpull_s3c2443() - Get configuration for s3c2443 pull resistors | 153 | * s3c2443_gpio_getpull() - Get configuration for s3c2443 pull resistors |
241 | * @chip: The gpio chip that the GPIO pin belongs to. | 154 | * @chip: The gpio chip that the GPIO pin belongs to. |
242 | * @off: The offset to the pin to get the configuration of. | 155 | * @off: The offset to the pin to get the configuration of. |
243 | * | 156 | * |
244 | * This helper function reads the state of the pull-{up,down} resistor for the | 157 | * This helper function reads the state of the pull-{up,down} resistor for the |
245 | * given GPIO in the same case as s3c_gpio_setpull_upown. | 158 | * given GPIO in the same case as samsung_gpio_setpull_upown. |
246 | */ | 159 | */ |
247 | extern s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip, | 160 | extern samsung_gpio_pull_t s3c2443_gpio_getpull(struct samsung_gpio_chip *chip, |
248 | unsigned int off); | 161 | unsigned int off); |
249 | 162 | ||
250 | #endif /* __PLAT_GPIO_CFG_HELPERS_H */ | 163 | #endif /* __PLAT_GPIO_CFG_HELPERS_H */ |
251 | |||
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h index 1762dcb4cb9e..d48245bb02b3 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h +++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h | |||
@@ -24,14 +24,14 @@ | |||
24 | #ifndef __PLAT_GPIO_CFG_H | 24 | #ifndef __PLAT_GPIO_CFG_H |
25 | #define __PLAT_GPIO_CFG_H __FILE__ | 25 | #define __PLAT_GPIO_CFG_H __FILE__ |
26 | 26 | ||
27 | typedef unsigned int __bitwise__ s3c_gpio_pull_t; | 27 | typedef unsigned int __bitwise__ samsung_gpio_pull_t; |
28 | typedef unsigned int __bitwise__ s5p_gpio_drvstr_t; | 28 | typedef unsigned int __bitwise__ s5p_gpio_drvstr_t; |
29 | 29 | ||
30 | /* forward declaration if gpio-core.h hasn't been included */ | 30 | /* forward declaration if gpio-core.h hasn't been included */ |
31 | struct s3c_gpio_chip; | 31 | struct samsung_gpio_chip; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * struct s3c_gpio_cfg GPIO configuration | 34 | * struct samsung_gpio_cfg GPIO configuration |
35 | * @cfg_eint: Configuration setting when used for external interrupt source | 35 | * @cfg_eint: Configuration setting when used for external interrupt source |
36 | * @get_pull: Read the current pull configuration for the GPIO | 36 | * @get_pull: Read the current pull configuration for the GPIO |
37 | * @set_pull: Set the current pull configuraiton for the GPIO | 37 | * @set_pull: Set the current pull configuraiton for the GPIO |
@@ -44,20 +44,20 @@ struct s3c_gpio_chip; | |||
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 | * | 46 | * |
47 | * @sa s3c_gpio_cfgpin | 47 | * @sa samsung_gpio_cfgpin |
48 | * @sa s3c_gpio_getcfg | 48 | * @sa s3c_gpio_getcfg |
49 | * @sa s3c_gpio_setpull | 49 | * @sa s3c_gpio_setpull |
50 | * @sa s3c_gpio_getpull | 50 | * @sa s3c_gpio_getpull |
51 | */ | 51 | */ |
52 | struct s3c_gpio_cfg { | 52 | struct samsung_gpio_cfg { |
53 | unsigned int cfg_eint; | 53 | unsigned int cfg_eint; |
54 | 54 | ||
55 | s3c_gpio_pull_t (*get_pull)(struct s3c_gpio_chip *chip, unsigned offs); | 55 | samsung_gpio_pull_t (*get_pull)(struct samsung_gpio_chip *chip, unsigned offs); |
56 | int (*set_pull)(struct s3c_gpio_chip *chip, unsigned offs, | 56 | int (*set_pull)(struct samsung_gpio_chip *chip, unsigned offs, |
57 | s3c_gpio_pull_t pull); | 57 | samsung_gpio_pull_t pull); |
58 | 58 | ||
59 | unsigned (*get_config)(struct s3c_gpio_chip *chip, unsigned offs); | 59 | unsigned (*get_config)(struct samsung_gpio_chip *chip, unsigned offs); |
60 | int (*set_config)(struct s3c_gpio_chip *chip, unsigned offs, | 60 | int (*set_config)(struct samsung_gpio_chip *chip, unsigned offs, |
61 | unsigned config); | 61 | unsigned config); |
62 | }; | 62 | }; |
63 | 63 | ||
@@ -69,7 +69,7 @@ struct s3c_gpio_cfg { | |||
69 | #define S3C_GPIO_OUTPUT (S3C_GPIO_SPECIAL(1)) | 69 | #define S3C_GPIO_OUTPUT (S3C_GPIO_SPECIAL(1)) |
70 | #define S3C_GPIO_SFN(x) (S3C_GPIO_SPECIAL(x)) | 70 | #define S3C_GPIO_SFN(x) (S3C_GPIO_SPECIAL(x)) |
71 | 71 | ||
72 | #define s3c_gpio_is_cfg_special(_cfg) \ | 72 | #define samsung_gpio_is_cfg_special(_cfg) \ |
73 | (((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK) | 73 | (((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK) |
74 | 74 | ||
75 | /** | 75 | /** |
@@ -128,9 +128,9 @@ extern int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr, | |||
128 | * up or down settings, and it may be dependent on the chip that is being | 128 | * up or down settings, and it may be dependent on the chip that is being |
129 | * used to whether the particular mode is available. | 129 | * used to whether the particular mode is available. |
130 | */ | 130 | */ |
131 | #define S3C_GPIO_PULL_NONE ((__force s3c_gpio_pull_t)0x00) | 131 | #define S3C_GPIO_PULL_NONE ((__force samsung_gpio_pull_t)0x00) |
132 | #define S3C_GPIO_PULL_DOWN ((__force s3c_gpio_pull_t)0x01) | 132 | #define S3C_GPIO_PULL_DOWN ((__force samsung_gpio_pull_t)0x01) |
133 | #define S3C_GPIO_PULL_UP ((__force s3c_gpio_pull_t)0x02) | 133 | #define S3C_GPIO_PULL_UP ((__force samsung_gpio_pull_t)0x02) |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * s3c_gpio_setpull() - set the state of a gpio pin pull resistor | 136 | * s3c_gpio_setpull() - set the state of a gpio pin pull resistor |
@@ -143,7 +143,7 @@ extern int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr, | |||
143 | * | 143 | * |
144 | * @pull is one of S3C_GPIO_PULL_NONE, S3C_GPIO_PULL_DOWN or S3C_GPIO_PULL_UP. | 144 | * @pull is one of S3C_GPIO_PULL_NONE, S3C_GPIO_PULL_DOWN or S3C_GPIO_PULL_UP. |
145 | */ | 145 | */ |
146 | extern int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull); | 146 | extern int s3c_gpio_setpull(unsigned int pin, samsung_gpio_pull_t pull); |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * s3c_gpio_getpull() - get the pull resistor state of a gpio pin | 149 | * s3c_gpio_getpull() - get the pull resistor state of a gpio pin |
@@ -151,7 +151,7 @@ extern int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull); | |||
151 | * | 151 | * |
152 | * Read the pull resistor value for the specified pin. | 152 | * Read the pull resistor value for the specified pin. |
153 | */ | 153 | */ |
154 | extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin); | 154 | extern samsung_gpio_pull_t s3c_gpio_getpull(unsigned int pin); |
155 | 155 | ||
156 | /* configure `all` aspects of an gpio */ | 156 | /* configure `all` aspects of an gpio */ |
157 | 157 | ||
@@ -170,7 +170,7 @@ extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin); | |||
170 | * @sa s3c_gpio_cfgpin_range | 170 | * @sa s3c_gpio_cfgpin_range |
171 | */ | 171 | */ |
172 | extern int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr, | 172 | extern int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr, |
173 | unsigned int cfg, s3c_gpio_pull_t pull); | 173 | unsigned int cfg, samsung_gpio_pull_t pull); |
174 | 174 | ||
175 | static inline int s3c_gpio_cfgrange_nopull(unsigned int pin, unsigned int size, | 175 | static inline int s3c_gpio_cfgrange_nopull(unsigned int pin, unsigned int size, |
176 | unsigned int cfg) | 176 | unsigned int cfg) |
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h index 8cad4cf19c3c..1fe6917f6a2a 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-core.h +++ b/arch/arm/plat-samsung/include/plat/gpio-core.h | |||
@@ -25,22 +25,22 @@ | |||
25 | * specific code. | 25 | * specific code. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | struct s3c_gpio_chip; | 28 | struct samsung_gpio_chip; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * struct s3c_gpio_pm - power management (suspend/resume) information | 31 | * struct samsung_gpio_pm - power management (suspend/resume) information |
32 | * @save: Routine to save the state of the GPIO block | 32 | * @save: Routine to save the state of the GPIO block |
33 | * @resume: Routine to resume the GPIO block. | 33 | * @resume: Routine to resume the GPIO block. |
34 | */ | 34 | */ |
35 | struct s3c_gpio_pm { | 35 | struct samsung_gpio_pm { |
36 | void (*save)(struct s3c_gpio_chip *chip); | 36 | void (*save)(struct samsung_gpio_chip *chip); |
37 | void (*resume)(struct s3c_gpio_chip *chip); | 37 | void (*resume)(struct samsung_gpio_chip *chip); |
38 | }; | 38 | }; |
39 | 39 | ||
40 | struct s3c_gpio_cfg; | 40 | struct samsung_gpio_cfg; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * struct s3c_gpio_chip - wrapper for specific implementation of gpio | 43 | * struct samsung_gpio_chip - wrapper for specific implementation of gpio |
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 | * @group: The group register number for gpio interrupt support. | 46 | * @group: The group register number for gpio interrupt support. |
@@ -60,10 +60,10 @@ struct s3c_gpio_cfg; | |||
60 | * CPU cores trying to get one lock for different GPIO banks, where each | 60 | * CPU cores trying to get one lock for different GPIO banks, where each |
61 | * bank of GPIO has its own register space and configuration registers. | 61 | * bank of GPIO has its own register space and configuration registers. |
62 | */ | 62 | */ |
63 | struct s3c_gpio_chip { | 63 | struct samsung_gpio_chip { |
64 | struct gpio_chip chip; | 64 | struct gpio_chip chip; |
65 | struct s3c_gpio_cfg *config; | 65 | struct samsung_gpio_cfg *config; |
66 | struct s3c_gpio_pm *pm; | 66 | struct samsung_gpio_pm *pm; |
67 | void __iomem *base; | 67 | void __iomem *base; |
68 | int irq_base; | 68 | int irq_base; |
69 | int group; | 69 | int group; |
@@ -73,58 +73,11 @@ struct s3c_gpio_chip { | |||
73 | #endif | 73 | #endif |
74 | }; | 74 | }; |
75 | 75 | ||
76 | static inline struct s3c_gpio_chip *to_s3c_gpio(struct gpio_chip *gpc) | 76 | static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc) |
77 | { | 77 | { |
78 | return container_of(gpc, struct s3c_gpio_chip, chip); | 78 | return container_of(gpc, struct samsung_gpio_chip, chip); |
79 | } | 79 | } |
80 | 80 | ||
81 | /** s3c_gpiolib_add() - add the s3c specific version of a gpio_chip. | ||
82 | * @chip: The chip to register | ||
83 | * | ||
84 | * This is a wrapper to gpiochip_add() that takes our specific gpio chip | ||
85 | * information and makes the necessary alterations for the platform and | ||
86 | * notes the information for use with the configuration systems and any | ||
87 | * other parts of the system. | ||
88 | */ | ||
89 | extern void s3c_gpiolib_add(struct s3c_gpio_chip *chip); | ||
90 | |||
91 | /* CONFIG_S3C_GPIO_TRACK enables the tracking of the s3c specific gpios | ||
92 | * for use with the configuration calls, and other parts of the s3c gpiolib | ||
93 | * support code. | ||
94 | * | ||
95 | * Not all s3c support code will need this, as some configurations of cpu | ||
96 | * may only support one or two different configuration options and have an | ||
97 | * easy gpio to s3c_gpio_chip mapping function. If this is the case, then | ||
98 | * the machine support file should provide its own s3c_gpiolib_getchip() | ||
99 | * and any other necessary functions. | ||
100 | */ | ||
101 | |||
102 | /** | ||
103 | * samsung_gpiolib_add_4bit_chips - 4bit single register GPIO config. | ||
104 | * @chip: The gpio chip that is being configured. | ||
105 | * @nr_chips: The no of chips (gpio ports) for the GPIO being configured. | ||
106 | * | ||
107 | * This helper deal with the GPIO cases where the control register has 4 bits | ||
108 | * of control per GPIO, generally in the form of: | ||
109 | * 0000 = Input | ||
110 | * 0001 = Output | ||
111 | * others = Special functions (dependent on bank) | ||
112 | * | ||
113 | * Note, since the code to deal with the case where there are two control | ||
114 | * registers instead of one, we do not have a separate set of function | ||
115 | * (samsung_gpiolib_add_4bit2_chips)for each case. | ||
116 | */ | ||
117 | extern void samsung_gpiolib_add_4bit_chips(struct s3c_gpio_chip *chip, | ||
118 | int nr_chips); | ||
119 | extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip, | ||
120 | int nr_chips); | ||
121 | extern void samsung_gpiolib_add_2bit_chips(struct s3c_gpio_chip *chip, | ||
122 | int nr_chips); | ||
123 | |||
124 | extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip); | ||
125 | extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip); | ||
126 | |||
127 | |||
128 | /** | 81 | /** |
129 | * samsung_gpiolib_to_irq - convert gpio pin to irq number | 82 | * samsung_gpiolib_to_irq - convert gpio pin to irq number |
130 | * @chip: The gpio chip that the pin belongs to. | 83 | * @chip: The gpio chip that the pin belongs to. |
@@ -136,36 +89,36 @@ extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip); | |||
136 | extern int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset); | 89 | extern int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset); |
137 | 90 | ||
138 | /* exported for core SoC support to change */ | 91 | /* exported for core SoC support to change */ |
139 | extern struct s3c_gpio_cfg s3c24xx_gpiocfg_default; | 92 | extern struct samsung_gpio_cfg s3c24xx_gpiocfg_default; |
140 | 93 | ||
141 | #ifdef CONFIG_S3C_GPIO_TRACK | 94 | #ifdef CONFIG_S3C_GPIO_TRACK |
142 | extern struct s3c_gpio_chip *s3c_gpios[S3C_GPIO_END]; | 95 | extern struct samsung_gpio_chip *s3c_gpios[S3C_GPIO_END]; |
143 | 96 | ||
144 | static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int chip) | 97 | static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int chip) |
145 | { | 98 | { |
146 | return (chip < S3C_GPIO_END) ? s3c_gpios[chip] : NULL; | 99 | return (chip < S3C_GPIO_END) ? s3c_gpios[chip] : NULL; |
147 | } | 100 | } |
148 | #else | 101 | #else |
149 | /* machine specific code should provide s3c_gpiolib_getchip */ | 102 | /* machine specific code should provide samsung_gpiolib_getchip */ |
150 | 103 | ||
151 | #include <mach/gpio-track.h> | 104 | #include <mach/gpio-track.h> |
152 | 105 | ||
153 | static inline void s3c_gpiolib_track(struct s3c_gpio_chip *chip) { } | 106 | static inline void s3c_gpiolib_track(struct samsung_gpio_chip *chip) { } |
154 | #endif | 107 | #endif |
155 | 108 | ||
156 | #ifdef CONFIG_PM | 109 | #ifdef CONFIG_PM |
157 | extern struct s3c_gpio_pm s3c_gpio_pm_1bit; | 110 | extern struct samsung_gpio_pm samsung_gpio_pm_1bit; |
158 | extern struct s3c_gpio_pm s3c_gpio_pm_2bit; | 111 | extern struct samsung_gpio_pm samsung_gpio_pm_2bit; |
159 | extern struct s3c_gpio_pm s3c_gpio_pm_4bit; | 112 | extern struct samsung_gpio_pm samsung_gpio_pm_4bit; |
160 | #define __gpio_pm(x) x | 113 | #define __gpio_pm(x) x |
161 | #else | 114 | #else |
162 | #define s3c_gpio_pm_1bit NULL | 115 | #define samsung_gpio_pm_1bit NULL |
163 | #define s3c_gpio_pm_2bit NULL | 116 | #define samsung_gpio_pm_2bit NULL |
164 | #define s3c_gpio_pm_4bit NULL | 117 | #define samsung_gpio_pm_4bit NULL |
165 | #define __gpio_pm(x) NULL | 118 | #define __gpio_pm(x) NULL |
166 | 119 | ||
167 | #endif /* CONFIG_PM */ | 120 | #endif /* CONFIG_PM */ |
168 | 121 | ||
169 | /* locking wrappers to deal with multiple access to the same gpio bank */ | 122 | /* locking wrappers to deal with multiple access to the same gpio bank */ |
170 | #define s3c_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl) | 123 | #define samsung_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl) |
171 | #define s3c_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl) | 124 | #define samsung_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl) |
diff --git a/arch/arm/plat-samsung/include/plat/gpio-fns.h b/arch/arm/plat-samsung/include/plat/gpio-fns.h new file mode 100644 index 000000000000..bab139201761 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/gpio-fns.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/gpio-fns.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2009 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C2410 - hardware | ||
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 | #ifndef __MACH_GPIO_FNS_H | ||
14 | #define __MACH_GPIO_FNS_H __FILE__ | ||
15 | |||
16 | /* These functions are in the to-be-removed category and it is strongly | ||
17 | * encouraged not to use these in new code. They will be marked deprecated | ||
18 | * very soon. | ||
19 | * | ||
20 | * Most of the functionality can be either replaced by the gpiocfg calls | ||
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. | ||
25 | */ | ||
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 | |||
35 | /* external functions for GPIO support | ||
36 | * | ||
37 | * These allow various different clients to access the same GPIO | ||
38 | * registers without conflicting. If your driver only owns the entire | ||
39 | * GPIO register, then it is safe to ioremap/__raw_{read|write} to it. | ||
40 | */ | ||
41 | |||
42 | extern unsigned int s3c2410_gpio_getcfg(unsigned int pin); | ||
43 | |||
44 | /* s3c2410_gpio_getirq | ||
45 | * | ||
46 | * turn the given pin number into the corresponding IRQ number | ||
47 | * | ||
48 | * returns: | ||
49 | * < 0 = no interrupt for this pin | ||
50 | * >=0 = interrupt number for the pin | ||
51 | */ | ||
52 | |||
53 | extern int s3c2410_gpio_getirq(unsigned int pin); | ||
54 | |||
55 | /* s3c2410_gpio_irqfilter | ||
56 | * | ||
57 | * set the irq filtering on the given pin | ||
58 | * | ||
59 | * on = 0 => disable filtering | ||
60 | * 1 => enable filtering | ||
61 | * | ||
62 | * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with | ||
63 | * width of filter (0 through 63) | ||
64 | * | ||
65 | * | ||
66 | */ | ||
67 | |||
68 | extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on, | ||
69 | unsigned int config); | ||
70 | |||
71 | /* s3c2410_gpio_pullup | ||
72 | * | ||
73 | * This call should be replaced with s3c_gpio_setpull(). | ||
74 | * | ||
75 | * As a note, there is currently no distinction between pull-up and pull-down | ||
76 | * in the s3c24xx series devices with only an on/off configuration. | ||
77 | */ | ||
78 | |||
79 | /* s3c2410_gpio_pullup | ||
80 | * | ||
81 | * configure the pull-up control on the given pin | ||
82 | * | ||
83 | * to = 1 => disable the pull-up | ||
84 | * 0 => enable the pull-up | ||
85 | * | ||
86 | * eg; | ||
87 | * | ||
88 | * s3c2410_gpio_pullup(S3C2410_GPB(0), 0); | ||
89 | * s3c2410_gpio_pullup(S3C2410_GPE(8), 0); | ||
90 | */ | ||
91 | |||
92 | extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); | ||
93 | |||
94 | extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); | ||
95 | |||
96 | extern unsigned int s3c2410_gpio_getpin(unsigned int pin); | ||
97 | |||
98 | #endif /* __MACH_GPIO_FNS_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/iic.h b/arch/arm/plat-samsung/include/plat/iic.h index 56b0059439e1..51d52e767a19 100644 --- a/arch/arm/plat-samsung/include/plat/iic.h +++ b/arch/arm/plat-samsung/include/plat/iic.h | |||
@@ -60,6 +60,7 @@ extern void s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *i2c); | |||
60 | extern void s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *i2c); | 60 | extern void s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *i2c); |
61 | extern void s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *i2c); | 61 | extern void s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *i2c); |
62 | extern void s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *i2c); | 62 | extern void s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *i2c); |
63 | extern void s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *i2c); | ||
63 | 64 | ||
64 | /* defined by architecture to configure gpio */ | 65 | /* defined by architecture to configure gpio */ |
65 | extern void s3c_i2c0_cfg_gpio(struct platform_device *dev); | 66 | extern void s3c_i2c0_cfg_gpio(struct platform_device *dev); |
diff --git a/arch/arm/plat-samsung/include/plat/irq.h b/arch/arm/plat-samsung/include/plat/irq.h new file mode 100644 index 000000000000..e21a89bc26c9 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/irq.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/irq.h | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for S3C24XX CPU IRQ 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/io.h> | ||
14 | |||
15 | #include <mach/hardware.h> | ||
16 | #include <mach/regs-irq.h> | ||
17 | #include <mach/regs-gpio.h> | ||
18 | |||
19 | #define irqdbf(x...) | ||
20 | #define irqdbf2(x...) | ||
21 | |||
22 | #define EXTINT_OFF (IRQ_EINT4 - 4) | ||
23 | |||
24 | /* these are exported for arch/arm/mach-* usage */ | ||
25 | extern struct irq_chip s3c_irq_level_chip; | ||
26 | extern struct irq_chip s3c_irq_chip; | ||
27 | |||
28 | static inline void s3c_irqsub_mask(unsigned int irqno, | ||
29 | unsigned int parentbit, | ||
30 | int subcheck) | ||
31 | { | ||
32 | unsigned long mask; | ||
33 | unsigned long submask; | ||
34 | |||
35 | submask = __raw_readl(S3C2410_INTSUBMSK); | ||
36 | mask = __raw_readl(S3C2410_INTMSK); | ||
37 | |||
38 | submask |= (1UL << (irqno - IRQ_S3CUART_RX0)); | ||
39 | |||
40 | /* check to see if we need to mask the parent IRQ */ | ||
41 | |||
42 | if ((submask & subcheck) == subcheck) | ||
43 | __raw_writel(mask | parentbit, S3C2410_INTMSK); | ||
44 | |||
45 | /* write back masks */ | ||
46 | __raw_writel(submask, S3C2410_INTSUBMSK); | ||
47 | |||
48 | } | ||
49 | |||
50 | static inline void s3c_irqsub_unmask(unsigned int irqno, | ||
51 | unsigned int parentbit) | ||
52 | { | ||
53 | unsigned long mask; | ||
54 | unsigned long submask; | ||
55 | |||
56 | submask = __raw_readl(S3C2410_INTSUBMSK); | ||
57 | mask = __raw_readl(S3C2410_INTMSK); | ||
58 | |||
59 | submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0)); | ||
60 | mask &= ~parentbit; | ||
61 | |||
62 | /* write back masks */ | ||
63 | __raw_writel(submask, S3C2410_INTSUBMSK); | ||
64 | __raw_writel(mask, S3C2410_INTMSK); | ||
65 | } | ||
66 | |||
67 | |||
68 | static inline void s3c_irqsub_maskack(unsigned int irqno, | ||
69 | unsigned int parentmask, | ||
70 | unsigned int group) | ||
71 | { | ||
72 | unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0); | ||
73 | |||
74 | s3c_irqsub_mask(irqno, parentmask, group); | ||
75 | |||
76 | __raw_writel(bit, S3C2410_SUBSRCPND); | ||
77 | |||
78 | /* only ack parent if we've got all the irqs (seems we must | ||
79 | * ack, all and hope that the irq system retriggers ok when | ||
80 | * the interrupt goes off again) | ||
81 | */ | ||
82 | |||
83 | if (1) { | ||
84 | __raw_writel(parentmask, S3C2410_SRCPND); | ||
85 | __raw_writel(parentmask, S3C2410_INTPND); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | static inline void s3c_irqsub_ack(unsigned int irqno, | ||
90 | unsigned int parentmask, | ||
91 | unsigned int group) | ||
92 | { | ||
93 | unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0); | ||
94 | |||
95 | __raw_writel(bit, S3C2410_SUBSRCPND); | ||
96 | |||
97 | /* only ack parent if we've got all the irqs (seems we must | ||
98 | * ack, all and hope that the irq system retriggers ok when | ||
99 | * the interrupt goes off again) | ||
100 | */ | ||
101 | |||
102 | if (1) { | ||
103 | __raw_writel(parentmask, S3C2410_SRCPND); | ||
104 | __raw_writel(parentmask, S3C2410_INTPND); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | /* exported for use in arch/arm/mach-s3c2410 */ | ||
109 | |||
110 | #ifdef CONFIG_PM | ||
111 | extern int s3c_irq_wake(struct irq_data *data, unsigned int state); | ||
112 | #else | ||
113 | #define s3c_irq_wake NULL | ||
114 | #endif | ||
115 | |||
116 | extern int s3c_irqext_type(struct irq_data *d, unsigned int type); | ||
diff --git a/arch/arm/plat-samsung/include/plat/irqs.h b/arch/arm/plat-samsung/include/plat/irqs.h new file mode 100644 index 000000000000..08d1a7ef97b7 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/irqs.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/irqs.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P Common IRQ 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 | #ifndef __PLAT_SAMSUNG_IRQS_H | ||
14 | #define __PLAT_SAMSUNG_IRQS_H __FILE__ | ||
15 | |||
16 | /* we keep the first set of CPU IRQs out of the range of | ||
17 | * the ISA space, so that the PC104 has them to itself | ||
18 | * and we don't end up having to do horrible things to the | ||
19 | * standard ISA drivers.... | ||
20 | * | ||
21 | * note, since we're using the VICs, our start must be a | ||
22 | * mulitple of 32 to allow the common code to work | ||
23 | */ | ||
24 | |||
25 | #define S5P_IRQ_OFFSET (32) | ||
26 | |||
27 | #define S5P_IRQ(x) ((x) + S5P_IRQ_OFFSET) | ||
28 | |||
29 | #define S5P_VIC0_BASE S5P_IRQ(0) | ||
30 | #define S5P_VIC1_BASE S5P_IRQ(32) | ||
31 | #define S5P_VIC2_BASE S5P_IRQ(64) | ||
32 | #define S5P_VIC3_BASE S5P_IRQ(96) | ||
33 | |||
34 | #define VIC_BASE(x) (S5P_VIC0_BASE + ((x)*32)) | ||
35 | |||
36 | #define IRQ_VIC0_BASE S5P_VIC0_BASE | ||
37 | #define IRQ_VIC1_BASE S5P_VIC1_BASE | ||
38 | #define IRQ_VIC2_BASE S5P_VIC2_BASE | ||
39 | |||
40 | /* VIC based IRQs */ | ||
41 | |||
42 | #define S5P_IRQ_VIC0(x) (S5P_VIC0_BASE + (x)) | ||
43 | #define S5P_IRQ_VIC1(x) (S5P_VIC1_BASE + (x)) | ||
44 | #define S5P_IRQ_VIC2(x) (S5P_VIC2_BASE + (x)) | ||
45 | #define S5P_IRQ_VIC3(x) (S5P_VIC3_BASE + (x)) | ||
46 | |||
47 | #define S5P_TIMER_IRQ(x) (11 + (x)) | ||
48 | |||
49 | #define IRQ_TIMER0 S5P_TIMER_IRQ(0) | ||
50 | #define IRQ_TIMER1 S5P_TIMER_IRQ(1) | ||
51 | #define IRQ_TIMER2 S5P_TIMER_IRQ(2) | ||
52 | #define IRQ_TIMER3 S5P_TIMER_IRQ(3) | ||
53 | #define IRQ_TIMER4 S5P_TIMER_IRQ(4) | ||
54 | |||
55 | #define IRQ_EINT(x) ((x) < 16 ? ((x) + S5P_EINT_BASE1) \ | ||
56 | : ((x) - 16 + S5P_EINT_BASE2)) | ||
57 | |||
58 | #define EINT_OFFSET(irq) ((irq) < S5P_EINT_BASE2 ? \ | ||
59 | ((irq) - S5P_EINT_BASE1) : \ | ||
60 | ((irq) + 16 - S5P_EINT_BASE2)) | ||
61 | |||
62 | #define IRQ_EINT_BIT(x) EINT_OFFSET(x) | ||
63 | |||
64 | /* Typically only a few gpio chips require gpio interrupt support. | ||
65 | To avoid memory waste irq descriptors are allocated only for | ||
66 | S5P_GPIOINT_GROUP_COUNT chips, each with total number of | ||
67 | S5P_GPIOINT_GROUP_SIZE pins/irqs. Each GPIOINT group can be assiged | ||
68 | to any gpio chip with the s5p_register_gpio_interrupt() function */ | ||
69 | #define S5P_GPIOINT_GROUP_COUNT 4 | ||
70 | #define S5P_GPIOINT_GROUP_SIZE 8 | ||
71 | #define S5P_GPIOINT_COUNT (S5P_GPIOINT_GROUP_COUNT * S5P_GPIOINT_GROUP_SIZE) | ||
72 | |||
73 | /* IRQ types common for all s5p platforms */ | ||
74 | #define S5P_IRQ_TYPE_LEVEL_LOW (0x00) | ||
75 | #define S5P_IRQ_TYPE_LEVEL_HIGH (0x01) | ||
76 | #define S5P_IRQ_TYPE_EDGE_FALLING (0x02) | ||
77 | #define S5P_IRQ_TYPE_EDGE_RISING (0x03) | ||
78 | #define S5P_IRQ_TYPE_EDGE_BOTH (0x04) | ||
79 | |||
80 | #endif /* __PLAT_SAMSUNG_IRQS_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/map-s3c.h b/arch/arm/plat-samsung/include/plat/map-s3c.h new file mode 100644 index 000000000000..7d048759b772 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/map-s3c.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/map-s3c.h | ||
2 | * | ||
3 | * Copyright (c) 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C24XX - Memory map definitions | ||
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 | #ifndef __ASM_PLAT_MAP_S3C_H | ||
14 | #define __ASM_PLAT_MAP_S3C_H __FILE__ | ||
15 | |||
16 | #define S3C24XX_VA_IRQ S3C_VA_IRQ | ||
17 | #define S3C24XX_VA_MEMCTRL S3C_VA_MEM | ||
18 | #define S3C24XX_VA_UART S3C_VA_UART | ||
19 | |||
20 | #define S3C24XX_VA_TIMER S3C_VA_TIMER | ||
21 | #define S3C24XX_VA_CLKPWR S3C_VA_SYS | ||
22 | #define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG | ||
23 | |||
24 | #define S3C2412_VA_SSMC S3C_ADDR_CPU(0x00000000) | ||
25 | #define S3C2412_VA_EBI S3C_ADDR_CPU(0x00010000) | ||
26 | |||
27 | #define S3C2410_PA_UART (0x50000000) | ||
28 | #define S3C24XX_PA_UART S3C2410_PA_UART | ||
29 | |||
30 | #ifndef S3C_UART_OFFSET | ||
31 | #define S3C_UART_OFFSET (0x400) | ||
32 | #endif | ||
33 | |||
34 | /* | ||
35 | * GPIO ports | ||
36 | * | ||
37 | * the calculation for the VA of this must ensure that | ||
38 | * it is the same distance apart from the UART in the | ||
39 | * phsyical address space, as the initial mapping for the IO | ||
40 | * is done as a 1:1 mapping. This puts it (currently) at | ||
41 | * 0xFA800000, which is not in the way of any current mapping | ||
42 | * by the base system. | ||
43 | */ | ||
44 | |||
45 | #define S3C2410_PA_GPIO (0x56000000) | ||
46 | #define S3C24XX_PA_GPIO S3C2410_PA_GPIO | ||
47 | |||
48 | #define S3C24XX_VA_GPIO ((S3C24XX_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART) | ||
49 | #define S3C64XX_VA_GPIO S3C_ADDR_CPU(0x00000000) | ||
50 | |||
51 | #define S3C64XX_VA_MODEM S3C_ADDR_CPU(0x00100000) | ||
52 | #define S3C64XX_VA_USB_HSPHY S3C_ADDR_CPU(0x00200000) | ||
53 | |||
54 | #define S3C_VA_USB_HSPHY S3C64XX_VA_USB_HSPHY | ||
55 | |||
56 | /* | ||
57 | * ISA style IO, for each machine to sort out mappings for, | ||
58 | * if it implements it. We reserve two 16M regions for ISA. | ||
59 | */ | ||
60 | |||
61 | #define S3C2410_ADDR(x) S3C_ADDR(x) | ||
62 | |||
63 | #define S3C24XX_VA_ISA_WORD S3C2410_ADDR(0x02000000) | ||
64 | #define S3C24XX_VA_ISA_BYTE S3C2410_ADDR(0x03000000) | ||
65 | |||
66 | /* deal with the registers that move under the 2412/2413 */ | ||
67 | |||
68 | #if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413) | ||
69 | #ifndef __ASSEMBLY__ | ||
70 | extern void __iomem *s3c24xx_va_gpio2; | ||
71 | #endif | ||
72 | #ifdef CONFIG_CPU_S3C2412_ONLY | ||
73 | #define S3C24XX_VA_GPIO2 (S3C24XX_VA_GPIO + 0x10) | ||
74 | #else | ||
75 | #define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2 | ||
76 | #endif | ||
77 | #else | ||
78 | #define s3c24xx_va_gpio2 S3C24XX_VA_GPIO | ||
79 | #define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO | ||
80 | #endif | ||
81 | |||
82 | #include <plat/map-s5p.h> | ||
83 | |||
84 | #endif /* __ASM_PLAT_MAP_S3C_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h b/arch/arm/plat-samsung/include/plat/map-s5p.h new file mode 100644 index 000000000000..c2d7bdae5891 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/map-s5p.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/map-s5p.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P - Memory map definitions | ||
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 | #ifndef __ASM_PLAT_MAP_S5P_H | ||
14 | #define __ASM_PLAT_MAP_S5P_H __FILE__ | ||
15 | |||
16 | #define S5P_VA_CHIPID S3C_ADDR(0x02000000) | ||
17 | #define S5P_VA_CMU S3C_ADDR(0x02100000) | ||
18 | #define S5P_VA_PMU S3C_ADDR(0x02180000) | ||
19 | #define S5P_VA_GPIO S3C_ADDR(0x02200000) | ||
20 | #define S5P_VA_GPIO1 S5P_VA_GPIO | ||
21 | #define S5P_VA_GPIO2 S3C_ADDR(0x02240000) | ||
22 | #define S5P_VA_GPIO3 S3C_ADDR(0x02280000) | ||
23 | |||
24 | #define S5P_VA_SYSRAM S3C_ADDR(0x02400000) | ||
25 | #define S5P_VA_DMC0 S3C_ADDR(0x02440000) | ||
26 | #define S5P_VA_DMC1 S3C_ADDR(0x02480000) | ||
27 | #define S5P_VA_SROMC S3C_ADDR(0x024C0000) | ||
28 | |||
29 | #define S5P_VA_SYSTIMER S3C_ADDR(0x02500000) | ||
30 | #define S5P_VA_L2CC S3C_ADDR(0x02600000) | ||
31 | |||
32 | #define S5P_VA_COMBINER_BASE S3C_ADDR(0x02700000) | ||
33 | #define S5P_VA_COMBINER(x) (S5P_VA_COMBINER_BASE + ((x) >> 2) * 0x10) | ||
34 | |||
35 | #define S5P_VA_COREPERI_BASE S3C_ADDR(0x02800000) | ||
36 | #define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x)) | ||
37 | #define S5P_VA_SCU S5P_VA_COREPERI(0x0) | ||
38 | #define S5P_VA_TWD S5P_VA_COREPERI(0x600) | ||
39 | |||
40 | #define S5P_VA_GIC_CPU S3C_ADDR(0x02810000) | ||
41 | #define S5P_VA_GIC_DIST S3C_ADDR(0x02820000) | ||
42 | |||
43 | #define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000)) | ||
44 | #define VA_VIC0 VA_VIC(0) | ||
45 | #define VA_VIC1 VA_VIC(1) | ||
46 | #define VA_VIC2 VA_VIC(2) | ||
47 | #define VA_VIC3 VA_VIC(3) | ||
48 | |||
49 | #define S5P_VA_UART(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) | ||
50 | #define S5P_VA_UART0 S5P_VA_UART(0) | ||
51 | #define S5P_VA_UART1 S5P_VA_UART(1) | ||
52 | #define S5P_VA_UART2 S5P_VA_UART(2) | ||
53 | #define S5P_VA_UART3 S5P_VA_UART(3) | ||
54 | |||
55 | #ifndef S3C_UART_OFFSET | ||
56 | #define S3C_UART_OFFSET (0x400) | ||
57 | #endif | ||
58 | |||
59 | #include <plat/map-s3c.h> | ||
60 | |||
61 | #endif /* __ASM_PLAT_MAP_S5P_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/mci.h b/arch/arm/plat-samsung/include/plat/mci.h new file mode 100644 index 000000000000..c42d31711944 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/mci.h | |||
@@ -0,0 +1,52 @@ | |||
1 | #ifndef _ARCH_MCI_H | ||
2 | #define _ARCH_MCI_H | ||
3 | |||
4 | /** | ||
5 | * struct s3c24xx_mci_pdata - sd/mmc controller platform data | ||
6 | * @no_wprotect: Set this to indicate there is no write-protect switch. | ||
7 | * @no_detect: Set this if there is no detect switch. | ||
8 | * @wprotect_invert: Invert the default sense of the write protect switch. | ||
9 | * @detect_invert: Invert the default sense of the write protect switch. | ||
10 | * @use_dma: Set to allow the use of DMA. | ||
11 | * @gpio_detect: GPIO number for the card detect line. | ||
12 | * @gpio_wprotect: GPIO number for the write protect line. | ||
13 | * @ocr_avail: The mask of the available power states, non-zero to use. | ||
14 | * @set_power: Callback to control the power mode. | ||
15 | * | ||
16 | * The @gpio_detect is used for card detection when @no_wprotect is unset, | ||
17 | * and the default sense is that 0 returned from gpio_get_value() means | ||
18 | * that a card is inserted. If @detect_invert is set, then the value from | ||
19 | * gpio_get_value() is inverted, which makes 1 mean card inserted. | ||
20 | * | ||
21 | * The driver will use @gpio_wprotect to signal whether the card is write | ||
22 | * protected if @no_wprotect is not set. A 0 returned from gpio_get_value() | ||
23 | * means the card is read/write, and 1 means read-only. The @wprotect_invert | ||
24 | * will invert the value returned from gpio_get_value(). | ||
25 | * | ||
26 | * Card power is set by @ocr_availa, using MCC_VDD_ constants if it is set | ||
27 | * to a non-zero value, otherwise the default of 3.2-3.4V is used. | ||
28 | */ | ||
29 | struct s3c24xx_mci_pdata { | ||
30 | unsigned int no_wprotect:1; | ||
31 | unsigned int no_detect:1; | ||
32 | unsigned int wprotect_invert:1; | ||
33 | unsigned int detect_invert:1; /* set => detect active high */ | ||
34 | unsigned int use_dma:1; | ||
35 | |||
36 | unsigned int gpio_detect; | ||
37 | unsigned int gpio_wprotect; | ||
38 | unsigned long ocr_avail; | ||
39 | void (*set_power)(unsigned char power_mode, | ||
40 | unsigned short vdd); | ||
41 | }; | ||
42 | |||
43 | /** | ||
44 | * s3c24xx_mci_set_platdata - set platform data for mmc/sdi device | ||
45 | * @pdata: The platform data | ||
46 | * | ||
47 | * Copy the platform data supplied by @pdata so that this can be marked | ||
48 | * __initdata. | ||
49 | */ | ||
50 | extern void s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata); | ||
51 | |||
52 | #endif /* _ARCH_NCI_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/mfc.h b/arch/arm/plat-samsung/include/plat/mfc.h new file mode 100644 index 000000000000..ac13227272f0 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/mfc.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Samsung Electronics Co.Ltd | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef __PLAT_SAMSUNG_MFC_H | ||
11 | #define __PLAT_SAMSUNG_MFC_H __FILE__ | ||
12 | |||
13 | /** | ||
14 | * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver | ||
15 | * @rbase: base address for MFC 'right' memory interface | ||
16 | * @rsize: size of the memory reserved for MFC 'right' interface | ||
17 | * @lbase: base address for MFC 'left' memory interface | ||
18 | * @lsize: size of the memory reserved for MFC 'left' interface | ||
19 | * | ||
20 | * This function reserves system memory for both MFC device memory | ||
21 | * interfaces and registers it to respective struct device entries as | ||
22 | * coherent memory. | ||
23 | */ | ||
24 | void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, | ||
25 | phys_addr_t lbase, unsigned int lsize); | ||
26 | |||
27 | #endif /* __PLAT_SAMSUNG_MFC_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/mipi_csis.h b/arch/arm/plat-samsung/include/plat/mipi_csis.h new file mode 100644 index 000000000000..c45b1e8d4c2e --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/mipi_csis.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010-2011 Samsung Electronics Co., Ltd. | ||
3 | * | ||
4 | * S5P series MIPI CSI slave device support | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __PLAT_SAMSUNG_MIPI_CSIS_H_ | ||
12 | #define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__ | ||
13 | |||
14 | struct platform_device; | ||
15 | |||
16 | /** | ||
17 | * struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver | ||
18 | * @clk_rate: bus clock frequency | ||
19 | * @lanes: number of data lanes used | ||
20 | * @alignment: data alignment in bits | ||
21 | * @hs_settle: HS-RX settle time | ||
22 | * @fixed_phy_vdd: false to enable external D-PHY regulator management in the | ||
23 | * driver or true in case this regulator has no enable function | ||
24 | * @phy_enable: pointer to a callback controlling D-PHY enable/reset | ||
25 | */ | ||
26 | struct s5p_platform_mipi_csis { | ||
27 | unsigned long clk_rate; | ||
28 | u8 lanes; | ||
29 | u8 alignment; | ||
30 | u8 hs_settle; | ||
31 | bool fixed_phy_vdd; | ||
32 | int (*phy_enable)(struct platform_device *pdev, bool on); | ||
33 | }; | ||
34 | |||
35 | /** | ||
36 | * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control | ||
37 | * @pdev: MIPI-CSIS platform device | ||
38 | * @on: true to enable D-PHY and deassert its reset | ||
39 | * false to disable D-PHY | ||
40 | */ | ||
41 | int s5p_csis_phy_enable(struct platform_device *pdev, bool on); | ||
42 | |||
43 | #endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/pll.h b/arch/arm/plat-samsung/include/plat/pll.h new file mode 100644 index 000000000000..357af7c1c664 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/pll.h | |||
@@ -0,0 +1,323 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/pll.h | ||
2 | * | ||
3 | * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Copyright 2008 Openmoko, Inc. | ||
7 | * Copyright 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk> | ||
9 | * http://armlinux.simtec.co.uk/ | ||
10 | * | ||
11 | * Samsung PLL codes | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #include <asm/div64.h> | ||
19 | |||
20 | #define S3C24XX_PLL_MDIV_MASK (0xFF) | ||
21 | #define S3C24XX_PLL_PDIV_MASK (0x1F) | ||
22 | #define S3C24XX_PLL_SDIV_MASK (0x3) | ||
23 | #define S3C24XX_PLL_MDIV_SHIFT (12) | ||
24 | #define S3C24XX_PLL_PDIV_SHIFT (4) | ||
25 | #define S3C24XX_PLL_SDIV_SHIFT (0) | ||
26 | |||
27 | static inline unsigned int s3c24xx_get_pll(unsigned int pllval, | ||
28 | unsigned int baseclk) | ||
29 | { | ||
30 | unsigned int mdiv, pdiv, sdiv; | ||
31 | uint64_t fvco; | ||
32 | |||
33 | mdiv = (pllval >> S3C24XX_PLL_MDIV_SHIFT) & S3C24XX_PLL_MDIV_MASK; | ||
34 | pdiv = (pllval >> S3C24XX_PLL_PDIV_SHIFT) & S3C24XX_PLL_PDIV_MASK; | ||
35 | sdiv = (pllval >> S3C24XX_PLL_SDIV_SHIFT) & S3C24XX_PLL_SDIV_MASK; | ||
36 | |||
37 | fvco = (uint64_t)baseclk * (mdiv + 8); | ||
38 | do_div(fvco, (pdiv + 2) << sdiv); | ||
39 | |||
40 | return (unsigned int)fvco; | ||
41 | } | ||
42 | |||
43 | #define S3C2416_PLL_MDIV_MASK (0x3FF) | ||
44 | #define S3C2416_PLL_PDIV_MASK (0x3F) | ||
45 | #define S3C2416_PLL_SDIV_MASK (0x7) | ||
46 | #define S3C2416_PLL_MDIV_SHIFT (14) | ||
47 | #define S3C2416_PLL_PDIV_SHIFT (5) | ||
48 | #define S3C2416_PLL_SDIV_SHIFT (0) | ||
49 | |||
50 | static inline unsigned int s3c2416_get_pll(unsigned int pllval, | ||
51 | unsigned int baseclk) | ||
52 | { | ||
53 | unsigned int mdiv, pdiv, sdiv; | ||
54 | uint64_t fvco; | ||
55 | |||
56 | mdiv = (pllval >> S3C2416_PLL_MDIV_SHIFT) & S3C2416_PLL_MDIV_MASK; | ||
57 | pdiv = (pllval >> S3C2416_PLL_PDIV_SHIFT) & S3C2416_PLL_PDIV_MASK; | ||
58 | sdiv = (pllval >> S3C2416_PLL_SDIV_SHIFT) & S3C2416_PLL_SDIV_MASK; | ||
59 | |||
60 | fvco = (uint64_t)baseclk * mdiv; | ||
61 | do_div(fvco, (pdiv << sdiv)); | ||
62 | |||
63 | return (unsigned int)fvco; | ||
64 | } | ||
65 | |||
66 | #define S3C6400_PLL_MDIV_MASK (0x3FF) | ||
67 | #define S3C6400_PLL_PDIV_MASK (0x3F) | ||
68 | #define S3C6400_PLL_SDIV_MASK (0x7) | ||
69 | #define S3C6400_PLL_MDIV_SHIFT (16) | ||
70 | #define S3C6400_PLL_PDIV_SHIFT (8) | ||
71 | #define S3C6400_PLL_SDIV_SHIFT (0) | ||
72 | |||
73 | static inline unsigned long s3c6400_get_pll(unsigned long baseclk, | ||
74 | u32 pllcon) | ||
75 | { | ||
76 | u32 mdiv, pdiv, sdiv; | ||
77 | u64 fvco = baseclk; | ||
78 | |||
79 | mdiv = (pllcon >> S3C6400_PLL_MDIV_SHIFT) & S3C6400_PLL_MDIV_MASK; | ||
80 | pdiv = (pllcon >> S3C6400_PLL_PDIV_SHIFT) & S3C6400_PLL_PDIV_MASK; | ||
81 | sdiv = (pllcon >> S3C6400_PLL_SDIV_SHIFT) & S3C6400_PLL_SDIV_MASK; | ||
82 | |||
83 | fvco *= mdiv; | ||
84 | do_div(fvco, (pdiv << sdiv)); | ||
85 | |||
86 | return (unsigned long)fvco; | ||
87 | } | ||
88 | |||
89 | #define PLL6553X_MDIV_MASK (0x7F) | ||
90 | #define PLL6553X_PDIV_MASK (0x1F) | ||
91 | #define PLL6553X_SDIV_MASK (0x3) | ||
92 | #define PLL6553X_KDIV_MASK (0xFFFF) | ||
93 | #define PLL6553X_MDIV_SHIFT (16) | ||
94 | #define PLL6553X_PDIV_SHIFT (8) | ||
95 | #define PLL6553X_SDIV_SHIFT (0) | ||
96 | |||
97 | static inline unsigned long s3c_get_pll6553x(unsigned long baseclk, | ||
98 | u32 pll_con0, u32 pll_con1) | ||
99 | { | ||
100 | unsigned long result; | ||
101 | u32 mdiv, pdiv, sdiv, kdiv; | ||
102 | u64 tmp; | ||
103 | |||
104 | mdiv = (pll_con0 >> PLL6553X_MDIV_SHIFT) & PLL6553X_MDIV_MASK; | ||
105 | pdiv = (pll_con0 >> PLL6553X_PDIV_SHIFT) & PLL6553X_PDIV_MASK; | ||
106 | sdiv = (pll_con0 >> PLL6553X_SDIV_SHIFT) & PLL6553X_SDIV_MASK; | ||
107 | kdiv = pll_con1 & PLL6553X_KDIV_MASK; | ||
108 | |||
109 | /* | ||
110 | * We need to multiple baseclk by mdiv (the integer part) and kdiv | ||
111 | * which is in 2^16ths, so shift mdiv up (does not overflow) and | ||
112 | * add kdiv before multiplying. The use of tmp is to avoid any | ||
113 | * overflows before shifting bac down into result when multipling | ||
114 | * by the mdiv and kdiv pair. | ||
115 | */ | ||
116 | |||
117 | tmp = baseclk; | ||
118 | tmp *= (mdiv << 16) + kdiv; | ||
119 | do_div(tmp, (pdiv << sdiv)); | ||
120 | result = tmp >> 16; | ||
121 | |||
122 | return result; | ||
123 | } | ||
124 | |||
125 | #define PLL35XX_MDIV_MASK (0x3FF) | ||
126 | #define PLL35XX_PDIV_MASK (0x3F) | ||
127 | #define PLL35XX_SDIV_MASK (0x7) | ||
128 | #define PLL35XX_MDIV_SHIFT (16) | ||
129 | #define PLL35XX_PDIV_SHIFT (8) | ||
130 | #define PLL35XX_SDIV_SHIFT (0) | ||
131 | |||
132 | static inline unsigned long s5p_get_pll35xx(unsigned long baseclk, u32 pll_con) | ||
133 | { | ||
134 | u32 mdiv, pdiv, sdiv; | ||
135 | u64 fvco = baseclk; | ||
136 | |||
137 | mdiv = (pll_con >> PLL35XX_MDIV_SHIFT) & PLL35XX_MDIV_MASK; | ||
138 | pdiv = (pll_con >> PLL35XX_PDIV_SHIFT) & PLL35XX_PDIV_MASK; | ||
139 | sdiv = (pll_con >> PLL35XX_SDIV_SHIFT) & PLL35XX_SDIV_MASK; | ||
140 | |||
141 | fvco *= mdiv; | ||
142 | do_div(fvco, (pdiv << sdiv)); | ||
143 | |||
144 | return (unsigned long)fvco; | ||
145 | } | ||
146 | |||
147 | #define PLL36XX_KDIV_MASK (0xFFFF) | ||
148 | #define PLL36XX_MDIV_MASK (0x1FF) | ||
149 | #define PLL36XX_PDIV_MASK (0x3F) | ||
150 | #define PLL36XX_SDIV_MASK (0x7) | ||
151 | #define PLL36XX_MDIV_SHIFT (16) | ||
152 | #define PLL36XX_PDIV_SHIFT (8) | ||
153 | #define PLL36XX_SDIV_SHIFT (0) | ||
154 | |||
155 | static inline unsigned long s5p_get_pll36xx(unsigned long baseclk, | ||
156 | u32 pll_con0, u32 pll_con1) | ||
157 | { | ||
158 | unsigned long result; | ||
159 | u32 mdiv, pdiv, sdiv, kdiv; | ||
160 | u64 tmp; | ||
161 | |||
162 | mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK; | ||
163 | pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK; | ||
164 | sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK; | ||
165 | kdiv = pll_con1 & PLL36XX_KDIV_MASK; | ||
166 | |||
167 | tmp = baseclk; | ||
168 | |||
169 | tmp *= (mdiv << 16) + kdiv; | ||
170 | do_div(tmp, (pdiv << sdiv)); | ||
171 | result = tmp >> 16; | ||
172 | |||
173 | return result; | ||
174 | } | ||
175 | |||
176 | #define PLL45XX_MDIV_MASK (0x3FF) | ||
177 | #define PLL45XX_PDIV_MASK (0x3F) | ||
178 | #define PLL45XX_SDIV_MASK (0x7) | ||
179 | #define PLL45XX_MDIV_SHIFT (16) | ||
180 | #define PLL45XX_PDIV_SHIFT (8) | ||
181 | #define PLL45XX_SDIV_SHIFT (0) | ||
182 | |||
183 | enum pll45xx_type_t { | ||
184 | pll_4500, | ||
185 | pll_4502, | ||
186 | pll_4508 | ||
187 | }; | ||
188 | |||
189 | static inline unsigned long s5p_get_pll45xx(unsigned long baseclk, u32 pll_con, | ||
190 | enum pll45xx_type_t pll_type) | ||
191 | { | ||
192 | u32 mdiv, pdiv, sdiv; | ||
193 | u64 fvco = baseclk; | ||
194 | |||
195 | mdiv = (pll_con >> PLL45XX_MDIV_SHIFT) & PLL45XX_MDIV_MASK; | ||
196 | pdiv = (pll_con >> PLL45XX_PDIV_SHIFT) & PLL45XX_PDIV_MASK; | ||
197 | sdiv = (pll_con >> PLL45XX_SDIV_SHIFT) & PLL45XX_SDIV_MASK; | ||
198 | |||
199 | if (pll_type == pll_4508) | ||
200 | sdiv = sdiv - 1; | ||
201 | |||
202 | fvco *= mdiv; | ||
203 | do_div(fvco, (pdiv << sdiv)); | ||
204 | |||
205 | return (unsigned long)fvco; | ||
206 | } | ||
207 | |||
208 | /* CON0 bit-fields */ | ||
209 | #define PLL46XX_MDIV_MASK (0x1FF) | ||
210 | #define PLL46XX_PDIV_MASK (0x3F) | ||
211 | #define PLL46XX_SDIV_MASK (0x7) | ||
212 | #define PLL46XX_LOCKED_SHIFT (29) | ||
213 | #define PLL46XX_MDIV_SHIFT (16) | ||
214 | #define PLL46XX_PDIV_SHIFT (8) | ||
215 | #define PLL46XX_SDIV_SHIFT (0) | ||
216 | |||
217 | /* CON1 bit-fields */ | ||
218 | #define PLL46XX_MRR_MASK (0x1F) | ||
219 | #define PLL46XX_MFR_MASK (0x3F) | ||
220 | #define PLL46XX_KDIV_MASK (0xFFFF) | ||
221 | #define PLL4650C_KDIV_MASK (0xFFF) | ||
222 | #define PLL46XX_MRR_SHIFT (24) | ||
223 | #define PLL46XX_MFR_SHIFT (16) | ||
224 | #define PLL46XX_KDIV_SHIFT (0) | ||
225 | |||
226 | enum pll46xx_type_t { | ||
227 | pll_4600, | ||
228 | pll_4650, | ||
229 | pll_4650c, | ||
230 | }; | ||
231 | |||
232 | static inline unsigned long s5p_get_pll46xx(unsigned long baseclk, | ||
233 | u32 pll_con0, u32 pll_con1, | ||
234 | enum pll46xx_type_t pll_type) | ||
235 | { | ||
236 | unsigned long result; | ||
237 | u32 mdiv, pdiv, sdiv, kdiv; | ||
238 | u64 tmp; | ||
239 | |||
240 | mdiv = (pll_con0 >> PLL46XX_MDIV_SHIFT) & PLL46XX_MDIV_MASK; | ||
241 | pdiv = (pll_con0 >> PLL46XX_PDIV_SHIFT) & PLL46XX_PDIV_MASK; | ||
242 | sdiv = (pll_con0 >> PLL46XX_SDIV_SHIFT) & PLL46XX_SDIV_MASK; | ||
243 | kdiv = pll_con1 & PLL46XX_KDIV_MASK; | ||
244 | |||
245 | if (pll_type == pll_4650c) | ||
246 | kdiv = pll_con1 & PLL4650C_KDIV_MASK; | ||
247 | else | ||
248 | kdiv = pll_con1 & PLL46XX_KDIV_MASK; | ||
249 | |||
250 | tmp = baseclk; | ||
251 | |||
252 | if (pll_type == pll_4600) { | ||
253 | tmp *= (mdiv << 16) + kdiv; | ||
254 | do_div(tmp, (pdiv << sdiv)); | ||
255 | result = tmp >> 16; | ||
256 | } else { | ||
257 | tmp *= (mdiv << 10) + kdiv; | ||
258 | do_div(tmp, (pdiv << sdiv)); | ||
259 | result = tmp >> 10; | ||
260 | } | ||
261 | |||
262 | return result; | ||
263 | } | ||
264 | |||
265 | #define PLL90XX_MDIV_MASK (0xFF) | ||
266 | #define PLL90XX_PDIV_MASK (0x3F) | ||
267 | #define PLL90XX_SDIV_MASK (0x7) | ||
268 | #define PLL90XX_KDIV_MASK (0xffff) | ||
269 | #define PLL90XX_LOCKED_SHIFT (29) | ||
270 | #define PLL90XX_MDIV_SHIFT (16) | ||
271 | #define PLL90XX_PDIV_SHIFT (8) | ||
272 | #define PLL90XX_SDIV_SHIFT (0) | ||
273 | #define PLL90XX_KDIV_SHIFT (0) | ||
274 | |||
275 | static inline unsigned long s5p_get_pll90xx(unsigned long baseclk, | ||
276 | u32 pll_con, u32 pll_conk) | ||
277 | { | ||
278 | unsigned long result; | ||
279 | u32 mdiv, pdiv, sdiv, kdiv; | ||
280 | u64 tmp; | ||
281 | |||
282 | mdiv = (pll_con >> PLL90XX_MDIV_SHIFT) & PLL90XX_MDIV_MASK; | ||
283 | pdiv = (pll_con >> PLL90XX_PDIV_SHIFT) & PLL90XX_PDIV_MASK; | ||
284 | sdiv = (pll_con >> PLL90XX_SDIV_SHIFT) & PLL90XX_SDIV_MASK; | ||
285 | kdiv = pll_conk & PLL90XX_KDIV_MASK; | ||
286 | |||
287 | /* | ||
288 | * We need to multiple baseclk by mdiv (the integer part) and kdiv | ||
289 | * which is in 2^16ths, so shift mdiv up (does not overflow) and | ||
290 | * add kdiv before multiplying. The use of tmp is to avoid any | ||
291 | * overflows before shifting bac down into result when multipling | ||
292 | * by the mdiv and kdiv pair. | ||
293 | */ | ||
294 | |||
295 | tmp = baseclk; | ||
296 | tmp *= (mdiv << 16) + kdiv; | ||
297 | do_div(tmp, (pdiv << sdiv)); | ||
298 | result = tmp >> 16; | ||
299 | |||
300 | return result; | ||
301 | } | ||
302 | |||
303 | #define PLL65XX_MDIV_MASK (0x3FF) | ||
304 | #define PLL65XX_PDIV_MASK (0x3F) | ||
305 | #define PLL65XX_SDIV_MASK (0x7) | ||
306 | #define PLL65XX_MDIV_SHIFT (16) | ||
307 | #define PLL65XX_PDIV_SHIFT (8) | ||
308 | #define PLL65XX_SDIV_SHIFT (0) | ||
309 | |||
310 | static inline unsigned long s5p_get_pll65xx(unsigned long baseclk, u32 pll_con) | ||
311 | { | ||
312 | u32 mdiv, pdiv, sdiv; | ||
313 | u64 fvco = baseclk; | ||
314 | |||
315 | mdiv = (pll_con >> PLL65XX_MDIV_SHIFT) & PLL65XX_MDIV_MASK; | ||
316 | pdiv = (pll_con >> PLL65XX_PDIV_SHIFT) & PLL65XX_PDIV_MASK; | ||
317 | sdiv = (pll_con >> PLL65XX_SDIV_SHIFT) & PLL65XX_SDIV_MASK; | ||
318 | |||
319 | fvco *= mdiv; | ||
320 | do_div(fvco, (pdiv << sdiv)); | ||
321 | |||
322 | return (unsigned long)fvco; | ||
323 | } | ||
diff --git a/arch/arm/plat-samsung/include/plat/pll6553x.h b/arch/arm/plat-samsung/include/plat/pll6553x.h deleted file mode 100644 index b8b7e1d884f8..000000000000 --- a/arch/arm/plat-samsung/include/plat/pll6553x.h +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/pll6553x.h | ||
2 | * partially from arch/arm/mach-s3c64xx/include/mach/pll.h | ||
3 | * | ||
4 | * Copyright 2008 Openmoko, Inc. | ||
5 | * Copyright 2008 Simtec Electronics | ||
6 | * Ben Dooks <ben@simtec.co.uk> | ||
7 | * http://armlinux.simtec.co.uk/ | ||
8 | * | ||
9 | * Samsung PLL6553x PLL code | ||
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 | /* S3C6400 and compatible (S3C2416, etc.) EPLL code */ | ||
17 | |||
18 | #define PLL6553X_MDIV_MASK ((1 << (23-16)) - 1) | ||
19 | #define PLL6553X_PDIV_MASK ((1 << (13-8)) - 1) | ||
20 | #define PLL6553X_SDIV_MASK ((1 << (2-0)) - 1) | ||
21 | #define PLL6553X_MDIV_SHIFT (16) | ||
22 | #define PLL6553X_PDIV_SHIFT (8) | ||
23 | #define PLL6553X_SDIV_SHIFT (0) | ||
24 | #define PLL6553X_KDIV_MASK (0xffff) | ||
25 | |||
26 | static inline unsigned long s3c_get_pll6553x(unsigned long baseclk, | ||
27 | u32 pll0, u32 pll1) | ||
28 | { | ||
29 | unsigned long result; | ||
30 | u32 mdiv, pdiv, sdiv, kdiv; | ||
31 | u64 tmp; | ||
32 | |||
33 | mdiv = (pll0 >> PLL6553X_MDIV_SHIFT) & PLL6553X_MDIV_MASK; | ||
34 | pdiv = (pll0 >> PLL6553X_PDIV_SHIFT) & PLL6553X_PDIV_MASK; | ||
35 | sdiv = (pll0 >> PLL6553X_SDIV_SHIFT) & PLL6553X_SDIV_MASK; | ||
36 | kdiv = pll1 & PLL6553X_KDIV_MASK; | ||
37 | |||
38 | /* We need to multiple baseclk by mdiv (the integer part) and kdiv | ||
39 | * which is in 2^16ths, so shift mdiv up (does not overflow) and | ||
40 | * add kdiv before multiplying. The use of tmp is to avoid any | ||
41 | * overflows before shifting bac down into result when multipling | ||
42 | * by the mdiv and kdiv pair. | ||
43 | */ | ||
44 | |||
45 | tmp = baseclk; | ||
46 | tmp *= (mdiv << 16) + kdiv; | ||
47 | do_div(tmp, (pdiv << sdiv)); | ||
48 | result = tmp >> 16; | ||
49 | |||
50 | return result; | ||
51 | } | ||
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h index f6749916d194..dcf68709f9cf 100644 --- a/arch/arm/plat-samsung/include/plat/pm.h +++ b/arch/arm/plat-samsung/include/plat/pm.h | |||
@@ -165,20 +165,20 @@ extern void s3c_pm_check_store(void); | |||
165 | extern void s3c_pm_configure_extint(void); | 165 | extern void s3c_pm_configure_extint(void); |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * s3c_pm_restore_gpios() - restore the state of the gpios after sleep. | 168 | * samsung_pm_restore_gpios() - restore the state of the gpios after sleep. |
169 | * | 169 | * |
170 | * Restore the state of the GPIO pins after sleep, which may involve ensuring | 170 | * Restore the state of the GPIO pins after sleep, which may involve ensuring |
171 | * that we do not glitch the state of the pins from that the bootloader's | 171 | * that we do not glitch the state of the pins from that the bootloader's |
172 | * resume code has done. | 172 | * resume code has done. |
173 | */ | 173 | */ |
174 | extern void s3c_pm_restore_gpios(void); | 174 | extern void samsung_pm_restore_gpios(void); |
175 | 175 | ||
176 | /** | 176 | /** |
177 | * s3c_pm_save_gpios() - save the state of the GPIOs for restoring after sleep. | 177 | * samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep. |
178 | * | 178 | * |
179 | * Save the GPIO states for resotration on resume. See s3c_pm_restore_gpios(). | 179 | * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios(). |
180 | */ | 180 | */ |
181 | extern void s3c_pm_save_gpios(void); | 181 | extern void samsung_pm_save_gpios(void); |
182 | 182 | ||
183 | extern void s3c_pm_save_core(void); | 183 | extern void s3c_pm_save_core(void); |
184 | extern void s3c_pm_restore_core(void); | 184 | extern void s3c_pm_restore_core(void); |
diff --git a/arch/arm/plat-samsung/include/plat/pwm-clock.h b/arch/arm/plat-samsung/include/plat/pwm-clock.h new file mode 100644 index 000000000000..bf6a60eb6237 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/pwm-clock.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/pwm-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright 2008 Openmoko, Inc. | ||
7 | * Copyright 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk> | ||
9 | * http://armlinux.simtec.co.uk/ | ||
10 | * | ||
11 | * SAMSUNG - pwm clock and timer support | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_PLAT_PWM_CLOCK_H | ||
19 | #define __ASM_PLAT_PWM_CLOCK_H __FILE__ | ||
20 | |||
21 | /** | ||
22 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk | ||
23 | * @tcfg: The timer TCFG1 register bits shifted down to 0. | ||
24 | * | ||
25 | * Return true if the given configuration from TCFG1 is a TCLK instead | ||
26 | * any of the TDIV clocks. | ||
27 | */ | ||
28 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | ||
29 | { | ||
30 | if (soc_is_s3c24xx()) | ||
31 | return tcfg == S3C2410_TCFG1_MUX_TCLK; | ||
32 | else if (soc_is_s3c64xx() || soc_is_s5pc100()) | ||
33 | return tcfg >= S3C64XX_TCFG1_MUX_TCLK; | ||
34 | else if (soc_is_s5p6440() || soc_is_s5p6450()) | ||
35 | return 0; | ||
36 | else | ||
37 | return tcfg == S3C64XX_TCFG1_MUX_TCLK; | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * tcfg_to_divisor() - convert tcfg1 setting to a divisor | ||
42 | * @tcfg1: The tcfg1 setting, shifted down. | ||
43 | * | ||
44 | * Get the divisor value for the given tcfg1 setting. We assume the | ||
45 | * caller has already checked to see if this is not a TCLK source. | ||
46 | */ | ||
47 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | ||
48 | { | ||
49 | if (soc_is_s3c24xx()) | ||
50 | return 1 << (tcfg1 + 1); | ||
51 | else | ||
52 | return 1 << tcfg1; | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * pwm_tdiv_has_div1() - does the tdiv setting have a /1 | ||
57 | * | ||
58 | * Return true if we have a /1 in the tdiv setting. | ||
59 | */ | ||
60 | static inline unsigned int pwm_tdiv_has_div1(void) | ||
61 | { | ||
62 | if (soc_is_s3c24xx()) | ||
63 | return 0; | ||
64 | else | ||
65 | return 1; | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * pwm_tdiv_div_bits() - calculate TCFG1 divisor value. | ||
70 | * @div: The divisor to calculate the bit information for. | ||
71 | * | ||
72 | * Turn a divisor into the necessary bit field for TCFG1. | ||
73 | */ | ||
74 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) | ||
75 | { | ||
76 | if (soc_is_s3c24xx()) | ||
77 | return ilog2(div) - 1; | ||
78 | else | ||
79 | return ilog2(div); | ||
80 | } | ||
81 | #endif /* __ASM_PLAT_PWM_CLOCK_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/regs-adc.h b/arch/arm/plat-samsung/include/plat/regs-adc.h index 035e8c38d69c..70612100120f 100644 --- a/arch/arm/plat-samsung/include/plat/regs-adc.h +++ b/arch/arm/plat-samsung/include/plat/regs-adc.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C) | 20 | #define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C) |
21 | #define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) | 21 | #define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) |
22 | #define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) | 22 | #define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) |
23 | #define S3C2443_ADCMUX S3C2410_ADCREG(0x18) | ||
23 | #define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) | 24 | #define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) |
24 | #define S5P_ADCMUX S3C2410_ADCREG(0x1C) | 25 | #define S5P_ADCMUX S3C2410_ADCREG(0x1C) |
25 | #define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) | 26 | #define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) |
@@ -33,6 +34,7 @@ | |||
33 | #define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6) | 34 | #define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6) |
34 | #define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3) | 35 | #define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3) |
35 | #define S3C2410_ADCCON_MUXMASK (0x7<<3) | 36 | #define S3C2410_ADCCON_MUXMASK (0x7<<3) |
37 | #define S3C2416_ADCCON_RESSEL (1 << 3) | ||
36 | #define S3C2410_ADCCON_STDBM (1<<2) | 38 | #define S3C2410_ADCCON_STDBM (1<<2) |
37 | #define S3C2410_ADCCON_READ_START (1<<1) | 39 | #define S3C2410_ADCCON_READ_START (1<<1) |
38 | #define S3C2410_ADCCON_ENABLE_START (1<<0) | 40 | #define S3C2410_ADCCON_ENABLE_START (1<<0) |
@@ -40,6 +42,7 @@ | |||
40 | 42 | ||
41 | 43 | ||
42 | /* ADCTSC Register Bits */ | 44 | /* ADCTSC Register Bits */ |
45 | #define S3C2443_ADCTSC_UD_SEN (1 << 8) | ||
43 | #define S3C2410_ADCTSC_YM_SEN (1<<7) | 46 | #define S3C2410_ADCTSC_YM_SEN (1<<7) |
44 | #define S3C2410_ADCTSC_YP_SEN (1<<6) | 47 | #define S3C2410_ADCTSC_YP_SEN (1<<6) |
45 | #define S3C2410_ADCTSC_XM_SEN (1<<5) | 48 | #define S3C2410_ADCTSC_XM_SEN (1<<5) |
diff --git a/arch/arm/plat-samsung/include/plat/regs-dma.h b/arch/arm/plat-samsung/include/plat/regs-dma.h new file mode 100644 index 000000000000..178bccbe4804 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/regs-dma.h | |||
@@ -0,0 +1,151 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/regs-dma.h | ||
2 | * | ||
3 | * Copyright (C) 2003-2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Samsung S3C24XX DMA 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 | #ifndef __ASM_PLAT_REGS_DMA_H | ||
14 | #define __ASM_PLAT_REGS_DMA_H __FILE__ | ||
15 | |||
16 | #define S3C2410_DMA_DISRC (0x00) | ||
17 | #define S3C2410_DMA_DISRCC (0x04) | ||
18 | #define S3C2410_DMA_DIDST (0x08) | ||
19 | #define S3C2410_DMA_DIDSTC (0x0C) | ||
20 | #define S3C2410_DMA_DCON (0x10) | ||
21 | #define S3C2410_DMA_DSTAT (0x14) | ||
22 | #define S3C2410_DMA_DCSRC (0x18) | ||
23 | #define S3C2410_DMA_DCDST (0x1C) | ||
24 | #define S3C2410_DMA_DMASKTRIG (0x20) | ||
25 | #define S3C2412_DMA_DMAREQSEL (0x24) | ||
26 | #define S3C2443_DMA_DMAREQSEL (0x24) | ||
27 | |||
28 | #define S3C2410_DISRCC_INC (1 << 0) | ||
29 | #define S3C2410_DISRCC_APB (1 << 1) | ||
30 | |||
31 | #define S3C2410_DMASKTRIG_STOP (1 << 2) | ||
32 | #define S3C2410_DMASKTRIG_ON (1 << 1) | ||
33 | #define S3C2410_DMASKTRIG_SWTRIG (1 << 0) | ||
34 | |||
35 | #define S3C2410_DCON_DEMAND (0 << 31) | ||
36 | #define S3C2410_DCON_HANDSHAKE (1 << 31) | ||
37 | #define S3C2410_DCON_SYNC_PCLK (0 << 30) | ||
38 | #define S3C2410_DCON_SYNC_HCLK (1 << 30) | ||
39 | |||
40 | #define S3C2410_DCON_INTREQ (1 << 29) | ||
41 | |||
42 | #define S3C2410_DCON_CH0_XDREQ0 (0 << 24) | ||
43 | #define S3C2410_DCON_CH0_UART0 (1 << 24) | ||
44 | #define S3C2410_DCON_CH0_SDI (2 << 24) | ||
45 | #define S3C2410_DCON_CH0_TIMER (3 << 24) | ||
46 | #define S3C2410_DCON_CH0_USBEP1 (4 << 24) | ||
47 | |||
48 | #define S3C2410_DCON_CH1_XDREQ1 (0 << 24) | ||
49 | #define S3C2410_DCON_CH1_UART1 (1 << 24) | ||
50 | #define S3C2410_DCON_CH1_I2SSDI (2 << 24) | ||
51 | #define S3C2410_DCON_CH1_SPI (3 << 24) | ||
52 | #define S3C2410_DCON_CH1_USBEP2 (4 << 24) | ||
53 | |||
54 | #define S3C2410_DCON_CH2_I2SSDO (0 << 24) | ||
55 | #define S3C2410_DCON_CH2_I2SSDI (1 << 24) | ||
56 | #define S3C2410_DCON_CH2_SDI (2 << 24) | ||
57 | #define S3C2410_DCON_CH2_TIMER (3 << 24) | ||
58 | #define S3C2410_DCON_CH2_USBEP3 (4 << 24) | ||
59 | |||
60 | #define S3C2410_DCON_CH3_UART2 (0 << 24) | ||
61 | #define S3C2410_DCON_CH3_SDI (1 << 24) | ||
62 | #define S3C2410_DCON_CH3_SPI (2 << 24) | ||
63 | #define S3C2410_DCON_CH3_TIMER (3 << 24) | ||
64 | #define S3C2410_DCON_CH3_USBEP4 (4 << 24) | ||
65 | |||
66 | #define S3C2410_DCON_SRCSHIFT (24) | ||
67 | #define S3C2410_DCON_SRCMASK (7 << 24) | ||
68 | |||
69 | #define S3C2410_DCON_BYTE (0 << 20) | ||
70 | #define S3C2410_DCON_HALFWORD (1 << 20) | ||
71 | #define S3C2410_DCON_WORD (2 << 20) | ||
72 | |||
73 | #define S3C2410_DCON_AUTORELOAD (0 << 22) | ||
74 | #define S3C2410_DCON_NORELOAD (1 << 22) | ||
75 | #define S3C2410_DCON_HWTRIG (1 << 23) | ||
76 | |||
77 | #ifdef CONFIG_CPU_S3C2440 | ||
78 | |||
79 | #define S3C2440_DIDSTC_CHKINT (1 << 2) | ||
80 | |||
81 | #define S3C2440_DCON_CH0_I2SSDO (5 << 24) | ||
82 | #define S3C2440_DCON_CH0_PCMIN (6 << 24) | ||
83 | |||
84 | #define S3C2440_DCON_CH1_PCMOUT (5 << 24) | ||
85 | #define S3C2440_DCON_CH1_SDI (6 << 24) | ||
86 | |||
87 | #define S3C2440_DCON_CH2_PCMIN (5 << 24) | ||
88 | #define S3C2440_DCON_CH2_MICIN (6 << 24) | ||
89 | |||
90 | #define S3C2440_DCON_CH3_MICIN (5 << 24) | ||
91 | #define S3C2440_DCON_CH3_PCMOUT (6 << 24) | ||
92 | #endif /* CONFIG_CPU_S3C2440 */ | ||
93 | |||
94 | #ifdef CONFIG_CPU_S3C2412 | ||
95 | |||
96 | #define S3C2412_DMAREQSEL_SRC(x) ((x) << 1) | ||
97 | |||
98 | #define S3C2412_DMAREQSEL_HW (1) | ||
99 | |||
100 | #define S3C2412_DMAREQSEL_SPI0TX S3C2412_DMAREQSEL_SRC(0) | ||
101 | #define S3C2412_DMAREQSEL_SPI0RX S3C2412_DMAREQSEL_SRC(1) | ||
102 | #define S3C2412_DMAREQSEL_SPI1TX S3C2412_DMAREQSEL_SRC(2) | ||
103 | #define S3C2412_DMAREQSEL_SPI1RX S3C2412_DMAREQSEL_SRC(3) | ||
104 | #define S3C2412_DMAREQSEL_I2STX S3C2412_DMAREQSEL_SRC(4) | ||
105 | #define S3C2412_DMAREQSEL_I2SRX S3C2412_DMAREQSEL_SRC(5) | ||
106 | #define S3C2412_DMAREQSEL_TIMER S3C2412_DMAREQSEL_SRC(9) | ||
107 | #define S3C2412_DMAREQSEL_SDI S3C2412_DMAREQSEL_SRC(10) | ||
108 | #define S3C2412_DMAREQSEL_USBEP1 S3C2412_DMAREQSEL_SRC(13) | ||
109 | #define S3C2412_DMAREQSEL_USBEP2 S3C2412_DMAREQSEL_SRC(14) | ||
110 | #define S3C2412_DMAREQSEL_USBEP3 S3C2412_DMAREQSEL_SRC(15) | ||
111 | #define S3C2412_DMAREQSEL_USBEP4 S3C2412_DMAREQSEL_SRC(16) | ||
112 | #define S3C2412_DMAREQSEL_XDREQ0 S3C2412_DMAREQSEL_SRC(17) | ||
113 | #define S3C2412_DMAREQSEL_XDREQ1 S3C2412_DMAREQSEL_SRC(18) | ||
114 | #define S3C2412_DMAREQSEL_UART0_0 S3C2412_DMAREQSEL_SRC(19) | ||
115 | #define S3C2412_DMAREQSEL_UART0_1 S3C2412_DMAREQSEL_SRC(20) | ||
116 | #define S3C2412_DMAREQSEL_UART1_0 S3C2412_DMAREQSEL_SRC(21) | ||
117 | #define S3C2412_DMAREQSEL_UART1_1 S3C2412_DMAREQSEL_SRC(22) | ||
118 | #define S3C2412_DMAREQSEL_UART2_0 S3C2412_DMAREQSEL_SRC(23) | ||
119 | #define S3C2412_DMAREQSEL_UART2_1 S3C2412_DMAREQSEL_SRC(24) | ||
120 | #endif /* CONFIG_CPU_S3C2412 */ | ||
121 | |||
122 | #ifdef CONFIG_CPU_S3C2443 | ||
123 | |||
124 | #define S3C2443_DMAREQSEL_SRC(x) ((x) << 1) | ||
125 | |||
126 | #define S3C2443_DMAREQSEL_HW (1) | ||
127 | |||
128 | #define S3C2443_DMAREQSEL_SPI0TX S3C2443_DMAREQSEL_SRC(0) | ||
129 | #define S3C2443_DMAREQSEL_SPI0RX S3C2443_DMAREQSEL_SRC(1) | ||
130 | #define S3C2443_DMAREQSEL_SPI1TX S3C2443_DMAREQSEL_SRC(2) | ||
131 | #define S3C2443_DMAREQSEL_SPI1RX S3C2443_DMAREQSEL_SRC(3) | ||
132 | #define S3C2443_DMAREQSEL_I2STX S3C2443_DMAREQSEL_SRC(4) | ||
133 | #define S3C2443_DMAREQSEL_I2SRX S3C2443_DMAREQSEL_SRC(5) | ||
134 | #define S3C2443_DMAREQSEL_TIMER S3C2443_DMAREQSEL_SRC(9) | ||
135 | #define S3C2443_DMAREQSEL_SDI S3C2443_DMAREQSEL_SRC(10) | ||
136 | #define S3C2443_DMAREQSEL_XDREQ0 S3C2443_DMAREQSEL_SRC(17) | ||
137 | #define S3C2443_DMAREQSEL_XDREQ1 S3C2443_DMAREQSEL_SRC(18) | ||
138 | #define S3C2443_DMAREQSEL_UART0_0 S3C2443_DMAREQSEL_SRC(19) | ||
139 | #define S3C2443_DMAREQSEL_UART0_1 S3C2443_DMAREQSEL_SRC(20) | ||
140 | #define S3C2443_DMAREQSEL_UART1_0 S3C2443_DMAREQSEL_SRC(21) | ||
141 | #define S3C2443_DMAREQSEL_UART1_1 S3C2443_DMAREQSEL_SRC(22) | ||
142 | #define S3C2443_DMAREQSEL_UART2_0 S3C2443_DMAREQSEL_SRC(23) | ||
143 | #define S3C2443_DMAREQSEL_UART2_1 S3C2443_DMAREQSEL_SRC(24) | ||
144 | #define S3C2443_DMAREQSEL_UART3_0 S3C2443_DMAREQSEL_SRC(25) | ||
145 | #define S3C2443_DMAREQSEL_UART3_1 S3C2443_DMAREQSEL_SRC(26) | ||
146 | #define S3C2443_DMAREQSEL_PCMOUT S3C2443_DMAREQSEL_SRC(27) | ||
147 | #define S3C2443_DMAREQSEL_PCMIN S3C2443_DMAREQSEL_SRC(28) | ||
148 | #define S3C2443_DMAREQSEL_MICIN S3C2443_DMAREQSEL_SRC(29) | ||
149 | #endif /* CONFIG_CPU_S3C2443 */ | ||
150 | |||
151 | #endif /* __ASM_PLAT_REGS_DMA_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/regs-iis.h b/arch/arm/plat-samsung/include/plat/regs-iis.h new file mode 100644 index 000000000000..a18d35e7a735 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/regs-iis.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/regs-iis.h | ||
2 | * | ||
3 | * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * S3C2410 IIS register definition | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_REGS_IIS_H | ||
14 | #define __ASM_ARCH_REGS_IIS_H | ||
15 | |||
16 | #define S3C2410_IISCON (0x00) | ||
17 | |||
18 | #define S3C2410_IISCON_LRINDEX (1 << 8) | ||
19 | #define S3C2410_IISCON_TXFIFORDY (1 << 7) | ||
20 | #define S3C2410_IISCON_RXFIFORDY (1 << 6) | ||
21 | #define S3C2410_IISCON_TXDMAEN (1 << 5) | ||
22 | #define S3C2410_IISCON_RXDMAEN (1 << 4) | ||
23 | #define S3C2410_IISCON_TXIDLE (1 << 3) | ||
24 | #define S3C2410_IISCON_RXIDLE (1 << 2) | ||
25 | #define S3C2410_IISCON_PSCEN (1 << 1) | ||
26 | #define S3C2410_IISCON_IISEN (1 << 0) | ||
27 | |||
28 | #define S3C2410_IISMOD (0x04) | ||
29 | |||
30 | #define S3C2440_IISMOD_MPLL (1 << 9) | ||
31 | #define S3C2410_IISMOD_SLAVE (1 << 8) | ||
32 | #define S3C2410_IISMOD_NOXFER (0 << 6) | ||
33 | #define S3C2410_IISMOD_RXMODE (1 << 6) | ||
34 | #define S3C2410_IISMOD_TXMODE (2 << 6) | ||
35 | #define S3C2410_IISMOD_TXRXMODE (3 << 6) | ||
36 | #define S3C2410_IISMOD_LR_LLOW (0 << 5) | ||
37 | #define S3C2410_IISMOD_LR_RLOW (1 << 5) | ||
38 | #define S3C2410_IISMOD_IIS (0 << 4) | ||
39 | #define S3C2410_IISMOD_MSB (1 << 4) | ||
40 | #define S3C2410_IISMOD_8BIT (0 << 3) | ||
41 | #define S3C2410_IISMOD_16BIT (1 << 3) | ||
42 | #define S3C2410_IISMOD_BITMASK (1 << 3) | ||
43 | #define S3C2410_IISMOD_256FS (0 << 2) | ||
44 | #define S3C2410_IISMOD_384FS (1 << 2) | ||
45 | #define S3C2410_IISMOD_16FS (0 << 0) | ||
46 | #define S3C2410_IISMOD_32FS (1 << 0) | ||
47 | #define S3C2410_IISMOD_48FS (2 << 0) | ||
48 | #define S3C2410_IISMOD_FS_MASK (3 << 0) | ||
49 | |||
50 | #define S3C2410_IISPSR (0x08) | ||
51 | |||
52 | #define S3C2410_IISPSR_INTMASK (31 << 5) | ||
53 | #define S3C2410_IISPSR_INTSHIFT (5) | ||
54 | #define S3C2410_IISPSR_EXTMASK (31 << 0) | ||
55 | #define S3C2410_IISPSR_EXTSHFIT (0) | ||
56 | |||
57 | #define S3C2410_IISFCON (0x0c) | ||
58 | |||
59 | #define S3C2410_IISFCON_TXDMA (1 << 15) | ||
60 | #define S3C2410_IISFCON_RXDMA (1 << 14) | ||
61 | #define S3C2410_IISFCON_TXENABLE (1 << 13) | ||
62 | #define S3C2410_IISFCON_RXENABLE (1 << 12) | ||
63 | #define S3C2410_IISFCON_TXMASK (0x3f << 6) | ||
64 | #define S3C2410_IISFCON_TXSHIFT (6) | ||
65 | #define S3C2410_IISFCON_RXMASK (0x3f) | ||
66 | #define S3C2410_IISFCON_RXSHIFT (0) | ||
67 | |||
68 | #define S3C2410_IISFIFO (0x10) | ||
69 | |||
70 | #endif /* __ASM_ARCH_REGS_IIS_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/regs-serial.h b/arch/arm/plat-samsung/include/plat/regs-serial.h index bac36fa3becb..720734847027 100644 --- a/arch/arm/plat-samsung/include/plat/regs-serial.h +++ b/arch/arm/plat-samsung/include/plat/regs-serial.h | |||
@@ -186,6 +186,11 @@ | |||
186 | #define S3C64XX_UINTSP 0x34 | 186 | #define S3C64XX_UINTSP 0x34 |
187 | #define S3C64XX_UINTM 0x38 | 187 | #define S3C64XX_UINTM 0x38 |
188 | 188 | ||
189 | #define S3C64XX_UINTM_RXD (0) | ||
190 | #define S3C64XX_UINTM_TXD (2) | ||
191 | #define S3C64XX_UINTM_RXD_MSK (1 << S3C64XX_UINTM_RXD) | ||
192 | #define S3C64XX_UINTM_TXD_MSK (1 << S3C64XX_UINTM_TXD) | ||
193 | |||
189 | /* Following are specific to S5PV210 */ | 194 | /* Following are specific to S5PV210 */ |
190 | #define S5PV210_UCON_CLKMASK (1<<10) | 195 | #define S5PV210_UCON_CLKMASK (1<<10) |
191 | #define S5PV210_UCON_PCLK (0<<10) | 196 | #define S5PV210_UCON_PCLK (0<<10) |
diff --git a/arch/arm/plat-samsung/include/plat/regs-spi.h b/arch/arm/plat-samsung/include/plat/regs-spi.h new file mode 100644 index 000000000000..552fe7cfe281 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/regs-spi.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/regs-spi.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Fetron GmbH | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * S3C2410 SPI register definition | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_ARCH_REGS_SPI_H | ||
13 | #define __ASM_ARCH_REGS_SPI_H | ||
14 | |||
15 | #define S3C2410_SPI1 (0x20) | ||
16 | #define S3C2412_SPI1 (0x100) | ||
17 | |||
18 | #define S3C2410_SPCON (0x00) | ||
19 | |||
20 | #define S3C2410_SPCON_SMOD_DMA (2 << 5) /* DMA mode */ | ||
21 | #define S3C2410_SPCON_SMOD_INT (1 << 5) /* interrupt mode */ | ||
22 | #define S3C2410_SPCON_SMOD_POLL (0 << 5) /* polling mode */ | ||
23 | #define S3C2410_SPCON_ENSCK (1 << 4) /* Enable SCK */ | ||
24 | #define S3C2410_SPCON_MSTR (1 << 3) /* Master:1, Slave:0 select */ | ||
25 | #define S3C2410_SPCON_CPOL_HIGH (1 << 2) /* Clock polarity select */ | ||
26 | #define S3C2410_SPCON_CPOL_LOW (0 << 2) /* Clock polarity select */ | ||
27 | |||
28 | #define S3C2410_SPCON_CPHA_FMTB (1 << 1) /* Clock Phase Select */ | ||
29 | #define S3C2410_SPCON_CPHA_FMTA (0 << 1) /* Clock Phase Select */ | ||
30 | |||
31 | #define S3C2410_SPSTA (0x04) | ||
32 | |||
33 | #define S3C2410_SPSTA_DCOL (1 << 2) /* Data Collision Error */ | ||
34 | #define S3C2410_SPSTA_MULD (1 << 1) /* Multi Master Error */ | ||
35 | #define S3C2410_SPSTA_READY (1 << 0) /* Data Tx/Rx ready */ | ||
36 | #define S3C2412_SPSTA_READY_ORG (1 << 3) | ||
37 | |||
38 | #define S3C2410_SPPIN (0x08) | ||
39 | |||
40 | #define S3C2410_SPPIN_ENMUL (1 << 2) /* Multi Master Error detect */ | ||
41 | #define S3C2410_SPPIN_RESERVED (1 << 1) | ||
42 | #define S3C2410_SPPIN_KEEP (1 << 0) /* Master Out keep */ | ||
43 | |||
44 | #define S3C2410_SPPRE (0x0C) | ||
45 | #define S3C2410_SPTDAT (0x10) | ||
46 | #define S3C2410_SPRDAT (0x14) | ||
47 | |||
48 | #endif /* __ASM_ARCH_REGS_SPI_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/regs-srom.h b/arch/arm/plat-samsung/include/plat/regs-srom.h new file mode 100644 index 000000000000..9b6729c81cda --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/regs-srom.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/regs-srom.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * S5P SROMC register definitions | ||
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 | #ifndef __PLAT_SAMSUNG_REGS_SROM_H | ||
14 | #define __PLAT_SAMSUNG_REGS_SROM_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | |||
18 | #define S5P_SROMREG(x) (S5P_VA_SROMC + (x)) | ||
19 | |||
20 | #define S5P_SROM_BW S5P_SROMREG(0x0) | ||
21 | #define S5P_SROM_BC0 S5P_SROMREG(0x4) | ||
22 | #define S5P_SROM_BC1 S5P_SROMREG(0x8) | ||
23 | #define S5P_SROM_BC2 S5P_SROMREG(0xc) | ||
24 | #define S5P_SROM_BC3 S5P_SROMREG(0x10) | ||
25 | #define S5P_SROM_BC4 S5P_SROMREG(0x14) | ||
26 | #define S5P_SROM_BC5 S5P_SROMREG(0x18) | ||
27 | |||
28 | /* one register BW holds 4 x 4-bit packed settings for NCS0 - NCS3 */ | ||
29 | |||
30 | #define S5P_SROM_BW__DATAWIDTH__SHIFT 0 | ||
31 | #define S5P_SROM_BW__ADDRMODE__SHIFT 1 | ||
32 | #define S5P_SROM_BW__WAITENABLE__SHIFT 2 | ||
33 | #define S5P_SROM_BW__BYTEENABLE__SHIFT 3 | ||
34 | |||
35 | #define S5P_SROM_BW__CS_MASK 0xf | ||
36 | |||
37 | #define S5P_SROM_BW__NCS0__SHIFT 0 | ||
38 | #define S5P_SROM_BW__NCS1__SHIFT 4 | ||
39 | #define S5P_SROM_BW__NCS2__SHIFT 8 | ||
40 | #define S5P_SROM_BW__NCS3__SHIFT 12 | ||
41 | #define S5P_SROM_BW__NCS4__SHIFT 16 | ||
42 | #define S5P_SROM_BW__NCS5__SHIFT 20 | ||
43 | |||
44 | /* applies to same to BCS0 - BCS3 */ | ||
45 | |||
46 | #define S5P_SROM_BCX__PMC__SHIFT 0 | ||
47 | #define S5P_SROM_BCX__TACP__SHIFT 4 | ||
48 | #define S5P_SROM_BCX__TCAH__SHIFT 8 | ||
49 | #define S5P_SROM_BCX__TCOH__SHIFT 12 | ||
50 | #define S5P_SROM_BCX__TACC__SHIFT 16 | ||
51 | #define S5P_SROM_BCX__TCOS__SHIFT 24 | ||
52 | #define S5P_SROM_BCX__TACS__SHIFT 28 | ||
53 | |||
54 | #endif /* __PLAT_SAMSUNG_REGS_SROM_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/regs-udc.h b/arch/arm/plat-samsung/include/plat/regs-udc.h new file mode 100644 index 000000000000..4003d3dab4e7 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/regs-udc.h | |||
@@ -0,0 +1,151 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/regs-udc.h | ||
2 | * | ||
3 | * Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at> | ||
4 | * | ||
5 | * This include file is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License as | ||
7 | * published by the Free Software Foundation; either version 2 of | ||
8 | * the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_ARCH_REGS_UDC_H | ||
12 | #define __ASM_ARCH_REGS_UDC_H | ||
13 | |||
14 | #define S3C2410_USBDREG(x) (x) | ||
15 | |||
16 | #define S3C2410_UDC_FUNC_ADDR_REG S3C2410_USBDREG(0x0140) | ||
17 | #define S3C2410_UDC_PWR_REG S3C2410_USBDREG(0x0144) | ||
18 | #define S3C2410_UDC_EP_INT_REG S3C2410_USBDREG(0x0148) | ||
19 | |||
20 | #define S3C2410_UDC_USB_INT_REG S3C2410_USBDREG(0x0158) | ||
21 | #define S3C2410_UDC_EP_INT_EN_REG S3C2410_USBDREG(0x015c) | ||
22 | |||
23 | #define S3C2410_UDC_USB_INT_EN_REG S3C2410_USBDREG(0x016c) | ||
24 | |||
25 | #define S3C2410_UDC_FRAME_NUM1_REG S3C2410_USBDREG(0x0170) | ||
26 | #define S3C2410_UDC_FRAME_NUM2_REG S3C2410_USBDREG(0x0174) | ||
27 | |||
28 | #define S3C2410_UDC_EP0_FIFO_REG S3C2410_USBDREG(0x01c0) | ||
29 | #define S3C2410_UDC_EP1_FIFO_REG S3C2410_USBDREG(0x01c4) | ||
30 | #define S3C2410_UDC_EP2_FIFO_REG S3C2410_USBDREG(0x01c8) | ||
31 | #define S3C2410_UDC_EP3_FIFO_REG S3C2410_USBDREG(0x01cc) | ||
32 | #define S3C2410_UDC_EP4_FIFO_REG S3C2410_USBDREG(0x01d0) | ||
33 | |||
34 | #define S3C2410_UDC_EP1_DMA_CON S3C2410_USBDREG(0x0200) | ||
35 | #define S3C2410_UDC_EP1_DMA_UNIT S3C2410_USBDREG(0x0204) | ||
36 | #define S3C2410_UDC_EP1_DMA_FIFO S3C2410_USBDREG(0x0208) | ||
37 | #define S3C2410_UDC_EP1_DMA_TTC_L S3C2410_USBDREG(0x020c) | ||
38 | #define S3C2410_UDC_EP1_DMA_TTC_M S3C2410_USBDREG(0x0210) | ||
39 | #define S3C2410_UDC_EP1_DMA_TTC_H S3C2410_USBDREG(0x0214) | ||
40 | |||
41 | #define S3C2410_UDC_EP2_DMA_CON S3C2410_USBDREG(0x0218) | ||
42 | #define S3C2410_UDC_EP2_DMA_UNIT S3C2410_USBDREG(0x021c) | ||
43 | #define S3C2410_UDC_EP2_DMA_FIFO S3C2410_USBDREG(0x0220) | ||
44 | #define S3C2410_UDC_EP2_DMA_TTC_L S3C2410_USBDREG(0x0224) | ||
45 | #define S3C2410_UDC_EP2_DMA_TTC_M S3C2410_USBDREG(0x0228) | ||
46 | #define S3C2410_UDC_EP2_DMA_TTC_H S3C2410_USBDREG(0x022c) | ||
47 | |||
48 | #define S3C2410_UDC_EP3_DMA_CON S3C2410_USBDREG(0x0240) | ||
49 | #define S3C2410_UDC_EP3_DMA_UNIT S3C2410_USBDREG(0x0244) | ||
50 | #define S3C2410_UDC_EP3_DMA_FIFO S3C2410_USBDREG(0x0248) | ||
51 | #define S3C2410_UDC_EP3_DMA_TTC_L S3C2410_USBDREG(0x024c) | ||
52 | #define S3C2410_UDC_EP3_DMA_TTC_M S3C2410_USBDREG(0x0250) | ||
53 | #define S3C2410_UDC_EP3_DMA_TTC_H S3C2410_USBDREG(0x0254) | ||
54 | |||
55 | #define S3C2410_UDC_EP4_DMA_CON S3C2410_USBDREG(0x0258) | ||
56 | #define S3C2410_UDC_EP4_DMA_UNIT S3C2410_USBDREG(0x025c) | ||
57 | #define S3C2410_UDC_EP4_DMA_FIFO S3C2410_USBDREG(0x0260) | ||
58 | #define S3C2410_UDC_EP4_DMA_TTC_L S3C2410_USBDREG(0x0264) | ||
59 | #define S3C2410_UDC_EP4_DMA_TTC_M S3C2410_USBDREG(0x0268) | ||
60 | #define S3C2410_UDC_EP4_DMA_TTC_H S3C2410_USBDREG(0x026c) | ||
61 | |||
62 | #define S3C2410_UDC_INDEX_REG S3C2410_USBDREG(0x0178) | ||
63 | |||
64 | /* indexed registers */ | ||
65 | |||
66 | #define S3C2410_UDC_MAXP_REG S3C2410_USBDREG(0x0180) | ||
67 | |||
68 | #define S3C2410_UDC_EP0_CSR_REG S3C2410_USBDREG(0x0184) | ||
69 | |||
70 | #define S3C2410_UDC_IN_CSR1_REG S3C2410_USBDREG(0x0184) | ||
71 | #define S3C2410_UDC_IN_CSR2_REG S3C2410_USBDREG(0x0188) | ||
72 | |||
73 | #define S3C2410_UDC_OUT_CSR1_REG S3C2410_USBDREG(0x0190) | ||
74 | #define S3C2410_UDC_OUT_CSR2_REG S3C2410_USBDREG(0x0194) | ||
75 | #define S3C2410_UDC_OUT_FIFO_CNT1_REG S3C2410_USBDREG(0x0198) | ||
76 | #define S3C2410_UDC_OUT_FIFO_CNT2_REG S3C2410_USBDREG(0x019c) | ||
77 | |||
78 | #define S3C2410_UDC_FUNCADDR_UPDATE (1 << 7) | ||
79 | |||
80 | #define S3C2410_UDC_PWR_ISOUP (1 << 7) /* R/W */ | ||
81 | #define S3C2410_UDC_PWR_RESET (1 << 3) /* R */ | ||
82 | #define S3C2410_UDC_PWR_RESUME (1 << 2) /* R/W */ | ||
83 | #define S3C2410_UDC_PWR_SUSPEND (1 << 1) /* R */ | ||
84 | #define S3C2410_UDC_PWR_ENSUSPEND (1 << 0) /* R/W */ | ||
85 | |||
86 | #define S3C2410_UDC_PWR_DEFAULT (0x00) | ||
87 | |||
88 | #define S3C2410_UDC_INT_EP4 (1 << 4) /* R/W (clear only) */ | ||
89 | #define S3C2410_UDC_INT_EP3 (1 << 3) /* R/W (clear only) */ | ||
90 | #define S3C2410_UDC_INT_EP2 (1 << 2) /* R/W (clear only) */ | ||
91 | #define S3C2410_UDC_INT_EP1 (1 << 1) /* R/W (clear only) */ | ||
92 | #define S3C2410_UDC_INT_EP0 (1 << 0) /* R/W (clear only) */ | ||
93 | |||
94 | #define S3C2410_UDC_USBINT_RESET (1 << 2) /* R/W (clear only) */ | ||
95 | #define S3C2410_UDC_USBINT_RESUME (1 << 1) /* R/W (clear only) */ | ||
96 | #define S3C2410_UDC_USBINT_SUSPEND (1 << 0) /* R/W (clear only) */ | ||
97 | |||
98 | #define S3C2410_UDC_INTE_EP4 (1 << 4) /* R/W */ | ||
99 | #define S3C2410_UDC_INTE_EP3 (1 << 3) /* R/W */ | ||
100 | #define S3C2410_UDC_INTE_EP2 (1 << 2) /* R/W */ | ||
101 | #define S3C2410_UDC_INTE_EP1 (1 << 1) /* R/W */ | ||
102 | #define S3C2410_UDC_INTE_EP0 (1 << 0) /* R/W */ | ||
103 | |||
104 | #define S3C2410_UDC_USBINTE_RESET (1 << 2) /* R/W */ | ||
105 | #define S3C2410_UDC_USBINTE_SUSPEND (1 << 0) /* R/W */ | ||
106 | |||
107 | #define S3C2410_UDC_INDEX_EP0 (0x00) | ||
108 | #define S3C2410_UDC_INDEX_EP1 (0x01) | ||
109 | #define S3C2410_UDC_INDEX_EP2 (0x02) | ||
110 | #define S3C2410_UDC_INDEX_EP3 (0x03) | ||
111 | #define S3C2410_UDC_INDEX_EP4 (0x04) | ||
112 | |||
113 | #define S3C2410_UDC_ICSR1_CLRDT (1 << 6) /* R/W */ | ||
114 | #define S3C2410_UDC_ICSR1_SENTSTL (1 << 5) /* R/W (clear only) */ | ||
115 | #define S3C2410_UDC_ICSR1_SENDSTL (1 << 4) /* R/W */ | ||
116 | #define S3C2410_UDC_ICSR1_FFLUSH (1 << 3) /* W (set only) */ | ||
117 | #define S3C2410_UDC_ICSR1_UNDRUN (1 << 2) /* R/W (clear only) */ | ||
118 | #define S3C2410_UDC_ICSR1_PKTRDY (1 << 0) /* R/W (set only) */ | ||
119 | |||
120 | #define S3C2410_UDC_ICSR2_AUTOSET (1 << 7) /* R/W */ | ||
121 | #define S3C2410_UDC_ICSR2_ISO (1 << 6) /* R/W */ | ||
122 | #define S3C2410_UDC_ICSR2_MODEIN (1 << 5) /* R/W */ | ||
123 | #define S3C2410_UDC_ICSR2_DMAIEN (1 << 4) /* R/W */ | ||
124 | |||
125 | #define S3C2410_UDC_OCSR1_CLRDT (1 << 7) /* R/W */ | ||
126 | #define S3C2410_UDC_OCSR1_SENTSTL (1 << 6) /* R/W (clear only) */ | ||
127 | #define S3C2410_UDC_OCSR1_SENDSTL (1 << 5) /* R/W */ | ||
128 | #define S3C2410_UDC_OCSR1_FFLUSH (1 << 4) /* R/W */ | ||
129 | #define S3C2410_UDC_OCSR1_DERROR (1 << 3) /* R */ | ||
130 | #define S3C2410_UDC_OCSR1_OVRRUN (1 << 2) /* R/W (clear only) */ | ||
131 | #define S3C2410_UDC_OCSR1_PKTRDY (1 << 0) /* R/W (clear only) */ | ||
132 | |||
133 | #define S3C2410_UDC_OCSR2_AUTOCLR (1 << 7) /* R/W */ | ||
134 | #define S3C2410_UDC_OCSR2_ISO (1 << 6) /* R/W */ | ||
135 | #define S3C2410_UDC_OCSR2_DMAIEN (1 << 5) /* R/W */ | ||
136 | |||
137 | #define S3C2410_UDC_EP0_CSR_OPKRDY (1 << 0) | ||
138 | #define S3C2410_UDC_EP0_CSR_IPKRDY (1 << 1) | ||
139 | #define S3C2410_UDC_EP0_CSR_SENTSTL (1 << 2) | ||
140 | #define S3C2410_UDC_EP0_CSR_DE (1 << 3) | ||
141 | #define S3C2410_UDC_EP0_CSR_SE (1 << 4) | ||
142 | #define S3C2410_UDC_EP0_CSR_SENDSTL (1 << 5) | ||
143 | #define S3C2410_UDC_EP0_CSR_SOPKTRDY (1 << 6) | ||
144 | #define S3C2410_UDC_EP0_CSR_SSE (1 << 7) | ||
145 | |||
146 | #define S3C2410_UDC_MAXP_8 (1 << 0) | ||
147 | #define S3C2410_UDC_MAXP_16 (1 << 1) | ||
148 | #define S3C2410_UDC_MAXP_32 (1 << 2) | ||
149 | #define S3C2410_UDC_MAXP_64 (1 << 3) | ||
150 | |||
151 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/reset.h b/arch/arm/plat-samsung/include/plat/reset.h new file mode 100644 index 000000000000..32ca5179c6e1 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/reset.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/reset.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __PLAT_SAMSUNG_RESET_H | ||
12 | #define __PLAT_SAMSUNG_RESET_H __FILE__ | ||
13 | |||
14 | extern void (*s5p_reset_hook)(void); | ||
15 | |||
16 | #endif /* __PLAT_SAMSUNG_RESET_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h b/arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h deleted file mode 100644 index bf5e2a9d408d..000000000000 --- a/arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c-pl330-pdata.h | ||
2 | * | ||
3 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __S3C_PL330_PDATA_H | ||
13 | #define __S3C_PL330_PDATA_H | ||
14 | |||
15 | #include <plat/s3c-dma-pl330.h> | ||
16 | |||
17 | /* | ||
18 | * Every PL330 DMAC has max 32 peripheral interfaces, | ||
19 | * of which some may be not be really used in your | ||
20 | * DMAC's configuration. | ||
21 | * Populate this array of 32 peri i/fs with relevant | ||
22 | * channel IDs for used peri i/f and DMACH_MAX for | ||
23 | * those unused. | ||
24 | * | ||
25 | * The platforms just need to provide this info | ||
26 | * to the S3C DMA API driver for PL330. | ||
27 | */ | ||
28 | struct s3c_pl330_platdata { | ||
29 | enum dma_ch peri[32]; | ||
30 | }; | ||
31 | |||
32 | #endif /* __S3C_PL330_PDATA_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c2410.h b/arch/arm/plat-samsung/include/plat/s3c2410.h new file mode 100644 index 000000000000..3986497dd3f7 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s3c2410.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c2410.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for s3c2410 machine directory | ||
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 | #ifdef CONFIG_CPU_S3C2410 | ||
15 | |||
16 | extern int s3c2410_init(void); | ||
17 | extern int s3c2410a_init(void); | ||
18 | |||
19 | extern void s3c2410_map_io(void); | ||
20 | |||
21 | extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
22 | |||
23 | extern void s3c2410_init_clocks(int xtal); | ||
24 | |||
25 | #else | ||
26 | #define s3c2410_init_clocks NULL | ||
27 | #define s3c2410_init_uarts NULL | ||
28 | #define s3c2410_map_io NULL | ||
29 | #define s3c2410_init NULL | ||
30 | #define s3c2410a_init NULL | ||
31 | #endif | ||
32 | |||
33 | extern int s3c2410_baseclk_add(void); | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c2412.h b/arch/arm/plat-samsung/include/plat/s3c2412.h new file mode 100644 index 000000000000..5bcfd143ba16 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s3c2412.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c2412.h | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for s3c2412 cpu 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 | #ifdef CONFIG_CPU_S3C2412 | ||
14 | |||
15 | extern int s3c2412_init(void); | ||
16 | |||
17 | extern void s3c2412_map_io(void); | ||
18 | |||
19 | extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
20 | |||
21 | extern void s3c2412_init_clocks(int xtal); | ||
22 | |||
23 | extern int s3c2412_baseclk_add(void); | ||
24 | #else | ||
25 | #define s3c2412_init_clocks NULL | ||
26 | #define s3c2412_init_uarts NULL | ||
27 | #define s3c2412_map_io NULL | ||
28 | #define s3c2412_init NULL | ||
29 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c2416.h b/arch/arm/plat-samsung/include/plat/s3c2416.h new file mode 100644 index 000000000000..a764f8503f52 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s3c2416.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c2416.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com> | ||
4 | * | ||
5 | * Header file for s3c2416 cpu support | ||
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 | #ifdef CONFIG_CPU_S3C2416 | ||
13 | |||
14 | struct s3c2410_uartcfg; | ||
15 | |||
16 | extern int s3c2416_init(void); | ||
17 | |||
18 | extern void s3c2416_map_io(void); | ||
19 | |||
20 | extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
21 | |||
22 | extern void s3c2416_init_clocks(int xtal); | ||
23 | |||
24 | extern int s3c2416_baseclk_add(void); | ||
25 | |||
26 | #else | ||
27 | #define s3c2416_init_clocks NULL | ||
28 | #define s3c2416_init_uarts NULL | ||
29 | #define s3c2416_map_io NULL | ||
30 | #define s3c2416_init NULL | ||
31 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c2443.h b/arch/arm/plat-samsung/include/plat/s3c2443.h new file mode 100644 index 000000000000..7fae1a050694 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s3c2443.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c2443.h | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for s3c2443 cpu 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 | #ifdef CONFIG_CPU_S3C2443 | ||
14 | |||
15 | struct s3c2410_uartcfg; | ||
16 | |||
17 | extern int s3c2443_init(void); | ||
18 | |||
19 | extern void s3c2443_map_io(void); | ||
20 | |||
21 | extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
22 | |||
23 | extern void s3c2443_init_clocks(int xtal); | ||
24 | |||
25 | extern int s3c2443_baseclk_add(void); | ||
26 | |||
27 | #else | ||
28 | #define s3c2443_init_clocks NULL | ||
29 | #define s3c2443_init_uarts NULL | ||
30 | #define s3c2443_map_io NULL | ||
31 | #define s3c2443_init NULL | ||
32 | #endif | ||
33 | |||
34 | /* common code used by s3c2443 and others. | ||
35 | * note, not to be used outside of arch/arm/mach-s3c* */ | ||
36 | |||
37 | struct clk; /* some files don't need clk.h otherwise */ | ||
38 | |||
39 | typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base); | ||
40 | |||
41 | extern void s3c2443_common_setup_clocks(pll_fn get_mpll); | ||
42 | extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, | ||
43 | unsigned int *divs, int nr_divs, | ||
44 | int divmask); | ||
45 | |||
46 | extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable); | ||
47 | extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable); | ||
48 | extern int s3c2443_clkcon_enable_s(struct clk *clk, int enable); | ||
49 | |||
50 | extern struct clksrc_clk clk_epllref; | ||
51 | extern struct clksrc_clk clk_esysclk; | ||
52 | extern struct clksrc_clk clk_msysclk; | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c244x.h b/arch/arm/plat-samsung/include/plat/s3c244x.h new file mode 100644 index 000000000000..ea0c961b7603 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s3c244x.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c244x.h | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for S3C2440 and S3C2442 cpu 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 | #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) | ||
14 | |||
15 | extern void s3c244x_map_io(void); | ||
16 | |||
17 | extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
18 | |||
19 | extern void s3c244x_init_clocks(int xtal); | ||
20 | |||
21 | #else | ||
22 | #define s3c244x_init_clocks NULL | ||
23 | #define s3c244x_init_uarts NULL | ||
24 | #endif | ||
25 | |||
26 | #ifdef CONFIG_CPU_S3C2440 | ||
27 | extern int s3c2440_init(void); | ||
28 | |||
29 | extern void s3c2440_map_io(void); | ||
30 | #else | ||
31 | #define s3c2440_init NULL | ||
32 | #define s3c2440_map_io NULL | ||
33 | #endif | ||
34 | |||
35 | #ifdef CONFIG_CPU_S3C2442 | ||
36 | extern int s3c2442_init(void); | ||
37 | |||
38 | extern void s3c2442_map_io(void); | ||
39 | #else | ||
40 | #define s3c2442_init NULL | ||
41 | #define s3c2442_map_io NULL | ||
42 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c6400.h b/arch/arm/plat-samsung/include/plat/s3c6400.h new file mode 100644 index 000000000000..37d428aaaebb --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s3c6400.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c6400.h | ||
2 | * | ||
3 | * Copyright 2008 Openmoko, Inc. | ||
4 | * Copyright 2008 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * Header file for s3c6400 cpu support | ||
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 | /* Common init code for S3C6400 related SoCs */ | ||
16 | |||
17 | extern void s3c6400_common_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
18 | extern void s3c6400_setup_clocks(void); | ||
19 | |||
20 | extern void s3c64xx_register_clocks(unsigned long xtal, unsigned armclk_limit); | ||
21 | |||
22 | #ifdef CONFIG_CPU_S3C6400 | ||
23 | |||
24 | extern int s3c6400_init(void); | ||
25 | extern void s3c6400_init_irq(void); | ||
26 | extern void s3c6400_map_io(void); | ||
27 | extern void s3c6400_init_clocks(int xtal); | ||
28 | |||
29 | #define s3c6400_init_uarts s3c6400_common_init_uarts | ||
30 | |||
31 | #else | ||
32 | #define s3c6400_init_clocks NULL | ||
33 | #define s3c6400_init_uarts NULL | ||
34 | #define s3c6400_map_io NULL | ||
35 | #define s3c6400_init NULL | ||
36 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c6410.h b/arch/arm/plat-samsung/include/plat/s3c6410.h new file mode 100644 index 000000000000..20a6675b9d17 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s3c6410.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c6410.h | ||
2 | * | ||
3 | * Copyright 2008 Openmoko, Inc. | ||
4 | * Copyright 2008 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * Header file for s3c6410 cpu support | ||
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 | #ifdef CONFIG_CPU_S3C6410 | ||
16 | |||
17 | extern int s3c6410_init(void); | ||
18 | extern void s3c6410_init_irq(void); | ||
19 | extern void s3c6410_map_io(void); | ||
20 | extern void s3c6410_init_clocks(int xtal); | ||
21 | |||
22 | #define s3c6410_init_uarts s3c6400_common_init_uarts | ||
23 | |||
24 | #else | ||
25 | #define s3c6410_init_clocks NULL | ||
26 | #define s3c6410_init_uarts NULL | ||
27 | #define s3c6410_map_io NULL | ||
28 | #define s3c6410_init NULL | ||
29 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s5p-clock.h b/arch/arm/plat-samsung/include/plat/s5p-clock.h new file mode 100644 index 000000000000..984bf9e7bc89 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s5p-clock.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5p-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Header file for s5p clock 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 | #ifndef __ASM_PLAT_S5P_CLOCK_H | ||
14 | #define __ASM_PLAT_S5P_CLOCK_H __FILE__ | ||
15 | |||
16 | #include <linux/clk.h> | ||
17 | |||
18 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) | ||
19 | |||
20 | #define clk_fin_apll clk_ext_xtal_mux | ||
21 | #define clk_fin_mpll clk_ext_xtal_mux | ||
22 | #define clk_fin_epll clk_ext_xtal_mux | ||
23 | #define clk_fin_dpll clk_ext_xtal_mux | ||
24 | #define clk_fin_vpll clk_ext_xtal_mux | ||
25 | #define clk_fin_hpll clk_ext_xtal_mux | ||
26 | |||
27 | extern struct clk clk_ext_xtal_mux; | ||
28 | extern struct clk clk_xusbxti; | ||
29 | extern struct clk clk_48m; | ||
30 | extern struct clk s5p_clk_27m; | ||
31 | extern struct clk clk_fout_apll; | ||
32 | extern struct clk clk_fout_mpll; | ||
33 | extern struct clk clk_fout_epll; | ||
34 | extern struct clk clk_fout_dpll; | ||
35 | extern struct clk clk_fout_vpll; | ||
36 | extern struct clk clk_arm; | ||
37 | extern struct clk clk_vpll; | ||
38 | |||
39 | extern struct clksrc_sources clk_src_apll; | ||
40 | extern struct clksrc_sources clk_src_mpll; | ||
41 | extern struct clksrc_sources clk_src_epll; | ||
42 | extern struct clksrc_sources clk_src_dpll; | ||
43 | |||
44 | extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable); | ||
45 | |||
46 | /* Common EPLL operations for S5P platform */ | ||
47 | extern int s5p_epll_enable(struct clk *clk, int enable); | ||
48 | extern unsigned long s5p_epll_get_rate(struct clk *clk); | ||
49 | |||
50 | /* SPDIF clk operations common for S5PC100/V210/C110 and Exynos4 */ | ||
51 | extern int s5p_spdif_set_rate(struct clk *clk, unsigned long rate); | ||
52 | extern unsigned long s5p_spdif_get_rate(struct clk *clk); | ||
53 | |||
54 | extern struct clk_ops s5p_sclk_spdif_ops; | ||
55 | #endif /* __ASM_PLAT_S5P_CLOCK_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h b/arch/arm/plat-samsung/include/plat/s5p-time.h new file mode 100644 index 000000000000..3a70aebc9205 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s5p-time.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5p-time.h | ||
2 | * | ||
3 | * Copyright 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for s5p time 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 | #ifndef __ASM_PLAT_S5P_TIME_H | ||
14 | #define __ASM_PLAT_S5P_TIME_H __FILE__ | ||
15 | |||
16 | /* S5P HR-Timer Clock mode */ | ||
17 | enum s5p_timer_mode { | ||
18 | S5P_PWM0, | ||
19 | S5P_PWM1, | ||
20 | S5P_PWM2, | ||
21 | S5P_PWM3, | ||
22 | S5P_PWM4, | ||
23 | }; | ||
24 | |||
25 | struct s5p_timer_source { | ||
26 | unsigned int event_id; | ||
27 | unsigned int source_id; | ||
28 | }; | ||
29 | |||
30 | /* Be able to sleep for atleast 4 seconds (usually more) */ | ||
31 | #define S5PTIMER_MIN_RANGE 4 | ||
32 | |||
33 | #define TCNT_MAX 0xffffffff | ||
34 | #define NON_PERIODIC 0 | ||
35 | #define PERIODIC 1 | ||
36 | |||
37 | extern void __init s5p_set_timer_source(enum s5p_timer_mode event, | ||
38 | enum s5p_timer_mode source); | ||
39 | extern struct sys_timer s5p_timer; | ||
40 | #endif /* __ASM_PLAT_S5P_TIME_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/s5p6440.h b/arch/arm/plat-samsung/include/plat/s5p6440.h new file mode 100644 index 000000000000..bf85ebbb4fbc --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s5p6440.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5p6440.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for s5p6440 cpu 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 | /* Common init code for S5P6440 related SoCs */ | ||
14 | |||
15 | extern void s5p6440_register_clocks(void); | ||
16 | extern void s5p6440_setup_clocks(void); | ||
17 | |||
18 | #ifdef CONFIG_CPU_S5P6440 | ||
19 | |||
20 | extern int s5p64x0_init(void); | ||
21 | extern void s5p6440_init_irq(void); | ||
22 | extern void s5p6440_map_io(void); | ||
23 | extern void s5p6440_init_clocks(int xtal); | ||
24 | |||
25 | extern void s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
26 | |||
27 | #else | ||
28 | #define s5p6440_init_clocks NULL | ||
29 | #define s5p6440_init_uarts NULL | ||
30 | #define s5p6440_map_io NULL | ||
31 | #define s5p64x0_init NULL | ||
32 | #endif | ||
33 | |||
34 | /* S5P6440 timer */ | ||
35 | |||
36 | extern struct sys_timer s5p6440_timer; | ||
diff --git a/arch/arm/plat-samsung/include/plat/s5p6450.h b/arch/arm/plat-samsung/include/plat/s5p6450.h new file mode 100644 index 000000000000..da25f9a1c54a --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s5p6450.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5p6450.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Header file for s5p6450 cpu 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 | /* Common init code for S5P6450 related SoCs */ | ||
14 | |||
15 | extern void s5p6450_register_clocks(void); | ||
16 | extern void s5p6450_setup_clocks(void); | ||
17 | |||
18 | #ifdef CONFIG_CPU_S5P6450 | ||
19 | |||
20 | extern int s5p64x0_init(void); | ||
21 | extern void s5p6450_init_irq(void); | ||
22 | extern void s5p6450_map_io(void); | ||
23 | extern void s5p6450_init_clocks(int xtal); | ||
24 | |||
25 | extern void s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
26 | |||
27 | #else | ||
28 | #define s5p6450_init_clocks NULL | ||
29 | #define s5p6450_init_uarts NULL | ||
30 | #define s5p6450_map_io NULL | ||
31 | #define s5p64x0_init NULL | ||
32 | #endif | ||
33 | |||
34 | /* S5P6450 timer */ | ||
35 | |||
36 | extern struct sys_timer s5p6450_timer; | ||
diff --git a/arch/arm/plat-samsung/include/plat/s5pc100.h b/arch/arm/plat-samsung/include/plat/s5pc100.h new file mode 100644 index 000000000000..9a21aeaaf452 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s5pc100.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5pc100.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for s5pc100 cpu 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 | /* Common init code for S5PC100 related SoCs */ | ||
14 | |||
15 | extern void s5pc100_common_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
16 | extern void s5pc100_register_clocks(void); | ||
17 | extern void s5pc100_setup_clocks(void); | ||
18 | |||
19 | #ifdef CONFIG_CPU_S5PC100 | ||
20 | |||
21 | extern int s5pc100_init(void); | ||
22 | extern void s5pc100_init_irq(void); | ||
23 | extern void s5pc100_map_io(void); | ||
24 | extern void s5pc100_init_clocks(int xtal); | ||
25 | |||
26 | #define s5pc100_init_uarts s5pc100_common_init_uarts | ||
27 | |||
28 | #else | ||
29 | #define s5pc100_init_clocks NULL | ||
30 | #define s5pc100_init_uarts NULL | ||
31 | #define s5pc100_map_io NULL | ||
32 | #define s5pc100_init NULL | ||
33 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s5pv210.h b/arch/arm/plat-samsung/include/plat/s5pv210.h new file mode 100644 index 000000000000..b4bc6be77072 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/s5pv210.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5pv210.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for s5pv210 cpu 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 | /* Common init code for S5PV210 related SoCs */ | ||
14 | |||
15 | extern void s5pv210_common_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
16 | extern void s5pv210_register_clocks(void); | ||
17 | extern void s5pv210_setup_clocks(void); | ||
18 | |||
19 | #ifdef CONFIG_CPU_S5PV210 | ||
20 | |||
21 | extern int s5pv210_init(void); | ||
22 | extern void s5pv210_init_irq(void); | ||
23 | extern void s5pv210_map_io(void); | ||
24 | extern void s5pv210_init_clocks(int xtal); | ||
25 | |||
26 | #define s5pv210_init_uarts s5pv210_common_init_uarts | ||
27 | |||
28 | #else | ||
29 | #define s5pv210_init_clocks NULL | ||
30 | #define s5pv210_init_uarts NULL | ||
31 | #define s5pv210_map_io NULL | ||
32 | #define s5pv210_init NULL | ||
33 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h index 058e09654fe8..e7b3c752e919 100644 --- a/arch/arm/plat-samsung/include/plat/sdhci.h +++ b/arch/arm/plat-samsung/include/plat/sdhci.h | |||
@@ -55,10 +55,6 @@ enum clk_types { | |||
55 | * cd_type == S3C_SDHCI_CD_GPIO | 55 | * cd_type == S3C_SDHCI_CD_GPIO |
56 | * @ext_cd_gpio_invert: invert values for external CD gpio line | 56 | * @ext_cd_gpio_invert: invert values for external CD gpio line |
57 | * @cfg_gpio: Configure the GPIO for a specific card bit-width | 57 | * @cfg_gpio: Configure the GPIO for a specific card bit-width |
58 | * @cfg_card: Configure the interface for a specific card and speed. This | ||
59 | * is necessary the controllers and/or GPIO blocks require the | ||
60 | * changing of driver-strength and other controls dependent on | ||
61 | * the card and speed of operation. | ||
62 | * | 58 | * |
63 | * Initialisation data specific to either the machine or the platform | 59 | * Initialisation data specific to either the machine or the platform |
64 | * for the device driver to use or call-back when configuring gpio or | 60 | * for the device driver to use or call-back when configuring gpio or |
@@ -80,12 +76,15 @@ struct s3c_sdhci_platdata { | |||
80 | int state)); | 76 | int state)); |
81 | 77 | ||
82 | void (*cfg_gpio)(struct platform_device *dev, int width); | 78 | void (*cfg_gpio)(struct platform_device *dev, int width); |
83 | void (*cfg_card)(struct platform_device *dev, | ||
84 | void __iomem *regbase, | ||
85 | struct mmc_ios *ios, | ||
86 | struct mmc_card *card); | ||
87 | }; | 79 | }; |
88 | 80 | ||
81 | /* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data | ||
82 | * @pd: The default platform data for this device. | ||
83 | * @set: Pointer to the platform data to fill in. | ||
84 | */ | ||
85 | extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd, | ||
86 | struct s3c_sdhci_platdata *set); | ||
87 | |||
89 | /** | 88 | /** |
90 | * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device. | 89 | * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device. |
91 | * @pd: Platform data to register to device. | 90 | * @pd: Platform data to register to device. |
@@ -132,17 +131,11 @@ extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w); | |||
132 | #ifdef CONFIG_S3C2416_SETUP_SDHCI | 131 | #ifdef CONFIG_S3C2416_SETUP_SDHCI |
133 | extern char *s3c2416_hsmmc_clksrcs[4]; | 132 | extern char *s3c2416_hsmmc_clksrcs[4]; |
134 | 133 | ||
135 | extern void s3c2416_setup_sdhci_cfg_card(struct platform_device *dev, | ||
136 | void __iomem *r, | ||
137 | struct mmc_ios *ios, | ||
138 | struct mmc_card *card); | ||
139 | |||
140 | static inline void s3c2416_default_sdhci0(void) | 134 | static inline void s3c2416_default_sdhci0(void) |
141 | { | 135 | { |
142 | #ifdef CONFIG_S3C_DEV_HSMMC | 136 | #ifdef CONFIG_S3C_DEV_HSMMC |
143 | s3c_hsmmc0_def_platdata.clocks = s3c2416_hsmmc_clksrcs; | 137 | s3c_hsmmc0_def_platdata.clocks = s3c2416_hsmmc_clksrcs; |
144 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio; | 138 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio; |
145 | s3c_hsmmc0_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card; | ||
146 | #endif /* CONFIG_S3C_DEV_HSMMC */ | 139 | #endif /* CONFIG_S3C_DEV_HSMMC */ |
147 | } | 140 | } |
148 | 141 | ||
@@ -151,7 +144,6 @@ static inline void s3c2416_default_sdhci1(void) | |||
151 | #ifdef CONFIG_S3C_DEV_HSMMC1 | 144 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
152 | s3c_hsmmc1_def_platdata.clocks = s3c2416_hsmmc_clksrcs; | 145 | s3c_hsmmc1_def_platdata.clocks = s3c2416_hsmmc_clksrcs; |
153 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio; | 146 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio; |
154 | s3c_hsmmc1_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card; | ||
155 | #endif /* CONFIG_S3C_DEV_HSMMC1 */ | 147 | #endif /* CONFIG_S3C_DEV_HSMMC1 */ |
156 | } | 148 | } |
157 | 149 | ||
@@ -165,17 +157,11 @@ static inline void s3c2416_default_sdhci1(void) { } | |||
165 | #ifdef CONFIG_S3C64XX_SETUP_SDHCI | 157 | #ifdef CONFIG_S3C64XX_SETUP_SDHCI |
166 | extern char *s3c64xx_hsmmc_clksrcs[4]; | 158 | extern char *s3c64xx_hsmmc_clksrcs[4]; |
167 | 159 | ||
168 | extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev, | ||
169 | void __iomem *r, | ||
170 | struct mmc_ios *ios, | ||
171 | struct mmc_card *card); | ||
172 | |||
173 | static inline void s3c6400_default_sdhci0(void) | 160 | static inline void s3c6400_default_sdhci0(void) |
174 | { | 161 | { |
175 | #ifdef CONFIG_S3C_DEV_HSMMC | 162 | #ifdef CONFIG_S3C_DEV_HSMMC |
176 | s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; | 163 | s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; |
177 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; | 164 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; |
178 | s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card; | ||
179 | #endif | 165 | #endif |
180 | } | 166 | } |
181 | 167 | ||
@@ -184,7 +170,6 @@ static inline void s3c6400_default_sdhci1(void) | |||
184 | #ifdef CONFIG_S3C_DEV_HSMMC1 | 170 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
185 | s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; | 171 | s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; |
186 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; | 172 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; |
187 | s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card; | ||
188 | #endif | 173 | #endif |
189 | } | 174 | } |
190 | 175 | ||
@@ -193,21 +178,14 @@ static inline void s3c6400_default_sdhci2(void) | |||
193 | #ifdef CONFIG_S3C_DEV_HSMMC2 | 178 | #ifdef CONFIG_S3C_DEV_HSMMC2 |
194 | s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; | 179 | s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; |
195 | s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; | 180 | s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; |
196 | s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card; | ||
197 | #endif | 181 | #endif |
198 | } | 182 | } |
199 | 183 | ||
200 | extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev, | ||
201 | void __iomem *r, | ||
202 | struct mmc_ios *ios, | ||
203 | struct mmc_card *card); | ||
204 | |||
205 | static inline void s3c6410_default_sdhci0(void) | 184 | static inline void s3c6410_default_sdhci0(void) |
206 | { | 185 | { |
207 | #ifdef CONFIG_S3C_DEV_HSMMC | 186 | #ifdef CONFIG_S3C_DEV_HSMMC |
208 | s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; | 187 | s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; |
209 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; | 188 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; |
210 | s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card; | ||
211 | #endif | 189 | #endif |
212 | } | 190 | } |
213 | 191 | ||
@@ -216,7 +194,6 @@ static inline void s3c6410_default_sdhci1(void) | |||
216 | #ifdef CONFIG_S3C_DEV_HSMMC1 | 194 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
217 | s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; | 195 | s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; |
218 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; | 196 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; |
219 | s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card; | ||
220 | #endif | 197 | #endif |
221 | } | 198 | } |
222 | 199 | ||
@@ -225,7 +202,6 @@ static inline void s3c6410_default_sdhci2(void) | |||
225 | #ifdef CONFIG_S3C_DEV_HSMMC2 | 202 | #ifdef CONFIG_S3C_DEV_HSMMC2 |
226 | s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; | 203 | s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; |
227 | s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; | 204 | s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; |
228 | s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card; | ||
229 | #endif | 205 | #endif |
230 | } | 206 | } |
231 | 207 | ||
@@ -244,17 +220,11 @@ static inline void s3c6400_default_sdhci2(void) { } | |||
244 | #ifdef CONFIG_S5PC100_SETUP_SDHCI | 220 | #ifdef CONFIG_S5PC100_SETUP_SDHCI |
245 | extern char *s5pc100_hsmmc_clksrcs[4]; | 221 | extern char *s5pc100_hsmmc_clksrcs[4]; |
246 | 222 | ||
247 | extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev, | ||
248 | void __iomem *r, | ||
249 | struct mmc_ios *ios, | ||
250 | struct mmc_card *card); | ||
251 | |||
252 | static inline void s5pc100_default_sdhci0(void) | 223 | static inline void s5pc100_default_sdhci0(void) |
253 | { | 224 | { |
254 | #ifdef CONFIG_S3C_DEV_HSMMC | 225 | #ifdef CONFIG_S3C_DEV_HSMMC |
255 | s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs; | 226 | s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs; |
256 | s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio; | 227 | s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio; |
257 | s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card; | ||
258 | #endif | 228 | #endif |
259 | } | 229 | } |
260 | 230 | ||
@@ -263,7 +233,6 @@ static inline void s5pc100_default_sdhci1(void) | |||
263 | #ifdef CONFIG_S3C_DEV_HSMMC1 | 233 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
264 | s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs; | 234 | s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs; |
265 | s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio; | 235 | s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio; |
266 | s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card; | ||
267 | #endif | 236 | #endif |
268 | } | 237 | } |
269 | 238 | ||
@@ -272,7 +241,6 @@ static inline void s5pc100_default_sdhci2(void) | |||
272 | #ifdef CONFIG_S3C_DEV_HSMMC2 | 241 | #ifdef CONFIG_S3C_DEV_HSMMC2 |
273 | s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs; | 242 | s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs; |
274 | s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio; | 243 | s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio; |
275 | s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card; | ||
276 | #endif | 244 | #endif |
277 | } | 245 | } |
278 | 246 | ||
@@ -288,17 +256,11 @@ static inline void s5pc100_default_sdhci2(void) { } | |||
288 | #ifdef CONFIG_S5PV210_SETUP_SDHCI | 256 | #ifdef CONFIG_S5PV210_SETUP_SDHCI |
289 | extern char *s5pv210_hsmmc_clksrcs[4]; | 257 | extern char *s5pv210_hsmmc_clksrcs[4]; |
290 | 258 | ||
291 | extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev, | ||
292 | void __iomem *r, | ||
293 | struct mmc_ios *ios, | ||
294 | struct mmc_card *card); | ||
295 | |||
296 | static inline void s5pv210_default_sdhci0(void) | 259 | static inline void s5pv210_default_sdhci0(void) |
297 | { | 260 | { |
298 | #ifdef CONFIG_S3C_DEV_HSMMC | 261 | #ifdef CONFIG_S3C_DEV_HSMMC |
299 | s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs; | 262 | s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs; |
300 | s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio; | 263 | s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio; |
301 | s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card; | ||
302 | #endif | 264 | #endif |
303 | } | 265 | } |
304 | 266 | ||
@@ -307,7 +269,6 @@ static inline void s5pv210_default_sdhci1(void) | |||
307 | #ifdef CONFIG_S3C_DEV_HSMMC1 | 269 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
308 | s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs; | 270 | s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs; |
309 | s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio; | 271 | s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio; |
310 | s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card; | ||
311 | #endif | 272 | #endif |
312 | } | 273 | } |
313 | 274 | ||
@@ -316,7 +277,6 @@ static inline void s5pv210_default_sdhci2(void) | |||
316 | #ifdef CONFIG_S3C_DEV_HSMMC2 | 277 | #ifdef CONFIG_S3C_DEV_HSMMC2 |
317 | s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs; | 278 | s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs; |
318 | s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio; | 279 | s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio; |
319 | s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card; | ||
320 | #endif | 280 | #endif |
321 | } | 281 | } |
322 | 282 | ||
@@ -325,7 +285,6 @@ static inline void s5pv210_default_sdhci3(void) | |||
325 | #ifdef CONFIG_S3C_DEV_HSMMC3 | 285 | #ifdef CONFIG_S3C_DEV_HSMMC3 |
326 | s3c_hsmmc3_def_platdata.clocks = s5pv210_hsmmc_clksrcs; | 286 | s3c_hsmmc3_def_platdata.clocks = s5pv210_hsmmc_clksrcs; |
327 | s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio; | 287 | s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio; |
328 | s3c_hsmmc3_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card; | ||
329 | #endif | 288 | #endif |
330 | } | 289 | } |
331 | 290 | ||
@@ -341,17 +300,11 @@ static inline void s5pv210_default_sdhci3(void) { } | |||
341 | #ifdef CONFIG_EXYNOS4_SETUP_SDHCI | 300 | #ifdef CONFIG_EXYNOS4_SETUP_SDHCI |
342 | extern char *exynos4_hsmmc_clksrcs[4]; | 301 | extern char *exynos4_hsmmc_clksrcs[4]; |
343 | 302 | ||
344 | extern void exynos4_setup_sdhci_cfg_card(struct platform_device *dev, | ||
345 | void __iomem *r, | ||
346 | struct mmc_ios *ios, | ||
347 | struct mmc_card *card); | ||
348 | |||
349 | static inline void exynos4_default_sdhci0(void) | 303 | static inline void exynos4_default_sdhci0(void) |
350 | { | 304 | { |
351 | #ifdef CONFIG_S3C_DEV_HSMMC | 305 | #ifdef CONFIG_S3C_DEV_HSMMC |
352 | s3c_hsmmc0_def_platdata.clocks = exynos4_hsmmc_clksrcs; | 306 | s3c_hsmmc0_def_platdata.clocks = exynos4_hsmmc_clksrcs; |
353 | s3c_hsmmc0_def_platdata.cfg_gpio = exynos4_setup_sdhci0_cfg_gpio; | 307 | s3c_hsmmc0_def_platdata.cfg_gpio = exynos4_setup_sdhci0_cfg_gpio; |
354 | s3c_hsmmc0_def_platdata.cfg_card = exynos4_setup_sdhci_cfg_card; | ||
355 | #endif | 308 | #endif |
356 | } | 309 | } |
357 | 310 | ||
@@ -360,7 +313,6 @@ static inline void exynos4_default_sdhci1(void) | |||
360 | #ifdef CONFIG_S3C_DEV_HSMMC1 | 313 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
361 | s3c_hsmmc1_def_platdata.clocks = exynos4_hsmmc_clksrcs; | 314 | s3c_hsmmc1_def_platdata.clocks = exynos4_hsmmc_clksrcs; |
362 | s3c_hsmmc1_def_platdata.cfg_gpio = exynos4_setup_sdhci1_cfg_gpio; | 315 | s3c_hsmmc1_def_platdata.cfg_gpio = exynos4_setup_sdhci1_cfg_gpio; |
363 | s3c_hsmmc1_def_platdata.cfg_card = exynos4_setup_sdhci_cfg_card; | ||
364 | #endif | 316 | #endif |
365 | } | 317 | } |
366 | 318 | ||
@@ -369,7 +321,6 @@ static inline void exynos4_default_sdhci2(void) | |||
369 | #ifdef CONFIG_S3C_DEV_HSMMC2 | 321 | #ifdef CONFIG_S3C_DEV_HSMMC2 |
370 | s3c_hsmmc2_def_platdata.clocks = exynos4_hsmmc_clksrcs; | 322 | s3c_hsmmc2_def_platdata.clocks = exynos4_hsmmc_clksrcs; |
371 | s3c_hsmmc2_def_platdata.cfg_gpio = exynos4_setup_sdhci2_cfg_gpio; | 323 | s3c_hsmmc2_def_platdata.cfg_gpio = exynos4_setup_sdhci2_cfg_gpio; |
372 | s3c_hsmmc2_def_platdata.cfg_card = exynos4_setup_sdhci_cfg_card; | ||
373 | #endif | 324 | #endif |
374 | } | 325 | } |
375 | 326 | ||
@@ -378,7 +329,6 @@ static inline void exynos4_default_sdhci3(void) | |||
378 | #ifdef CONFIG_S3C_DEV_HSMMC3 | 329 | #ifdef CONFIG_S3C_DEV_HSMMC3 |
379 | s3c_hsmmc3_def_platdata.clocks = exynos4_hsmmc_clksrcs; | 330 | s3c_hsmmc3_def_platdata.clocks = exynos4_hsmmc_clksrcs; |
380 | s3c_hsmmc3_def_platdata.cfg_gpio = exynos4_setup_sdhci3_cfg_gpio; | 331 | s3c_hsmmc3_def_platdata.cfg_gpio = exynos4_setup_sdhci3_cfg_gpio; |
381 | s3c_hsmmc3_def_platdata.cfg_card = exynos4_setup_sdhci_cfg_card; | ||
382 | #endif | 332 | #endif |
383 | } | 333 | } |
384 | 334 | ||
diff --git a/arch/arm/plat-samsung/include/plat/sysmmu.h b/arch/arm/plat-samsung/include/plat/sysmmu.h new file mode 100644 index 000000000000..5fe8ee01a5ba --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/sysmmu.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/sysmmu.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Samsung System MMU driver for S5P platform | ||
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 | #ifndef __PLAT_SAMSUNG_SYSMMU_H | ||
14 | #define __PLAT_SAMSUNG_SYSMMU_H __FILE__ | ||
15 | |||
16 | enum S5P_SYSMMU_INTERRUPT_TYPE { | ||
17 | SYSMMU_PAGEFAULT, | ||
18 | SYSMMU_AR_MULTIHIT, | ||
19 | SYSMMU_AW_MULTIHIT, | ||
20 | SYSMMU_BUSERROR, | ||
21 | SYSMMU_AR_SECURITY, | ||
22 | SYSMMU_AR_ACCESS, | ||
23 | SYSMMU_AW_SECURITY, | ||
24 | SYSMMU_AW_PROTECTION, /* 7 */ | ||
25 | SYSMMU_FAULTS_NUM | ||
26 | }; | ||
27 | |||
28 | #ifdef CONFIG_S5P_SYSTEM_MMU | ||
29 | |||
30 | #include <mach/sysmmu.h> | ||
31 | |||
32 | /** | ||
33 | * s5p_sysmmu_enable() - enable system mmu of ip | ||
34 | * @ips: The ip connected system mmu. | ||
35 | * #pgd: Base physical address of the 1st level page table | ||
36 | * | ||
37 | * This function enable system mmu to transfer address | ||
38 | * from virtual address to physical address | ||
39 | */ | ||
40 | void s5p_sysmmu_enable(sysmmu_ips ips, unsigned long pgd); | ||
41 | |||
42 | /** | ||
43 | * s5p_sysmmu_disable() - disable sysmmu mmu of ip | ||
44 | * @ips: The ip connected system mmu. | ||
45 | * | ||
46 | * This function disable system mmu to transfer address | ||
47 | * from virtual address to physical address | ||
48 | */ | ||
49 | void s5p_sysmmu_disable(sysmmu_ips ips); | ||
50 | |||
51 | /** | ||
52 | * s5p_sysmmu_set_tablebase_pgd() - set page table base address to refer page table | ||
53 | * @ips: The ip connected system mmu. | ||
54 | * @pgd: The page table base address. | ||
55 | * | ||
56 | * This function set page table base address | ||
57 | * When system mmu transfer address from virtaul address to physical address, | ||
58 | * system mmu refer address information from page table | ||
59 | */ | ||
60 | void s5p_sysmmu_set_tablebase_pgd(sysmmu_ips ips, unsigned long pgd); | ||
61 | |||
62 | /** | ||
63 | * s5p_sysmmu_tlb_invalidate() - flush all TLB entry in system mmu | ||
64 | * @ips: The ip connected system mmu. | ||
65 | * | ||
66 | * This function flush all TLB entry in system mmu | ||
67 | */ | ||
68 | void s5p_sysmmu_tlb_invalidate(sysmmu_ips ips); | ||
69 | |||
70 | /** s5p_sysmmu_set_fault_handler() - Fault handler for System MMUs | ||
71 | * @itype: type of fault. | ||
72 | * @pgtable_base: the physical address of page table base. This is 0 if @ips is | ||
73 | * SYSMMU_BUSERROR. | ||
74 | * @fault_addr: the device (virtual) address that the System MMU tried to | ||
75 | * translated. This is 0 if @ips is SYSMMU_BUSERROR. | ||
76 | * Called when interrupt occurred by the System MMUs | ||
77 | * The device drivers of peripheral devices that has a System MMU can implement | ||
78 | * a fault handler to resolve address translation fault by System MMU. | ||
79 | * The meanings of return value and parameters are described below. | ||
80 | |||
81 | * return value: non-zero if the fault is correctly resolved. | ||
82 | * zero if the fault is not handled. | ||
83 | */ | ||
84 | void s5p_sysmmu_set_fault_handler(sysmmu_ips ips, | ||
85 | int (*handler)(enum S5P_SYSMMU_INTERRUPT_TYPE itype, | ||
86 | unsigned long pgtable_base, | ||
87 | unsigned long fault_addr)); | ||
88 | #else | ||
89 | #define s5p_sysmmu_enable(ips, pgd) do { } while (0) | ||
90 | #define s5p_sysmmu_disable(ips) do { } while (0) | ||
91 | #define s5p_sysmmu_set_tablebase_pgd(ips, pgd) do { } while (0) | ||
92 | #define s5p_sysmmu_tlb_invalidate(ips) do { } while (0) | ||
93 | #define s5p_sysmmu_set_fault_handler(ips, handler) do { } while (0) | ||
94 | #endif | ||
95 | #endif /* __ASM_PLAT_SYSMMU_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/system-reset.h b/arch/arm/plat-samsung/include/plat/system-reset.h new file mode 100644 index 000000000000..a448e990964d --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/system-reset.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/system-reset.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Based on arch/arm/mach-s3c2410/include/mach/system-reset.h | ||
7 | * | ||
8 | * S5P - System define for arch_reset() | ||
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 <plat/watchdog-reset.h> | ||
16 | |||
17 | void (*s5p_reset_hook)(void); | ||
18 | |||
19 | static void arch_reset(char mode, const char *cmd) | ||
20 | { | ||
21 | /* SWRESET support in s5p_reset_hook() */ | ||
22 | |||
23 | if (s5p_reset_hook) | ||
24 | s5p_reset_hook(); | ||
25 | |||
26 | /* Perform reset using Watchdog reset | ||
27 | * if there is no s5p_reset_hook() | ||
28 | */ | ||
29 | |||
30 | arch_wdt_reset(); | ||
31 | } | ||
diff --git a/arch/arm/plat-samsung/include/plat/tv-core.h b/arch/arm/plat-samsung/include/plat/tv-core.h new file mode 100644 index 000000000000..3bc34f3ce28f --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/tv-core.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-samsung/include/plat/tv.h | ||
3 | * | ||
4 | * Copyright 2011 Samsung Electronics Co., Ltd. | ||
5 | * Tomasz Stanislawski <t.stanislaws@samsung.com> | ||
6 | * | ||
7 | * Samsung TV driver core functions | ||
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 | #ifndef __SAMSUNG_PLAT_TV_H | ||
15 | #define __SAMSUNG_PLAT_TV_H __FILE__ | ||
16 | |||
17 | /* | ||
18 | * These functions are only for use with the core support code, such as | ||
19 | * the CPU-specific initialization code. | ||
20 | */ | ||
21 | |||
22 | /* Re-define device name to differentiate the subsystem in various SoCs. */ | ||
23 | static inline void s5p_hdmi_setname(char *name) | ||
24 | { | ||
25 | #ifdef CONFIG_S5P_DEV_TV | ||
26 | s5p_device_hdmi.name = name; | ||
27 | #endif | ||
28 | } | ||
29 | |||
30 | static inline void s5p_mixer_setname(char *name) | ||
31 | { | ||
32 | #ifdef CONFIG_S5P_DEV_TV | ||
33 | s5p_device_mixer.name = name; | ||
34 | #endif | ||
35 | } | ||
36 | |||
37 | static inline void s5p_sdo_setname(char *name) | ||
38 | { | ||
39 | #ifdef CONFIG_S5P_DEV_TV | ||
40 | s5p_device_sdo.name = name; | ||
41 | #endif | ||
42 | } | ||
43 | |||
44 | #endif /* __SAMSUNG_PLAT_TV_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/udc.h b/arch/arm/plat-samsung/include/plat/udc.h new file mode 100644 index 000000000000..8c22d586befb --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/udc.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* arch/arm/plat-samsung/include/plat/udc.h | ||
2 | * | ||
3 | * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org> | ||
4 | * | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * | ||
11 | * Changelog: | ||
12 | * 14-Mar-2005 RTP Created file | ||
13 | * 02-Aug-2005 RTP File rename | ||
14 | * 07-Sep-2005 BJD Minor cleanups, changed cmd to enum | ||
15 | * 18-Jan-2007 HMW Add per-platform vbus_draw function | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARM_ARCH_UDC_H | ||
19 | #define __ASM_ARM_ARCH_UDC_H | ||
20 | |||
21 | enum s3c2410_udc_cmd_e { | ||
22 | S3C2410_UDC_P_ENABLE = 1, /* Pull-up enable */ | ||
23 | S3C2410_UDC_P_DISABLE = 2, /* Pull-up disable */ | ||
24 | S3C2410_UDC_P_RESET = 3, /* UDC reset, in case of */ | ||
25 | }; | ||
26 | |||
27 | struct s3c2410_udc_mach_info { | ||
28 | void (*udc_command)(enum s3c2410_udc_cmd_e); | ||
29 | void (*vbus_draw)(unsigned int ma); | ||
30 | |||
31 | unsigned int pullup_pin; | ||
32 | unsigned int pullup_pin_inverted; | ||
33 | |||
34 | unsigned int vbus_pin; | ||
35 | unsigned char vbus_pin_inverted; | ||
36 | }; | ||
37 | |||
38 | extern void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *); | ||
39 | |||
40 | /** | ||
41 | * s3c24xx_hsudc_platdata - Platform data for USB High-Speed gadget controller. | ||
42 | * @epnum: Number of endpoints to be instantiated by the controller driver. | ||
43 | * @gpio_init: Platform specific USB related GPIO initialization. | ||
44 | * @gpio_uninit: Platform specific USB releted GPIO uninitialzation. | ||
45 | * | ||
46 | * Representation of platform data for the S3C24XX USB 2.0 High Speed gadget | ||
47 | * controllers. | ||
48 | */ | ||
49 | struct s3c24xx_hsudc_platdata { | ||
50 | unsigned int epnum; | ||
51 | void (*gpio_init)(void); | ||
52 | void (*gpio_uninit)(void); | ||
53 | }; | ||
54 | |||
55 | extern void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd); | ||
56 | |||
57 | #endif /* __ASM_ARM_ARCH_UDC_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h b/arch/arm/plat-samsung/include/plat/usb-phy.h new file mode 100644 index 000000000000..959bcdb03a25 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/usb-phy.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Samsung Electronics Co.Ltd | ||
3 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef __PLAT_SAMSUNG_USB_PHY_H | ||
12 | #define __PLAT_SAMSUNG_USB_PHY_H __FILE__ | ||
13 | |||
14 | enum s5p_usb_phy_type { | ||
15 | S5P_USB_PHY_DEVICE, | ||
16 | S5P_USB_PHY_HOST, | ||
17 | }; | ||
18 | |||
19 | extern int s5p_usb_phy_init(struct platform_device *pdev, int type); | ||
20 | extern int s5p_usb_phy_exit(struct platform_device *pdev, int type); | ||
21 | |||
22 | #endif /* __PLAT_SAMSUNG_USB_PHY_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h b/arch/arm/plat-samsung/include/plat/watchdog-reset.h index 54b762acb5a0..40dbb2b0ae22 100644 --- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h +++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h | |||
@@ -10,6 +10,7 @@ | |||
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <plat/clock.h> | ||
13 | #include <plat/regs-watchdog.h> | 14 | #include <plat/regs-watchdog.h> |
14 | #include <mach/map.h> | 15 | #include <mach/map.h> |
15 | 16 | ||
@@ -19,17 +20,12 @@ | |||
19 | 20 | ||
20 | static inline void arch_wdt_reset(void) | 21 | static inline void arch_wdt_reset(void) |
21 | { | 22 | { |
22 | struct clk *wdtclk; | ||
23 | |||
24 | printk("arch_reset: attempting watchdog reset\n"); | 23 | printk("arch_reset: attempting watchdog reset\n"); |
25 | 24 | ||
26 | __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */ | 25 | __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */ |
27 | 26 | ||
28 | wdtclk = clk_get(NULL, "watchdog"); | 27 | if (s3c2410_wdtclk) |
29 | if (!IS_ERR(wdtclk)) { | 28 | clk_enable(s3c2410_wdtclk); |
30 | clk_enable(wdtclk); | ||
31 | } else | ||
32 | printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__); | ||
33 | 29 | ||
34 | /* put initial values into count and data */ | 30 | /* put initial values into count and data */ |
35 | __raw_writel(0x80, S3C2410_WTCNT); | 31 | __raw_writel(0x80, S3C2410_WTCNT); |
diff --git a/arch/arm/plat-samsung/irq-uart.c b/arch/arm/plat-samsung/irq-uart.c deleted file mode 100644 index 3014c7226bd1..000000000000 --- a/arch/arm/plat-samsung/irq-uart.c +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* arch/arm/plat-samsung/irq-uart.c | ||
2 | * originally part of arch/arm/plat-s3c64xx/irq.c | ||
3 | * | ||
4 | * Copyright 2008 Openmoko, Inc. | ||
5 | * Copyright 2008 Simtec Electronics | ||
6 | * Ben Dooks <ben@simtec.co.uk> | ||
7 | * http://armlinux.simtec.co.uk/ | ||
8 | * | ||
9 | * Samsung- UART Interrupt handling | ||
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/interrupt.h> | ||
18 | #include <linux/serial_core.h> | ||
19 | #include <linux/irq.h> | ||
20 | #include <linux/io.h> | ||
21 | |||
22 | #include <asm/mach/irq.h> | ||
23 | |||
24 | #include <mach/map.h> | ||
25 | #include <plat/irq-uart.h> | ||
26 | #include <plat/regs-serial.h> | ||
27 | #include <plat/cpu.h> | ||
28 | |||
29 | /* Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3] | ||
30 | * are consecutive when looking up the interrupt in the demux routines. | ||
31 | */ | ||
32 | static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc) | ||
33 | { | ||
34 | struct s3c_uart_irq *uirq = desc->irq_data.handler_data; | ||
35 | struct irq_chip *chip = irq_get_chip(irq); | ||
36 | u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP); | ||
37 | int base = uirq->base_irq; | ||
38 | |||
39 | chained_irq_enter(chip, desc); | ||
40 | |||
41 | if (pend & (1 << 0)) | ||
42 | generic_handle_irq(base); | ||
43 | if (pend & (1 << 1)) | ||
44 | generic_handle_irq(base + 1); | ||
45 | if (pend & (1 << 2)) | ||
46 | generic_handle_irq(base + 2); | ||
47 | if (pend & (1 << 3)) | ||
48 | generic_handle_irq(base + 3); | ||
49 | |||
50 | chained_irq_exit(chip, desc); | ||
51 | } | ||
52 | |||
53 | static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq) | ||
54 | { | ||
55 | void __iomem *reg_base = uirq->regs; | ||
56 | struct irq_chip_generic *gc; | ||
57 | struct irq_chip_type *ct; | ||
58 | |||
59 | /* mask all interrupts at the start. */ | ||
60 | __raw_writel(0xf, reg_base + S3C64XX_UINTM); | ||
61 | |||
62 | gc = irq_alloc_generic_chip("s3c-uart", 1, uirq->base_irq, reg_base, | ||
63 | handle_level_irq); | ||
64 | |||
65 | if (!gc) { | ||
66 | pr_err("%s: irq_alloc_generic_chip for IRQ %u failed\n", | ||
67 | __func__, uirq->base_irq); | ||
68 | return; | ||
69 | } | ||
70 | |||
71 | ct = gc->chip_types; | ||
72 | ct->chip.irq_ack = irq_gc_ack_set_bit; | ||
73 | ct->chip.irq_mask = irq_gc_mask_set_bit; | ||
74 | ct->chip.irq_unmask = irq_gc_mask_clr_bit; | ||
75 | ct->regs.ack = S3C64XX_UINTP; | ||
76 | ct->regs.mask = S3C64XX_UINTM; | ||
77 | irq_setup_generic_chip(gc, IRQ_MSK(4), IRQ_GC_INIT_MASK_CACHE, | ||
78 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); | ||
79 | |||
80 | irq_set_handler_data(uirq->parent_irq, uirq); | ||
81 | irq_set_chained_handler(uirq->parent_irq, s3c_irq_demux_uart); | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * s3c_init_uart_irqs() - initialise UART IRQs and the necessary demuxing | ||
86 | * @irq: The interrupt data for registering | ||
87 | * @nr_irqs: The number of interrupt descriptions in @irq. | ||
88 | * | ||
89 | * Register the UART interrupts specified by @irq including the demuxing | ||
90 | * routines. This supports the S3C6400 and newer style of devices. | ||
91 | */ | ||
92 | void __init s3c_init_uart_irqs(struct s3c_uart_irq *irq, unsigned int nr_irqs) | ||
93 | { | ||
94 | for (; nr_irqs > 0; nr_irqs--, irq++) | ||
95 | s3c_init_uart_irq(irq); | ||
96 | } | ||
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c index f714d060370d..51583cd30164 100644 --- a/arch/arm/plat-samsung/irq-vic-timer.c +++ b/arch/arm/plat-samsung/irq-vic-timer.c | |||
@@ -22,9 +22,14 @@ | |||
22 | #include <plat/irq-vic-timer.h> | 22 | #include <plat/irq-vic-timer.h> |
23 | #include <plat/regs-timer.h> | 23 | #include <plat/regs-timer.h> |
24 | 24 | ||
25 | #include <asm/mach/irq.h> | ||
26 | |||
25 | static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc) | 27 | static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc) |
26 | { | 28 | { |
29 | struct irq_chip *chip = irq_get_chip(irq); | ||
30 | chained_irq_enter(chip, desc); | ||
27 | generic_handle_irq((int)desc->irq_data.handler_data); | 31 | generic_handle_irq((int)desc->irq_data.handler_data); |
32 | chained_irq_exit(chip, desc); | ||
28 | } | 33 | } |
29 | 34 | ||
30 | /* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */ | 35 | /* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */ |
diff --git a/arch/arm/plat-samsung/platformdata.c b/arch/arm/plat-samsung/platformdata.c index 7cf2e1e3b20f..ceb9fa3a80c0 100644 --- a/arch/arm/plat-samsung/platformdata.c +++ b/arch/arm/plat-samsung/platformdata.c | |||
@@ -10,10 +10,12 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/string.h> | 14 | #include <linux/string.h> |
14 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
15 | 16 | ||
16 | #include <plat/devs.h> | 17 | #include <plat/devs.h> |
18 | #include <plat/sdhci.h> | ||
17 | 19 | ||
18 | void __init *s3c_set_platdata(void *pd, size_t pdsize, | 20 | void __init *s3c_set_platdata(void *pd, size_t pdsize, |
19 | struct platform_device *pdev) | 21 | struct platform_device *pdev) |
@@ -35,3 +37,22 @@ void __init *s3c_set_platdata(void *pd, size_t pdsize, | |||
35 | pdev->dev.platform_data = npd; | 37 | pdev->dev.platform_data = npd; |
36 | return npd; | 38 | return npd; |
37 | } | 39 | } |
40 | |||
41 | void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd, | ||
42 | struct s3c_sdhci_platdata *set) | ||
43 | { | ||
44 | set->cd_type = pd->cd_type; | ||
45 | set->ext_cd_init = pd->ext_cd_init; | ||
46 | set->ext_cd_cleanup = pd->ext_cd_cleanup; | ||
47 | set->ext_cd_gpio = pd->ext_cd_gpio; | ||
48 | set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert; | ||
49 | |||
50 | if (pd->max_width) | ||
51 | set->max_width = pd->max_width; | ||
52 | if (pd->cfg_gpio) | ||
53 | set->cfg_gpio = pd->cfg_gpio; | ||
54 | if (pd->host_caps) | ||
55 | set->host_caps |= pd->host_caps; | ||
56 | if (pd->clk_type) | ||
57 | set->clk_type = pd->clk_type; | ||
58 | } | ||
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c index 96528200eb79..4be016eaa6db 100644 --- a/arch/arm/plat-samsung/pm-gpio.c +++ b/arch/arm/plat-samsung/pm-gpio.c | |||
@@ -28,13 +28,13 @@ | |||
28 | #define OFFS_DAT (0x04) | 28 | #define OFFS_DAT (0x04) |
29 | #define OFFS_UP (0x08) | 29 | #define OFFS_UP (0x08) |
30 | 30 | ||
31 | static void s3c_gpio_pm_1bit_save(struct s3c_gpio_chip *chip) | 31 | static void samsung_gpio_pm_1bit_save(struct samsung_gpio_chip *chip) |
32 | { | 32 | { |
33 | chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON); | 33 | chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON); |
34 | chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT); | 34 | chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT); |
35 | } | 35 | } |
36 | 36 | ||
37 | static void s3c_gpio_pm_1bit_resume(struct s3c_gpio_chip *chip) | 37 | static void samsung_gpio_pm_1bit_resume(struct samsung_gpio_chip *chip) |
38 | { | 38 | { |
39 | void __iomem *base = chip->base; | 39 | void __iomem *base = chip->base; |
40 | u32 old_gpcon = __raw_readl(base + OFFS_CON); | 40 | u32 old_gpcon = __raw_readl(base + OFFS_CON); |
@@ -60,12 +60,12 @@ static void s3c_gpio_pm_1bit_resume(struct s3c_gpio_chip *chip) | |||
60 | chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat); | 60 | chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat); |
61 | } | 61 | } |
62 | 62 | ||
63 | struct s3c_gpio_pm s3c_gpio_pm_1bit = { | 63 | struct samsung_gpio_pm samsung_gpio_pm_1bit = { |
64 | .save = s3c_gpio_pm_1bit_save, | 64 | .save = samsung_gpio_pm_1bit_save, |
65 | .resume = s3c_gpio_pm_1bit_resume, | 65 | .resume = samsung_gpio_pm_1bit_resume, |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static void s3c_gpio_pm_2bit_save(struct s3c_gpio_chip *chip) | 68 | static void samsung_gpio_pm_2bit_save(struct samsung_gpio_chip *chip) |
69 | { | 69 | { |
70 | chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON); | 70 | chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON); |
71 | chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT); | 71 | chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT); |
@@ -95,7 +95,7 @@ static inline int is_out(unsigned long con) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * s3c_gpio_pm_2bit_resume() - restore the given GPIO bank | 98 | * samsung_gpio_pm_2bit_resume() - restore the given GPIO bank |
99 | * @chip: The chip information to resume. | 99 | * @chip: The chip information to resume. |
100 | * | 100 | * |
101 | * Restore one of the GPIO banks that was saved during suspend. This is | 101 | * Restore one of the GPIO banks that was saved during suspend. This is |
@@ -121,7 +121,7 @@ static inline int is_out(unsigned long con) | |||
121 | * [1] this assumes that writing to a pin DAT whilst in SFN will set the | 121 | * [1] this assumes that writing to a pin DAT whilst in SFN will set the |
122 | * state for when it is next output. | 122 | * state for when it is next output. |
123 | */ | 123 | */ |
124 | static void s3c_gpio_pm_2bit_resume(struct s3c_gpio_chip *chip) | 124 | static void samsung_gpio_pm_2bit_resume(struct samsung_gpio_chip *chip) |
125 | { | 125 | { |
126 | void __iomem *base = chip->base; | 126 | void __iomem *base = chip->base; |
127 | u32 old_gpcon = __raw_readl(base + OFFS_CON); | 127 | u32 old_gpcon = __raw_readl(base + OFFS_CON); |
@@ -187,13 +187,13 @@ static void s3c_gpio_pm_2bit_resume(struct s3c_gpio_chip *chip) | |||
187 | chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat); | 187 | chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat); |
188 | } | 188 | } |
189 | 189 | ||
190 | struct s3c_gpio_pm s3c_gpio_pm_2bit = { | 190 | struct samsung_gpio_pm samsung_gpio_pm_2bit = { |
191 | .save = s3c_gpio_pm_2bit_save, | 191 | .save = samsung_gpio_pm_2bit_save, |
192 | .resume = s3c_gpio_pm_2bit_resume, | 192 | .resume = samsung_gpio_pm_2bit_resume, |
193 | }; | 193 | }; |
194 | 194 | ||
195 | #if defined(CONFIG_ARCH_S3C64XX) || defined(CONFIG_PLAT_S5P) | 195 | #if defined(CONFIG_ARCH_S3C64XX) || defined(CONFIG_PLAT_S5P) |
196 | static void s3c_gpio_pm_4bit_save(struct s3c_gpio_chip *chip) | 196 | static void samsung_gpio_pm_4bit_save(struct samsung_gpio_chip *chip) |
197 | { | 197 | { |
198 | chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON); | 198 | chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON); |
199 | chip->pm_save[2] = __raw_readl(chip->base + OFFS_DAT); | 199 | chip->pm_save[2] = __raw_readl(chip->base + OFFS_DAT); |
@@ -203,7 +203,7 @@ static void s3c_gpio_pm_4bit_save(struct s3c_gpio_chip *chip) | |||
203 | chip->pm_save[0] = __raw_readl(chip->base - 4); | 203 | chip->pm_save[0] = __raw_readl(chip->base - 4); |
204 | } | 204 | } |
205 | 205 | ||
206 | static u32 s3c_gpio_pm_4bit_mask(u32 old_gpcon, u32 gps_gpcon) | 206 | static u32 samsung_gpio_pm_4bit_mask(u32 old_gpcon, u32 gps_gpcon) |
207 | { | 207 | { |
208 | u32 old, new, mask; | 208 | u32 old, new, mask; |
209 | u32 change_mask = 0x0; | 209 | u32 change_mask = 0x0; |
@@ -242,14 +242,14 @@ static u32 s3c_gpio_pm_4bit_mask(u32 old_gpcon, u32 gps_gpcon) | |||
242 | return change_mask; | 242 | return change_mask; |
243 | } | 243 | } |
244 | 244 | ||
245 | static void s3c_gpio_pm_4bit_con(struct s3c_gpio_chip *chip, int index) | 245 | static void samsung_gpio_pm_4bit_con(struct samsung_gpio_chip *chip, int index) |
246 | { | 246 | { |
247 | void __iomem *con = chip->base + (index * 4); | 247 | void __iomem *con = chip->base + (index * 4); |
248 | u32 old_gpcon = __raw_readl(con); | 248 | u32 old_gpcon = __raw_readl(con); |
249 | u32 gps_gpcon = chip->pm_save[index + 1]; | 249 | u32 gps_gpcon = chip->pm_save[index + 1]; |
250 | u32 gpcon, mask; | 250 | u32 gpcon, mask; |
251 | 251 | ||
252 | mask = s3c_gpio_pm_4bit_mask(old_gpcon, gps_gpcon); | 252 | mask = samsung_gpio_pm_4bit_mask(old_gpcon, gps_gpcon); |
253 | 253 | ||
254 | gpcon = old_gpcon & ~mask; | 254 | gpcon = old_gpcon & ~mask; |
255 | gpcon |= gps_gpcon & mask; | 255 | gpcon |= gps_gpcon & mask; |
@@ -257,7 +257,7 @@ static void s3c_gpio_pm_4bit_con(struct s3c_gpio_chip *chip, int index) | |||
257 | __raw_writel(gpcon, con); | 257 | __raw_writel(gpcon, con); |
258 | } | 258 | } |
259 | 259 | ||
260 | static void s3c_gpio_pm_4bit_resume(struct s3c_gpio_chip *chip) | 260 | static void samsung_gpio_pm_4bit_resume(struct samsung_gpio_chip *chip) |
261 | { | 261 | { |
262 | void __iomem *base = chip->base; | 262 | void __iomem *base = chip->base; |
263 | u32 old_gpcon[2]; | 263 | u32 old_gpcon[2]; |
@@ -269,10 +269,10 @@ static void s3c_gpio_pm_4bit_resume(struct s3c_gpio_chip *chip) | |||
269 | old_gpcon[0] = 0; | 269 | old_gpcon[0] = 0; |
270 | old_gpcon[1] = __raw_readl(base + OFFS_CON); | 270 | old_gpcon[1] = __raw_readl(base + OFFS_CON); |
271 | 271 | ||
272 | s3c_gpio_pm_4bit_con(chip, 0); | 272 | samsung_gpio_pm_4bit_con(chip, 0); |
273 | if (chip->chip.ngpio > 8) { | 273 | if (chip->chip.ngpio > 8) { |
274 | old_gpcon[0] = __raw_readl(base - 4); | 274 | old_gpcon[0] = __raw_readl(base - 4); |
275 | s3c_gpio_pm_4bit_con(chip, -1); | 275 | samsung_gpio_pm_4bit_con(chip, -1); |
276 | } | 276 | } |
277 | 277 | ||
278 | /* Now change the configurations that require DAT,CON */ | 278 | /* Now change the configurations that require DAT,CON */ |
@@ -298,19 +298,19 @@ static void s3c_gpio_pm_4bit_resume(struct s3c_gpio_chip *chip) | |||
298 | old_gpdat, gps_gpdat); | 298 | old_gpdat, gps_gpdat); |
299 | } | 299 | } |
300 | 300 | ||
301 | struct s3c_gpio_pm s3c_gpio_pm_4bit = { | 301 | struct samsung_gpio_pm samsung_gpio_pm_4bit = { |
302 | .save = s3c_gpio_pm_4bit_save, | 302 | .save = samsung_gpio_pm_4bit_save, |
303 | .resume = s3c_gpio_pm_4bit_resume, | 303 | .resume = samsung_gpio_pm_4bit_resume, |
304 | }; | 304 | }; |
305 | #endif /* CONFIG_ARCH_S3C64XX || CONFIG_PLAT_S5P */ | 305 | #endif /* CONFIG_ARCH_S3C64XX || CONFIG_PLAT_S5P */ |
306 | 306 | ||
307 | /** | 307 | /** |
308 | * s3c_pm_save_gpio() - save gpio chip data for suspend | 308 | * samsung_pm_save_gpio() - save gpio chip data for suspend |
309 | * @ourchip: The chip for suspend. | 309 | * @ourchip: The chip for suspend. |
310 | */ | 310 | */ |
311 | static void s3c_pm_save_gpio(struct s3c_gpio_chip *ourchip) | 311 | static void samsung_pm_save_gpio(struct samsung_gpio_chip *ourchip) |
312 | { | 312 | { |
313 | struct s3c_gpio_pm *pm = ourchip->pm; | 313 | struct samsung_gpio_pm *pm = ourchip->pm; |
314 | 314 | ||
315 | if (pm == NULL || pm->save == NULL) | 315 | if (pm == NULL || pm->save == NULL) |
316 | S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label); | 316 | S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label); |
@@ -319,24 +319,24 @@ static void s3c_pm_save_gpio(struct s3c_gpio_chip *ourchip) | |||
319 | } | 319 | } |
320 | 320 | ||
321 | /** | 321 | /** |
322 | * s3c_pm_save_gpios() - Save the state of the GPIO banks. | 322 | * samsung_pm_save_gpios() - Save the state of the GPIO banks. |
323 | * | 323 | * |
324 | * For all the GPIO banks, save the state of each one ready for going | 324 | * For all the GPIO banks, save the state of each one ready for going |
325 | * into a suspend mode. | 325 | * into a suspend mode. |
326 | */ | 326 | */ |
327 | void s3c_pm_save_gpios(void) | 327 | void samsung_pm_save_gpios(void) |
328 | { | 328 | { |
329 | struct s3c_gpio_chip *ourchip; | 329 | struct samsung_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;) { | 332 | for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) { |
333 | ourchip = s3c_gpiolib_getchip(gpio_nr); | 333 | ourchip = samsung_gpiolib_getchip(gpio_nr); |
334 | if (!ourchip) { | 334 | if (!ourchip) { |
335 | gpio_nr++; | 335 | gpio_nr++; |
336 | continue; | 336 | continue; |
337 | } | 337 | } |
338 | 338 | ||
339 | s3c_pm_save_gpio(ourchip); | 339 | samsung_pm_save_gpio(ourchip); |
340 | 340 | ||
341 | S3C_PMDBG("%s: save %08x,%08x,%08x,%08x\n", | 341 | S3C_PMDBG("%s: save %08x,%08x,%08x,%08x\n", |
342 | ourchip->chip.label, | 342 | ourchip->chip.label, |
@@ -351,12 +351,12 @@ void s3c_pm_save_gpios(void) | |||
351 | } | 351 | } |
352 | 352 | ||
353 | /** | 353 | /** |
354 | * s3c_pm_resume_gpio() - restore gpio chip data after suspend | 354 | * samsung_pm_resume_gpio() - restore gpio chip data after suspend |
355 | * @ourchip: The suspended chip. | 355 | * @ourchip: The suspended chip. |
356 | */ | 356 | */ |
357 | static void s3c_pm_resume_gpio(struct s3c_gpio_chip *ourchip) | 357 | static void samsung_pm_resume_gpio(struct samsung_gpio_chip *ourchip) |
358 | { | 358 | { |
359 | struct s3c_gpio_pm *pm = ourchip->pm; | 359 | struct samsung_gpio_pm *pm = ourchip->pm; |
360 | 360 | ||
361 | if (pm == NULL || pm->resume == NULL) | 361 | if (pm == NULL || pm->resume == NULL) |
362 | S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label); | 362 | S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label); |
@@ -364,19 +364,19 @@ static void s3c_pm_resume_gpio(struct s3c_gpio_chip *ourchip) | |||
364 | pm->resume(ourchip); | 364 | pm->resume(ourchip); |
365 | } | 365 | } |
366 | 366 | ||
367 | void s3c_pm_restore_gpios(void) | 367 | void samsung_pm_restore_gpios(void) |
368 | { | 368 | { |
369 | struct s3c_gpio_chip *ourchip; | 369 | struct samsung_gpio_chip *ourchip; |
370 | unsigned int gpio_nr; | 370 | unsigned int gpio_nr; |
371 | 371 | ||
372 | for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) { | 372 | for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) { |
373 | ourchip = s3c_gpiolib_getchip(gpio_nr); | 373 | ourchip = samsung_gpiolib_getchip(gpio_nr); |
374 | if (!ourchip) { | 374 | if (!ourchip) { |
375 | gpio_nr++; | 375 | gpio_nr++; |
376 | continue; | 376 | continue; |
377 | } | 377 | } |
378 | 378 | ||
379 | s3c_pm_resume_gpio(ourchip); | 379 | samsung_pm_resume_gpio(ourchip); |
380 | 380 | ||
381 | gpio_nr += ourchip->chip.ngpio; | 381 | gpio_nr += ourchip->chip.ngpio; |
382 | gpio_nr += CONFIG_S3C_GPIO_SPACE; | 382 | gpio_nr += CONFIG_S3C_GPIO_SPACE; |
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c index ae6f99834cdd..64ab65f0fdbc 100644 --- a/arch/arm/plat-samsung/pm.c +++ b/arch/arm/plat-samsung/pm.c | |||
@@ -268,8 +268,8 @@ static int s3c_pm_enter(suspend_state_t state) | |||
268 | 268 | ||
269 | /* save all necessary core registers not covered by the drivers */ | 269 | /* save all necessary core registers not covered by the drivers */ |
270 | 270 | ||
271 | s3c_pm_save_gpios(); | 271 | samsung_pm_save_gpios(); |
272 | s3c_pm_saved_gpios(); | 272 | samsung_pm_saved_gpios(); |
273 | s3c_pm_save_uarts(); | 273 | s3c_pm_save_uarts(); |
274 | s3c_pm_save_core(); | 274 | s3c_pm_save_core(); |
275 | 275 | ||
@@ -306,7 +306,7 @@ static int s3c_pm_enter(suspend_state_t state) | |||
306 | 306 | ||
307 | s3c_pm_restore_core(); | 307 | s3c_pm_restore_core(); |
308 | s3c_pm_restore_uarts(); | 308 | s3c_pm_restore_uarts(); |
309 | s3c_pm_restore_gpios(); | 309 | samsung_pm_restore_gpios(); |
310 | s3c_pm_restored_gpios(); | 310 | s3c_pm_restored_gpios(); |
311 | 311 | ||
312 | s3c_pm_debug_init(); | 312 | s3c_pm_debug_init(); |
diff --git a/arch/arm/plat-samsung/pwm-clock.c b/arch/arm/plat-samsung/pwm-clock.c index f1bba88ed2f5..a35ff3bcffe4 100644 --- a/arch/arm/plat-samsung/pwm-clock.c +++ b/arch/arm/plat-samsung/pwm-clock.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <plat/cpu.h> | 27 | #include <plat/cpu.h> |
28 | 28 | ||
29 | #include <plat/regs-timer.h> | 29 | #include <plat/regs-timer.h> |
30 | #include <mach/pwm-clock.h> | 30 | #include <plat/pwm-clock.h> |
31 | 31 | ||
32 | /* Each of the timers 0 through 5 go through the following | 32 | /* Each of the timers 0 through 5 go through the following |
33 | * clock tree, with the inputs depending on the timers. | 33 | * clock tree, with the inputs depending on the timers. |
@@ -339,8 +339,17 @@ static int clk_pwm_tin_set_parent(struct clk *clk, struct clk *parent) | |||
339 | unsigned long bits; | 339 | unsigned long bits; |
340 | unsigned long shift = S3C2410_TCFG1_SHIFT(id); | 340 | unsigned long shift = S3C2410_TCFG1_SHIFT(id); |
341 | 341 | ||
342 | unsigned long mux_tclk; | ||
343 | |||
344 | if (soc_is_s3c24xx()) | ||
345 | mux_tclk = S3C2410_TCFG1_MUX_TCLK; | ||
346 | else if (soc_is_s5p6440() || soc_is_s5p6450()) | ||
347 | mux_tclk = 0; | ||
348 | else | ||
349 | mux_tclk = S3C64XX_TCFG1_MUX_TCLK; | ||
350 | |||
342 | if (parent == s3c24xx_pwmclk_tclk(id)) | 351 | if (parent == s3c24xx_pwmclk_tclk(id)) |
343 | bits = S3C_TCFG1_MUX_TCLK << shift; | 352 | bits = mux_tclk << shift; |
344 | else if (parent == s3c24xx_pwmclk_tdiv(id)) | 353 | else if (parent == s3c24xx_pwmclk_tdiv(id)) |
345 | bits = clk_pwm_tdiv_bits(to_tdiv(parent)) << shift; | 354 | bits = clk_pwm_tdiv_bits(to_tdiv(parent)) << shift; |
346 | else | 355 | else |
diff --git a/arch/arm/plat-samsung/pwm.c b/arch/arm/plat-samsung/pwm.c index f37457c52064..dc1185dcf80d 100644 --- a/arch/arm/plat-samsung/pwm.c +++ b/arch/arm/plat-samsung/pwm.c | |||
@@ -299,6 +299,9 @@ static int s3c_pwm_probe(struct platform_device *pdev) | |||
299 | goto err_clk_tin; | 299 | goto err_clk_tin; |
300 | } | 300 | } |
301 | 301 | ||
302 | clk_enable(pwm->clk); | ||
303 | clk_enable(pwm->clk_div); | ||
304 | |||
302 | local_irq_save(flags); | 305 | local_irq_save(flags); |
303 | 306 | ||
304 | tcon = __raw_readl(S3C2410_TCON); | 307 | tcon = __raw_readl(S3C2410_TCON); |
@@ -326,6 +329,8 @@ static int s3c_pwm_probe(struct platform_device *pdev) | |||
326 | return 0; | 329 | return 0; |
327 | 330 | ||
328 | err_clk_tdiv: | 331 | err_clk_tdiv: |
332 | clk_disable(pwm->clk_div); | ||
333 | clk_disable(pwm->clk); | ||
329 | clk_put(pwm->clk_div); | 334 | clk_put(pwm->clk_div); |
330 | 335 | ||
331 | err_clk_tin: | 336 | err_clk_tin: |
@@ -340,6 +345,8 @@ static int __devexit s3c_pwm_remove(struct platform_device *pdev) | |||
340 | { | 345 | { |
341 | struct pwm_device *pwm = platform_get_drvdata(pdev); | 346 | struct pwm_device *pwm = platform_get_drvdata(pdev); |
342 | 347 | ||
348 | clk_disable(pwm->clk_div); | ||
349 | clk_disable(pwm->clk); | ||
343 | clk_put(pwm->clk_div); | 350 | clk_put(pwm->clk_div); |
344 | clk_put(pwm->clk); | 351 | clk_put(pwm->clk); |
345 | kfree(pwm); | 352 | kfree(pwm); |
diff --git a/arch/arm/plat-samsung/s3c-dma-ops.c b/arch/arm/plat-samsung/s3c-dma-ops.c new file mode 100644 index 000000000000..781494912827 --- /dev/null +++ b/arch/arm/plat-samsung/s3c-dma-ops.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /* linux/arch/arm/plat-samsung/s3c-dma-ops.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Samsung S3C-DMA Operations | ||
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/errno.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/export.h> | ||
18 | |||
19 | #include <mach/dma.h> | ||
20 | |||
21 | struct cb_data { | ||
22 | void (*fp) (void *); | ||
23 | void *fp_param; | ||
24 | unsigned ch; | ||
25 | struct list_head node; | ||
26 | }; | ||
27 | |||
28 | static LIST_HEAD(dma_list); | ||
29 | |||
30 | static void s3c_dma_cb(struct s3c2410_dma_chan *channel, void *param, | ||
31 | int size, enum s3c2410_dma_buffresult res) | ||
32 | { | ||
33 | struct cb_data *data = param; | ||
34 | |||
35 | data->fp(data->fp_param); | ||
36 | } | ||
37 | |||
38 | static unsigned s3c_dma_request(enum dma_ch dma_ch, | ||
39 | struct samsung_dma_info *info) | ||
40 | { | ||
41 | struct cb_data *data; | ||
42 | |||
43 | if (s3c2410_dma_request(dma_ch, info->client, NULL) < 0) { | ||
44 | s3c2410_dma_free(dma_ch, info->client); | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | data = kzalloc(sizeof(struct cb_data), GFP_KERNEL); | ||
49 | data->ch = dma_ch; | ||
50 | list_add_tail(&data->node, &dma_list); | ||
51 | |||
52 | s3c2410_dma_devconfig(dma_ch, info->direction, info->fifo); | ||
53 | |||
54 | if (info->cap == DMA_CYCLIC) | ||
55 | s3c2410_dma_setflags(dma_ch, S3C2410_DMAF_CIRCULAR); | ||
56 | |||
57 | s3c2410_dma_config(dma_ch, info->width); | ||
58 | |||
59 | return (unsigned)dma_ch; | ||
60 | } | ||
61 | |||
62 | static int s3c_dma_release(unsigned ch, struct s3c2410_dma_client *client) | ||
63 | { | ||
64 | struct cb_data *data; | ||
65 | |||
66 | list_for_each_entry(data, &dma_list, node) | ||
67 | if (data->ch == ch) | ||
68 | break; | ||
69 | list_del(&data->node); | ||
70 | |||
71 | s3c2410_dma_free(ch, client); | ||
72 | kfree(data); | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static int s3c_dma_prepare(unsigned ch, struct samsung_dma_prep_info *info) | ||
78 | { | ||
79 | struct cb_data *data; | ||
80 | int len = (info->cap == DMA_CYCLIC) ? info->period : info->len; | ||
81 | |||
82 | list_for_each_entry(data, &dma_list, node) | ||
83 | if (data->ch == ch) | ||
84 | break; | ||
85 | |||
86 | if (!data->fp) { | ||
87 | s3c2410_dma_set_buffdone_fn(ch, s3c_dma_cb); | ||
88 | data->fp = info->fp; | ||
89 | data->fp_param = info->fp_param; | ||
90 | } | ||
91 | |||
92 | s3c2410_dma_enqueue(ch, (void *)data, info->buf, len); | ||
93 | |||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | static inline int s3c_dma_trigger(unsigned ch) | ||
98 | { | ||
99 | return s3c2410_dma_ctrl(ch, S3C2410_DMAOP_START); | ||
100 | } | ||
101 | |||
102 | static inline int s3c_dma_started(unsigned ch) | ||
103 | { | ||
104 | return s3c2410_dma_ctrl(ch, S3C2410_DMAOP_STARTED); | ||
105 | } | ||
106 | |||
107 | static inline int s3c_dma_flush(unsigned ch) | ||
108 | { | ||
109 | return s3c2410_dma_ctrl(ch, S3C2410_DMAOP_FLUSH); | ||
110 | } | ||
111 | |||
112 | static inline int s3c_dma_stop(unsigned ch) | ||
113 | { | ||
114 | return s3c2410_dma_ctrl(ch, S3C2410_DMAOP_STOP); | ||
115 | } | ||
116 | |||
117 | static struct samsung_dma_ops s3c_dma_ops = { | ||
118 | .request = s3c_dma_request, | ||
119 | .release = s3c_dma_release, | ||
120 | .prepare = s3c_dma_prepare, | ||
121 | .trigger = s3c_dma_trigger, | ||
122 | .started = s3c_dma_started, | ||
123 | .flush = s3c_dma_flush, | ||
124 | .stop = s3c_dma_stop, | ||
125 | }; | ||
126 | |||
127 | void *s3c_dma_get_ops(void) | ||
128 | { | ||
129 | return &s3c_dma_ops; | ||
130 | } | ||
131 | EXPORT_SYMBOL(s3c_dma_get_ops); | ||
diff --git a/arch/arm/plat-samsung/s3c-pl330.c b/arch/arm/plat-samsung/s3c-pl330.c deleted file mode 100644 index f85638c6f5ae..000000000000 --- a/arch/arm/plat-samsung/s3c-pl330.c +++ /dev/null | |||
@@ -1,1244 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/s3c-pl330.c | ||
2 | * | ||
3 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/err.h> | ||
20 | |||
21 | #include <asm/hardware/pl330.h> | ||
22 | |||
23 | #include <plat/s3c-pl330-pdata.h> | ||
24 | |||
25 | /** | ||
26 | * struct s3c_pl330_dmac - Logical representation of a PL330 DMAC. | ||
27 | * @busy_chan: Number of channels currently busy. | ||
28 | * @peri: List of IDs of peripherals this DMAC can work with. | ||
29 | * @node: To attach to the global list of DMACs. | ||
30 | * @pi: PL330 configuration info for the DMAC. | ||
31 | * @kmcache: Pool to quickly allocate xfers for all channels in the dmac. | ||
32 | * @clk: Pointer of DMAC operation clock. | ||
33 | */ | ||
34 | struct s3c_pl330_dmac { | ||
35 | unsigned busy_chan; | ||
36 | enum dma_ch *peri; | ||
37 | struct list_head node; | ||
38 | struct pl330_info *pi; | ||
39 | struct kmem_cache *kmcache; | ||
40 | struct clk *clk; | ||
41 | }; | ||
42 | |||
43 | /** | ||
44 | * struct s3c_pl330_xfer - A request submitted by S3C DMA clients. | ||
45 | * @token: Xfer ID provided by the client. | ||
46 | * @node: To attach to the list of xfers on a channel. | ||
47 | * @px: Xfer for PL330 core. | ||
48 | * @chan: Owner channel of this xfer. | ||
49 | */ | ||
50 | struct s3c_pl330_xfer { | ||
51 | void *token; | ||
52 | struct list_head node; | ||
53 | struct pl330_xfer px; | ||
54 | struct s3c_pl330_chan *chan; | ||
55 | }; | ||
56 | |||
57 | /** | ||
58 | * struct s3c_pl330_chan - Logical channel to communicate with | ||
59 | * a Physical peripheral. | ||
60 | * @pl330_chan_id: Token of a hardware channel thread of PL330 DMAC. | ||
61 | * NULL if the channel is available to be acquired. | ||
62 | * @id: ID of the peripheral that this channel can communicate with. | ||
63 | * @options: Options specified by the client. | ||
64 | * @sdaddr: Address provided via s3c2410_dma_devconfig. | ||
65 | * @node: To attach to the global list of channels. | ||
66 | * @lrq: Pointer to the last submitted pl330_req to PL330 core. | ||
67 | * @xfer_list: To manage list of xfers enqueued. | ||
68 | * @req: Two requests to communicate with the PL330 engine. | ||
69 | * @callback_fn: Callback function to the client. | ||
70 | * @rqcfg: Channel configuration for the xfers. | ||
71 | * @xfer_head: Pointer to the xfer to be next executed. | ||
72 | * @dmac: Pointer to the DMAC that manages this channel, NULL if the | ||
73 | * channel is available to be acquired. | ||
74 | * @client: Client of this channel. NULL if the | ||
75 | * channel is available to be acquired. | ||
76 | */ | ||
77 | struct s3c_pl330_chan { | ||
78 | void *pl330_chan_id; | ||
79 | enum dma_ch id; | ||
80 | unsigned int options; | ||
81 | unsigned long sdaddr; | ||
82 | struct list_head node; | ||
83 | struct pl330_req *lrq; | ||
84 | struct list_head xfer_list; | ||
85 | struct pl330_req req[2]; | ||
86 | s3c2410_dma_cbfn_t callback_fn; | ||
87 | struct pl330_reqcfg rqcfg; | ||
88 | struct s3c_pl330_xfer *xfer_head; | ||
89 | struct s3c_pl330_dmac *dmac; | ||
90 | struct s3c2410_dma_client *client; | ||
91 | }; | ||
92 | |||
93 | /* All DMACs in the platform */ | ||
94 | static LIST_HEAD(dmac_list); | ||
95 | |||
96 | /* All channels to peripherals in the platform */ | ||
97 | static LIST_HEAD(chan_list); | ||
98 | |||
99 | /* | ||
100 | * Since we add resources(DMACs and Channels) to the global pool, | ||
101 | * we need to guard access to the resources using a global lock | ||
102 | */ | ||
103 | static DEFINE_SPINLOCK(res_lock); | ||
104 | |||
105 | /* Returns the channel with ID 'id' in the chan_list */ | ||
106 | static struct s3c_pl330_chan *id_to_chan(const enum dma_ch id) | ||
107 | { | ||
108 | struct s3c_pl330_chan *ch; | ||
109 | |||
110 | list_for_each_entry(ch, &chan_list, node) | ||
111 | if (ch->id == id) | ||
112 | return ch; | ||
113 | |||
114 | return NULL; | ||
115 | } | ||
116 | |||
117 | /* Allocate a new channel with ID 'id' and add to chan_list */ | ||
118 | static void chan_add(const enum dma_ch id) | ||
119 | { | ||
120 | struct s3c_pl330_chan *ch = id_to_chan(id); | ||
121 | |||
122 | /* Return if the channel already exists */ | ||
123 | if (ch) | ||
124 | return; | ||
125 | |||
126 | ch = kmalloc(sizeof(*ch), GFP_KERNEL); | ||
127 | /* Return silently to work with other channels */ | ||
128 | if (!ch) | ||
129 | return; | ||
130 | |||
131 | ch->id = id; | ||
132 | ch->dmac = NULL; | ||
133 | |||
134 | list_add_tail(&ch->node, &chan_list); | ||
135 | } | ||
136 | |||
137 | /* If the channel is not yet acquired by any client */ | ||
138 | static bool chan_free(struct s3c_pl330_chan *ch) | ||
139 | { | ||
140 | if (!ch) | ||
141 | return false; | ||
142 | |||
143 | /* Channel points to some DMAC only when it's acquired */ | ||
144 | return ch->dmac ? false : true; | ||
145 | } | ||
146 | |||
147 | /* | ||
148 | * Returns 0 is peripheral i/f is invalid or not present on the dmac. | ||
149 | * Index + 1, otherwise. | ||
150 | */ | ||
151 | static unsigned iface_of_dmac(struct s3c_pl330_dmac *dmac, enum dma_ch ch_id) | ||
152 | { | ||
153 | enum dma_ch *id = dmac->peri; | ||
154 | int i; | ||
155 | |||
156 | /* Discount invalid markers */ | ||
157 | if (ch_id == DMACH_MAX) | ||
158 | return 0; | ||
159 | |||
160 | for (i = 0; i < PL330_MAX_PERI; i++) | ||
161 | if (id[i] == ch_id) | ||
162 | return i + 1; | ||
163 | |||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | /* If all channel threads of the DMAC are busy */ | ||
168 | static inline bool dmac_busy(struct s3c_pl330_dmac *dmac) | ||
169 | { | ||
170 | struct pl330_info *pi = dmac->pi; | ||
171 | |||
172 | return (dmac->busy_chan < pi->pcfg.num_chan) ? false : true; | ||
173 | } | ||
174 | |||
175 | /* | ||
176 | * Returns the number of free channels that | ||
177 | * can be handled by this dmac only. | ||
178 | */ | ||
179 | static unsigned ch_onlyby_dmac(struct s3c_pl330_dmac *dmac) | ||
180 | { | ||
181 | enum dma_ch *id = dmac->peri; | ||
182 | struct s3c_pl330_dmac *d; | ||
183 | struct s3c_pl330_chan *ch; | ||
184 | unsigned found, count = 0; | ||
185 | enum dma_ch p; | ||
186 | int i; | ||
187 | |||
188 | for (i = 0; i < PL330_MAX_PERI; i++) { | ||
189 | p = id[i]; | ||
190 | ch = id_to_chan(p); | ||
191 | |||
192 | if (p == DMACH_MAX || !chan_free(ch)) | ||
193 | continue; | ||
194 | |||
195 | found = 0; | ||
196 | list_for_each_entry(d, &dmac_list, node) { | ||
197 | if (d != dmac && iface_of_dmac(d, ch->id)) { | ||
198 | found = 1; | ||
199 | break; | ||
200 | } | ||
201 | } | ||
202 | if (!found) | ||
203 | count++; | ||
204 | } | ||
205 | |||
206 | return count; | ||
207 | } | ||
208 | |||
209 | /* | ||
210 | * Measure of suitability of 'dmac' handling 'ch' | ||
211 | * | ||
212 | * 0 indicates 'dmac' can not handle 'ch' either | ||
213 | * because it is not supported by the hardware or | ||
214 | * because all dmac channels are currently busy. | ||
215 | * | ||
216 | * >0 vlaue indicates 'dmac' has the capability. | ||
217 | * The bigger the value the more suitable the dmac. | ||
218 | */ | ||
219 | #define MAX_SUIT UINT_MAX | ||
220 | #define MIN_SUIT 0 | ||
221 | |||
222 | static unsigned suitablility(struct s3c_pl330_dmac *dmac, | ||
223 | struct s3c_pl330_chan *ch) | ||
224 | { | ||
225 | struct pl330_info *pi = dmac->pi; | ||
226 | enum dma_ch *id = dmac->peri; | ||
227 | struct s3c_pl330_dmac *d; | ||
228 | unsigned s; | ||
229 | int i; | ||
230 | |||
231 | s = MIN_SUIT; | ||
232 | /* If all the DMAC channel threads are busy */ | ||
233 | if (dmac_busy(dmac)) | ||
234 | return s; | ||
235 | |||
236 | for (i = 0; i < PL330_MAX_PERI; i++) | ||
237 | if (id[i] == ch->id) | ||
238 | break; | ||
239 | |||
240 | /* If the 'dmac' can't talk to 'ch' */ | ||
241 | if (i == PL330_MAX_PERI) | ||
242 | return s; | ||
243 | |||
244 | s = MAX_SUIT; | ||
245 | list_for_each_entry(d, &dmac_list, node) { | ||
246 | /* | ||
247 | * If some other dmac can talk to this | ||
248 | * peri and has some channel free. | ||
249 | */ | ||
250 | if (d != dmac && iface_of_dmac(d, ch->id) && !dmac_busy(d)) { | ||
251 | s = 0; | ||
252 | break; | ||
253 | } | ||
254 | } | ||
255 | if (s) | ||
256 | return s; | ||
257 | |||
258 | s = 100; | ||
259 | |||
260 | /* Good if free chans are more, bad otherwise */ | ||
261 | s += (pi->pcfg.num_chan - dmac->busy_chan) - ch_onlyby_dmac(dmac); | ||
262 | |||
263 | return s; | ||
264 | } | ||
265 | |||
266 | /* More than one DMAC may have capability to transfer data with the | ||
267 | * peripheral. This function assigns most suitable DMAC to manage the | ||
268 | * channel and hence communicate with the peripheral. | ||
269 | */ | ||
270 | static struct s3c_pl330_dmac *map_chan_to_dmac(struct s3c_pl330_chan *ch) | ||
271 | { | ||
272 | struct s3c_pl330_dmac *d, *dmac = NULL; | ||
273 | unsigned sn, sl = MIN_SUIT; | ||
274 | |||
275 | list_for_each_entry(d, &dmac_list, node) { | ||
276 | sn = suitablility(d, ch); | ||
277 | |||
278 | if (sn == MAX_SUIT) | ||
279 | return d; | ||
280 | |||
281 | if (sn > sl) | ||
282 | dmac = d; | ||
283 | } | ||
284 | |||
285 | return dmac; | ||
286 | } | ||
287 | |||
288 | /* Acquire the channel for peripheral 'id' */ | ||
289 | static struct s3c_pl330_chan *chan_acquire(const enum dma_ch id) | ||
290 | { | ||
291 | struct s3c_pl330_chan *ch = id_to_chan(id); | ||
292 | struct s3c_pl330_dmac *dmac; | ||
293 | |||
294 | /* If the channel doesn't exist or is already acquired */ | ||
295 | if (!ch || !chan_free(ch)) { | ||
296 | ch = NULL; | ||
297 | goto acq_exit; | ||
298 | } | ||
299 | |||
300 | dmac = map_chan_to_dmac(ch); | ||
301 | /* If couldn't map */ | ||
302 | if (!dmac) { | ||
303 | ch = NULL; | ||
304 | goto acq_exit; | ||
305 | } | ||
306 | |||
307 | dmac->busy_chan++; | ||
308 | ch->dmac = dmac; | ||
309 | |||
310 | acq_exit: | ||
311 | return ch; | ||
312 | } | ||
313 | |||
314 | /* Delete xfer from the queue */ | ||
315 | static inline void del_from_queue(struct s3c_pl330_xfer *xfer) | ||
316 | { | ||
317 | struct s3c_pl330_xfer *t; | ||
318 | struct s3c_pl330_chan *ch; | ||
319 | int found; | ||
320 | |||
321 | if (!xfer) | ||
322 | return; | ||
323 | |||
324 | ch = xfer->chan; | ||
325 | |||
326 | /* Make sure xfer is in the queue */ | ||
327 | found = 0; | ||
328 | list_for_each_entry(t, &ch->xfer_list, node) | ||
329 | if (t == xfer) { | ||
330 | found = 1; | ||
331 | break; | ||
332 | } | ||
333 | |||
334 | if (!found) | ||
335 | return; | ||
336 | |||
337 | /* If xfer is last entry in the queue */ | ||
338 | if (xfer->node.next == &ch->xfer_list) | ||
339 | t = list_entry(ch->xfer_list.next, | ||
340 | struct s3c_pl330_xfer, node); | ||
341 | else | ||
342 | t = list_entry(xfer->node.next, | ||
343 | struct s3c_pl330_xfer, node); | ||
344 | |||
345 | /* If there was only one node left */ | ||
346 | if (t == xfer) | ||
347 | ch->xfer_head = NULL; | ||
348 | else if (ch->xfer_head == xfer) | ||
349 | ch->xfer_head = t; | ||
350 | |||
351 | list_del(&xfer->node); | ||
352 | } | ||
353 | |||
354 | /* Provides pointer to the next xfer in the queue. | ||
355 | * If CIRCULAR option is set, the list is left intact, | ||
356 | * otherwise the xfer is removed from the list. | ||
357 | * Forced delete 'pluck' can be set to override the CIRCULAR option. | ||
358 | */ | ||
359 | static struct s3c_pl330_xfer *get_from_queue(struct s3c_pl330_chan *ch, | ||
360 | int pluck) | ||
361 | { | ||
362 | struct s3c_pl330_xfer *xfer = ch->xfer_head; | ||
363 | |||
364 | if (!xfer) | ||
365 | return NULL; | ||
366 | |||
367 | /* If xfer is last entry in the queue */ | ||
368 | if (xfer->node.next == &ch->xfer_list) | ||
369 | ch->xfer_head = list_entry(ch->xfer_list.next, | ||
370 | struct s3c_pl330_xfer, node); | ||
371 | else | ||
372 | ch->xfer_head = list_entry(xfer->node.next, | ||
373 | struct s3c_pl330_xfer, node); | ||
374 | |||
375 | if (pluck || !(ch->options & S3C2410_DMAF_CIRCULAR)) | ||
376 | del_from_queue(xfer); | ||
377 | |||
378 | return xfer; | ||
379 | } | ||
380 | |||
381 | static inline void add_to_queue(struct s3c_pl330_chan *ch, | ||
382 | struct s3c_pl330_xfer *xfer, int front) | ||
383 | { | ||
384 | struct pl330_xfer *xt; | ||
385 | |||
386 | /* If queue empty */ | ||
387 | if (ch->xfer_head == NULL) | ||
388 | ch->xfer_head = xfer; | ||
389 | |||
390 | xt = &ch->xfer_head->px; | ||
391 | /* If the head already submitted (CIRCULAR head) */ | ||
392 | if (ch->options & S3C2410_DMAF_CIRCULAR && | ||
393 | (xt == ch->req[0].x || xt == ch->req[1].x)) | ||
394 | ch->xfer_head = xfer; | ||
395 | |||
396 | /* If this is a resubmission, it should go at the head */ | ||
397 | if (front) { | ||
398 | ch->xfer_head = xfer; | ||
399 | list_add(&xfer->node, &ch->xfer_list); | ||
400 | } else { | ||
401 | list_add_tail(&xfer->node, &ch->xfer_list); | ||
402 | } | ||
403 | } | ||
404 | |||
405 | static inline void _finish_off(struct s3c_pl330_xfer *xfer, | ||
406 | enum s3c2410_dma_buffresult res, int ffree) | ||
407 | { | ||
408 | struct s3c_pl330_chan *ch; | ||
409 | |||
410 | if (!xfer) | ||
411 | return; | ||
412 | |||
413 | ch = xfer->chan; | ||
414 | |||
415 | /* Do callback */ | ||
416 | if (ch->callback_fn) | ||
417 | ch->callback_fn(NULL, xfer->token, xfer->px.bytes, res); | ||
418 | |||
419 | /* Force Free or if buffer is not needed anymore */ | ||
420 | if (ffree || !(ch->options & S3C2410_DMAF_CIRCULAR)) | ||
421 | kmem_cache_free(ch->dmac->kmcache, xfer); | ||
422 | } | ||
423 | |||
424 | static inline int s3c_pl330_submit(struct s3c_pl330_chan *ch, | ||
425 | struct pl330_req *r) | ||
426 | { | ||
427 | struct s3c_pl330_xfer *xfer; | ||
428 | int ret = 0; | ||
429 | |||
430 | /* If already submitted */ | ||
431 | if (r->x) | ||
432 | return 0; | ||
433 | |||
434 | xfer = get_from_queue(ch, 0); | ||
435 | if (xfer) { | ||
436 | r->x = &xfer->px; | ||
437 | |||
438 | /* Use max bandwidth for M<->M xfers */ | ||
439 | if (r->rqtype == MEMTOMEM) { | ||
440 | struct pl330_info *pi = xfer->chan->dmac->pi; | ||
441 | int burst = 1 << ch->rqcfg.brst_size; | ||
442 | u32 bytes = r->x->bytes; | ||
443 | int bl; | ||
444 | |||
445 | bl = pi->pcfg.data_bus_width / 8; | ||
446 | bl *= pi->pcfg.data_buf_dep; | ||
447 | bl /= burst; | ||
448 | |||
449 | /* src/dst_burst_len can't be more than 16 */ | ||
450 | if (bl > 16) | ||
451 | bl = 16; | ||
452 | |||
453 | while (bl > 1) { | ||
454 | if (!(bytes % (bl * burst))) | ||
455 | break; | ||
456 | bl--; | ||
457 | } | ||
458 | |||
459 | ch->rqcfg.brst_len = bl; | ||
460 | } else { | ||
461 | ch->rqcfg.brst_len = 1; | ||
462 | } | ||
463 | |||
464 | ret = pl330_submit_req(ch->pl330_chan_id, r); | ||
465 | |||
466 | /* If submission was successful */ | ||
467 | if (!ret) { | ||
468 | ch->lrq = r; /* latest submitted req */ | ||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | r->x = NULL; | ||
473 | |||
474 | /* If both of the PL330 ping-pong buffers filled */ | ||
475 | if (ret == -EAGAIN) { | ||
476 | dev_err(ch->dmac->pi->dev, "%s:%d!\n", | ||
477 | __func__, __LINE__); | ||
478 | /* Queue back again */ | ||
479 | add_to_queue(ch, xfer, 1); | ||
480 | ret = 0; | ||
481 | } else { | ||
482 | dev_err(ch->dmac->pi->dev, "%s:%d!\n", | ||
483 | __func__, __LINE__); | ||
484 | _finish_off(xfer, S3C2410_RES_ERR, 0); | ||
485 | } | ||
486 | } | ||
487 | |||
488 | return ret; | ||
489 | } | ||
490 | |||
491 | static void s3c_pl330_rq(struct s3c_pl330_chan *ch, | ||
492 | struct pl330_req *r, enum pl330_op_err err) | ||
493 | { | ||
494 | unsigned long flags; | ||
495 | struct s3c_pl330_xfer *xfer; | ||
496 | struct pl330_xfer *xl = r->x; | ||
497 | enum s3c2410_dma_buffresult res; | ||
498 | |||
499 | spin_lock_irqsave(&res_lock, flags); | ||
500 | |||
501 | r->x = NULL; | ||
502 | |||
503 | s3c_pl330_submit(ch, r); | ||
504 | |||
505 | spin_unlock_irqrestore(&res_lock, flags); | ||
506 | |||
507 | /* Map result to S3C DMA API */ | ||
508 | if (err == PL330_ERR_NONE) | ||
509 | res = S3C2410_RES_OK; | ||
510 | else if (err == PL330_ERR_ABORT) | ||
511 | res = S3C2410_RES_ABORT; | ||
512 | else | ||
513 | res = S3C2410_RES_ERR; | ||
514 | |||
515 | /* If last request had some xfer */ | ||
516 | if (xl) { | ||
517 | xfer = container_of(xl, struct s3c_pl330_xfer, px); | ||
518 | _finish_off(xfer, res, 0); | ||
519 | } else { | ||
520 | dev_info(ch->dmac->pi->dev, "%s:%d No Xfer?!\n", | ||
521 | __func__, __LINE__); | ||
522 | } | ||
523 | } | ||
524 | |||
525 | static void s3c_pl330_rq0(void *token, enum pl330_op_err err) | ||
526 | { | ||
527 | struct pl330_req *r = token; | ||
528 | struct s3c_pl330_chan *ch = container_of(r, | ||
529 | struct s3c_pl330_chan, req[0]); | ||
530 | s3c_pl330_rq(ch, r, err); | ||
531 | } | ||
532 | |||
533 | static void s3c_pl330_rq1(void *token, enum pl330_op_err err) | ||
534 | { | ||
535 | struct pl330_req *r = token; | ||
536 | struct s3c_pl330_chan *ch = container_of(r, | ||
537 | struct s3c_pl330_chan, req[1]); | ||
538 | s3c_pl330_rq(ch, r, err); | ||
539 | } | ||
540 | |||
541 | /* Release an acquired channel */ | ||
542 | static void chan_release(struct s3c_pl330_chan *ch) | ||
543 | { | ||
544 | struct s3c_pl330_dmac *dmac; | ||
545 | |||
546 | if (chan_free(ch)) | ||
547 | return; | ||
548 | |||
549 | dmac = ch->dmac; | ||
550 | ch->dmac = NULL; | ||
551 | dmac->busy_chan--; | ||
552 | } | ||
553 | |||
554 | int s3c2410_dma_ctrl(enum dma_ch id, enum s3c2410_chan_op op) | ||
555 | { | ||
556 | struct s3c_pl330_xfer *xfer; | ||
557 | enum pl330_chan_op pl330op; | ||
558 | struct s3c_pl330_chan *ch; | ||
559 | unsigned long flags; | ||
560 | int idx, ret; | ||
561 | |||
562 | spin_lock_irqsave(&res_lock, flags); | ||
563 | |||
564 | ch = id_to_chan(id); | ||
565 | |||
566 | if (!ch || chan_free(ch)) { | ||
567 | ret = -EINVAL; | ||
568 | goto ctrl_exit; | ||
569 | } | ||
570 | |||
571 | switch (op) { | ||
572 | case S3C2410_DMAOP_START: | ||
573 | /* Make sure both reqs are enqueued */ | ||
574 | idx = (ch->lrq == &ch->req[0]) ? 1 : 0; | ||
575 | s3c_pl330_submit(ch, &ch->req[idx]); | ||
576 | s3c_pl330_submit(ch, &ch->req[1 - idx]); | ||
577 | pl330op = PL330_OP_START; | ||
578 | break; | ||
579 | |||
580 | case S3C2410_DMAOP_STOP: | ||
581 | pl330op = PL330_OP_ABORT; | ||
582 | break; | ||
583 | |||
584 | case S3C2410_DMAOP_FLUSH: | ||
585 | pl330op = PL330_OP_FLUSH; | ||
586 | break; | ||
587 | |||
588 | case S3C2410_DMAOP_PAUSE: | ||
589 | case S3C2410_DMAOP_RESUME: | ||
590 | case S3C2410_DMAOP_TIMEOUT: | ||
591 | case S3C2410_DMAOP_STARTED: | ||
592 | spin_unlock_irqrestore(&res_lock, flags); | ||
593 | return 0; | ||
594 | |||
595 | default: | ||
596 | spin_unlock_irqrestore(&res_lock, flags); | ||
597 | return -EINVAL; | ||
598 | } | ||
599 | |||
600 | ret = pl330_chan_ctrl(ch->pl330_chan_id, pl330op); | ||
601 | |||
602 | if (pl330op == PL330_OP_START) { | ||
603 | spin_unlock_irqrestore(&res_lock, flags); | ||
604 | return ret; | ||
605 | } | ||
606 | |||
607 | idx = (ch->lrq == &ch->req[0]) ? 1 : 0; | ||
608 | |||
609 | /* Abort the current xfer */ | ||
610 | if (ch->req[idx].x) { | ||
611 | xfer = container_of(ch->req[idx].x, | ||
612 | struct s3c_pl330_xfer, px); | ||
613 | |||
614 | /* Drop xfer during FLUSH */ | ||
615 | if (pl330op == PL330_OP_FLUSH) | ||
616 | del_from_queue(xfer); | ||
617 | |||
618 | ch->req[idx].x = NULL; | ||
619 | |||
620 | spin_unlock_irqrestore(&res_lock, flags); | ||
621 | _finish_off(xfer, S3C2410_RES_ABORT, | ||
622 | pl330op == PL330_OP_FLUSH ? 1 : 0); | ||
623 | spin_lock_irqsave(&res_lock, flags); | ||
624 | } | ||
625 | |||
626 | /* Flush the whole queue */ | ||
627 | if (pl330op == PL330_OP_FLUSH) { | ||
628 | |||
629 | if (ch->req[1 - idx].x) { | ||
630 | xfer = container_of(ch->req[1 - idx].x, | ||
631 | struct s3c_pl330_xfer, px); | ||
632 | |||
633 | del_from_queue(xfer); | ||
634 | |||
635 | ch->req[1 - idx].x = NULL; | ||
636 | |||
637 | spin_unlock_irqrestore(&res_lock, flags); | ||
638 | _finish_off(xfer, S3C2410_RES_ABORT, 1); | ||
639 | spin_lock_irqsave(&res_lock, flags); | ||
640 | } | ||
641 | |||
642 | /* Finish off the remaining in the queue */ | ||
643 | xfer = ch->xfer_head; | ||
644 | while (xfer) { | ||
645 | |||
646 | del_from_queue(xfer); | ||
647 | |||
648 | spin_unlock_irqrestore(&res_lock, flags); | ||
649 | _finish_off(xfer, S3C2410_RES_ABORT, 1); | ||
650 | spin_lock_irqsave(&res_lock, flags); | ||
651 | |||
652 | xfer = ch->xfer_head; | ||
653 | } | ||
654 | } | ||
655 | |||
656 | ctrl_exit: | ||
657 | spin_unlock_irqrestore(&res_lock, flags); | ||
658 | |||
659 | return ret; | ||
660 | } | ||
661 | EXPORT_SYMBOL(s3c2410_dma_ctrl); | ||
662 | |||
663 | int s3c2410_dma_enqueue(enum dma_ch id, void *token, | ||
664 | dma_addr_t addr, int size) | ||
665 | { | ||
666 | struct s3c_pl330_chan *ch; | ||
667 | struct s3c_pl330_xfer *xfer; | ||
668 | unsigned long flags; | ||
669 | int idx, ret = 0; | ||
670 | |||
671 | spin_lock_irqsave(&res_lock, flags); | ||
672 | |||
673 | ch = id_to_chan(id); | ||
674 | |||
675 | /* Error if invalid or free channel */ | ||
676 | if (!ch || chan_free(ch)) { | ||
677 | ret = -EINVAL; | ||
678 | goto enq_exit; | ||
679 | } | ||
680 | |||
681 | /* Error if size is unaligned */ | ||
682 | if (ch->rqcfg.brst_size && size % (1 << ch->rqcfg.brst_size)) { | ||
683 | ret = -EINVAL; | ||
684 | goto enq_exit; | ||
685 | } | ||
686 | |||
687 | xfer = kmem_cache_alloc(ch->dmac->kmcache, GFP_ATOMIC); | ||
688 | if (!xfer) { | ||
689 | ret = -ENOMEM; | ||
690 | goto enq_exit; | ||
691 | } | ||
692 | |||
693 | xfer->token = token; | ||
694 | xfer->chan = ch; | ||
695 | xfer->px.bytes = size; | ||
696 | xfer->px.next = NULL; /* Single request */ | ||
697 | |||
698 | /* For S3C DMA API, direction is always fixed for all xfers */ | ||
699 | if (ch->req[0].rqtype == MEMTODEV) { | ||
700 | xfer->px.src_addr = addr; | ||
701 | xfer->px.dst_addr = ch->sdaddr; | ||
702 | } else { | ||
703 | xfer->px.src_addr = ch->sdaddr; | ||
704 | xfer->px.dst_addr = addr; | ||
705 | } | ||
706 | |||
707 | add_to_queue(ch, xfer, 0); | ||
708 | |||
709 | /* Try submitting on either request */ | ||
710 | idx = (ch->lrq == &ch->req[0]) ? 1 : 0; | ||
711 | |||
712 | if (!ch->req[idx].x) | ||
713 | s3c_pl330_submit(ch, &ch->req[idx]); | ||
714 | else | ||
715 | s3c_pl330_submit(ch, &ch->req[1 - idx]); | ||
716 | |||
717 | spin_unlock_irqrestore(&res_lock, flags); | ||
718 | |||
719 | if (ch->options & S3C2410_DMAF_AUTOSTART) | ||
720 | s3c2410_dma_ctrl(id, S3C2410_DMAOP_START); | ||
721 | |||
722 | return 0; | ||
723 | |||
724 | enq_exit: | ||
725 | spin_unlock_irqrestore(&res_lock, flags); | ||
726 | |||
727 | return ret; | ||
728 | } | ||
729 | EXPORT_SYMBOL(s3c2410_dma_enqueue); | ||
730 | |||
731 | int s3c2410_dma_request(enum dma_ch id, | ||
732 | struct s3c2410_dma_client *client, | ||
733 | void *dev) | ||
734 | { | ||
735 | struct s3c_pl330_dmac *dmac; | ||
736 | struct s3c_pl330_chan *ch; | ||
737 | unsigned long flags; | ||
738 | int ret = 0; | ||
739 | |||
740 | spin_lock_irqsave(&res_lock, flags); | ||
741 | |||
742 | ch = chan_acquire(id); | ||
743 | if (!ch) { | ||
744 | ret = -EBUSY; | ||
745 | goto req_exit; | ||
746 | } | ||
747 | |||
748 | dmac = ch->dmac; | ||
749 | |||
750 | ch->pl330_chan_id = pl330_request_channel(dmac->pi); | ||
751 | if (!ch->pl330_chan_id) { | ||
752 | chan_release(ch); | ||
753 | ret = -EBUSY; | ||
754 | goto req_exit; | ||
755 | } | ||
756 | |||
757 | ch->client = client; | ||
758 | ch->options = 0; /* Clear any option */ | ||
759 | ch->callback_fn = NULL; /* Clear any callback */ | ||
760 | ch->lrq = NULL; | ||
761 | |||
762 | ch->rqcfg.brst_size = 2; /* Default word size */ | ||
763 | ch->rqcfg.swap = SWAP_NO; | ||
764 | ch->rqcfg.scctl = SCCTRL0; /* Noncacheable and nonbufferable */ | ||
765 | ch->rqcfg.dcctl = DCCTRL0; /* Noncacheable and nonbufferable */ | ||
766 | ch->rqcfg.privileged = 0; | ||
767 | ch->rqcfg.insnaccess = 0; | ||
768 | |||
769 | /* Set invalid direction */ | ||
770 | ch->req[0].rqtype = DEVTODEV; | ||
771 | ch->req[1].rqtype = ch->req[0].rqtype; | ||
772 | |||
773 | ch->req[0].cfg = &ch->rqcfg; | ||
774 | ch->req[1].cfg = ch->req[0].cfg; | ||
775 | |||
776 | ch->req[0].peri = iface_of_dmac(dmac, id) - 1; /* Original index */ | ||
777 | ch->req[1].peri = ch->req[0].peri; | ||
778 | |||
779 | ch->req[0].token = &ch->req[0]; | ||
780 | ch->req[0].xfer_cb = s3c_pl330_rq0; | ||
781 | ch->req[1].token = &ch->req[1]; | ||
782 | ch->req[1].xfer_cb = s3c_pl330_rq1; | ||
783 | |||
784 | ch->req[0].x = NULL; | ||
785 | ch->req[1].x = NULL; | ||
786 | |||
787 | /* Reset xfer list */ | ||
788 | INIT_LIST_HEAD(&ch->xfer_list); | ||
789 | ch->xfer_head = NULL; | ||
790 | |||
791 | req_exit: | ||
792 | spin_unlock_irqrestore(&res_lock, flags); | ||
793 | |||
794 | return ret; | ||
795 | } | ||
796 | EXPORT_SYMBOL(s3c2410_dma_request); | ||
797 | |||
798 | int s3c2410_dma_free(enum dma_ch id, struct s3c2410_dma_client *client) | ||
799 | { | ||
800 | struct s3c_pl330_chan *ch; | ||
801 | struct s3c_pl330_xfer *xfer; | ||
802 | unsigned long flags; | ||
803 | int ret = 0; | ||
804 | unsigned idx; | ||
805 | |||
806 | spin_lock_irqsave(&res_lock, flags); | ||
807 | |||
808 | ch = id_to_chan(id); | ||
809 | |||
810 | if (!ch || chan_free(ch)) | ||
811 | goto free_exit; | ||
812 | |||
813 | /* Refuse if someone else wanted to free the channel */ | ||
814 | if (ch->client != client) { | ||
815 | ret = -EBUSY; | ||
816 | goto free_exit; | ||
817 | } | ||
818 | |||
819 | /* Stop any active xfer, Flushe the queue and do callbacks */ | ||
820 | pl330_chan_ctrl(ch->pl330_chan_id, PL330_OP_FLUSH); | ||
821 | |||
822 | /* Abort the submitted requests */ | ||
823 | idx = (ch->lrq == &ch->req[0]) ? 1 : 0; | ||
824 | |||
825 | if (ch->req[idx].x) { | ||
826 | xfer = container_of(ch->req[idx].x, | ||
827 | struct s3c_pl330_xfer, px); | ||
828 | |||
829 | ch->req[idx].x = NULL; | ||
830 | del_from_queue(xfer); | ||
831 | |||
832 | spin_unlock_irqrestore(&res_lock, flags); | ||
833 | _finish_off(xfer, S3C2410_RES_ABORT, 1); | ||
834 | spin_lock_irqsave(&res_lock, flags); | ||
835 | } | ||
836 | |||
837 | if (ch->req[1 - idx].x) { | ||
838 | xfer = container_of(ch->req[1 - idx].x, | ||
839 | struct s3c_pl330_xfer, px); | ||
840 | |||
841 | ch->req[1 - idx].x = NULL; | ||
842 | del_from_queue(xfer); | ||
843 | |||
844 | spin_unlock_irqrestore(&res_lock, flags); | ||
845 | _finish_off(xfer, S3C2410_RES_ABORT, 1); | ||
846 | spin_lock_irqsave(&res_lock, flags); | ||
847 | } | ||
848 | |||
849 | /* Pluck and Abort the queued requests in order */ | ||
850 | do { | ||
851 | xfer = get_from_queue(ch, 1); | ||
852 | |||
853 | spin_unlock_irqrestore(&res_lock, flags); | ||
854 | _finish_off(xfer, S3C2410_RES_ABORT, 1); | ||
855 | spin_lock_irqsave(&res_lock, flags); | ||
856 | } while (xfer); | ||
857 | |||
858 | ch->client = NULL; | ||
859 | |||
860 | pl330_release_channel(ch->pl330_chan_id); | ||
861 | |||
862 | ch->pl330_chan_id = NULL; | ||
863 | |||
864 | chan_release(ch); | ||
865 | |||
866 | free_exit: | ||
867 | spin_unlock_irqrestore(&res_lock, flags); | ||
868 | |||
869 | return ret; | ||
870 | } | ||
871 | EXPORT_SYMBOL(s3c2410_dma_free); | ||
872 | |||
873 | int s3c2410_dma_config(enum dma_ch id, int xferunit) | ||
874 | { | ||
875 | struct s3c_pl330_chan *ch; | ||
876 | struct pl330_info *pi; | ||
877 | unsigned long flags; | ||
878 | int i, dbwidth, ret = 0; | ||
879 | |||
880 | spin_lock_irqsave(&res_lock, flags); | ||
881 | |||
882 | ch = id_to_chan(id); | ||
883 | |||
884 | if (!ch || chan_free(ch)) { | ||
885 | ret = -EINVAL; | ||
886 | goto cfg_exit; | ||
887 | } | ||
888 | |||
889 | pi = ch->dmac->pi; | ||
890 | dbwidth = pi->pcfg.data_bus_width / 8; | ||
891 | |||
892 | /* Max size of xfer can be pcfg.data_bus_width */ | ||
893 | if (xferunit > dbwidth) { | ||
894 | ret = -EINVAL; | ||
895 | goto cfg_exit; | ||
896 | } | ||
897 | |||
898 | i = 0; | ||
899 | while (xferunit != (1 << i)) | ||
900 | i++; | ||
901 | |||
902 | /* If valid value */ | ||
903 | if (xferunit == (1 << i)) | ||
904 | ch->rqcfg.brst_size = i; | ||
905 | else | ||
906 | ret = -EINVAL; | ||
907 | |||
908 | cfg_exit: | ||
909 | spin_unlock_irqrestore(&res_lock, flags); | ||
910 | |||
911 | return ret; | ||
912 | } | ||
913 | EXPORT_SYMBOL(s3c2410_dma_config); | ||
914 | |||
915 | /* Options that are supported by this driver */ | ||
916 | #define S3C_PL330_FLAGS (S3C2410_DMAF_CIRCULAR | S3C2410_DMAF_AUTOSTART) | ||
917 | |||
918 | int s3c2410_dma_setflags(enum dma_ch id, unsigned int options) | ||
919 | { | ||
920 | struct s3c_pl330_chan *ch; | ||
921 | unsigned long flags; | ||
922 | int ret = 0; | ||
923 | |||
924 | spin_lock_irqsave(&res_lock, flags); | ||
925 | |||
926 | ch = id_to_chan(id); | ||
927 | |||
928 | if (!ch || chan_free(ch) || options & ~(S3C_PL330_FLAGS)) | ||
929 | ret = -EINVAL; | ||
930 | else | ||
931 | ch->options = options; | ||
932 | |||
933 | spin_unlock_irqrestore(&res_lock, flags); | ||
934 | |||
935 | return 0; | ||
936 | } | ||
937 | EXPORT_SYMBOL(s3c2410_dma_setflags); | ||
938 | |||
939 | int s3c2410_dma_set_buffdone_fn(enum dma_ch id, s3c2410_dma_cbfn_t rtn) | ||
940 | { | ||
941 | struct s3c_pl330_chan *ch; | ||
942 | unsigned long flags; | ||
943 | int ret = 0; | ||
944 | |||
945 | spin_lock_irqsave(&res_lock, flags); | ||
946 | |||
947 | ch = id_to_chan(id); | ||
948 | |||
949 | if (!ch || chan_free(ch)) | ||
950 | ret = -EINVAL; | ||
951 | else | ||
952 | ch->callback_fn = rtn; | ||
953 | |||
954 | spin_unlock_irqrestore(&res_lock, flags); | ||
955 | |||
956 | return ret; | ||
957 | } | ||
958 | EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn); | ||
959 | |||
960 | int s3c2410_dma_devconfig(enum dma_ch id, enum s3c2410_dmasrc source, | ||
961 | unsigned long address) | ||
962 | { | ||
963 | struct s3c_pl330_chan *ch; | ||
964 | unsigned long flags; | ||
965 | int ret = 0; | ||
966 | |||
967 | spin_lock_irqsave(&res_lock, flags); | ||
968 | |||
969 | ch = id_to_chan(id); | ||
970 | |||
971 | if (!ch || chan_free(ch)) { | ||
972 | ret = -EINVAL; | ||
973 | goto devcfg_exit; | ||
974 | } | ||
975 | |||
976 | switch (source) { | ||
977 | case S3C2410_DMASRC_HW: /* P->M */ | ||
978 | ch->req[0].rqtype = DEVTOMEM; | ||
979 | ch->req[1].rqtype = DEVTOMEM; | ||
980 | ch->rqcfg.src_inc = 0; | ||
981 | ch->rqcfg.dst_inc = 1; | ||
982 | break; | ||
983 | case S3C2410_DMASRC_MEM: /* M->P */ | ||
984 | ch->req[0].rqtype = MEMTODEV; | ||
985 | ch->req[1].rqtype = MEMTODEV; | ||
986 | ch->rqcfg.src_inc = 1; | ||
987 | ch->rqcfg.dst_inc = 0; | ||
988 | break; | ||
989 | default: | ||
990 | ret = -EINVAL; | ||
991 | goto devcfg_exit; | ||
992 | } | ||
993 | |||
994 | ch->sdaddr = address; | ||
995 | |||
996 | devcfg_exit: | ||
997 | spin_unlock_irqrestore(&res_lock, flags); | ||
998 | |||
999 | return ret; | ||
1000 | } | ||
1001 | EXPORT_SYMBOL(s3c2410_dma_devconfig); | ||
1002 | |||
1003 | int s3c2410_dma_getposition(enum dma_ch id, dma_addr_t *src, dma_addr_t *dst) | ||
1004 | { | ||
1005 | struct s3c_pl330_chan *ch = id_to_chan(id); | ||
1006 | struct pl330_chanstatus status; | ||
1007 | int ret; | ||
1008 | |||
1009 | if (!ch || chan_free(ch)) | ||
1010 | return -EINVAL; | ||
1011 | |||
1012 | ret = pl330_chan_status(ch->pl330_chan_id, &status); | ||
1013 | if (ret < 0) | ||
1014 | return ret; | ||
1015 | |||
1016 | *src = status.src_addr; | ||
1017 | *dst = status.dst_addr; | ||
1018 | |||
1019 | return 0; | ||
1020 | } | ||
1021 | EXPORT_SYMBOL(s3c2410_dma_getposition); | ||
1022 | |||
1023 | static irqreturn_t pl330_irq_handler(int irq, void *data) | ||
1024 | { | ||
1025 | if (pl330_update(data)) | ||
1026 | return IRQ_HANDLED; | ||
1027 | else | ||
1028 | return IRQ_NONE; | ||
1029 | } | ||
1030 | |||
1031 | static int pl330_probe(struct platform_device *pdev) | ||
1032 | { | ||
1033 | struct s3c_pl330_dmac *s3c_pl330_dmac; | ||
1034 | struct s3c_pl330_platdata *pl330pd; | ||
1035 | struct pl330_info *pl330_info; | ||
1036 | struct resource *res; | ||
1037 | int i, ret, irq; | ||
1038 | |||
1039 | pl330pd = pdev->dev.platform_data; | ||
1040 | |||
1041 | /* Can't do without the list of _32_ peripherals */ | ||
1042 | if (!pl330pd || !pl330pd->peri) { | ||
1043 | dev_err(&pdev->dev, "platform data missing!\n"); | ||
1044 | return -ENODEV; | ||
1045 | } | ||
1046 | |||
1047 | pl330_info = kzalloc(sizeof(*pl330_info), GFP_KERNEL); | ||
1048 | if (!pl330_info) | ||
1049 | return -ENOMEM; | ||
1050 | |||
1051 | pl330_info->pl330_data = NULL; | ||
1052 | pl330_info->dev = &pdev->dev; | ||
1053 | |||
1054 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1055 | if (!res) { | ||
1056 | ret = -ENODEV; | ||
1057 | goto probe_err1; | ||
1058 | } | ||
1059 | |||
1060 | request_mem_region(res->start, resource_size(res), pdev->name); | ||
1061 | |||
1062 | pl330_info->base = ioremap(res->start, resource_size(res)); | ||
1063 | if (!pl330_info->base) { | ||
1064 | ret = -ENXIO; | ||
1065 | goto probe_err2; | ||
1066 | } | ||
1067 | |||
1068 | irq = platform_get_irq(pdev, 0); | ||
1069 | if (irq < 0) { | ||
1070 | ret = irq; | ||
1071 | goto probe_err3; | ||
1072 | } | ||
1073 | |||
1074 | ret = request_irq(irq, pl330_irq_handler, 0, | ||
1075 | dev_name(&pdev->dev), pl330_info); | ||
1076 | if (ret) | ||
1077 | goto probe_err4; | ||
1078 | |||
1079 | /* Allocate a new DMAC */ | ||
1080 | s3c_pl330_dmac = kmalloc(sizeof(*s3c_pl330_dmac), GFP_KERNEL); | ||
1081 | if (!s3c_pl330_dmac) { | ||
1082 | ret = -ENOMEM; | ||
1083 | goto probe_err5; | ||
1084 | } | ||
1085 | |||
1086 | /* Get operation clock and enable it */ | ||
1087 | s3c_pl330_dmac->clk = clk_get(&pdev->dev, "pdma"); | ||
1088 | if (IS_ERR(s3c_pl330_dmac->clk)) { | ||
1089 | dev_err(&pdev->dev, "Cannot get operation clock.\n"); | ||
1090 | ret = -EINVAL; | ||
1091 | goto probe_err6; | ||
1092 | } | ||
1093 | clk_enable(s3c_pl330_dmac->clk); | ||
1094 | |||
1095 | ret = pl330_add(pl330_info); | ||
1096 | if (ret) | ||
1097 | goto probe_err7; | ||
1098 | |||
1099 | /* Hook the info */ | ||
1100 | s3c_pl330_dmac->pi = pl330_info; | ||
1101 | |||
1102 | /* No busy channels */ | ||
1103 | s3c_pl330_dmac->busy_chan = 0; | ||
1104 | |||
1105 | s3c_pl330_dmac->kmcache = kmem_cache_create(dev_name(&pdev->dev), | ||
1106 | sizeof(struct s3c_pl330_xfer), 0, 0, NULL); | ||
1107 | |||
1108 | if (!s3c_pl330_dmac->kmcache) { | ||
1109 | ret = -ENOMEM; | ||
1110 | goto probe_err8; | ||
1111 | } | ||
1112 | |||
1113 | /* Get the list of peripherals */ | ||
1114 | s3c_pl330_dmac->peri = pl330pd->peri; | ||
1115 | |||
1116 | /* Attach to the list of DMACs */ | ||
1117 | list_add_tail(&s3c_pl330_dmac->node, &dmac_list); | ||
1118 | |||
1119 | /* Create a channel for each peripheral in the DMAC | ||
1120 | * that is, if it doesn't already exist | ||
1121 | */ | ||
1122 | for (i = 0; i < PL330_MAX_PERI; i++) | ||
1123 | if (s3c_pl330_dmac->peri[i] != DMACH_MAX) | ||
1124 | chan_add(s3c_pl330_dmac->peri[i]); | ||
1125 | |||
1126 | printk(KERN_INFO | ||
1127 | "Loaded driver for PL330 DMAC-%d %s\n", pdev->id, pdev->name); | ||
1128 | printk(KERN_INFO | ||
1129 | "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n", | ||
1130 | pl330_info->pcfg.data_buf_dep, | ||
1131 | pl330_info->pcfg.data_bus_width / 8, pl330_info->pcfg.num_chan, | ||
1132 | pl330_info->pcfg.num_peri, pl330_info->pcfg.num_events); | ||
1133 | |||
1134 | return 0; | ||
1135 | |||
1136 | probe_err8: | ||
1137 | pl330_del(pl330_info); | ||
1138 | probe_err7: | ||
1139 | clk_disable(s3c_pl330_dmac->clk); | ||
1140 | clk_put(s3c_pl330_dmac->clk); | ||
1141 | probe_err6: | ||
1142 | kfree(s3c_pl330_dmac); | ||
1143 | probe_err5: | ||
1144 | free_irq(irq, pl330_info); | ||
1145 | probe_err4: | ||
1146 | probe_err3: | ||
1147 | iounmap(pl330_info->base); | ||
1148 | probe_err2: | ||
1149 | release_mem_region(res->start, resource_size(res)); | ||
1150 | probe_err1: | ||
1151 | kfree(pl330_info); | ||
1152 | |||
1153 | return ret; | ||
1154 | } | ||
1155 | |||
1156 | static int pl330_remove(struct platform_device *pdev) | ||
1157 | { | ||
1158 | struct s3c_pl330_dmac *dmac, *d; | ||
1159 | struct s3c_pl330_chan *ch; | ||
1160 | unsigned long flags; | ||
1161 | int del, found; | ||
1162 | |||
1163 | if (!pdev->dev.platform_data) | ||
1164 | return -EINVAL; | ||
1165 | |||
1166 | spin_lock_irqsave(&res_lock, flags); | ||
1167 | |||
1168 | found = 0; | ||
1169 | list_for_each_entry(d, &dmac_list, node) | ||
1170 | if (d->pi->dev == &pdev->dev) { | ||
1171 | found = 1; | ||
1172 | break; | ||
1173 | } | ||
1174 | |||
1175 | if (!found) { | ||
1176 | spin_unlock_irqrestore(&res_lock, flags); | ||
1177 | return 0; | ||
1178 | } | ||
1179 | |||
1180 | dmac = d; | ||
1181 | |||
1182 | /* Remove all Channels that are managed only by this DMAC */ | ||
1183 | list_for_each_entry(ch, &chan_list, node) { | ||
1184 | |||
1185 | /* Only channels that are handled by this DMAC */ | ||
1186 | if (iface_of_dmac(dmac, ch->id)) | ||
1187 | del = 1; | ||
1188 | else | ||
1189 | continue; | ||
1190 | |||
1191 | /* Don't remove if some other DMAC has it too */ | ||
1192 | list_for_each_entry(d, &dmac_list, node) | ||
1193 | if (d != dmac && iface_of_dmac(d, ch->id)) { | ||
1194 | del = 0; | ||
1195 | break; | ||
1196 | } | ||
1197 | |||
1198 | if (del) { | ||
1199 | spin_unlock_irqrestore(&res_lock, flags); | ||
1200 | s3c2410_dma_free(ch->id, ch->client); | ||
1201 | spin_lock_irqsave(&res_lock, flags); | ||
1202 | list_del(&ch->node); | ||
1203 | kfree(ch); | ||
1204 | } | ||
1205 | } | ||
1206 | |||
1207 | /* Disable operation clock */ | ||
1208 | clk_disable(dmac->clk); | ||
1209 | clk_put(dmac->clk); | ||
1210 | |||
1211 | /* Remove the DMAC */ | ||
1212 | list_del(&dmac->node); | ||
1213 | kfree(dmac); | ||
1214 | |||
1215 | spin_unlock_irqrestore(&res_lock, flags); | ||
1216 | |||
1217 | return 0; | ||
1218 | } | ||
1219 | |||
1220 | static struct platform_driver pl330_driver = { | ||
1221 | .driver = { | ||
1222 | .owner = THIS_MODULE, | ||
1223 | .name = "s3c-pl330", | ||
1224 | }, | ||
1225 | .probe = pl330_probe, | ||
1226 | .remove = pl330_remove, | ||
1227 | }; | ||
1228 | |||
1229 | static int __init pl330_init(void) | ||
1230 | { | ||
1231 | return platform_driver_register(&pl330_driver); | ||
1232 | } | ||
1233 | module_init(pl330_init); | ||
1234 | |||
1235 | static void __exit pl330_exit(void) | ||
1236 | { | ||
1237 | platform_driver_unregister(&pl330_driver); | ||
1238 | return; | ||
1239 | } | ||
1240 | module_exit(pl330_exit); | ||
1241 | |||
1242 | MODULE_AUTHOR("Jaswinder Singh <jassi.brar@samsung.com>"); | ||
1243 | MODULE_DESCRIPTION("Driver for PL330 DMA Controller"); | ||
1244 | MODULE_LICENSE("GPL"); | ||