diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-12-18 11:17:37 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2008-12-18 11:17:37 -0500 |
commit | 56c035c9ce1f1850969778af6a4cc0b99089b6c8 (patch) | |
tree | b6f1998be0c1e6bb623a0c55e8ba04d74bb58cf2 /arch/arm/plat-s3c24xx | |
parent | 7f2754378f3522a42daafdbb9d2385f341008454 (diff) | |
parent | 438a5d42e052ec6126c5f1e24763b711210db33e (diff) |
Merge branch 'next-s3c64xx-device' into next-merged
Conflicts:
arch/arm/mach-s3c2440/mach-at2440evb.c
Diffstat (limited to 'arch/arm/plat-s3c24xx')
-rw-r--r-- | arch/arm/plat-s3c24xx/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/devs.c | 55 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/gpiolib.c | 125 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/include/plat/map.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/s3c244x.c | 2 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/setup-i2c.c | 25 |
6 files changed, 35 insertions, 176 deletions
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile index a8cfdefc29e9..1e0767b266b8 100644 --- a/arch/arm/plat-s3c24xx/Makefile +++ b/arch/arm/plat-s3c24xx/Makefile | |||
@@ -33,6 +33,9 @@ obj-$(CONFIG_S3C2410_CLOCK) += s3c2410-clock.o | |||
33 | obj-$(CONFIG_S3C2410_DMA) += dma.o | 33 | obj-$(CONFIG_S3C2410_DMA) += dma.o |
34 | obj-$(CONFIG_S3C24XX_ADC) += adc.o | 34 | obj-$(CONFIG_S3C24XX_ADC) += adc.o |
35 | 35 | ||
36 | # device specific setup and/or initialisation | ||
37 | obj-$(CONFIG_ARCH_S3C2410) += setup-i2c.o | ||
38 | |||
36 | # SPI gpio central GPIO functions | 39 | # SPI gpio central GPIO functions |
37 | 40 | ||
38 | obj-$(CONFIG_S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13) += spi-bus0-gpe11_12_13.o | 41 | obj-$(CONFIG_S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13) += spi-bus0-gpe11_12_13.o |
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c index 9826efb91e48..14d4f0bc1253 100644 --- a/arch/arm/plat-s3c24xx/devs.c +++ b/arch/arm/plat-s3c24xx/devs.c | |||
@@ -271,31 +271,6 @@ struct platform_device s3c_device_wdt = { | |||
271 | 271 | ||
272 | EXPORT_SYMBOL(s3c_device_wdt); | 272 | EXPORT_SYMBOL(s3c_device_wdt); |
273 | 273 | ||
274 | /* I2C */ | ||
275 | |||
276 | static struct resource s3c_i2c_resource[] = { | ||
277 | [0] = { | ||
278 | .start = S3C24XX_PA_IIC, | ||
279 | .end = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1, | ||
280 | .flags = IORESOURCE_MEM, | ||
281 | }, | ||
282 | [1] = { | ||
283 | .start = IRQ_IIC, | ||
284 | .end = IRQ_IIC, | ||
285 | .flags = IORESOURCE_IRQ, | ||
286 | } | ||
287 | |||
288 | }; | ||
289 | |||
290 | struct platform_device s3c_device_i2c = { | ||
291 | .name = "s3c2410-i2c", | ||
292 | .id = -1, | ||
293 | .num_resources = ARRAY_SIZE(s3c_i2c_resource), | ||
294 | .resource = s3c_i2c_resource, | ||
295 | }; | ||
296 | |||
297 | EXPORT_SYMBOL(s3c_device_i2c); | ||
298 | |||
299 | /* IIS */ | 274 | /* IIS */ |
300 | 275 | ||
301 | static struct resource s3c_iis_resource[] = { | 276 | static struct resource s3c_iis_resource[] = { |
@@ -411,36 +386,6 @@ struct platform_device s3c_device_sdi = { | |||
411 | 386 | ||
412 | EXPORT_SYMBOL(s3c_device_sdi); | 387 | EXPORT_SYMBOL(s3c_device_sdi); |
413 | 388 | ||
414 | /* High-speed MMC/SD */ | ||
415 | |||
416 | static struct resource s3c_hsmmc_resource[] = { | ||
417 | [0] = { | ||
418 | .start = S3C2443_PA_HSMMC, | ||
419 | .end = S3C2443_PA_HSMMC + S3C2443_SZ_HSMMC - 1, | ||
420 | .flags = IORESOURCE_MEM, | ||
421 | }, | ||
422 | [1] = { | ||
423 | .start = IRQ_S3C2443_HSMMC, | ||
424 | .end = IRQ_S3C2443_HSMMC, | ||
425 | .flags = IORESOURCE_IRQ, | ||
426 | } | ||
427 | }; | ||
428 | |||
429 | static u64 s3c_device_hsmmc_dmamask = 0xffffffffUL; | ||
430 | |||
431 | struct platform_device s3c_device_hsmmc = { | ||
432 | .name = "s3c-sdhci", | ||
433 | .id = -1, | ||
434 | .num_resources = ARRAY_SIZE(s3c_hsmmc_resource), | ||
435 | .resource = s3c_hsmmc_resource, | ||
436 | .dev = { | ||
437 | .dma_mask = &s3c_device_hsmmc_dmamask, | ||
438 | .coherent_dma_mask = 0xffffffffUL | ||
439 | } | ||
440 | }; | ||
441 | |||
442 | |||
443 | |||
444 | /* SPI (0) */ | 389 | /* SPI (0) */ |
445 | 390 | ||
446 | static struct resource s3c_spi0_resource[] = { | 391 | static struct resource s3c_spi0_resource[] = { |
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c index b07c2d0dd533..f95c6c9d9f1a 100644 --- a/arch/arm/plat-s3c24xx/gpiolib.c +++ b/arch/arm/plat-s3c24xx/gpiolib.c | |||
@@ -19,104 +19,12 @@ | |||
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | 21 | ||
22 | #include <plat/gpio-core.h> | ||
22 | #include <mach/hardware.h> | 23 | #include <mach/hardware.h> |
23 | #include <asm/irq.h> | 24 | #include <asm/irq.h> |
24 | 25 | ||
25 | #include <mach/regs-gpio.h> | 26 | #include <mach/regs-gpio.h> |
26 | 27 | ||
27 | struct s3c24xx_gpio_chip { | ||
28 | struct gpio_chip chip; | ||
29 | void __iomem *base; | ||
30 | }; | ||
31 | |||
32 | static inline struct s3c24xx_gpio_chip *to_s3c_chip(struct gpio_chip *gpc) | ||
33 | { | ||
34 | return container_of(gpc, struct s3c24xx_gpio_chip, chip); | ||
35 | } | ||
36 | |||
37 | /* these routines are exported for use by other parts of the platform | ||
38 | * and system support, but are not intended to be used directly by the | ||
39 | * drivers themsevles. | ||
40 | */ | ||
41 | |||
42 | static int s3c24xx_gpiolib_input(struct gpio_chip *chip, unsigned offset) | ||
43 | { | ||
44 | struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip); | ||
45 | void __iomem *base = ourchip->base; | ||
46 | unsigned long flags; | ||
47 | unsigned long con; | ||
48 | |||
49 | local_irq_save(flags); | ||
50 | |||
51 | con = __raw_readl(base + 0x00); | ||
52 | con &= ~(3 << (offset * 2)); | ||
53 | con |= (S3C2410_GPIO_OUTPUT & 0xf) << (offset * 2); | ||
54 | |||
55 | __raw_writel(con, base + 0x00); | ||
56 | |||
57 | local_irq_restore(flags); | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static int s3c24xx_gpiolib_output(struct gpio_chip *chip, | ||
62 | unsigned offset, int value) | ||
63 | { | ||
64 | struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip); | ||
65 | void __iomem *base = ourchip->base; | ||
66 | unsigned long flags; | ||
67 | unsigned long dat; | ||
68 | unsigned long con; | ||
69 | |||
70 | local_irq_save(flags); | ||
71 | |||
72 | dat = __raw_readl(base + 0x04); | ||
73 | dat &= ~(1 << offset); | ||
74 | if (value) | ||
75 | dat |= 1 << offset; | ||
76 | __raw_writel(dat, base + 0x04); | ||
77 | |||
78 | con = __raw_readl(base + 0x00); | ||
79 | con &= ~(3 << (offset * 2)); | ||
80 | con |= (S3C2410_GPIO_OUTPUT & 0xf) << (offset * 2); | ||
81 | |||
82 | __raw_writel(con, base + 0x00); | ||
83 | __raw_writel(dat, base + 0x04); | ||
84 | |||
85 | local_irq_restore(flags); | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static void s3c24xx_gpiolib_set(struct gpio_chip *chip, | ||
90 | unsigned offset, int value) | ||
91 | { | ||
92 | struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip); | ||
93 | void __iomem *base = ourchip->base; | ||
94 | unsigned long flags; | ||
95 | unsigned long dat; | ||
96 | |||
97 | local_irq_save(flags); | ||
98 | |||
99 | dat = __raw_readl(base + 0x04); | ||
100 | dat &= ~(1 << offset); | ||
101 | if (value) | ||
102 | dat |= 1 << offset; | ||
103 | __raw_writel(dat, base + 0x04); | ||
104 | |||
105 | local_irq_restore(flags); | ||
106 | } | ||
107 | |||
108 | static int s3c24xx_gpiolib_get(struct gpio_chip *chip, unsigned offset) | ||
109 | { | ||
110 | struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip); | ||
111 | unsigned long val; | ||
112 | |||
113 | val = __raw_readl(ourchip->base + 0x04); | ||
114 | val >>= offset; | ||
115 | val &= 1; | ||
116 | |||
117 | return val; | ||
118 | } | ||
119 | |||
120 | static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) | 28 | static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) |
121 | { | 29 | { |
122 | return -EINVAL; | 30 | return -EINVAL; |
@@ -125,7 +33,7 @@ static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) | |||
125 | static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip, | 33 | static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip, |
126 | unsigned offset, int value) | 34 | unsigned offset, int value) |
127 | { | 35 | { |
128 | struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip); | 36 | struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip); |
129 | void __iomem *base = ourchip->base; | 37 | void __iomem *base = ourchip->base; |
130 | unsigned long flags; | 38 | unsigned long flags; |
131 | unsigned long dat; | 39 | unsigned long dat; |
@@ -151,7 +59,7 @@ static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip, | |||
151 | return 0; | 59 | return 0; |
152 | } | 60 | } |
153 | 61 | ||
154 | static struct s3c24xx_gpio_chip gpios[] = { | 62 | struct s3c_gpio_chip s3c24xx_gpios[] = { |
155 | [0] = { | 63 | [0] = { |
156 | .base = S3C24XX_GPIO_BASE(S3C2410_GPA0), | 64 | .base = S3C24XX_GPIO_BASE(S3C2410_GPA0), |
157 | .chip = { | 65 | .chip = { |
@@ -219,34 +127,13 @@ static struct s3c24xx_gpio_chip gpios[] = { | |||
219 | }, | 127 | }, |
220 | }; | 128 | }; |
221 | 129 | ||
222 | static __init void s3c24xx_gpiolib_add(struct s3c24xx_gpio_chip *chip) | ||
223 | { | ||
224 | struct gpio_chip *gc = &chip->chip; | ||
225 | |||
226 | BUG_ON(!chip->base); | ||
227 | BUG_ON(!gc->label); | ||
228 | BUG_ON(!gc->ngpio); | ||
229 | |||
230 | if (!gc->direction_input) | ||
231 | gc->direction_input = s3c24xx_gpiolib_input; | ||
232 | if (!gc->direction_output) | ||
233 | gc->direction_output = s3c24xx_gpiolib_output; | ||
234 | if (!gc->set) | ||
235 | gc->set = s3c24xx_gpiolib_set; | ||
236 | if (!gc->get) | ||
237 | gc->get = s3c24xx_gpiolib_get; | ||
238 | |||
239 | /* gpiochip_add() prints own failure message on error. */ | ||
240 | gpiochip_add(gc); | ||
241 | } | ||
242 | |||
243 | static __init int s3c24xx_gpiolib_init(void) | 130 | static __init int s3c24xx_gpiolib_init(void) |
244 | { | 131 | { |
245 | struct s3c24xx_gpio_chip *chip = gpios; | 132 | struct s3c_gpio_chip *chip = s3c24xx_gpios; |
246 | int gpn; | 133 | int gpn; |
247 | 134 | ||
248 | for (gpn = 0; gpn < ARRAY_SIZE(gpios); gpn++, chip++) | 135 | for (gpn = 0; gpn < ARRAY_SIZE(s3c24xx_gpios); gpn++, chip++) |
249 | s3c24xx_gpiolib_add(chip); | 136 | s3c_gpiolib_add(chip); |
250 | 137 | ||
251 | return 0; | 138 | return 0; |
252 | } | 139 | } |
diff --git a/arch/arm/plat-s3c24xx/include/plat/map.h b/arch/arm/plat-s3c24xx/include/plat/map.h index e7be0c0d3702..fef8ea8b8e1e 100644 --- a/arch/arm/plat-s3c24xx/include/plat/map.h +++ b/arch/arm/plat-s3c24xx/include/plat/map.h | |||
@@ -51,7 +51,6 @@ | |||
51 | 51 | ||
52 | /* Standard size definitions for peripheral blocks. */ | 52 | /* Standard size definitions for peripheral blocks. */ |
53 | 53 | ||
54 | #define S3C24XX_SZ_IIC SZ_1M | ||
55 | #define S3C24XX_SZ_IIS SZ_1M | 54 | #define S3C24XX_SZ_IIS SZ_1M |
56 | #define S3C24XX_SZ_ADC SZ_1M | 55 | #define S3C24XX_SZ_ADC SZ_1M |
57 | #define S3C24XX_SZ_SPI SZ_1M | 56 | #define S3C24XX_SZ_SPI SZ_1M |
diff --git a/arch/arm/plat-s3c24xx/s3c244x.c b/arch/arm/plat-s3c24xx/s3c244x.c index 494368403055..c1de6bb0101b 100644 --- a/arch/arm/plat-s3c24xx/s3c244x.c +++ b/arch/arm/plat-s3c24xx/s3c244x.c | |||
@@ -68,7 +68,7 @@ void __init s3c244x_map_io(void) | |||
68 | /* rename any peripherals used differing from the s3c2410 */ | 68 | /* rename any peripherals used differing from the s3c2410 */ |
69 | 69 | ||
70 | s3c_device_sdi.name = "s3c2440-sdi"; | 70 | s3c_device_sdi.name = "s3c2440-sdi"; |
71 | s3c_device_i2c.name = "s3c2440-i2c"; | 71 | s3c_device_i2c0.name = "s3c2440-i2c"; |
72 | s3c_device_nand.name = "s3c2440-nand"; | 72 | s3c_device_nand.name = "s3c2440-nand"; |
73 | s3c_device_usbgadget.name = "s3c2440-usbgadget"; | 73 | s3c_device_usbgadget.name = "s3c2440-usbgadget"; |
74 | } | 74 | } |
diff --git a/arch/arm/plat-s3c24xx/setup-i2c.c b/arch/arm/plat-s3c24xx/setup-i2c.c new file mode 100644 index 000000000000..d62b7e7fb355 --- /dev/null +++ b/arch/arm/plat-s3c24xx/setup-i2c.c | |||
@@ -0,0 +1,25 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/setup-i2c.c | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C24XX Base setup for i2c device | ||
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 | |||
15 | struct platform_device; | ||
16 | |||
17 | #include <plat/iic.h> | ||
18 | #include <mach/hardware.h> | ||
19 | #include <mach/regs-gpio.h> | ||
20 | |||
21 | void s3c_i2c0_cfg_gpio(struct platform_device *dev) | ||
22 | { | ||
23 | s3c2410_gpio_cfgpin(S3C2410_GPE15, S3C2410_GPE15_IICSDA); | ||
24 | s3c2410_gpio_cfgpin(S3C2410_GPE14, S3C2410_GPE14_IICSCL); | ||
25 | } | ||