Re: [PATCH v3 04/15] ARM: at91: replace at91sam9_ddrsdr.h with at91bootstrap's at91_ddrsdrc.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sam,

On 2/4/19 19:25, Sam Ravnborg wrote:
> Hi Ahmad.
> 
> On Mon, Apr 01, 2019 at 12:18:12PM +0200, Ahmad Fatoum wrote:
>> Instead of adding missing definitions to the existing at91sam9_ddrsdr.h
>> and adapting the incoming DDRAM initialization code from at91bootstrap,
>> just replace the lightly used existing header with:
>> https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/include/arch/at91_ddrsdrc.h
>>
>> For easier comprehension, the replacement is done in three steps:
>> This last step copies the memory size querying functions from at91sam9_ddrsdr.h
>> to at91_ddrsdrc.h, then deletes it and fixes all references.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
>> ---
> 
> 
>> diff --git a/arch/arm/mach-at91/include/mach/at91_ddrsdrc.h b/arch/arm/mach-at91/include/mach/at91_ddrsdrc.h
>> index 57d0d8f489c4..7e68e7dd63eb 100644
>> --- a/arch/arm/mach-at91/include/mach/at91_ddrsdrc.h
>> +++ b/arch/arm/mach-at91/include/mach/at91_ddrsdrc.h
>> @@ -285,4 +285,48 @@
>>  #define AT91C_DDRC2_WPVS	(0x1UL << 0)
>>  #define AT91C_DDRC2_WPSRC	(0xFFFFUL << 8)
>>  
>> +#ifndef __ASSEMBLY__
>> +#include <common.h>
>> +#include <io.h>
>> +
>> +static inline u32 at91_get_ddram_size(void * __iomem base, bool is_nb)
>> +{
> 
> I should have brought this up in the previous patch-set, but it continue to itch me.
> So you get the feedback here....
> 
> We have at91_get_ddram_size(IOMEM(xxx), {true or false})
> 
> If we introduced the following small helpers we could simplify the call sites
> to just use at91_get_ddram_size(AT91SAM9G45_BASE_DDRSDRC0) and similar.
> 
> static inline u32 at91_get_ddram_size(void __force __iomem * addr)
> {
> 	return __at91_get_ddram_size(IOMEM(addr), true);
> }
> 
> static inline u32 at91sam9g45_get_ddram_size(void __force __iomem * addr)
> {
> 	return __at91_get_ddram_size(IOMEM(addr), false);
> }

That would still require the pointer cast to pacify the -Wint-conversion.
And (void*)ADDR looks only marginally better IOMEM(ADDR) IMO
at the cost of having sparse miss passing memory pointers
(__force __iomem would be equivalent to just __attribute__((noderef)), wouldn't it?)

My preference would've been that AT91SAM9G45_BASE_DDRSDRC0 already expands
to a void __iomem *. We could do that in a follow-up patch.

> 
> But then for the few call sites it is not really worth it anyway.
> Anyway, just a small itch. Just ignore it.
> 
> 	Sam
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux