diff options
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r-- | arch/arm/plat-samsung/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/plat-samsung/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-samsung/adc.c | 48 | ||||
-rw-r--r-- | arch/arm/plat-samsung/clock.c | 75 | ||||
-rw-r--r-- | arch/arm/plat-samsung/devs.c | 14 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/cpu.h | 8 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/devs.h | 4 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/gpio-core.h | 7 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/mfc.h | 11 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/pm.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-samsung/s5p-dev-mfc.c | 34 | ||||
-rw-r--r-- | arch/arm/plat-samsung/s5p-irq-gpioint.c | 8 | ||||
-rw-r--r-- | arch/arm/plat-samsung/setup-camif.c | 70 |
13 files changed, 232 insertions, 56 deletions
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 59401e1cc530..a9d52167e16e 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -414,6 +414,11 @@ config S5P_SETUP_MIPIPHY | |||
414 | help | 414 | help |
415 | Compile in common setup code for MIPI-CSIS and MIPI-DSIM devices | 415 | Compile in common setup code for MIPI-CSIS and MIPI-DSIM devices |
416 | 416 | ||
417 | config S3C_SETUP_CAMIF | ||
418 | bool | ||
419 | help | ||
420 | Compile in common setup code for S3C CAMIF devices | ||
421 | |||
417 | # DMA | 422 | # DMA |
418 | 423 | ||
419 | config S3C_DMA | 424 | config S3C_DMA |
@@ -502,5 +507,6 @@ config DEBUG_S3C_UART | |||
502 | default "0" if DEBUG_S3C_UART0 | 507 | default "0" if DEBUG_S3C_UART0 |
503 | default "1" if DEBUG_S3C_UART1 | 508 | default "1" if DEBUG_S3C_UART1 |
504 | default "2" if DEBUG_S3C_UART2 | 509 | default "2" if DEBUG_S3C_UART2 |
510 | default "3" if DEBUG_S3C_UART3 | ||
505 | 511 | ||
506 | endif | 512 | endif |
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 9e40e8d00740..3a7c64d1814a 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile | |||
@@ -41,6 +41,7 @@ obj-$(CONFIG_S5P_DEV_UART) += s5p-dev-uart.o | |||
41 | 41 | ||
42 | obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o | 42 | obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o |
43 | 43 | ||
44 | obj-$(CONFIG_S3C_SETUP_CAMIF) += setup-camif.o | ||
44 | obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o | 45 | obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o |
45 | 46 | ||
46 | # DMA support | 47 | # DMA support |
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c index b1e05ccff3ac..37542c2689a2 100644 --- a/arch/arm/plat-samsung/adc.c +++ b/arch/arm/plat-samsung/adc.c | |||
@@ -344,7 +344,7 @@ static int s3c_adc_probe(struct platform_device *pdev) | |||
344 | int ret; | 344 | int ret; |
345 | unsigned tmp; | 345 | unsigned tmp; |
346 | 346 | ||
347 | adc = kzalloc(sizeof(struct adc_device), GFP_KERNEL); | 347 | adc = devm_kzalloc(dev, sizeof(struct adc_device), GFP_KERNEL); |
348 | if (adc == NULL) { | 348 | if (adc == NULL) { |
349 | dev_err(dev, "failed to allocate adc_device\n"); | 349 | dev_err(dev, "failed to allocate adc_device\n"); |
350 | return -ENOMEM; | 350 | return -ENOMEM; |
@@ -355,50 +355,46 @@ static int s3c_adc_probe(struct platform_device *pdev) | |||
355 | adc->pdev = pdev; | 355 | adc->pdev = pdev; |
356 | adc->prescale = S3C2410_ADCCON_PRSCVL(49); | 356 | adc->prescale = S3C2410_ADCCON_PRSCVL(49); |
357 | 357 | ||
358 | adc->vdd = regulator_get(dev, "vdd"); | 358 | adc->vdd = devm_regulator_get(dev, "vdd"); |
359 | if (IS_ERR(adc->vdd)) { | 359 | if (IS_ERR(adc->vdd)) { |
360 | dev_err(dev, "operating without regulator \"vdd\" .\n"); | 360 | dev_err(dev, "operating without regulator \"vdd\" .\n"); |
361 | ret = PTR_ERR(adc->vdd); | 361 | return PTR_ERR(adc->vdd); |
362 | goto err_alloc; | ||
363 | } | 362 | } |
364 | 363 | ||
365 | adc->irq = platform_get_irq(pdev, 1); | 364 | adc->irq = platform_get_irq(pdev, 1); |
366 | if (adc->irq <= 0) { | 365 | if (adc->irq <= 0) { |
367 | dev_err(dev, "failed to get adc irq\n"); | 366 | dev_err(dev, "failed to get adc irq\n"); |
368 | ret = -ENOENT; | 367 | return -ENOENT; |
369 | goto err_reg; | ||
370 | } | 368 | } |
371 | 369 | ||
372 | ret = request_irq(adc->irq, s3c_adc_irq, 0, dev_name(dev), adc); | 370 | ret = devm_request_irq(dev, adc->irq, s3c_adc_irq, 0, dev_name(dev), |
371 | adc); | ||
373 | if (ret < 0) { | 372 | if (ret < 0) { |
374 | dev_err(dev, "failed to attach adc irq\n"); | 373 | dev_err(dev, "failed to attach adc irq\n"); |
375 | goto err_reg; | 374 | return ret; |
376 | } | 375 | } |
377 | 376 | ||
378 | adc->clk = clk_get(dev, "adc"); | 377 | adc->clk = devm_clk_get(dev, "adc"); |
379 | if (IS_ERR(adc->clk)) { | 378 | if (IS_ERR(adc->clk)) { |
380 | dev_err(dev, "failed to get adc clock\n"); | 379 | dev_err(dev, "failed to get adc clock\n"); |
381 | ret = PTR_ERR(adc->clk); | 380 | return PTR_ERR(adc->clk); |
382 | goto err_irq; | ||
383 | } | 381 | } |
384 | 382 | ||
385 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 383 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
386 | if (!regs) { | 384 | if (!regs) { |
387 | dev_err(dev, "failed to find registers\n"); | 385 | dev_err(dev, "failed to find registers\n"); |
388 | ret = -ENXIO; | 386 | return -ENXIO; |
389 | goto err_clk; | ||
390 | } | 387 | } |
391 | 388 | ||
392 | adc->regs = ioremap(regs->start, resource_size(regs)); | 389 | adc->regs = devm_request_and_ioremap(dev, regs); |
393 | if (!adc->regs) { | 390 | if (!adc->regs) { |
394 | dev_err(dev, "failed to map registers\n"); | 391 | dev_err(dev, "failed to map registers\n"); |
395 | ret = -ENXIO; | 392 | return -ENXIO; |
396 | goto err_clk; | ||
397 | } | 393 | } |
398 | 394 | ||
399 | ret = regulator_enable(adc->vdd); | 395 | ret = regulator_enable(adc->vdd); |
400 | if (ret) | 396 | if (ret) |
401 | goto err_ioremap; | 397 | return ret; |
402 | 398 | ||
403 | clk_enable(adc->clk); | 399 | clk_enable(adc->clk); |
404 | 400 | ||
@@ -418,32 +414,14 @@ static int s3c_adc_probe(struct platform_device *pdev) | |||
418 | adc_dev = adc; | 414 | adc_dev = adc; |
419 | 415 | ||
420 | return 0; | 416 | return 0; |
421 | |||
422 | err_ioremap: | ||
423 | iounmap(adc->regs); | ||
424 | err_clk: | ||
425 | clk_put(adc->clk); | ||
426 | |||
427 | err_irq: | ||
428 | free_irq(adc->irq, adc); | ||
429 | err_reg: | ||
430 | regulator_put(adc->vdd); | ||
431 | err_alloc: | ||
432 | kfree(adc); | ||
433 | return ret; | ||
434 | } | 417 | } |
435 | 418 | ||
436 | static int __devexit s3c_adc_remove(struct platform_device *pdev) | 419 | static int __devexit s3c_adc_remove(struct platform_device *pdev) |
437 | { | 420 | { |
438 | struct adc_device *adc = platform_get_drvdata(pdev); | 421 | struct adc_device *adc = platform_get_drvdata(pdev); |
439 | 422 | ||
440 | iounmap(adc->regs); | ||
441 | free_irq(adc->irq, adc); | ||
442 | clk_disable(adc->clk); | 423 | clk_disable(adc->clk); |
443 | regulator_disable(adc->vdd); | 424 | regulator_disable(adc->vdd); |
444 | regulator_put(adc->vdd); | ||
445 | clk_put(adc->clk); | ||
446 | kfree(adc); | ||
447 | 425 | ||
448 | return 0; | 426 | return 0; |
449 | } | 427 | } |
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index 012bbd0b8d81..47c9fad43f00 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c | |||
@@ -389,6 +389,72 @@ int __init s3c24xx_register_baseclocks(unsigned long xtal) | |||
389 | 389 | ||
390 | static struct dentry *clk_debugfs_root; | 390 | static struct dentry *clk_debugfs_root; |
391 | 391 | ||
392 | static void clock_tree_show_one(struct seq_file *s, struct clk *c, int level) | ||
393 | { | ||
394 | struct clk *child; | ||
395 | const char *state; | ||
396 | char buf[255] = { 0 }; | ||
397 | int n = 0; | ||
398 | |||
399 | if (c->name) | ||
400 | n = snprintf(buf, sizeof(buf) - 1, "%s", c->name); | ||
401 | |||
402 | if (c->devname) | ||
403 | n += snprintf(buf + n, sizeof(buf) - 1 - n, ":%s", c->devname); | ||
404 | |||
405 | state = (c->usage > 0) ? "on" : "off"; | ||
406 | |||
407 | seq_printf(s, "%*s%-*s %-6s %-3d %-10lu\n", | ||
408 | level * 3 + 1, "", | ||
409 | 50 - level * 3, buf, | ||
410 | state, c->usage, clk_get_rate(c)); | ||
411 | |||
412 | list_for_each_entry(child, &clocks, list) { | ||
413 | if (child->parent != c) | ||
414 | continue; | ||
415 | |||
416 | clock_tree_show_one(s, child, level + 1); | ||
417 | } | ||
418 | } | ||
419 | |||
420 | static int clock_tree_show(struct seq_file *s, void *data) | ||
421 | { | ||
422 | struct clk *c; | ||
423 | unsigned long flags; | ||
424 | |||
425 | seq_printf(s, " clock state ref rate\n"); | ||
426 | seq_printf(s, "----------------------------------------------------\n"); | ||
427 | |||
428 | spin_lock_irqsave(&clocks_lock, flags); | ||
429 | |||
430 | list_for_each_entry(c, &clocks, list) | ||
431 | if (c->parent == NULL) | ||
432 | clock_tree_show_one(s, c, 0); | ||
433 | |||
434 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
435 | return 0; | ||
436 | } | ||
437 | |||
438 | static int clock_tree_open(struct inode *inode, struct file *file) | ||
439 | { | ||
440 | return single_open(file, clock_tree_show, inode->i_private); | ||
441 | } | ||
442 | |||
443 | static const struct file_operations clock_tree_fops = { | ||
444 | .open = clock_tree_open, | ||
445 | .read = seq_read, | ||
446 | .llseek = seq_lseek, | ||
447 | .release = single_release, | ||
448 | }; | ||
449 | |||
450 | static int clock_rate_show(void *data, u64 *val) | ||
451 | { | ||
452 | struct clk *c = data; | ||
453 | *val = clk_get_rate(c); | ||
454 | return 0; | ||
455 | } | ||
456 | DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_rate_show, NULL, "%llu\n"); | ||
457 | |||
392 | static int clk_debugfs_register_one(struct clk *c) | 458 | static int clk_debugfs_register_one(struct clk *c) |
393 | { | 459 | { |
394 | int err; | 460 | int err; |
@@ -411,7 +477,7 @@ static int clk_debugfs_register_one(struct clk *c) | |||
411 | goto err_out; | 477 | goto err_out; |
412 | } | 478 | } |
413 | 479 | ||
414 | d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate); | 480 | d = debugfs_create_file("rate", S_IRUGO, c->dent, c, &clock_rate_fops); |
415 | if (!d) { | 481 | if (!d) { |
416 | err = -ENOMEM; | 482 | err = -ENOMEM; |
417 | goto err_out; | 483 | goto err_out; |
@@ -446,13 +512,18 @@ static int __init clk_debugfs_init(void) | |||
446 | { | 512 | { |
447 | struct clk *c; | 513 | struct clk *c; |
448 | struct dentry *d; | 514 | struct dentry *d; |
449 | int err; | 515 | int err = -ENOMEM; |
450 | 516 | ||
451 | d = debugfs_create_dir("clock", NULL); | 517 | d = debugfs_create_dir("clock", NULL); |
452 | if (!d) | 518 | if (!d) |
453 | return -ENOMEM; | 519 | return -ENOMEM; |
454 | clk_debugfs_root = d; | 520 | clk_debugfs_root = d; |
455 | 521 | ||
522 | d = debugfs_create_file("clock_tree", S_IRUGO, clk_debugfs_root, NULL, | ||
523 | &clock_tree_fops); | ||
524 | if (!d) | ||
525 | goto err_out; | ||
526 | |||
456 | list_for_each_entry(c, &clocks, list) { | 527 | list_for_each_entry(c, &clocks, list) { |
457 | err = clk_debugfs_register(c); | 528 | err = clk_debugfs_register(c); |
458 | if (err) | 529 | if (err) |
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 03f654d55eff..51afedda9ab6 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c | |||
@@ -146,15 +146,6 @@ struct platform_device s3c_device_camif = { | |||
146 | 146 | ||
147 | /* ASOC DMA */ | 147 | /* ASOC DMA */ |
148 | 148 | ||
149 | struct platform_device samsung_asoc_dma = { | ||
150 | .name = "samsung-audio", | ||
151 | .id = -1, | ||
152 | .dev = { | ||
153 | .dma_mask = &samsung_device_dma_mask, | ||
154 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
155 | } | ||
156 | }; | ||
157 | |||
158 | struct platform_device samsung_asoc_idma = { | 149 | struct platform_device samsung_asoc_idma = { |
159 | .name = "samsung-idma", | 150 | .name = "samsung-idma", |
160 | .id = -1, | 151 | .id = -1, |
@@ -486,11 +477,7 @@ static struct resource s3c_i2c0_resource[] = { | |||
486 | 477 | ||
487 | struct platform_device s3c_device_i2c0 = { | 478 | struct platform_device s3c_device_i2c0 = { |
488 | .name = "s3c2410-i2c", | 479 | .name = "s3c2410-i2c", |
489 | #ifdef CONFIG_S3C_DEV_I2C1 | ||
490 | .id = 0, | 480 | .id = 0, |
491 | #else | ||
492 | .id = -1, | ||
493 | #endif | ||
494 | .num_resources = ARRAY_SIZE(s3c_i2c0_resource), | 481 | .num_resources = ARRAY_SIZE(s3c_i2c0_resource), |
495 | .resource = s3c_i2c0_resource, | 482 | .resource = s3c_i2c0_resource, |
496 | }; | 483 | }; |
@@ -933,6 +920,7 @@ struct platform_device s5p_device_mfc_r = { | |||
933 | .coherent_dma_mask = DMA_BIT_MASK(32), | 920 | .coherent_dma_mask = DMA_BIT_MASK(32), |
934 | }, | 921 | }, |
935 | }; | 922 | }; |
923 | |||
936 | #endif /* CONFIG_S5P_DEV_MFC */ | 924 | #endif /* CONFIG_S5P_DEV_MFC */ |
937 | 925 | ||
938 | /* MIPI CSIS */ | 926 | /* MIPI CSIS */ |
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index ace4451b7651..e0072ce8d6e9 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h | |||
@@ -43,6 +43,7 @@ extern unsigned long samsung_cpu_id; | |||
43 | #define EXYNOS4_CPU_MASK 0xFFFE0000 | 43 | #define EXYNOS4_CPU_MASK 0xFFFE0000 |
44 | 44 | ||
45 | #define EXYNOS5250_SOC_ID 0x43520000 | 45 | #define EXYNOS5250_SOC_ID 0x43520000 |
46 | #define EXYNOS5440_SOC_ID 0x54400000 | ||
46 | #define EXYNOS5_SOC_MASK 0xFFFFF000 | 47 | #define EXYNOS5_SOC_MASK 0xFFFFF000 |
47 | 48 | ||
48 | #define IS_SAMSUNG_CPU(name, id, mask) \ | 49 | #define IS_SAMSUNG_CPU(name, id, mask) \ |
@@ -62,6 +63,7 @@ IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK) | |||
62 | IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) | 63 | IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) |
63 | IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) | 64 | IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) |
64 | IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK) | 65 | IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK) |
66 | IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK) | ||
65 | 67 | ||
66 | #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ | 68 | #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ |
67 | defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ | 69 | defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ |
@@ -130,6 +132,12 @@ IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK) | |||
130 | # define soc_is_exynos5250() 0 | 132 | # define soc_is_exynos5250() 0 |
131 | #endif | 133 | #endif |
132 | 134 | ||
135 | #if defined(CONFIG_SOC_EXYNOS5440) | ||
136 | # define soc_is_exynos5440() is_samsung_exynos5440() | ||
137 | #else | ||
138 | # define soc_is_exynos5440() 0 | ||
139 | #endif | ||
140 | |||
133 | #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } | 141 | #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } |
134 | 142 | ||
135 | #ifndef KHZ | 143 | #ifndef KHZ |
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h index 5da4b4f38f40..87d501ff3328 100644 --- a/arch/arm/plat-samsung/include/plat/devs.h +++ b/arch/arm/plat-samsung/include/plat/devs.h | |||
@@ -123,7 +123,6 @@ extern struct platform_device s5pv210_device_spdif; | |||
123 | 123 | ||
124 | extern struct platform_device exynos4_device_ac97; | 124 | extern struct platform_device exynos4_device_ac97; |
125 | extern struct platform_device exynos4_device_ahci; | 125 | extern struct platform_device exynos4_device_ahci; |
126 | extern struct platform_device exynos4_device_dwmci; | ||
127 | extern struct platform_device exynos4_device_i2s0; | 126 | extern struct platform_device exynos4_device_i2s0; |
128 | extern struct platform_device exynos4_device_i2s1; | 127 | extern struct platform_device exynos4_device_i2s1; |
129 | extern struct platform_device exynos4_device_i2s2; | 128 | extern struct platform_device exynos4_device_i2s2; |
@@ -133,9 +132,6 @@ extern struct platform_device exynos4_device_pcm1; | |||
133 | extern struct platform_device exynos4_device_pcm2; | 132 | extern struct platform_device exynos4_device_pcm2; |
134 | extern struct platform_device exynos4_device_spdif; | 133 | extern struct platform_device exynos4_device_spdif; |
135 | 134 | ||
136 | extern struct platform_device exynos_device_drm; | ||
137 | |||
138 | extern struct platform_device samsung_asoc_dma; | ||
139 | extern struct platform_device samsung_asoc_idma; | 135 | extern struct platform_device samsung_asoc_idma; |
140 | extern struct platform_device samsung_device_keypad; | 136 | extern struct platform_device samsung_device_keypad; |
141 | 137 | ||
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h index 1fe6917f6a2a..f7a3ea2c498a 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-core.h +++ b/arch/arm/plat-samsung/include/plat/gpio-core.h | |||
@@ -11,6 +11,9 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #ifndef __PLAT_SAMSUNG_GPIO_CORE_H | ||
15 | #define __PLAT_SAMSUNG_GPIO_CORE_H | ||
16 | |||
14 | #define GPIOCON_OFF (0x00) | 17 | #define GPIOCON_OFF (0x00) |
15 | #define GPIODAT_OFF (0x04) | 18 | #define GPIODAT_OFF (0x04) |
16 | 19 | ||
@@ -48,6 +51,7 @@ struct samsung_gpio_cfg; | |||
48 | * @config: special function and pull-resistor control information. | 51 | * @config: special function and pull-resistor control information. |
49 | * @lock: Lock for exclusive access to this gpio bank. | 52 | * @lock: Lock for exclusive access to this gpio bank. |
50 | * @pm_save: Save information for suspend/resume support. | 53 | * @pm_save: Save information for suspend/resume support. |
54 | * @bitmap_gpio_int: Bitmap for representing GPIO interrupt or not. | ||
51 | * | 55 | * |
52 | * This wrapper provides the necessary information for the Samsung | 56 | * This wrapper provides the necessary information for the Samsung |
53 | * specific gpios being registered with gpiolib. | 57 | * specific gpios being registered with gpiolib. |
@@ -71,6 +75,7 @@ struct samsung_gpio_chip { | |||
71 | #ifdef CONFIG_PM | 75 | #ifdef CONFIG_PM |
72 | u32 pm_save[4]; | 76 | u32 pm_save[4]; |
73 | #endif | 77 | #endif |
78 | u32 bitmap_gpio_int; | ||
74 | }; | 79 | }; |
75 | 80 | ||
76 | static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc) | 81 | static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc) |
@@ -122,3 +127,5 @@ extern struct samsung_gpio_pm samsung_gpio_pm_4bit; | |||
122 | /* locking wrappers to deal with multiple access to the same gpio bank */ | 127 | /* locking wrappers to deal with multiple access to the same gpio bank */ |
123 | #define samsung_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl) | 128 | #define samsung_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl) |
124 | #define samsung_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl) | 129 | #define samsung_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl) |
130 | |||
131 | #endif /* __PLAT_SAMSUNG_GPIO_CORE_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/mfc.h b/arch/arm/plat-samsung/include/plat/mfc.h index ac13227272f0..e6d7c42d68b6 100644 --- a/arch/arm/plat-samsung/include/plat/mfc.h +++ b/arch/arm/plat-samsung/include/plat/mfc.h | |||
@@ -10,6 +10,14 @@ | |||
10 | #ifndef __PLAT_SAMSUNG_MFC_H | 10 | #ifndef __PLAT_SAMSUNG_MFC_H |
11 | #define __PLAT_SAMSUNG_MFC_H __FILE__ | 11 | #define __PLAT_SAMSUNG_MFC_H __FILE__ |
12 | 12 | ||
13 | struct s5p_mfc_dt_meminfo { | ||
14 | unsigned long loff; | ||
15 | unsigned long lsize; | ||
16 | unsigned long roff; | ||
17 | unsigned long rsize; | ||
18 | char *compatible; | ||
19 | }; | ||
20 | |||
13 | /** | 21 | /** |
14 | * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver | 22 | * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver |
15 | * @rbase: base address for MFC 'right' memory interface | 23 | * @rbase: base address for MFC 'right' memory interface |
@@ -24,4 +32,7 @@ | |||
24 | void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, | 32 | void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, |
25 | phys_addr_t lbase, unsigned int lsize); | 33 | phys_addr_t lbase, unsigned int lsize); |
26 | 34 | ||
35 | int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname, | ||
36 | int depth, void *data); | ||
37 | |||
27 | #endif /* __PLAT_SAMSUNG_MFC_H */ | 38 | #endif /* __PLAT_SAMSUNG_MFC_H */ |
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h index 61fc53740fbd..887a0c954379 100644 --- a/arch/arm/plat-samsung/include/plat/pm.h +++ b/arch/arm/plat-samsung/include/plat/pm.h | |||
@@ -107,10 +107,12 @@ extern void s3c_pm_do_restore(struct sleep_save *ptr, int count); | |||
107 | extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); | 107 | extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); |
108 | 108 | ||
109 | #ifdef CONFIG_PM | 109 | #ifdef CONFIG_PM |
110 | extern int s3c_irq_wake(struct irq_data *data, unsigned int state); | ||
110 | extern int s3c_irqext_wake(struct irq_data *data, unsigned int state); | 111 | extern int s3c_irqext_wake(struct irq_data *data, unsigned int state); |
111 | extern int s3c24xx_irq_suspend(void); | 112 | extern int s3c24xx_irq_suspend(void); |
112 | extern void s3c24xx_irq_resume(void); | 113 | extern void s3c24xx_irq_resume(void); |
113 | #else | 114 | #else |
115 | #define s3c_irq_wake NULL | ||
114 | #define s3c_irqext_wake NULL | 116 | #define s3c_irqext_wake NULL |
115 | #define s3c24xx_irq_suspend NULL | 117 | #define s3c24xx_irq_suspend NULL |
116 | #define s3c24xx_irq_resume NULL | 118 | #define s3c24xx_irq_resume NULL |
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c index ad6089465e2a..5ec104b5408b 100644 --- a/arch/arm/plat-samsung/s5p-dev-mfc.c +++ b/arch/arm/plat-samsung/s5p-dev-mfc.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/memblock.h> | 15 | #include <linux/memblock.h> |
16 | #include <linux/ioport.h> | 16 | #include <linux/ioport.h> |
17 | #include <linux/of_fdt.h> | ||
18 | #include <linux/of.h> | ||
17 | 19 | ||
18 | #include <mach/map.h> | 20 | #include <mach/map.h> |
19 | #include <plat/devs.h> | 21 | #include <plat/devs.h> |
@@ -69,3 +71,35 @@ static int __init s5p_mfc_memory_init(void) | |||
69 | return 0; | 71 | return 0; |
70 | } | 72 | } |
71 | device_initcall(s5p_mfc_memory_init); | 73 | device_initcall(s5p_mfc_memory_init); |
74 | |||
75 | #ifdef CONFIG_OF | ||
76 | int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname, | ||
77 | int depth, void *data) | ||
78 | { | ||
79 | __be32 *prop; | ||
80 | unsigned long len; | ||
81 | struct s5p_mfc_dt_meminfo *mfc_mem = data; | ||
82 | |||
83 | if (!data) | ||
84 | return 0; | ||
85 | |||
86 | if (!of_flat_dt_is_compatible(node, mfc_mem->compatible)) | ||
87 | return 0; | ||
88 | |||
89 | prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len); | ||
90 | if (!prop || (len != 2 * sizeof(unsigned long))) | ||
91 | return 0; | ||
92 | |||
93 | mfc_mem->loff = be32_to_cpu(prop[0]); | ||
94 | mfc_mem->lsize = be32_to_cpu(prop[1]); | ||
95 | |||
96 | prop = of_get_flat_dt_prop(node, "samsung,mfc-r", &len); | ||
97 | if (!prop || (len != 2 * sizeof(unsigned long))) | ||
98 | return 0; | ||
99 | |||
100 | mfc_mem->roff = be32_to_cpu(prop[0]); | ||
101 | mfc_mem->rsize = be32_to_cpu(prop[1]); | ||
102 | |||
103 | return 1; | ||
104 | } | ||
105 | #endif | ||
diff --git a/arch/arm/plat-samsung/s5p-irq-gpioint.c b/arch/arm/plat-samsung/s5p-irq-gpioint.c index 23557d30e44c..bae56131a50a 100644 --- a/arch/arm/plat-samsung/s5p-irq-gpioint.c +++ b/arch/arm/plat-samsung/s5p-irq-gpioint.c | |||
@@ -185,7 +185,7 @@ int __init s5p_register_gpio_interrupt(int pin) | |||
185 | 185 | ||
186 | /* check if the group has been already registered */ | 186 | /* check if the group has been already registered */ |
187 | if (my_chip->irq_base) | 187 | if (my_chip->irq_base) |
188 | return my_chip->irq_base + offset; | 188 | goto success; |
189 | 189 | ||
190 | /* register gpio group */ | 190 | /* register gpio group */ |
191 | ret = s5p_gpioint_add(my_chip); | 191 | ret = s5p_gpioint_add(my_chip); |
@@ -193,9 +193,13 @@ int __init s5p_register_gpio_interrupt(int pin) | |||
193 | my_chip->chip.to_irq = samsung_gpiolib_to_irq; | 193 | my_chip->chip.to_irq = samsung_gpiolib_to_irq; |
194 | printk(KERN_INFO "Registered interrupt support for gpio group %d.\n", | 194 | printk(KERN_INFO "Registered interrupt support for gpio group %d.\n", |
195 | group); | 195 | group); |
196 | return my_chip->irq_base + offset; | 196 | goto success; |
197 | } | 197 | } |
198 | return ret; | 198 | return ret; |
199 | success: | ||
200 | my_chip->bitmap_gpio_int |= BIT(offset); | ||
201 | |||
202 | return my_chip->irq_base + offset; | ||
199 | } | 203 | } |
200 | 204 | ||
201 | int __init s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups) | 205 | int __init s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups) |
diff --git a/arch/arm/plat-samsung/setup-camif.c b/arch/arm/plat-samsung/setup-camif.c new file mode 100644 index 000000000000..e01bf760af2c --- /dev/null +++ b/arch/arm/plat-samsung/setup-camif.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | ||
3 | * | ||
4 | * Helper functions for S3C24XX/S3C64XX SoC series CAMIF driver | ||
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/gpio.h> | ||
12 | #include <plat/gpio-cfg.h> | ||
13 | |||
14 | /* Number of camera port pins, without FIELD */ | ||
15 | #define S3C_CAMIF_NUM_GPIOS 13 | ||
16 | |||
17 | /* Default camera port configuration helpers. */ | ||
18 | |||
19 | static void camif_get_gpios(int *gpio_start, int *gpio_reset) | ||
20 | { | ||
21 | #ifdef CONFIG_ARCH_S3C24XX | ||
22 | *gpio_start = S3C2410_GPJ(0); | ||
23 | *gpio_reset = S3C2410_GPJ(12); | ||
24 | #else | ||
25 | /* s3c64xx */ | ||
26 | *gpio_start = S3C64XX_GPF(0); | ||
27 | *gpio_reset = S3C64XX_GPF(3); | ||
28 | #endif | ||
29 | } | ||
30 | |||
31 | int s3c_camif_gpio_get(void) | ||
32 | { | ||
33 | int gpio_start, gpio_reset; | ||
34 | int ret, i; | ||
35 | |||
36 | camif_get_gpios(&gpio_start, &gpio_reset); | ||
37 | |||
38 | for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) { | ||
39 | int gpio = gpio_start + i; | ||
40 | |||
41 | if (gpio == gpio_reset) | ||
42 | continue; | ||
43 | |||
44 | ret = gpio_request(gpio, "camif"); | ||
45 | if (!ret) | ||
46 | ret = s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
47 | if (ret) { | ||
48 | pr_err("failed to configure GPIO %d\n", gpio); | ||
49 | for (--i; i >= 0; i--) | ||
50 | gpio_free(gpio--); | ||
51 | return ret; | ||
52 | } | ||
53 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
54 | } | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | void s3c_camif_gpio_put(void) | ||
60 | { | ||
61 | int i, gpio_start, gpio_reset; | ||
62 | |||
63 | camif_get_gpios(&gpio_start, &gpio_reset); | ||
64 | |||
65 | for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) { | ||
66 | int gpio = gpio_start + i; | ||
67 | if (gpio != gpio_reset) | ||
68 | gpio_free(gpio); | ||
69 | } | ||
70 | } | ||