* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache
@ 2015-06-05 7:47 Josh Wu
2015-06-05 7:47 ` [U-Boot] [PATCH v2 2/3] m68k: cache: add an empty stub functions " Josh Wu
` (3 more replies)
0 siblings, 4 replies; 21+ messages in thread
From: Josh Wu @ 2015-06-05 7:47 UTC (permalink / raw)
To: u-boot
Since some driver like ohci, lcd used dcache functions. But some ARM
cpu don't implement the invalidate_dcache_range()/flush_dcache_range()
functions.
To avoid compiling errors this patch adds an weak empty stub function
for all ARM cpu.
And each cpu can implement its own implementation. If not implemented
by default it will use an empty function.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
Changes in v2: new added
arch/arm/lib/cache.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/lib/cache.c b/arch/arm/lib/cache.c
index 74cfde6..bc48f53 100644
--- a/arch/arm/lib/cache.c
+++ b/arch/arm/lib/cache.c
@@ -53,6 +53,15 @@ __weak void enable_caches(void)
puts("WARNING: Caches not enabled\n");
}
+__weak void invalidate_dcache_range(unsigned long start, unsigned long stop)
+{
+ /* An empty stub, real implementation should be in platform code */
+}
+__weak void flush_dcache_range(unsigned long start, unsigned long stop)
+{
+ /* An empty stub, real implementation should be in platform code */
+}
+
#ifdef CONFIG_SYS_NONCACHED_MEMORY
/*
* Reserve one MMU section worth of address space below the malloc() area that
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [U-Boot] [PATCH v2 2/3] m68k: cache: add an empty stub functions for invalidate/flush dcache 2015-06-05 7:47 [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache Josh Wu @ 2015-06-05 7:47 ` Josh Wu 2015-06-05 21:29 ` Angelo Dureghello 2015-06-05 7:47 ` [U-Boot] [PATCH v2 3/3] usb: ohci: enable cache support Josh Wu ` (2 subsequent siblings) 3 siblings, 1 reply; 21+ messages in thread From: Josh Wu @ 2015-06-05 7:47 UTC (permalink / raw) To: u-boot Since some driver like ohci, lcd used dcache functions. But m68k don't implement the invalidate_dcache_range()/flush_dcache_range() functions. To avoid compiling errors this patch adds an weak empty stub function for all m68k cpu. Also each cpu can implement its own implementation. If not implemented then by default is using an empty function. Signed-off-by: Josh Wu <josh.wu@atmel.com> --- Changes in v2: new added. arch/m68k/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/m68k/lib/cache.c b/arch/m68k/lib/cache.c index 21daf3d..ace791b 100644 --- a/arch/m68k/lib/cache.c +++ b/arch/m68k/lib/cache.c @@ -132,3 +132,12 @@ void dcache_invalid(void) __asm__ __volatile__("movec %0, %%cacr"::"r"(temp)); #endif } + +__weak void invalidate_dcache_range(unsigned long start, unsigned long stop) +{ + /* An empty stub, real implementation should be in platform code */ +} +__weak void flush_dcache_range(unsigned long start, unsigned long stop) +{ + /* An empty stub, real implementation should be in platform code */ +} -- 1.9.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 2/3] m68k: cache: add an empty stub functions for invalidate/flush dcache 2015-06-05 7:47 ` [U-Boot] [PATCH v2 2/3] m68k: cache: add an empty stub functions " Josh Wu @ 2015-06-05 21:29 ` Angelo Dureghello 0 siblings, 0 replies; 21+ messages in thread From: Angelo Dureghello @ 2015-06-05 21:29 UTC (permalink / raw) To: u-boot On 05/06/2015 09:47, Josh Wu wrote: > Since some driver like ohci, lcd used dcache functions. But m68k don't > implement the invalidate_dcache_range()/flush_dcache_range() functions. > > To avoid compiling errors this patch adds an weak empty stub function > for all m68k cpu. > > Also each cpu can implement its own implementation. If not implemented > then by default is using an empty function. > > Signed-off-by: Josh Wu <josh.wu@atmel.com> > --- > > Changes in v2: new added. > > arch/m68k/lib/cache.c | 9 +++++++++ > 1 file changed, 9 insertions(+) Acked-by: Angelo Dureghello <angelo@sysam.it> ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 3/3] usb: ohci: enable cache support 2015-06-05 7:47 [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache Josh Wu 2015-06-05 7:47 ` [U-Boot] [PATCH v2 2/3] m68k: cache: add an empty stub functions " Josh Wu @ 2015-06-05 7:47 ` Josh Wu 2015-06-05 13:18 ` [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache Marek Vasut 2015-06-11 5:21 ` [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions Josh Wu 3 siblings, 0 replies; 21+ messages in thread From: Josh Wu @ 2015-06-05 7:47 UTC (permalink / raw) To: u-boot Remove the CONFIG_DM_USB limitation to enable cache support functions. Tested on SAMA5D3x-EK board. Signed-off-by: Josh Wu <josh.wu@atmel.com> Acked-by: Hans de Goede <hdegoede@redhat.com> --- Changes in v2: - CONFIG_DM_USB in periodic_unlink() should be remove as well. This version remove it. - Add Hans de Goede's acked-by. drivers/usb/host/ohci-hcd.c | 12 +----------- drivers/usb/host/ohci.h | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 494b760..4300e09 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -103,21 +103,13 @@ static struct pci_device_id ehci_pci_ids[] = { # define m32_swap(x) cpu_to_le32(x) #endif /* CONFIG_SYS_OHCI_BE_CONTROLLER */ -#ifdef CONFIG_DM_USB -/* - * We really should do proper cache flushing everywhere, but for now we only - * do it for new (driver-model) usb code to avoid regressions. - */ +/* We really should do proper cache flushing everywhere */ #define flush_dcache_buffer(addr, size) \ flush_dcache_range((unsigned long)(addr), \ ALIGN((unsigned long)(addr) + size, ARCH_DMA_MINALIGN)) #define invalidate_dcache_buffer(addr, size) \ invalidate_dcache_range((unsigned long)(addr), \ ALIGN((unsigned long)(addr) + size, ARCH_DMA_MINALIGN)) -#else -#define flush_dcache_buffer(addr, size) -#define invalidate_dcache_buffer(addr, size) -#endif /* Do not use sizeof(ed / td) as our ed / td structs contain extra members */ #define flush_dcache_ed(addr) flush_dcache_buffer(addr, 16) @@ -782,12 +774,10 @@ static void periodic_unlink(struct ohci *ohci, volatile struct ed *ed, if (((struct ed *) m32_swap((unsigned long)ed_p)) == ed) { *ed_p = ed->hwNextED; -#ifdef CONFIG_DM_USB aligned_ed_p = (unsigned long)ed_p; aligned_ed_p &= ~(ARCH_DMA_MINALIGN - 1); flush_dcache_range(aligned_ed_p, aligned_ed_p + ARCH_DMA_MINALIGN); -#endif break; } ed_p = &(((struct ed *) diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index f52b4c1..47bd85b 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h @@ -18,7 +18,7 @@ # define ohci_writel(a, b) (*((volatile u32 *)(b)) = ((volatile u32)a)) #endif /* CONFIG_SYS_OHCI_SWAP_REG_ACCESS */ -#if defined CONFIG_DM_USB && ARCH_DMA_MINALIGN > 16 +#if ARCH_DMA_MINALIGN > 16 #define ED_ALIGNMENT ARCH_DMA_MINALIGN #else #define ED_ALIGNMENT 16 -- 1.9.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-05 7:47 [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache Josh Wu 2015-06-05 7:47 ` [U-Boot] [PATCH v2 2/3] m68k: cache: add an empty stub functions " Josh Wu 2015-06-05 7:47 ` [U-Boot] [PATCH v2 3/3] usb: ohci: enable cache support Josh Wu @ 2015-06-05 13:18 ` Marek Vasut 2015-06-08 2:05 ` Josh Wu 2015-06-11 5:21 ` [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions Josh Wu 3 siblings, 1 reply; 21+ messages in thread From: Marek Vasut @ 2015-06-05 13:18 UTC (permalink / raw) To: u-boot On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: > Since some driver like ohci, lcd used dcache functions. But some ARM > cpu don't implement the invalidate_dcache_range()/flush_dcache_range() > functions. > > To avoid compiling errors this patch adds an weak empty stub function > for all ARM cpu. > > And each cpu can implement its own implementation. If not implemented > by default it will use an empty function. > > Signed-off-by: Josh Wu <josh.wu@atmel.com> > --- > > Changes in v2: new added > > arch/arm/lib/cache.c | 9 +++++++++ > 1 file changed, 9 insertions(+) So, why exactly can't this be entirely common code , but a CPU-specific code ? :) Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-05 13:18 ` [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache Marek Vasut @ 2015-06-08 2:05 ` Josh Wu 2015-06-08 8:26 ` Marek Vasut 0 siblings, 1 reply; 21+ messages in thread From: Josh Wu @ 2015-06-08 2:05 UTC (permalink / raw) To: u-boot Hi, Marek On 6/5/2015 9:18 PM, Marek Vasut wrote: > On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: >> Since some driver like ohci, lcd used dcache functions. But some ARM >> cpu don't implement the invalidate_dcache_range()/flush_dcache_range() >> functions. >> >> To avoid compiling errors this patch adds an weak empty stub function >> for all ARM cpu. >> >> And each cpu can implement its own implementation. If not implemented >> by default it will use an empty function. >> >> Signed-off-by: Josh Wu <josh.wu@atmel.com> >> --- >> >> Changes in v2: new added >> >> arch/arm/lib/cache.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) > So, why exactly can't this be entirely common code , but a CPU-specific > code ? :) Do you mean to make those empty functions as common code for all arch cpu to use? It seems there is no place to put common code for all arch cpu. Best Regards, Josh Wu > > Best regards, > Marek Vasut ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-08 2:05 ` Josh Wu @ 2015-06-08 8:26 ` Marek Vasut 2015-06-08 9:15 ` Josh Wu 2015-06-08 13:20 ` Tom Rini 0 siblings, 2 replies; 21+ messages in thread From: Marek Vasut @ 2015-06-08 8:26 UTC (permalink / raw) To: u-boot On Monday, June 08, 2015 at 04:05:04 AM, Josh Wu wrote: > Hi, Marek > > On 6/5/2015 9:18 PM, Marek Vasut wrote: > > On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: > >> Since some driver like ohci, lcd used dcache functions. But some ARM > >> cpu don't implement the invalidate_dcache_range()/flush_dcache_range() > >> functions. > >> > >> To avoid compiling errors this patch adds an weak empty stub function > >> for all ARM cpu. > >> > >> And each cpu can implement its own implementation. If not implemented > >> by default it will use an empty function. > >> > >> Signed-off-by: Josh Wu <josh.wu@atmel.com> > >> --- > >> > >> Changes in v2: new added > >> > >> arch/arm/lib/cache.c | 9 +++++++++ > >> 1 file changed, 9 insertions(+) > > > > So, why exactly can't this be entirely common code , but a CPU-specific > > code ? :) > > Do you mean to make those empty functions as common code for all arch > cpu to use? Yes. > It seems there is no place to put common code for all arch cpu. Isn't that what the common/ directory is for ? ;-) Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-08 8:26 ` Marek Vasut @ 2015-06-08 9:15 ` Josh Wu 2015-06-08 13:20 ` Tom Rini 1 sibling, 0 replies; 21+ messages in thread From: Josh Wu @ 2015-06-08 9:15 UTC (permalink / raw) To: u-boot Hi, Marek On 6/8/2015 4:26 PM, Marek Vasut wrote: > On Monday, June 08, 2015 at 04:05:04 AM, Josh Wu wrote: >> Hi, Marek >> >> On 6/5/2015 9:18 PM, Marek Vasut wrote: >>> On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: >>>> Since some driver like ohci, lcd used dcache functions. But some ARM >>>> cpu don't implement the invalidate_dcache_range()/flush_dcache_range() >>>> functions. >>>> >>>> To avoid compiling errors this patch adds an weak empty stub function >>>> for all ARM cpu. >>>> >>>> And each cpu can implement its own implementation. If not implemented >>>> by default it will use an empty function. >>>> >>>> Signed-off-by: Josh Wu <josh.wu@atmel.com> >>>> --- >>>> >>>> Changes in v2: new added >>>> >>>> arch/arm/lib/cache.c | 9 +++++++++ >>>> 1 file changed, 9 insertions(+) >>> So, why exactly can't this be entirely common code , but a CPU-specific >>> code ? :) >> Do you mean to make those empty functions as common code for all arch >> cpu to use? > Yes. > >> It seems there is no place to put common code for all arch cpu. > Isn't that what the common/ directory is for ? ;-) Oh, yes ;-) I just think maybe it's more logical to keep those to the <arch>/lib/cache.c as cache are <arch> dependent. Another point is if we create a new cache.c in common/, then the cache implementation code are in three files: <arch>/cpu/cache.c or cpu.c <arch>/lib/cache.c common/cache.c It seems too fragmented. What do you think? Best Regards, Josh Wu > > Best regards, > Marek Vasut ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-08 8:26 ` Marek Vasut 2015-06-08 9:15 ` Josh Wu @ 2015-06-08 13:20 ` Tom Rini 2015-06-09 3:54 ` Josh Wu 1 sibling, 1 reply; 21+ messages in thread From: Tom Rini @ 2015-06-08 13:20 UTC (permalink / raw) To: u-boot On Mon, Jun 08, 2015 at 10:26:29AM +0200, Marek Vasut wrote: > On Monday, June 08, 2015 at 04:05:04 AM, Josh Wu wrote: > > Hi, Marek > > > > On 6/5/2015 9:18 PM, Marek Vasut wrote: > > > On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: > > >> Since some driver like ohci, lcd used dcache functions. But some ARM > > >> cpu don't implement the invalidate_dcache_range()/flush_dcache_range() > > >> functions. > > >> > > >> To avoid compiling errors this patch adds an weak empty stub function > > >> for all ARM cpu. > > >> > > >> And each cpu can implement its own implementation. If not implemented > > >> by default it will use an empty function. > > >> > > >> Signed-off-by: Josh Wu <josh.wu@atmel.com> > > >> --- > > >> > > >> Changes in v2: new added > > >> > > >> arch/arm/lib/cache.c | 9 +++++++++ > > >> 1 file changed, 9 insertions(+) > > > > > > So, why exactly can't this be entirely common code , but a CPU-specific > > > code ? :) > > > > Do you mean to make those empty functions as common code for all arch > > cpu to use? > > Yes. > > > It seems there is no place to put common code for all arch cpu. > > Isn't that what the common/ directory is for ? ;-) No, this is making something common for the sake of making it common rather than good architecutre of the code I think. We aren't going to share real cache functions just these dummy ones. We may re-evaluate our dummy ones at some point in the future when people try and use some particular combination harder, see for example the PowerPC dummy cache functions we just recently dropped. Thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150608/f4179dbf/attachment.sig> ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-08 13:20 ` Tom Rini @ 2015-06-09 3:54 ` Josh Wu 2015-06-09 13:11 ` Tom Rini 0 siblings, 1 reply; 21+ messages in thread From: Josh Wu @ 2015-06-09 3:54 UTC (permalink / raw) To: u-boot Hi, Tom On 6/8/2015 9:20 PM, Tom Rini wrote: > On Mon, Jun 08, 2015 at 10:26:29AM +0200, Marek Vasut wrote: >> On Monday, June 08, 2015 at 04:05:04 AM, Josh Wu wrote: >>> Hi, Marek >>> >>> On 6/5/2015 9:18 PM, Marek Vasut wrote: >>>> On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: >>>>> Since some driver like ohci, lcd used dcache functions. But some ARM >>>>> cpu don't implement the invalidate_dcache_range()/flush_dcache_range() >>>>> functions. >>>>> >>>>> To avoid compiling errors this patch adds an weak empty stub function >>>>> for all ARM cpu. >>>>> >>>>> And each cpu can implement its own implementation. If not implemented >>>>> by default it will use an empty function. >>>>> >>>>> Signed-off-by: Josh Wu <josh.wu@atmel.com> >>>>> --- >>>>> >>>>> Changes in v2: new added >>>>> >>>>> arch/arm/lib/cache.c | 9 +++++++++ >>>>> 1 file changed, 9 insertions(+) >>>> So, why exactly can't this be entirely common code , but a CPU-specific >>>> code ? :) >>> Do you mean to make those empty functions as common code for all arch >>> cpu to use? >> Yes. >> >>> It seems there is no place to put common code for all arch cpu. >> Isn't that what the common/ directory is for ? ;-) > No, this is making something common for the sake of making it common > rather than good architecutre of the code I think. We aren't going to > share real cache functions just these dummy ones. So it is the right place: arch/arm/lib/cache.c to put the dummy cache function. > We may re-evaluate > our dummy ones at some point in the future when people try and use some > particular combination harder, see for example the PowerPC dummy cache > functions we just recently dropped. Thanks! > If this patch set are ok for you. I will sent more patches to drop the dummy cache functions in <arch>/cpu/ folders. Also the flush_cache() in arch/arm/lib/cache.c can be dropped and just call flush_dcache_range() as the ARM1136, ARM926ejs alreay implemented their own flush_cache(). Best Regards, Josh Wu ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-09 3:54 ` Josh Wu @ 2015-06-09 13:11 ` Tom Rini 2015-06-10 9:49 ` Josh Wu 0 siblings, 1 reply; 21+ messages in thread From: Tom Rini @ 2015-06-09 13:11 UTC (permalink / raw) To: u-boot On Tue, Jun 09, 2015 at 11:54:14AM +0800, Josh Wu wrote: > Hi, Tom > > On 6/8/2015 9:20 PM, Tom Rini wrote: > >On Mon, Jun 08, 2015 at 10:26:29AM +0200, Marek Vasut wrote: > >>On Monday, June 08, 2015 at 04:05:04 AM, Josh Wu wrote: > >>>Hi, Marek > >>> > >>>On 6/5/2015 9:18 PM, Marek Vasut wrote: > >>>>On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: > >>>>>Since some driver like ohci, lcd used dcache functions. But some ARM > >>>>>cpu don't implement the invalidate_dcache_range()/flush_dcache_range() > >>>>>functions. > >>>>> > >>>>>To avoid compiling errors this patch adds an weak empty stub function > >>>>>for all ARM cpu. > >>>>> > >>>>>And each cpu can implement its own implementation. If not implemented > >>>>>by default it will use an empty function. > >>>>> > >>>>>Signed-off-by: Josh Wu <josh.wu@atmel.com> > >>>>>--- > >>>>> > >>>>>Changes in v2: new added > >>>>> > >>>>> arch/arm/lib/cache.c | 9 +++++++++ > >>>>> 1 file changed, 9 insertions(+) > >>>>So, why exactly can't this be entirely common code , but a CPU-specific > >>>>code ? :) > >>>Do you mean to make those empty functions as common code for all arch > >>>cpu to use? > >>Yes. > >> > >>>It seems there is no place to put common code for all arch cpu. > >>Isn't that what the common/ directory is for ? ;-) > >No, this is making something common for the sake of making it common > >rather than good architecutre of the code I think. We aren't going to > >share real cache functions just these dummy ones. > > So it is the right place: arch/arm/lib/cache.c to put the dummy > cache function. Yes. > >We may re-evaluate > >our dummy ones at some point in the future when people try and use some > >particular combination harder, see for example the PowerPC dummy cache > >functions we just recently dropped. Thanks! > > If this patch set are ok for you. I will sent more patches to drop > the dummy cache functions in <arch>/cpu/ folders. Right, that's the best palce I think, baring an existing arch having a location for weak cache functions already (like arm does). > Also the flush_cache() in arch/arm/lib/cache.c can be dropped and > just call flush_dcache_range() as the ARM1136, ARM926ejs alreay > implemented their own flush_cache(). Nope, other things fail if you do that (vpac270_nor_256 and 24 others at least so far in my test build). -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150609/8212e1fc/attachment.sig> ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-09 13:11 ` Tom Rini @ 2015-06-10 9:49 ` Josh Wu 2015-06-10 9:58 ` Marek Vasut 2015-06-10 18:20 ` Tom Rini 0 siblings, 2 replies; 21+ messages in thread From: Josh Wu @ 2015-06-10 9:49 UTC (permalink / raw) To: u-boot On 6/9/2015 9:11 PM, Tom Rini wrote: > On Tue, Jun 09, 2015 at 11:54:14AM +0800, Josh Wu wrote: >> Hi, Tom >> >> On 6/8/2015 9:20 PM, Tom Rini wrote: >>> On Mon, Jun 08, 2015 at 10:26:29AM +0200, Marek Vasut wrote: >>>> On Monday, June 08, 2015 at 04:05:04 AM, Josh Wu wrote: >>>>> Hi, Marek >>>>> >>>>> On 6/5/2015 9:18 PM, Marek Vasut wrote: >>>>>> On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: >>>>>>> Since some driver like ohci, lcd used dcache functions. But some ARM >>>>>>> cpu don't implement the invalidate_dcache_range()/flush_dcache_range() >>>>>>> functions. >>>>>>> >>>>>>> To avoid compiling errors this patch adds an weak empty stub function >>>>>>> for all ARM cpu. >>>>>>> >>>>>>> And each cpu can implement its own implementation. If not implemented >>>>>>> by default it will use an empty function. >>>>>>> >>>>>>> Signed-off-by: Josh Wu <josh.wu@atmel.com> >>>>>>> --- >>>>>>> >>>>>>> Changes in v2: new added >>>>>>> >>>>>>> arch/arm/lib/cache.c | 9 +++++++++ >>>>>>> 1 file changed, 9 insertions(+) >>>>>> So, why exactly can't this be entirely common code , but a CPU-specific >>>>>> code ? :) >>>>> Do you mean to make those empty functions as common code for all arch >>>>> cpu to use? >>>> Yes. >>>> >>>>> It seems there is no place to put common code for all arch cpu. >>>> Isn't that what the common/ directory is for ? ;-) >>> No, this is making something common for the sake of making it common >>> rather than good architecutre of the code I think. We aren't going to >>> share real cache functions just these dummy ones. >> So it is the right place: arch/arm/lib/cache.c to put the dummy >> cache function. > Yes. > >>> We may re-evaluate >>> our dummy ones at some point in the future when people try and use some >>> particular combination harder, see for example the PowerPC dummy cache >>> functions we just recently dropped. Thanks! >> If this patch set are ok for you. I will sent more patches to drop >> the dummy cache functions in <arch>/cpu/ folders. > Right, that's the best palce I think, baring an existing arch having a > location for weak cache functions already (like arm does). > >> Also the flush_cache() in arch/arm/lib/cache.c can be dropped and >> just call flush_dcache_range() as the ARM1136, ARM926ejs alreay >> implemented their own flush_cache(). > Nope, other things fail if you do that (vpac270_nor_256 and 24 others at > least so far in my test build). Does it fail to compile or on running? As I don't have the board to test the binary, but I don't find any compile error when I apply such a patch. Maybe it is better to sent out my patch for you to check. Best Regards, Josh Wu > ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-10 9:49 ` Josh Wu @ 2015-06-10 9:58 ` Marek Vasut 2015-06-11 5:03 ` Josh Wu 2015-06-10 18:20 ` Tom Rini 1 sibling, 1 reply; 21+ messages in thread From: Marek Vasut @ 2015-06-10 9:58 UTC (permalink / raw) To: u-boot On Wednesday, June 10, 2015 at 11:49:54 AM, Josh Wu wrote: > On 6/9/2015 9:11 PM, Tom Rini wrote: > > On Tue, Jun 09, 2015 at 11:54:14AM +0800, Josh Wu wrote: > >> Hi, Tom > >> > >> On 6/8/2015 9:20 PM, Tom Rini wrote: > >>> On Mon, Jun 08, 2015 at 10:26:29AM +0200, Marek Vasut wrote: > >>>> On Monday, June 08, 2015 at 04:05:04 AM, Josh Wu wrote: > >>>>> Hi, Marek > >>>>> > >>>>> On 6/5/2015 9:18 PM, Marek Vasut wrote: > >>>>>> On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: > >>>>>>> Since some driver like ohci, lcd used dcache functions. But some > >>>>>>> ARM cpu don't implement the > >>>>>>> invalidate_dcache_range()/flush_dcache_range() functions. > >>>>>>> > >>>>>>> To avoid compiling errors this patch adds an weak empty stub > >>>>>>> function for all ARM cpu. > >>>>>>> > >>>>>>> And each cpu can implement its own implementation. If not > >>>>>>> implemented by default it will use an empty function. > >>>>>>> > >>>>>>> Signed-off-by: Josh Wu <josh.wu@atmel.com> > >>>>>>> --- > >>>>>>> > >>>>>>> Changes in v2: new added > >>>>>>> > >>>>>>> arch/arm/lib/cache.c | 9 +++++++++ > >>>>>>> 1 file changed, 9 insertions(+) > >>>>>> > >>>>>> So, why exactly can't this be entirely common code , but a > >>>>>> CPU-specific code ? :) > >>>>> > >>>>> Do you mean to make those empty functions as common code for all arch > >>>>> cpu to use? > >>>> > >>>> Yes. > >>>> > >>>>> It seems there is no place to put common code for all arch cpu. > >>>> > >>>> Isn't that what the common/ directory is for ? ;-) > >>> > >>> No, this is making something common for the sake of making it common > >>> rather than good architecutre of the code I think. We aren't going to > >>> share real cache functions just these dummy ones. > >> > >> So it is the right place: arch/arm/lib/cache.c to put the dummy > >> cache function. > > > > Yes. > > > >>> We may re-evaluate > >>> our dummy ones at some point in the future when people try and use some > >>> particular combination harder, see for example the PowerPC dummy cache > >>> functions we just recently dropped. Thanks! > >> > >> If this patch set are ok for you. I will sent more patches to drop > >> the dummy cache functions in <arch>/cpu/ folders. > > > > Right, that's the best palce I think, baring an existing arch having a > > location for weak cache functions already (like arm does). > > > >> Also the flush_cache() in arch/arm/lib/cache.c can be dropped and > >> just call flush_dcache_range() as the ARM1136, ARM926ejs alreay > >> implemented their own flush_cache(). > > > > Nope, other things fail if you do that (vpac270_nor_256 and 24 others at > > least so far in my test build). > > Does it fail to compile or on running? As I don't have the board to test > the binary, but I don't find any compile error when I apply such a patch. > Maybe it is better to sent out my patch for you to check. VPAC is PXA270 and to my knowledge, PXA has no cache support in place at all. ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-10 9:58 ` Marek Vasut @ 2015-06-11 5:03 ` Josh Wu 0 siblings, 0 replies; 21+ messages in thread From: Josh Wu @ 2015-06-11 5:03 UTC (permalink / raw) To: u-boot On 6/10/2015 5:58 PM, Marek Vasut wrote: > On Wednesday, June 10, 2015 at 11:49:54 AM, Josh Wu wrote: >> On 6/9/2015 9:11 PM, Tom Rini wrote: >>> On Tue, Jun 09, 2015 at 11:54:14AM +0800, Josh Wu wrote: >>>> Hi, Tom >>>> >>>> On 6/8/2015 9:20 PM, Tom Rini wrote: >>>>> On Mon, Jun 08, 2015 at 10:26:29AM +0200, Marek Vasut wrote: >>>>>> On Monday, June 08, 2015 at 04:05:04 AM, Josh Wu wrote: >>>>>>> Hi, Marek >>>>>>> >>>>>>> On 6/5/2015 9:18 PM, Marek Vasut wrote: >>>>>>>> On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: >>>>>>>>> Since some driver like ohci, lcd used dcache functions. But some >>>>>>>>> ARM cpu don't implement the >>>>>>>>> invalidate_dcache_range()/flush_dcache_range() functions. >>>>>>>>> >>>>>>>>> To avoid compiling errors this patch adds an weak empty stub >>>>>>>>> function for all ARM cpu. >>>>>>>>> >>>>>>>>> And each cpu can implement its own implementation. If not >>>>>>>>> implemented by default it will use an empty function. >>>>>>>>> >>>>>>>>> Signed-off-by: Josh Wu <josh.wu@atmel.com> >>>>>>>>> --- >>>>>>>>> >>>>>>>>> Changes in v2: new added >>>>>>>>> >>>>>>>>> arch/arm/lib/cache.c | 9 +++++++++ >>>>>>>>> 1 file changed, 9 insertions(+) >>>>>>>> So, why exactly can't this be entirely common code , but a >>>>>>>> CPU-specific code ? :) >>>>>>> Do you mean to make those empty functions as common code for all arch >>>>>>> cpu to use? >>>>>> Yes. >>>>>> >>>>>>> It seems there is no place to put common code for all arch cpu. >>>>>> Isn't that what the common/ directory is for ? ;-) >>>>> No, this is making something common for the sake of making it common >>>>> rather than good architecutre of the code I think. We aren't going to >>>>> share real cache functions just these dummy ones. >>>> So it is the right place: arch/arm/lib/cache.c to put the dummy >>>> cache function. >>> Yes. >>> >>>>> We may re-evaluate >>>>> our dummy ones at some point in the future when people try and use some >>>>> particular combination harder, see for example the PowerPC dummy cache >>>>> functions we just recently dropped. Thanks! >>>> If this patch set are ok for you. I will sent more patches to drop >>>> the dummy cache functions in <arch>/cpu/ folders. >>> Right, that's the best palce I think, baring an existing arch having a >>> location for weak cache functions already (like arm does). >>> >>>> Also the flush_cache() in arch/arm/lib/cache.c can be dropped and >>>> just call flush_dcache_range() as the ARM1136, ARM926ejs alreay >>>> implemented their own flush_cache(). >>> Nope, other things fail if you do that (vpac270_nor_256 and 24 others at >>> least so far in my test build). >> Does it fail to compile or on running? As I don't have the board to test >> the binary, but I don't find any compile error when I apply such a patch. >> Maybe it is better to sent out my patch for you to check. > VPAC is PXA270 and to my knowledge, PXA has no cache support in place at all. ok, so use a empty function is reasonable for pxa. Marek, Tom I just sent out another two patches: first one is drop the invalidate_dcache_range()/flush_dcache_range(). second one is drop the flush_cache() function. Could you check those two patches? thank you. Best Regards, Josh Wu ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache 2015-06-10 9:49 ` Josh Wu 2015-06-10 9:58 ` Marek Vasut @ 2015-06-10 18:20 ` Tom Rini 1 sibling, 0 replies; 21+ messages in thread From: Tom Rini @ 2015-06-10 18:20 UTC (permalink / raw) To: u-boot On Wed, Jun 10, 2015 at 05:49:54PM +0800, Josh Wu wrote: > On 6/9/2015 9:11 PM, Tom Rini wrote: > >On Tue, Jun 09, 2015 at 11:54:14AM +0800, Josh Wu wrote: > >>Hi, Tom > >> > >>On 6/8/2015 9:20 PM, Tom Rini wrote: > >>>On Mon, Jun 08, 2015 at 10:26:29AM +0200, Marek Vasut wrote: > >>>>On Monday, June 08, 2015 at 04:05:04 AM, Josh Wu wrote: > >>>>>Hi, Marek > >>>>> > >>>>>On 6/5/2015 9:18 PM, Marek Vasut wrote: > >>>>>>On Friday, June 05, 2015 at 09:47:30 AM, Josh Wu wrote: > >>>>>>>Since some driver like ohci, lcd used dcache functions. But some ARM > >>>>>>>cpu don't implement the invalidate_dcache_range()/flush_dcache_range() > >>>>>>>functions. > >>>>>>> > >>>>>>>To avoid compiling errors this patch adds an weak empty stub function > >>>>>>>for all ARM cpu. > >>>>>>> > >>>>>>>And each cpu can implement its own implementation. If not implemented > >>>>>>>by default it will use an empty function. > >>>>>>> > >>>>>>>Signed-off-by: Josh Wu <josh.wu@atmel.com> > >>>>>>>--- > >>>>>>> > >>>>>>>Changes in v2: new added > >>>>>>> > >>>>>>> arch/arm/lib/cache.c | 9 +++++++++ > >>>>>>> 1 file changed, 9 insertions(+) > >>>>>>So, why exactly can't this be entirely common code , but a CPU-specific > >>>>>>code ? :) > >>>>>Do you mean to make those empty functions as common code for all arch > >>>>>cpu to use? > >>>>Yes. > >>>> > >>>>>It seems there is no place to put common code for all arch cpu. > >>>>Isn't that what the common/ directory is for ? ;-) > >>>No, this is making something common for the sake of making it common > >>>rather than good architecutre of the code I think. We aren't going to > >>>share real cache functions just these dummy ones. > >>So it is the right place: arch/arm/lib/cache.c to put the dummy > >>cache function. > >Yes. > > > >>>We may re-evaluate > >>>our dummy ones at some point in the future when people try and use some > >>>particular combination harder, see for example the PowerPC dummy cache > >>>functions we just recently dropped. Thanks! > >>If this patch set are ok for you. I will sent more patches to drop > >>the dummy cache functions in <arch>/cpu/ folders. > >Right, that's the best palce I think, baring an existing arch having a > >location for weak cache functions already (like arm does). > > > >>Also the flush_cache() in arch/arm/lib/cache.c can be dropped and > >>just call flush_dcache_range() as the ARM1136, ARM926ejs alreay > >>implemented their own flush_cache(). > >Nope, other things fail if you do that (vpac270_nor_256 and 24 others at > >least so far in my test build). > > Does it fail to compile or on running? As I don't have the board to > test the binary, but I don't find any compile error when I apply > such a patch. It was a link failure for me when I just dropped flush_cache() from arch/arm/lib/cache.c -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150610/9bad2491/attachment.sig> ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions 2015-06-05 7:47 [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache Josh Wu ` (2 preceding siblings ...) 2015-06-05 13:18 ` [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache Marek Vasut @ 2015-06-11 5:21 ` Josh Wu 2015-06-11 5:21 ` [U-Boot] [PATCH 1/2] ARM: cache: drop the empty dcache functions as we have it in lib/cache.c Josh Wu ` (2 more replies) 3 siblings, 3 replies; 21+ messages in thread From: Josh Wu @ 2015-06-11 5:21 UTC (permalink / raw) To: u-boot This series is based on the patch I sent: http://patchwork.ozlabs.org/patch/481095/ As above introduces the default empty function for invalidate_dcache_range() & flush_dcache_range() in arch/arm/lib/cache.c. So in this series, we can drop the empty stubs in arch/arm/cpu/ Also this series introduces a default function for flush_cache(). Josh Wu (2): ARM: cache: drop the empty dcache functions as we have it in lib/cache.c ARM: cache: implement a default flush_cache() function arch/arm/cpu/arm1136/cpu.c | 17 ----------------- arch/arm/cpu/arm926ejs/cache.c | 17 ----------------- arch/arm/cpu/armv7/cache_v7.c | 21 --------------------- arch/arm/cpu/armv8/cache_v8.c | 16 ---------------- arch/arm/lib/cache.c | 26 +++++--------------------- 5 files changed, 5 insertions(+), 92 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 1/2] ARM: cache: drop the empty dcache functions as we have it in lib/cache.c 2015-06-11 5:21 ` [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions Josh Wu @ 2015-06-11 5:21 ` Josh Wu 2015-09-12 9:14 ` Albert ARIBAUD 2015-06-11 5:21 ` [U-Boot] [PATCH 2/2] ARM: cache: implement a default flush_cache() function Josh Wu 2015-07-01 2:01 ` [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions Josh Wu 2 siblings, 1 reply; 21+ messages in thread From: Josh Wu @ 2015-06-11 5:21 UTC (permalink / raw) To: u-boot As there are empty function invalidate_dcache_range(), flush_dcache_range() in arch/arm/lib/cache.c. So we can reuse it by just drop them in arch/arm/cpu/. Signed-off-by: Josh Wu <josh.wu@atmel.com> --- arch/arm/cpu/arm1136/cpu.c | 8 -------- arch/arm/cpu/arm926ejs/cache.c | 8 -------- arch/arm/cpu/armv7/cache_v7.c | 8 -------- arch/arm/cpu/armv8/cache_v8.c | 8 -------- 4 files changed, 32 deletions(-) diff --git a/arch/arm/cpu/arm1136/cpu.c b/arch/arm/cpu/arm1136/cpu.c index a7aed4b..b4d1d54 100644 --- a/arch/arm/cpu/arm1136/cpu.c +++ b/arch/arm/cpu/arm1136/cpu.c @@ -134,14 +134,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range(unsigned long start, unsigned long stop) -{ -} - -void flush_dcache_range(unsigned long start, unsigned long stop) -{ -} - void flush_cache(unsigned long start, unsigned long size) { } diff --git a/arch/arm/cpu/arm926ejs/cache.c b/arch/arm/cpu/arm926ejs/cache.c index 8d7873c..99d1a13 100644 --- a/arch/arm/cpu/arm926ejs/cache.c +++ b/arch/arm/cpu/arm926ejs/cache.c @@ -83,14 +83,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range(unsigned long start, unsigned long stop) -{ -} - -void flush_dcache_range(unsigned long start, unsigned long stop) -{ -} - void flush_cache(unsigned long start, unsigned long size) { } diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c index e8ee875..4f0e406 100644 --- a/arch/arm/cpu/armv7/cache_v7.c +++ b/arch/arm/cpu/armv7/cache_v7.c @@ -304,14 +304,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range(unsigned long start, unsigned long stop) -{ -} - -void flush_dcache_range(unsigned long start, unsigned long stop) -{ -} - void arm_init_before_mmu(void) { } diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c index c5ec529..f8c17cc 100644 --- a/arch/arm/cpu/armv8/cache_v8.c +++ b/arch/arm/cpu/armv8/cache_v8.c @@ -149,14 +149,6 @@ void flush_dcache_all(void) { } -void invalidate_dcache_range(unsigned long start, unsigned long stop) -{ -} - -void flush_dcache_range(unsigned long start, unsigned long stop) -{ -} - void dcache_enable(void) { } -- 1.9.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 1/2] ARM: cache: drop the empty dcache functions as we have it in lib/cache.c 2015-06-11 5:21 ` [U-Boot] [PATCH 1/2] ARM: cache: drop the empty dcache functions as we have it in lib/cache.c Josh Wu @ 2015-09-12 9:14 ` Albert ARIBAUD 2015-09-12 13:17 ` Tom Rini 0 siblings, 1 reply; 21+ messages in thread From: Albert ARIBAUD @ 2015-09-12 9:14 UTC (permalink / raw) To: u-boot Hello Josh, Sorry this series somehow dropped off my radar completely. Is it still needed now? If it does, then it would require rework as some of the functions removed are not empty anymore. On Thu, 11 Jun 2015 13:21:45 +0800, Josh Wu <josh.wu@atmel.com> wrote: > As there are empty function invalidate_dcache_range(), flush_dcache_range() > in arch/arm/lib/cache.c. So we can reuse it by just drop them in arch/arm/cpu/. > > Signed-off-by: Josh Wu <josh.wu@atmel.com> > --- > > arch/arm/cpu/arm1136/cpu.c | 8 -------- > arch/arm/cpu/arm926ejs/cache.c | 8 -------- > arch/arm/cpu/armv7/cache_v7.c | 8 -------- > arch/arm/cpu/armv8/cache_v8.c | 8 -------- > 4 files changed, 32 deletions(-) > > diff --git a/arch/arm/cpu/arm1136/cpu.c b/arch/arm/cpu/arm1136/cpu.c > index a7aed4b..b4d1d54 100644 > --- a/arch/arm/cpu/arm1136/cpu.c > +++ b/arch/arm/cpu/arm1136/cpu.c > @@ -134,14 +134,6 @@ void flush_dcache_all(void) > { > } > > -void invalidate_dcache_range(unsigned long start, unsigned long stop) > -{ > -} > - > -void flush_dcache_range(unsigned long start, unsigned long stop) > -{ > -} > - > void flush_cache(unsigned long start, unsigned long size) > { > } > diff --git a/arch/arm/cpu/arm926ejs/cache.c b/arch/arm/cpu/arm926ejs/cache.c > index 8d7873c..99d1a13 100644 > --- a/arch/arm/cpu/arm926ejs/cache.c > +++ b/arch/arm/cpu/arm926ejs/cache.c > @@ -83,14 +83,6 @@ void flush_dcache_all(void) > { > } > > -void invalidate_dcache_range(unsigned long start, unsigned long stop) > -{ > -} > - > -void flush_dcache_range(unsigned long start, unsigned long stop) > -{ > -} > - > void flush_cache(unsigned long start, unsigned long size) > { > } > diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c > index e8ee875..4f0e406 100644 > --- a/arch/arm/cpu/armv7/cache_v7.c > +++ b/arch/arm/cpu/armv7/cache_v7.c > @@ -304,14 +304,6 @@ void flush_dcache_all(void) > { > } > > -void invalidate_dcache_range(unsigned long start, unsigned long stop) > -{ > -} > - > -void flush_dcache_range(unsigned long start, unsigned long stop) > -{ > -} > - > void arm_init_before_mmu(void) > { > } > diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c > index c5ec529..f8c17cc 100644 > --- a/arch/arm/cpu/armv8/cache_v8.c > +++ b/arch/arm/cpu/armv8/cache_v8.c > @@ -149,14 +149,6 @@ void flush_dcache_all(void) > { > } > > -void invalidate_dcache_range(unsigned long start, unsigned long stop) > -{ > -} > - > -void flush_dcache_range(unsigned long start, unsigned long stop) > -{ > -} > - > void dcache_enable(void) > { > } > -- > 1.9.1 > Amicalement, -- Albert. ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 1/2] ARM: cache: drop the empty dcache functions as we have it in lib/cache.c 2015-09-12 9:14 ` Albert ARIBAUD @ 2015-09-12 13:17 ` Tom Rini 0 siblings, 0 replies; 21+ messages in thread From: Tom Rini @ 2015-09-12 13:17 UTC (permalink / raw) To: u-boot On Sat, Sep 12, 2015 at 11:14:18AM +0200, Albert ARIBAUD wrote: > Hello Josh, > > Sorry this series somehow dropped off my radar completely. Is it still > needed now? If it does, then it would require rework as some of the > functions removed are not empty anymore. An updated version of this series which handled other arches has been applied now. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150912/307fae99/attachment.sig> ^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 2/2] ARM: cache: implement a default flush_cache() function 2015-06-11 5:21 ` [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions Josh Wu 2015-06-11 5:21 ` [U-Boot] [PATCH 1/2] ARM: cache: drop the empty dcache functions as we have it in lib/cache.c Josh Wu @ 2015-06-11 5:21 ` Josh Wu 2015-07-01 2:01 ` [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions Josh Wu 2 siblings, 0 replies; 21+ messages in thread From: Josh Wu @ 2015-06-11 5:21 UTC (permalink / raw) To: u-boot It will just call flush_dcache_range(). As ARM1136 & ARM926ejs already implemented their own flush_cache(), those code in weak function in arch/arm/lib/cache.c can be dropped. Signed-off-by: Josh Wu <josh.wu@atmel.com> --- arch/arm/cpu/arm1136/cpu.c | 9 --------- arch/arm/cpu/arm926ejs/cache.c | 9 --------- arch/arm/cpu/armv7/cache_v7.c | 13 ------------- arch/arm/cpu/armv8/cache_v8.c | 8 -------- arch/arm/lib/cache.c | 26 +++++--------------------- 5 files changed, 5 insertions(+), 60 deletions(-) diff --git a/arch/arm/cpu/arm1136/cpu.c b/arch/arm/cpu/arm1136/cpu.c index b4d1d54..f092ffc 100644 --- a/arch/arm/cpu/arm1136/cpu.c +++ b/arch/arm/cpu/arm1136/cpu.c @@ -120,11 +120,6 @@ void flush_dcache_range(unsigned long start, unsigned long stop) asm volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)); } -void flush_cache(unsigned long start, unsigned long size) -{ - flush_dcache_range(start, start + size); -} - #else /* #ifndef CONFIG_SYS_DCACHE_OFF */ void invalidate_dcache_all(void) { @@ -133,10 +128,6 @@ void invalidate_dcache_all(void) void flush_dcache_all(void) { } - -void flush_cache(unsigned long start, unsigned long size) -{ -} #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */ #if !defined(CONFIG_SYS_ICACHE_OFF) || !defined(CONFIG_SYS_DCACHE_OFF) diff --git a/arch/arm/cpu/arm926ejs/cache.c b/arch/arm/cpu/arm926ejs/cache.c index 99d1a13..e5c1a6a 100644 --- a/arch/arm/cpu/arm926ejs/cache.c +++ b/arch/arm/cpu/arm926ejs/cache.c @@ -69,11 +69,6 @@ void flush_dcache_range(unsigned long start, unsigned long stop) asm volatile("mcr p15, 0, %0, c7, c10, 4\n" : : "r"(0)); } - -void flush_cache(unsigned long start, unsigned long size) -{ - flush_dcache_range(start, start + size); -} #else /* #ifndef CONFIG_SYS_DCACHE_OFF */ void invalidate_dcache_all(void) { @@ -82,10 +77,6 @@ void invalidate_dcache_all(void) void flush_dcache_all(void) { } - -void flush_cache(unsigned long start, unsigned long size) -{ -} #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */ /* diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c index 4f0e406..a5aa4fa 100644 --- a/arch/arm/cpu/armv7/cache_v7.c +++ b/arch/arm/cpu/armv7/cache_v7.c @@ -286,15 +286,6 @@ void mmu_page_table_flush(unsigned long start, unsigned long stop) flush_dcache_range(start, stop); v7_inval_tlb(); } - -/* - * Flush range from all levels of d-cache/unified-cache used: - * Affects the range [start, start + size - 1] - */ -void flush_cache(unsigned long start, unsigned long size) -{ - flush_dcache_range(start, start + size); -} #else /* #ifndef CONFIG_SYS_DCACHE_OFF */ void invalidate_dcache_all(void) { @@ -308,10 +299,6 @@ void arm_init_before_mmu(void) { } -void flush_cache(unsigned long start, unsigned long size) -{ -} - void mmu_page_table_flush(unsigned long start, unsigned long stop) { } diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c index f8c17cc..92b66c3 100644 --- a/arch/arm/cpu/armv8/cache_v8.c +++ b/arch/arm/cpu/armv8/cache_v8.c @@ -217,11 +217,3 @@ void __weak enable_caches(void) icache_enable(); dcache_enable(); } - -/* - * Flush range from all levels of d-cache/unified-cache - */ -void flush_cache(unsigned long start, unsigned long size) -{ - flush_dcache_range(start, start + size); -} diff --git a/arch/arm/lib/cache.c b/arch/arm/lib/cache.c index bc48f53..cd13db3 100644 --- a/arch/arm/lib/cache.c +++ b/arch/arm/lib/cache.c @@ -10,29 +10,13 @@ #include <common.h> #include <malloc.h> +/* + * Flush range from all levels of d-cache/unified-cache. + * Affects the range [start, start + size - 1]. + */ __weak void flush_cache(unsigned long start, unsigned long size) { -#if defined(CONFIG_CPU_ARM1136) - -#if !defined(CONFIG_SYS_ICACHE_OFF) - asm("mcr p15, 0, r1, c7, c5, 0"); /* invalidate I cache */ -#endif - -#if !defined(CONFIG_SYS_DCACHE_OFF) - asm("mcr p15, 0, r1, c7, c14, 0"); /* Clean+invalidate D cache */ -#endif - -#endif /* CONFIG_CPU_ARM1136 */ - -#ifdef CONFIG_CPU_ARM926EJS -#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) - /* test and clean, page 2-23 of arm926ejs manual */ - asm("0: mrc p15, 0, r15, c7, c10, 3\n\t" "bne 0b\n" : : : "memory"); - /* disable write buffer as well (page 2-22) */ - asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)); -#endif -#endif /* CONFIG_CPU_ARM926EJS */ - return; + flush_dcache_range(start, start + size); } /* -- 1.9.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions 2015-06-11 5:21 ` [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions Josh Wu 2015-06-11 5:21 ` [U-Boot] [PATCH 1/2] ARM: cache: drop the empty dcache functions as we have it in lib/cache.c Josh Wu 2015-06-11 5:21 ` [U-Boot] [PATCH 2/2] ARM: cache: implement a default flush_cache() function Josh Wu @ 2015-07-01 2:01 ` Josh Wu 2 siblings, 0 replies; 21+ messages in thread From: Josh Wu @ 2015-07-01 2:01 UTC (permalink / raw) To: u-boot Hi, Any feedback for this series patch? Best Regards, Josh Wu On 6/11/2015 1:21 PM, Josh Wu wrote: > This series is based on the patch I sent: > http://patchwork.ozlabs.org/patch/481095/ > As above introduces the default empty function for invalidate_dcache_range() & > flush_dcache_range() in arch/arm/lib/cache.c. > So in this series, we can drop the empty stubs in arch/arm/cpu/ > > Also this series introduces a default function for flush_cache(). > > > Josh Wu (2): > ARM: cache: drop the empty dcache functions as we have it in > lib/cache.c > ARM: cache: implement a default flush_cache() function > > arch/arm/cpu/arm1136/cpu.c | 17 ----------------- > arch/arm/cpu/arm926ejs/cache.c | 17 ----------------- > arch/arm/cpu/armv7/cache_v7.c | 21 --------------------- > arch/arm/cpu/armv8/cache_v8.c | 16 ---------------- > arch/arm/lib/cache.c | 26 +++++--------------------- > 5 files changed, 5 insertions(+), 92 deletions(-) > ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2015-09-12 13:17 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-06-05 7:47 [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache Josh Wu 2015-06-05 7:47 ` [U-Boot] [PATCH v2 2/3] m68k: cache: add an empty stub functions " Josh Wu 2015-06-05 21:29 ` Angelo Dureghello 2015-06-05 7:47 ` [U-Boot] [PATCH v2 3/3] usb: ohci: enable cache support Josh Wu 2015-06-05 13:18 ` [U-Boot] [PATCH v2 1/3] ARM: cache: add an empty stub function for invalidate/flush dcache Marek Vasut 2015-06-08 2:05 ` Josh Wu 2015-06-08 8:26 ` Marek Vasut 2015-06-08 9:15 ` Josh Wu 2015-06-08 13:20 ` Tom Rini 2015-06-09 3:54 ` Josh Wu 2015-06-09 13:11 ` Tom Rini 2015-06-10 9:49 ` Josh Wu 2015-06-10 9:58 ` Marek Vasut 2015-06-11 5:03 ` Josh Wu 2015-06-10 18:20 ` Tom Rini 2015-06-11 5:21 ` [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions Josh Wu 2015-06-11 5:21 ` [U-Boot] [PATCH 1/2] ARM: cache: drop the empty dcache functions as we have it in lib/cache.c Josh Wu 2015-09-12 9:14 ` Albert ARIBAUD 2015-09-12 13:17 ` Tom Rini 2015-06-11 5:21 ` [U-Boot] [PATCH 2/2] ARM: cache: implement a default flush_cache() function Josh Wu 2015-07-01 2:01 ` [U-Boot] [resend][PATCH 0/2] ARM: cache: clean up the code to drop the empty stub functions Josh Wu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox