From: Josh Boyer <jwboyer@linux.vnet.ibm.com>
To: paulus@samba.org
Cc: linuxppc-dev@ozlabs.org
Subject: [patch 04/10] 4xx bootwrapper reworks
Date: Fri, 03 Aug 2007 11:09:04 -0500 [thread overview]
Message-ID: <20070803161710.676644000@linux.vnet.ibm.com> (raw)
In-Reply-To: <20070803160900.069522000@linux.vnet.ibm.com>>
Make the fixup_memsize function common for all of 4xx as several chips share
the same SDRAM controller. Also add functions to reset 40x chips and quiesce
the ethernet.
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
---
arch/powerpc/boot/44x.h | 4 ----
arch/powerpc/boot/4xx.c | 36 +++++++++++++++++++++++++++++++-----
arch/powerpc/boot/4xx.h | 20 ++++++++++++++++++++
arch/powerpc/boot/dcr.h | 2 ++
arch/powerpc/boot/ebony.c | 3 ++-
5 files changed, 55 insertions(+), 10 deletions(-)
--- linux-2.6.orig/arch/powerpc/boot/44x.h
+++ linux-2.6/arch/powerpc/boot/44x.h
@@ -10,10 +10,6 @@
#ifndef _PPC_BOOT_44X_H_
#define _PPC_BOOT_44X_H_
-void ibm44x_fixup_memsize(void);
-void ibm4xx_fixup_ebc_ranges(const char *ebc);
-
-void ibm44x_dbcr_reset(void);
void ebony_init(void *mac0, void *mac1);
#endif /* _PPC_BOOT_44X_H_ */
--- linux-2.6.orig/arch/powerpc/boot/4xx.c
+++ linux-2.6/arch/powerpc/boot/4xx.c
@@ -21,8 +21,8 @@
#include "reg.h"
#include "dcr.h"
-/* Read the 44x memory controller to get size of system memory. */
-void ibm44x_fixup_memsize(void)
+/* Read the 4xx SDRAM controller to get size of system memory. */
+void ibm4xx_fixup_memsize(void)
{
int i;
unsigned long memsize, bank_config;
@@ -39,22 +39,48 @@ void ibm44x_fixup_memsize(void)
dt_fixup_memory(0, memsize);
}
-#define SPRN_DBCR0 0x134
-#define DBCR0_RST_SYSTEM 0x30000000
+#define DBCR0_RST_SYSTEM 0x30000000
void ibm44x_dbcr_reset(void)
{
unsigned long tmp;
+ /* DBCR0 on 44x is SPRN 0x134 */
asm volatile (
"mfspr %0,%1\n"
"oris %0,%0,%2@h\n"
"mtspr %1,%0"
- : "=&r"(tmp) : "i"(SPRN_DBCR0), "i"(DBCR0_RST_SYSTEM)
+ : "=&r"(tmp) : "i"(0x134), "i"(DBCR0_RST_SYSTEM)
);
}
+void ibm40x_dbcr_reset(void)
+{
+ unsigned long tmp;
+
+ /* DBCR0 on 40x is SPRN 0x3F2 */
+ asm volatile (
+ "mfspr %0,%1\n"
+ "oris %0,%0,%2@h\n"
+ "mtspr %1,%0"
+ : "=&r"(tmp) : "i"(0x3F2), "i"(DBCR0_RST_SYSTEM)
+ );
+}
+
+#define EMAC_RESET 0x20000000
+#define MAL_RESET 0x80000000
+void ibm4xx_quiesce_eth(u32 *emac0, u32 *emac1)
+{
+ /* Quiesce the MAL and EMAC(s) since PIBS/OpenBIOS don't do this for us */
+ if (emac0)
+ *emac0 = EMAC_RESET;
+ if (emac1)
+ *emac1 = EMAC_RESET;
+
+ mtdcr(DCRN_MAL0_CFG, MAL_RESET);
+}
+
/* Read 4xx EBC bus bridge registers to get mappings of the peripheral
* banks into the OPB address space */
void ibm4xx_fixup_ebc_ranges(const char *ebc)
--- /dev/null
+++ linux-2.6/arch/powerpc/boot/4xx.h
@@ -0,0 +1,20 @@
+/*
+ * PowerPC 4xx related functions
+ *
+ * Copyright 2007 IBM Corporation.
+ * Josh Boyer <jwboyer@linux.vnet.ibm.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+#ifndef _POWERPC_BOOT_4XX_H_
+#define _POWERPC_BOOT_4XX_H_
+
+void ibm4xx_fixup_memsize(void);
+void ibm44x_dbcr_reset(void);
+void ibm40x_dbcr_reset(void);
+void ibm4xx_quiesce_eth(u32 *emac0, u32 *emac1);
+void ibm4xx_fixup_ebc_ranges(const char *ebc);
+
+#endif /* _POWERPC_BOOT_4XX_H_ */
--- linux-2.6.orig/arch/powerpc/boot/dcr.h
+++ linux-2.6/arch/powerpc/boot/dcr.h
@@ -121,4 +121,6 @@ static const unsigned long sdram_bxcr[]
#define DCRN_CPC0_MIRQ1 0x0ed
#define DCRN_CPC0_JTAGID 0x0ef
+#define DCRN_MAL0_CFG 0x180
+
#endif /* _PPC_BOOT_DCR_H_ */
--- linux-2.6.orig/arch/powerpc/boot/ebony.c
+++ linux-2.6/arch/powerpc/boot/ebony.c
@@ -25,6 +25,7 @@
#include "ops.h"
#include "reg.h"
#include "dcr.h"
+#include "4xx.h"
#include "44x.h"
extern char _dtb_start[];
@@ -98,7 +99,7 @@ static void ebony_fixups(void)
unsigned long sysclk = 33000000;
ibm440gp_fixup_clocks(sysclk, 6 * 1843200);
- ibm44x_fixup_memsize();
+ ibm4xx_fixup_memsize();
dt_fixup_mac_addresses(ebony_mac0, ebony_mac1);
ibm4xx_fixup_ebc_ranges("/plb/opb/ebc");
}
--
next prev parent reply other threads:[~2007-08-03 16:33 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-03 16:09 [patch 00/10] 4xx patch series for 2.6.24 Josh Boyer
2007-08-03 16:09 ` [patch 01/10] Rename 4xx paths to 40x Josh Boyer
2007-08-03 16:09 ` [patch 02/10] 4xx Kconfig cleanup Josh Boyer
2007-08-04 7:45 ` David Gibson
2007-08-06 12:31 ` Josh Boyer
2007-08-07 3:06 ` David Gibson
2007-08-03 16:09 ` [patch 03/10] Rename 44x bootwrapper Josh Boyer
2007-08-06 4:36 ` David Gibson
2007-08-03 16:09 ` Josh Boyer [this message]
2007-08-06 4:38 ` [patch 04/10] 4xx bootwrapper reworks David Gibson
2007-08-06 12:36 ` Josh Boyer
2007-08-07 3:05 ` David Gibson
2007-08-07 13:10 ` Josh Boyer
2007-08-08 1:19 ` David Gibson
2007-08-03 16:09 ` [patch 05/10] 40x MMU Josh Boyer
2007-08-06 4:34 ` David Gibson
2007-08-03 16:09 ` [patch 06/10] 40x decrementer fixes Josh Boyer
2007-08-03 16:47 ` Sergei Shtylyov
2007-08-03 17:10 ` Sergei Shtylyov
2007-08-03 17:25 ` Josh Boyer
2007-08-03 17:30 ` Sergei Shtylyov
2007-08-03 17:30 ` Josh Boyer
2007-08-03 17:35 ` Sergei Shtylyov
2007-08-04 2:28 ` Benjamin Herrenschmidt
2007-08-05 14:12 ` Sergei Shtylyov
2007-08-03 17:15 ` Josh Boyer
2007-08-03 17:25 ` Sergei Shtylyov
2007-08-04 2:28 ` Benjamin Herrenschmidt
2007-08-05 14:19 ` Sergei Shtylyov
2007-08-03 16:09 ` [patch 07/10] Fix 40x build Josh Boyer
2007-08-06 4:39 ` David Gibson
2007-08-03 16:09 ` [patch 08/10] Bamboo DTS Josh Boyer
2007-08-06 4:53 ` David Gibson
2007-08-06 18:01 ` Jon Loeliger
2007-08-06 18:05 ` Josh Boyer
2007-08-07 13:11 ` Josh Boyer
2007-08-03 16:09 ` [patch 09/10] Bamboo board support Josh Boyer
2007-08-06 4:55 ` David Gibson
2007-08-03 16:09 ` [patch 10/10] Bamboo zImage wrapper Josh Boyer
2007-08-06 5:00 ` David Gibson
2007-08-06 12:39 ` Josh Boyer
2007-08-07 3:04 ` David Gibson
2007-08-07 3:04 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070803161710.676644000@linux.vnet.ibm.com \
--to=jwboyer@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).