Beginning of migration of MPC8xx to DM model
Subsystems (4)
cover Beginning of migration of MPC8xx to DM model
This serie is the beginning of MPC8xx migration to DM model.
Please comment and help me get the good direction.
Christophe Leroy (7):
powercp: mpc8xx: move commproc.h
powerpc: mpc8xx: redistribute data in CPM dpram
board: MCR3000: properly setup initial RAM
board: MCR3000: Activate CONFIG_DM and CONFIG_OF_CONTROL
powerpc: mpc8xx: move watchdog into drivers/watchdog
drivers: watchdog: add a driver for the MPC8xx watchdog
board: MCR3000: use new DM watchdog
arch/powerpc/Kconfig | 2 +- arch/powerpc/cpu/mpc8xx/Kconfig | 4 ++ arch/powerpc/cpu/mpc8xx/cpu.c | 15 +---- arch/powerpc/cpu/mpc8xx/cpu_init.c | 4 +- arch/powerpc/cpu/mpc8xx/immap.c | 2 +- arch/powerpc/cpu/mpc8xx/interrupts.c | 2 +- arch/powerpc/cpu/mpc8xx/start.S | 5 +- arch/powerpc/dts/Makefile | 16 +++++ arch/powerpc/dts/mcr3000.dts | 15 +++++ .../powerpc/include/asm/cpm_8xx.h | 16 ++--- board/cssi/MCR3000/MCR3000.c | 19 ++++++ board/cssi/MCR3000/u-boot.lds | 6 ++ configs/MCR3000_defconfig | 5 ++ drivers/net/mpc8xx_fec.c | 2 +- drivers/serial/serial_mpc8xx.c | 2 +- drivers/spi/mpc8xx_spi.c | 2 +- drivers/watchdog/Kconfig | 6 ++ drivers/watchdog/Makefile | 1 + drivers/watchdog/mpc8xx_wdt.c | 72 ++++++++++++++++++++++ include/configs/MCR3000.h | 8 ++- 20 files changed, 169 insertions(+), 35 deletions(-) create mode 100644 arch/powerpc/dts/Makefile create mode 100644 arch/powerpc/dts/mcr3000.dts rename include/commproc.h => arch/powerpc/include/asm/cpm_8xx.h (99%) create mode 100644 drivers/watchdog/mpc8xx_wdt.c
Signature · 1 line
2.13.3
RFC 1/7 powercp: mpc8xx: move commproc.h
include/commproc.h is dedicated to the 8xx, rename it cpm_8xx.h and move it into arch/powerpc/include/asm
--- arch/powerpc/cpu/mpc8xx/cpu.c | 2 +- arch/powerpc/cpu/mpc8xx/cpu_init.c | 2 +- arch/powerpc/cpu/mpc8xx/immap.c | 2 +- arch/powerpc/cpu/mpc8xx/interrupts.c | 2 +- include/commproc.h => arch/powerpc/include/asm/cpm_8xx.h | 0 drivers/net/mpc8xx_fec.c | 2 +- drivers/serial/serial_mpc8xx.c | 2 +- drivers/spi/mpc8xx_spi.c | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename include/commproc.h => arch/powerpc/include/asm/cpm_8xx.h (100%)
arch/powerpc/cpu/mpc8xx/cpu.c +1 -1
@@ -21,9 +21,9 @@#include <watchdog.h> #include <command.h> #include <mpc8xx.h> -#include <commproc.h> #include <netdev.h> #include <asm/cache.h> +#include <asm/cpm_8xx.h> #include <linux/compiler.h> #include <asm/io.h>
arch/powerpc/cpu/mpc8xx/cpu_init.c +1 -1
@@ -9,7 +9,7 @@#include <watchdog.h> #include <mpc8xx.h> -#include <commproc.h> +#include <asm/cpm_8xx.h> #include <asm/io.h> DECLARE_GLOBAL_DATA_PTR ;
arch/powerpc/cpu/mpc8xx/immap.c +1 -1
@@ -13,7 +13,7 @@#include <command.h> #include <asm/immap_8xx.h> -#include <commproc.h> +#include <asm/cpm_8xx.h> #include <asm/iopin_8xx.h> #include <asm/io.h>
arch/powerpc/cpu/mpc8xx/interrupts.c +1 -1
@@ -8,9 +8,9 @@#include <common.h> #include <mpc8xx.h> #include <mpc8xx_irq.h> +#include <asm/cpm_8xx.h> #include <asm/processor.h> #include <asm/io.h> -#include <commproc.h> /************************************************************************/
arch/powerpc/include/asm/cpm_8xx.h renamed from include/commproc.h +0 -0
drivers/net/mpc8xx_fec.c +1 -1
@@ -7,10 +7,10 @@#include <common.h> #include <command.h> -#include <commproc.h> #include <malloc.h> #include <net.h> #include <netdev.h> +#include <asm/cpm_8xx.h> #include <asm/io.h> #include <phy.h>
drivers/serial/serial_mpc8xx.c +1 -1
@@ -6,10 +6,10 @@*/ #include <common.h> -#include <commproc.h> #include <command.h> #include <serial.h> #include <watchdog.h> +#include <asm/cpm_8xx.h> #include <linux/compiler.h> DECLARE_GLOBAL_DATA_PTR ;
drivers/spi/mpc8xx_spi.c +1 -1
@@ -19,7 +19,7 @@#include <common.h> #include <mpc8xx.h> -#include <commproc.h> +#include <asm/cpm_8xx.h> #include <linux/ctype.h> #include <malloc.h> #include <post.h>
Signature · 1 line
2.13.3
RFC 2/7 powerpc: mpc8xx: redistribute data in CPM dpram
In reply to Christophe LeroySome malloc memory is needed at startup for DM model. Lets reorganise the use of the CPM dpram.
The MPC866/885 dpram, we have 8kbytes dual port RAM, which is usable as:
IMMR + 0x2000..0x2800: BD/Data/Microcode
IMMR + 0x2800..0x2e00: BD/Data
IMMR + 0x2e00..0x3800: BD/Data/Microcode
IMMR + 0x3800..0x3a00: BD/Data
IMMR + 0x3a00..0x3c00: BD/Data/Microcode
IMMR + 0x3c00..0x4000: Parameters for the Peripheral Controllers
Lets reallocate all BDs in the 3800..3a00 area and give the full 2800..2e00 for dynamic RAM allocation including global data
That way, the microcode areas remain available if needed on day
--- arch/powerpc/include/asm/cpm_8xx.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/cpm_8xx.h +8 -8
@@ -51,14 +51,14 @@/* * DPRAM defines and allocation functions */ -#define CPM_SERIAL_BASE 0x0800 -#define CPM_I2C_BASE 0x0820 -#define CPM_SPI_BASE 0x0840 -#define CPM_FEC_BASE 0x0860 -#define CPM_SERIAL2_BASE 0x08E0 -#define CPM_SCC_BASE 0x0900 -#define CPM_POST_BASE 0x0980 -#define CPM_WLKBD_BASE 0x0a00 +#define CPM_SERIAL_BASE 0x1800 +#define CPM_I2C_BASE 0x1820 +#define CPM_SPI_BASE 0x1840 +#define CPM_FEC_BASE 0x1860 +#define CPM_SERIAL2_BASE 0x18e0 +#define CPM_SCC_BASE 0x1900 +#define CPM_POST_BASE 0x1980 +#define CPM_WLKBD_BASE 0x1a00#define BD_IIC_START ((uint) 0x0400)/* <- please use CPM_I2C_BASE !! */
Signature · 1 line
2.13.3
RFC 3/7 board: MCR3000: properly setup initial RAM
In reply to Christophe LeroyIn order to use CONFIG_DM, some initial RAM is needed for malloc()
--- arch/powerpc/cpu/mpc8xx/cpu_init.c | 2 +- arch/powerpc/cpu/mpc8xx/start.S | 5 +++-- include/configs/MCR3000.h | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-)
arch/powerpc/cpu/mpc8xx/cpu_init.c +1 -1
@@ -28,7 +28,7 @@ void cpu_init_f(immap_t __iomem *immr) gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR +CONFIG_SYS_GBL_DATA_OFFSET );/* Clear initial global data */ -memset ((void *)gd,0 ,sizeof (*gd)); +board_init_f_init_reserve ((ulong )gd);/* SYPCR - contains watchdog control (11-9) */
arch/powerpc/cpu/mpc8xx/start.S +3 -2
@@ -130,8 +130,9 @@ in_flash: /* initialize some SPRs that are hard to access from C */ /*----------------------------------------------------------------------*/ - lis r3, CONFIG_SYS_IMMR at h /* pass IMMR as arg1 to C routine */ - ori r1, r3, CONFIG_SYS_INIT_SP_OFFSET /* set up the stack in internal DPRAM */ + /* set up the stack in internal DPRAM */ + lis r3, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)@h + ori r1, r3, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)@l /* Note: R0 is still 0 here */ stwu r0, -4(r1) /* clear final stack frame so that */ stwu r0, -4(r1) /* stack backtraces terminate cleanly */
include/configs/MCR3000.h +4 -3
@@ -70,11 +70,12 @@#define CONFIG_SYS_HZ 1000/* Definitions for initial stack pointer and data area (in DPRAM) */ -#define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_IMMR -#define CONFIG_SYS_INIT_RAM_SIZE 0x2f00 +#define CONFIG_SYS_INIT_RAM_ADDR (CONFIG_SYS_IMMR + 0x2800) +#define CONFIG_SYS_INIT_RAM_SIZE (0x2e00 - 0x2800)#define CONFIG_SYS_GBL_DATA_SIZE 64#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \ - CONFIG_SYS_GBL_DATA_SIZE) + CONFIG_SYS_GBL_DATA_SIZE - \ + CONFIG_SYS_MALLOC_F_LEN)#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET/* RAM configuration (note that CONFIG_SYS_SDRAM_BASE must be zero) */
Signature · 1 line
2.13.3
RFC 4/7 board: MCR3000: Activate CONFIG_DM and CONFIG_OF_CONTROL
In reply to Christophe LeroyAdd mcr3000 device tree and activate CONFIG_DM and CONFIG_OF_CONTROL
--- arch/powerpc/dts/Makefile | 16 ++++++++++++++++ arch/powerpc/dts/mcr3000.dts | 12 ++++++++++++ board/cssi/MCR3000/u-boot.lds | 6 ++++++ configs/MCR3000_defconfig | 3 +++ 4 files changed, 37 insertions(+) create mode 100644 arch/powerpc/dts/Makefile create mode 100644 arch/powerpc/dts/mcr3000.dts
arch/powerpc/dts/Makefile new file +16 -0
@@ -0,0 +1,16 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +dtb-$(CONFIG_MCR3000) += mcr3000.dtb + +targets += $(dtb-y) + +# Add any required device tree compiler flags here +DTC_FLAGS += + +PHONY += dtbs +dtbs: $(addprefix $(obj)/, $(dtb-y)) + @: + +clean-files := *.dtb
arch/powerpc/dts/mcr3000.dts new file +12 -0
@@ -0,0 +1,12 @@ +/* + * MCR3000 Device Tree Source + * + * Copyright 2017 CS Systemes d'Information + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/dts-v1/; + +/ { +};
board/cssi/MCR3000/u-boot.lds +6 -0
@@ -70,6 +70,12 @@ SECTIONS __ex_table : { *(__ex_table) } __stop___ex_table = .; + /* + * _end - This is end of u-boot.bin image. + * dtb will be appended here to make u-boot-dtb.bin + */ + _end = .; + . = ALIGN(4096); __init_begin = .; .text.init : { *(.text.init) }
configs/MCR3000_defconfig +3 -0
@@ -73,3 +73,6 @@ CONFIG_LZMA=y CONFIG_OF_LIBFDT=y CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run flashboot" +CONFIG_DM=y +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="mcr3000"
Signature · 1 line
2.13.3
RFC 5/7 powerpc: mpc8xx: move watchdog into drivers/watchdog
In reply to Christophe LeroyIn preparation of DM watchdog, move basic actions into drivers/watchdog
--- arch/powerpc/Kconfig | 2 +- arch/powerpc/cpu/mpc8xx/Kconfig | 4 ++++ arch/powerpc/cpu/mpc8xx/cpu.c | 13 ------------- drivers/watchdog/Makefile | 1 + drivers/watchdog/mpc8xx_wdt.c | 21 +++++++++++++++++++++ 5 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 drivers/watchdog/mpc8xx_wdt.c
arch/powerpc/Kconfig +1 -1
@@ -34,7 +34,7 @@ config MPC8xx bool "MPC8xx" select BOARD_EARLY_INIT_F imply CMD_REGINFO - imply HW_WATCHDOG + imply MPC8xx_WATCHDOG endchoice
arch/powerpc/cpu/mpc8xx/Kconfig +4 -0
@@ -25,6 +25,10 @@ config MPC885 endchoice +config MPC8xx_WATCHDOG + bool "Watchdog" + select HW_WATCHDOG + config 8xx_GCLK_FREQ int "CPU GCLK Frequency"
arch/powerpc/cpu/mpc8xx/cpu.c +0 -13
@@ -272,19 +272,6 @@ unsigned long get_tbclk(void)/* ------------------------------------------------------------------------- */ -#if defined(CONFIG_HW_WATCHDOG ) -void hw_watchdog_reset (void ) -{ -immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR ; -int re_enable =disable_interrupts (); - -out_be16 (&immr->im_siu_conf.sc_swsr,0x556c );/* write magic1 */ -out_be16 (&immr->im_siu_conf.sc_swsr,0xaa39 );/* write magic2 */ -if (re_enable) -enable_interrupts (); -} -#endif /* CONFIG_WATCHDOG */ -/* * Initializes on-chip ethernet controllers. * to override, implement board_eth_init()
drivers/watchdog/Makefile +1 -0
@@ -22,3 +22,4 @@ obj-$(CONFIG_WDT_ASPEED) += ast_wdt.o obj-$(CONFIG_WDT_BCM6345) += bcm6345_wdt.o obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o obj-$(CONFIG_WDT_ORION) += orion_wdt.o +obj-$(CONFIG_MPC8xx_WATCHDOG) += mpc8xx_wdt.o
drivers/watchdog/mpc8xx_wdt.c new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright 2017 CS Systemes d'Information +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <mpc8xx.h> +#include <asm/cpm_8xx.h> +#include <asm/io.h> + +DECLARE_GLOBAL_DATA_PTR ; + +void hw_watchdog_reset (void ) +{ +immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR ; + +out_be16 (&immap->im_siu_conf.sc_swsr,0x556c );/* write magic1 */ +out_be16 (&immap->im_siu_conf.sc_swsr,0xaa39 );/* write magic2 */ +} +
Signature · 1 line
2.13.3
RFC 6/7 drivers: watchdog: add a driver for the MPC8xx watchdog
In reply to Christophe LeroyThis patch adds a DM driver for the MPC8xx watchdog. Basically, the watchdog is enabled by default from the start and SYPCR register has to be writen once to set the timeout and/or deactivate the watchdog. Once written, it cannot be written again.
It means that wdt_stop() can be called before wdt_start() to stop the watchdog, but cannot be called if wdt_start() has been called.
--- drivers/watchdog/Kconfig | 6 +++++ drivers/watchdog/mpc8xx_wdt.c | 51 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+)
drivers/watchdog/Kconfig +6 -0
@@ -78,4 +78,10 @@ config WDT_ORION Select this to enable Orion watchdog timer, which can be found on some Marvell Armada chips. +config WDT_MPC8xx + bool "MPC8xx watchdog timer support" + depends on WDT && MPC8xx + help + Select this to enable mpc8xx watchdog timer + endmenu
drivers/watchdog/mpc8xx_wdt.c +51 -0
60 lines not on this page · raw message
Signature · 1 line
2.13.3
RFC 7/7 board: MCR3000: use new DM watchdog
In reply to Christophe Leroy--- arch/powerpc/dts/mcr3000.dts | 3 +++ board/cssi/MCR3000/MCR3000.c | 19 +++++++++++++++++++ configs/MCR3000_defconfig | 2 ++ include/configs/MCR3000.h | 1 + 4 files changed, 25 insertions(+)
arch/powerpc/dts/mcr3000.dts +3 -0
@@ -9,4 +9,7 @@ /dts-v1/; / { + WDT: watchdog at 0 { + compatible = "fsl,pq1-wdt"; + }; };
board/cssi/MCR3000/MCR3000.c +19 -0
@@ -13,6 +13,8 @@#include <mpc8xx.h> #include <fdt_support.h> #include <asm/io.h> +#include <dm/uclass.h> +#include <wdt.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -144,3 +146,20 @@ int board_early_init_f(void)return 0 ; } + +int board_early_init_r (void ) +{ +struct udevice *watchdog_dev =NULL ; + +if (uclass_get_device (UCLASS_WDT ,0 , &watchdog_dev)) { +puts ("Cannot find watchdog!\n" ); + }else { +puts ("Enabling watchdog.\n" ); +if (IS_ENABLED (CONFIG_HW_WATCHDOG )) +wdt_start (watchdog_dev,0xffff ,0 ); +else +wdt_stop (watchdog_dev); + } + +return 0 ; +}
configs/MCR3000_defconfig +2 -0
@@ -76,3 +76,5 @@ CONFIG_BOOTCOMMAND="run flashboot" CONFIG_DM=y CONFIG_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="mcr3000" +CONFIG_WDT=y +CONFIG_WDT_MPC8xx=y
include/configs/MCR3000.h +1 -0
@@ -10,6 +10,7 @@/* High Level Configuration Options */ #define CONFIG_MISC_INIT_R 1/* Call misc_init_r */ +#define CONFIG_BOARD_EARLY_INIT_R 1#define CONFIG_EXTRA_ENV_SETTINGS \ "sdram_type=SDRAM\0" \
Signature · 1 line
2.13.3