diff options
author | jake <jake@titicaca.localdomain> | 2010-07-31 10:28:23 +0900 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2011-11-16 19:56:16 -0800 |
commit | f9647853cb10e25adbc365957ca5c9e84c77105c (patch) | |
tree | af86f9717d57137c31d5af4a0ccd0afbcc4e01b2 /arch | |
parent | fbcc44d9abd0e32e92bc0053745503acda3cf9d2 (diff) | |
download | kernel_samsung_crespo-f9647853cb10e25adbc365957ca5c9e84c77105c.zip kernel_samsung_crespo-f9647853cb10e25adbc365957ca5c9e84c77105c.tar.gz kernel_samsung_crespo-f9647853cb10e25adbc365957ca5c9e84c77105c.tar.bz2 |
HERRING: DEV: Add devs.c file.
Change-Id: Id12baeeb30e512d040f8e32d4ce65bc587b6300e
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/plat-s5p/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-s5p/devs.c | 463 | ||||
-rw-r--r-- | arch/arm/plat-s5p/include/plat/csis.h | 29 | ||||
-rw-r--r-- | arch/arm/plat-s5p/include/plat/fimc.h | 122 |
4 files changed, 615 insertions, 0 deletions
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile index e234cc4..79f81e3 100644 --- a/arch/arm/plat-s5p/Makefile +++ b/arch/arm/plat-s5p/Makefile @@ -17,6 +17,7 @@ obj-y += dev-uart.o obj-y += cpu.o obj-y += clock.o obj-y += irq.o +obj-y += devs.o obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o obj-$(CONFIG_S5P_GPIO_INT) += irq-gpioint.o obj-$(CONFIG_S5P_SYSTEM_MMU) += sysmmu.o 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 + diff --git a/arch/arm/plat-s5p/include/plat/csis.h b/arch/arm/plat-s5p/include/plat/csis.h new file mode 100644 index 0000000..23a9b527b --- /dev/null +++ b/arch/arm/plat-s5p/include/plat/csis.h @@ -0,0 +1,29 @@ +/* linux/arch/arm/plat-s5p/include/plat/csis.h + * + * Copyright (c) 2010 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * S5PV210 - Platform header file for MIPI-CSI2 driver + * + * 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. + */ + +#ifndef __ASM_PLAT_CSIS_H +#define __ASM_PLAT_CSIS_H __FILE__ + +struct platform_device; + +struct s3c_platform_csis { + const char srclk_name[16]; + const char clk_name[16]; + unsigned long clk_rate; + + void (*cfg_gpio)(void); + void (*cfg_phy_global)(int on); +}; + +extern void s3c_csis_set_platdata(struct s3c_platform_csis *csis); + +#endif /* __ASM_PLAT_CSIS_H */ diff --git a/arch/arm/plat-s5p/include/plat/fimc.h b/arch/arm/plat-s5p/include/plat/fimc.h new file mode 100644 index 0000000..fc51547 --- /dev/null +++ b/arch/arm/plat-s5p/include/plat/fimc.h @@ -0,0 +1,122 @@ +/* linux/arch/arm/plat-s5p/include/plat/fimc.h + * + * Copyright 2010 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * Platform header file for Samsung Camera Interface (FIMC) driver + * + * 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. +*/ +#ifndef __ASM_PLAT_FIMC_H +#define __ASM_PLAT_FIMC_H __FILE__ + +#include <linux/videodev2.h> + +#define FIMC_SRC_MAX_W 1920 +#define FIMC_SRC_MAX_H 1088 + +struct platform_device; + +/* For exnternal camera device */ +enum fimc_cam_type { + CAM_TYPE_ITU = 0, + CAM_TYPE_MIPI = 1, +}; + +enum fimc_cam_format { + ITU_601_YCBCR422_8BIT = (1 << 31), + ITU_656_YCBCR422_8BIT = (0 << 31), + ITU_601_YCBCR422_16BIT = (1 << 29), + MIPI_CSI_YCBCR422_8BIT = 0x1e, + MIPI_CSI_RAW8 = 0x2a, + MIPI_CSI_RAW10 = 0x2b, + MIPI_CSI_RAW12 = 0x2c, + MIPI_USER_DEF_PACKET_1 = 0x30, /* User defined Byte-based packet 1 */ +}; + +enum fimc_cam_order422 { + CAM_ORDER422_8BIT_YCBYCR = (0 << 14), + CAM_ORDER422_8BIT_YCRYCB = (1 << 14), + CAM_ORDER422_8BIT_CBYCRY = (2 << 14), + CAM_ORDER422_8BIT_CRYCBY = (3 << 14), + CAM_ORDER422_16BIT_Y4CBCRCBCR = (0 << 14), + CAM_ORDER422_16BIT_Y4CRCBCRCB = (1 << 14), +}; + +enum fimc_cam_index { + CAMERA_PAR_A = 0, + CAMERA_PAR_B = 1, + CAMERA_CSI_C = 2, + CAMERA_PATTERN = 3, /* Not actual camera but test pattern */ + CAMERA_WB = 4, /* Not actual camera but write back */ +}; + +/* struct s3c_platform_camera: abstraction for input camera */ +struct s3c_platform_camera { + /* + * ITU cam A,B: 0,1 + * CSI-2 cam C: 2 + */ + enum fimc_cam_index id; + + enum fimc_cam_type type; /* ITU or MIPI */ + enum fimc_cam_format fmt; /* input format */ + enum fimc_cam_order422 order422; /* YCBCR422 order for ITU */ + u32 pixelformat; /* default fourcc */ + + int i2c_busnum; + struct i2c_board_info *info; + struct v4l2_subdev *sd; + + const char srclk_name[16]; /* source of mclk name */ + const char clk_name[16]; /* mclk name */ + u32 clk_rate; /* mclk ratio */ + struct clk *clk; /* mclk */ + int line_length; /* max length */ + int width; /* default resol */ + int height; /* default resol */ + struct v4l2_rect window; /* real cut region from source */ + + int mipi_lanes; /* MIPI data lanes */ + int mipi_settle; /* MIPI settle */ + int mipi_align; /* MIPI data align: 24/32 */ + + /* Polarity: 1 if inverted polarity used */ + int inv_pclk; + int inv_vsync; + int inv_href; + int inv_hsync; + + int initialized; + + /* Board specific power pin control */ + int (*cam_power)(int onoff); +}; + +/* For camera interface driver */ +struct s3c_platform_fimc { + enum fimc_cam_index default_cam; /* index of default cam */ + struct s3c_platform_camera *camera[5]; /* FIXME */ + int hw_ver; + + void (*cfg_gpio)(struct platform_device *pdev); + int (*clk_on)(struct platform_device *pdev, struct clk **clk); + int (*clk_off)(struct platform_device *pdev, struct clk **clk); +}; + +extern void s3c_fimc0_set_platdata(struct s3c_platform_fimc *fimc); +extern void s3c_fimc1_set_platdata(struct s3c_platform_fimc *fimc); +extern void s3c_fimc2_set_platdata(struct s3c_platform_fimc *fimc); + +/* defined by architecture to configure gpio */ +extern void s3c_fimc0_cfg_gpio(struct platform_device *pdev); +extern void s3c_fimc1_cfg_gpio(struct platform_device *pdev); +extern void s3c_fimc2_cfg_gpio(struct platform_device *pdev); + +/* platform specific clock functions */ +extern int s3c_fimc_clk_on(struct platform_device *pdev, struct clk **clk); +extern int s3c_fimc_clk_off(struct platform_device *pdev, struct clk **clk); + +#endif /*__ASM_PLAT_FIMC_H */ |