diff options
author | Kukjin Kim <kgene.kim@samsung.com> | 2012-04-17 23:21:30 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2012-05-12 18:01:59 -0400 |
commit | d9c452f4b4042baaa24fb91bf0c847813ff3645d (patch) | |
tree | be7a92d10d225a3a02ed0693649246ff4eff7417 /arch/arm/plat-samsung | |
parent | cfe370f876407735041f8e02ec31ffa922cd8e45 (diff) |
ARM: SAMSUNG: move setup code for s5p mfc and mipiphy into plat-samsung
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r-- | arch/arm/plat-samsung/Kconfig | 10 | ||||
-rw-r--r-- | arch/arm/plat-samsung/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/plat-samsung/s5p-dev-mfc.c | 71 | ||||
-rw-r--r-- | arch/arm/plat-samsung/setup-mipiphy.c | 63 |
4 files changed, 147 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 5ce6bc8ccf81..7fec2e9cdad4 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -309,6 +309,11 @@ config SAMSUNG_DEV_BACKLIGHT | |||
309 | help | 309 | help |
310 | Compile in platform device definition LCD backlight with PWM Timer | 310 | Compile in platform device definition LCD backlight with PWM Timer |
311 | 311 | ||
312 | config S5P_DEV_MFC | ||
313 | bool | ||
314 | help | ||
315 | Compile in setup memory (init) code for MFC | ||
316 | |||
312 | config S3C24XX_PWM | 317 | config S3C24XX_PWM |
313 | bool "PWM device support" | 318 | bool "PWM device support" |
314 | select HAVE_PWM | 319 | select HAVE_PWM |
@@ -316,6 +321,11 @@ config S3C24XX_PWM | |||
316 | Support for exporting the PWM timer blocks via the pwm device | 321 | Support for exporting the PWM timer blocks via the pwm device |
317 | system | 322 | system |
318 | 323 | ||
324 | config S5P_SETUP_MIPIPHY | ||
325 | bool | ||
326 | help | ||
327 | Compile in common setup code for MIPI-CSIS and MIPI-DSIM devices | ||
328 | |||
319 | # DMA | 329 | # DMA |
320 | 330 | ||
321 | config S3C_DMA | 331 | config S3C_DMA |
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index b20047b5633e..860b2db4db15 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile | |||
@@ -36,10 +36,13 @@ obj-y += platformdata.o | |||
36 | 36 | ||
37 | obj-y += devs.o | 37 | obj-y += devs.o |
38 | obj-y += dev-uart.o | 38 | obj-y += dev-uart.o |
39 | obj-$(CONFIG_S5P_DEV_MFC) += s5p-dev-mfc.o | ||
39 | obj-$(CONFIG_S5P_DEV_UART) += s5p-dev-uart.o | 40 | obj-$(CONFIG_S5P_DEV_UART) += s5p-dev-uart.o |
40 | 41 | ||
41 | obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o | 42 | obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o |
42 | 43 | ||
44 | obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o | ||
45 | |||
43 | # DMA support | 46 | # DMA support |
44 | 47 | ||
45 | obj-$(CONFIG_S3C_DMA) += dma.o s3c-dma-ops.o | 48 | obj-$(CONFIG_S3C_DMA) += dma.o s3c-dma-ops.o |
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c new file mode 100644 index 000000000000..ad6089465e2a --- /dev/null +++ b/arch/arm/plat-samsung/s5p-dev-mfc.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010-2011 Samsung Electronics Co.Ltd | ||
3 | * | ||
4 | * Base S5P MFC resource and device definitions | ||
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/kernel.h> | ||
12 | #include <linux/interrupt.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/dma-mapping.h> | ||
15 | #include <linux/memblock.h> | ||
16 | #include <linux/ioport.h> | ||
17 | |||
18 | #include <mach/map.h> | ||
19 | #include <plat/devs.h> | ||
20 | #include <plat/irqs.h> | ||
21 | #include <plat/mfc.h> | ||
22 | |||
23 | struct s5p_mfc_reserved_mem { | ||
24 | phys_addr_t base; | ||
25 | unsigned long size; | ||
26 | struct device *dev; | ||
27 | }; | ||
28 | |||
29 | static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata; | ||
30 | |||
31 | void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, | ||
32 | phys_addr_t lbase, unsigned int lsize) | ||
33 | { | ||
34 | int i; | ||
35 | |||
36 | s5p_mfc_mem[0].dev = &s5p_device_mfc_r.dev; | ||
37 | s5p_mfc_mem[0].base = rbase; | ||
38 | s5p_mfc_mem[0].size = rsize; | ||
39 | |||
40 | s5p_mfc_mem[1].dev = &s5p_device_mfc_l.dev; | ||
41 | s5p_mfc_mem[1].base = lbase; | ||
42 | s5p_mfc_mem[1].size = lsize; | ||
43 | |||
44 | for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) { | ||
45 | struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i]; | ||
46 | if (memblock_remove(area->base, area->size)) { | ||
47 | printk(KERN_ERR "Failed to reserve memory for MFC device (%ld bytes at 0x%08lx)\n", | ||
48 | area->size, (unsigned long) area->base); | ||
49 | area->base = 0; | ||
50 | } | ||
51 | } | ||
52 | } | ||
53 | |||
54 | static int __init s5p_mfc_memory_init(void) | ||
55 | { | ||
56 | int i; | ||
57 | |||
58 | for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) { | ||
59 | struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i]; | ||
60 | if (!area->base) | ||
61 | continue; | ||
62 | |||
63 | if (dma_declare_coherent_memory(area->dev, area->base, | ||
64 | area->base, area->size, | ||
65 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE) == 0) | ||
66 | printk(KERN_ERR "Failed to declare coherent memory for MFC device (%ld bytes at 0x%08lx)\n", | ||
67 | area->size, (unsigned long) area->base); | ||
68 | } | ||
69 | return 0; | ||
70 | } | ||
71 | device_initcall(s5p_mfc_memory_init); | ||
diff --git a/arch/arm/plat-samsung/setup-mipiphy.c b/arch/arm/plat-samsung/setup-mipiphy.c new file mode 100644 index 000000000000..683c466c0e6a --- /dev/null +++ b/arch/arm/plat-samsung/setup-mipiphy.c | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Samsung Electronics Co., Ltd. | ||
3 | * | ||
4 | * S5P - Helper functions for MIPI-CSIS and MIPI-DSIM D-PHY control | ||
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/kernel.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | #include <linux/io.h> | ||
14 | #include <linux/spinlock.h> | ||
15 | #include <mach/regs-clock.h> | ||
16 | |||
17 | static int __s5p_mipi_phy_control(struct platform_device *pdev, | ||
18 | bool on, u32 reset) | ||
19 | { | ||
20 | static DEFINE_SPINLOCK(lock); | ||
21 | void __iomem *addr; | ||
22 | unsigned long flags; | ||
23 | int pid; | ||
24 | u32 cfg; | ||
25 | |||
26 | if (!pdev) | ||
27 | return -EINVAL; | ||
28 | |||
29 | pid = (pdev->id == -1) ? 0 : pdev->id; | ||
30 | |||
31 | if (pid != 0 && pid != 1) | ||
32 | return -EINVAL; | ||
33 | |||
34 | addr = S5P_MIPI_DPHY_CONTROL(pid); | ||
35 | |||
36 | spin_lock_irqsave(&lock, flags); | ||
37 | |||
38 | cfg = __raw_readl(addr); | ||
39 | cfg = on ? (cfg | reset) : (cfg & ~reset); | ||
40 | __raw_writel(cfg, addr); | ||
41 | |||
42 | if (on) { | ||
43 | cfg |= S5P_MIPI_DPHY_ENABLE; | ||
44 | } else if (!(cfg & (S5P_MIPI_DPHY_SRESETN | | ||
45 | S5P_MIPI_DPHY_MRESETN) & ~reset)) { | ||
46 | cfg &= ~S5P_MIPI_DPHY_ENABLE; | ||
47 | } | ||
48 | |||
49 | __raw_writel(cfg, addr); | ||
50 | spin_unlock_irqrestore(&lock, flags); | ||
51 | |||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | int s5p_csis_phy_enable(struct platform_device *pdev, bool on) | ||
56 | { | ||
57 | return __s5p_mipi_phy_control(pdev, on, S5P_MIPI_DPHY_SRESETN); | ||
58 | } | ||
59 | |||
60 | int s5p_dsim_phy_enable(struct platform_device *pdev, bool on) | ||
61 | { | ||
62 | return __s5p_mipi_phy_control(pdev, on, S5P_MIPI_DPHY_MRESETN); | ||
63 | } | ||