All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] nios2: fix virt_to_phys for nios2 with MMU
@ 2015-10-21 13:10 Thomas Chou
  2015-10-22  1:43 ` Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas Chou @ 2015-10-21 13:10 UTC (permalink / raw)
  To: u-boot

As the virtual address and physical address mapping of nios2 with
MMU are different. Add a check of MMU, and fix the mapping.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 arch/nios2/include/asm/io.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
index d0adf08..fdfc14e 100644
--- a/arch/nios2/include/asm/io.h
+++ b/arch/nios2/include/asm/io.h
@@ -39,7 +39,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 static inline phys_addr_t virt_to_phys(void * vaddr)
 {
-	return (phys_addr_t)(vaddr);
+	DECLARE_GLOBAL_DATA_PTR;
+	if (gd->arch.has_mmu)
+		return (phys_addr_t)(vaddr) & 0x1fffffff;
+	else
+		return (phys_addr_t)(vaddr) & 0x7fffffff;
 }
 
 static inline void *ioremap(unsigned long physaddr, unsigned long size)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] nios2: fix virt_to_phys for nios2 with MMU
  2015-10-21 13:10 [U-Boot] [PATCH] nios2: fix virt_to_phys for nios2 with MMU Thomas Chou
@ 2015-10-22  1:43 ` Marek Vasut
  2015-10-22  1:49 ` Ley Foon Tan
  2015-10-22  7:47 ` [U-Boot] [PATCH v2] " Thomas Chou
  2 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2015-10-22  1:43 UTC (permalink / raw)
  To: u-boot

On Wednesday, October 21, 2015 at 03:10:44 PM, Thomas Chou wrote:
> As the virtual address and physical address mapping of nios2 with
> MMU are different. Add a check of MMU, and fix the mapping.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
>  arch/nios2/include/asm/io.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
> index d0adf08..fdfc14e 100644
> --- a/arch/nios2/include/asm/io.h
> +++ b/arch/nios2/include/asm/io.h
> @@ -39,7 +39,11 @@ static inline void unmap_physmem(void *vaddr, unsigned
> long flags)
> 
>  static inline phys_addr_t virt_to_phys(void * vaddr)
>  {
> -	return (phys_addr_t)(vaddr);
> +	DECLARE_GLOBAL_DATA_PTR;
> +	if (gd->arch.has_mmu)
> +		return (phys_addr_t)(vaddr) & 0x1fffffff;
> +	else
> +		return (phys_addr_t)(vaddr) & 0x7fffffff;

I _think_ the parenthesis around vaddr are not necessary, but otherwise,
I really like to see this patch:

Acked-by: Marek Vasut <marex@denx.de>

>  }
> 
>  static inline void *ioremap(unsigned long physaddr, unsigned long size)

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] nios2: fix virt_to_phys for nios2 with MMU
  2015-10-21 13:10 [U-Boot] [PATCH] nios2: fix virt_to_phys for nios2 with MMU Thomas Chou
  2015-10-22  1:43 ` Marek Vasut
@ 2015-10-22  1:49 ` Ley Foon Tan
  2015-10-22  7:47 ` [U-Boot] [PATCH v2] " Thomas Chou
  2 siblings, 0 replies; 5+ messages in thread
From: Ley Foon Tan @ 2015-10-22  1:49 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 21, 2015 at 9:10 PM, Thomas Chou <thomas@wytron.com.tw> wrote:
> As the virtual address and physical address mapping of nios2 with
> MMU are different. Add a check of MMU, and fix the mapping.
>
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
>  arch/nios2/include/asm/io.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
> index d0adf08..fdfc14e 100644
> --- a/arch/nios2/include/asm/io.h
> +++ b/arch/nios2/include/asm/io.h
> @@ -39,7 +39,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
>
>  static inline phys_addr_t virt_to_phys(void * vaddr)
>  {
> -       return (phys_addr_t)(vaddr);
> +       DECLARE_GLOBAL_DATA_PTR;
> +       if (gd->arch.has_mmu)
> +               return (phys_addr_t)(vaddr) & 0x1fffffff;
> +       else
> +               return (phys_addr_t)(vaddr) & 0x7fffffff;
>  }

Reviewed-by: Ley Foon Tan <lftan@altera.com>

Regards
Ley Foon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] nios2: fix virt_to_phys for nios2 with MMU
  2015-10-21 13:10 [U-Boot] [PATCH] nios2: fix virt_to_phys for nios2 with MMU Thomas Chou
  2015-10-22  1:43 ` Marek Vasut
  2015-10-22  1:49 ` Ley Foon Tan
@ 2015-10-22  7:47 ` Thomas Chou
  2015-10-23  0:20   ` Thomas Chou
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Chou @ 2015-10-22  7:47 UTC (permalink / raw)
  To: u-boot

As the virtual address and physical address mapping of nios2 with
MMU are different. Add a check of MMU, and fix the mapping.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Ley Foon Tan <lftan@altera.com>
---
v2
  remove the parenthesis around vaddr as suggested by Marek.

 arch/nios2/include/asm/io.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
index d0adf08..e7da35b 100644
--- a/arch/nios2/include/asm/io.h
+++ b/arch/nios2/include/asm/io.h
@@ -39,7 +39,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 static inline phys_addr_t virt_to_phys(void * vaddr)
 {
-	return (phys_addr_t)(vaddr);
+	DECLARE_GLOBAL_DATA_PTR;
+	if (gd->arch.has_mmu)
+		return (phys_addr_t)vaddr & 0x1fffffff;
+	else
+		return (phys_addr_t)vaddr & 0x7fffffff;
 }
 
 static inline void *ioremap(unsigned long physaddr, unsigned long size)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH v2] nios2: fix virt_to_phys for nios2 with MMU
  2015-10-22  7:47 ` [U-Boot] [PATCH v2] " Thomas Chou
@ 2015-10-23  0:20   ` Thomas Chou
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Chou @ 2015-10-23  0:20 UTC (permalink / raw)
  To: u-boot



On 10/22/2015 03:47 PM, Thomas Chou wrote:
> As the virtual address and physical address mapping of nios2 with
> MMU are different. Add a check of MMU, and fix the mapping.
>
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> Acked-by: Marek Vasut <marex@denx.de>
> Reviewed-by: Ley Foon Tan <lftan@altera.com>
> ---
> v2
>    remove the parenthesis around vaddr as suggested by Marek.
>
>   arch/nios2/include/asm/io.h | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>

Applied to u-boot-nios.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-23  0:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-21 13:10 [U-Boot] [PATCH] nios2: fix virt_to_phys for nios2 with MMU Thomas Chou
2015-10-22  1:43 ` Marek Vasut
2015-10-22  1:49 ` Ley Foon Tan
2015-10-22  7:47 ` [U-Boot] [PATCH v2] " Thomas Chou
2015-10-23  0:20   ` Thomas Chou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.