aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ppc40x/patches/104-magicboxv2-cf-card-fixup.patch
blob: 56e337c2814d158883c116f44bd9a899349eb26d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- a/arch/powerpc/boot/cuboot-magicboxv2.c
+++ b/arch/powerpc/boot/cuboot-magicboxv2.c
@@ -2,6 +2,7 @@
  * Old U-boot compatibility for Magicbox v2
  *
  * Author: Imre Kaloz <kaloz@openwrt.org>
+ *         Gabor Juhos <juhosg@openwrt.org>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
@@ -22,8 +23,36 @@
 
 static bd_t bd;
 
+static void fixup_cf_card(void)
+{
+#define DCRN_CPC0_PCI_BASE	0xf9
+#define CF_CS0_BASE	0xff100000
+#define CF_CS1_BASE	0xff200000
+
+	/* Turn on PerWE instead of PCIsomething */
+	mtdcr(DCRN_CPC0_PCI_BASE,
+	      mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27));
+
+	/* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */
+	mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR);
+	mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
+	mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP);
+	mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
+
+	/* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */
+	mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR);
+	mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
+	mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP);
+	mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
+
+#undef DCRN_CPC0_PCI_BASE
+#undef CF_CS0_BASE
+#undef CF_CS1_BASE
+}
+
 static void magicboxv2_fixups(void)
 {
+	fixup_cf_card();
 	ibm405ep_fixup_clocks(25000000);
 	ibm4xx_sdram_fixup_memsize();
 	dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr);