Re: Raspberry Pi support for Rev-2 & BL

Markus Dolze <[email protected]> Fri, 18 Jan 2013 07:32:57 +0100
Newsgroups gmane.comp.sysutils.lcdproc
Message-ID <[email protected]>
Hi Paul,

thank you very much for your comments.

On 18.01.2013 02:48, paul_c wrote:
> 
> On Thursday 17 January 2013, Markus Dolze wrote:
>> TODO
>> ====
>> 1. There may be a memory leak in setup_io due to the pre-allocation
>> and alignment of 'gpio_mem'. The recent example code on [1] removed
>> this, too. Check if we can do the same.
>>   [1] http://elinux.org/Rpi_Low-level_peripherals
> 
> I used an early snippet of code to map the gpio in to memory. If the 
> current references suggest that malloc is unnecessary, then make the 
> change now. According to `man getpagesize' "Portable applications 
> should employ sysconf(_SC_PAGESIZE)" as it has been labeled LEGACY and 
> is architecture dependant in Linux - Either method (currently) works on 
> a Pi and returns 4096 as expected.

I will do and test this.

Additionally I am not sure if a whole 4 KB page needs to be mapped as we
only access a register space of ~200 bytes. If using MAP_FIXED option,
it has to be an exact multiple of the page size, but it may not be
necessary otherwise. I will give it a try, too.

> 
> In response to the comment regarding gpio_map needing to be volatile, 
> yes it does - It signals to the compiler that writes should not be 
> optimised out or reordered. 
> 
>> 2. Check if we can get rid of the global variable 'gpio_map'.
> 
> This could be made part of the driver struct, but as it is declared 
> static, it is not visable outside hd44780-rpi.c nor is there any reason 
> to make it available anywhere else.

Ok, I will leave it there for now.

> 
>> 3. End user documentation.
> 
> Documentation is not my strong point and I tend to write based on the 
> assumption that the reader knows his/her way round source code.

I will take care of this, now that I have enough understanding of the
GPIO usage on the Pi (GPIO signal name vs. pin header numbers, different
revision pin out, etc).

Regards,
Markus