[U-Boot] [PATCH 1/2] armv7m: add instruction & data cache support
Marek Vasut
marex at denx.de
Fri Mar 10 17:26:08 UTC 2017
On 03/10/2017 06:21 PM, Vikas MANOCHA wrote:
> Hi Marek,
>
>> -----Original Message-----
>> From: Marek Vasut [mailto:marex at denx.de]
>> Sent: Thursday, March 09, 2017 5:33 PM
>> To: Vikas MANOCHA <vikas.manocha at st.com>; u-boot at lists.denx.de
>> Cc: Christophe KERELLO <christophe.kerello at st.com>; Albert Aribaud <albert.u.boot at aribaud.net>; Alexander Graf
>> <agraf at suse.de>; Andre Przywara <andre.przywara at arm.com>; Heiko Schocher <hs at denx.de>; Ladislav Michl <ladis at linux-
>> mips.org>; Simon Glass <sjg at chromium.org>; Stephen Warren <swarren at nvidia.com>; Toshifumi NISHINAGA
>> <tnishinaga.dev at gmail.com>
>> 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 <vikas.manocha at st.com>
>>> ---
>>> 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, vikas.manocha at st.com.
>>> + *
>>> + * 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
More information about the U-Boot
mailing list