Re: Kernel updating : export gpio not working ?

2013-02-28 Thread Mylene Josserand
Hi,

Thank you for your answer ! :)

No problem to post back my solution. I think it can always be useful to 
know the solution of a problem even if it is a specific one. And I would 
be happy if it could help other kernel-newbies not to do the same error ;)


Best regards,

-- 
Mylène JOSSERAND


Le 27/02/2013 18:42, Mulyadi Santosa a écrit :
 On Wed, Feb 27, 2013 at 10:19 PM, Mylene Josserand
 mylene.josser...@navocap.com  wrote:
 Just to update you that I have found my problem !

 In my config file, I did not notice that my own board and an other imx27
 board was enabled ! So the gpios configured was the one from this board
 and not mine's (thanks debugfs !). That is why it did not act like I wanted.

 This is the kind of post that I like most some one has problem but
 he/she also still find a way to solve. Then post it back to
 kernelnewbies.

 Nice info to know.


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


doesn't ioremap() retrun contigious addressess...?

2013-02-28 Thread sandeep kumar
Hi All
Please find a piece of code that i wrote in my driver,

void __iomem *tcpm_base = ioremap_nocache(0x0390, SZ_16KB);
printk(Virtual addresss %x\n,tcpm_base);
if(tcpm_base!=NULL)
{
printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
for(i=0;i(SZ_16KB-1);i++)
src = readl(tcpm_base+i);
printk(%d\n,src);
printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
}
else
printk(unable to map \n);


When i execute this code, i am seeing a kernel panic telling
- LOG 
Virtual addresss ea88
Unable to handle kernel paging request at virtual address ea89
-LOG-

If you observe,
virtual address of  tcpm_base is ea88.
if ioremap() returns all contigious memory, There should be no
dereferencing of ea89(the max address should be ea88fffe)

But in kernel logs show, it is dereferencing that address.

My question now is...
doesn't ioremap() returns contigious address space?


With regards,
Sandeep Kumar Anantapalli,
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: doesn't ioremap() retrun contigious addressess...?

2013-02-28 Thread sandeep kumar
Sorry, Neglect the question.
i am using a readl() which reads 4 bytes at a time. In the last iteration,
it is trying to read next 4 unmapped locations.


On Thu, Feb 28, 2013 at 4:06 PM, sandeep kumar coolsandyfor...@gmail.comwrote:


 Hi All
 Please find a piece of code that i wrote in my driver,

 void __iomem *tcpm_base = ioremap_nocache(0x0390, SZ_16KB);
 printk(Virtual addresss %x\n,tcpm_base);
 if(tcpm_base!=NULL)
 {
 printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
 for(i=0;i(SZ_16KB-1);i++)
 src = readl(tcpm_base+i);
 printk(%d\n,src);
 printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
 }
 else
 printk(unable to map \n);


 When i execute this code, i am seeing a kernel panic telling
 - LOG 
 Virtual addresss ea88
 Unable to handle kernel paging request at virtual address ea89
 -LOG-

 If you observe,
 virtual address of  tcpm_base is ea88.
 if ioremap() returns all contigious memory, There should be no
 dereferencing of ea89(the max address should be ea88fffe)

 But in kernel logs show, it is dereferencing that address.

 My question now is...
 doesn't ioremap() returns contigious address space?


 With regards,
 Sandeep Kumar Anantapalli,




-- 
With regards,
Sandeep Kumar Anantapalli,
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: doesn't ioremap() retrun contigious addressess...?

2013-02-28 Thread Prabhu nath
Yes, ioremap() maps the given physical address to contiguous Kernel virtual
address above high_memory and returns the first address of the mapped
kernel virtual address.

Regards,
Prabhu



On Thu, Feb 28, 2013 at 4:06 PM, sandeep kumar coolsandyfor...@gmail.comwrote:


 Hi All
 Please find a piece of code that i wrote in my driver,

 void __iomem *tcpm_base = ioremap_nocache(0x0390, SZ_16KB);
 printk(Virtual addresss %x\n,tcpm_base);
 if(tcpm_base!=NULL)
 {
 printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
 for(i=0;i(SZ_16KB-1);i++)
 src = readl(tcpm_base+i);
 printk(%d\n,src);
 printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
 }
 else
 printk(unable to map \n);


 When i execute this code, i am seeing a kernel panic telling
 - LOG 
 Virtual addresss ea88
 Unable to handle kernel paging request at virtual address ea89
 -LOG-

 If you observe,
 virtual address of  tcpm_base is ea88.
 if ioremap() returns all contigious memory, There should be no
 dereferencing of ea89(the max address should be ea88fffe)

 But in kernel logs show, it is dereferencing that address.

 My question now is...
 doesn't ioremap() returns contigious address space?


 With regards,
 Sandeep Kumar Anantapalli,

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: doesn't ioremap() retrun contigious addressess...?

2013-02-28 Thread Prabhu nath
I guess your reading is wrong. If you are mapping 16KB of physical address
from 0x0390. The mapping is as follows.

0x0390 to 0x03903FFF -- 0xEA88 to 0xEA883FFF

For every iteration you are reading 4 bytes. hence you have to reduce your
loop as follows and also declare tcpm_base as unsigned int *

unsigned int __iomem *tcpm_base;

 *tcpm_base = ioremap_nocache(0x0390, SZ_16KB);
printk(Virtual addresss %x\n,tcpm_base);
if(tcpm_base!=NULL)
{
printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
for(i=0;i*0xFFF*;i++)
src = readl(tcpm_base+i);
printk(%d\n,src);
printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
}
else
printk(unable to map \n);


Regards,
Prabhu


On Thu, Feb 28, 2013 at 4:41 PM, Prabhu nath gprabhun...@gmail.com wrote:

 Yes, ioremap() maps the given physical address to contiguous Kernel
 virtual address above high_memory and returns the first address of the
 mapped kernel virtual address.

 Regards,
 Prabhu



 On Thu, Feb 28, 2013 at 4:06 PM, sandeep kumar 
 coolsandyfor...@gmail.comwrote:


 Hi All
 Please find a piece of code that i wrote in my driver,

 void __iomem *tcpm_base = ioremap_nocache(0x0390, SZ_16KB);
 printk(Virtual addresss %x\n,tcpm_base);
 if(tcpm_base!=NULL)
 {
 printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
 for(i=0;i(SZ_16KB-1);i++)
 src = readl(tcpm_base+i);
 printk(%d\n,src);
 printk(Jiffies %x %ld\n\n\n\n, jiffies, jiffies);
 }
 else
 printk(unable to map \n);


 When i execute this code, i am seeing a kernel panic telling
 - LOG 
 Virtual addresss ea88
 Unable to handle kernel paging request at virtual address ea89
 -LOG-

 If you observe,
 virtual address of  tcpm_base is ea88.
 if ioremap() returns all contigious memory, There should be no
 dereferencing of ea89(the max address should be ea88fffe)

 But in kernel logs show, it is dereferencing that address.

 My question now is...
 doesn't ioremap() returns contigious address space?


 With regards,
 Sandeep Kumar Anantapalli,

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: doesn't ioremap() retrun contigious addressess...?

2013-02-28 Thread Yann Droneaud
Le jeudi 28 février 2013 à 16:25 +0530, sandeep kumar a écrit :
 Sorry, Neglect the question.
 i am using a readl() which reads 4 bytes at a time. In the last
 iteration, it is trying to read next 4 unmapped locations.
 

So you probably have to do this instead:

for(i=0;i(SZ_16KB-1)/4;i++)
 src = readl(tcpm_base+(i * 4));

Regards
 
-- 
Yann Droneaud
OPTEYA




___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: doesn't ioremap() retrun contigious addressess...?

2013-02-28 Thread Prabhu nath
Yep.




On Thu, Feb 28, 2013 at 5:10 PM, Yann Droneaud ydrone...@opteya.com wrote:

 Le jeudi 28 février 2013 à 16:25 +0530, sandeep kumar a écrit :
  Sorry, Neglect the question.
  i am using a readl() which reads 4 bytes at a time. In the last
  iteration, it is trying to read next 4 unmapped locations.
 

 So you probably have to do this instead:

 for(i=0;i(SZ_16KB-1)/4;i++)
  src = readl(tcpm_base+(i * 4));

 Regards

 --
 Yann Droneaud
 OPTEYA




 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: doesn't ioremap() retrun contigious addressess...?

2013-02-28 Thread sandeep kumar
Thank you all, It worked :)


On Thu, Feb 28, 2013 at 5:33 PM, Prabhu nath gprabhun...@gmail.com wrote:

 Yep.




 On Thu, Feb 28, 2013 at 5:10 PM, Yann Droneaud ydrone...@opteya.comwrote:

 Le jeudi 28 février 2013 à 16:25 +0530, sandeep kumar a écrit :
  Sorry, Neglect the question.
  i am using a readl() which reads 4 bytes at a time. In the last
  iteration, it is trying to read next 4 unmapped locations.
 

 So you probably have to do this instead:

 for(i=0;i(SZ_16KB-1)/4;i++)
  src = readl(tcpm_base+(i * 4));

 Regards

 --
 Yann Droneaud
 OPTEYA




 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies





-- 
With regards,
Sandeep Kumar Anantapalli,
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


64bit MMIO access

2013-02-28 Thread Jagath Weerasinghe
Hi,

What are the read/write kernel functions to access 64bit MMIO addresses?
Are there similar functions like readl() and writel() for 64bit systems?

Regards,
Jagath

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


64bit MMIO access

2013-02-28 Thread Jagath Weerasinghe
Hi,

What are the read/write kernel functions to access 64bit MMIO addresses?
Are there similar functions like readl() and writel() for 64bit systems?

Regards,
Jagath

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to measure the RAM read/write performance

2013-02-28 Thread Arun KS
On Tue, Feb 26, 2013 at 6:50 PM, ankur dwivedi ankurengg2...@gmail.com wrote:
 I am not sure but what if you make the variable as a volatile?

Volatile in simple terms
==
Consider this eg:

1  int main(void){
2  int a, x, y;
3  x=a;
4  y=a;
5  }

Line 3 with be converted to a LDR instruction.
Line 4 is where the compiler optimization comes in. It may be loaded
from the previous loaded register.

Line 3: ldr r0[r1];   r1 is having the address of a
Line 4: mov r2 r0;   because we have value of a already in r0.

But if a is volatile variable, then compiler places ldr for both
instructions(ie for x=a and y = a).
so line 4 will change as follows.

Line 3: ldr r0[r1];r1 is having the address of a
Line 4: ldr r2[r1]; r1 is having the address of a

But if cache is enabled, ldr can fetch the data from cache if present.
So volatile cannot help us here.

Thanks,
Arun


 On Tue, Feb 26, 2013 at 5:01 PM, sandeep kumar coolsandyfor...@gmail.com
 wrote:

 Hi All
 In performance benchmark tools, When we profile read/write timings mostly,
 those read/writes are done to cache only.

 I want to measure my DDR(RAM chip) performance.
 So i want to make sure, every read/write should happen to DDR RAM chip
 only.

 How can i achieve this...Any ideas/suggestions...?

 --
 With regards,
 Sandeep Kumar Anantapalli,

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




 --
 Thanks

 Ankur Dwivedi


 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: relocatable modules' symbols

2013-02-28 Thread Arun KS
Hi Horseriver,

On Sun, Feb 24, 2013 at 7:26 AM, horseriver horseriv...@gmail.com wrote:
 On Sun, Feb 24, 2013 at 04:00:37PM +0700, Mulyadi Santosa wrote:
 On Sat, Feb 23, 2013 at 6:45 AM, horseriver horseriv...@gmail.com wrote:
  hi:
 
I have built vmlinux at the top dir of kernel source ,then I use objdump 
  to look into
its section information.I find the statup_32 which is the start routine 
  of kernel ,
locats at 0xc010. I know the 0x10 is the defined address for 
  locating
protect-mode code .But which I can not understand is the 0xc prefix 
  .where does it come from?

 If my guess is right, that's because kernel mode code start at
 0xc00 a.k.a a bit above 3 GiB on x86 32 bit machine

   I have find this answer .
   It is defined in lds script file .

 here is the code :
   SECTIONS
   {
   . = 0xC000 + 0x10;
   /* read-only */
   _text = .;/* Text and read-only data */


   why use 0xC000 as its start ? why not  just  use 0x10 only ?
   if use 0xC000,every linked symbole will be prefixed by 0xc , what is 
 the purpose ?

Usually, user kernel space split is 3G:1G.
ie 1G for kernel space. And this starts from 0xC000_ till 0x_

All the address below 0xC000_(ie 3G from 0x0 to 0xBFFF_) is
used for user space.

Thanks,
Arun

 thanks!



 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer and consultant

 blog: the-hydra.blogspot.com
 training: mulyaditraining.blogspot.com

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: atomic operations

2013-02-28 Thread Arun KS
Hi Peter,

On Sun, Feb 24, 2013 at 6:20 PM, Peter Teoh htmldevelo...@gmail.com wrote:
 in simple terms, any operation, in terms assembly instructions, which can be
 executed in ONE instruction, is atomic, because, just like an atom, it
 cannot be broken up into parts.   any instructions that is longer than one,
 for eg, TWO instruction, is NOT atomic, because in BETWEEN the first and 2nd
 instruction, something like an interrupt can come in, and affect the values
 of the operand when it is passed from instruction one to second instruction.

Nice explanation.

Thanks,
Arun
 To save me from reiteration:

 http://www.ibm.com/developerworks/library/pa-dalign/ (search for
 atomicity).

 http://stackoverflow.com/questions/381244/purpose-of-memory-alignment

 http://lwn.net/Articles/260832/

 http://www.songho.ca/misc/alignment/dataalign.html

 http://www.cis.upenn.edu/~palsetia/cit595s08/Lectures08/alignmentOrdering.pdf

 Essentially, atomicity and non-alignment become problematic when u tried to
 to read using non-byte addressing mode with non-aligned address.

 On Sun, Feb 24, 2013 at 5:42 PM, Shraddha Kamat sh200...@gmail.com wrote:

 what is the relation between atomic operations and memory alignment ?

 I read from UTLK that an unaligned memory access is not atomic

 please explain me , I am not able to get the relationship between
 memory alignment and atomicity of the operation.


 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




 --
 Regards,
 Peter Teoh

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Examples of Per-CPU Variables in Kernel source

2013-02-28 Thread Arun KS
On Sun, Feb 24, 2013 at 2:07 PM, Shraddha Kamat sh200...@gmail.com wrote:
 I was reading about Per-CPU Variables from UTLK. Where are
 such variables used in the kernel source code - example.
Use grep utility to find it out .

Thanks,
Arun

 -- Shraddha



 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies