Skip to contentSkip to conversation

Ioremap related concern ...

DISCUSSION Misbah khan 2 participants 2 messages Sep 18, 2008

lore
Share & tools
lore
#0 lore raw

Hi all,

i am facing a problem regarding the usage of ioremap function which is described as:-

1) I am remaping the SDRAM memory into three continews buffer as

	ptr1 = (unsigned int *)ioremap(0x0001000,0x1000);
	ptr2 = (unsigned int *)ioremap(0x0002000,0x1000);
	ptr3 = (unsigned int *)ioremap(0x0003000,0x1000);

I am filling the data into the SDRAM buffer using these remap pointers

2) SDRAM is mmaped to user space into a buffer as

	struct sdram_buf
	{
		unsigned int buf[4096];

	};
	struct sdram_buf sdram_buf_obj[3];

The mapping looks correct but it doesent work ... :(

	If is do the ioremap like this it works 
	
	ptr1 = (unsigned int *)ioremap(0x0001000,(0x1000 * 4));
	ptr2 = (unsigned int *)ioremap(0x0002000,(0x1000 * 4));
	ptr3 = (unsigned int *)ioremap(0x0003000,(0x1000 * 4));

	Doing this actually takes more space into the ram memory hence for mapping 
	1 M of Ram memeoy it actually takes 4 MB practically.

Can any one point out the mistake or suggest something ...

Signature · 2 lines
View this message in context: http://www.nabble.com/Ioremap-related-concern-...-tp19545826p19545826.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
#1 lore raw
Quoted 10 lines · Misbah khan

Hi all,

i am facing a problem regarding the usage of ioremap function which is described as:-

1) I am remaping the SDRAM memory into three continews buffer as

       ptr1 = (unsigned int *)ioremap(0x0001000,0x1000);
       ptr2 = (unsigned int *)ioremap(0x0002000,0x1000);
       ptr3 = (unsigned int *)ioremap(0x0003000,0x1000);

Ah, this doesn't work. You can't just choose a region of ram and ioremap it. Besides, the base of RAM is already used by the interrupt vectors.

If you need to allocate a region for DMA buffers, then take a look at dma_alloc_coherent(). If you just need to allocate some buffers, then just use kzalloc().

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.