On 03/10/2017 06:21 PM, Vikas MANOCHA wrote:
> Hi Marek,
> 
>> -----Original Message-----
>> From: Marek Vasut [mailto:[email protected]]
>> Sent: Thursday, March 09, 2017 5:33 PM
>> To: Vikas MANOCHA <[email protected]>; [email protected]
>> Cc: Christophe KERELLO <[email protected]>; Albert Aribaud 
>> <[email protected]>; Alexander Graf
>> <[email protected]>; Andre Przywara <[email protected]>; Heiko Schocher 
>> <[email protected]>; Ladislav Michl <ladis@linux-
>> mips.org>; Simon Glass <[email protected]>; Stephen Warren 
>> <[email protected]>; Toshifumi NISHINAGA
>> <[email protected]>
>> Subject: Re: [PATCH 1/2] armv7m: add instruction & data cache support
>>
>> On 03/09/2017 10:55 PM, Vikas Manocha wrote:
>>> This patch adds armv7m instruction & data cache support.
>>>
>>> Signed-off-by: Vikas Manocha <[email protected]>
>>> ---
>>>  arch/arm/cpu/armv7m/Makefile  |   2 +-
>>>  arch/arm/cpu/armv7m/cache.c   | 295 
>>> ++++++++++++++++++++++++++++++++++++++++++
>>>  arch/arm/include/asm/armv7m.h |  23 +++-
>>>  arch/arm/lib/Makefile         |   2 +
>>>  4 files changed, 319 insertions(+), 3 deletions(-)  create mode
>>> 100644 arch/arm/cpu/armv7m/cache.c
>>>
>>> diff --git a/arch/arm/cpu/armv7m/Makefile
>>> b/arch/arm/cpu/armv7m/Makefile index aff60e8..41efe11 100644
>>> --- a/arch/arm/cpu/armv7m/Makefile
>>> +++ b/arch/arm/cpu/armv7m/Makefile
>>> @@ -6,4 +6,4 @@
>>>  #
>>>
>>>  extra-y := start.o
>>> -obj-y += cpu.o
>>> +obj-y += cpu.o cache.o
>>> diff --git a/arch/arm/cpu/armv7m/cache.c b/arch/arm/cpu/armv7m/cache.c
>>> new file mode 100644 index 0000000..0fded33
>>> --- /dev/null
>>> +++ b/arch/arm/cpu/armv7m/cache.c
>>> @@ -0,0 +1,295 @@
>>> +/*
>>> + * (C) Copyright 2017
>>> + * Vikas Manocha, ST Micoelectronics, [email protected].
>>> + *
>>> + * SPDX-License-Identifier:        GPL-2.0+
>>> + */
>>> +
>>> +#include <common.h>
>>> +#include <asm/armv7m.h>
>>> +#include <asm/io.h>
>>> +#include <errno.h>
>>> +
>>> +struct v7m_cache {
>>> +   uint32_t ic_iallu;      /* offset 0x0*/
>>> +   uint32_t res;           /* offset 0x4*/
>>> +   uint32_t ic_imvalu;     /* offset 0x8*/
>>> +   uint32_t dc_imvac;      /* offset 0xc*/
>>> +   uint32_t dc_isw;        /* offset 0x10*/
>>> +   uint32_t dc_cmvau;      /* offset 0x14*/
>>> +   uint32_t dc_cmvac;      /* offset 0x18*/
>>> +   uint32_t dc_csw;        /* offset 0x1c*/
>>> +   uint32_t dc_cimvac;     /* offset 0x20*/
>>> +   uint32_t dc_cisw;       /* offset 0x24*/
>>> +   uint32_t bp_iall;       /* offset 0x28*/
>>> +};
>>
>> We should get rid of this struct register definitions, just use #define 
>> MACRO ...
> 
> struct or macro: both approaches have their merits for block of registers, 
> one better than other is arguable.
> I used structures here as it's very unlikely that there would be design 
> changes in these registers to break the functionality.

It's always very unlikely ... until it happens.

> Had it been general peripherals like i2c, spi, it could be otherwise.

So let's keep it consistent and use macros ...


[...]

-- 
Best regards,
Marek Vasut
_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to