aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-s5p/devs.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-s5p/devs.c')
-rw-r--r--arch/arm/plat-s5p/devs.c463
1 files changed, 463 insertions, 0 deletions
diff --git a/arch/arm/plat-s5p/devs.c b/arch/arm/plat-s5p/devs.c
new file mode 100644
index 0000000..b38bccd
--- /dev/null
+++ b/arch/arm/plat-s5p/devs.c
@@ -0,0 +1,463 @@
+/* linux/arch/arm/plat-s5p/devs.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * Base S5P platform device definitions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+#include <mach/hardware.h>
+#include <mach/map.h>
+#include <mach/dma.h>
+
+#include <plat/devs.h>
+#include <plat/gpio-cfg.h>
+#include <plat/irqs.h>
+#include <plat/fimc.h>
+#include <plat/csis.h>
+
+#if defined(CONFIG_VIDEO_MFC51) || defined(CONFIG_VIDEO_MFC50)
+static struct resource s5p_mfc_resources[] = {
+ [0] = {
+ .start = S5P_PA_MFC,
+ .end = S5P_PA_MFC + S5P_SZ_MFC - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_MFC,
+ .end = IRQ_MFC,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+struct platform_device s5p_device_mfc = {
+ .name = "mfc",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(s5p_mfc_resources),
+ .resource = s5p_mfc_resources,
+};
+#endif
+
+#ifdef CONFIG_VIDEO_FIMC
+static struct resource s3c_fimc0_resource[] = {
+ [0] = {
+ .start = S5P_PA_FIMC0,
+ .end = S5P_PA_FIMC0 + S5P_SZ_FIMC0 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_FIMC0,
+ .end = IRQ_FIMC0,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device s3c_device_fimc0 = {
+ .name = "s3c-fimc",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(s3c_fimc0_resource),
+ .resource = s3c_fimc0_resource,
+};
+
+static struct s3c_platform_fimc default_fimc0_data __initdata = {
+ .default_cam = CAMERA_PAR_A,
+#if defined(CONFIG_CPU_S5PV210_EVT1)
+ .hw_ver = 0x45,
+#else
+ .hw_ver = 0x43,
+#endif
+};
+
+void __init s3c_fimc0_set_platdata(struct s3c_platform_fimc *pd)
+{
+ struct s3c_platform_fimc *npd;
+
+ if (!pd)
+ pd = &default_fimc0_data;
+
+ npd = kmemdup(pd, sizeof(struct s3c_platform_fimc), GFP_KERNEL);
+ if (!npd)
+ printk(KERN_ERR "%s: no memory for platform data\n", __func__);
+ else {
+ if (!npd->cfg_gpio)
+ npd->cfg_gpio = s3c_fimc0_cfg_gpio;
+
+ if (!npd->clk_on)
+ npd->clk_on = s3c_fimc_clk_on;
+
+ if (!npd->clk_off)
+ npd->clk_off = s3c_fimc_clk_off;
+#if defined(CONFIG_CPU_S5PV210_EVT1)
+ npd->hw_ver = 0x45;
+#else
+ npd->hw_ver = 0x43;
+#endif
+
+ s3c_device_fimc0.dev.platform_data = npd;
+ }
+}
+
+static struct resource s3c_fimc1_resource[] = {
+ [0] = {
+ .start = S5P_PA_FIMC1,
+ .end = S5P_PA_FIMC1 + S5P_SZ_FIMC1 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_FIMC1,
+ .end = IRQ_FIMC1,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device s3c_device_fimc1 = {
+ .name = "s3c-fimc",
+ .id = 1,
+ .num_resources = ARRAY_SIZE(s3c_fimc1_resource),
+ .resource = s3c_fimc1_resource,
+};
+
+static struct s3c_platform_fimc default_fimc1_data __initdata = {
+ .default_cam = CAMERA_PAR_A,
+#if defined(CONFIG_CPU_S5PV210_EVT1)
+ .hw_ver = 0x50,
+#else
+ .hw_ver = 0x43,
+#endif
+};
+
+void __init s3c_fimc1_set_platdata(struct s3c_platform_fimc *pd)
+{
+ struct s3c_platform_fimc *npd;
+
+ if (!pd)
+ pd = &default_fimc1_data;
+
+ npd = kmemdup(pd, sizeof(struct s3c_platform_fimc), GFP_KERNEL);
+ if (!npd)
+ printk(KERN_ERR "%s: no memory for platform data\n", __func__);
+ else {
+ if (!npd->cfg_gpio)
+ npd->cfg_gpio = s3c_fimc1_cfg_gpio;
+
+ if (!npd->clk_on)
+ npd->clk_on = s3c_fimc_clk_on;
+
+ if (!npd->clk_off)
+ npd->clk_off = s3c_fimc_clk_off;
+#if defined(CONFIG_CPU_S5PV210_EVT1)
+ npd->hw_ver = 0x50;
+#else
+ npd->hw_ver = 0x43;
+#endif
+
+ s3c_device_fimc1.dev.platform_data = npd;
+ }
+}
+
+static struct resource s3c_fimc2_resource[] = {
+ [0] = {
+ .start = S5P_PA_FIMC2,
+ .end = S5P_PA_FIMC2 + S5P_SZ_FIMC2 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_FIMC2,
+ .end = IRQ_FIMC2,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device s3c_device_fimc2 = {
+ .name = "s3c-fimc",
+ .id = 2,
+ .num_resources = ARRAY_SIZE(s3c_fimc2_resource),
+ .resource = s3c_fimc2_resource,
+};
+
+static struct s3c_platform_fimc default_fimc2_data __initdata = {
+ .default_cam = CAMERA_PAR_A,
+#if defined(CONFIG_CPU_S5PV210_EVT1)
+ .hw_ver = 0x45,
+#else
+ .hw_ver = 0x43,
+#endif
+};
+
+void __init s3c_fimc2_set_platdata(struct s3c_platform_fimc *pd)
+{
+ struct s3c_platform_fimc *npd;
+
+ if (!pd)
+ pd = &default_fimc2_data;
+
+ npd = kmemdup(pd, sizeof(struct s3c_platform_fimc), GFP_KERNEL);
+ if (!npd)
+ printk(KERN_ERR "%s: no memory for platform data\n", __func__);
+ else {
+ if (!npd->cfg_gpio)
+ npd->cfg_gpio = s3c_fimc2_cfg_gpio;
+
+ if (!npd->clk_on)
+ npd->clk_on = s3c_fimc_clk_on;
+
+ if (!npd->clk_off)
+ npd->clk_off = s3c_fimc_clk_off;
+#if defined(CONFIG_CPU_S5PV210_EVT1)
+ npd->hw_ver = 0x45;
+#else
+ npd->hw_ver = 0x43;
+#endif
+
+ s3c_device_fimc2.dev.platform_data = npd;
+ }
+}
+
+static struct resource s3c_ipc_resource[] = {
+ [0] = {
+ .start = S5P_PA_IPC,
+ .end = S5P_PA_IPC + S5P_SZ_IPC - 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+struct platform_device s3c_device_ipc = {
+ .name = "s3c-ipc",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(s3c_ipc_resource),
+ .resource = s3c_ipc_resource,
+};
+#endif
+
+#ifdef CONFIG_VIDEO_JPEG_V2
+/* JPEG controller */
+static struct resource s3c_jpeg_resource[] = {
+ [0] = {
+ .start = S5PV210_PA_JPEG,
+ .end = S5PV210_PA_JPEG + S5PV210_SZ_JPEG - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_JPEG,
+ .end = IRQ_JPEG,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+struct platform_device s3c_device_jpeg = {
+ .name = "s3c-jpg",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(s3c_jpeg_resource),
+ .resource = s3c_jpeg_resource,
+};
+EXPORT_SYMBOL(s3c_device_jpeg);
+#endif /* CONFIG_VIDEO_JPEG_V2 */
+
+#ifdef CONFIG_VIDEO_ROTATOR
+/* rotator interface */
+static struct resource s5p_rotator_resource[] = {
+ [0] = {
+ .start = S5P_PA_ROTATOR,
+ .end = S5P_PA_ROTATOR + S5P_SZ_ROTATOR - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_ROTATOR,
+ .end = IRQ_ROTATOR,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+struct platform_device s5p_device_rotator = {
+ .name = "s5p-rotator",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(s5p_rotator_resource),
+ .resource = s5p_rotator_resource
+};
+EXPORT_SYMBOL(s5p_device_rotator);
+#endif
+
+#ifdef CONFIG_VIDEO_TV20
+/* TVOUT interface */
+static struct resource s5p_tvout_resources[] = {
+ [0] = {
+ .start = S5P_PA_TVENC,
+ .end = S5P_PA_TVENC + S5P_SZ_TVENC - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = S5P_PA_VP,
+ .end = S5P_PA_VP + S5P_SZ_VP - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [2] = {
+ .start = S5P_PA_MIXER,
+ .end = S5P_PA_MIXER + S5P_SZ_MIXER - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [3] = {
+ .start = S5P_PA_HDMI,
+ .end = S5P_PA_HDMI + S5P_SZ_HDMI - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [4] = {
+ .start = S5P_I2C_HDMI_PHY,
+ .end = S5P_I2C_HDMI_PHY + S5P_I2C_HDMI_SZ_PHY - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [5] = {
+ .start = IRQ_MIXER,
+ .end = IRQ_MIXER,
+ .flags = IORESOURCE_IRQ,
+ },
+ [6] = {
+ .start = IRQ_HDMI,
+ .end = IRQ_HDMI,
+ .flags = IORESOURCE_IRQ,
+ },
+ [7] = {
+ .start = IRQ_TVENC,
+ .end = IRQ_TVENC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device s5p_device_tvout = {
+ .name = "s5p-tvout",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(s5p_tvout_resources),
+ .resource = s5p_tvout_resources,
+};
+EXPORT_SYMBOL(s5p_device_tvout);
+
+/* CEC */
+static struct resource s5p_cec_resources[] = {
+ [0] = {
+ .start = S5P_PA_CEC,
+ .end = S5P_PA_CEC + S5P_SZ_CEC - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_CEC,
+ .end = IRQ_CEC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device s5p_device_cec = {
+ .name = "s5p-cec",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(s5p_cec_resources),
+ .resource = s5p_cec_resources,
+};
+EXPORT_SYMBOL(s5p_device_cec);
+
+/* HPD */
+struct platform_device s5p_device_hpd = {
+ .name = "s5p-hpd",
+ .id = -1,
+};
+EXPORT_SYMBOL(s5p_device_hpd);
+#endif
+
+#ifdef CONFIG_USB_SUPPORT
+#ifdef CONFIG_USB_ARCH_HAS_EHCI
+ /* USB Host Controlle EHCI registrations */
+static struct resource s3c_usb__ehci_resource[] = {
+ [0] = {
+ .start = S5P_PA_USB_EHCI,
+ .end = S5P_PA_USB_EHCI + S5P_SZ_USB_EHCI - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_UHOST,
+ .end = IRQ_UHOST,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+static u64 s3c_device_usb_ehci_dmamask = 0xffffffffUL;
+
+struct platform_device s3c_device_usb_ehci = {
+ .name = "s5p-ehci",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(s3c_usb__ehci_resource),
+ .resource = s3c_usb__ehci_resource,
+ .dev = {
+ .dma_mask = &s3c_device_usb_ehci_dmamask,
+ .coherent_dma_mask = 0xffffffffUL
+ }
+};
+EXPORT_SYMBOL(s3c_device_usb_ehci);
+#endif /* CONFIG_USB_ARCH_HAS_EHCI */
+
+#ifdef CONFIG_USB_ARCH_HAS_OHCI
+/* USB Host Controlle OHCI registrations */
+static struct resource s3c_usb__ohci_resource[] = {
+ [0] = {
+ .start = S5P_PA_USB_OHCI,
+ .end = S5P_PA_USB_OHCI + S5P_SZ_USB_OHCI - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_UHOST,
+ .end = IRQ_UHOST,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+static u64 s3c_device_usb_ohci_dmamask = 0xffffffffUL;
+
+struct platform_device s3c_device_usb_ohci = {
+ .name = "s5p-ohci",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(s3c_usb__ohci_resource),
+ .resource = s3c_usb__ohci_resource,
+ .dev = {
+ .dma_mask = &s3c_device_usb_ohci_dmamask,
+ .coherent_dma_mask = 0xffffffffUL
+ }
+};
+EXPORT_SYMBOL(s3c_device_usb_ohci);
+#endif /* CONFIG_USB_ARCH_HAS_EHCI */
+
+/* USB Device (Gadget)*/
+static struct resource s3c_usbgadget_resource[] = {
+ [0] = {
+ .start = S3C_PA_OTG,
+ .end = S3C_PA_OTG + S3C_SZ_OTG - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_OTG,
+ .end = IRQ_OTG,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+struct platform_device s3c_device_usbgadget = {
+ .name = "s3c-usbgadget",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
+ .resource = s3c_usbgadget_resource,
+};
+EXPORT_SYMBOL(s3c_device_usbgadget);
+#endif
+