Skip to contentSkip to conversation

MIPS: ath79: make ath79_ddr_ctrl_init() compatible for newer SoCs

PATCH In review Felix Fietkau 2 participants 4 messages May 16, 2016 – May 20, 2016 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 MIPS: ath79: make ath79_ddr_ctrl_init() compatible for newer SoCs

AR913x, AR724x and AR933x are the only SoCs where the ath79_ddr_wb_flush_base starts at 0x7c, all newer SoCs use 0x9c Invert the logic to make the code compatible with AR95xx

---
 arch/mips/ath79/common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/mips/ath79/common.c +4 -4
index 3cedd1f..84d4502 100644
@@ -46,12 +46,12 @@ void ath79_ddr_ctrl_init(void)
 {
 	ath79_ddr_base = ioremap_nocache(AR71XX_DDR_CTRL_BASE,
 					 AR71XX_DDR_CTRL_SIZE);
-	if (soc_is_ar71xx() || soc_is_ar934x()) {
-		ath79_ddr_wb_flush_base = ath79_ddr_base + 0x9c;
-		ath79_ddr_pci_win_base = ath79_ddr_base + 0x7c;
-	} else {
+	if (soc_is_ar913x() || soc_is_ar724x() || soc_is_ar933x()) {
 		ath79_ddr_wb_flush_base = ath79_ddr_base + 0x7c;
 		ath79_ddr_pci_win_base = 0;
+	} else {
+		ath79_ddr_wb_flush_base = ath79_ddr_base + 0x9c;
+		ath79_ddr_pci_win_base = ath79_ddr_base + 0x7c;
 	}
 }
 EXPORT_SYMBOL_GPL(ath79_ddr_ctrl_init);
Signature · 1 line
2.2.2
#1 lore raw

PATCH v2 2/2 MIPS: ath79: fix regression in PCI window initialization

ath79_ddr_pci_win_base has the type void __iomem *, so register offsets need to be a multiple of 4.

Cc Alban Bedel <[email protected]>
Fixes 24b0e3e84fbf ("MIPS: ath79: Improve the DDR controller interface")
---
 arch/mips/ath79/common.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
arch/mips/ath79/common.c +8 -8
index 84d4502..d071a3a 100644
@@ -76,14 +76,14 @@ void ath79_ddr_set_pci_windows(void)
 {
 	BUG_ON(!ath79_ddr_pci_win_base);
 
-	__raw_writel(AR71XX_PCI_WIN0_OFFS, ath79_ddr_pci_win_base + 0);
-	__raw_writel(AR71XX_PCI_WIN1_OFFS, ath79_ddr_pci_win_base + 1);
-	__raw_writel(AR71XX_PCI_WIN2_OFFS, ath79_ddr_pci_win_base + 2);
-	__raw_writel(AR71XX_PCI_WIN3_OFFS, ath79_ddr_pci_win_base + 3);
-	__raw_writel(AR71XX_PCI_WIN4_OFFS, ath79_ddr_pci_win_base + 4);
-	__raw_writel(AR71XX_PCI_WIN5_OFFS, ath79_ddr_pci_win_base + 5);
-	__raw_writel(AR71XX_PCI_WIN6_OFFS, ath79_ddr_pci_win_base + 6);
-	__raw_writel(AR71XX_PCI_WIN7_OFFS, ath79_ddr_pci_win_base + 7);
+	__raw_writel(AR71XX_PCI_WIN0_OFFS, ath79_ddr_pci_win_base + 0x0);
+	__raw_writel(AR71XX_PCI_WIN1_OFFS, ath79_ddr_pci_win_base + 0x4);
+	__raw_writel(AR71XX_PCI_WIN2_OFFS, ath79_ddr_pci_win_base + 0x8);
+	__raw_writel(AR71XX_PCI_WIN3_OFFS, ath79_ddr_pci_win_base + 0xc);
+	__raw_writel(AR71XX_PCI_WIN4_OFFS, ath79_ddr_pci_win_base + 0x10);
+	__raw_writel(AR71XX_PCI_WIN5_OFFS, ath79_ddr_pci_win_base + 0x14);
+	__raw_writel(AR71XX_PCI_WIN6_OFFS, ath79_ddr_pci_win_base + 0x18);
+	__raw_writel(AR71XX_PCI_WIN7_OFFS, ath79_ddr_pci_win_base + 0x1c);
 }
 EXPORT_SYMBOL_GPL(ath79_ddr_set_pci_windows);
 
Signature · 1 line
2.2.2
Acked-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] MIPS: ath79: fix regression in PCI window initialization

In reply to Felix Fietkau
Quoted 6 lines · On Mon, 16 May 2016 19:51:55 +0200 Felix Fietkau <[email protected]> wrote:

ath79_ddr_pci_win_base has the type void __iomem *, so register offsets need to be a multiple of 4.

Cc Alban Bedel <[email protected]>
Fixes 24b0e3e84fbf ("MIPS: ath79: Improve the DDR controller interface")

Alban