--- zzzz-none-000/linux-3.10.107/arch/arm/plat-samsung/devs.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/arch/arm/plat-samsung/devs.c 2021-02-04 17:41:59.000000000 +0000 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -30,8 +31,10 @@ #include #include #include +#include #include #include +#include #include @@ -40,7 +43,6 @@ #include #include -#include #include #include #include @@ -49,22 +51,21 @@ #include #include #include -#include #include #include -#include #include #include #include #include #include +#include #include #include #include #include #include -#include #include +#include #include static u64 samsung_device_dma_mask = DMA_BIT_MASK(32); @@ -74,9 +75,12 @@ static struct resource s3c_ac97_resource[] = { [0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97), [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97), - [2] = DEFINE_RES_DMA_NAMED(DMACH_PCM_OUT, "PCM out"), - [3] = DEFINE_RES_DMA_NAMED(DMACH_PCM_IN, "PCM in"), - [4] = DEFINE_RES_DMA_NAMED(DMACH_MIC_IN, "Mic in"), +}; + +static struct s3c_audio_pdata s3c_ac97_pdata = { + .dma_playback = (void *)DMACH_PCM_OUT, + .dma_capture = (void *)DMACH_PCM_IN, + .dma_capture_mic = (void *)DMACH_MIC_IN, }; struct platform_device s3c_device_ac97 = { @@ -87,6 +91,7 @@ .dev = { .dma_mask = &samsung_device_dma_mask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &s3c_ac97_pdata, } }; #endif /* CONFIG_CPU_S3C2440 */ @@ -144,23 +149,6 @@ }; #endif /* CONFIG_CPU_S3C2440 */ -/* ASOC DMA */ - -#ifdef CONFIG_PLAT_S5P -static struct resource samsung_asoc_idma_resource = DEFINE_RES_IRQ(IRQ_I2S0); - -struct platform_device samsung_asoc_idma = { - .name = "samsung-idma", - .id = -1, - .num_resources = 1, - .resource = &samsung_asoc_idma_resource, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - } -}; -#endif - /* FB */ #ifdef CONFIG_S3C_DEV_FB @@ -189,151 +177,6 @@ } #endif /* CONFIG_S3C_DEV_FB */ -/* FIMC */ - -#ifdef CONFIG_S5P_DEV_FIMC0 -static struct resource s5p_fimc0_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_FIMC0, SZ_4K), - [1] = DEFINE_RES_IRQ(IRQ_FIMC0), -}; - -struct platform_device s5p_device_fimc0 = { - .name = "s5p-fimc", - .id = 0, - .num_resources = ARRAY_SIZE(s5p_fimc0_resource), - .resource = s5p_fimc0_resource, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; - -struct platform_device s5p_device_fimc_md = { - .name = "s5p-fimc-md", - .id = -1, -}; -#endif /* CONFIG_S5P_DEV_FIMC0 */ - -#ifdef CONFIG_S5P_DEV_FIMC1 -static struct resource s5p_fimc1_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_FIMC1, SZ_4K), - [1] = DEFINE_RES_IRQ(IRQ_FIMC1), -}; - -struct platform_device s5p_device_fimc1 = { - .name = "s5p-fimc", - .id = 1, - .num_resources = ARRAY_SIZE(s5p_fimc1_resource), - .resource = s5p_fimc1_resource, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; -#endif /* CONFIG_S5P_DEV_FIMC1 */ - -#ifdef CONFIG_S5P_DEV_FIMC2 -static struct resource s5p_fimc2_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_FIMC2, SZ_4K), - [1] = DEFINE_RES_IRQ(IRQ_FIMC2), -}; - -struct platform_device s5p_device_fimc2 = { - .name = "s5p-fimc", - .id = 2, - .num_resources = ARRAY_SIZE(s5p_fimc2_resource), - .resource = s5p_fimc2_resource, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; -#endif /* CONFIG_S5P_DEV_FIMC2 */ - -#ifdef CONFIG_S5P_DEV_FIMC3 -static struct resource s5p_fimc3_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_FIMC3, SZ_4K), - [1] = DEFINE_RES_IRQ(IRQ_FIMC3), -}; - -struct platform_device s5p_device_fimc3 = { - .name = "s5p-fimc", - .id = 3, - .num_resources = ARRAY_SIZE(s5p_fimc3_resource), - .resource = s5p_fimc3_resource, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; -#endif /* CONFIG_S5P_DEV_FIMC3 */ - -/* G2D */ - -#ifdef CONFIG_S5P_DEV_G2D -static struct resource s5p_g2d_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_G2D, SZ_4K), - [1] = DEFINE_RES_IRQ(IRQ_2D), -}; - -struct platform_device s5p_device_g2d = { - .name = "s5p-g2d", - .id = 0, - .num_resources = ARRAY_SIZE(s5p_g2d_resource), - .resource = s5p_g2d_resource, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; -#endif /* CONFIG_S5P_DEV_G2D */ - -#ifdef CONFIG_S5P_DEV_JPEG -static struct resource s5p_jpeg_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_JPEG, SZ_4K), - [1] = DEFINE_RES_IRQ(IRQ_JPEG), -}; - -struct platform_device s5p_device_jpeg = { - .name = "s5p-jpeg", - .id = 0, - .num_resources = ARRAY_SIZE(s5p_jpeg_resource), - .resource = s5p_jpeg_resource, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; -#endif /* CONFIG_S5P_DEV_JPEG */ - -/* FIMD0 */ - -#ifdef CONFIG_S5P_DEV_FIMD0 -static struct resource s5p_fimd0_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_FIMD0, SZ_32K), - [1] = DEFINE_RES_IRQ_NAMED(IRQ_FIMD0_VSYNC, "vsync"), - [2] = DEFINE_RES_IRQ_NAMED(IRQ_FIMD0_FIFO, "fifo"), - [3] = DEFINE_RES_IRQ_NAMED(IRQ_FIMD0_SYSTEM, "lcd_sys"), -}; - -struct platform_device s5p_device_fimd0 = { - .name = "s5p-fb", - .id = 0, - .num_resources = ARRAY_SIZE(s5p_fimd0_resource), - .resource = s5p_fimd0_resource, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; - -void __init s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd) -{ - s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata), - &s5p_device_fimd0); -} -#endif /* CONFIG_S5P_DEV_FIMD0 */ - /* HWMON */ #ifdef CONFIG_S3C_DEV_HWMON @@ -721,66 +564,6 @@ } #endif /* CONFIG_S3C_DEV_I2C7 */ -/* I2C HDMIPHY */ - -#ifdef CONFIG_S5P_DEV_I2C_HDMIPHY -static struct resource s5p_i2c_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_IIC_HDMIPHY, SZ_4K), - [1] = DEFINE_RES_IRQ(IRQ_IIC_HDMIPHY), -}; - -struct platform_device s5p_device_i2c_hdmiphy = { - .name = "s3c2440-hdmiphy-i2c", - .id = -1, - .num_resources = ARRAY_SIZE(s5p_i2c_resource), - .resource = s5p_i2c_resource, -}; - -void __init s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *pd) -{ - struct s3c2410_platform_i2c *npd; - - if (!pd) { - pd = &default_i2c_data; - - if (soc_is_exynos4210() || - soc_is_exynos4212() || soc_is_exynos4412()) - pd->bus_num = 8; - else if (soc_is_s5pv210()) - pd->bus_num = 3; - else - pd->bus_num = 0; - } - - npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), - &s5p_device_i2c_hdmiphy); -} - -static struct s5p_hdmi_platform_data s5p_hdmi_def_platdata; - -void __init s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info, - struct i2c_board_info *mhl_info, int mhl_bus) -{ - struct s5p_hdmi_platform_data *pd = &s5p_hdmi_def_platdata; - - if (soc_is_exynos4210() || - soc_is_exynos4212() || soc_is_exynos4412()) - pd->hdmiphy_bus = 8; - else if (soc_is_s5pv210()) - pd->hdmiphy_bus = 3; - else - pd->hdmiphy_bus = 0; - - pd->hdmiphy_info = hdmiphy_info; - pd->mhl_info = mhl_info; - pd->mhl_bus = mhl_bus; - - s3c_set_platdata(pd, sizeof(struct s5p_hdmi_platform_data), - &s5p_device_hdmi); -} - -#endif /* CONFIG_S5P_DEV_I2C_HDMIPHY */ - /* I2S */ #ifdef CONFIG_PLAT_S3C24XX @@ -884,36 +667,6 @@ } #endif /* CONFIG_PLAT_S3C24XX */ -/* MIPI CSIS */ - -#ifdef CONFIG_S5P_DEV_CSIS0 -static struct resource s5p_mipi_csis0_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS0, SZ_16K), - [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS0), -}; - -struct platform_device s5p_device_mipi_csis0 = { - .name = "s5p-mipi-csis", - .id = 0, - .num_resources = ARRAY_SIZE(s5p_mipi_csis0_resource), - .resource = s5p_mipi_csis0_resource, -}; -#endif /* CONFIG_S5P_DEV_CSIS0 */ - -#ifdef CONFIG_S5P_DEV_CSIS1 -static struct resource s5p_mipi_csis1_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS1, SZ_16K), - [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS1), -}; - -struct platform_device s5p_device_mipi_csis1 = { - .name = "s5p-mipi-csis", - .id = 1, - .num_resources = ARRAY_SIZE(s5p_mipi_csis1_resource), - .resource = s5p_mipi_csis1_resource, -}; -#endif - /* NAND */ #ifdef CONFIG_S3C_DEV_NAND @@ -1057,76 +810,24 @@ } #endif /* CONFIG_S3C64XX_DEV_ONENAND1 */ -#ifdef CONFIG_S5P_DEV_ONENAND -static struct resource s5p_onenand_resources[] = { - [0] = DEFINE_RES_MEM(S5P_PA_ONENAND, SZ_128K), - [1] = DEFINE_RES_MEM(S5P_PA_ONENAND_DMA, SZ_8K), - [2] = DEFINE_RES_IRQ(IRQ_ONENAND_AUDI), -}; - -struct platform_device s5p_device_onenand = { - .name = "s5pc110-onenand", - .id = -1, - .num_resources = ARRAY_SIZE(s5p_onenand_resources), - .resource = s5p_onenand_resources, -}; -#endif /* CONFIG_S5P_DEV_ONENAND */ - -/* PMU */ +/* PWM Timer */ -#if defined(CONFIG_PLAT_S5P) && !defined(CONFIG_ARCH_EXYNOS) -static struct resource s5p_pmu_resource[] = { - DEFINE_RES_IRQ(IRQ_PMU) +#ifdef CONFIG_SAMSUNG_DEV_PWM +static struct resource samsung_pwm_resource[] = { + DEFINE_RES_MEM(SAMSUNG_PA_TIMER, SZ_4K), }; -static struct platform_device s5p_device_pmu = { - .name = "arm-pmu", +struct platform_device samsung_device_pwm = { + .name = "samsung-pwm", .id = -1, - .num_resources = ARRAY_SIZE(s5p_pmu_resource), - .resource = s5p_pmu_resource, + .num_resources = ARRAY_SIZE(samsung_pwm_resource), + .resource = samsung_pwm_resource, }; -static int __init s5p_pmu_init(void) +void __init samsung_pwm_set_platdata(struct samsung_pwm_variant *pd) { - platform_device_register(&s5p_device_pmu); - return 0; + samsung_device_pwm.dev.platform_data = pd; } -arch_initcall(s5p_pmu_init); -#endif /* CONFIG_PLAT_S5P */ - -/* PWM Timer */ - -#ifdef CONFIG_SAMSUNG_DEV_PWM - -#define TIMER_RESOURCE_SIZE (1) - -#define TIMER_RESOURCE(_tmr, _irq) \ - (struct resource [TIMER_RESOURCE_SIZE]) { \ - [0] = { \ - .start = _irq, \ - .end = _irq, \ - .flags = IORESOURCE_IRQ \ - } \ - } - -#define DEFINE_S3C_TIMER(_tmr_no, _irq) \ - .name = "s3c24xx-pwm", \ - .id = _tmr_no, \ - .num_resources = TIMER_RESOURCE_SIZE, \ - .resource = TIMER_RESOURCE(_tmr_no, _irq), \ - -/* - * since we already have an static mapping for the timer, - * we do not bother setting any IO resource for the base. - */ - -struct platform_device s3c_device_timer[] = { - [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) }, - [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) }, - [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) }, - [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) }, - [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) }, -}; #endif /* CONFIG_SAMSUNG_DEV_PWM */ /* RTC */ @@ -1271,52 +972,6 @@ } #endif /* CONFIG_SAMSUNG_DEV_TS */ -/* TV */ - -#ifdef CONFIG_S5P_DEV_TV - -static struct resource s5p_hdmi_resources[] = { - [0] = DEFINE_RES_MEM(S5P_PA_HDMI, SZ_1M), - [1] = DEFINE_RES_IRQ(IRQ_HDMI), -}; - -struct platform_device s5p_device_hdmi = { - .name = "s5p-hdmi", - .id = -1, - .num_resources = ARRAY_SIZE(s5p_hdmi_resources), - .resource = s5p_hdmi_resources, -}; - -static struct resource s5p_sdo_resources[] = { - [0] = DEFINE_RES_MEM(S5P_PA_SDO, SZ_64K), - [1] = DEFINE_RES_IRQ(IRQ_SDO), -}; - -struct platform_device s5p_device_sdo = { - .name = "s5p-sdo", - .id = -1, - .num_resources = ARRAY_SIZE(s5p_sdo_resources), - .resource = s5p_sdo_resources, -}; - -static struct resource s5p_mixer_resources[] = { - [0] = DEFINE_RES_MEM_NAMED(S5P_PA_MIXER, SZ_64K, "mxr"), - [1] = DEFINE_RES_MEM_NAMED(S5P_PA_VP, SZ_64K, "vp"), - [2] = DEFINE_RES_IRQ_NAMED(IRQ_MIXER, "irq"), -}; - -struct platform_device s5p_device_mixer = { - .name = "s5p-mixer", - .id = -1, - .num_resources = ARRAY_SIZE(s5p_mixer_resources), - .resource = s5p_mixer_resources, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - } -}; -#endif /* CONFIG_S5P_DEV_TV */ - /* USB */ #ifdef CONFIG_S3C_DEV_USB_HOST @@ -1373,39 +1028,6 @@ } #endif /* CONFIG_PLAT_S3C24XX */ -/* USB EHCI Host Controller */ - -#ifdef CONFIG_S5P_DEV_USB_EHCI -static struct resource s5p_ehci_resource[] = { - [0] = DEFINE_RES_MEM(S5P_PA_EHCI, SZ_256), - [1] = DEFINE_RES_IRQ(IRQ_USB_HOST), -}; - -struct platform_device s5p_device_ehci = { - .name = "s5p-ehci", - .id = -1, - .num_resources = ARRAY_SIZE(s5p_ehci_resource), - .resource = s5p_ehci_resource, - .dev = { - .dma_mask = &samsung_device_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(32), - } -}; - -void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd) -{ - struct s5p_ehci_platdata *npd; - - npd = s3c_set_platdata(pd, sizeof(struct s5p_ehci_platdata), - &s5p_device_ehci); - - if (!npd->phy_init) - npd->phy_init = s5p_usb_phy_init; - if (!npd->phy_exit) - npd->phy_exit = s5p_usb_phy_exit; -} -#endif /* CONFIG_S5P_DEV_USB_EHCI */ - /* USB HSOTG */ #ifdef CONFIG_S3C_DEV_USB_HSOTG @@ -1425,11 +1047,11 @@ }, }; -void __init s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd) +void __init dwc2_hsotg_set_platdata(struct dwc2_hsotg_plat *pd) { - struct s3c_hsotg_plat *npd; + struct dwc2_hsotg_plat *npd; - npd = s3c_set_platdata(pd, sizeof(struct s3c_hsotg_plat), + npd = s3c_set_platdata(pd, sizeof(struct dwc2_hsotg_plat), &s3c_device_usb_hsotg); if (!npd->phy_init) @@ -1513,8 +1135,12 @@ pd.num_cs = num_cs; pd.src_clk_nr = src_clk_nr; pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio; -#ifdef CONFIG_PL330_DMA +#if defined(CONFIG_PL330_DMA) pd.filter = pl330_filter; +#elif defined(CONFIG_S3C64XX_PL080) + pd.filter = pl08x_filter_id; +#elif defined(CONFIG_S3C24XX_DMAC) + pd.filter = s3c24xx_dma_filter; #endif s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0); @@ -1554,8 +1180,10 @@ pd.num_cs = num_cs; pd.src_clk_nr = src_clk_nr; pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio; -#ifdef CONFIG_PL330_DMA +#if defined(CONFIG_PL330_DMA) pd.filter = pl330_filter; +#elif defined(CONFIG_S3C64XX_PL080) + pd.filter = pl08x_filter_id; #endif s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1); @@ -1595,8 +1223,10 @@ pd.num_cs = num_cs; pd.src_clk_nr = src_clk_nr; pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio; -#ifdef CONFIG_PL330_DMA +#if defined(CONFIG_PL330_DMA) pd.filter = pl330_filter; +#elif defined(CONFIG_S3C64XX_PL080) + pd.filter = pl08x_filter_id; #endif s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);