LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ppc32: Add support for PM82x Boards
From: Heiko Schocher @ 2005-11-21 10:24 UTC (permalink / raw)
  To: linuxppc-dev

Hello

the following Patch (against 2.6 kernel.org tree, COMMIT_ID:
f093182d313edde9b1f86dbdaf40ba4da2dbd0e7) adds support for
the Microsys PM82x Boards. Verified on the PM827 Board.

not included yet: support for MTD, I2C, RTC.

Note: 2 previously submitted Patches are required:

Thu, 4 Nov 2005 [PATCH] ppc32: Fix SCC Uart write problem after 2. open()
Tue, 3 Nov 2005 [PATCH] ppc32: fix: swallowed chars when booting.

Signed-off-by: Heiko Schocher <hs@denx.de>

---

 arch/ppc/8260_io/Kconfig                |    7
 arch/ppc/8260_io/fcc_enet.c             |  117 ++++
 arch/ppc/Kconfig                        |    7
 arch/ppc/configs/pm82x_defconfig        |  897
+++++++++++++++++++++++++++++++
 arch/ppc/platforms/Makefile             |    1
 arch/ppc/platforms/pm82x.h              |   48 ++
 arch/ppc/platforms/pm82x_setup.c        |   40 +
 arch/ppc/syslib/m8260_setup.c           |   24 +
 arch/ppc/syslib/m82xx_pci.c             |   15 -
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |   56 ++
 include/asm-ppc/cpm2.h                  |    2
 include/asm-ppc/mpc8260.h               |    4
 12 files changed, 1212 insertions(+), 6 deletions(-)

diff --git a/arch/ppc/8260_io/Kconfig b/arch/ppc/8260_io/Kconfig
index ea9651e..0cb917d 100644
--- a/arch/ppc/8260_io/Kconfig
+++ b/arch/ppc/8260_io/Kconfig
@@ -23,6 +23,10 @@ config FCC1_ENET
 	help
 	  Use CPM2 fast Ethernet controller 1 to drive Ethernet (default).

+config DB_CR826_J30x_ON
+	bool "  DB CR826 Legacy Jumper ON"
+	depends on PM82X
+
 config FCC2_ENET
 	bool "Ethernet on FCC2"
 	depends on FEC_ENET
@@ -59,6 +63,9 @@ config FCC_DM9131
 config FCC_DM9161
 	bool "DM9161"

+config FCC_AMD79C873
+	bool "AMD79C873"
+
 config FCC_GENERIC_PHY
 	bool "Generic"
 endchoice
diff --git a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c
index 4edeede..2f67f5b 100644
--- a/arch/ppc/8260_io/fcc_enet.c
+++ b/arch/ppc/8260_io/fcc_enet.c
@@ -202,8 +202,18 @@ static int fcc_enet_set_mac_address(stru

 #define PC_F1RXCLK	PC_CLK(F1_RXCLK)
 #define PC_F1TXCLK	PC_CLK(F1_TXCLK)
+#if defined(CONFIG_PM82X)
+#ifndef CONFIG_DB_CR826_J30x_ON
+#define CMX1_CLK_ROUTE  ((uint)0x35000000)
+#define CMX1_CLK_MASK   ((uint)0x7f000000)
+#else
+#define CMX1_CLK_ROUTE  ((uint)0x37000000)
+#define CMX1_CLK_MASK   ((uint)0x7f000000)
+#endif
+#else
 #define CMX1_CLK_ROUTE	(CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK))
 #define CMX1_CLK_MASK	((uint)0xff000000)
+#endif

 #define PC_F2RXCLK	PC_CLK(F2_RXCLK)
 #define PC_F2TXCLK	PC_CLK(F2_TXCLK)
@@ -297,6 +307,14 @@ static int fcc_enet_set_mac_address(stru
 #elif defined(CONFIG_EST8260) || defined(CONFIG_ADS8260) ||
defined(CONFIG_PQ2FADS)
 #define PC_MDIO		((uint)0x00400000)
 #define PC_MDCK		((uint)0x00200000)
+#elif defined (CONFIG_PM82X)
+#ifndef CONFIG_DB_CR826_J30x_ON
+#define PC_MDIO		((uint)0x00000080) /* MDIO on PC24 */
+#define PC_MDCK		((uint)0x00000100) /* MDCK on PC23 */
+#else
+#define PC_MDIO		((uint)0x00000100) /* MDIO on PA23 */
+#define PC_MDCK		((uint)0x00000200) /* MDCK on PA22 */
+#endif  /* CONFIG_DB_CR826_J30x_ON */
 #else
 #define PC_MDIO		((uint)0x00000004)
 #define PC_MDCK		((uint)0x00000020)
@@ -875,6 +893,28 @@ static void mii_parse_anar(uint mii_reg,
 	fep->phy_status = s;
 }

+#ifdef CONFIG_FCC_AMD79C873
+/* Some boards don't have the MDIRQ line connected (PM82x is such a board)
*/
+
+static void mii_waitfor_anc(uint mii_reg, struct net_device *dev)
+{
+	struct fcc_enet_private *fep;
+	int regval;
+	int i;
+
+	fep = dev->priv;
+	regval = mk_mii_read(MII_BMSR) | (fep->phy_addr << 23);
+
+	for (i = 0; i < 1000; i++) {
+		if (mii_send_receive(fep->fip, regval) & 0x20)
+			return;
+		udelay(10000);
+	}
+
+	printk("%s: autonegotiation timeout\n", dev->name);
+}
+#endif
+
 /* ------------------------------------------------------------------------
- */
 /* Generic PHY support.  Should work for all PHYs, but does not support
link
  * change interrupts.
@@ -1150,6 +1190,72 @@ static phy_info_t phy_info_qs6612 = {

 #endif /* CONFIG_FEC_QS6612 */

+/* ------------------------------------------------------------------------
- */
+/* The AMD Am79C873 PHY is on PM82x                             */
+
+#ifdef CONFIG_FCC_AMD79C873
+
+#define MII_79C873_IER		17  /* Interrupt Enable Register */
+#define MII_79C873_DR		18  /* Diagnostic Register       */
+
+static void mii_parse_79c873_cr(uint mii_reg, struct net_device *dev)
+{
+	volatile struct fcc_enet_private *fep = dev->priv;
+	uint s = fep->phy_status;
+
+	s &= ~(PHY_STAT_SPMASK);
+
+	if (mii_reg & 0x2000) {
+		if (mii_reg & 0x0100)
+			s |= PHY_STAT_100FDX;
+		else
+			s |= PHY_STAT_100HDX;
+	} else {
+		if (mii_reg & 0x0100)
+			s |= PHY_STAT_10FDX;
+		else
+			s |= PHY_STAT_10HDX;
+	}
+
+	fep->phy_status = s;
+}
+
+static phy_info_t phy_info_79c873 = {
+	0x00181b80,
+	"AMD79C873",
+
+	(const phy_cmd_t []) {  /* config */
+		{ mk_mii_read(MII_BMCR), mii_parse_cr },
+		{ mk_mii_read(MII_ADVERTISE), mii_parse_anar },
+		{ mk_mii_end, }
+	},
+	(const phy_cmd_t []) {  /* startup */
+#if 0
+		{ mk_mii_write(MII_79C873_IER, 0xff00), NULL },
+#endif
+		{ mk_mii_write(MII_BMCR, 0x1200), NULL }, /* autonegotiate */
+#ifdef  CONFIG_PM82X
+		{ mk_mii_read(MII_BMSR), mii_waitfor_anc },
+#endif
+		{ mk_mii_end, }
+	},
+	(const phy_cmd_t []) { /* ack_int */
+		/* read SR twice: to acknowledge and to get link status */
+		{ mk_mii_read(MII_BMSR), mii_parse_sr },
+		{ mk_mii_read(MII_BMSR), mii_parse_sr },
+
+		/* find out the current link parameters */
+
+		{ mk_mii_read(MII_BMCR), mii_parse_79c873_cr },
+		{ mk_mii_end, }
+	},
+	(const phy_cmd_t []) {  /* shutdown - disable interrupts */
+		{ mk_mii_write(MII_79C873_IER, 0x0000), NULL },
+		{ mk_mii_end, }
+	},
+};
+
+#endif /* CONFIG_FCC_AMD79C873 */

 /* ------------------------------------------------------------------------
- */
 /* The Davicom DM9131 is used on the HYMOD board			     */
@@ -1381,6 +1487,10 @@ static phy_info_t *phy_info[] = {
 	&phy_info_dm9161,
 #endif /* CONFIG_FCC_DM9161 */

+#ifdef CONFIG_FCC_AMD79C873
+	&phy_info_79c873,
+#endif /* CONFIG_FCC_AMD79C873 */
+
 #ifdef CONFIG_FCC_GENERIC_PHY
 	/* Generic PHY support.  This must be the last PHY in the table.
 	 * It will be used to support any PHY that doesn't match a previous
@@ -1847,8 +1957,10 @@ init_fcc_ioports(fcc_info_t *fip, volati
 #ifdef	CONFIG_USE_MDIO
 	/* ....and the MII serial clock/data.
 	*/
+#ifndef CONFIG_PM82X
 	io->iop_pdatc |= (fip->fc_mdio | fip->fc_mdck);
 	io->iop_podrc &= ~(fip->fc_mdio | fip->fc_mdck);
+#endif
 	io->iop_pdirc |= (fip->fc_mdio | fip->fc_mdck);
 	io->iop_pparc &= ~(fip->fc_mdio | fip->fc_mdck);
 #endif	/* CONFIG_USE_MDIO */
@@ -2380,6 +2492,11 @@ fcc_enet_open(struct net_device *dev)
 			schedule();

 		mii_do_cmd(dev, fep->phy->startup);
+#ifdef  CONFIG_PM82X
+		/* Read the autonegotiation results */
+		mii_do_cmd(dev, fep->phy->ack_int);
+		mii_do_cmd(dev, phy_cmd_relink);
+#endif  /* CONFIG_PM82X */
 		netif_start_queue(dev);
 		return 0;		/* Success */
 	}
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 8fa51b0..1add0a9 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -667,6 +667,11 @@ config TQM8260
 	  End of Life: not yet :-)
 	  URL: <http://www.denx.de/PDF/TQM82xx_SPEC_Rev005.pdf>

+config PM82X
+	bool "PM82X"
+	help
+	  This option enables support for the MicroSys PM82x evaluation boards.
+
 config ADS8272
 	bool "ADS8272"

@@ -723,7 +728,7 @@ config PPC_MPC52xx
 config 8260
 	bool "CPM2 Support" if WILLOW
 	depends on 6xx
-	default y if TQM8260 || RPX8260 || EST8260 || SBS8260 || SBC82xx ||
PQ2FADS
+	default y if TQM8260 || RPX8260 || EST8260 || SBS8260 || SBC82xx ||
PQ2FADS || PM82X
 	help
 	  The MPC8260 is a typical embedded CPU made by Motorola.  Selecting
 	  this option means that you wish to build a kernel for a machine with
diff --git a/arch/ppc/configs/pm82x_defconfig
b/arch/ppc/configs/pm82x_defconfig
new file mode 100644
index 0000000..13f0e8a
--- /dev/null
+++ b/arch/ppc/configs/pm82x_defconfig
@@ -0,0 +1,897 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.14-rc3
+# Mon Oct 17 12:21:11 2005
+#
+CONFIG_MMU=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_PPC=y
+CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+
+#
+# Code maturity level options
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+# CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
+# CONFIG_IKCONFIG is not set
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_EMBEDDED=y
+# CONFIG_KALLSYMS is not set
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+# CONFIG_EPOLL is not set
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+
+#
+# Processor
+#
+CONFIG_6xx=y
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_POWER3 is not set
+# CONFIG_POWER4 is not set
+# CONFIG_8xx is not set
+# CONFIG_E200 is not set
+# CONFIG_E500 is not set
+CONFIG_PPC_FPU=y
+# CONFIG_KEXEC is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_WANT_EARLY_SERIAL is not set
+CONFIG_EMBEDDEDBOOT=y
+CONFIG_PPC_STD_MMU=y
+
+#
+# Platform options
+#
+# CONFIG_PPC_MULTIPLATFORM is not set
+# CONFIG_APUS is not set
+# CONFIG_KATANA is not set
+# CONFIG_WILLOW is not set
+# CONFIG_CPCI690 is not set
+# CONFIG_POWERPMC250 is not set
+# CONFIG_CHESTNUT is not set
+# CONFIG_SPRUCE is not set
+# CONFIG_HDPU is not set
+# CONFIG_EV64260 is not set
+# CONFIG_LOPEC is not set
+# CONFIG_MVME5100 is not set
+# CONFIG_PPLUS is not set
+# CONFIG_PRPMC750 is not set
+# CONFIG_PRPMC800 is not set
+# CONFIG_SANDPOINT is not set
+# CONFIG_RADSTONE_PPC7D is not set
+# CONFIG_PAL4 is not set
+# CONFIG_GEMINI is not set
+# CONFIG_EST8260 is not set
+# CONFIG_SBC82xx is not set
+# CONFIG_SBS8260 is not set
+# CONFIG_RPX8260 is not set
+# CONFIG_TQM8260 is not set
+CONFIG_PM82X=y
+# CONFIG_ADS8272 is not set
+# CONFIG_PQ2FADS is not set
+# CONFIG_LITE5200 is not set
+# CONFIG_MPC834x_SYS is not set
+# CONFIG_EV64360 is not set
+CONFIG_8260=y
+CONFIG_CPM2=y
+# CONFIG_PC_KEYBOARD is not set
+# CONFIG_SMP is not set
+# CONFIG_HIGHMEM is not set
+CONFIG_HZ_100=y
+# CONFIG_HZ_250 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=100
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_MISC is not set
+# CONFIG_CMDLINE_BOOL is not set
+# CONFIG_PM is not set
+# CONFIG_SOFTWARE_SUSPEND is not set
+CONFIG_SECCOMP=y
+CONFIG_ISA_DMA_API=y
+
+#
+# Bus options
+#
+CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_8260=y
+# CONFIG_8260_PCI9 is not set
+CONFIG_PCI_LEGACY_PROC=y
+# CONFIG_PCI_DEBUG is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# Advanced setup
+#
+# CONFIG_ADVANCED_OPTIONS is not set
+
+#
+# Default settings for advanced configuration options are used
+#
+CONFIG_HIGHMEM_START=0xfe000000
+CONFIG_LOWMEM_SIZE=0x30000000
+CONFIG_KERNEL_START=0xc0000000
+CONFIG_TASK_SIZE=0x80000000
+CONFIG_BOOT_LOAD=0x00400000
+
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_BIC=y
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# DCCP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_DCCP is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_IEEE80211 is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
+
+#
+# Connector - unified userspace <-> kernelspace linker
+#
+# CONFIG_CONNECTOR is not set
+
+#
+# Memory Technology Devices (MTD)
+#
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_CONCAT is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+CONFIG_NFTL=y
+# CONFIG_NFTL_RW is not set
+# CONFIG_INFTL is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+CONFIG_MTD_JEDECPROBE=y
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
+# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
+CONFIG_MTD_MAP_BANK_WIDTH_8=y
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+# CONFIG_MTD_CFI_I1 is not set
+# CONFIG_MTD_CFI_I2 is not set
+CONFIG_MTD_CFI_I4=y
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_OTP is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+CONFIG_MTD_COMPLEX_MAPPINGS=y
+# CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_SBC8240 is not set
+CONFIG_MTD_PM82X=y
+# CONFIG_MTD_PCI is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLKMTD is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+CONFIG_MTD_NAND=y
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+CONFIG_MTD_NAND_IDS=y
+CONFIG_MTD_NAND_DISKONCHIP=y
+# CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADVANCED is not set
+CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADDRESS=0
+# CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE is not set
+# CONFIG_MTD_NAND_NANDSIM is not set
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_CPQ_DA is not set
+# CONFIG_BLK_CPQ_CISS_DA is not set
+# CONFIG_BLK_DEV_DAC960 is not set
+# CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+CONFIG_BLK_DEV_INITRD=y
+# CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Fusion MPT device support
+#
+# CONFIG_FUSION is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# I2O device support
+#
+# CONFIG_I2O is not set
+
+#
+# Macintosh device drivers
+#
+
+#
+# Network device support
+#
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+
+#
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
+# PHY device support
+#
+# CONFIG_PHYLIB is not set
+
+#
+# Ethernet (10 or 100Mbit)
+#
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=y
+# CONFIG_HAPPYMEAL is not set
+# CONFIG_SUNGEM is not set
+# CONFIG_CASSINI is not set
+# CONFIG_NET_VENDOR_3COM is not set
+
+#
+# Tulip family network device support
+#
+# CONFIG_NET_TULIP is not set
+# CONFIG_HP100 is not set
+CONFIG_NET_PCI=y
+# CONFIG_PCNET32 is not set
+# CONFIG_AMD8111_ETH is not set
+# CONFIG_ADAPTEC_STARFIRE is not set
+# CONFIG_B44 is not set
+# CONFIG_FORCEDETH is not set
+# CONFIG_DGRS is not set
+CONFIG_EEPRO100=y
+# CONFIG_E100 is not set
+# CONFIG_FEALNX is not set
+# CONFIG_NATSEMI is not set
+# CONFIG_NE2K_PCI is not set
+# CONFIG_8139CP is not set
+# CONFIG_8139TOO is not set
+# CONFIG_SIS900 is not set
+# CONFIG_EPIC100 is not set
+# CONFIG_SUNDANCE is not set
+# CONFIG_TLAN is not set
+# CONFIG_VIA_RHINE is not set
+
+#
+# Ethernet (1000 Mbit)
+#
+# CONFIG_ACENIC is not set
+# CONFIG_DL2K is not set
+# CONFIG_E1000 is not set
+# CONFIG_NS83820 is not set
+# CONFIG_HAMACHI is not set
+# CONFIG_YELLOWFIN is not set
+# CONFIG_R8169 is not set
+# CONFIG_SIS190 is not set
+# CONFIG_SKGE is not set
+# CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
+# CONFIG_TIGON3 is not set
+# CONFIG_BNX2 is not set
+
+#
+# Ethernet (10000 Mbit)
+#
+# CONFIG_CHELSIO_T1 is not set
+# CONFIG_IXGB is not set
+# CONFIG_S2IO is not set
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
+
+#
+# Wireless LAN (non-hamradio)
+#
+# CONFIG_NET_RADIO is not set
+
+#
+# Wan interfaces
+#
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+
+#
+# ISDN subsystem
+#
+# CONFIG_ISDN is not set
+
+#
+# Telephony Support
+#
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+# CONFIG_INPUT is not set
+
+#
+# Hardware I/O ports
+#
+# CONFIG_SERIO is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+# CONFIG_VT is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_CPM=y
+CONFIG_SERIAL_CPM_CONSOLE=y
+CONFIG_SERIAL_CPM_SCC1=y
+CONFIG_SERIAL_CPM_SCC2=y
+CONFIG_SERIAL_CPM_SCC3=y
+CONFIG_SERIAL_CPM_SCC4=y
+CONFIG_SERIAL_CPM_SMC1=y
+CONFIG_SERIAL_CPM_SMC2=y
+# CONFIG_SERIAL_JSM is not set
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+# CONFIG_NVRAM is not set
+CONFIG_GEN_RTC=y
+# CONFIG_GEN_RTC_X is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_AGP is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# TPM devices
+#
+# CONFIG_TCG_TPM is not set
+
+#
+# I2C support
+#
+CONFIG_I2C=y
+# CONFIG_I2C_CHARDEV is not set
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_MPC is not set
+CONFIG_I2C_MPC8260=y
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 is not set
+# CONFIG_I2C_PCA_ISA is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+CONFIG_SENSORS_PCF8563=y
+# CONFIG_SENSORS_PCA9539 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_RTC8564 is not set
+# CONFIG_SENSORS_M41T00 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+CONFIG_I2C_DEBUG_CORE=y
+CONFIG_I2C_DEBUG_ALGO=y
+CONFIG_I2C_DEBUG_BUS=y
+CONFIG_I2C_DEBUG_CHIP=y
+
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
+# Hardware Monitoring support
+#
+# CONFIG_HWMON is not set
+# CONFIG_HWMON_VID is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia Capabilities Port drivers
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
+# SN Devices
+#
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_FS_POSIX_ACL is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+CONFIG_INOTIFY=y
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+# CONFIG_PROC_KCORE is not set
+CONFIG_SYSFS=y
+# CONFIG_TMPFS is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+# CONFIG_RELAYFS_FS is not set
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS_FS is not set
+# CONFIG_JFFS2_FS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=y
+# CONFIG_NFS_V3 is not set
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
+# CONFIG_NFSD is not set
+CONFIG_ROOT_NFS=y
+CONFIG_LOCKD=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+# CONFIG_9P_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+# CONFIG_MSDOS_PARTITION is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+# CONFIG_SCC_ENET is not set
+CONFIG_FEC_ENET=y
+CONFIG_USE_MDIO=y
+
+#
+# CPM2 Options
+#
+CONFIG_FCC1_ENET=y
+# CONFIG_DB_CR826_J30x_ON is not set
+# CONFIG_FCC2_ENET is not set
+# CONFIG_FCC3_ENET is not set
+# CONFIG_FCC_LXT970 is not set
+CONFIG_FCC_LXT971=y
+# CONFIG_FCC_QS6612 is not set
+# CONFIG_FCC_DM9131 is not set
+# CONFIG_FCC_DM9161 is not set
+# CONFIG_FCC_AMD79C873 is not set
+# CONFIG_FCC_GENERIC_PHY is not set
+
+#
+# Library routines
+#
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC32 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_REED_SOLOMON=y
+CONFIG_REED_SOLOMON_DEC16=y
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_MAGIC_SYSRQ is not set
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_FS is not set
+# CONFIG_KGDB_CONSOLE is not set
+# CONFIG_XMON is not set
+# CONFIG_BDI_SWITCH is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
diff --git a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile
index 7c5cdab..becaed3 100644
--- a/arch/ppc/platforms/Makefile
+++ b/arch/ppc/platforms/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_PMAC_BACKLIGHT)	+= pmac_bac
 obj-$(CONFIG_PREP_RESIDUAL)	+= residual.o
 obj-$(CONFIG_PQ2ADS)		+= pq2ads.o
 obj-$(CONFIG_TQM8260)		+= tqm8260_setup.o
+obj-$(CONFIG_PM82X)		+= pm82x_setup.o
 obj-$(CONFIG_CPCI690)		+= cpci690.o
 obj-$(CONFIG_EV64260)		+= ev64260.o
 obj-$(CONFIG_CHESTNUT)		+= chestnut.o
diff --git a/arch/ppc/platforms/pm82x.h b/arch/ppc/platforms/pm82x.h
new file mode 100644
index 0000000..ee12e1d
--- /dev/null
+++ b/arch/ppc/platforms/pm82x.h
@@ -0,0 +1,48 @@
+/*
+ * PM82X board specific definitions
+ *
+ * Copyright (c) 2005 Heiko Schocher (hs@denx.de)
+ */
+
+#ifndef __MACH_PM82X_H
+#define __MACH_PM82X_H
+
+#include <linux/config.h>
+
+#include <asm/ppcboot.h>
+
+#if defined(CONFIG_PCI)
+/* #include <platforms/m8260_pci.h> */
+#endif
+
+#define CPM_MAP_ADDR		((uint)0xF0000000)
+#define	I2C_ADDR_RTC		0x51
+
+/* For our show_cpuinfo hooks. */
+#define CPUINFO_VENDOR		"Microsys"
+#define CPUINFO_MACHINE	"PM82x PowerPC"
+
+#if defined (CONFIG_MTD_NAND_DISKONCHIP)
+#define BOOTROM_RESTART_ADDR	((uint)0x40000100)
+#else
+#define BOOTROM_RESTART_ADDR	((uint)0xFF800100)
+#endif
+
+/* PPC Sys identification */
+#define BOARD_CHIP_NAME "8250"
+
+#ifdef CONFIG_PCI
+/* PCI interrupt controller */
+#define PCI_INT_STAT_REG	0xF8200000
+#define PCI_INT_MASK_REG	0xF8200004
+#define PIRQA			(NR_CPM_INTS + 0)
+#define PIRQB			(NR_CPM_INTS + 1)
+#define PIRQC			(NR_CPM_INTS + 2)
+#define PIRQD			(NR_CPM_INTS + 3)
+
+#define PCI_INT_TO_SIU  SIU_INT_IRQ2
+
+#endif /* CONFIG_PCI */
+
+
+#endif	/* __MACH_PM82X_H */
diff --git a/arch/ppc/platforms/pm82x_setup.c
b/arch/ppc/platforms/pm82x_setup.c
new file mode 100644
index 0000000..dd8ea88
--- /dev/null
+++ b/arch/ppc/platforms/pm82x_setup.c
@@ -0,0 +1,40 @@
+/*
+ * arch/ppc/platforms/pm82x_setup.c
+ *
+ * PM82X platform support
+ *
+ * Author: Heiko Schocher <hs@denx.de>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/init.h>
+
+#include <asm/mpc8260.h>
+#include <asm/cpm2.h>
+#include <asm/machdep.h>
+
+static int
+pm82x_set_rtc_time(unsigned long time)
+{
+	((cpm2_map_t *)CPM_MAP_ADDR)->im_sit.sit_tmcnt = time;
+	((cpm2_map_t *)CPM_MAP_ADDR)->im_sit.sit_tmcntsc = 0x3;
+	return(0);
+}
+
+static unsigned long
+pm82x_get_rtc_time(void)
+{
+	return ((cpm2_map_t *)CPM_MAP_ADDR)->im_sit.sit_tmcnt;
+}
+
+void __init
+m82xx_board_init(void)
+{
+	/* Anything special for this platform */
+	ppc_md.set_rtc_time	= pm82x_set_rtc_time;
+	ppc_md.get_rtc_time	= pm82x_get_rtc_time;
+}
diff --git a/arch/ppc/syslib/m8260_setup.c b/arch/ppc/syslib/m8260_setup.c
index 76a2aa4..f4b0f3a 100644
--- a/arch/ppc/syslib/m8260_setup.c
+++ b/arch/ppc/syslib/m8260_setup.c
@@ -51,6 +51,16 @@ m8260_setup_arch(void)

 	/* Reset the Communication Processor Module. */
 	cpm2_reset();
+
+#ifdef  CONFIG_PM82X
+	/* On PM82x BRG1 is not initialized by the firmware (as the console
+	 * is on SMC2). We initialize it here to avoid "realtime clock stuck"
+	 * messages. Later on, when the RTC driver loads up, it re-installs
+	 * its own handlers.
+	 */
+	cpm_setbrg(0, 9600);
+#endif  /* CONFIG_PM82X */
+
 #ifdef CONFIG_8260_PCI9
 	/* Initialise IDMA for PCI erratum workaround */
 	idma_pci9_init();
@@ -156,9 +166,9 @@ m8260_show_cpuinfo(struct seq_file *m)
 		   "core clock\t: %u MHz\n"
 		   "CPM  clock\t: %u MHz\n"
 		   "bus  clock\t: %u MHz\n",
-		   CPUINFO_VENDOR, CPUINFO_MACHINE, bp->bi_memsize,
-		   bp->bi_baudrate, bp->bi_intfreq / 1000000,
-		   bp->bi_cpmfreq / 1000000, bp->bi_busfreq / 1000000);
+		   CPUINFO_VENDOR, CPUINFO_MACHINE, (unsigned int) bp->bi_memsize,
+		   (int) bp->bi_baudrate, (unsigned int) bp->bi_intfreq / 1000000,
+		   (unsigned int) bp->bi_cpmfreq / 1000000, (unsigned int) bp->bi_busfreq
/ 1000000);
 	return 0;
 }

@@ -176,7 +186,15 @@ m8260_init_IRQ(void)
 	/* Initialize the default interrupt mapping priorities,
 	 * in case the boot rom changed something on us.
 	 */
+#ifndef CONFIG_PM82X
 	cpm2_immr->im_intctl.ic_siprr = 0x05309770;
+	cpm2_immr->im_intctl.ic_scprrh = 0x05309770;
+	cpm2_immr->im_intctl.ic_scprrl = 0x05309770;
+#else
+	cpm2_immr->im_intctl.ic_siprr = 0x0530b370;
+	cpm2_immr->im_intctl.ic_scprrh = 0x0530b370;
+	cpm2_immr->im_intctl.ic_scprrl = 0x0530b370;
+#endif

 #if defined(CONFIG_PCI) && (defined(CONFIG_ADS8272) ||
defined(CONFIG_PQ2FADS))
  	/* Initialize stuff for the 82xx CPLD IC and install demux  */
diff --git a/arch/ppc/syslib/m82xx_pci.c b/arch/ppc/syslib/m82xx_pci.c
index 1d1c395..5af560e 100644
--- a/arch/ppc/syslib/m82xx_pci.c
+++ b/arch/ppc/syslib/m82xx_pci.c
@@ -300,6 +300,19 @@ pq2ads_setup_pci(struct pci_controller *

 }

+void m8260_pcibios_fixup(void)
+{
+	struct pci_dev *dev = NULL;
+
+	for_each_pci_dev(dev) {
+#ifdef CONFIG_PM82X
+		if (dev->bus->number == 0 && (dev->devfn & ~0x7) == (0xD << 3)) {
+			dev->irq = SIU_INT_IRQ5;
+		}
+#endif
+	}
+}
+
 void __init pq2_find_bridges(void)
 {
 	extern int pci_assign_all_buses;
@@ -377,7 +390,7 @@ void __init pq2_find_bridges(void)
 	hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);

 	ppc_md.pci_map_irq = pq2pci_map_irq;
-	ppc_md.pcibios_fixup = NULL;
+	ppc_md.pcibios_fixup = m8260_pcibios_fixup;
 	ppc_md.pcibios_fixup_bus = NULL;

 }
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index fd9e53e..39776bc 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -95,8 +95,13 @@ void smc1_lineif(struct uart_cpm_port *p
 	io->iop_pdird &= ~0x00800000;
 	io->iop_psord &= ~0x00c00000;

+#if defined(CONFIG_PM82X)
+	/* Wire BRG7 to SMC1 */
+	cpm2_immr->im_cpmux.cmx_smr &= 0x1f;
+#else
 	/* Wire BRG1 to SMC1 */
 	cpm2_immr->im_cpmux.cmx_smr &= 0x0f;
+#endif
 	pinfo->brg = 1;
 }

@@ -104,14 +109,29 @@ void smc2_lineif(struct uart_cpm_port *p
 {
 	volatile iop_cpm2_t *io = &cpm2_immr->im_ioport;

+#if defined(CONFIG_PM82X)
+	/* SMC2 is only on port A */
+	io->iop_ppard |= 0x08000000;
+	io->iop_pdird &= ~0x08000000;
+	io->iop_psord |= 0x08000000;
+	io->iop_pparc |= 0x00010000;
+	io->iop_pdirc |= 0x00010000;
+	io->iop_psorc &= ~0x00010000;
+#else
 	/* SMC2 is only on port A */
 	io->iop_ppara |= 0x00c00000;
 	io->iop_pdira |= 0x00400000;
 	io->iop_pdira &= ~0x00800000;
 	io->iop_psora &= ~0x00c00000;
+#endif

+#if defined(CONFIG_PM82X)
+	/* Wire BRG8 to SMC2 */
+	cpm2_immr->im_cpmux.cmx_smr &= 0xf1;
+#else
 	/* Wire BRG2 to SMC2 */
 	cpm2_immr->im_cpmux.cmx_smr &= 0xf0;
+#endif
 	pinfo->brg = 2;
 }

@@ -119,12 +139,22 @@ void scc1_lineif(struct uart_cpm_port *p
 {
 	volatile iop_cpm2_t *io = &cpm2_immr->im_ioport;

+#if defined(CONFIG_PM82X)
+	io->iop_ppard |= 0x00000001;	/* Rx */
+	io->iop_pparb |= 0x00000008;	/* Tx */
+
+	io->iop_psord &= ~0x00000001;   /* Rx */
+	io->iop_psorb |= 0x00000008;    /* Tx */
+	io->iop_pdird &= ~0x00000001;   /* Rx */
+	io->iop_pdirb |= 0x00000008;    /* Tx */
+#else
 	/* Use Port D for SCC1 instead of other functions.  */
 	io->iop_ppard |= 0x00000003;
 	io->iop_psord &= ~0x00000001;	/* Rx */
 	io->iop_psord |= 0x00000002;	/* Tx */
 	io->iop_pdird &= ~0x00000001;	/* Rx */
 	io->iop_pdird |= 0x00000002;	/* Tx */
+#endif

 	/* Wire BRG1 to SCC1 */
 	cpm2_immr->im_cpmux.cmx_scr &= 0x00ffffff;
@@ -149,6 +179,14 @@ void scc2_lineif(struct uart_cpm_port *p
 	io->iop_psord &= ~0x00000010;	/* Tx */
 	io->iop_pdird &= ~0x00000008;	/* Rx */
 	io->iop_pdird |= 0x00000010;	/* Tx */
+#elif defined(CONFIG_PM82X)
+	volatile iop_cpm2_t *io = &cpm2_immr->im_ioport;
+	io->iop_pparb |= 0x00010000;	/* Rx */
+	io->iop_pdirb &= ~0x00010000;
+	io->iop_psorb &= ~0x00010000;
+	io->iop_ppard |= 0x00000010;	/* Tx */
+	io->iop_pdird |= 0x00000010;
+	io->iop_psord &= ~0x00000010;
 #else
 	volatile iop_cpm2_t *io = &cpm2_immr->im_ioport;
 	io->iop_pparb |= 0x008b0000;
@@ -165,12 +203,21 @@ void scc2_lineif(struct uart_cpm_port *p

 void scc3_lineif(struct uart_cpm_port *pinfo)
 {
+#if defined(CONFIG_PM82X)
+	volatile iop_cpm2_t *io = &cpm2_immr->im_ioport;
+	io->iop_pparb |= 0x00820000;	/* Rx */
+	io->iop_pdirb &= ~0x00020000;
+	io->iop_psorb &= ~0x00020000;
+	io->iop_pdirb |= 0x00800000;	/* Tx */
+	io->iop_psorb |= 0x00800000;
+#else
 	volatile iop_cpm2_t *io = &cpm2_immr->im_ioport;
 	io->iop_pparb |= 0x008b0000;
 	io->iop_pdirb |= 0x00880000;
 	io->iop_psorb |= 0x00880000;
 	io->iop_pdirb &= ~0x00030000;
 	io->iop_psorb &= ~0x00030000;
+#endif
 	cpm2_immr->im_cpmux.cmx_scr &= 0xffff00ff;
 	cpm2_immr->im_cpmux.cmx_scr |= 0x00001200;
 	pinfo->brg = 3;
@@ -180,10 +227,19 @@ void scc4_lineif(struct uart_cpm_port *p
 {
 	volatile iop_cpm2_t *io = &cpm2_immr->im_ioport;

+#if defined(CONFIG_PM82X)
+	io->iop_ppard |= 0x00000200;	/* Rx */
+	io->iop_pdird &= ~0x00000200;
+	io->iop_psord &= ~0x00000200;
+	io->iop_ppard |= 0x00000400;	/* Tx */
+	io->iop_pdird |= 0x00000400;
+	io->iop_psord &= ~0x00000400;
+#else
 	io->iop_ppard |= 0x00000600;
 	io->iop_psord &= ~0x00000600;	/* Tx/Rx */
 	io->iop_pdird &= ~0x00000200;	/* Rx */
 	io->iop_pdird |= 0x00000400;	/* Tx */
+#endif

 	cpm2_immr->im_cpmux.cmx_scr &= 0xffffff00;
 	cpm2_immr->im_cpmux.cmx_scr |= 0x0000001b;
diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h
index 43d2ebb..0e7a03c 100644
--- a/include/asm-ppc/cpm2.h
+++ b/include/asm-ppc/cpm2.h
@@ -181,7 +181,7 @@ typedef struct cpm_buf_desc {
  */
 #define PROFF_SMC1	(0)
 #define PROFF_SMC2	(64)
-
+#define PROFF_I2C	((16 * 1024) - 64)

 /* Define enough so I can at least use the serial port as a UART.
  */
diff --git a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h
index 3214526..501ea8e 100644
--- a/include/asm-ppc/mpc8260.h
+++ b/include/asm-ppc/mpc8260.h
@@ -36,6 +36,10 @@
 #include <platforms/tqm8260.h>
 #endif

+#ifdef CONFIG_PM82X
+#include <platforms/pm82x.h>
+#endif
+
 #if defined(CONFIG_PQ2ADS) || defined (CONFIG_PQ2FADS)
 #include <platforms/pq2ads.h>
 #endif


\f
!-------------------------------------------------------------flip-

^ permalink raw reply related

* Strange results with changing HZ
From: Wojciech Kromer @ 2005-11-21  7:44 UTC (permalink / raw)
  To: linuxppc-embedded

My system is:
 - 2.4.25 kernel from denx.de
 - uclibc (gcc 3.4.2) + busybox
 - changed HZ to 1000
 - rebuild kernel only

AFAIR there souldn't be any need to recompile user apps.

I have strange results.
Sleep and timeout selects works fine, but alarm functions seems to be 
too fast.
For example included program or ping waits too short.



it is OK:

# time alarm_test
alarm fired after 0.099166s
real    0m 0.11s
user    0m 0.00s
sys     0m 0.00s
#
# time sleep 1
real    0m 1.01s
user    0m 0.00s
sys     0m 0.00s
# time sleep 10
real    0m 10.01s
user    0m 0.00s
sys     0m 0.00s


but:

# alarm_test
alarm fired after 0.099709s
# alarm_test
alarm fired after 0.099710s


------------------------------------ alarm_test.c :

#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>

static void sighand(int sig)
{
}

int main()
{
 struct timeval tv1, tv2;
 sigset_t set;

 sigfillset(&set);
 sigdelset(&set, SIGALRM);
 sigdelset(&set, SIGINT);

 signal(SIGALRM, sighand);
 gettimeofday(&tv1, NULL);

 alarm(1);
 sigsuspend(&set);
 gettimeofday(&tv2, NULL);

 tv1.tv_sec = tv2.tv_sec - tv1.tv_sec - (tv2.tv_usec < tv1.tv_usec);
 tv1.tv_usec = tv2.tv_usec - tv1.tv_usec + (tv2.tv_usec < tv1.tv_usec) * 
1000000;

 printf("alarm fired after %ld.%06lds\n",
 tv1.tv_sec, tv1.tv_usec);

 return 0;
}

^ permalink raw reply

* Re:Re: Help ! 2.6.14 kernel can't bring up
From: zjznliang @ 2005-11-21  6:59 UTC (permalink / raw)
  To: clemens.koller; +Cc: linuxppc-embedded

SGkgY2xlbWVucy5rb2xsZXKjoQ0KDQoJICAgICAgICAgIEkgaGF2ZSBjb25maWdlZCB0aGUgQ09O
RklHX1dBTlRfRUFSTFlfU0VSSUFMIGZvciB0aGUgMi42LjE0IGtlcm5lbCxidXQgSSBzdGlsbCBk
aWRuJ3Qgc2VlIG5vdGhpbmcgb3V0cHV0IA0Kb24gdGhlIHNlcmlhbCBwb3J0IC4NCgkJCUkgaGF2
ZSBzb21lIGRvdWJ0cywNCgkJCTEsIExpbnV4IGtlcm5lbCAyLjQuMjUgY2FuIHdvcmsgd2VsbCB3
aXRoIHRoZSBzYW1lIFUtQm9vdCBhbmQgYm9hcmQgYXMgTGludXgga2VybmVsIDIuNi4xNCwgd2hh
dCBpcyB0aGUgZGlmZmVyZW50IA0Kd2l0aCB0aGUgc2VyaWFsIHBvcnQgZHJpdmVyIGJldHdlZW4g
dGhlc2UgPw0KCQkJMi5UaGUgY29tbWFuZCBsaW5lICxVLUJvb3Qgc2VuZHMgY29tbWFuZCBsaW5l
IHRvIHRoZSBrZXJuZWwgLGxpa2UgYXMgImJhdWRyYXRlICxyb290IC4uLi4iLiBJbiB0aGUgbGlu
dXgga2VybmVsIA0KMi42LjE0LCJtYWtlIG1lbnVjb25maWcgLHBsYXRmb3JtIC0+ZGVmYXVsdCBi
b290bG9hZGVyIGtlcm5lbCBhcmd1bWVudCIsSSBjb25maWcgdGhlIGNvbnNvbGUgYXMgdGhlIHNh
bWUgYXMgdGhlIFUtYm9vdCAsDQpidXQgaXQgd2FzIGZhaWwgLkRpZG4ndCBjb25maWcgaXQgLGl0
IHdhcyBzdGlsbCBmYWlsIC4NCg0KCQkJSSBoYXZlIG1lYXN1cmVkIHRoZSBwaW4gb2YgdGhlIHNl
cmlhbCBwb3J0ICwgbm8gcHVyc2Ugb3V0cHV0LiBJIGNoZWNrZWQgdGhlIENTIChjaGlwIHNlbGVj
dCApIHBpbiBvZiB0aGUgU0RSQU0NCih3aGVyZSBpcyB0aGUgbGludXgga2VybmVsICBpbXBsZW1l
bnRhdGlvbiksIHRoZSBwaW4gaGFzIHB1cnNlcyB3aGVuIHRoZSBzZXJpYWwgcG9ydCB3aXRoIG5v
dGhpbmcgLHNvIEkgdGhvdWdodCB0aGUgbGludXggDQprZXJuZWwgd2FzIHJ1bm5pbmcgLGJ1dCB0
aGUgc2VyaWFsIHBvcnQgd2FzIGZhaWwgLi4uLi4uLi4NCg0KCQlOb3cgLCBtYXliZSBJIHdpbGwg
Y2hlY2sgdGhlIGtlcm5lbCBjb2RlIHRvIHRyYWNlIHRoZSBwcm9ibGVtIC4gDQoNCgkJVGhhbmtz
IGZvciB5b3VyIHBhdGllbmNlLg0KIA0KCQlJZiB5b3UgaGF2ZSBzb21lIGFkdmljZXMgLHBsZWFz
ZSBsZXQgbWUga25vdyAgLlRoYW5rIHlvdSAhIA0KIAkJCQkNCg0KoaGhoXpqem5saWFuZw0KoaGh
oaGhoaF6anpubGlhbmdfcG9wb0AxNjMuY29tDQqhoaGhoaGhoaGhoaEyMDA1LTExLTIxDQo=

^ permalink raw reply

* anyone used i2c-algo-8260 for the MPC8272 family?
From: Ron Kellam @ 2005-11-21  6:56 UTC (permalink / raw)
  To: linuxppc-embedded

Hi all,

I'm trying to get i2c-algo-8260 and i2c-pm826 working on an MPC8247.
It doesn't... It just hangs the kernel.

There are some subtle differences b/t the 8260 family and 8272 family.
The 8272 family only has 8KB DPRAM (c.f. 16KB), so I believe the
definition of PROFF_I2C in include/linux/cpm_8260.h should be
different.  I've changed it from:

	#define PROFF_I2C	((16 * 1024) - 64)
to 
	#define PROFF_I2C	((8 * 1024) - 64)

but still get no I2C activity, and a kernel hang.

Anyone have this working, or any thoughts to contribute?

Regards,
Ron Kellam.

^ permalink raw reply

* Re: Memtest-SDRAM
From: Wolfgang Denk @ 2005-11-20 20:30 UTC (permalink / raw)
  To: Kylo Ginsberg; +Cc: linuxppc-embedded
In-Reply-To: <61cc712d0511201058p367df361i7e46591336918712@mail.gmail.com>

In message <61cc712d0511201058p367df361i7e46591336918712@mail.gmail.com> you wrote:
>
> > A simple test is: if Linux is running  without  problems  under  load
> > than there are no problems with your SDRAM.
> 
> Yes, but determining the proper load to test with can be tricky. 

Ummm.. I disagree. Avtually it's pretty simple. Boot the system  with
root  file  system  mounted  over  NFS.  The  compile  a Linux kernel
natively on the board. This is doing all you want: stressing  network
(lots  of  DMA),  stressing  the memory (lots of context switches and
heavy RAM use), etc. If your system survives this,  you  can  be  98%
sure that it will pass any other test as well.

> E.g., I had a subtle memory timing issue that only turned up under
> very peculiar circumstances under linux; this was very difficult to

Of course there are really weird cases,  but  fortunaltey  these  are
rare exceptions.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Committee, n.:  A group of men who individually can do nothing but as
a group decide that nothing can be done.                 - Fred Allen

^ permalink raw reply

* Re: Memtest-SDRAM
From: Kylo Ginsberg @ 2005-11-20 18:58 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-embedded
In-Reply-To: <20051119152413.D0B44353BEF@atlas.denx.de>

On 11/19/05, Wolfgang Denk <wd@denx.de> wrote:
> In message <6AD9F6A5F6E096408F0B703773355A0765E931@CHN-SNR-MBX01.wipro.co=
m> you wrote:
> >
> >   Can I comprehensively test and conform that my SDRAM is creating
> > problem other than mtest at u-boot( which I already implemented the
> > mtest with the help of mailing list , where my memory failed . ) , if i=
s
> > there is a way please do let me know .
>
> A simple test is: if Linux is running  without  problems  under  load
> than there are no problems with your SDRAM.

Yes, but determining the proper load to test with can be tricky.=20
E.g., I had a subtle memory timing issue that only turned up under
very peculiar circumstances under linux; this was very difficult to
reproduce until I started using a simple user-space memory tester
application, which could very reliably produce failures.  Fwiw, I
started with this:

http://pyropus.ca/software/memtester/

Cheers,
Kylo

^ permalink raw reply

* [PATCH] ppc32: smc1_lineif fix for mpc8272
From: Mike Rapoport @ 2005-11-20 14:05 UTC (permalink / raw)
  To: galak; +Cc: 'linuxppc-embedded@ozlabs.org'

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

This patch fixes the pin assignment of SMC1 for MPC8272 family

Signed-off-by: Mike Rapoport <mike@compulab.co.il>


-- 
Sincerely yours,
Mike Rapoport



[-- Attachment #2: smc_8272.patch --]
[-- Type: text/x-diff, Size: 728 bytes --]

diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -89,11 +89,19 @@ void smc1_lineif(struct uart_cpm_port *p
 {
 	volatile iop_cpm2_t *io = &cpm2_immr->im_ioport;
 
+#ifdef CONFIG_8272
+	/* SMC1 is only on port C on 8272 */
+	io->iop_pparc |= 0x0c000000;
+	io->iop_pdirc |= 0x04000000;
+	io->iop_pdirc &= ~0x08000000;
+	io->iop_psorc &= ~0x0c000000;
+#else
 	/* SMC1 is only on port D */
 	io->iop_ppard |= 0x00c00000;
 	io->iop_pdird |= 0x00400000;
 	io->iop_pdird &= ~0x00800000;
 	io->iop_psord &= ~0x00c00000;
+#endif
 
 	/* Wire BRG1 to SMC1 */
 	cpm2_immr->im_cpmux.cmx_smr &= 0x0f;

^ permalink raw reply

* Re: [PATCH] Fix oops in MGA DRM on root bus.
From: David Woodhouse @ 2005-11-20  0:08 UTC (permalink / raw)
  To: greg, airlied; +Cc: linuxppc-dev
In-Reply-To: <1132442389.4084.5.camel@baythorne.infradead.org>

On Sat, 2005-11-19 at 23:19 +0000, David Woodhouse wrote:
> -       if ((pdev->device == 0x0525)
> +       if ((pdev->device == 0x0525) && pdev->bus->self &&
>             && (pdev->bus->self->vendor == 0x3388)
>             && (pdev->bus->self->device == 0x0021)) {
>                 return 0;

Perhaps with one fewer '&&'...

diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -161,7 +161,7 @@ static int mga_driver_device_is_agp(drm_
 	 * device.
 	 */
 
-	if ((pdev->device == 0x0525)
+	if ((pdev->device == 0x0525) && pdev->bus->self
 	    && (pdev->bus->self->vendor == 0x3388)
 	    && (pdev->bus->self->device == 0x0021)) {
 		return 0;

-- 
dwmw2

^ permalink raw reply

* [PATCH] Fix oops in MGA DRM on root bus.
From: David Woodhouse @ 2005-11-19 23:19 UTC (permalink / raw)
  To: airlied, greg; +Cc: linuxppc-dev

I think that if a PCI bus is a root bus, attached to a host bridge not a
PCI->PCI bridge, then bus->self is allowed to be NULL. Certainly that's
the case on my Pegasos, and it makes the MGA DRM driver oops...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>

diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -161,7 +161,7 @@ static int mga_driver_device_is_agp(drm_
 	 * device.
 	 */
 
-	if ((pdev->device == 0x0525)
+	if ((pdev->device == 0x0525) && pdev->bus->self &&
 	    && (pdev->bus->self->vendor == 0x3388)
 	    && (pdev->bus->self->device == 0x0021)) {
 		return 0;

-- 
dwmw2

^ permalink raw reply

* Re: [PATCH] generate COFF zImage in arch/powerpc/boot
From: Olaf Hering @ 2005-11-19 20:47 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <20051119172900.GA11829@suse.de>

 On Sat, Nov 19, Olaf Hering wrote:

>  On Sat, Nov 19, Olaf Hering wrote:
> 
> > This patch on top of yours fixes it for me.
> 
> Another Makefile fix to actually include the kernel in the zImage.coff.

The kernel entry point should be printed unconditional. It helps
debugging the early init when it doesnt run at the link address.

My stack corruption was caused by a bug in call_prom_ret. It uses the
wrong pointer to clear the memory of the return values.

 arch/powerpc/boot/Makefile      |    2 ++
 arch/powerpc/boot/main.c        |   12 ++----------
 arch/powerpc/kernel/prom_init.c |    2 +-
 3 files changed, 5 insertions(+), 11 deletions(-)

Index: linux-2.6.15-rc1-olh/arch/powerpc/boot/Makefile
===================================================================
--- linux-2.6.15-rc1-olh.orig/arch/powerpc/boot/Makefile
+++ linux-2.6.15-rc1-olh/arch/powerpc/boot/Makefile
@@ -140,10 +140,12 @@ $(obj)/zImage.initrd.vmode: obj-boot += 
 $(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds
 	$(call cmd,bootld,$(obj-boot),zImage.lds)
 
+$(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
 $(obj)/zImage: $(obj)/zImage.vmode $(obj)/zImage.coff $(obj)/addnote
 	@cp -f $< $@
 	$(call if_changed,addnote)
 
+$(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
 $(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff $(obj)/addnote
 	@cp -f $< $@
 	$(call if_changed,addnote)
Index: linux-2.6.15-rc1-olh/arch/powerpc/boot/main.c
===================================================================
--- linux-2.6.15-rc1-olh.orig/arch/powerpc/boot/main.c
+++ linux-2.6.15-rc1-olh/arch/powerpc/boot/main.c
@@ -299,16 +299,8 @@ void start(unsigned long a1, unsigned lo
 	flush_cache((void *)vmlinux.addr, vmlinux.size);
 
 	kernel_entry = (kernel_entry_t)vmlinux.addr;
-#ifdef DEBUG
-	printf( "kernel:\n\r"
-		"        entry addr = 0x%lx\n\r"
-		"        a1         = 0x%lx,\n\r"
-		"        a2         = 0x%lx,\n\r"
-		"        prom       = 0x%lx,\n\r"
-		"        bi_recs    = 0x%lx,\n\r",
-		(unsigned long)kernel_entry, a1, a2,
-		(unsigned long)prom, NULL);
-#endif
+	printf( "entering kernel at 0x%08x(%x/%x/%08x)\n\r",
+		(unsigned long)kernel_entry, a1, a2, prom);
 
 	kernel_entry(a1, a2, prom, NULL);
 
Index: linux-2.6.15-rc1-olh/arch/powerpc/kernel/prom_init.c
===================================================================
--- linux-2.6.15-rc1-olh.orig/arch/powerpc/kernel/prom_init.c
+++ linux-2.6.15-rc1-olh/arch/powerpc/kernel/prom_init.c
@@ -265,7 +265,7 @@ static int __init call_prom_ret(const ch
 	va_end(list);
 
 	for (i = 0; i < nret; i++)
-		rets[nargs+i] = 0;
+		args.args[nargs+i] = 0;
 
 	if (enter_prom(&args, RELOC(prom_entry)) < 0)
 		return PROM_ERROR;

-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply

* Re: [PATCH] generate COFF zImage in arch/powerpc/boot
From: Olaf Hering @ 2005-11-19 17:29 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <20051119102952.GA32273@suse.de>

 On Sat, Nov 19, Olaf Hering wrote:

> This patch on top of yours fixes it for me.

Another Makefile fix to actually include the kernel in the zImage.coff.

With this my 7200 almost works. There is one thing that I cant explain
right now. alloc_up calls prom_claim at some point, and it stores the
result in alloc_bottom. r30 holds the address where the code is running.
But this reg is 0 after returning from prom_claim. My debug patch below
adds checks for the value of r30, there is no way it can return with r30
being 0, according to the objdump output. But still it does. 
If I enable DEBUG_PROM, and add a 2 or 3 prom_debug calls, everything
works. Any idea what that means?

 arch/powerpc/boot/Makefile      |    2 ++
 arch/powerpc/boot/main.c        |    9 +++------
 arch/powerpc/kernel/prom_init.c |   21 +++++++++++++++++++++
 3 files changed, 26 insertions(+), 6 deletions(-)

Index: linux-2.6.15-rc1-olh/arch/powerpc/boot/Makefile
===================================================================
--- linux-2.6.15-rc1-olh.orig/arch/powerpc/boot/Makefile
+++ linux-2.6.15-rc1-olh/arch/powerpc/boot/Makefile
@@ -140,10 +140,12 @@ $(obj)/zImage.initrd.vmode: obj-boot += 
 $(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds
 	$(call cmd,bootld,$(obj-boot),zImage.lds)
 
+$(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
 $(obj)/zImage: $(obj)/zImage.vmode $(obj)/zImage.coff $(obj)/addnote
 	@cp -f $< $@
 	$(call if_changed,addnote)
 
+$(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
 $(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff $(obj)/addnote
 	@cp -f $< $@
 	$(call if_changed,addnote)
Index: linux-2.6.15-rc1-olh/arch/powerpc/boot/main.c
===================================================================
--- linux-2.6.15-rc1-olh.orig/arch/powerpc/boot/main.c
+++ linux-2.6.15-rc1-olh/arch/powerpc/boot/main.c
@@ -299,15 +299,12 @@ void start(unsigned long a1, unsigned lo
 	flush_cache((void *)vmlinux.addr, vmlinux.size);
 
 	kernel_entry = (kernel_entry_t)vmlinux.addr;
-#ifdef DEBUG
+#if 1
 	printf( "kernel:\n\r"
 		"        entry addr = 0x%lx\n\r"
 		"        a1         = 0x%lx,\n\r"
-		"        a2         = 0x%lx,\n\r"
-		"        prom       = 0x%lx,\n\r"
-		"        bi_recs    = 0x%lx,\n\r",
-		(unsigned long)kernel_entry, a1, a2,
-		(unsigned long)prom, NULL);
+		"        a2         = 0x%lx,\n\r",
+		(unsigned long)kernel_entry, a1, a2);
 #endif
 
 	kernel_entry(a1, a2, prom, NULL);
Index: linux-2.6.15-rc1-olh/arch/powerpc/kernel/prom_init.c
===================================================================
--- linux-2.6.15-rc1-olh.orig/arch/powerpc/kernel/prom_init.c
+++ linux-2.6.15-rc1-olh/arch/powerpc/kernel/prom_init.c
@@ -144,6 +144,7 @@ struct mem_map_entry {
 typedef u32 cell_t;
 
 extern void __start(unsigned long r3, unsigned long r4, unsigned long r5);
+static inline unsigned long __init olh_reg30(void) { unsigned long reg; __asm__ __volatile__("mr %0,30\n" : "=r" (reg)); return reg; }
 
 #ifdef CONFIG_PPC64
 extern int enter_prom(struct prom_args *args, unsigned long entry);
@@ -242,9 +243,13 @@ static int __init call_prom(const char *
 	for (i = 0; i < nret; i++)
 		args.args[nargs+i] = 0;
 
+	if (!olh_reg30())
+		asm(".long 0x0\n");
 	if (enter_prom(&args, RELOC(prom_entry)) < 0)
 		return PROM_ERROR;
 
+	if (!olh_reg30())
+		asm(".long 0x0\n");
 	return (nret > 0) ? args.args[nargs] : 0;
 }
 
@@ -255,6 +260,8 @@ static int __init call_prom_ret(const ch
 	struct prom_args args;
 	va_list list;
 
+	if (!olh_reg30())
+		asm(".long 0x0\n");
 	args.service = ADDR(service);
 	args.nargs = nargs;
 	args.nret = nret;
@@ -274,6 +281,8 @@ static int __init call_prom_ret(const ch
 		for (i = 1; i < nret; ++i)
 			rets[i-1] = args.args[nargs+i];
 
+	if (!olh_reg30())
+		asm(".long 0x0\n");
 	return (nret > 0) ? args.args[nargs] : 0;
 }
 
@@ -364,6 +373,8 @@ static unsigned int __init prom_claim(un
 {
 	struct prom_t *_prom = &RELOC(prom);
 
+	if (!olh_reg30())
+		asm(".long 0x0\n");
 	if (align == 0 && (OF_WORKAROUNDS & OF_WA_CLAIM)) {
 		/*
 		 * Old OF requires we claim physical and virtual separately
@@ -375,21 +386,29 @@ static unsigned int __init prom_claim(un
 		ret = call_prom_ret("call-method", 5, 2, &result,
 				    ADDR("claim"), _prom->memory,
 				    align, size, virt);
+	if (!olh_reg30())
+		asm(".long 0x0\n");
 		if (ret != 0 || result == -1)
 			return -1;
 		ret = call_prom_ret("call-method", 5, 2, &result,
 				    ADDR("claim"), _prom->mmumap,
 				    align, size, virt);
+	if (!olh_reg30())
+		asm(".long 0x0\n");
 		if (ret != 0) {
 			call_prom("call-method", 4, 1, ADDR("release"),
 				  _prom->memory, size, virt);
+		asm(".long 0x0\n");
 			return -1;
 		}
 		/* the 0x12 is M (coherence) + PP == read/write */
 		call_prom("call-method", 6, 1,
 			  ADDR("map"), _prom->mmumap, 0x12, size, virt, virt);
+		if (!olh_reg30())
+			asm(".long 0x0\n");
 		return virt;
 	}
+		asm(".long 0x0\n");
 	return call_prom("claim", 3, 1, (prom_arg_t)virt, (prom_arg_t)size,
 			 (prom_arg_t)align);
 }
@@ -752,6 +771,8 @@ static unsigned long __init alloc_up(uns
 	    base = _ALIGN_UP(base + 0x100000, align)) {
 		prom_debug("    trying: 0x%x\n\r", base);
 		addr = (unsigned long)prom_claim(base, size, 0);
+	if (!olh_reg30())
+		asm(".long 0x0\n");
 		if (addr != PROM_ERROR && addr != 0)
 			break;
 		addr = 0;

-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply

* Re: Memtest-SDRAM
From: Wolfgang Denk @ 2005-11-19 15:24 UTC (permalink / raw)
  To: srideep.devireddy; +Cc: linuxppc-embedded
In-Reply-To: <6AD9F6A5F6E096408F0B703773355A0765E931@CHN-SNR-MBX01.wipro.com>

In message <6AD9F6A5F6E096408F0B703773355A0765E931@CHN-SNR-MBX01.wipro.com> you wrote:
> 
>   Can I comprehensively test and conform that my SDRAM is creating
> problem other than mtest at u-boot( which I already implemented the
> mtest with the help of mailing list , where my memory failed . ) , if is
> there is a way please do let me know .

A simple test is: if Linux is running  without  problems  under  load
than there are no problems with your SDRAM.

See also the U-Boot FAQ.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
I have a very small mind and must live with it.    -- Edsger Dijkstra

^ permalink raw reply

* Re: [PATCH] generate COFF zImage in arch/powerpc/boot
From: Olaf Hering @ 2005-11-19 10:29 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <17278.40894.898159.724090@cargo.ozlabs.ibm.com>

 On Sat, Nov 19, Paul Mackeras wrote:

> Olaf Hering writes:
> 
> > So we either need a ld script for coff with kernel and initrd in the
> > .data section. Or we write a tool to extract the vmlinux.gz and initrd
> > based on nm or readelf -a output.
> 
> Here's a new version that does the first of those...
> 
> The zImage base address could go back to 4MB now.  In fact one could
> argue that if OF is based at 12MB and load-base is near zero, linking
> it at 6MB would be best.
> 
> There is still something I haven't got right: if you do make -j3, it
> does this sort of thing:
> 
>   STRIP   vmlinux.strip
>   STRIP   vmlinux.strip
>   GZIP    arch/powerpc/boot/kernel-vmlinux.strip.gz
>   GZIP    arch/powerpc/boot/kernel-vmlinux.strip.gz
>   BOOTCC  arch/powerpc/boot/kernel-vmlinux.strip.o
>   BOOTCC  arch/powerpc/boot/kernel-vmlinux.strip.o
> mv: cannot stat `arch/powerpc/boot/.kernel-vmlinux.strip.o.tmp': No such file or directory
> make[2]: *** [arch/powerpc/boot/kernel-vmlinux.strip.o] Error 1
> make[1]: *** [zImage] Error 2
> 
> I have no idea why it tries to make those things twice in parallel.
> It doesn't do that for vmlinux.

This patch on top of yours fixes it for me.

All members of $(BOOT_TARGETS) will be built in parallel.

make zImage.vmode doesnt work right now, without your patch.
And all it gains is one less host prog and one less zImage file.
Same for zImage.coff. Is it worth the trouble?

 arch/powerpc/Makefile      |    5 ++---
 arch/powerpc/boot/Makefile |   10 +++++-----
 2 files changed, 7 insertions(+), 8 deletions(-)

Index: linux-2.6.15-rc1-olh/arch/powerpc/boot/Makefile
===================================================================
--- linux-2.6.15-rc1-olh.orig/arch/powerpc/boot/Makefile
+++ linux-2.6.15-rc1-olh/arch/powerpc/boot/Makefile
@@ -89,7 +89,7 @@ gz-sec  = $(foreach section, $(1), $(pat
 
 hostprogs-y		:= addnote addRamDisk hack-coff
 
-targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
+targets += zImage zImage.initrd \
 	   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
 	   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
 	   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
@@ -132,19 +132,19 @@ $(call obj-sec, $(required) $(initrd)): 
 	$(call if_changed_dep,bootcc)
 	$(call cmd,addsection)
 
-$(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
+$(obj)/zImage.vmode: obj-boot += $(call obj-sec, $(required))
 $(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds
 	$(call cmd,bootld,$(obj-boot),zImage.lds)
 
-$(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
+$(obj)/zImage.initrd.vmode: obj-boot += $(call obj-sec, $(required) $(initrd))
 $(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds
 	$(call cmd,bootld,$(obj-boot),zImage.lds)
 
-$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote
+$(obj)/zImage: $(obj)/zImage.vmode $(obj)/zImage.coff $(obj)/addnote
 	@cp -f $< $@
 	$(call if_changed,addnote)
 
-$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote
+$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff $(obj)/addnote
 	@cp -f $< $@
 	$(call if_changed,addnote)
 
Index: linux-2.6.15-rc1-olh/arch/powerpc/Makefile
===================================================================
--- linux-2.6.15-rc1-olh.orig/arch/powerpc/Makefile
+++ linux-2.6.15-rc1-olh/arch/powerpc/Makefile
@@ -138,7 +138,7 @@ drivers-$(CONFIG_CPM2)		+= arch/ppc/8260
 
 drivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
 
-defaultimage-$(CONFIG_PPC32)	:= zImage zImage.coff
+defaultimage-$(CONFIG_PPC32)	:= zImage
 defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
 defaultimage-$(CONFIG_PPC_PSERIES) := zImage
 KBUILD_IMAGE := $(defaultimage-y)
@@ -149,8 +149,7 @@ CPPFLAGS_vmlinux.lds	:= -Upowerpc
 # All the instructions talk about "make bzImage".
 bzImage: zImage
 
-BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm \
-	       zImage.vmode zImage.initrd.vmode zImage.coff zImage.initrd.coff
+BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
 
 .PHONY: $(BOOT_TARGETS)
 

-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply

* Re: [PATCH] generate COFF zImage in arch/powerpc/boot
From: Olaf Hering @ 2005-11-19  9:12 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <20051119084654.GA29731@suse.de>

 On Sat, Nov 19, Olaf Hering wrote:

>  On Sat, Nov 19, Paul Mackeras wrote:
> 
> > There is still something I haven't got right: if you do make -j3, it
> > does this sort of thing:
> > 
> >   STRIP   vmlinux.strip
> >   STRIP   vmlinux.strip
> >   GZIP    arch/powerpc/boot/kernel-vmlinux.strip.gz
> >   GZIP    arch/powerpc/boot/kernel-vmlinux.strip.gz
> >   BOOTCC  arch/powerpc/boot/kernel-vmlinux.strip.o
> >   BOOTCC  arch/powerpc/boot/kernel-vmlinux.strip.o
> > mv: cannot stat `arch/powerpc/boot/.kernel-vmlinux.strip.o.tmp': No such file or directory
> > make[2]: *** [arch/powerpc/boot/kernel-vmlinux.strip.o] Error 1
> > make[1]: *** [zImage] Error 2
> > 
> > I have no idea why it tries to make those things twice in parallel.

I got this:
  Building modules, stage 2.
  BOOTAS  arch/powerpc/boot/crt0.o
  BOOTCC  arch/powerpc/boot/prom.o
  BOOTAS  arch/powerpc/boot/crt0.o
  BOOTCC  arch/powerpc/boot/prom.o
  BOOTCC  arch/powerpc/boot/stdio.o
  BOOTCC  arch/powerpc/boot/main.o
  BOOTCC  arch/powerpc/boot/stdio.o
  BOOTCC  arch/powerpc/boot/main.o
  HOSTCC  arch/powerpc/boot/hack-coff
mv: cannot stat `arch/powerpc/boot/.crt0.o.tmp': No such file or directory
make[2]: *** [arch/powerpc/boot/crt0.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mv: cannot stat `arch/powerpc/boot/.prom.o.tmp': No such file or directory
make[2]: *** [arch/powerpc/boot/prom.o] Error 1
fixdep: arch/powerpc/boot/.main.o.d: No such file or directory
make[2]: *** [arch/powerpc/boot/main.o] Error 2
make[1]: *** [zImage] Error 2
make[1]: *** Waiting for unfinished jobs....
mv: cannot stat `arch/powerpc/boot/.stdio.o.tmp': No such file or directory
make[2]: *** [arch/powerpc/boot/stdio.o] Error 1
make[1]: *** [zImage.coff] Error 2

The dependencies need some work.

-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply

* Re: [PATCH] generate COFF zImage in arch/powerpc/boot
From: Olaf Hering @ 2005-11-19  8:46 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <17278.40894.898159.724090@cargo.ozlabs.ibm.com>

 On Sat, Nov 19, Paul Mackeras wrote:

> There is still something I haven't got right: if you do make -j3, it
> does this sort of thing:
> 
>   STRIP   vmlinux.strip
>   STRIP   vmlinux.strip
>   GZIP    arch/powerpc/boot/kernel-vmlinux.strip.gz
>   GZIP    arch/powerpc/boot/kernel-vmlinux.strip.gz
>   BOOTCC  arch/powerpc/boot/kernel-vmlinux.strip.o
>   BOOTCC  arch/powerpc/boot/kernel-vmlinux.strip.o
> mv: cannot stat `arch/powerpc/boot/.kernel-vmlinux.strip.o.tmp': No such file or directory
> make[2]: *** [arch/powerpc/boot/kernel-vmlinux.strip.o] Error 1
> make[1]: *** [zImage] Error 2
> 
> I have no idea why it tries to make those things twice in parallel.
> It doesn't do that for vmlinux.

I think this comes from the targets evaluation. Maybe strip needs to be
some sort of serialization:

cmd_stripvm = $(STRIP) -s -R .comment $< -o $@.$$$$ && mv -v $@.$$$$ $@

gzip is also called twice, use the mygzip rule from
arch/ppc/boot/images/Makefile

-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply

* Re: [PATCH] m8xx_wdt: software watchdog reset/interrupt select
From: Florian Schirmer @ 2005-11-19  6:16 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: obi, carjay, linux-ppc-embedded
In-Reply-To: <20051118153657.GA13943@logos.cnet>

Hi,

> After your message I decided to check if the PIT is working, guess what: it isnt.
> 
> Our board uses an external RTC (the internal RTC/PIT HW seem to be
> nonexistant/nonfunctional).

Now it starts to make sense :-) Patch looks good. If Dan doesn't come up 
with a better idea to solve the clock detection problem feel free to go 
ahead and send it upstream.

Best,
   Florian

^ permalink raw reply

* Memtest-SDRAM
From: srideep.devireddy @ 2005-11-19  4:33 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 753 bytes --]


Hi all ,



  Can I comprehensively test and conform that my SDRAM is creating
problem other than mtest at u-boot( which I already implemented the
mtest with the help of mailing list , where my memory failed . ) , if is
there is a way please do let me know .



Thanks in advance,



Best Regards\

Srideep











Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

[-- Attachment #2: Type: text/html, Size: 3371 bytes --]

^ permalink raw reply

* Re: [PATCH] generate COFF zImage in arch/powerpc/boot
From: Paul Mackerras @ 2005-11-19  3:45 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev
In-Reply-To: <20051118221309.GA12724@suse.de>

Olaf Hering writes:

> So we either need a ld script for coff with kernel and initrd in the
> .data section. Or we write a tool to extract the vmlinux.gz and initrd
> based on nm or readelf -a output.

Here's a new version that does the first of those...

The zImage base address could go back to 4MB now.  In fact one could
argue that if OF is based at 12MB and load-base is near zero, linking
it at 6MB would be best.

There is still something I haven't got right: if you do make -j3, it
does this sort of thing:

  STRIP   vmlinux.strip
  STRIP   vmlinux.strip
  GZIP    arch/powerpc/boot/kernel-vmlinux.strip.gz
  GZIP    arch/powerpc/boot/kernel-vmlinux.strip.gz
  BOOTCC  arch/powerpc/boot/kernel-vmlinux.strip.o
  BOOTCC  arch/powerpc/boot/kernel-vmlinux.strip.o
mv: cannot stat `arch/powerpc/boot/.kernel-vmlinux.strip.o.tmp': No such file or directory
make[2]: *** [arch/powerpc/boot/kernel-vmlinux.strip.o] Error 1
make[1]: *** [zImage] Error 2

I have no idea why it tries to make those things twice in parallel.
It doesn't do that for vmlinux.

Paul.

diff -urN powerpc/arch/powerpc/Makefile merge-hack/arch/powerpc/Makefile
--- powerpc/arch/powerpc/Makefile	2005-11-18 17:19:11.000000000 +1100
+++ merge-hack/arch/powerpc/Makefile	2005-11-18 17:20:06.000000000 +1100
@@ -138,7 +138,7 @@
 
 drivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
 
-defaultimage-$(CONFIG_PPC32)	:= zImage
+defaultimage-$(CONFIG_PPC32)	:= zImage zImage.coff
 defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
 defaultimage-$(CONFIG_PPC_PSERIES) := zImage
 KBUILD_IMAGE := $(defaultimage-y)
@@ -149,7 +149,8 @@
 # All the instructions talk about "make bzImage".
 bzImage: zImage
 
-BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
+BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm \
+	       zImage.vmode zImage.initrd.vmode zImage.coff zImage.initrd.coff
 
 .PHONY: $(BOOT_TARGETS)
 
diff -urN powerpc/arch/powerpc/boot/Makefile merge-hack/arch/powerpc/boot/Makefile
--- powerpc/arch/powerpc/boot/Makefile	2005-11-16 15:55:17.000000000 +1100
+++ merge-hack/arch/powerpc/boot/Makefile	2005-11-19 14:18:04.000000000 +1100
@@ -25,8 +25,8 @@
 BOOTCFLAGS	:= $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
 		   $(shell $(CROSS32CC) -print-file-name=include) -fPIC
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
-BOOTLFLAGS	:= -T $(srctree)/$(src)/zImage.lds
 OBJCOPYFLAGS    := contents,alloc,load,readonly,data
+OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000
 
 zlib       := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
 zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
@@ -35,7 +35,7 @@
 $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
 #$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h)
 
-src-boot := string.S prom.c main.c div64.S crt0.S
+src-boot := crt0.S string.S prom.c stdio.c main.c div64.S
 src-boot += $(zlib)
 src-boot := $(addprefix $(obj)/, $(src-boot))
 obj-boot := $(addsuffix .o, $(basename $(src-boot)))
@@ -70,7 +70,7 @@
       cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
 
 quiet_cmd_bootld = BOOTLD  $@
-      cmd_bootld = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(2)
+      cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
 
 $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
 	$(call if_changed_dep,bootcc)
@@ -87,12 +87,13 @@
 src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
 gz-sec  = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
 
-hostprogs-y		:= addnote addRamDisk
-targets 		+= zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
-			   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
-			   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
-			   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
-			   vmlinux.initrd
+hostprogs-y		:= addnote addRamDisk hack-coff
+
+targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
+	   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
+	   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
+	   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
+	   vmlinux.initrd
 extra-y			:= initrd.o
 
 quiet_cmd_ramdisk = RAMDISK $@
@@ -114,6 +115,10 @@
 quiet_cmd_addnote = ADDNOTE $@
       cmd_addnote = $(obj)/addnote $@
 
+quiet_cmd_gencoff = COFF    $@
+      cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \
+		    $(obj)/hack-coff $@
+
 $(call gz-sec, $(required)): $(obj)/kernel-%.gz: %
 	$(call if_changed,gzip)
 
@@ -127,13 +132,13 @@
 	$(call if_changed_dep,bootcc)
 	$(call cmd,addsection)
 
-$(obj)/zImage.vmode: obj-boot += $(call obj-sec, $(required))
+$(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
 $(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds
-	$(call cmd,bootld,$(obj-boot))
+	$(call cmd,bootld,$(obj-boot),zImage.lds)
 
-$(obj)/zImage.initrd.vmode: obj-boot += $(call obj-sec, $(required) $(initrd))
+$(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
 $(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds
-	$(call cmd,bootld,$(obj-boot))
+	$(call cmd,bootld,$(obj-boot),zImage.lds)
 
 $(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote
 	@cp -f $< $@
@@ -143,6 +148,15 @@
 	@cp -f $< $@
 	$(call if_changed,addnote)
 
+$(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
+	$(call cmd,bootld,$(obj-boot),zImage.coff.lds)
+	$(call cmd,gencoff)
+
+$(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \
+			   $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
+	$(call cmd,bootld,$(obj-boot),zImage.coff.lds)
+	$(call cmd,gencoff)
+
 install: $(CONFIGURE) $(BOOTIMAGE)
 	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
 
diff -urN powerpc/arch/powerpc/boot/crt0.S merge-hack/arch/powerpc/boot/crt0.S
--- powerpc/arch/powerpc/boot/crt0.S	2005-11-18 15:57:30.000000000 +1100
+++ merge-hack/arch/powerpc/boot/crt0.S	2005-11-18 22:07:18.000000000 +1100
@@ -12,17 +12,23 @@
 #include "ppc_asm.h"
 
 	.text
+	/* a procedure descriptor used when booting this as a COFF file */
+_zimage_start_opd:
+	.long	_zimage_start, 0, 0, 0
+
 	.globl	_zimage_start
 _zimage_start:
+	/* Work out the offset between the address we were linked at
+	   and the address where we're running. */
 	bl	1f
-
-1:
-	mflr	r0
+1:	mflr	r0
 	lis	r9,1b@ha
 	addi	r9,r9,1b@l
 	subf.	r0,r9,r0
-	beq	3f
+	beq	3f		/* if running at same address as linked */
 
+	/* The .got2 section contains a list of addresses, so add
+	   the address offset onto each entry. */
 	lis	r9,__got2_start@ha
 	addi	r9,r9,__got2_start@l
 	lis	r8,__got2_end@ha
@@ -32,15 +38,14 @@
 	srwi.	r8,r8,2
 	mtctr	r8
 	add	r9,r0,r9
-2:
-	lwz	r8,0(r9)
+2:	lwz	r8,0(r9)
 	add	r8,r8,r0
 	stw	r8,0(r9)
 	addi	r9,r9,4
 	bdnz	2b
 
-3:
-	lis	r9,_start@h
+	/* Do a cache flush for our text, in case OF didn't */
+3:	lis	r9,_start@h
 	add	r9,r0,r9
 	lis	r8,_etext@ha
 	addi	r8,r8,_etext@l
diff -urN powerpc/arch/powerpc/boot/hack-coff.c merge-hack/arch/powerpc/boot/hack-coff.c
--- /dev/null	2005-11-19 12:36:29.626282000 +1100
+++ merge-hack/arch/powerpc/boot/hack-coff.c	2005-11-17 14:57:08.000000000 +1100
@@ -0,0 +1,84 @@
+/*
+ * hack-coff.c - hack the header of an xcoff file to fill in
+ * a few fields needed by the Open Firmware xcoff loader on
+ * Power Macs but not initialized by objcopy.
+ *
+ * Copyright (C) Paul Mackerras 1997.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include "rs6000.h"
+
+#define AOUT_MAGIC	0x010b
+
+#define get_16be(x)	((((unsigned char *)(x))[0] << 8) \
+			 + ((unsigned char *)(x))[1])
+#define put_16be(x, v)	(((unsigned char *)(x))[0] = (v) >> 8, \
+			 ((unsigned char *)(x))[1] = (v) & 0xff)
+#define get_32be(x)	((((unsigned char *)(x))[0] << 24) \
+			 + (((unsigned char *)(x))[1] << 16) \
+			 + (((unsigned char *)(x))[2] << 8) \
+			 + ((unsigned char *)(x))[3])
+
+int
+main(int ac, char **av)
+{
+    int fd;
+    int i, nsect;
+    int aoutsz;
+    struct external_filehdr fhdr;
+    AOUTHDR aout;
+    struct external_scnhdr shdr;
+
+    if (ac != 2) {
+	fprintf(stderr, "Usage: hack-coff coff-file\n");
+	exit(1);
+    }
+    if ((fd = open(av[1], 2)) == -1) {
+	perror(av[2]);
+	exit(1);
+    }
+    if (read(fd, &fhdr, sizeof(fhdr)) != sizeof(fhdr))
+	goto readerr;
+    i = get_16be(fhdr.f_magic);
+    if (i != U802TOCMAGIC && i != U802WRMAGIC && i != U802ROMAGIC) {
+	fprintf(stderr, "%s: not an xcoff file\n", av[1]);
+	exit(1);
+    }
+    aoutsz = get_16be(fhdr.f_opthdr);
+    if (read(fd, &aout, aoutsz) != aoutsz)
+	goto readerr;
+    nsect = get_16be(fhdr.f_nscns);
+    for (i = 0; i < nsect; ++i) {
+	if (read(fd, &shdr, sizeof(shdr)) != sizeof(shdr))
+	    goto readerr;
+	if (strcmp(shdr.s_name, ".text") == 0) {
+	    put_16be(aout.o_snentry, i+1);
+	    put_16be(aout.o_sntext, i+1);
+	} else if (strcmp(shdr.s_name, ".data") == 0) {
+	    put_16be(aout.o_sndata, i+1);
+	} else if (strcmp(shdr.s_name, ".bss") == 0) {
+	    put_16be(aout.o_snbss, i+1);
+	}
+    }
+    put_16be(aout.magic, AOUT_MAGIC);
+    if (lseek(fd, (long) sizeof(struct external_filehdr), 0) == -1
+	|| write(fd, &aout, aoutsz) != aoutsz) {
+	fprintf(stderr, "%s: write error\n", av[1]);
+	exit(1);
+    }
+    close(fd);
+    exit(0);
+
+readerr:
+    fprintf(stderr, "%s: read error or file too short\n", av[1]);
+    exit(1);
+}
diff -urN powerpc/arch/powerpc/boot/main.c merge-hack/arch/powerpc/boot/main.c
--- powerpc/arch/powerpc/boot/main.c	2005-11-16 15:55:17.000000000 +1100
+++ merge-hack/arch/powerpc/boot/main.c	2005-11-17 14:41:13.000000000 +1100
@@ -21,8 +21,8 @@
 
 
 /* Value picked to match that used by yaboot */
-#define PROG_START	0x01400000
-#define RAM_END		(512<<20) // Fixme: use OF */
+#define PROG_START	0x01400000	/* only used on 64-bit systems */
+#define RAM_END		(512<<20)	/* Fixme: use OF */
 #define	ONE_MB		0x100000
 
 extern char _start[];
@@ -160,6 +160,17 @@
 	elfoffset = (unsigned long)elf64ph->p_offset;
 	vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset;
 	vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset;
+
+#if defined(PROG_START)
+	/*
+	 * Maintain a "magic" minimum address. This keeps some older
+	 * firmware platforms running.
+	 */
+
+	if (claim_base < PROG_START)
+		claim_base = PROG_START;
+#endif
+
 	return 1;
 }
 
@@ -206,12 +217,18 @@
 		exit();
 	if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
 		exit();
-	stderr = stdout;
-	if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
-		exit();
 
 	printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp);
 
+	/*
+	 * The first available claim_base must be above the end of the
+	 * the loaded kernel wrapper file (_start to _end includes the
+	 * initrd image if it is present) and rounded up to a nice
+	 * 1 MB boundary for good measure.
+	 */
+
+	claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
+
 	vmlinuz.addr = (unsigned long)_vmlinux_start;
 	vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start);
 
@@ -228,25 +245,6 @@
 		exit();
 	}
 
-	/*
-	 * The first available claim_base must be above the end of the
-	 * the loaded kernel wrapper file (_start to _end includes the
-	 * initrd image if it is present) and rounded up to a nice
-	 * 1 MB boundary for good measure.
-	 */
-
-	claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
-
-#if defined(PROG_START)
-	/*
-	 * Maintain a "magic" minimum address. This keeps some older
-	 * firmware platforms running.
-	 */
-
-	if (claim_base < PROG_START)
-		claim_base = PROG_START;
-#endif
-
 	/* We need to claim the memsize plus the file offset since gzip
 	 * will expand the header (file offset), then the kernel, then
 	 * possible rubbish we don't care about. But the kernel bss must
diff -urN powerpc/arch/powerpc/boot/prom.c merge-hack/arch/powerpc/boot/prom.c
--- powerpc/arch/powerpc/boot/prom.c	2005-11-16 15:55:17.000000000 +1100
+++ merge-hack/arch/powerpc/boot/prom.c	2005-11-17 14:37:12.000000000 +1100
@@ -13,487 +13,153 @@
 #include "prom.h"
 
 int (*prom)(void *);
+phandle chosen_handle;
+ihandle stdout;
 
-void *chosen_handle;
-
-void *stdin;
-void *stdout;
-void *stderr;
-
-
-int
-write(void *handle, void *ptr, int nb)
-{
-	struct prom_args {
-		char *service;
-		int nargs;
-		int nret;
-		void *ihandle;
-		void *addr;
-		int len;
-		int actual;
-	} args;
-
-	args.service = "write";
-	args.nargs = 3;
-	args.nret = 1;
-	args.ihandle = handle;
-	args.addr = ptr;
-	args.len = nb;
-	args.actual = -1;
-	(*prom)(&args);
-	return args.actual;
-}
-
-int
-read(void *handle, void *ptr, int nb)
+int call_prom(const char *service, int nargs, int nret, ...)
 {
+	int i;
 	struct prom_args {
-		char *service;
+		const char *service;
 		int nargs;
 		int nret;
-		void *ihandle;
-		void *addr;
-		int len;
-		int actual;
+		unsigned int args[12];
 	} args;
+	va_list list;
 
-	args.service = "read";
-	args.nargs = 3;
-	args.nret = 1;
-	args.ihandle = handle;
-	args.addr = ptr;
-	args.len = nb;
-	args.actual = -1;
-	(*prom)(&args);
-	return args.actual;
-}
+	args.service = service;
+	args.nargs = nargs;
+	args.nret = nret;
 
-void
-exit()
-{
-	struct prom_args {
-		char *service;
-	} args;
+	va_start(list, nret);
+	for (i = 0; i < nargs; i++)
+		args.args[i] = va_arg(list, unsigned int);
+	va_end(list);
 
-	for (;;) {
-		args.service = "exit";
-		(*prom)(&args);
-	}
-}
+	for (i = 0; i < nret; i++)
+		args.args[nargs+i] = 0;
 
-void
-pause(void)
-{
-	struct prom_args {
-		char *service;
-	} args;
-
-	args.service = "enter";
-	(*prom)(&args);
-}
-
-void *
-finddevice(const char *name)
-{
-	struct prom_args {
-		char *service;
-		int nargs;
-		int nret;
-		const char *devspec;
-		void *phandle;
-	} args;
-
-	args.service = "finddevice";
-	args.nargs = 1;
-	args.nret = 1;
-	args.devspec = name;
-	args.phandle = (void *) -1;
-	(*prom)(&args);
-	return args.phandle;
-}
-
-void *
-claim(unsigned long virt, unsigned long size, unsigned long align)
-{
-	struct prom_args {
-		char *service;
-		int nargs;
-		int nret;
-		unsigned int virt;
-		unsigned int size;
-		unsigned int align;
-		void *ret;
-	} args;
+	if (prom(&args) < 0)
+		return -1;
 
-	args.service = "claim";
-	args.nargs = 3;
-	args.nret = 1;
-	args.virt = virt;
-	args.size = size;
-	args.align = align;
-	(*prom)(&args);
-	return args.ret;
+	return (nret > 0)? args.args[nargs]: 0;
 }
 
-int
-getprop(void *phandle, const char *name, void *buf, int buflen)
+int call_prom_ret(const char *service, int nargs, int nret,
+		  unsigned int *rets, ...)
 {
+	int i;
 	struct prom_args {
-		char *service;
+		const char *service;
 		int nargs;
 		int nret;
-		void *phandle;
-		const char *name;
-		void *buf;
-		int buflen;
-		int size;
+		unsigned int args[12];
 	} args;
+	va_list list;
 
-	args.service = "getprop";
-	args.nargs = 4;
-	args.nret = 1;
-	args.phandle = phandle;
-	args.name = name;
-	args.buf = buf;
-	args.buflen = buflen;
-	args.size = -1;
-	(*prom)(&args);
-	return args.size;
-}
+	args.service = service;
+	args.nargs = nargs;
+	args.nret = nret;
 
-int
-putc(int c, void *f)
-{
-	char ch = c;
+	va_start(list, rets);
+	for (i = 0; i < nargs; i++)
+		args.args[i] = va_arg(list, unsigned int);
+	va_end(list);
 
-	if (c == '\n')
-		putc('\r', f);
-	return write(f, &ch, 1) == 1? c: -1;
-}
+	for (i = 0; i < nret; i++)
+		args.args[nargs+i] = 0;
 
-int
-putchar(int c)
-{
-	return putc(c, stdout);
-}
+	if (prom(&args) < 0)
+		return -1;
 
-int
-fputs(char *str, void *f)
-{
-	int n = strlen(str);
+	if (rets != (void *) 0)
+		for (i = 1; i < nret; ++i)
+			rets[i-1] = args.args[nargs+i];
 
-	return write(f, str, n) == n? 0: -1;
+	return (nret > 0)? args.args[nargs]: 0;
 }
 
-size_t strnlen(const char * s, size_t count)
+int write(void *handle, void *ptr, int nb)
 {
-	const char *sc;
-
-	for (sc = s; count-- && *sc != '\0'; ++sc)
-		/* nothing */;
-	return sc - s;
+	return call_prom("write", 3, 1, handle, ptr, nb);
 }
 
-extern unsigned int __div64_32(unsigned long long *dividend,
-			       unsigned int divisor);
-
-/* The unnecessary pointer compare is there
- * to check for type safety (n must be 64bit)
+/*
+ * Older OF's require that when claiming a specific range of addresses,
+ * we claim the physical space in the /memory node and the virtual
+ * space in the chosen mmu node, and then do a map operation to
+ * map virtual to physical.
  */
-# define do_div(n,base) ({						\
-	unsigned int __base = (base);					\
-	unsigned int __rem;						\
-	(void)(((typeof((n)) *)0) == ((unsigned long long *)0));	\
-	if (((n) >> 32) == 0) {						\
-		__rem = (unsigned int)(n) % __base;			\
-		(n) = (unsigned int)(n) / __base;			\
-	} else								\
-		__rem = __div64_32(&(n), __base);			\
-	__rem;								\
- })
+static int need_map = -1;
+static ihandle chosen_mmu;
+static phandle memory;
 
-static int skip_atoi(const char **s)
+/* returns true if s2 is a prefix of s1 */
+static int string_match(const char *s1, const char *s2)
 {
-	int i, c;
-
-	for (i = 0; '0' <= (c = **s) && c <= '9'; ++*s)
-		i = i*10 + c - '0';
-	return i;
+	for (; *s2; ++s2)
+		if (*s1++ != *s2)
+			return 0;
+	return 1;
 }
 
-#define ZEROPAD	1		/* pad with zero */
-#define SIGN	2		/* unsigned/signed long */
-#define PLUS	4		/* show plus */
-#define SPACE	8		/* space if plus */
-#define LEFT	16		/* left justified */
-#define SPECIAL	32		/* 0x */
-#define LARGE	64		/* use 'ABCDEF' instead of 'abcdef' */
-
-static char * number(char * str, unsigned long long num, int base, int size, int precision, int type)
+static int check_of_version(void)
 {
-	char c,sign,tmp[66];
-	const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
-	int i;
+	phandle oprom, chosen;
+	char version[64];
 
-	if (type & LARGE)
-		digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-	if (type & LEFT)
-		type &= ~ZEROPAD;
-	if (base < 2 || base > 36)
+	oprom = finddevice("/openprom");
+	if (oprom == (phandle) -1)
+		return 0;
+	if (getprop(oprom, "model", version, sizeof(version)) <= 0)
 		return 0;
-	c = (type & ZEROPAD) ? '0' : ' ';
-	sign = 0;
-	if (type & SIGN) {
-		if ((signed long long)num < 0) {
-			sign = '-';
-			num = - (signed long long)num;
-			size--;
-		} else if (type & PLUS) {
-			sign = '+';
-			size--;
-		} else if (type & SPACE) {
-			sign = ' ';
-			size--;
+	version[sizeof(version)-1] = 0;
+	printf("OF version = '%s'\r\n", version);
+	if (!string_match(version, "Open Firmware, 1.")
+	    && !string_match(version, "FirmWorks,3."))
+		return 0;
+	chosen = finddevice("/chosen");
+	if (chosen == (phandle) -1) {
+		chosen = finddevice("/chosen@0");
+		if (chosen == (phandle) -1) {
+			printf("no chosen\n");
+			return 0;
 		}
 	}
-	if (type & SPECIAL) {
-		if (base == 16)
-			size -= 2;
-		else if (base == 8)
-			size--;
-	}
-	i = 0;
-	if (num == 0)
-		tmp[i++]='0';
-	else while (num != 0) {
-		tmp[i++] = digits[do_div(num, base)];
+	if (getprop(chosen, "mmu", &chosen_mmu, sizeof(chosen_mmu)) <= 0) {
+		printf("no mmu\n");
+		return 0;
 	}
-	if (i > precision)
-		precision = i;
-	size -= precision;
-	if (!(type&(ZEROPAD+LEFT)))
-		while(size-->0)
-			*str++ = ' ';
-	if (sign)
-		*str++ = sign;
-	if (type & SPECIAL) {
-		if (base==8)
-			*str++ = '0';
-		else if (base==16) {
-			*str++ = '0';
-			*str++ = digits[33];
+	memory = (ihandle) call_prom("open", 1, 1, "/memory");
+	if (memory == (ihandle) -1) {
+		memory = (ihandle) call_prom("open", 1, 1, "/memory@0");
+		if (memory == (ihandle) -1) {
+			printf("no memory node\n");
+			return 0;
 		}
 	}
-	if (!(type & LEFT))
-		while (size-- > 0)
-			*str++ = c;
-	while (i < precision--)
-		*str++ = '0';
-	while (i-- > 0)
-		*str++ = tmp[i];
-	while (size-- > 0)
-		*str++ = ' ';
-	return str;
+	printf("old OF detected\r\n");
+	return 1;
 }
 
-int vsprintf(char *buf, const char *fmt, va_list args)
+void *claim(unsigned long virt, unsigned long size, unsigned long align)
 {
-	int len;
-	unsigned long long num;
-	int i, base;
-	char * str;
-	const char *s;
-
-	int flags;		/* flags to number() */
-
-	int field_width;	/* width of output field */
-	int precision;		/* min. # of digits for integers; max
-				   number of chars for from string */
-	int qualifier;		/* 'h', 'l', or 'L' for integer fields */
-	                        /* 'z' support added 23/7/1999 S.H.    */
-				/* 'z' changed to 'Z' --davidm 1/25/99 */
+	int ret;
+	unsigned int result;
 
+	if (need_map < 0)
+		need_map = check_of_version();
+	if (align || !need_map)
+		return (void *) call_prom("claim", 3, 1, virt, size, align);
 	
-	for (str=buf ; *fmt ; ++fmt) {
-		if (*fmt != '%') {
-			*str++ = *fmt;
-			continue;
-		}
-			
-		/* process flags */
-		flags = 0;
-		repeat:
-			++fmt;		/* this also skips first '%' */
-			switch (*fmt) {
-				case '-': flags |= LEFT; goto repeat;
-				case '+': flags |= PLUS; goto repeat;
-				case ' ': flags |= SPACE; goto repeat;
-				case '#': flags |= SPECIAL; goto repeat;
-				case '0': flags |= ZEROPAD; goto repeat;
-				}
-		
-		/* get field width */
-		field_width = -1;
-		if ('0' <= *fmt && *fmt <= '9')
-			field_width = skip_atoi(&fmt);
-		else if (*fmt == '*') {
-			++fmt;
-			/* it's the next argument */
-			field_width = va_arg(args, int);
-			if (field_width < 0) {
-				field_width = -field_width;
-				flags |= LEFT;
-			}
-		}
-
-		/* get the precision */
-		precision = -1;
-		if (*fmt == '.') {
-			++fmt;	
-			if ('0' <= *fmt && *fmt <= '9')
-				precision = skip_atoi(&fmt);
-			else if (*fmt == '*') {
-				++fmt;
-				/* it's the next argument */
-				precision = va_arg(args, int);
-			}
-			if (precision < 0)
-				precision = 0;
-		}
-
-		/* get the conversion qualifier */
-		qualifier = -1;
-		if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') {
-			qualifier = *fmt;
-			++fmt;
-		}
-
-		/* default base */
-		base = 10;
-
-		switch (*fmt) {
-		case 'c':
-			if (!(flags & LEFT))
-				while (--field_width > 0)
-					*str++ = ' ';
-			*str++ = (unsigned char) va_arg(args, int);
-			while (--field_width > 0)
-				*str++ = ' ';
-			continue;
-
-		case 's':
-			s = va_arg(args, char *);
-			if (!s)
-				s = "<NULL>";
-
-			len = strnlen(s, precision);
-
-			if (!(flags & LEFT))
-				while (len < field_width--)
-					*str++ = ' ';
-			for (i = 0; i < len; ++i)
-				*str++ = *s++;
-			while (len < field_width--)
-				*str++ = ' ';
-			continue;
-
-		case 'p':
-			if (field_width == -1) {
-				field_width = 2*sizeof(void *);
-				flags |= ZEROPAD;
-			}
-			str = number(str,
-				(unsigned long) va_arg(args, void *), 16,
-				field_width, precision, flags);
-			continue;
-
-
-		case 'n':
-			if (qualifier == 'l') {
-				long * ip = va_arg(args, long *);
-				*ip = (str - buf);
-			} else if (qualifier == 'Z') {
-				size_t * ip = va_arg(args, size_t *);
-				*ip = (str - buf);
-			} else {
-				int * ip = va_arg(args, int *);
-				*ip = (str - buf);
-			}
-			continue;
-
-		case '%':
-			*str++ = '%';
-			continue;
-
-		/* integer number formats - set up the flags and "break" */
-		case 'o':
-			base = 8;
-			break;
-
-		case 'X':
-			flags |= LARGE;
-		case 'x':
-			base = 16;
-			break;
-
-		case 'd':
-		case 'i':
-			flags |= SIGN;
-		case 'u':
-			break;
-
-		default:
-			*str++ = '%';
-			if (*fmt)
-				*str++ = *fmt;
-			else
-				--fmt;
-			continue;
-		}
-		if (qualifier == 'l') {
-			num = va_arg(args, unsigned long);
-			if (flags & SIGN)
-				num = (signed long) num;
-		} else if (qualifier == 'Z') {
-			num = va_arg(args, size_t);
-		} else if (qualifier == 'h') {
-			num = (unsigned short) va_arg(args, int);
-			if (flags & SIGN)
-				num = (signed short) num;
-		} else {
-			num = va_arg(args, unsigned int);
-			if (flags & SIGN)
-				num = (signed int) num;
-		}
-		str = number(str, num, base, field_width, precision, flags);
-	}
-	*str = '\0';
-	return str-buf;
-}
-
-int sprintf(char * buf, const char *fmt, ...)
-{
-	va_list args;
-	int i;
-
-	va_start(args, fmt);
-	i=vsprintf(buf,fmt,args);
-	va_end(args);
-	return i;
-}
-
-static char sprint_buf[1024];
-
-int
-printf(const char *fmt, ...)
-{
-	va_list args;
-	int n;
-
-	va_start(args, fmt);
-	n = vsprintf(sprint_buf, fmt, args);
-	va_end(args);
-	write(stdout, sprint_buf, n);
-	return n;
+	ret = call_prom_ret("call-method", 5, 2, &result, "claim", memory,
+			    align, size, virt);
+	if (ret != 0 || result == -1)
+		return (void *) -1;
+	ret = call_prom_ret("call-method", 5, 2, &result, "claim", chosen_mmu,
+			    align, size, virt);
+	/* 0x12 == coherent + read/write */
+	ret = call_prom("call-method", 6, 1, "map", chosen_mmu,
+			0x12, size, virt, virt);
+	return (void *) virt;
 }
diff -urN powerpc/arch/powerpc/boot/prom.h merge-hack/arch/powerpc/boot/prom.h
--- powerpc/arch/powerpc/boot/prom.h	2005-11-16 15:55:17.000000000 +1100
+++ merge-hack/arch/powerpc/boot/prom.h	2005-11-17 11:11:47.000000000 +1100
@@ -1,18 +1,34 @@
 #ifndef _PPC_BOOT_PROM_H_
 #define _PPC_BOOT_PROM_H_
 
+typedef void *phandle;
+typedef void *ihandle;
+
 extern int (*prom) (void *);
-extern void *chosen_handle;
+extern phandle chosen_handle;
+extern ihandle stdout;
 
-extern void *stdin;
-extern void *stdout;
-extern void *stderr;
+int	call_prom(const char *service, int nargs, int nret, ...);
+int	call_prom_ret(const char *service, int nargs, int nret,
+		      unsigned int *rets, ...);
 
 extern int write(void *handle, void *ptr, int nb);
-extern int read(void *handle, void *ptr, int nb);
-extern void exit(void);
-extern void pause(void);
-extern void *finddevice(const char *);
-extern void *claim(unsigned long virt, unsigned long size, unsigned long align);
-extern int getprop(void *phandle, const char *name, void *buf, int buflen);
+extern void *claim(unsigned long virt, unsigned long size, unsigned long aln);
+
+static inline void exit(void)
+{
+	call_prom("exit", 0, 0);
+}
+
+static inline phandle finddevice(const char *name)
+{
+	return (phandle) call_prom("finddevice", 1, 1, name);
+}
+
+static inline int getprop(void *phandle, const char *name,
+			  void *buf, int buflen)
+{
+	return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
+}
+
 #endif				/* _PPC_BOOT_PROM_H_ */
diff -urN powerpc/arch/powerpc/boot/rs6000.h merge-hack/arch/powerpc/boot/rs6000.h
--- /dev/null	2005-11-19 12:36:29.626282000 +1100
+++ merge-hack/arch/powerpc/boot/rs6000.h	2005-11-17 14:57:47.000000000 +1100
@@ -0,0 +1,243 @@
+/* IBM RS/6000 "XCOFF" file definitions for BFD.
+   Copyright (C) 1990, 1991 Free Software Foundation, Inc.
+   FIXME: Can someone provide a transliteration of this name into ASCII?
+   Using the following chars caused a compiler warning on HIUX (so I replaced
+   them with octal escapes), and isn't useful without an understanding of what
+   character set it is.
+   Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
+   and John Gilmore of Cygnus Support.  */
+
+/********************** FILE HEADER **********************/
+
+struct external_filehdr {
+	char f_magic[2];	/* magic number			*/
+	char f_nscns[2];	/* number of sections		*/
+	char f_timdat[4];	/* time & date stamp		*/
+	char f_symptr[4];	/* file pointer to symtab	*/
+	char f_nsyms[4];	/* number of symtab entries	*/
+	char f_opthdr[2];	/* sizeof(optional hdr)		*/
+	char f_flags[2];	/* flags			*/
+};
+
+        /* IBM RS/6000 */
+#define U802WRMAGIC     0730    /* writeable text segments **chh**      */
+#define U802ROMAGIC     0735    /* readonly sharable text segments      */
+#define U802TOCMAGIC    0737    /* readonly text segments and TOC       */
+
+#define BADMAG(x)	\
+	((x).f_magic != U802ROMAGIC && (x).f_magic != U802WRMAGIC && \
+	 (x).f_magic != U802TOCMAGIC)
+
+#define	FILHDR	struct external_filehdr
+#define	FILHSZ	20
+
+
+/********************** AOUT "OPTIONAL HEADER" **********************/
+
+
+typedef struct
+{
+  unsigned char	magic[2];	/* type of file			*/
+  unsigned char	vstamp[2];	/* version stamp		*/
+  unsigned char	tsize[4];	/* text size in bytes, padded to FW bdry */
+  unsigned char	dsize[4];	/* initialized data "  "	*/
+  unsigned char	bsize[4];	/* uninitialized data "   "	*/
+  unsigned char	entry[4];	/* entry pt.			*/
+  unsigned char	text_start[4];	/* base of text used for this file */
+  unsigned char	data_start[4];	/* base of data used for this file */
+  unsigned char	o_toc[4];	/* address of TOC */
+  unsigned char	o_snentry[2];	/* section number of entry point */
+  unsigned char	o_sntext[2];	/* section number of .text section */
+  unsigned char	o_sndata[2];	/* section number of .data section */
+  unsigned char	o_sntoc[2];	/* section number of TOC */
+  unsigned char	o_snloader[2];	/* section number of .loader section */
+  unsigned char	o_snbss[2];	/* section number of .bss section */
+  unsigned char	o_algntext[2];	/* .text alignment */
+  unsigned char	o_algndata[2];	/* .data alignment */
+  unsigned char	o_modtype[2];	/* module type (??) */
+  unsigned char o_cputype[2];	/* cpu type */
+  unsigned char	o_maxstack[4];	/* max stack size (??) */
+  unsigned char o_maxdata[4];	/* max data size (??) */
+  unsigned char	o_resv2[12];	/* reserved */
+}
+AOUTHDR;
+
+#define AOUTSZ 72
+#define SMALL_AOUTSZ (28)
+#define AOUTHDRSZ 72
+
+#define	RS6K_AOUTHDR_OMAGIC	0x0107	/* old: text & data writeable */
+#define	RS6K_AOUTHDR_NMAGIC	0x0108	/* new: text r/o, data r/w */
+#define	RS6K_AOUTHDR_ZMAGIC	0x010B	/* paged: text r/o, both page-aligned */
+
+
+/********************** SECTION HEADER **********************/
+
+
+struct external_scnhdr {
+	char		s_name[8];	/* section name			*/
+	char		s_paddr[4];	/* physical address, aliased s_nlib */
+	char		s_vaddr[4];	/* virtual address		*/
+	char		s_size[4];	/* section size			*/
+	char		s_scnptr[4];	/* file ptr to raw data for section */
+	char		s_relptr[4];	/* file ptr to relocation	*/
+	char		s_lnnoptr[4];	/* file ptr to line numbers	*/
+	char		s_nreloc[2];	/* number of relocation entries	*/
+	char		s_nlnno[2];	/* number of line number entries*/
+	char		s_flags[4];	/* flags			*/
+};
+
+/*
+ * names of "special" sections
+ */
+#define _TEXT	".text"
+#define _DATA	".data"
+#define _BSS	".bss"
+#define _PAD	".pad"
+#define _LOADER	".loader"
+
+#define	SCNHDR	struct external_scnhdr
+#define	SCNHSZ	40
+
+/* XCOFF uses a special .loader section with type STYP_LOADER.  */
+#define STYP_LOADER 0x1000
+
+/* XCOFF uses a special .debug section with type STYP_DEBUG.  */
+#define STYP_DEBUG 0x2000
+
+/* XCOFF handles line number or relocation overflow by creating
+   another section header with STYP_OVRFLO set.  */
+#define STYP_OVRFLO 0x8000
+
+/********************** LINE NUMBERS **********************/
+
+/* 1 line number entry for every "breakpointable" source line in a section.
+ * Line numbers are grouped on a per function basis; first entry in a function
+ * grouping will have l_lnno = 0 and in place of physical address will be the
+ * symbol table index of the function name.
+ */
+struct external_lineno {
+	union {
+		char l_symndx[4];	/* function name symbol index, iff l_lnno == 0*/
+		char l_paddr[4];	/* (physical) address of line number	*/
+	} l_addr;
+	char l_lnno[2];	/* line number		*/
+};
+
+
+#define	LINENO	struct external_lineno
+#define	LINESZ	6
+
+
+/********************** SYMBOLS **********************/
+
+#define E_SYMNMLEN	8	/* # characters in a symbol name	*/
+#define E_FILNMLEN	14	/* # characters in a file name		*/
+#define E_DIMNUM	4	/* # array dimensions in auxiliary entry */
+
+struct external_syment
+{
+  union {
+    char e_name[E_SYMNMLEN];
+    struct {
+      char e_zeroes[4];
+      char e_offset[4];
+    } e;
+  } e;
+  char e_value[4];
+  char e_scnum[2];
+  char e_type[2];
+  char e_sclass[1];
+  char e_numaux[1];
+};
+
+
+
+#define N_BTMASK	(017)
+#define N_TMASK		(060)
+#define N_BTSHFT	(4)
+#define N_TSHIFT	(2)
+
+
+union external_auxent {
+	struct {
+		char x_tagndx[4];	/* str, un, or enum tag indx */
+		union {
+			struct {
+			    char  x_lnno[2]; /* declaration line number */
+			    char  x_size[2]; /* str/union/array size */
+			} x_lnsz;
+			char x_fsize[4];	/* size of function */
+		} x_misc;
+		union {
+			struct {		/* if ISFCN, tag, or .bb */
+			    char x_lnnoptr[4];	/* ptr to fcn line # */
+			    char x_endndx[4];	/* entry ndx past block end */
+			} x_fcn;
+			struct {		/* if ISARY, up to 4 dimen. */
+			    char x_dimen[E_DIMNUM][2];
+			} x_ary;
+		} x_fcnary;
+		char x_tvndx[2];		/* tv index */
+	} x_sym;
+
+	union {
+		char x_fname[E_FILNMLEN];
+		struct {
+			char x_zeroes[4];
+			char x_offset[4];
+		} x_n;
+	} x_file;
+
+	struct {
+		char x_scnlen[4];			/* section length */
+		char x_nreloc[2];	/* # relocation entries */
+		char x_nlinno[2];	/* # line numbers */
+	} x_scn;
+
+        struct {
+		char x_tvfill[4];	/* tv fill value */
+		char x_tvlen[2];	/* length of .tv */
+		char x_tvran[2][2];	/* tv range */
+	} x_tv;		/* info about .tv section (in auxent of symbol .tv)) */
+
+	struct {
+		unsigned char x_scnlen[4];
+		unsigned char x_parmhash[4];
+		unsigned char x_snhash[2];
+		unsigned char x_smtyp[1];
+		unsigned char x_smclas[1];
+		unsigned char x_stab[4];
+		unsigned char x_snstab[2];
+	} x_csect;
+
+};
+
+#define	SYMENT	struct external_syment
+#define	SYMESZ	18
+#define	AUXENT	union external_auxent
+#define	AUXESZ	18
+#define DBXMASK 0x80		/* for dbx storage mask */
+#define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
+
+
+
+/********************** RELOCATION DIRECTIVES **********************/
+
+
+struct external_reloc {
+  char r_vaddr[4];
+  char r_symndx[4];
+  char r_size[1];
+  char r_type[1];
+};
+
+
+#define RELOC struct external_reloc
+#define RELSZ 10
+
+#define DEFAULT_DATA_SECTION_ALIGNMENT 4
+#define DEFAULT_BSS_SECTION_ALIGNMENT 4
+#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
+/* For new sections we havn't heard of before */
+#define DEFAULT_SECTION_ALIGNMENT 4
diff -urN powerpc/arch/powerpc/boot/stdio.c merge-hack/arch/powerpc/boot/stdio.c
--- /dev/null	2005-11-19 12:36:29.626282000 +1100
+++ merge-hack/arch/powerpc/boot/stdio.c	2005-11-17 14:36:52.000000000 +1100
@@ -0,0 +1,325 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <stdarg.h>
+#include <stddef.h>
+#include "string.h"
+#include "stdio.h"
+#include "prom.h"
+
+size_t strnlen(const char * s, size_t count)
+{
+	const char *sc;
+
+	for (sc = s; count-- && *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+
+extern unsigned int __div64_32(unsigned long long *dividend,
+			       unsigned int divisor);
+
+/* The unnecessary pointer compare is there
+ * to check for type safety (n must be 64bit)
+ */
+# define do_div(n,base) ({						\
+	unsigned int __base = (base);					\
+	unsigned int __rem;						\
+	(void)(((typeof((n)) *)0) == ((unsigned long long *)0));	\
+	if (((n) >> 32) == 0) {						\
+		__rem = (unsigned int)(n) % __base;			\
+		(n) = (unsigned int)(n) / __base;			\
+	} else								\
+		__rem = __div64_32(&(n), __base);			\
+	__rem;								\
+ })
+
+static int skip_atoi(const char **s)
+{
+	int i, c;
+
+	for (i = 0; '0' <= (c = **s) && c <= '9'; ++*s)
+		i = i*10 + c - '0';
+	return i;
+}
+
+#define ZEROPAD	1		/* pad with zero */
+#define SIGN	2		/* unsigned/signed long */
+#define PLUS	4		/* show plus */
+#define SPACE	8		/* space if plus */
+#define LEFT	16		/* left justified */
+#define SPECIAL	32		/* 0x */
+#define LARGE	64		/* use 'ABCDEF' instead of 'abcdef' */
+
+static char * number(char * str, unsigned long long num, int base, int size, int precision, int type)
+{
+	char c,sign,tmp[66];
+	const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
+	int i;
+
+	if (type & LARGE)
+		digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+	if (type & LEFT)
+		type &= ~ZEROPAD;
+	if (base < 2 || base > 36)
+		return 0;
+	c = (type & ZEROPAD) ? '0' : ' ';
+	sign = 0;
+	if (type & SIGN) {
+		if ((signed long long)num < 0) {
+			sign = '-';
+			num = - (signed long long)num;
+			size--;
+		} else if (type & PLUS) {
+			sign = '+';
+			size--;
+		} else if (type & SPACE) {
+			sign = ' ';
+			size--;
+		}
+	}
+	if (type & SPECIAL) {
+		if (base == 16)
+			size -= 2;
+		else if (base == 8)
+			size--;
+	}
+	i = 0;
+	if (num == 0)
+		tmp[i++]='0';
+	else while (num != 0) {
+		tmp[i++] = digits[do_div(num, base)];
+	}
+	if (i > precision)
+		precision = i;
+	size -= precision;
+	if (!(type&(ZEROPAD+LEFT)))
+		while(size-->0)
+			*str++ = ' ';
+	if (sign)
+		*str++ = sign;
+	if (type & SPECIAL) {
+		if (base==8)
+			*str++ = '0';
+		else if (base==16) {
+			*str++ = '0';
+			*str++ = digits[33];
+		}
+	}
+	if (!(type & LEFT))
+		while (size-- > 0)
+			*str++ = c;
+	while (i < precision--)
+		*str++ = '0';
+	while (i-- > 0)
+		*str++ = tmp[i];
+	while (size-- > 0)
+		*str++ = ' ';
+	return str;
+}
+
+int vsprintf(char *buf, const char *fmt, va_list args)
+{
+	int len;
+	unsigned long long num;
+	int i, base;
+	char * str;
+	const char *s;
+
+	int flags;		/* flags to number() */
+
+	int field_width;	/* width of output field */
+	int precision;		/* min. # of digits for integers; max
+				   number of chars for from string */
+	int qualifier;		/* 'h', 'l', or 'L' for integer fields */
+	                        /* 'z' support added 23/7/1999 S.H.    */
+				/* 'z' changed to 'Z' --davidm 1/25/99 */
+
+	
+	for (str=buf ; *fmt ; ++fmt) {
+		if (*fmt != '%') {
+			*str++ = *fmt;
+			continue;
+		}
+			
+		/* process flags */
+		flags = 0;
+		repeat:
+			++fmt;		/* this also skips first '%' */
+			switch (*fmt) {
+				case '-': flags |= LEFT; goto repeat;
+				case '+': flags |= PLUS; goto repeat;
+				case ' ': flags |= SPACE; goto repeat;
+				case '#': flags |= SPECIAL; goto repeat;
+				case '0': flags |= ZEROPAD; goto repeat;
+				}
+		
+		/* get field width */
+		field_width = -1;
+		if ('0' <= *fmt && *fmt <= '9')
+			field_width = skip_atoi(&fmt);
+		else if (*fmt == '*') {
+			++fmt;
+			/* it's the next argument */
+			field_width = va_arg(args, int);
+			if (field_width < 0) {
+				field_width = -field_width;
+				flags |= LEFT;
+			}
+		}
+
+		/* get the precision */
+		precision = -1;
+		if (*fmt == '.') {
+			++fmt;	
+			if ('0' <= *fmt && *fmt <= '9')
+				precision = skip_atoi(&fmt);
+			else if (*fmt == '*') {
+				++fmt;
+				/* it's the next argument */
+				precision = va_arg(args, int);
+			}
+			if (precision < 0)
+				precision = 0;
+		}
+
+		/* get the conversion qualifier */
+		qualifier = -1;
+		if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') {
+			qualifier = *fmt;
+			++fmt;
+		}
+
+		/* default base */
+		base = 10;
+
+		switch (*fmt) {
+		case 'c':
+			if (!(flags & LEFT))
+				while (--field_width > 0)
+					*str++ = ' ';
+			*str++ = (unsigned char) va_arg(args, int);
+			while (--field_width > 0)
+				*str++ = ' ';
+			continue;
+
+		case 's':
+			s = va_arg(args, char *);
+			if (!s)
+				s = "<NULL>";
+
+			len = strnlen(s, precision);
+
+			if (!(flags & LEFT))
+				while (len < field_width--)
+					*str++ = ' ';
+			for (i = 0; i < len; ++i)
+				*str++ = *s++;
+			while (len < field_width--)
+				*str++ = ' ';
+			continue;
+
+		case 'p':
+			if (field_width == -1) {
+				field_width = 2*sizeof(void *);
+				flags |= ZEROPAD;
+			}
+			str = number(str,
+				(unsigned long) va_arg(args, void *), 16,
+				field_width, precision, flags);
+			continue;
+
+
+		case 'n':
+			if (qualifier == 'l') {
+				long * ip = va_arg(args, long *);
+				*ip = (str - buf);
+			} else if (qualifier == 'Z') {
+				size_t * ip = va_arg(args, size_t *);
+				*ip = (str - buf);
+			} else {
+				int * ip = va_arg(args, int *);
+				*ip = (str - buf);
+			}
+			continue;
+
+		case '%':
+			*str++ = '%';
+			continue;
+
+		/* integer number formats - set up the flags and "break" */
+		case 'o':
+			base = 8;
+			break;
+
+		case 'X':
+			flags |= LARGE;
+		case 'x':
+			base = 16;
+			break;
+
+		case 'd':
+		case 'i':
+			flags |= SIGN;
+		case 'u':
+			break;
+
+		default:
+			*str++ = '%';
+			if (*fmt)
+				*str++ = *fmt;
+			else
+				--fmt;
+			continue;
+		}
+		if (qualifier == 'l') {
+			num = va_arg(args, unsigned long);
+			if (flags & SIGN)
+				num = (signed long) num;
+		} else if (qualifier == 'Z') {
+			num = va_arg(args, size_t);
+		} else if (qualifier == 'h') {
+			num = (unsigned short) va_arg(args, int);
+			if (flags & SIGN)
+				num = (signed short) num;
+		} else {
+			num = va_arg(args, unsigned int);
+			if (flags & SIGN)
+				num = (signed int) num;
+		}
+		str = number(str, num, base, field_width, precision, flags);
+	}
+	*str = '\0';
+	return str-buf;
+}
+
+int sprintf(char * buf, const char *fmt, ...)
+{
+	va_list args;
+	int i;
+
+	va_start(args, fmt);
+	i=vsprintf(buf,fmt,args);
+	va_end(args);
+	return i;
+}
+
+static char sprint_buf[1024];
+
+int
+printf(const char *fmt, ...)
+{
+	va_list args;
+	int n;
+
+	va_start(args, fmt);
+	n = vsprintf(sprint_buf, fmt, args);
+	va_end(args);
+	write(stdout, sprint_buf, n);
+	return n;
+}
diff -urN powerpc/arch/powerpc/boot/stdio.h merge-hack/arch/powerpc/boot/stdio.h
--- powerpc/arch/powerpc/boot/stdio.h	2005-11-16 15:55:17.000000000 +1100
+++ merge-hack/arch/powerpc/boot/stdio.h	2005-11-17 11:07:34.000000000 +1100
@@ -7,10 +7,4 @@
 
 extern int vsprintf(char *buf, const char *fmt, va_list args);
 
-extern int putc(int c, void *f);
-extern int putchar(int c);
-extern int getchar(void);
-
-extern int fputs(char *str, void *f);
-
 #endif				/* _PPC_BOOT_STDIO_H_ */
diff -urN powerpc/arch/powerpc/boot/zImage.coff.lds merge-hack/arch/powerpc/boot/zImage.coff.lds
--- /dev/null	2005-11-19 12:36:29.626282000 +1100
+++ merge-hack/arch/powerpc/boot/zImage.coff.lds	2005-11-18 22:19:31.000000000 +1100
@@ -0,0 +1,46 @@
+OUTPUT_ARCH(powerpc:common)
+ENTRY(_start)
+SECTIONS
+{
+  . = (5*1024*1024);
+  _start = .;
+  .text      :
+  {
+    *(.text)
+    *(.fixup)
+  }
+  _etext = .;
+  . = ALIGN(4096);
+  .data    :
+  {
+    *(.rodata*)
+    *(.data*)
+    *(.sdata*)
+    __got2_start = .;
+    *(.got2)
+    __got2_end = .;
+
+    _vmlinux_start =  .;
+    *(.kernel:vmlinux.strip)
+    _vmlinux_end =  .;
+
+    _initrd_start =  .;
+    *(.kernel:initrd)
+    _initrd_end =  .;
+  }
+
+  . = ALIGN(4096);
+  _edata  =  .;
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss)
+   *(.bss)
+  }
+  _end = . ;
+
+  /DISCARD/ :
+  {
+    *(.comment)
+  }
+}
diff -urN powerpc/arch/powerpc/boot/zImage.lds merge-hack/arch/powerpc/boot/zImage.lds
--- powerpc/arch/powerpc/boot/zImage.lds	2005-11-16 15:55:17.000000000 +1100
+++ merge-hack/arch/powerpc/boot/zImage.lds	2005-11-18 21:21:04.000000000 +1100
@@ -2,7 +2,7 @@
 ENTRY(_zimage_start)
 SECTIONS
 {
-  . = (4*1024*1024);
+  . = (5*1024*1024);
   _start = .;
   .text      :
   {
@@ -33,8 +33,6 @@
 
   . = ALIGN(4096);
   _edata  =  .;
-
-  . = ALIGN(4096);
   __bss_start = .;
   .bss       :
   {

^ permalink raw reply

* Re: Platform device model drawback
From: Grant Likely @ 2005-11-19  2:37 UTC (permalink / raw)
  To: Greg KH; +Cc: Kumar Gala, linuxppc-embedded list
In-Reply-To: <20051118234711.GB26118@kroah.com>

On 11/18/05, Greg KH <greg@kroah.com> wrote:
> On Thu, Nov 17, 2005 at 04:46:17PM -0700, Grant Likely wrote:
> > Does this help?  (We also discussed this a bit at the PPC BoF at OLS th=
is year)
> >
> >  For example on the mpc52xx (see arch/ppc/syslib/mpc52xx_devices.c);
> >    - 6 PSC devices on chip;
> >    - (struct platform_device) for each device has: .name=3D'mpc52xx-psc=
';
> >    - However, SCC1 may be driven by the Ethernet driver but PSC2 and
> > PSC6 may be serial
> >    - problem then is: How do you get only PSC1 bound to the
> > psc-ethernet driver and only PSC2 & PSC6 bound to the serial driver?
>
> I really do not know, sorry.
>
> >
> > Possible solution;  Modify the naming scheme slightly from what is
> > currently used.
> > 1. Make the Ethernet driver register the name "mpc52xx-psc:eth"
> > 2. Make the serial driver register the name "mpc52xx-psc:uart"
> > 3. In the board-specific platform code, modify the .name field in
> > struct platform_device *before* the device is registered with the
> > platform device. (possibly by extending ppc_sys_device_fixup callback)
> >    - The board specific code would set PSC1 to "mpc52xx-psc:eth",
> > PSC2&6 to "mpc52xx-psc:uart".  PSC3-5 would stick with "mpc52xx-psc"
> > and so would not get bound to anything.

Ignoring the question below, do you see any problem with the above solution=
?

> >
> > Q: Can the .name field be modified *after* platform_device is
> > registered w/ the platform bus?
>
> No, it can not, sorry.
Not a big deal, that question was a bit of an aside.  If the name
could be changed, then the device function could change at runtime by
unbinding one function driver, changing the name and rebind
another....  But now that I think about it for more that 2ms, a
solution to this would be to just unregister, change .name, and
reregister the struct platform_device.

g.

^ permalink raw reply

* Re: Platform device model drawback
From: Greg KH @ 2005-11-18 23:47 UTC (permalink / raw)
  To: Grant Likely; +Cc: Kumar Gala, linuxppc-embedded list
In-Reply-To: <528646bc0511171546s4095b3ebgb71cd13880480d1b@mail.gmail.com>

On Thu, Nov 17, 2005 at 04:46:17PM -0700, Grant Likely wrote:
> On 11/15/05, Greg KH <greg@kroah.com> wrote:
> > On Tue, Nov 15, 2005 at 01:34:47PM -0600, Kumar Gala wrote:
> > > This is where the confusion is.  We have two instances of device A.  We
> > > want instance 1 of device A bound to driver "enet" and instance 2 of
> > > device A bound to "serial".
> >
> > That's different from what was described earlier :)
> >
> > In this case, you need two different struct devices.
> Which is what we have.
> 
> >
> > > Today both instances are called "deviceA".  However we can't register two
> > > different drivers as "deviceA".
> >
> > Nor would you want to.
> >
> > > Not sure if that clarifies the issue any.
> >
> > A bit.  I think it still sounds messy...
> Does this help?  (We also discussed this a bit at the PPC BoF at OLS this year)
> 
>  For example on the mpc52xx (see arch/ppc/syslib/mpc52xx_devices.c);
>    - 6 PSC devices on chip;
>    - (struct platform_device) for each device has: .name='mpc52xx-psc';
>    - However, SCC1 may be driven by the Ethernet driver but PSC2 and
> PSC6 may be serial
>    - problem then is: How do you get only PSC1 bound to the
> psc-ethernet driver and only PSC2 & PSC6 bound to the serial driver?

I really do not know, sorry.

> 
> Possible solution;  Modify the naming scheme slightly from what is
> currently used.
> 1. Make the Ethernet driver register the name "mpc52xx-psc:eth"
> 2. Make the serial driver register the name "mpc52xx-psc:uart"
> 3. In the board-specific platform code, modify the .name field in
> struct platform_device *before* the device is registered with the
> platform device. (possibly by extending ppc_sys_device_fixup callback)
>    - The board specific code would set PSC1 to "mpc52xx-psc:eth",
> PSC2&6 to "mpc52xx-psc:uart".  PSC3-5 would stick with "mpc52xx-psc"
> and so would not get bound to anything.
> 
> Q: Can the .name field be modified *after* platform_device is
> registered w/ the platform bus?

No, it can not, sorry.

Good luck,

greg k-h

^ permalink raw reply

* Re: Help ! 2.6.14 kernel can't bring up
From: David H. Lynch Jr. @ 2005-11-18 23:14 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <20051118024803.E2988687A1@ozlabs.org>

zjznliang wrote:
> Hi linuxppc-embedded!
>
> 	Hi , How to config the "early printk" in 2.6.14 linux configration???
>
>
>  	
Console and debugging I/O is available at all stages of The Linux
loading process - If the drivers for your board support it.
There is nearly free support for 8250 like serial ports, in virtually
all boards. Support for other debugging IO devices is fairly simple to
setup.

I used the arch/ppc/syslib/mv64x60_dbg.c and
arch/ppc/boot/simple/mv64x60_tty.c as templates to create trivial
drivers for debugging IO
on hardware that had no relation to a UART.

I think "early printk" refers to the early serial driver that can be
used after the kernel has uncompressed itself and relocated itself and
switched to
a virtual environment. For 8250 like serial ports that can enabled in
the linux .config file setup by make menuconfig or whatever variant of
make xxconfig
you prefer. For non-8250 like uarts you will again have to write an
early serial driver. All the early debug IO drivers are trivial - little
more is needed than
an implementation of putc, as opposed to the full conolse support
required for a tty on a booted system.

^ permalink raw reply

* Re: [PATCH] generate COFF zImage in arch/powerpc/boot
From: Olaf Hering @ 2005-11-18 23:16 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <20051118221309.GA12724@suse.de>

 On Fri, Nov 18, Olaf Hering wrote:

>  On Fri, Nov 18, Olaf Hering wrote:
> 
> >  On Fri, Nov 18, Paul Mackeras wrote:
> > 
> > 
> > > +++ merge-hack/arch/powerpc/boot/zImage.lds	2005-11-16 23:16:48.000000000 +1100
> > 
> > This change makes arch/powerpc/boot/README obsolete. 
> > Last time I looked, the COFF loader liked only .text, .data and .bss.
> > But maybe hack-coff needs some tweaking to modify also other sections.
> 
> I tried to keep the kernel in its own section. But the firmware does not
> fully setup the memory range for that section. claim and map calls for
> that area are not enough.

After using your new version of claim, I found that the section is not
copied. It contains only sequences of ff0fffff fff0ff0f.

-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply

* Re: [PATCH] ppc boot: replace string labels with numbers
From: Olaf Hering @ 2005-11-18 22:19 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: linuxppc-dev
In-Reply-To: <322e5a1c14e0e7a08d88868f23ec7c73@penguinppc.org>

 On Fri, Nov 18, Hollis Blanchard wrote:

> >The code should be obvious.
> 
> I hope the above was a joke, Olaf.

Not really. Perhaps I have been working on that code for too long now.
Its the string table that makes a difference.

-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply

* Re: [PATCH] generate COFF zImage in arch/powerpc/boot
From: Olaf Hering @ 2005-11-18 22:13 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <20051118075158.GB14865@suse.de>

 On Fri, Nov 18, Olaf Hering wrote:

>  On Fri, Nov 18, Paul Mackeras wrote:
> 
> 
> > +++ merge-hack/arch/powerpc/boot/zImage.lds	2005-11-16 23:16:48.000000000 +1100
> 
> This change makes arch/powerpc/boot/README obsolete. 
> Last time I looked, the COFF loader liked only .text, .data and .bss.
> But maybe hack-coff needs some tweaking to modify also other sections.

I tried to keep the kernel in its own section. But the firmware does not
fully setup the memory range for that section. claim and map calls for
that area are not enough.
So we either need a ld script for coff with kernel and initrd in the
.data section. Or we write a tool to extract the vmlinux.gz and initrd
based on nm or readelf -a output.

-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply

* Re: [PATCH] Fix 8250 probe on ppc32
From: David Woodhouse @ 2005-11-18 21:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, Tom Rini
In-Reply-To: <1132349794.20016.94.camel@gaston>

On Sat, 2005-11-19 at 08:36 +1100, Benjamin Herrenschmidt wrote:
> As soon as you can get something mapped I suppose... On ppc32 with
> BootX, I setup a BAT in head.S, thus udbg is available in
> machine_init(). On ppc64 with hypervisor console, we can enable hacks
> that initialize udbg in real mode.

About the same time as you can first call register_console() with it
then.

I always used to call serial8250_console_init() from the beginning of
setup_arch() if I wanted that kind of thing.

-- 
dwmw2

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox