Skip to contentSkip to conversation

powerpc: Partialy restore core of mpc8xx

PATCH New Christophe Leroy 2 participants 2 messages Jul 6, 2017 – Jul 9, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 powerpc: Partialy restore core of mpc8xx

CS Systemes d'Information (CSSI) manufactures 8xx boards for critical communication systems. Those boards have been running U-Boot since 2010 and will have to be maintained until at least 2027.

commit 5b8e76c35ec312a3f73126bd1a2d2c0965b98a9f ("powerpc, 8xx: remove support for 8xx") orphaned those boards by removing support for the mpc8xx CPU.

This commit partially restores support for the 8xx, with the following limitations:
- Restores support for MPC866 and MPC885 only
- Does not restore IDE, PCMCIA, I2C, USB
- Does not restore examples
- Does not restore POST
- Does not restore Ethernet on SCC
- Does not restore console on SCC
- Does not restore bedbug and kgdb support

As the 866 and 885 do not support the following features, they are not restored either:
- VIDEO / LCD
- RTC clock

The CPM uCODE patch is not restored either, because:
- 866 and 885 already have support for I2C and SPI relocation without a uCODE patch
- relocation of SMC, I2C or SPI is only needed for using SCCs for Ethernet or QMC

The dynamic setup/calculation of clocks is removed, we expect the target being use with the clock and PLPRCR register defined in the configuration.
All the clock settings for 8xx prior to 866 is removed as well as we now only support 866 and 885.

This code is mature and addresses mature boards. Therefore all code enclosed in '#if 0/#endif' and '#if XX_DEBUG/#endif' is unneeded.

The following files are not restored by this patch:

- arch/powerpc/cpu/mpc8xx/bedbug_860.c
- arch/powerpc/cpu/mpc8xx/fec.h
- arch/powerpc/cpu/mpc8xx/kgdb.S
- arch/powerpc/cpu/mpc8xx/plprcr_write.S
- arch/powerpc/cpu/mpc8xx/scc.c
- arch/powerpc/cpu/mpc8xx/upatch.c
- arch/powerpc/cpu/mpc8xx/video.c
- arch/powerpc/include/asm/status_led.h
- arch/powerpc/lib/ide.c
- arch/powerpc/lib/ide.h
- doc/README.MPC866
- drivers/pcmcia/mpc8xx_pcmcia.c
- drivers/rtc/mpc8xx.c
- drivers/usb/gadget/mpc8xx_udc.c
- drivers/video/mpc8xx_lcd.c
- examples/standalone/test_burst.c
- examples/standalone/test_burst.h
- examples/standalone/test_burst_lib.S
- examples/standalone/timer.c
- include/mpc823_lcd.h
- include/usb/mpc8xx_udc.h
- post/cpu/mpc8xx/Makefile
- post/cpu/mpc8xx/cache.c
- post/cpu/mpc8xx/cache_8xx.S
- post/cpu/mpc8xx/ether.c
- post/cpu/mpc8xx/spr.c
- post/cpu/mpc8xx/uart.c
- post/cpu/mpc8xx/usb.c
- post/cpu/mpc8xx/watchdog.c

Some of the restored files are not located in a proper location. In order to keep traceability of the changes, they will be moved to their correct location and moved to Kconfig in a followup patch.

This patch also declares CSSI as point of contact for the update of the 8xx platform, as those boards are the only ones still being maintained on the 8xx area. A later patch will add those boards to the tree.

---
v6: Removed travis-CI setup as it fails due to lack of board. Will be added back with
the board. Removed SCC console. Keep only 866 and 885 in check_CPU(). Removed commands that just print 'not implemented' from immap.c.
Removed code enclosed in #if 0/#endif .

v5: Only restore the needed parts.

v4: Restored some common CONFIG_ removed by 5xx removal in README and config_whitelist
Removed all impacts on 4xx; Removed a few remaining references to 82xx Fixed unbalanced #ifdef in i2c

v3: Fixed build error in arch/powerpc/include/asm/ppc.h ; removed commproc.h from 4xx

v2: Tom squashed patches 1-10 of the serie

 MAINTAINERS                            |   2 +-
 README                                 |  62 ++-
 api/api_platform-powerpc.c             |   2 +-
 arch/powerpc/Kconfig                   |   6 +
 arch/powerpc/cpu/mpc8xx/Kconfig        |  13 +
 arch/powerpc/cpu/mpc8xx/Makefile       |  17 +
 arch/powerpc/cpu/mpc8xx/config.mk      |   8 +
 arch/powerpc/cpu/mpc8xx/cpu.c          | 331 +++++++++++++
 arch/powerpc/cpu/mpc8xx/cpu_init.c     | 180 +++++++
 arch/powerpc/cpu/mpc8xx/fdt.c          |  27 ++
 arch/powerpc/cpu/mpc8xx/fec.c          | 847 +++++++++++++++++++++++++++++++++
 arch/powerpc/cpu/mpc8xx/interrupts.c   | 259 ++++++++++
 arch/powerpc/cpu/mpc8xx/serial.c       | 301 ++++++++++++
 arch/powerpc/cpu/mpc8xx/speed.c        |  62 +++
 arch/powerpc/cpu/mpc8xx/spi.c          | 368 ++++++++++++++
 arch/powerpc/cpu/mpc8xx/start.S        | 636 +++++++++++++++++++++++++
 arch/powerpc/cpu/mpc8xx/traps.c        | 168 +++++++
 arch/powerpc/include/asm/8xx_immap.h   | 468 ++++++++++++++++++
 arch/powerpc/include/asm/cache.h       |  41 +-
 arch/powerpc/include/asm/global_data.h |   3 +
 arch/powerpc/include/asm/iopin_8xx.h   | 379 +++++++++++++++
 arch/powerpc/include/asm/ppc.h         |  11 +
 arch/powerpc/lib/Kconfig               |   7 +
 arch/powerpc/lib/Makefile              |   1 +
 arch/powerpc/lib/immap.c               | 397 +++++++++++++++
 arch/powerpc/lib/time.c                |  11 +
 cmd/bdinfo.c                           |   2 +-
 cmd/reginfo.c                          |  59 ++-
 include/asm-generic/u-boot.h           |   2 +-
 include/commproc.h                     | 687 ++++++++++++++++++++++++++
 include/mpc8xx.h                       |  14 -
 include/ppc_asm.tmpl                   |  46 ++
 include/watchdog.h                     |   5 +
 scripts/config_whitelist.txt           |  22 +
 34 files changed, 5418 insertions(+), 26 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc8xx/Kconfig
 create mode 100644 arch/powerpc/cpu/mpc8xx/Makefile
 create mode 100644 arch/powerpc/cpu/mpc8xx/config.mk
 create mode 100644 arch/powerpc/cpu/mpc8xx/cpu.c
 create mode 100644 arch/powerpc/cpu/mpc8xx/cpu_init.c
 create mode 100644 arch/powerpc/cpu/mpc8xx/fdt.c
 create mode 100644 arch/powerpc/cpu/mpc8xx/fec.c
 create mode 100644 arch/powerpc/cpu/mpc8xx/interrupts.c
 create mode 100644 arch/powerpc/cpu/mpc8xx/serial.c
 create mode 100644 arch/powerpc/cpu/mpc8xx/speed.c
 create mode 100644 arch/powerpc/cpu/mpc8xx/spi.c
 create mode 100644 arch/powerpc/cpu/mpc8xx/start.S
 create mode 100644 arch/powerpc/cpu/mpc8xx/traps.c
 create mode 100644 arch/powerpc/include/asm/8xx_immap.h
 create mode 100644 arch/powerpc/include/asm/iopin_8xx.h
 create mode 100644 arch/powerpc/lib/Kconfig
 create mode 100644 arch/powerpc/lib/immap.c
 create mode 100644 include/commproc.h
MAINTAINERS +1 -1
index 85dfa14cac..3505da5648 100644
@@ -325,7 +325,7 @@ S:	Maintained
 F:	arch/powerpc/
 
 POWERPC MPC8XX
-M:	Wolfgang Denk <[email protected]>
+M:	Christophe Leroy <[email protected]>
 S:	Maintained
 T:	git git://git.denx.de/u-boot-mpc8xx.git
 F:	arch/powerpc/cpu/mpc8xx/
README +57 -5

120 lines not on this page · raw message

api/api_platform-powerpc.c +1 -1
index d1b54ea4e1..9e9bc63b2f 100644
@@ -30,7 +30,7 @@ int platform_sys_info(struct sys_info *si)
 	si->clk_bus = gd->bus_clk;
 	si->clk_cpu = gd->cpu_clk;
 
-#if defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
+#if defined(CONFIG_8xx) || defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
 #define bi_bar	bi_immr_base
 #elif defined(CONFIG_MPC83xx)
 #define bi_bar	bi_immrbar
arch/powerpc/Kconfig +6 -0
index c3dba8955d..a7558d59b2 100644
@@ -29,10 +29,16 @@ config MPC86xx
 	select SYS_FSL_DDR
 	select SYS_FSL_DDR_BE
 
+config 8xx
+	bool "MPC8xx"
+
 endchoice
 
+source "arch/powerpc/lib/Kconfig"
+
 source "arch/powerpc/cpu/mpc83xx/Kconfig"
 source "arch/powerpc/cpu/mpc85xx/Kconfig"
 source "arch/powerpc/cpu/mpc86xx/Kconfig"
+source "arch/powerpc/cpu/mpc8xx/Kconfig"
 
 endmenu
arch/powerpc/cpu/mpc8xx/Kconfig new file +13 -0
new file mode 100644
index 0000000000..a425cba8aa
@@ -0,0 +1,13 @@
+menu "mpc8xx CPU"
+	depends on 8xx
+
+config SYS_CPU
+	default "mpc8xx"
+
+choice
+	prompt "Target select"
+	optional
+
+endchoice
+
+endmenu
arch/powerpc/cpu/mpc8xx/Makefile new file +17 -0
new file mode 100644
index 0000000000..5dd801d76e
@@ -0,0 +1,17 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y += start.o
+extra-y += traps.o
+obj-y	+= cpu.o
+obj-y	+= cpu_init.o
+obj-y	+= fec.o
+obj-$(CONFIG_OF_LIBFDT) += fdt.o
+obj-y	+= interrupts.o
+obj-y	+= serial.o
+obj-y	+= speed.o
+obj-y	+= spi.o
arch/powerpc/cpu/mpc8xx/config.mk new file +8 -0
new file mode 100644
index 0000000000..485e43d2de
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2000-2010
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+PLATFORM_CPPFLAGS += -mstring -mcpu=860 -msoft-float
arch/powerpc/cpu/mpc8xx/cpu.c new file +331 -0

331 lines not on this page · raw message

arch/powerpc/cpu/mpc8xx/cpu_init.c new file +180 -0

180 lines not on this page · raw message

arch/powerpc/cpu/mpc8xx/fdt.c new file +27 -0
new file mode 100644
index 0000000000..34d36478d3
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2008 (C) Bryan O'Donoghue
+ *
+ * Code copied & edited from Freescale mpc85xx stuff.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void ft_cpu_setup(void *blob, bd_t *bd)
+{
+	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
+		"timebase-frequency", get_tbclk(), 1);
+	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
+		"bus-frequency", bd->bi_busfreq, 1);
+	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
+		"clock-frequency", bd->bi_intfreq, 1);
+	do_fixup_by_compat_u32(blob, "fsl,cpm-brg", "clock-frequency",
+		gd->arch.brg_clk, 1);
+
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+}
arch/powerpc/cpu/mpc8xx/fec.c new file +847 -0

847 lines not on this page · raw message

arch/powerpc/cpu/mpc8xx/interrupts.c new file +259 -0

259 lines not on this page · raw message

arch/powerpc/cpu/mpc8xx/serial.c new file +301 -0

301 lines not on this page · raw message

arch/powerpc/cpu/mpc8xx/speed.c new file +62 -0

62 lines not on this page · raw message

arch/powerpc/cpu/mpc8xx/spi.c new file +368 -0

368 lines not on this page · raw message

arch/powerpc/cpu/mpc8xx/start.S new file +636 -0

435 lines not on this page · raw message

arch/powerpc/cpu/mpc8xx/traps.c new file +168 -0

168 lines not on this page · raw message

arch/powerpc/include/asm/8xx_immap.h new file +468 -0

468 lines not on this page · raw message

arch/powerpc/include/asm/cache.h +40 -1

41 lines not on this page · raw message

arch/powerpc/include/asm/global_data.h +3 -0
index 1c4a82ca99..35a02b61a4 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/include/asm/iopin_8xx.h new file +379 -0

379 lines not on this page · raw message

arch/powerpc/include/asm/ppc.h +11 -0
index aa6c304d2d..9a8afe1132 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/lib/Kconfig new file +7 -0
new file mode 100644
index 0000000000..7c8ea971c3

Lines of this file are not shown. View the raw message.

arch/powerpc/lib/Makefile +1 -0
index 9a3043abf8..4aa41836a2 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/lib/immap.c new file +397 -0

397 lines not on this page · raw message

arch/powerpc/lib/time.c +11 -0
index 3a5ad4d8d2..4cbb65eb68 100644

Lines of this file are not shown. View the raw message.

cmd/bdinfo.c +1 -1
index 89b73f4fb9..8bf10ee3c1 100644

Lines of this file are not shown. View the raw message.

cmd/reginfo.c +57 -2

59 lines not on this page · raw message

include/asm-generic/u-boot.h +1 -1
index b8f9c7aedb..4d83ffd470 100644

Lines of this file are not shown. View the raw message.

include/commproc.h new file +687 -0

687 lines not on this page · raw message

include/mpc8xx.h +0 -14
index 33a2cd8057..fc081ab756 100644

Lines of this file are not shown. View the raw message.

include/ppc_asm.tmpl +46 -0

46 lines not on this page · raw message

include/watchdog.h +5 -0
index 52f4c506b0..a3a2eeaf1b 100644

Lines of this file are not shown. View the raw message.

scripts/config_whitelist.txt +22 -0
index 95f27b6ead..1a7bc674cc 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.12.0

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH v6 1/1 powerpc: Partialy restore core of mpc8xx

Quoted 77 lines · Christophe Leroy

CS Systemes d'Information (CSSI) manufactures 8xx boards for critical communication systems. Those boards have been running U-Boot since 2010 and will have to be maintained until at least 2027.

commit 5b8e76c35ec312a3f73126bd1a2d2c0965b98a9f ("powerpc, 8xx: remove support for 8xx") orphaned those boards by removing support for the mpc8xx CPU.

This commit partially restores support for the 8xx, with the following limitations:
- Restores support for MPC866 and MPC885 only
- Does not restore IDE, PCMCIA, I2C, USB
- Does not restore examples
- Does not restore POST
- Does not restore Ethernet on SCC
- Does not restore console on SCC
- Does not restore bedbug and kgdb support

As the 866 and 885 do not support the following features, they are not restored either:
- VIDEO / LCD
- RTC clock

The CPM uCODE patch is not restored either, because:
- 866 and 885 already have support for I2C and SPI relocation without a uCODE patch
- relocation of SMC, I2C or SPI is only needed for using SCCs for Ethernet or QMC

The dynamic setup/calculation of clocks is removed, we expect the target being use with the clock and PLPRCR register defined in the configuration.
All the clock settings for 8xx prior to 866 is removed as well as we now only support 866 and 885.

This code is mature and addresses mature boards. Therefore all code enclosed in '#if 0/#endif' and '#if XX_DEBUG/#endif' is unneeded.

The following files are not restored by this patch:

- arch/powerpc/cpu/mpc8xx/bedbug_860.c
- arch/powerpc/cpu/mpc8xx/fec.h
- arch/powerpc/cpu/mpc8xx/kgdb.S
- arch/powerpc/cpu/mpc8xx/plprcr_write.S
- arch/powerpc/cpu/mpc8xx/scc.c
- arch/powerpc/cpu/mpc8xx/upatch.c
- arch/powerpc/cpu/mpc8xx/video.c
- arch/powerpc/include/asm/status_led.h
- arch/powerpc/lib/ide.c
- arch/powerpc/lib/ide.h
- doc/README.MPC866
- drivers/pcmcia/mpc8xx_pcmcia.c
- drivers/rtc/mpc8xx.c
- drivers/usb/gadget/mpc8xx_udc.c
- drivers/video/mpc8xx_lcd.c
- examples/standalone/test_burst.c
- examples/standalone/test_burst.h
- examples/standalone/test_burst_lib.S
- examples/standalone/timer.c
- include/mpc823_lcd.h
- include/usb/mpc8xx_udc.h
- post/cpu/mpc8xx/Makefile
- post/cpu/mpc8xx/cache.c
- post/cpu/mpc8xx/cache_8xx.S
- post/cpu/mpc8xx/ether.c
- post/cpu/mpc8xx/spr.c
- post/cpu/mpc8xx/uart.c
- post/cpu/mpc8xx/usb.c
- post/cpu/mpc8xx/watchdog.c

Some of the restored files are not located in a proper location. In order to keep traceability of the changes, they will be moved to their correct location and moved to Kconfig in a followup patch.

Quoted 6 lines

This patch also declares CSSI as point of contact for the update of the 8xx platform, as those boards are the only ones still being maintained on the 8xx area. A later patch will add those boards to the tree.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170708/5b1456f8/attachment.sig>