diff mbox

[U-Boot,v3,2/4] ARM: cache: add an empty stub function for invalidate/flush dcache

Message ID 1437968418-21319-3-git-send-email-josh.wu@atmel.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Josh Wu July 27, 2015, 3:40 a.m. UTC
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 in arch/arm/lib/cache.c.
And ARM cpu still can implemnt its own cache functions on the cpu folder.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

Changes in v3:
- remove the same functions in the cpu/ files as they will use the weak
  function provided in lib/cache.c

Changes in v2:
- new added.

 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 --------
 arch/arm/lib/cache.c           | 9 +++++++++
 5 files changed, 9 insertions(+), 32 deletions(-)

Comments

York Sun July 27, 2015, 4:31 p.m. UTC | #1
On 07/26/2015 08:40 PM, 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 in arch/arm/lib/cache.c.
> And ARM cpu still can implemnt its own cache functions on the cpu folder.
> 
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
> 
> Changes in v3:
> - remove the same functions in the cpu/ files as they will use the weak
>   function provided in lib/cache.c
> 
> Changes in v2:
> - new added.
> 

<snip>

> 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)
>  {
>  }

Are you sure about this change? You are probably changing the wrong leg of the
#if conditional code.

York
Josh Wu July 28, 2015, 2:17 a.m. UTC | #2
Hi, York

On 7/28/2015 12:31 AM, York Sun wrote:
>
> On 07/26/2015 08:40 PM, 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 in arch/arm/lib/cache.c.
>> And ARM cpu still can implemnt its own cache functions on the cpu folder.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>>
>> Changes in v3:
>> - remove the same functions in the cpu/ files as they will use the weak
>>    function provided in lib/cache.c
>>
>> Changes in v2:
>> - new added.
>>
> <snip>
>
>> 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)
>>   {
>>   }
> Are you sure about this change?

This patch deletes those above empty functions so that the driver will 
use the same weak empty functions in arch/arm/lib/cache.c, which is 
added by this patch as well.

> You are probably changing the wrong leg of the
> #if conditional code.

I don't think so. Could give me more details about this? Thanks.

Best Regards,
Josh Wu

>
> York
York Sun July 28, 2015, 4:24 a.m. UTC | #3
Please search the same name function in the same file.

York

Sent from my cellphone


-------- Original message --------
From: Josh Wu
Date:07/27/2015 19:17 (GMT-08:00)
To: Sun York-R58495 , U-Boot Mailing List , Marek Vasut , Tom Rini
Cc: Masahiro Yamada , Jeroen Hofstee , Valentine Barshak , Simon Glass , Thierry Reding , Masahiro Yamada , Heiko Schocher , Albert Aribaud , Nobuhiro Iwamatsu
Subject: Re: [PATCH v3 2/4] ARM: cache: add an empty stub function for invalidate/flush dcache

Hi, York

On 7/28/2015 12:31 AM, York Sun wrote:
>
> On 07/26/2015 08:40 PM, 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 in arch/arm/lib/cache.c.
>> And ARM cpu still can implemnt its own cache functions on the cpu folder.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>>
>> Changes in v3:
>> - remove the same functions in the cpu/ files as they will use the weak
>>    function provided in lib/cache.c
>>
>> Changes in v2:
>> - new added.
>>
> <snip>
>
>> 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)
>>   {
>>   }
> Are you sure about this change?

This patch deletes those above empty functions so that the driver will
use the same weak empty functions in arch/arm/lib/cache.c, which is
added by this patch as well.

> You are probably changing the wrong leg of the
> #if conditional code.

I don't think so. Could give me more details about this? Thanks.

Best Regards,
Josh Wu

>
> York
Josh Wu July 28, 2015, 5:06 a.m. UTC | #4
Hi, York

On 7/28/2015 12:24 PM, York Sun wrote:
> Please search the same name function in the same file.

yes, there still have flush_dcache_range() & invalidate_dcache_range() 
function defined in case of DCACHE is enabled (CONFIG_SYS_DCACHE_OFF is 
not defined).
And in that case, the empty weak functions flush_dcache_range() & 
invalidate_dcache_range() in arch/arm/lib/cache.c will be ignored. It is 
an expect behavior.

or did I miss something?

Best Regards,
Josh Wu

>
> York
>
> Sent from my cellphone
>
>
> -------- Original message --------
> From: Josh Wu
> Date:07/27/2015 19:17 (GMT-08:00)
> To: Sun York-R58495 , U-Boot Mailing List , Marek Vasut , Tom Rini
> Cc: Masahiro Yamada , Jeroen Hofstee , Valentine Barshak , Simon Glass 
> , Thierry Reding , Masahiro Yamada , Heiko Schocher , Albert Aribaud , 
> Nobuhiro Iwamatsu
> Subject: Re: [PATCH v3 2/4] ARM: cache: add an empty stub function for 
> invalidate/flush dcache
>
> Hi, York
>
> On 7/28/2015 12:31 AM, York Sun wrote:
> >
> > On 07/26/2015 08:40 PM, 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 in arch/arm/lib/cache.c.
> >> And ARM cpu still can implemnt its own cache functions on the cpu 
> folder.
> >>
> >> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> >> ---
> >>
> >> Changes in v3:
> >> - remove the same functions in the cpu/ files as they will use the weak
> >>    function provided in lib/cache.c
> >>
> >> Changes in v2:
> >> - new added.
> >>
> > <snip>
> >
> >> 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)
> >>   {
> >>   }
> > Are you sure about this change?
>
> This patch deletes those above empty functions so that the driver will
> use the same weak empty functions in arch/arm/lib/cache.c, which is
> added by this patch as well.
>
> > You are probably changing the wrong leg of the
> > #if conditional code.
>
> I don't think so. Could give me more details about this? Thanks.
>
> Best Regards,
> Josh Wu
>
> >
> > York
>
York Sun July 28, 2015, 5:21 a.m. UTC | #5
Josh,

No you didn't miss. I think you are right on this file.

York

Sent from my cellphone


-------- Original message --------
From: Josh Wu
Date:07/27/2015 22:07 (GMT-08:00)
To: Sun York-R58495 , U-Boot Mailing List , Marek Vasut , Tom Rini
Cc: Masahiro Yamada , Jeroen Hofstee , Valentine Barshak , Simon Glass , Thierry Reding , Masahiro Yamada , Heiko Schocher , Albert Aribaud , Nobuhiro Iwamatsu
Subject: Re: [PATCH v3 2/4] ARM: cache: add an empty stub function for invalidate/flush dcache

Hi, York

On 7/28/2015 12:24 PM, York Sun wrote:
Please search the same name function in the same file.

yes, there still have flush_dcache_range() & invalidate_dcache_range() function defined in case of DCACHE is enabled (CONFIG_SYS_DCACHE_OFF is not defined).
And in that case, the empty weak functions flush_dcache_range() & invalidate_dcache_range() in arch/arm/lib/cache.c will be ignored. It is an expect behavior.

or did I miss something?

Best Regards,
Josh Wu


York

Sent from my cellphone


-------- Original message --------
From: Josh Wu
Date:07/27/2015 19:17 (GMT-08:00)
To: Sun York-R58495 , U-Boot Mailing List , Marek Vasut , Tom Rini
Cc: Masahiro Yamada , Jeroen Hofstee , Valentine Barshak , Simon Glass , Thierry Reding , Masahiro Yamada , Heiko Schocher , Albert Aribaud , Nobuhiro Iwamatsu
Subject: Re: [PATCH v3 2/4] ARM: cache: add an empty stub function for invalidate/flush dcache

Hi, York

On 7/28/2015 12:31 AM, York Sun wrote:
>
> On 07/26/2015 08:40 PM, 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 in arch/arm/lib/cache.c.
>> And ARM cpu still can implemnt its own cache functions on the cpu folder.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com><mailto:josh.wu@atmel.com>
>> ---
>>
>> Changes in v3:
>> - remove the same functions in the cpu/ files as they will use the weak
>>    function provided in lib/cache.c
>>
>> Changes in v2:
>> - new added.
>>
> <snip>
>
>> 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)
>>   {
>>   }
> Are you sure about this change?

This patch deletes those above empty functions so that the driver will
use the same weak empty functions in arch/arm/lib/cache.c, which is
added by this patch as well.

> You are probably changing the wrong leg of the
> #if conditional code.

I don't think so. Could give me more details about this? Thanks.

Best Regards,
Josh Wu

>
> York
Josh Wu Aug. 4, 2015, 6:50 a.m. UTC | #6
Hi, York

On 7/28/2015 1:21 PM, York Sun wrote:
> Josh,
>
> No you didn't miss. I think you are right on this file.

Thanks for the review, Could I have your reviewed-by tag for this patch?

Best Regards,
Josh Wu
>
> York
>
> Sent from my cellphone
>
>
> -------- Original message --------
> From: Josh Wu
> Date:07/27/2015 22:07 (GMT-08:00)
> To: Sun York-R58495 , U-Boot Mailing List , Marek Vasut , Tom Rini
> Cc: Masahiro Yamada , Jeroen Hofstee , Valentine Barshak , Simon Glass 
> , Thierry Reding , Masahiro Yamada , Heiko Schocher , Albert Aribaud , 
> Nobuhiro Iwamatsu
> Subject: Re: [PATCH v3 2/4] ARM: cache: add an empty stub function for 
> invalidate/flush dcache
>
> Hi, York
>
> On 7/28/2015 12:24 PM, York Sun wrote:
>> Please search the same name function in the same file.
>
> yes, there still have flush_dcache_range() & invalidate_dcache_range() 
> function defined in case of DCACHE is enabled (CONFIG_SYS_DCACHE_OFF 
> is not defined).
> And in that case, the empty weak functions flush_dcache_range() & 
> invalidate_dcache_range() in arch/arm/lib/cache.c will be ignored. It 
> is an expect behavior.
>
> or did I miss something?
>
> Best Regards,
> Josh Wu
>
>>
>> York
>>
>> Sent from my cellphone
>>
>>
>> -------- Original message --------
>> From: Josh Wu
>> Date:07/27/2015 19:17 (GMT-08:00)
>> To: Sun York-R58495 , U-Boot Mailing List , Marek Vasut , Tom Rini
>> Cc: Masahiro Yamada , Jeroen Hofstee , Valentine Barshak , Simon 
>> Glass , Thierry Reding , Masahiro Yamada , Heiko Schocher , Albert 
>> Aribaud , Nobuhiro Iwamatsu
>> Subject: Re: [PATCH v3 2/4] ARM: cache: add an empty stub function 
>> for invalidate/flush dcache
>>
>> Hi, York
>>
>> On 7/28/2015 12:31 AM, York Sun wrote:
>> >
>> > On 07/26/2015 08:40 PM, 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 in arch/arm/lib/cache.c.
>> >> And ARM cpu still can implemnt its own cache functions on the cpu 
>> folder.
>> >>
>> >> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> >> ---
>> >>
>> >> Changes in v3:
>> >> - remove the same functions in the cpu/ files as they will use the 
>> weak
>> >>    function provided in lib/cache.c
>> >>
>> >> Changes in v2:
>> >> - new added.
>> >>
>> > <snip>
>> >
>> >> 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)
>> >>   {
>> >>   }
>> > Are you sure about this change?
>>
>> This patch deletes those above empty functions so that the driver will
>> use the same weak empty functions in arch/arm/lib/cache.c, which is
>> added by this patch as well.
>>
>> > You are probably changing the wrong leg of the
>> > #if conditional code.
>>
>> I don't think so. Could give me more details about this? Thanks.
>>
>> Best Regards,
>> Josh Wu
>>
>> >
>> > York
>>
>
York Sun Aug. 4, 2015, 3:30 p.m. UTC | #7
On 07/26/2015 08:40 PM, 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 in arch/arm/lib/cache.c.
> And ARM cpu still can implemnt its own cache functions on the cpu folder.
> 
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
> 
> Changes in v3:
> - remove the same functions in the cpu/ files as they will use the weak
>   function provided in lib/cache.c
> 
> Changes in v2:
> - new added.
> 
>  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 --------
>  arch/arm/lib/cache.c           | 9 +++++++++
>  5 files changed, 9 insertions(+), 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)
>  {
>  }
> 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
> 

Reviewed-by: York Sun <yorksun@freescale.com>
Josh Wu Aug. 5, 2015, 7:32 a.m. UTC | #8
Hi, York

On 8/4/2015 11:30 PM, York Sun wrote:
>
> On 07/26/2015 08:40 PM, 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 in arch/arm/lib/cache.c.
>> And ARM cpu still can implemnt its own cache functions on the cpu folder.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>>
>> Changes in v3:
>> - remove the same functions in the cpu/ files as they will use the weak
>>    function provided in lib/cache.c
>>
>> Changes in v2:
>> - new added.
>>
>>   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 --------
>>   arch/arm/lib/cache.c           | 9 +++++++++
>>   5 files changed, 9 insertions(+), 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)
>>   {
>>   }
>> 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
>>
> Reviewed-by: York Sun <yorksun@freescale.com>

Thank you.

Best Regards,
Josh Wu
Tom Rini Aug. 13, 2015, 1:20 p.m. UTC | #9
On Mon, Jul 27, 2015 at 11:40:16AM +0800, Wu, Josh 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 in arch/arm/lib/cache.c.
> And ARM cpu still can implemnt its own cache functions on the cpu folder.
> 
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> Reviewed-by: York Sun <yorksun@freescale.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

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)
 {
 }
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