Skip to contentSkip to conversation

Fix CPM1 uart console

PATCH In review Jochen Friedrich 2 participants 2 messages Aug 29, 2007 – Sep 12, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix CPM1 uart console

The powerpc version of commproc.c doesn't export cpm_dpram_phys due to a typo. The ppc version of cpm_dpram_addr returns a usable virtual address mapped to a physical address at the same location. cpm_dpram_phys returns complete garbage as it tries to calculate an offset based on an otherwise unused virtual adress returned by ioremap.

This patch fixes the typo for powerpc and removes the unnecessary ioremap and corresponding virtual address for ppc.

---
 arch/powerpc/sysdev/commproc.c |    2 +-
 arch/ppc/8xx_io/commproc.c     |    4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/sysdev/commproc.c +1 -1
index 4f67b89..dd5417a 100644
@@ -395,4 +395,4 @@ uint cpm_dpram_phys(u8* addr)
 {
 	return (dpram_pbase + (uint)(addr - dpram_vbase));
 }
-EXPORT_SYMBOL(cpm_dpram_addr);
+EXPORT_SYMBOL(cpm_dpram_phys);
arch/ppc/8xx_io/commproc.c +1 -3
index 7088428..593b939 100644
@@ -379,14 +379,12 @@ static rh_block_t cpm_boot_dpmem_rh_block[16];
 static rh_info_t cpm_dpmem_info;
 
 #define CPM_DPMEM_ALIGNMENT	8
-static u8* dpram_vbase;
 static uint dpram_pbase;
 
 void m8xx_cpm_dpinit(void)
 {
 	spin_lock_init(&cpm_dpmem_lock);
 
-	dpram_vbase = immr_map_size(im_cpm.cp_dpmem, CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE);
 	dpram_pbase = (uint)&((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem;
 
 	/* Initialize the info header */
@@ -465,6 +463,6 @@ EXPORT_SYMBOL(cpm_dpram_addr);
 
 uint cpm_dpram_phys(u8* addr)
 {
-	return (dpram_pbase + (uint)(addr - dpram_vbase));
+	return (uint)addr;
 }
 EXPORT_SYMBOL(cpm_dpram_phys);
#1 lore raw
Quoted 45 lines · Jochen Friedrich

The powerpc version of commproc.c doesn't export cpm_dpram_phys due to a typo. The ppc version of cpm_dpram_addr returns a usable virtual address mapped to a physical address at the same location. cpm_dpram_phys returns complete garbage as it tries to calculate an offset based on an otherwise unused virtual adress returned by ioremap.

This patch fixes the typo for powerpc and removes the unnecessary ioremap and corresponding virtual address for ppc.

---
 arch/powerpc/sysdev/commproc.c |    2 +-
 arch/ppc/8xx_io/commproc.c     |    4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/sysdev/commproc.c +1 -1
index 4f67b89..dd5417a 100644
@@ -395,4 +395,4 @@ uint cpm_dpram_phys(u8* addr)
 {
 	return (dpram_pbase + (uint)(addr - dpram_vbase));
 }
-EXPORT_SYMBOL(cpm_dpram_addr);
+EXPORT_SYMBOL(cpm_dpram_phys);
arch/ppc/8xx_io/commproc.c +0 -2
index 7088428..593b939 100644
@@ -379,14 +379,12 @@ static rh_block_t cpm_boot_dpmem_rh_block[16];
 static rh_info_t cpm_dpmem_info;
 
 #define CPM_DPMEM_ALIGNMENT	8
-static u8* dpram_vbase;
 static uint dpram_pbase;
 
 void m8xx_cpm_dpinit(void)
 {
 	spin_lock_init(&cpm_dpmem_lock);
 
-	dpram_vbase = immr_map_size(im_cpm.cp_dpmem, CPM_DATAONLY_BASE +  
 CPM_DATAONLY_SIZE);
 	dpram_pbase = (uint)&((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem;
 
arch/ppc/8xx_io/commproc.c +0 -0
 	/* Initialize the info header */

arch/ppc/8xx_io/commproc.c EXPORT_SYMBOL(cpm_dpram_addr); · line 466

Quoted 5 lines
arch/ppc/8xx_io/commproc.c +1 -1
@@ -465,6 +463,6 @@ EXPORT_SYMBOL(cpm_dpram_addr);
 
 uint cpm_dpram_phys(u8* addr)
 {
-	return (dpram_pbase + (uint)(addr - dpram_vbase));
+	return (uint)addr;

this doesn't seem quite right.

Quoted 7 lines
arch/ppc/8xx_io/commproc.c +0 -0
 }
 EXPORT_SYMBOL(cpm_dpram_phys);

_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded