~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-imx/devices/platform-ipu-core.c

Version: ~ [ linux-5.9-rc6 ] ~ [ linux-5.8.10 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.66 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.146 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.198 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.236 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.236 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2011 Pengutronix
  3  * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
  4  *
  5  * This program is free software; you can redistribute it and/or modify it under
  6  * the terms of the GNU General Public License version 2 as published by the
  7  * Free Software Foundation.
  8  */
  9 #include <linux/dma-mapping.h>
 10 
 11 #include "../hardware.h"
 12 #include "devices-common.h"
 13 
 14 #define imx_ipu_core_entry_single(soc)                                  \
 15 {                                                                       \
 16         .iobase = soc ## _IPU_CTRL_BASE_ADDR,                           \
 17         .synirq = soc ## _INT_IPU_SYN,                                  \
 18         .errirq = soc ## _INT_IPU_ERR,                                  \
 19 }
 20 
 21 #ifdef CONFIG_SOC_IMX31
 22 const struct imx_ipu_core_data imx31_ipu_core_data __initconst =
 23         imx_ipu_core_entry_single(MX31);
 24 #endif
 25 
 26 #ifdef CONFIG_SOC_IMX35
 27 const struct imx_ipu_core_data imx35_ipu_core_data __initconst =
 28         imx_ipu_core_entry_single(MX35);
 29 #endif
 30 
 31 static struct platform_device *imx_ipu_coredev __initdata;
 32 
 33 struct platform_device *__init imx_add_ipu_core(
 34                 const struct imx_ipu_core_data *data)
 35 {
 36         /* The resource order is important! */
 37         struct resource res[] = {
 38                 {
 39                         .start = data->iobase,
 40                         .end = data->iobase + 0x5f,
 41                         .flags = IORESOURCE_MEM,
 42                 }, {
 43                         .start = data->iobase + 0x88,
 44                         .end = data->iobase + 0xb3,
 45                         .flags = IORESOURCE_MEM,
 46                 }, {
 47                         .start = data->synirq,
 48                         .end = data->synirq,
 49                         .flags = IORESOURCE_IRQ,
 50                 }, {
 51                         .start = data->errirq,
 52                         .end = data->errirq,
 53                         .flags = IORESOURCE_IRQ,
 54                 },
 55         };
 56 
 57         return imx_ipu_coredev = imx_add_platform_device("ipu-core", -1,
 58                         res, ARRAY_SIZE(res), NULL, 0);
 59 }
 60 
 61 struct platform_device *__init imx_alloc_mx3_camera(
 62                 const struct imx_ipu_core_data *data,
 63                 const struct mx3_camera_pdata *pdata)
 64 {
 65         struct resource res[] = {
 66                 {
 67                         .start = data->iobase + 0x60,
 68                         .end = data->iobase + 0x87,
 69                         .flags = IORESOURCE_MEM,
 70                 },
 71         };
 72         int ret = -ENOMEM;
 73         struct platform_device *pdev;
 74 
 75         if (IS_ERR_OR_NULL(imx_ipu_coredev))
 76                 return ERR_PTR(-ENODEV);
 77 
 78         pdev = platform_device_alloc("mx3-camera", 0);
 79         if (!pdev)
 80                 return ERR_PTR(-ENOMEM);
 81 
 82         pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
 83         if (!pdev->dev.dma_mask)
 84                 goto err;
 85 
 86         *pdev->dev.dma_mask = DMA_BIT_MASK(32);
 87         pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 88 
 89         ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
 90         if (ret)
 91                 goto err;
 92 
 93         if (pdata) {
 94                 struct mx3_camera_pdata *copied_pdata;
 95 
 96                 ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
 97                 if (ret) {
 98 err:
 99                         kfree(pdev->dev.dma_mask);
100                         platform_device_put(pdev);
101                         return ERR_PTR(-ENODEV);
102                 }
103                 copied_pdata = dev_get_platdata(&pdev->dev);
104                 copied_pdata->dma_dev = &imx_ipu_coredev->dev;
105         }
106 
107         return pdev;
108 }
109 
110 struct platform_device *__init imx_add_mx3_sdc_fb(
111                 const struct imx_ipu_core_data *data,
112                 struct mx3fb_platform_data *pdata)
113 {
114         struct resource res[] = {
115                 {
116                         .start = data->iobase + 0xb4,
117                         .end = data->iobase + 0x1bf,
118                         .flags = IORESOURCE_MEM,
119                 },
120         };
121 
122         if (IS_ERR_OR_NULL(imx_ipu_coredev))
123                 return ERR_PTR(-ENODEV);
124 
125         pdata->dma_dev = &imx_ipu_coredev->dev;
126 
127         return imx_add_platform_device_dmamask("mx3_sdc_fb", -1,
128                         res, ARRAY_SIZE(res), pdata, sizeof(*pdata),
129                         DMA_BIT_MASK(32));
130 }
131 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp