All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] MIPS: bcm63xx: define SDRAM_MBASE_REG
@ 2011-09-21 13:39 Florian Fainelli
  2011-09-21 13:39 ` [PATCH 1/3] MIPS: introduce GENERIC_DUMP_TLB Florian Fainelli
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Florian Fainelli @ 2011-09-21 13:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Florian Fainelli, Florian Fainelli

From: Florian Fainelli <ffainelli@freebox.fr>

This register offset in the SDRAM controller is going to be used by BCM6345.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
index 0ed5230..6e803ac 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -734,6 +734,8 @@
 #define SDRAM_CFG_BANK_SHIFT		13
 #define SDRAM_CFG_BANK_MASK		(1 << SDRAM_CFG_BANK_SHIFT)
 
+#define SDRAM_MBASE_REG			0xc
+
 #define SDRAM_PRIO_REG			0x2C
 #define SDRAM_PRIO_MIPS_SHIFT		29
 #define SDRAM_PRIO_MIPS_MASK		(1 << SDRAM_PRIO_MIPS_SHIFT)
-- 
1.7.4.1

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

* [PATCH 1/3] MIPS: introduce GENERIC_DUMP_TLB
  2011-09-21 13:39 [PATCH 1/5] MIPS: bcm63xx: define SDRAM_MBASE_REG Florian Fainelli
@ 2011-09-21 13:39 ` Florian Fainelli
  2011-09-21 13:48   ` Florian Fainelli
  2011-09-21 13:39 ` [PATCH 2/5] MIPS: bcm63xx: fix SDRAM size computation for BCM6345 Florian Fainelli
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Florian Fainelli @ 2011-09-21 13:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Florian Fainelli

Allows us not to duplicate more lines in arch/mips/lib/Makefile.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 arch/mips/Kconfig      |    4 ++++
 arch/mips/lib/Makefile |   20 +-------------------
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d300c2b..9f4ade4 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1803,6 +1803,10 @@ config SIBYTE_DMA_PAGEOPS
 config CPU_HAS_PREFETCH
 	bool
 
+config CPU_GENERIC_DUMP_TLB
+	bool
+	default y if !(CPU_R3000 || CPU_R6000 || CPU_R8000 || CPU_TX39XX)
+
 choice
 	prompt "MIPS MT options"
 
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index b2cad4f..d8c290c 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -8,27 +8,9 @@ lib-y	+= csum_partial.o delay.o memcpy.o memcpy-inatomic.o memset.o \
 obj-y			+= iomap.o
 obj-$(CONFIG_PCI)	+= iomap-pci.o
 
-obj-$(CONFIG_CPU_LOONGSON2)	+= dump_tlb.o
-obj-$(CONFIG_CPU_MIPS32)	+= dump_tlb.o
-obj-$(CONFIG_CPU_MIPS64)	+= dump_tlb.o
-obj-$(CONFIG_CPU_NEVADA)	+= dump_tlb.o
-obj-$(CONFIG_CPU_R10000)	+= dump_tlb.o
+obj-$(CONFIG_CPU_GENERIC_DUMP_TLB) += dump_tlb.o
 obj-$(CONFIG_CPU_R3000)		+= r3k_dump_tlb.o
-obj-$(CONFIG_CPU_R4300)		+= dump_tlb.o
-obj-$(CONFIG_CPU_R4X00)		+= dump_tlb.o
-obj-$(CONFIG_CPU_R5000)		+= dump_tlb.o
-obj-$(CONFIG_CPU_R5432)		+= dump_tlb.o
-obj-$(CONFIG_CPU_R5500)		+= dump_tlb.o
-obj-$(CONFIG_CPU_R6000)		+=
-obj-$(CONFIG_CPU_R8000)		+=
-obj-$(CONFIG_CPU_RM7000)	+= dump_tlb.o
-obj-$(CONFIG_CPU_RM9000)	+= dump_tlb.o
-obj-$(CONFIG_CPU_SB1)		+= dump_tlb.o
 obj-$(CONFIG_CPU_TX39XX)	+= r3k_dump_tlb.o
-obj-$(CONFIG_CPU_TX49XX)	+= dump_tlb.o
-obj-$(CONFIG_CPU_VR41XX)	+= dump_tlb.o
-obj-$(CONFIG_CPU_CAVIUM_OCTEON)	+= dump_tlb.o
-obj-$(CONFIG_CPU_XLR)		+= dump_tlb.o
 
 # libgcc-style stuff needed in the kernel
 obj-y += ashldi3.o ashrdi3.o cmpdi2.o lshrdi3.o ucmpdi2.o
-- 
1.7.4.1

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

* [PATCH 2/5] MIPS: bcm63xx: fix SDRAM size computation for BCM6345
  2011-09-21 13:39 [PATCH 1/5] MIPS: bcm63xx: define SDRAM_MBASE_REG Florian Fainelli
  2011-09-21 13:39 ` [PATCH 1/3] MIPS: introduce GENERIC_DUMP_TLB Florian Fainelli
@ 2011-09-21 13:39 ` Florian Fainelli
  2011-09-22 10:20   ` Sergei Shtylyov
  2011-09-21 13:39 ` [PATCH 2/3] MIPS: introduce CPU_R4K_FPU Florian Fainelli
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Florian Fainelli @ 2011-09-21 13:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Florian Fainelli, Florian Fainelli

From: Florian Fainelli <ffainelli@freebox.fr>

Instead of hardcoding the amount of available RAM, read the number of
effective multiples of 8MB from SDRAM_MBASE_REG.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 arch/mips/bcm63xx/cpu.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index 7c7e4d4..7ad1b39 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -260,8 +260,10 @@ static unsigned int detect_memory_size(void)
 	unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
 	u32 val;
 
-	if (BCMCPU_IS_6345())
-		return (8 * 1024 * 1024);
+	if (BCMCPU_IS_6345()) {
+		val = bcm_sdram_readl(SDRAM_MBASE_REG);
+		return (val * 8 * 1024 * 1024);
+	}
 
 	if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
 		val = bcm_sdram_readl(SDRAM_CFG_REG);
-- 
1.7.4.1

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

* [PATCH 2/3] MIPS: introduce CPU_R4K_FPU
  2011-09-21 13:39 [PATCH 1/5] MIPS: bcm63xx: define SDRAM_MBASE_REG Florian Fainelli
  2011-09-21 13:39 ` [PATCH 1/3] MIPS: introduce GENERIC_DUMP_TLB Florian Fainelli
  2011-09-21 13:39 ` [PATCH 2/5] MIPS: bcm63xx: fix SDRAM size computation for BCM6345 Florian Fainelli
@ 2011-09-21 13:39 ` Florian Fainelli
  2011-09-21 13:39 ` [PATCH 3/5] MIPS: bcm63xx: define MPI_BASE for BCM6345 Florian Fainelli
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2011-09-21 13:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Florian Fainelli

R4K-style CPUs have this boolean defined by default. Allows us
to remove some lines in arch/mips/kernel/Makefile.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 arch/mips/Kconfig         |    4 ++++
 arch/mips/kernel/Makefile |   18 +-----------------
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 9f4ade4..44eebc7 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1807,6 +1807,10 @@ config CPU_GENERIC_DUMP_TLB
 	bool
 	default y if !(CPU_R3000 || CPU_R6000 || CPU_R8000 || CPU_TX39XX)
 
+config CPU_R4K_FPU
+	bool
+	default y if !(CPU_R3000 || CPU_R6000 || CPU_TX39XX || CPU_CAVIUM_OCTEON)
+
 choice
 	prompt "MIPS MT options"
 
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 83bba33..d07c112 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -32,27 +32,11 @@ obj-$(CONFIG_MODULES)		+= mips_ksyms.o module.o
 
 obj-$(CONFIG_FUNCTION_TRACER)	+= mcount.o ftrace.o
 
-obj-$(CONFIG_CPU_LOONGSON2)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_MIPS32)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_MIPS64)	+= r4k_fpu.o r4k_switch.o
+obj-$(CONFIG_CPU_R4K_FPU)	+= r4k_fpu.o r4k_switch.o
 obj-$(CONFIG_CPU_R3000)		+= r2300_fpu.o r2300_switch.o
-obj-$(CONFIG_CPU_R4300)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R4X00)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R5000)		+= r4k_fpu.o r4k_switch.o
 obj-$(CONFIG_CPU_R6000)		+= r6000_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R5432)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R5500)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R8000)		+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_RM7000)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_RM9000)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_NEVADA)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_R10000)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_SB1)		+= r4k_fpu.o r4k_switch.o
 obj-$(CONFIG_CPU_TX39XX)	+= r2300_fpu.o r2300_switch.o
-obj-$(CONFIG_CPU_TX49XX)	+= r4k_fpu.o r4k_switch.o
-obj-$(CONFIG_CPU_VR41XX)	+= r4k_fpu.o r4k_switch.o
 obj-$(CONFIG_CPU_CAVIUM_OCTEON)	+= octeon_switch.o
-obj-$(CONFIG_CPU_XLR)		+= r4k_fpu.o r4k_switch.o
 
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_SMP_UP)		+= smp-up.o
-- 
1.7.4.1

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

* [PATCH 3/5] MIPS: bcm63xx: define MPI_BASE for BCM6345
  2011-09-21 13:39 [PATCH 1/5] MIPS: bcm63xx: define SDRAM_MBASE_REG Florian Fainelli
                   ` (2 preceding siblings ...)
  2011-09-21 13:39 ` [PATCH 2/3] MIPS: introduce CPU_R4K_FPU Florian Fainelli
@ 2011-09-21 13:39 ` Florian Fainelli
  2011-09-21 13:39 ` [PATCH 3/3] MIPS: introduce CPU_R4K_CACHE_TLB Florian Fainelli
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2011-09-21 13:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Florian Fainelli, Florian Fainelli

From: Florian Fainelli <ffainelli@freebox.fr>

We are going to use this register to remove some BCM6345 specific hacks.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
index 96a2391..9fe3b7c 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
@@ -163,7 +163,7 @@ enum bcm63xx_regs_set {
 #define BCM_6345_ENET0_BASE		(0xfffe1800)
 #define BCM_6345_ENETDMA_BASE		(0xfffe2800)
 #define BCM_6345_PCMCIA_BASE		(0xfffe2028)
-#define BCM_6345_MPI_BASE		(0xdeadbeef)
+#define BCM_6345_MPI_BASE		(0xfffe2000)
 #define BCM_6345_OHCI0_BASE		(0xfffe2100)
 #define BCM_6345_OHCI_PRIV_BASE		(0xfffe2200)
 #define BCM_6345_USBH_PRIV_BASE		(0xdeadbeef)
-- 
1.7.4.1

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

* [PATCH 3/3] MIPS: introduce CPU_R4K_CACHE_TLB
  2011-09-21 13:39 [PATCH 1/5] MIPS: bcm63xx: define SDRAM_MBASE_REG Florian Fainelli
                   ` (3 preceding siblings ...)
  2011-09-21 13:39 ` [PATCH 3/5] MIPS: bcm63xx: define MPI_BASE for BCM6345 Florian Fainelli
@ 2011-09-21 13:39 ` Florian Fainelli
  2011-09-21 13:39 ` [PATCH 4/5] MIPS: bcm63xx: remove BCM6345 hacks to read base boot address Florian Fainelli
  2011-09-21 13:39 ` [PATCH 5/5] MIPS: bcm63xx: fix GPIO set/get for BCM6345 Florian Fainelli
  6 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2011-09-21 13:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Florian Fainelli

R4K-style CPUs having common code to support their caches and tlb have this
boolean defined by default. Allows us to remove some lines in
arch/mips/mm/Makefile.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 arch/mips/Kconfig     |    4 ++++
 arch/mips/mm/Makefile |   16 +---------------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 44eebc7..a250607 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1811,6 +1811,10 @@ config CPU_R4K_FPU
 	bool
 	default y if !(CPU_R3000 || CPU_R6000 || CPU_TX39XX || CPU_CAVIUM_OCTEON)
 
+config CPU_R4K_CACHE_TLB
+	bool
+	default y if !(CPU_R3000 || CPU_R8000 || CPU_SB1 || CPU_TX39XX || CPU_CAVIUM_OCTEON)
+
 choice
 	prompt "MIPS MT options"
 
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
index 4d8c162..8e880da 100644
--- a/arch/mips/mm/Makefile
+++ b/arch/mips/mm/Makefile
@@ -11,26 +11,12 @@ obj-$(CONFIG_64BIT)		+= pgtable-64.o
 obj-$(CONFIG_HIGHMEM)		+= highmem.o
 obj-$(CONFIG_HUGETLB_PAGE)	+= hugetlbpage.o
 
-obj-$(CONFIG_CPU_LOONGSON2)	+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_MIPS32)	+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_MIPS64)	+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_NEVADA)	+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_R10000)	+= c-r4k.o cex-gen.o tlb-r4k.o
+obj-$(CONFIG_CPU_R4K_CACHE_TLB) += c-r4k.o cex-gen.o tlb-r4k.o
 obj-$(CONFIG_CPU_R3000)		+= c-r3k.o tlb-r3k.o
-obj-$(CONFIG_CPU_R4300)		+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_R4X00)		+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_R5000)		+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_R5432)		+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_R5500)		+= c-r4k.o cex-gen.o tlb-r4k.o
 obj-$(CONFIG_CPU_R8000)		+= c-r4k.o cex-gen.o tlb-r8k.o
-obj-$(CONFIG_CPU_RM7000)	+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_RM9000)	+= c-r4k.o cex-gen.o tlb-r4k.o
 obj-$(CONFIG_CPU_SB1)		+= c-r4k.o cerr-sb1.o cex-sb1.o tlb-r4k.o
 obj-$(CONFIG_CPU_TX39XX)	+= c-tx39.o tlb-r3k.o
-obj-$(CONFIG_CPU_TX49XX)	+= c-r4k.o cex-gen.o tlb-r4k.o
-obj-$(CONFIG_CPU_VR41XX)	+= c-r4k.o cex-gen.o tlb-r4k.o
 obj-$(CONFIG_CPU_CAVIUM_OCTEON)	+= c-octeon.o cex-oct.o tlb-r4k.o
-obj-$(CONFIG_CPU_XLR)		+= c-r4k.o tlb-r4k.o cex-gen.o
 
 obj-$(CONFIG_IP22_CPU_SCACHE)	+= sc-ip22.o
 obj-$(CONFIG_R5000_CPU_SCACHE)  += sc-r5k.o
-- 
1.7.4.1

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

* [PATCH 4/5] MIPS: bcm63xx: remove BCM6345 hacks to read base boot address
  2011-09-21 13:39 [PATCH 1/5] MIPS: bcm63xx: define SDRAM_MBASE_REG Florian Fainelli
                   ` (4 preceding siblings ...)
  2011-09-21 13:39 ` [PATCH 3/3] MIPS: introduce CPU_R4K_CACHE_TLB Florian Fainelli
@ 2011-09-21 13:39 ` Florian Fainelli
  2011-09-21 13:39 ` [PATCH 5/5] MIPS: bcm63xx: fix GPIO set/get for BCM6345 Florian Fainelli
  6 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2011-09-21 13:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Florian Fainelli, Florian Fainelli

From: Florian Fainelli <ffainelli@freebox.fr>

Though BCM6345 does not technically have the same MPI register layout
than the other SoCs, reading the chip-select registers is done the same
way, and particularly for chip-select 0, which is the boot flash.
Now that BCM6345 has a MPI_BASE register defined, use it.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 arch/mips/bcm63xx/boards/board_bcm963xx.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 40b223b..ac948c2 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -709,15 +709,9 @@ void __init board_prom_init(void)
 	char cfe_version[32];
 	u32 val;
 
-	/* read base address of boot chip select (0)
-	 * 6345 does not have MPI but boots from standard
-	 * MIPS Flash address */
-	if (BCMCPU_IS_6345())
-		val = 0x1fc00000;
-	else {
-		val = bcm_mpi_readl(MPI_CSBASE_REG(0));
-		val &= MPI_CSBASE_BASE_MASK;
-	}
+	/* read base address of boot chip select (0) */
+	val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+	val &= MPI_CSBASE_BASE_MASK;
 	boot_addr = (u8 *)KSEG1ADDR(val);
 
 	/* dump cfe version */
@@ -893,12 +887,9 @@ int __init board_register_devices(void)
 		bcm63xx_dsp_register(&board.dsp);
 
 	/* read base address of boot chip select (0) */
-	if (BCMCPU_IS_6345())
-		val = 0x1fc00000;
-	else {
-		val = bcm_mpi_readl(MPI_CSBASE_REG(0));
-		val &= MPI_CSBASE_BASE_MASK;
-	}
+	val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+	val &= MPI_CSBASE_BASE_MASK;
+
 	mtd_resources[0].start = val;
 	mtd_resources[0].end = 0x1FFFFFFF;
 
-- 
1.7.4.1

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

* [PATCH 5/5] MIPS: bcm63xx: fix GPIO set/get for BCM6345
  2011-09-21 13:39 [PATCH 1/5] MIPS: bcm63xx: define SDRAM_MBASE_REG Florian Fainelli
                   ` (5 preceding siblings ...)
  2011-09-21 13:39 ` [PATCH 4/5] MIPS: bcm63xx: remove BCM6345 hacks to read base boot address Florian Fainelli
@ 2011-09-21 13:39 ` Florian Fainelli
  6 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2011-09-21 13:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Florian Fainelli, Florian Fainelli

From: Florian Fainelli <ffainelli@freebox.fr>

On BCM6345, the register offsets for the set/get GPIO registers is wrong
in order not add more complexity, use the HI_* variants for BCM6345
which results in reading/writing from/to the right register offsets.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 arch/mips/bcm63xx/gpio.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/arch/mips/bcm63xx/gpio.c b/arch/mips/bcm63xx/gpio.c
index f560fe7..154353f 100644
--- a/arch/mips/bcm63xx/gpio.c
+++ b/arch/mips/bcm63xx/gpio.c
@@ -4,7 +4,7 @@
  * for more details.
  *
  * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
- * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
+ * Copyright (C) 2008-2011 Florian Fainelli <florian@openwrt.org>
  */
 
 #include <linux/kernel.h>
@@ -33,7 +33,10 @@ static void bcm63xx_gpio_set(struct gpio_chip *chip,
 		BUG();
 
 	if (gpio < 32) {
-		reg = GPIO_DATA_LO_REG;
+		if (!BCMCPU_IS_6345())
+			reg = GPIO_DATA_LO_REG;
+		else
+			reg = GPIO_DATA_HI_REG;
 		mask = 1 << gpio;
 		v = &gpio_out_low;
 	} else {
@@ -60,7 +63,10 @@ static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio)
 		BUG();
 
 	if (gpio < 32) {
-		reg = GPIO_DATA_LO_REG;
+		if (!BCMCPU_IS_6345())
+			reg = GPIO_DATA_LO_REG;
+		else
+			reg = GPIO_DATA_HI_REG;
 		mask = 1 << gpio;
 	} else {
 		reg = GPIO_DATA_HI_REG;
@@ -125,7 +131,11 @@ static struct gpio_chip bcm63xx_gpio_chip = {
 
 int __init bcm63xx_gpio_init(void)
 {
-	gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_REG);
+	if (!BCMCPU_IS_6345())
+		gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_REG);
+	else
+		gpio_out_low = bcm_gpio_readl(GPIO_DATA_HI_REG);
+
 	gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG);
 	bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
 	pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);
-- 
1.7.4.1

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

* Re: [PATCH 1/3] MIPS: introduce GENERIC_DUMP_TLB
  2011-09-21 13:39 ` [PATCH 1/3] MIPS: introduce GENERIC_DUMP_TLB Florian Fainelli
@ 2011-09-21 13:48   ` Florian Fainelli
  0 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2011-09-21 13:48 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips

Ralf,

On Wednesday 21 September 2011 15:39:44 Florian Fainelli wrote:
> Allows us not to duplicate more lines in arch/mips/lib/Makefile.
> 
> Signed-off-by: Florian Fainelli <florian@openwrt.org>

I did not meant to resend this 3-series patch with the BCM6345 5 patches, 
sorry for the noise.
-- 
Florian

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

* Re: [PATCH 2/5] MIPS: bcm63xx: fix SDRAM size computation for BCM6345
  2011-09-21 13:39 ` [PATCH 2/5] MIPS: bcm63xx: fix SDRAM size computation for BCM6345 Florian Fainelli
@ 2011-09-22 10:20   ` Sergei Shtylyov
  2011-09-22 16:48     ` Florian Fainelli
  0 siblings, 1 reply; 11+ messages in thread
From: Sergei Shtylyov @ 2011-09-22 10:20 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: ralf, linux-mips, Florian Fainelli

Hello.

On 21-09-2011 17:39, Florian Fainelli wrote:

> From: Florian Fainelli<ffainelli@freebox.fr>

> Instead of hardcoding the amount of available RAM, read the number of
> effective multiples of 8MB from SDRAM_MBASE_REG.

> Signed-off-by: Florian Fainelli<florian@openwrt.org>
> ---
>   arch/mips/bcm63xx/cpu.c |    6 ++++--
>   1 files changed, 4 insertions(+), 2 deletions(-)

> diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
> index 7c7e4d4..7ad1b39 100644
> --- a/arch/mips/bcm63xx/cpu.c
> +++ b/arch/mips/bcm63xx/cpu.c
> @@ -260,8 +260,10 @@ static unsigned int detect_memory_size(void)
>   	unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
>   	u32 val;
>
> -	if (BCMCPU_IS_6345())
> -		return (8 * 1024 * 1024);
> +	if (BCMCPU_IS_6345()) {
> +		val = bcm_sdram_readl(SDRAM_MBASE_REG);
> +		return (val * 8 * 1024 * 1024);

    Parens not needed here.

WBR, Sergei

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

* Re: [PATCH 2/5] MIPS: bcm63xx: fix SDRAM size computation for BCM6345
  2011-09-22 10:20   ` Sergei Shtylyov
@ 2011-09-22 16:48     ` Florian Fainelli
  0 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2011-09-22 16:48 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: ralf, linux-mips

On Thursday 22 September 2011 12:20:50 Sergei Shtylyov wrote:
> Hello.
> 
> On 21-09-2011 17:39, Florian Fainelli wrote:
> > From: Florian Fainelli<ffainelli@freebox.fr>
> > 
> > Instead of hardcoding the amount of available RAM, read the number of
> > effective multiples of 8MB from SDRAM_MBASE_REG.
> > 
> > Signed-off-by: Florian Fainelli<florian@openwrt.org>
> > ---
> > 
> >   arch/mips/bcm63xx/cpu.c |    6 ++++--
> >   1 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
> > index 7c7e4d4..7ad1b39 100644
> > --- a/arch/mips/bcm63xx/cpu.c
> > +++ b/arch/mips/bcm63xx/cpu.c
> > @@ -260,8 +260,10 @@ static unsigned int detect_memory_size(void)
> > 
> >   	unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
> >   	u32 val;
> > 
> > -	if (BCMCPU_IS_6345())
> > -		return (8 * 1024 * 1024);
> > +	if (BCMCPU_IS_6345()) {
> > +		val = bcm_sdram_readl(SDRAM_MBASE_REG);
> > +		return (val * 8 * 1024 * 1024);
> 
>     Parens not needed here.

For consistency with other parts of the code, I would rather keep it.
-- 
Florian

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

end of thread, other threads:[~2011-09-22 16:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21 13:39 [PATCH 1/5] MIPS: bcm63xx: define SDRAM_MBASE_REG Florian Fainelli
2011-09-21 13:39 ` [PATCH 1/3] MIPS: introduce GENERIC_DUMP_TLB Florian Fainelli
2011-09-21 13:48   ` Florian Fainelli
2011-09-21 13:39 ` [PATCH 2/5] MIPS: bcm63xx: fix SDRAM size computation for BCM6345 Florian Fainelli
2011-09-22 10:20   ` Sergei Shtylyov
2011-09-22 16:48     ` Florian Fainelli
2011-09-21 13:39 ` [PATCH 2/3] MIPS: introduce CPU_R4K_FPU Florian Fainelli
2011-09-21 13:39 ` [PATCH 3/5] MIPS: bcm63xx: define MPI_BASE for BCM6345 Florian Fainelli
2011-09-21 13:39 ` [PATCH 3/3] MIPS: introduce CPU_R4K_CACHE_TLB Florian Fainelli
2011-09-21 13:39 ` [PATCH 4/5] MIPS: bcm63xx: remove BCM6345 hacks to read base boot address Florian Fainelli
2011-09-21 13:39 ` [PATCH 5/5] MIPS: bcm63xx: fix GPIO set/get for BCM6345 Florian Fainelli

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.