* mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
@ 2011-07-29 7:31 Jan Pohanka
2011-07-29 7:51 ` Uwe Kleine-König
0 siblings, 1 reply; 11+ messages in thread
From: Jan Pohanka @ 2011-07-29 7:31 UTC (permalink / raw)
To: linux-media; +Cc: s.hauer
Dear all,
I'm playing with imx27ipcam reference design and I would like to use more
recent (or actual) kernel than the one in BSP (2.6.19). I had no problems
with running 2.6.39 version from mainline, and now I want to get some
signal from CMOS chip. As there is no driver for mt9d131 yet I modified
the mt9m111 driver to communicate wit it.
Driver gets correctly initialized
mx2-camera mx2-camera.0: initialising
mx2-camera mx2-camera.0: Camera clock frequency: 6250000
mx2-camera mx2-camera.0: Using EMMA
camera 0-0: Probing 0-0
mx27ipcam_camera_power: 1
mx27ipcam_camera_reset
mx2-camera mx2-camera.0: Camera driver attached to camera 0
mt9m111 0-0048: read reg.000 -> 1519
mt9m111 0-0048: Detected a MT9D131 chip ID 1519
camera 0-0: Found 8 supported formats.
mx2-camera mx2-camera.0: Camera driver detached from camera 0
mx27ipcam_camera_power: 0
mx2-camera mx2-camera.0: MX2 Camera (CSI) driver probed, clock frequency:
6250000
For example this command should capture several frames
ffmpeg -s qvga -r 30 -t 2 -pix_fmt yuyv422 -f video4linux2 -i /dev/video0
temp_vid.h263
however there is some problems with dma_contig allocation
mx2-camera mx2-camera.0: dma_alloc_coherent size 155648 failed
[video4linux2 @ 0xfa8c50]mmap: Cannot allocate memory
/dev/video0: Input/output error
...
camera 0-0: mmap called, vma=0xc397fd30
camera 0-0: vma start=0x4014c000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397fcd8
camera 0-0: vma start=0x40ee8000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397fc80
camera 0-0: vma start=0x40fa4000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397fc28
camera 0-0: vma start=0x4109a000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397fbd0
camera 0-0: vma start=0x41124000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397fb78
camera 0-0: vma start=0x4118a000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397fb20
camera 0-0: vma start=0x41241000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397fac8
camera 0-0: vma start=0x41277000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397fa70
camera 0-0: vma start=0x412c3000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397fa18
camera 0-0: vma start=0x41377000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397f9c0
camera 0-0: vma start=0x41416000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397f968
camera 0-0: vma start=0x4147f000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397f910
camera 0-0: vma start=0x414a5000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397f8b8
camera 0-0: vma start=0x41542000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397f860
camera 0-0: vma start=0x415ba000, size=155648, ret=0
camera 0-0: mmap called, vma=0xc397f808
mx2-camera mx2-camera.0: dma_alloc_coherent size 155648 failed
camera 0-0: vma start=0x41667000, size=155648, ret=-12
mx2-camera mx2-camera.0: Camera driver detached from camera 0
mx27ipcam_camera_power: 0
camera 0-0: camera device close
It seems like there is no dma buffer initialized for mx2_camera driver.
Could please anyone give me some hint how to deal with it?
regards
Jan
--
Tato zpráva byla vytvořena převratným poštovním klientem Opery:
http://www.opera.com/mail/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-07-29 7:31 mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed Jan Pohanka
@ 2011-07-29 7:51 ` Uwe Kleine-König
2011-07-29 8:59 ` Jan Pohanka
0 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2011-07-29 7:51 UTC (permalink / raw)
To: Jan Pohanka; +Cc: linux-media, s.hauer
Hello,
On Fri, Jul 29, 2011 at 09:31:28AM +0200, Jan Pohanka wrote:
> I'm playing with imx27ipcam reference design and I would like to use
> more recent (or actual) kernel than the one in BSP (2.6.19). I had
> no problems with running 2.6.39 version from mainline, and now I
> want to get some signal from CMOS chip. As there is no driver for
> mt9d131 yet I modified the mt9m111 driver to communicate wit it.
> Driver gets correctly initialized
>
> mx2-camera mx2-camera.0: initialising
> mx2-camera mx2-camera.0: Camera clock frequency: 6250000
> mx2-camera mx2-camera.0: Using EMMA
> camera 0-0: Probing 0-0
> mx27ipcam_camera_power: 1
> mx27ipcam_camera_reset
> mx2-camera mx2-camera.0: Camera driver attached to camera 0
> mt9m111 0-0048: read reg.000 -> 1519
> mt9m111 0-0048: Detected a MT9D131 chip ID 1519
> camera 0-0: Found 8 supported formats.
> mx2-camera mx2-camera.0: Camera driver detached from camera 0
> mx27ipcam_camera_power: 0
> mx2-camera mx2-camera.0: MX2 Camera (CSI) driver probed, clock
> frequency: 6250000
>
> For example this command should capture several frames
> ffmpeg -s qvga -r 30 -t 2 -pix_fmt yuyv422 -f video4linux2 -i
> /dev/video0 temp_vid.h263
>
> however there is some problems with dma_contig allocation
> mx2-camera mx2-camera.0: dma_alloc_coherent size 155648 failed
> [video4linux2 @ 0xfa8c50]mmap: Cannot allocate memory
> /dev/video0: Input/output error
>
> ...
> camera 0-0: mmap called, vma=0xc397fd30
> camera 0-0: vma start=0x4014c000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397fcd8
> camera 0-0: vma start=0x40ee8000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397fc80
> camera 0-0: vma start=0x40fa4000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397fc28
> camera 0-0: vma start=0x4109a000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397fbd0
> camera 0-0: vma start=0x41124000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397fb78
> camera 0-0: vma start=0x4118a000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397fb20
> camera 0-0: vma start=0x41241000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397fac8
> camera 0-0: vma start=0x41277000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397fa70
> camera 0-0: vma start=0x412c3000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397fa18
> camera 0-0: vma start=0x41377000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397f9c0
> camera 0-0: vma start=0x41416000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397f968
> camera 0-0: vma start=0x4147f000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397f910
> camera 0-0: vma start=0x414a5000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397f8b8
> camera 0-0: vma start=0x41542000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397f860
> camera 0-0: vma start=0x415ba000, size=155648, ret=0
> camera 0-0: mmap called, vma=0xc397f808
> mx2-camera mx2-camera.0: dma_alloc_coherent size 155648 failed
> camera 0-0: vma start=0x41667000, size=155648, ret=-12
> mx2-camera mx2-camera.0: Camera driver detached from camera 0
> mx27ipcam_camera_power: 0
> camera 0-0: camera device close
Check out what arch/arm/mach-imx/mach-pcm037.c does to give some memory
to the camera device.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-07-29 7:51 ` Uwe Kleine-König
@ 2011-07-29 8:59 ` Jan Pohanka
2011-07-29 9:23 ` Uwe Kleine-König
0 siblings, 1 reply; 11+ messages in thread
From: Jan Pohanka @ 2011-07-29 8:59 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-media, s.hauer
Hi Uwe,
thank you for answer. You are right I give no memory to camera device in
mach-imx27ipcam.c. I have tried to do it in same way as it is in
mach-pcm037.c but no success. Here is my init function
static int __init mx27ipcam_camera_init(void) {
int dma, ret = -ENOMEM;
struct platform_device *pdev;
printk("MX2 camera initialization.\n");
pdev = imx27_add_mx2_camera(&mx27ipcam_camera);
if (IS_ERR(pdev)) {
printk("pdev error\n");
return PTR_ERR(pdev);
}
dma = dma_declare_coherent_memory(&pdev->dev,
mx2_camera_base, mx2_camera_base,
MX2_CAMERA_BUF_SIZE,
DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
if (!(dma & DMA_MEMORY_MAP))
goto err;
ret = platform_device_add(pdev);
if (ret) {
printk("platform_device_add error\n");
err:
platform_device_put(pdev);
}
return ret;
}
I do not understand fully this business around allocation so it may be
wrong.
regards
Jan
Dne Fri, 29 Jul 2011 09:51:43 +0200 Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> napsal(a):
> Hello,
>
> On Fri, Jul 29, 2011 at 09:31:28AM +0200, Jan Pohanka wrote:
>> I'm playing with imx27ipcam reference design and I would like to use
>> more recent (or actual) kernel than the one in BSP (2.6.19). I had
>> no problems with running 2.6.39 version from mainline, and now I
>> want to get some signal from CMOS chip. As there is no driver for
>> mt9d131 yet I modified the mt9m111 driver to communicate wit it.
>> Driver gets correctly initialized
>>
>> mx2-camera mx2-camera.0: initialising
>> mx2-camera mx2-camera.0: Camera clock frequency: 6250000
>> mx2-camera mx2-camera.0: Using EMMA
>> camera 0-0: Probing 0-0
>> mx27ipcam_camera_power: 1
>> mx27ipcam_camera_reset
>> mx2-camera mx2-camera.0: Camera driver attached to camera 0
>> mt9m111 0-0048: read reg.000 -> 1519
>> mt9m111 0-0048: Detected a MT9D131 chip ID 1519
>> camera 0-0: Found 8 supported formats.
>> mx2-camera mx2-camera.0: Camera driver detached from camera 0
>> mx27ipcam_camera_power: 0
>> mx2-camera mx2-camera.0: MX2 Camera (CSI) driver probed, clock
>> frequency: 6250000
>>
>> For example this command should capture several frames
>> ffmpeg -s qvga -r 30 -t 2 -pix_fmt yuyv422 -f video4linux2 -i
>> /dev/video0 temp_vid.h263
>>
>> however there is some problems with dma_contig allocation
>> mx2-camera mx2-camera.0: dma_alloc_coherent size 155648 failed
>> [video4linux2 @ 0xfa8c50]mmap: Cannot allocate memory
>> /dev/video0: Input/output error
>>
>> ...
>> camera 0-0: mmap called, vma=0xc397fd30
>> camera 0-0: vma start=0x4014c000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397fcd8
>> camera 0-0: vma start=0x40ee8000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397fc80
>> camera 0-0: vma start=0x40fa4000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397fc28
>> camera 0-0: vma start=0x4109a000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397fbd0
>> camera 0-0: vma start=0x41124000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397fb78
>> camera 0-0: vma start=0x4118a000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397fb20
>> camera 0-0: vma start=0x41241000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397fac8
>> camera 0-0: vma start=0x41277000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397fa70
>> camera 0-0: vma start=0x412c3000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397fa18
>> camera 0-0: vma start=0x41377000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397f9c0
>> camera 0-0: vma start=0x41416000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397f968
>> camera 0-0: vma start=0x4147f000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397f910
>> camera 0-0: vma start=0x414a5000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397f8b8
>> camera 0-0: vma start=0x41542000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397f860
>> camera 0-0: vma start=0x415ba000, size=155648, ret=0
>> camera 0-0: mmap called, vma=0xc397f808
>> mx2-camera mx2-camera.0: dma_alloc_coherent size 155648 failed
>> camera 0-0: vma start=0x41667000, size=155648, ret=-12
>> mx2-camera mx2-camera.0: Camera driver detached from camera 0
>> mx27ipcam_camera_power: 0
>> camera 0-0: camera device close
> Check out what arch/arm/mach-imx/mach-pcm037.c does to give some memory
> to the camera device.
>
> Best regards
> Uwe
>
--
Tato zpráva byla vytvořena převratným poštovním klientem Opery:
http://www.opera.com/mail/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-07-29 8:59 ` Jan Pohanka
@ 2011-07-29 9:23 ` Uwe Kleine-König
2011-07-29 10:14 ` Jan Pohanka
0 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2011-07-29 9:23 UTC (permalink / raw)
To: Jan Pohanka; +Cc: linux-media, s.hauer
Hi Jan,
On Fri, Jul 29, 2011 at 10:59:55AM +0200, Jan Pohanka wrote:
> thank you for answer. You are right I give no memory to camera
> device in mach-imx27ipcam.c. I have tried to do it in same way as it
> is in mach-pcm037.c but no success. Here is my init function
>
> static int __init mx27ipcam_camera_init(void) {
> int dma, ret = -ENOMEM;
> struct platform_device *pdev;
>
> printk("MX2 camera initialization.\n");
>
> pdev = imx27_add_mx2_camera(&mx27ipcam_camera);
>
> if (IS_ERR(pdev)) {
> printk("pdev error\n");
> return PTR_ERR(pdev);
> }
>
> dma = dma_declare_coherent_memory(&pdev->dev,
> mx2_camera_base, mx2_camera_base,
> MX2_CAMERA_BUF_SIZE,
> DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
> if (!(dma & DMA_MEMORY_MAP))
> goto err;
>
>
> ret = platform_device_add(pdev);
> if (ret) {
> printk("platform_device_add error\n");
>
> err:
> platform_device_put(pdev);
> }
>
> return ret;
> }
and you also have a reserve callback? See commit
90026c8c823bff54172eab33a5e7fcecfd3df635 for all details.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-07-29 9:23 ` Uwe Kleine-König
@ 2011-07-29 10:14 ` Jan Pohanka
2011-07-29 11:57 ` Uwe Kleine-König
0 siblings, 1 reply; 11+ messages in thread
From: Jan Pohanka @ 2011-07-29 10:14 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-media, s.hauer
Dear Uwe,
which repository should I search 90026c8c823bff54172eab33a5e7fcecfd3df635
in? I have not found it in git.pengutronix.de/git/imx/linux-2.6.git nor in
vanilla sources.
regards Jan
Dne Fri, 29 Jul 2011 11:23:12 +0200 Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> napsal(a):
> Hi Jan,
>
> On Fri, Jul 29, 2011 at 10:59:55AM +0200, Jan Pohanka wrote:
>> thank you for answer. You are right I give no memory to camera
>> device in mach-imx27ipcam.c. I have tried to do it in same way as it
>> is in mach-pcm037.c but no success. Here is my init function
>>
>> static int __init mx27ipcam_camera_init(void) {
>> int dma, ret = -ENOMEM;
>> struct platform_device *pdev;
>>
>> printk("MX2 camera initialization.\n");
>>
>> pdev = imx27_add_mx2_camera(&mx27ipcam_camera);
>>
>> if (IS_ERR(pdev)) {
>> printk("pdev error\n");
>> return PTR_ERR(pdev);
>> }
>>
>> dma = dma_declare_coherent_memory(&pdev->dev,
>> mx2_camera_base, mx2_camera_base,
>> MX2_CAMERA_BUF_SIZE,
>> DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
>> if (!(dma & DMA_MEMORY_MAP))
>> goto err;
>>
>>
>> ret = platform_device_add(pdev);
>> if (ret) {
>> printk("platform_device_add error\n");
>>
>> err:
>> platform_device_put(pdev);
>> }
>>
>> return ret;
>> }
> and you also have a reserve callback? See commit
> 90026c8c823bff54172eab33a5e7fcecfd3df635 for all details.
>
> Best regards
> Uwe
>
--
Tato zpráva byla vytvořena převratným poštovním klientem Opery:
http://www.opera.com/mail/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-07-29 10:14 ` Jan Pohanka
@ 2011-07-29 11:57 ` Uwe Kleine-König
2011-08-01 6:58 ` Jan Pohanka
2011-08-04 13:11 ` Jan Pohanka
0 siblings, 2 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2011-07-29 11:57 UTC (permalink / raw)
To: Jan Pohanka; +Cc: linux-media, s.hauer
Hello Jan,
On Fri, Jul 29, 2011 at 12:14:09PM +0200, Jan Pohanka wrote:
> which repository should I search
> 90026c8c823bff54172eab33a5e7fcecfd3df635 in? I have not found it in
> git.pengutronix.de/git/imx/linux-2.6.git nor in vanilla sources.
Seems my copy'n'paste foo isn't optimal. Commit
dca7c0b4293a06d1ed9387e729a4882896abccc2 is the relevant, it's in
vanilla.
http://git.kernel.org/linus/dca7c0b4293a06d1ed9387e729a4882896abccc2
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-07-29 11:57 ` Uwe Kleine-König
@ 2011-08-01 6:58 ` Jan Pohanka
2011-08-04 13:11 ` Jan Pohanka
1 sibling, 0 replies; 11+ messages in thread
From: Jan Pohanka @ 2011-08-01 6:58 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-media, s.hauer
Hello Uwe,
thank you for the answer again, but I'm still in troubles...
Here is the code from my mach-imx27ipcam.c regarding camera initialization
and DMESG messages I got. The initialization is almost the same as in
pcm037 as you adviced.
static int mx27ipcam_camera_power(struct device *dev, int on)
{
/* set clock*/
/* set standby pin */
gpio_set_value(CAM_STDBY, !on);
printk("%s: %d\n", __func__, (!(!on)));
return 0;
}
static int mx27ipcam_camera_reset(struct device *dev)
{
gpio_set_value(CAM_RESET, 0);
udelay(100);
gpio_set_value(CAM_RESET, 1);
printk("%s\n", __func__);
return 0;
}
static struct soc_camera_link iclink_mt9d131 = {
.bus_id = 0, /* Must match with the camera ID */
.board_info = &mx27ipcam_i2c_camera[0],
.i2c_adapter_id = 0,
.power = mx27ipcam_camera_power,
.reset = mx27ipcam_camera_reset,
};
static struct platform_device mx27ipcam_mt9d131 = {
.name = "soc-camera-pdrv",
.id = 0,
.dev = {
.platform_data = &iclink_mt9d131,
},
};
static struct platform_device *platform_devices[] __initdata = {
&ipcam_nor_mtd_device,
&mx27ipcam_mt9d131,
};
static struct mx2_camera_platform_data mx27ipcam_camera = {
.flags = 0,
.clk = 100000,
};
static phys_addr_t mx2_camera_base __initdata;
#define MX2_CAMERA_BUF_SIZE SZ_4M
static int __init mx27ipcam_camera_init(void) {
int dma, ret = -ENOMEM;
struct platform_device *pdev;
printk("MX2 camera initialization.\n");
pdev = imx27_add_mx2_camera(&mx27ipcam_camera);
if (IS_ERR(pdev)) {
printk("pdev error\n");
return PTR_ERR(pdev);
}
dma = dma_declare_coherent_memory(&pdev->dev,
mx2_camera_base, mx2_camera_base,
MX2_CAMERA_BUF_SIZE,
DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
if (!(dma & DMA_MEMORY_MAP))
goto err;
ret = platform_device_add(pdev);
if (ret) {
printk("platform_device_add error\n");
err:
platform_device_put(pdev);
}
return ret;
}
static void __init mx27ipcam_init(void)
{
...
imx27_add_imx_i2c(0, &mx27ipcam_i2c1_data);
mx27ipcam_camera_init();
...
}
...
static void __init imx27ipcam_reserve(void)
{
/* reserve 4 MiB for mx2-camera */
mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE,
MX2_CAMERA_BUF_SIZE);
memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
}
MACHINE_START(IMX27IPCAM, "Freescale IMX27IPCAM")
/* maintainer: Freescale Semiconductor, Inc. */
.boot_params = MX27_PHYS_OFFSET + 0x100,
.reserve = imx27ipcam_reserve,
.map_io = mx27_map_io,
.init_early = imx27_init_early,
.init_irq = mx27_init_irq,
.timer = &mx27ipcam_timer,
.init_machine = mx27ipcam_init,
MACHINE_END
MX2 camera initialization.
------------[ cut here ]------------
WARNING: at /home/honza/_dev/kernel/linux-2.6.39.y/kernel/resource.c:491
__insert_resource+0x13c/0
x148()
Modules linked in:
[<c00329e0>] (unwind_backtrace+0x0/0xf0) from [<c0042b00>]
(warn_slowpath_common+0x4c/0x64)
[<c0042b00>] (warn_slowpath_common+0x4c/0x64) from [<c0042b34>]
(warn_slowpath_null+0x1c/0x24)
[<c0042b34>] (warn_slowpath_null+0x1c/0x24) from [<c004960c>]
(__insert_resource+0x13c/0x148)
[<c004960c>] (__insert_resource+0x13c/0x148) from [<c0049e6c>]
(insert_resource_conflict+0x20/0x54
)
[<c0049e6c>] (insert_resource_conflict+0x20/0x54) from [<c0049ea8>]
(insert_resource+0x8/0x14)
[<c0049ea8>] (insert_resource+0x8/0x14) from [<c01bf11c>]
(platform_device_add+0x70/0x238)
[<c01bf11c>] (platform_device_add+0x70/0x238) from [<c000bc54>]
(mx27ipcam_init+0xc0/0x120)
[<c000bc54>] (mx27ipcam_init+0xc0/0x120) from [<c0009558>]
(customize_machine+0x1c/0x28)
[<c0009558>] (customize_machine+0x1c/0x28) from [<c002248c>]
(do_one_initcall+0x30/0x16c)
[<c002248c>] (do_one_initcall+0x30/0x16c) from [<c000891c>]
(kernel_init+0x90/0x13c)
[<c000891c>] (kernel_init+0x90/0x13c) from [<c002dfc0>]
(kernel_thread_exit+0x0/0x8)
---[ end trace 1b75b31a2719ed1c ]---
mx2-camera.0: failed to claim resource 0
platform_device_add error
I have also another question if you are able to answer it. I would like to
have some kind of kernel debugging working (JTAG or KGDB). We own j-link
probe from segger, but their gdbserver cannot attach running application.
It resets the board and I'm not able to boot linux again with probe
connected. According to this I have tried also KGDB, but it does not work
either. I have found this link
http://www.imxdev.org/wiki/index.php?title=Mxuart_patch - it seems that
polling routines are still not implemented in current driver. Is that true?
with best regards
Jan
Dne Fri, 29 Jul 2011 13:57:32 +0200 Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> napsal(a):
> Hello Jan,
>
> On Fri, Jul 29, 2011 at 12:14:09PM +0200, Jan Pohanka wrote:
>> which repository should I search
>> 90026c8c823bff54172eab33a5e7fcecfd3df635 in? I have not found it in
>> git.pengutronix.de/git/imx/linux-2.6.git nor in vanilla sources.
> Seems my copy'n'paste foo isn't optimal. Commit
> dca7c0b4293a06d1ed9387e729a4882896abccc2 is the relevant, it's in
> vanilla.
>
> http://git.kernel.org/linus/dca7c0b4293a06d1ed9387e729a4882896abccc2
>
> Best regards
> Uwe
>
--
Tato zpráva byla vytvořena převratným poštovním klientem Opery:
http://www.opera.com/mail/
Dne Fri, 29 Jul 2011 13:57:32 +0200 Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> napsal(a):
> Hello Jan,
>
> On Fri, Jul 29, 2011 at 12:14:09PM +0200, Jan Pohanka wrote:
>> which repository should I search
>> 90026c8c823bff54172eab33a5e7fcecfd3df635 in? I have not found it in
>> git.pengutronix.de/git/imx/linux-2.6.git nor in vanilla sources.
> Seems my copy'n'paste foo isn't optimal. Commit
> dca7c0b4293a06d1ed9387e729a4882896abccc2 is the relevant, it's in
> vanilla.
>
> http://git.kernel.org/linus/dca7c0b4293a06d1ed9387e729a4882896abccc2
>
> Best regards
> Uwe
>
--
Tato zpráva byla vytvořena převratným poštovním klientem Opery:
http://www.opera.com/mail/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-07-29 11:57 ` Uwe Kleine-König
2011-08-01 6:58 ` Jan Pohanka
@ 2011-08-04 13:11 ` Jan Pohanka
2011-08-04 13:25 ` Uwe Kleine-König
1 sibling, 1 reply; 11+ messages in thread
From: Jan Pohanka @ 2011-08-04 13:11 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-media, s.hauer
Dear Uwe,
could you please give me some advice once more? It seems I'm not able to
make mx2_camera working by myself.
I have tried dma memory allocation in my board file in several ways, but
nothing seems to work. I use Video capture example for v4l2 for testing.
regards
Jan
mx27ipcam_camera_power: 1
mx27ipcam_camera_reset
mx2-camera mx2-camera.0: Camera driver attached to camera 0
mx2-camera mx2-camera.0: dma_alloc_coherent size 614400 failed
mmap error 12, Cannot allocate memory
mx2-camera mx2-camera.0: Camera driver detached from camera 0
mx27ipcam_camera_power: 0
...
static phys_addr_t mx2_camera_base __initdata;
#define MX2_CAMERA_BUF_SIZE SZ_4M
static int __init mx27ipcam_init_camera(void)
{
int dma, ret = -ENOMEM;
struct platform_device *pdev = imx27_alloc_mx2_camera(&mx27ipcam_camera);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
dma = dma_declare_coherent_memory(&pdev->dev,
mx2_camera_base, mx2_camera_base,
MX2_CAMERA_BUF_SIZE,
DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
if (!(dma & DMA_MEMORY_MAP))
goto err;
ret = platform_device_add(pdev);
if (ret)
err:
platform_device_put(pdev);
return ret;
}
static void __init mx27ipcam_init(void)
{
imx27_soc_init();
mxc_gpio_setup_multiple_pins(mx27ipcam_pins, ARRAY_SIZE(mx27ipcam_pins),
"mx27ipcam");
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
/*imx27_add_mxc_nand(&mx27ipcam_nand_board_info);*/
imx27_add_imx_uart0(NULL);
imx27_add_fec(NULL);
imx27_add_imx2_wdt(NULL);
imx27_add_imx_i2c(0, &mx27ipcam_i2c1_data);
mx27ipcam_init_camera();
}
static void __init mx27ipcam_reserve(void)
{
/* reserve 4 MiB for mx3-camera */
mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE,
MX2_CAMERA_BUF_SIZE);
memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
}
MACHINE_START(IMX27IPCAM, "Freescale IMX27IPCAM")
/* maintainer: Freescale Semiconductor, Inc. */
.boot_params = MX27_PHYS_OFFSET + 0x100,
.reserve = mx27ipcam_reserve,
.map_io = mx27_map_io,
.init_early = imx27_init_early,
.init_irq = mx27_init_irq,
.timer = &mx27ipcam_timer,
.init_machine = mx27ipcam_init,
MACHINE_END
struct platform_device *__init imx_add_mx2_camera(
const struct imx_mx2_camera_data *data,
const struct mx2_camera_platform_data *pdata)
{
struct resource res[] = {
{
.start = data->iobasecsi,
.end = data->iobasecsi + data->iosizecsi - 1,
.flags = IORESOURCE_MEM,
}, {
.start = data->irqcsi,
.end = data->irqcsi,
.flags = IORESOURCE_IRQ,
}, {
.start = data->iobaseemmaprp,
.end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
.flags = IORESOURCE_MEM,
}, {
.start = data->irqemmaprp,
.end = data->irqemmaprp,
.flags = IORESOURCE_IRQ,
},
};
return imx_add_platform_device_dmamask("mx2-camera", 0,
res, data->iobaseemmaprp ? 4 : 2,
pdata, sizeof(*pdata), DMA_BIT_MASK(32));
}
struct platform_device *__init imx_alloc_mx2_camera(
const struct imx_mx2_camera_data *data,
const struct mx2_camera_platform_data *pdata)
{
struct resource res[] = {
{
.start = data->iobasecsi,
.end = data->iobasecsi + data->iosizecsi - 1,
.flags = IORESOURCE_MEM,
}, {
.start = data->irqcsi,
.end = data->irqcsi,
.flags = IORESOURCE_IRQ,
}, {
.start = data->iobaseemmaprp,
.end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
.flags = IORESOURCE_MEM,
}, {
.start = data->irqemmaprp,
.end = data->irqemmaprp,
.flags = IORESOURCE_IRQ,
},
};
int ret = -ENOMEM;
struct platform_device *pdev;
pdev = platform_device_alloc("mx2-camera", 0);
if (!pdev)
goto err;
pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
if (!pdev->dev.dma_mask)
goto err;
*pdev->dev.dma_mask = DMA_BIT_MASK(32);
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
if (ret)
goto err;
if (pdata) {
ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
if (ret) {
err:
kfree(pdev->dev.dma_mask);
platform_device_put(pdev);
return ERR_PTR(-ENODEV);
}
}
return pdev;
}
Dne Fri, 29 Jul 2011 13:57:32 +0200 Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> napsal(a):
> Hello Jan,
>
> On Fri, Jul 29, 2011 at 12:14:09PM +0200, Jan Pohanka wrote:
>> which repository should I search
>> 90026c8c823bff54172eab33a5e7fcecfd3df635 in? I have not found it in
>> git.pengutronix.de/git/imx/linux-2.6.git nor in vanilla sources.
> Seems my copy'n'paste foo isn't optimal. Commit
> dca7c0b4293a06d1ed9387e729a4882896abccc2 is the relevant, it's in
> vanilla.
>
> http://git.kernel.org/linus/dca7c0b4293a06d1ed9387e729a4882896abccc2
>
> Best regards
> Uwe
>
--
Tato zpráva byla vytvořena převratným poštovním klientem Opery:
http://www.opera.com/mail/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-08-04 13:11 ` Jan Pohanka
@ 2011-08-04 13:25 ` Uwe Kleine-König
2011-08-05 7:21 ` Jan Pohanka
0 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2011-08-04 13:25 UTC (permalink / raw)
To: Jan Pohanka; +Cc: linux-media, s.hauer
Hello Jan,
On Thu, Aug 04, 2011 at 03:11:11PM +0200, Jan Pohanka wrote:
> Dear Uwe,
> could you please give me some advice once more? It seems I'm not
> able to make mx2_camera working by myself.
> I have tried dma memory allocation in my board file in several ways,
> but nothing seems to work. I use Video capture example for v4l2 for
> testing.
>
> regards
> Jan
>
> mx27ipcam_camera_power: 1
> mx27ipcam_camera_reset
> mx2-camera mx2-camera.0: Camera driver attached to camera 0
> mx2-camera mx2-camera.0: dma_alloc_coherent size 614400 failed
> mmap error 12, Cannot allocate memory
> mx2-camera mx2-camera.0: Camera driver detached from camera 0
> mx27ipcam_camera_power: 0
Cannot say offhand. I'd instrument dma_alloc_from_coherent to check
where it fails.
The patch looks OK from a first glance.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-08-04 13:25 ` Uwe Kleine-König
@ 2011-08-05 7:21 ` Jan Pohanka
2011-08-05 7:28 ` Uwe Kleine-König
0 siblings, 1 reply; 11+ messages in thread
From: Jan Pohanka @ 2011-08-05 7:21 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-media, s.hauer
Hello Uwe,
thank you for the hint. There was problem with insufficient memory.
dma_alloc_from_coherent is called several times and when I allocated
only 4MB, last call failed. When I passed 8MB to
dma_declare_coherent_memory, it works. Unfortunately I do not
understand why 4MB is not enough for 640x480 YUV image...
regards
Jan
2011/8/4 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> Hello Jan,
>
> On Thu, Aug 04, 2011 at 03:11:11PM +0200, Jan Pohanka wrote:
>> Dear Uwe,
>> could you please give me some advice once more? It seems I'm not
>> able to make mx2_camera working by myself.
>> I have tried dma memory allocation in my board file in several ways,
>> but nothing seems to work. I use Video capture example for v4l2 for
>> testing.
>>
>> regards
>> Jan
>>
>> mx27ipcam_camera_power: 1
>> mx27ipcam_camera_reset
>> mx2-camera mx2-camera.0: Camera driver attached to camera 0
>> mx2-camera mx2-camera.0: dma_alloc_coherent size 614400 failed
>> mmap error 12, Cannot allocate memory
>> mx2-camera mx2-camera.0: Camera driver detached from camera 0
>> mx27ipcam_camera_power: 0
> Cannot say offhand. I'd instrument dma_alloc_from_coherent to check
> where it fails.
>
> The patch looks OK from a first glance.
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed
2011-08-05 7:21 ` Jan Pohanka
@ 2011-08-05 7:28 ` Uwe Kleine-König
0 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2011-08-05 7:28 UTC (permalink / raw)
To: Jan Pohanka; +Cc: linux-media, s.hauer
Hello Jan,
On Fri, Aug 05, 2011 at 09:21:36AM +0200, Jan Pohanka wrote:
> Hello Uwe,
> thank you for the hint. There was problem with insufficient memory.
> dma_alloc_from_coherent is called several times and when I allocated
> only 4MB, last call failed. When I passed 8MB to
> dma_declare_coherent_memory, it works. Unfortunately I do not
> understand why 4MB is not enough for 640x480 YUV image...
A YUV420 image of size 640x480 needs 1.5 * 640 * 480 bytes (I think).
That's ~ 0.5MB. Now it depends how much buffers are allocated. For
taking a photo a single buffer is enough, for a video it uses probably
more than one.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-08-05 7:28 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-29 7:31 mx2_camera driver on mx27ipcam: dma_alloc_coherent size failed Jan Pohanka
2011-07-29 7:51 ` Uwe Kleine-König
2011-07-29 8:59 ` Jan Pohanka
2011-07-29 9:23 ` Uwe Kleine-König
2011-07-29 10:14 ` Jan Pohanka
2011-07-29 11:57 ` Uwe Kleine-König
2011-08-01 6:58 ` Jan Pohanka
2011-08-04 13:11 ` Jan Pohanka
2011-08-04 13:25 ` Uwe Kleine-König
2011-08-05 7:21 ` Jan Pohanka
2011-08-05 7:28 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox