Powerpc: mpc8xx: cleanup before migration to DM model
Subsystems (5)
v2 cover Powerpc: mpc8xx: cleanup before migration to DM model
The purpose of this serie is to clean the mpc8xx code a bit prior to moving to OF and DM model.
Christophe Leroy (10):
powerpc: mpc8xx: initialisation of global data
board: MCR3000: replace mtd->priv by mtd_to_nand()
board: MCR3000: Increase Monitor size
soft_i2c: cleanup - no mpc8xx support
boards: MCR3000: cleanup config
powerpc: mpc8xx: cleaning up watchdog
powerpc: mpc8xx: get rid of get_immr()
powerpc: mpc8xx: Change CONFIG_8xx to CONFIG_MPC8xx
powerpc: 8xx: get rid of the multiple PVR_ values
powerpc: mpc8xx: refactorise reginfo
api/api_platform-powerpc.c | 2 +-
arch/powerpc/Kconfig | 4 +-
arch/powerpc/cpu/mpc8xx/Kconfig | 2 +-
arch/powerpc/cpu/mpc8xx/Makefile | 1 -
arch/powerpc/cpu/mpc8xx/cpu.c | 27 +++-----
arch/powerpc/cpu/mpc8xx/cpu_init.c | 10 ++-
arch/powerpc/cpu/mpc8xx/immap.c | 22 ++++++-
arch/powerpc/cpu/mpc8xx/reginfo.c | 71 ----------------------
arch/powerpc/cpu/mpc8xx/speed.c | 3 +-
arch/powerpc/include/asm/cache.h | 6 +-
arch/powerpc/include/asm/global_data.h | 2 +-
.../include/asm/{8xx_immap.h => immap_8xx.h} | 0
arch/powerpc/include/asm/iopin_8xx.h | 2 +-
arch/powerpc/include/asm/ppc.h | 12 +---
arch/powerpc/include/asm/processor.h | 6 +-
board/cssi/MCR3000/MCR3000.c | 2 +
board/cssi/MCR3000/nand.c | 2 +-
cmd/bdinfo.c | 2 +-
configs/MCR3000_defconfig | 4 +-
drivers/i2c/soft_i2c.c | 3 -
drivers/net/Kconfig | 2 +-
drivers/serial/Kconfig | 2 +-
drivers/spi/Kconfig | 2 +-
include/asm-generic/u-boot.h | 2 +-
include/commproc.h | 2 +-
include/configs/MCR3000.h | 30 +--------
include/mpc8xx.h | 4 +-
include/ppc_asm.tmpl | 6 +-
include/watchdog.h | 5 --
29 files changed, 71 insertions(+), 167 deletions(-)
delete mode 100644 arch/powerpc/cpu/mpc8xx/reginfo.c
rename arch/powerpc/include/asm/{8xx_immap.h => immap_8xx.h} (100%)Signature · 1 line
2.13.3
PATCH v2 1/10 powerpc: mpc8xx: initialisation of global data
Global data pointer has to be initialised
Global data area has to be zeroised
--- arch/powerpc/cpu/mpc8xx/cpu_init.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/cpu/mpc8xx/cpu_init.c +6 -0
@@ -12,6 +12,8 @@#include <commproc.h> #include <asm/io.h> +DECLARE_GLOBAL_DATA_PTR ; +/* * Breath some life into the CPU... *
@@ -24,6 +26,10 @@ void cpu_init_f(immap_t __iomem *immr)memctl8xx_t __iomem *memctl = &immr->im_memctl;ulong reg; + gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR +CONFIG_SYS_GBL_DATA_OFFSET ); +/* Clear initial global data */ +memset ((void *)gd,0 ,sizeof (*gd)); +/* SYPCR - contains watchdog control (11-9) */ out_be32 (&immr->im_siu_conf.sc_sypcr,CONFIG_SYS_SYPCR );
Signature · 1 line
2.13.3
PATCH v2 2/10 board: MCR3000: replace mtd->priv by mtd_to_nand()
In reply to Christophe LeroySince commit 17cb4b8f327eb ("mtd: nand: Add+use mtd_to/from_nand and nand_get/set_controller_data"), mtd_to_nand() has to be used instead of mtd->priv
--- board/cssi/MCR3000/nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/cssi/MCR3000/nand.c +1 -1
@@ -17,7 +17,7 @@static void nand_hwcontrol (struct mtd_info *mtdinfo,int cmd,unsigned int ctrl) { -struct nand_chip *this = mtdinfo->priv; +struct nand_chip *this =mtd_to_nand (mtdinfo);immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR ;unsigned short pddat =0 ;
Signature · 1 line
2.13.3
PATCH v2 3/10 board: MCR3000: Increase Monitor size
In reply to Christophe LeroyU-boot doesn't fit anymore in a 256kb area, increase it to 320kb
--- include/configs/MCR3000.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/configs/MCR3000.h +3 -3
@@ -25,7 +25,7 @@"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \"mcr3k:eth0:off;" \"${ofl_args}; " \ -"bootm 0x04060000 - 0x04050000\0" \ +"bootm 0x04070000 - 0x04060000\0" \"tftpboot=setenv bootargs " \"${console_args} " \"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
@@ -46,7 +46,7 @@"${console_args} " \"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \"mcr3k:eth0:off;" \ -"bootm 0x04060000 - 0x04050000\0" \ +"bootm 0x04070000 - 0x04060000\0" \"dhcpboot=dhcp ${loadaddr} ${filename};" \"tftp 0xf00000 mcr3000.dtb;" \"setenv bootargs " \
@@ -108,7 +108,7 @@* the maximum mapped by the Linux kernel during initialization. */ #define CONFIG_SYS_BOOTMAPSZ (8 << 20) -#define CONFIG_SYS_MONITOR_LEN (256 << 10) +#define CONFIG_SYS_MONITOR_LEN (320 << 10)#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE#define CONFIG_SYS_MALLOC_LEN (4096 << 10)
Signature · 1 line
2.13.3
PATCH v2 4/10 soft_i2c: cleanup - no mpc8xx support
In reply to Christophe Leroycommit 907208c452999 ("powerpc: Partialy restore core of mpc8xx") didn't bring back support for I2C on the mpc8xx
--- drivers/i2c/soft_i2c.c | 3 --- 1 file changed, 3 deletions(-)
drivers/i2c/soft_i2c.c +0 -3
@@ -25,9 +25,6 @@#include <asm/arch/gpio.h> #endif #endif -#if defined(CONFIG_8xx) -#include <asm/io.h> -#endif #include <i2c.h> #if defined(CONFIG_SOFT_I2C_GPIO_SCL )
Signature · 1 line
2.13.3
PATCH v2 5/10 boards: MCR3000: cleanup config
In reply to Christophe LeroySome config is redundant with Kconfig. Fix it.
Also remove unused configs
Move SDRAM_MAX_SIZE in the only place it is used
--- arch/powerpc/Kconfig | 1 + board/cssi/MCR3000/MCR3000.c | 2 ++ configs/MCR3000_defconfig | 2 ++ include/configs/MCR3000.h | 22 ---------------------- 4 files changed, 5 insertions(+), 22 deletions(-)
arch/powerpc/Kconfig +1 -0
@@ -32,6 +32,7 @@ config MPC86xx config 8xx bool "MPC8xx" + select BOARD_EARLY_INIT_F imply CMD_REGINFO endchoice
board/cssi/MCR3000/MCR3000.c +2 -0
@@ -16,6 +16,8 @@DECLARE_GLOBAL_DATA_PTR ; +#define SDRAM_MAX_SIZE (32 * 1024 * 1024) +static const uint cs1_dram_table_66[] = {/* DRAM - single read. (offset 0 in upm RAM) */ 0x0F3DFC04 ,0x0FEFBC04 ,0x00BE7804 ,0x0FFDF400 ,
configs/MCR3000_defconfig +2 -0
@@ -71,3 +71,5 @@ CONFIG_MPC8XX_FEC=y CONFIG_SHA256=y CONFIG_LZMA=y CONFIG_OF_LIBFDT=y +CONFIG_USE_BOOTCOMMAND=y +CONFIG_BOOTCOMMAND="run flashboot"
include/configs/MCR3000.h +0 -22
@@ -9,7 +9,6 @@#define __CONFIG_H/* High Level Configuration Options */ -#define CONFIG_BOARD_EARLY_INIT_F 1/* Call board_early_init_f */ #define CONFIG_MISC_INIT_R 1/* Call misc_init_r */ #define CONFIG_EXTRA_ENV_SETTINGS \
@@ -55,25 +54,16 @@"${ofl_args}; " \ "bootm ${loadaddr} - 0xf00000\0" -#define CONFIG_BOOTDELAY 5 -#define CONFIG_IPADDR 192.168.0.3#define CONFIG_SERVERIP 192.168.0.1#define CONFIG_NETMASK 255.0.0.0 -#define CONFIG_BOOTCOMMAND "run flashboot" -#define CONFIG_LOADS_ECHO 1/* echo on for serial download */ -#undef CONFIG_LOADS_BAUD_CHANGE/* don't allow baudrate change */ #define CONFIG_WATCHDOG 1/* watchdog enabled */ /* Miscellaneous configurable options */ -#ifdef CONFIG_HUSH_PARSER -#define CONFIG_SYS_PROMPT_HUSH_PS2 "S3K> " -#endif -#define CONFIG_SYS_MEMTEST_START 0x00002000#define CONFIG_SYS_MEMTEST_END 0x00800000
@@ -91,7 +81,6 @@/* RAM configuration (note that CONFIG_SYS_SDRAM_BASE must be zero) */ #define CONFIG_SYS_SDRAM_BASE 0x00000000 -#define SDRAM_MAX_SIZE (32 * 1024 * 1024)/* FLASH organization */ #define CONFIG_SYS_FLASH_BASE CONFIG_SYS_TEXT_BASE
@@ -121,24 +110,13 @@#define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR - CONFIG_SYS_FLASH_BASE)#define CONFIG_ENV_OVERWRITE 1 -/* Cache Configuration */ -#define CONFIG_SYS_CACHELINE_SIZE 16 -/* Ethernet configuration part */ #define CONFIG_SYS_DISCOVER_PHY 1 -#ifdef CONFIG_MPC8XX_FEC #define CONFIG_MII_INIT 1 -#endif /* NAND configuration part */ #define CONFIG_SYS_MAX_NAND_DEVICE 1#define CONFIG_SYS_NAND_MAX_CHIPS 1#define CONFIG_SYS_NAND_BASE 0x0C000000 -/* Internal Definitions */ - -/* Boot Flags*/ -#define BOOTFLAG_COLD 0x01 -#define BOOTFLAG_WARM 0x02 -#endif /* __CONFIG_H */
Signature · 1 line
2.13.3
PATCH v2 6/10 powerpc: mpc8xx: cleaning up watchdog
In reply to Christophe LeroyIn preparation of migration to DM watchdog, clean up a bit.
The 8xx watchdog really is a HW watchdog, so declare it as is then it goes through Kconfig
--- arch/powerpc/Kconfig | 1 + arch/powerpc/cpu/mpc8xx/cpu.c | 20 +++++--------------- arch/powerpc/cpu/mpc8xx/cpu_init.c | 4 +--- include/configs/MCR3000.h | 2 -- include/watchdog.h | 5 ----- 5 files changed, 7 insertions(+), 25 deletions(-)
arch/powerpc/Kconfig +1 -0
@@ -34,6 +34,7 @@ config 8xx bool "MPC8xx" select BOARD_EARLY_INIT_F imply CMD_REGINFO + imply HW_WATCHDOG endchoice
arch/powerpc/cpu/mpc8xx/cpu.c +5 -15
@@ -273,26 +273,16 @@ unsigned long get_tbclk(void)/* ------------------------------------------------------------------------- */ -#if defined(CONFIG_WATCHDOG ) -void watchdog_reset (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 (); -reset_8xx_watchdog ((immap_t __iomem *)CONFIG_SYS_IMMR ); -if (re_enable) -enable_interrupts (); -} -#endif /* CONFIG_WATCHDOG */ - -#if defined(CONFIG_WATCHDOG ) - -void reset_8xx_watchdog (immap_t __iomem *immr) -{ -/* -* All other boards use the MPC8xx Internal Watchdog -*/ 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 */
arch/powerpc/cpu/mpc8xx/cpu_init.c +1 -3
@@ -34,9 +34,7 @@ void cpu_init_f(immap_t __iomem *immr)out_be32 (&immr->im_siu_conf.sc_sypcr,CONFIG_SYS_SYPCR ); -#if defined(CONFIG_WATCHDOG ) -reset_8xx_watchdog (immr); -#endif /* CONFIG_WATCHDOG */ +WATCHDOG_RESET ();/* SIUMCR - contains debug pin configuration (11-6) */ setbits_be32 (&immr->im_siu_conf.sc_siumcr,CONFIG_SYS_SIUMCR );
include/configs/MCR3000.h +0 -2
@@ -60,8 +60,6 @@#define CONFIG_LOADS_ECHO 1/* echo on for serial download */ -#define CONFIG_WATCHDOG 1/* watchdog enabled */ -/* Miscellaneous configurable options */ #define CONFIG_SYS_MEMTEST_START 0x00002000
include/watchdog.h +0 -5
@@ -72,11 +72,6 @@ int init_func_watchdog_reset(void);* Prototypes from $(CPU)/cpu.c. */ -/* MPC 8xx */ -#if defined(CONFIG_8xx) && !defined(__ASSEMBLY__) -void reset_8xx_watchdog (immap_t __iomem *immr); -#endif -#if defined(CONFIG_HW_WATCHDOG ) && !defined(__ASSEMBLY__)void hw_watchdog_init (void );#endif
Signature · 1 line
2.13.3
PATCH v2 7/10 powerpc: mpc8xx: get rid of get_immr()
In reply to Christophe LeroyFunction get_immr() is almost not used and doesn't bring much added value. Just replace it with mfspr(SPRN_IMMR) at the two needed places.
--- arch/powerpc/cpu/mpc8xx/cpu.c | 7 +++---- arch/powerpc/cpu/mpc8xx/reginfo.c | 2 +- arch/powerpc/cpu/mpc8xx/speed.c | 3 +-- arch/powerpc/include/asm/ppc.h | 8 -------- 4 files changed, 5 insertions(+), 15 deletions(-)
arch/powerpc/cpu/mpc8xx/cpu.c +3 -4
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;static int check_CPU (long clock,uint pvr,uint immr) { -immap_t __iomem *immap = (immap_t __iomem *)(immr &0xFFFF0000 ); +immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR ;uint k;char buf[32 ];
@@ -90,7 +90,7 @@ static int check_CPU(long clock, uint pvr, uint immr)int checkcpu (void ) {ulong clock = gd->cpu_clk; -uint immr =get_immr (0 );/* Return full IMMR contents */ +uint immr =mfspr (SPRN_IMMR );/* Return full IMMR contents */ uint pvr =get_pvr ();puts ("CPU: " );
@@ -237,8 +237,7 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])*/ unsigned long get_tbclk (void ) { -uint immr =get_immr (0 );/* Return full IMMR contents */ -immap_t __iomem *immap = (immap_t __iomem *)(immr &0xFFFF0000 ); +immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR ;ulong oscclk, factor, pll;if (in_be32 (&immap->im_clkrst.car_sccr) &SCCR_TBS )
arch/powerpc/cpu/mpc8xx/reginfo.c +1 -1
@@ -22,7 +22,7 @@ void print_reginfo(void)*/ printf ("\nSystem Configuration registers\n" -"\tIMMR\t0x%08X\n" ,get_immr (0 )); +"\tIMMR\t0x%08X\n" ,mfspr (SPRN_IMMR ));printf ("\tSIUMCR\t0x%08X" ,in_be32 (&sysconf->sc_siumcr));printf ("\tSYPCR\t0x%08X\n" ,in_be32 (&sysconf->sc_sypcr));
arch/powerpc/cpu/mpc8xx/speed.c +1 -2
@@ -17,8 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;*/ int get_clocks (void ) { -uint immr =get_immr (0 );/* Return full IMMR contents */ -immap_t __iomem *immap = (immap_t __iomem *)(immr &0xFFFF0000 ); +immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR ;uint sccr =in_be32 (&immap->im_clkrst.car_sccr);uint divider =1 << (((sccr &SCCR_DFBRG11 ) >>11 ) *2 );
arch/powerpc/include/asm/ppc.h +0 -8
@@ -40,14 +40,6 @@#include <asm/processor.h> -#if defined(CONFIG_8xx) -static inline uint get_immr (uint mask) -{ -uint immr =mfspr (SPRN_IMMR ); - -return mask ? (immr & mask) : immr; -} -#endif static inline uint get_pvr (void ) {return mfspr (PVR );
Signature · 1 line
2.13.3
PATCH v2 7/10 powerpc: mpc8xx: get rid of get_immr()
Dear Christophe,
Quoted 3 lines · In message <622b8aec162cc43e774bde5da990a61fc961b4d9.1519976944.git.christophe.…
Function
get_immr()is almost not used and doesn't bring much added value. Just replace it withmfspr(SPRN_IMMR)at the two needed places.
...
Review
Quoted 4 lines
static int
check_CPU(long clock, uint pvr, uint immr){(quoted diff) +1
-1- immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000); + immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
This is a totally unrelated change, which additionally changes the behaviour of the code - the content of the argument "immr" is now not longer used here.
If this is necessary / intentional, it should be a separate commit with proper explanation.
arch/powerpc/cpu/mpc8xx/cpu.c int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 240
Quoted 3 lines
arch/powerpc/cpu/mpc8xx/cpu.c +1
-2-uint immr =get_immr (0 );/* Return full IMMR contents */ -immap_t __iomem *immap = (immap_t __iomem *)(immr &0xFFFF0000 ); +immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR ;
Ditto here.
arch/powerpc/cpu/mpc8xx/cpu.c int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 240
Quoted 3 lines
arch/powerpc/cpu/mpc8xx/cpu.c +1
-2-uint immr =get_immr (0 );/* Return full IMMR contents */ -immap_t __iomem *immap = (immap_t __iomem *)(immr &0xFFFF0000 ); +immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR ;
And here again.
arch/powerpc/include/asm/ppc.h line 50
Quoted 8 lines
arch/powerpc/include/asm/ppc.h +0
-8-#if defined(CONFIG_8xx) -static inline uint get_immr (uint mask) -{ -uint immr =mfspr (SPRN_IMMR ); - -return mask ? (immr & mask) : immr; -} -#endif
Actually, I do not see what you win by this "cleanup". In my opinion the function serves a good purpose; your code just becomes more difficult to understand.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de About the use of language: it is impossible to sharpen a pencil with a blunt ax. It is equally vain to try to do it with ten blunt axes instead. -- Edsger Dijkstra
PATCH v2 7/10 powerpc: mpc8xx: get rid of get_immr()
Le 03/03/2018 à 17:46, Wolfgang Denk a écrit :
Quoted 7 lines
Dear Christophe,
Quoted 3 lines · In message <622b8aec162cc43e774bde5da990a61fc961b4d9.1519976944.git.christophe.…
Function
get_immr()is almost not used and doesn't bring much added value. Just replace it withmfspr(SPRN_IMMR)at the two needed places....
Quoted 8 lines
Review
Quoted 4 lines
static int
check_CPU(long clock, uint pvr, uint immr){(quoted diff) +1
-1- immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000); + immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;This is a totally unrelated change, which additionally changes the behaviour of the code - the content of the argument "immr" is now not longer used here.
In many other places (eg. checkdcache(), do_reset(), etc.), immap is defined as this. Why not doing the same everywhere ?
The lower part of immr is still used later in the function.
Quoted 3 lines
If this is necessary / intentional, it should be a separate commit with proper explanation.
Ok
Quoted 14 lines
arch/powerpc/cpu/mpc8xx/cpu.c int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 240
Quoted 5 lines
arch/powerpc/cpu/mpc8xx/cpu.c +1
-2-uint immr =get_immr (0 );/* Return full IMMR contents */ -immap_t __iomem *immap = (immap_t __iomem *)(immr &0xFFFF0000 ); +immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR ;Ditto here.
arch/powerpc/cpu/mpc8xx/cpu.c int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 240
Quoted 3 lines
arch/powerpc/cpu/mpc8xx/cpu.c +1
-2-uint immr =get_immr (0 );/* Return full IMMR contents */ -immap_t __iomem *immap = (immap_t __iomem *)(immr &0xFFFF0000 ); +immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR ;And here again.
Quoted 12 lines
arch/powerpc/include/asm/ppc.h line 50
Quoted 8 lines
arch/powerpc/include/asm/ppc.h +0
-8-#if defined(CONFIG_8xx) -static inline uint get_immr (uint mask) -{ -uint immr =mfspr (SPRN_IMMR ); - -return mask ? (immr & mask) : immr; -} -#endif Actually, I do not see what you win by this "cleanup". In my opinion the function serves a good purpose; your code just becomes more difficult to understand.
The main idea was to get rid of as much as possible specific 8xx stuff in common header files.
Since SPRN_IMMR is defined regardless of the subarch, maybe I should have just remove the #ifdef around get_immr()
Regarding the understandability of the code, I thought it would be clearer to define immap the same way in all functions.
immr being set with CONFIG_SYS_IMMR early in start.S, and not changing anywhere after that, I don't see any point in reading it from SPRN_IMMR everytime we need it, especially as many other functions already set it from CONFIG_SYS_IMMR. 83xx, 86xx etc... do set immap ptr from CONFIG_SYS_IMMR too.
Regards
Christophe
Quoted 5 lines
Best regards,
Wolfgang Denk
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
PATCH v2 7/10 powerpc: mpc8xx: get rid of get_immr()
Dear Christophe,
Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 7 lines
Review
Quoted 3 lines
(quoted diff) +1
-1- immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000); + immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;This is a totally unrelated change, which additionally changes the behaviour of the code - the content of the argument "immr" is now not longer used here.
In many other places (eg.
checkdcache(),do_reset(), etc.), immap is defined as this. Why not doing the same everywhere ?
Firwt, it is an unrelated and undocumented change - you don't mention it in the commit message. This _must_ be fixed. Actually I think this should be a separate patch, both for documentation and bisectability.
The other question is if there really is a guarantee that IMMR ist set to the value of CONFIG_SYS_IMMR. If that was the case, the whole code would make little sense, and I don't think it was written like that just for fun. So please double-check.
Quoted 1 line
The lower part of immr is still used later in the function.
Now if that is the case,, then your modification makes even less sense. If we need the value anyway, why implement two different sources of information? This looks bogus to me.
Quoted 2 lines
Since
SPRN_IMMRis defined regardless of the subarch, maybe I should have just remove the #ifdef aroundget_immr()
Indeed that would make more sense, IMO.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Ninety-Ninety Rule of Project Schedules:
The first ninety percent of the task takes ninety percent of
the time, and the last ten percent takes the other ninety percent.PATCH v2 7/10 powerpc: mpc8xx: get rid of get_immr()
Le 04/03/2018 à 15:51, Wolfgang Denk a écrit :
Quoted 11 lines
Dear Christophe,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 7 lines
Review
Quoted 3 lines
(quoted diff) +1
-1- immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000); + immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;This is a totally unrelated change, which additionally changes the behaviour of the code - the content of the argument "immr" is now not longer used here.
Quoted 7 lines
Quoted 2 lines
In many other places (eg.
checkdcache(),do_reset(), etc.), immap is defined as this. Why not doing the same everywhere ?Firwt, it is an unrelated and undocumented change - you don't mention it in the commit message. This _must_ be fixed. Actually I think this should be a separate patch, both for documentation and bisectability.
I agree, my mistake.
Quoted 5 lines
The other question is if there really is a guarantee that IMMR ist set to the value of
CONFIG_SYS_IMMR. If that was the case, the whole code would make little sense, and I don't think it was written like that just for fun. So please double-check.
In start.S:
.globl _start_start:
lis r3, CONFIG_SYS_IMMR at h /* position IMMR */ mtspr 638, r3
In many fonctions, you have (in the same file cpu.c):
int checkicache(void)
{
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;int checkdcache(void)
{
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;void upmconfig(uint upm, uint *table, uint size)
{
uint i;
uint addr = 0;
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
ulong msr, addr;
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;In other files too (eg: 5 times in immap.c, 7 times in interrupts.c, 6 times in mpc8xx_fec.c , etc.)
Quoted 6 lines
Quoted 2 lines
The lower part of immr is still used later in the function.
Now if that is the case,, then your modification makes even less sense. If we need the value anyway, why implement two different sources of information? This looks bogus to me.
What makes little sense to me is to define the immap pointer differently in three places, allthough it is equivalent.
It is not the same information we need later in the function. What this function (and only this one) needs in addition is the lower part of SPRN_IMMR while the immap pointer is the higher part of SPRN_IMMR (that we set earlier in start.S)
Quoted 5 lines
Quoted 3 lines
Since
SPRN_IMMRis defined regardless of the subarch, maybe I should have just remove the #ifdef aroundget_immr()Indeed that would make more sense, IMO.
I'll do that, and eventually make another patch for unifying the way the immap pointer is set.
Best regards
Christophe
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
PATCH v2 8/10 powerpc: mpc8xx: Change CONFIG_8xx to CONFIG_MPC8xx
In reply to Christophe LeroyCONFIG_8xx doesn't mean much outside of arch/powerpc/ This patch renames it CONFIG_MPC8xx just like CONFIG_MPC85xx etc ... It also renames 8xx_immap.h to immap_8xx.h to be consistent with other file names.
---
api/api_platform-powerpc.c | 2 +-
arch/powerpc/Kconfig | 2 +-
arch/powerpc/cpu/mpc8xx/Kconfig | 2 +-
arch/powerpc/cpu/mpc8xx/immap.c | 2 +-
arch/powerpc/include/asm/cache.h | 6 +++---
arch/powerpc/include/asm/global_data.h | 2 +-
arch/powerpc/include/asm/{8xx_immap.h => immap_8xx.h} | 0
arch/powerpc/include/asm/iopin_8xx.h | 2 +-
arch/powerpc/include/asm/ppc.h | 4 ++--
cmd/bdinfo.c | 2 +-
configs/MCR3000_defconfig | 2 +-
drivers/net/Kconfig | 2 +-
drivers/serial/Kconfig | 2 +-
drivers/spi/Kconfig | 2 +-
include/asm-generic/u-boot.h | 2 +-
include/commproc.h | 2 +-
include/mpc8xx.h | 4 ++--
include/ppc_asm.tmpl | 6 +++---
18 files changed, 23 insertions(+), 23 deletions(-)
rename arch/powerpc/include/asm/{8xx_immap.h => immap_8xx.h} (100%)api/api_platform-powerpc.c +1 -1
@@ -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_8xx) || defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx) +#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx)#define bi_bar bi_immr_base#elif defined(CONFIG_MPC83xx)#define bi_bar bi_immrbar
arch/powerpc/Kconfig +1 -1
@@ -30,7 +30,7 @@ config MPC86xx select SYS_FSL_DDR_BE imply CMD_REGINFO -config 8xx +config MPC8xx bool "MPC8xx" select BOARD_EARLY_INIT_F imply CMD_REGINFO
arch/powerpc/cpu/mpc8xx/Kconfig +1 -1
@@ -1,5 +1,5 @@ menu "mpc8xx CPU" - depends on 8xx + depends on MPC8xx config SYS_CPU default "mpc8xx"
arch/powerpc/cpu/mpc8xx/immap.c +1 -1
@@ -12,7 +12,7 @@#include <common.h> #include <command.h> -#include <asm/8xx_immap.h> +#include <asm/immap_8xx.h> #include <commproc.h> #include <asm/iopin_8xx.h> #include <asm/io.h>
arch/powerpc/include/asm/cache.h +3 -3
@@ -7,7 +7,7 @@#include <asm/processor.h> /* bytes per L1 cache line */ -#if defined(CONFIG_8xx) +#if defined(CONFIG_MPC8xx)#define L1_CACHE_SHIFT 4#elif defined(CONFIG_PPC64BRIDGE )#define L1_CACHE_SHIFT 7
@@ -72,7 +72,7 @@ void disable_cpc_sram(void);#define L2CACHE_NONE 0x03/* NONE */ #define L2CACHE_PARITY 0x08/* Mask for L2 Cache Parity Protected bit */ -#ifdef CONFIG_8xx +#ifdef CONFIG_MPC8xx/* Cache control on the MPC8xx is provided through some additional * special purpose registers. */
@@ -139,6 +139,6 @@ static inline void wr_dc_adr(uint val)mtspr (DC_ADR , val); }#endif -#endif /* CONFIG_8xx */ +#endif /* CONFIG_MPC8xx */ #endif
arch/powerpc/include/asm/global_data.h +1 -1
@@ -19,7 +19,7 @@ struct arch_global_data {u8 sdhc_adapter;#endif #endif -#if defined(CONFIG_8xx) +#if defined(CONFIG_MPC8xx)unsigned long brg_clk;#endif #if defined(CONFIG_CPM2 )
arch/powerpc/include/asm/immap_8xx.h renamed from arch/powerpc/include/asm/8xx_immap.h +0 -0
arch/powerpc/include/asm/iopin_8xx.h +1 -1
@@ -11,7 +11,7 @@#define _ASM_IOPIN_8XX_H_#include <linux/types.h> -#include <asm/8xx_immap.h> +#include <asm/immap_8xx.h> #include <asm/io.h> #ifdef __KERNEL__
arch/powerpc/include/asm/ppc.h +2 -2
@@ -13,8 +13,8 @@#ifndef __ASSEMBLY__ -#if defined(CONFIG_8xx) -#include <asm/8xx_immap.h> +#if defined(CONFIG_MPC8xx) +#include <asm/immap_8xx.h> #endif #ifdef CONFIG_MPC86xx#include <mpc86xx.h>
cmd/bdinfo.c +1 -1
@@ -180,7 +180,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_bi_flash (bd);print_num ("sramstart" , bd->bi_sramstart);print_num ("sramsize" , bd->bi_sramsize); -#if defined(CONFIG_8xx) || defined(CONFIG_E500 ) +#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500 )print_num ("immr_base" , bd->bi_immr_base);#endif print_num ("bootflags" , bd->bi_bootflags);
configs/MCR3000_defconfig +1 -1
@@ -1,6 +1,6 @@ CONFIG_PPC=y CONFIG_SYS_TEXT_BASE=0x4000000 -CONFIG_8xx=y +CONFIG_MPC8xx=y CONFIG_TARGET_MCR3000=y CONFIG_8xx_GCLK_FREQ=132000000 CONFIG_CMD_IMMAP=y
drivers/net/Kconfig +1 -1
@@ -330,7 +330,7 @@ config RENESAS_RAVB config MPC8XX_FEC bool "Fast Ethernet Controller on MPC8XX" - depends on 8xx + depends on MPC8xx select MII help This driver implements support for the Fast Ethernet Controller
drivers/serial/Kconfig +1 -1
@@ -592,7 +592,7 @@ config ZYNQ_SERIAL config MPC8XX_CONS bool "Console driver for MPC8XX" - depends on 8xx + depends on MPC8xx default y choice
drivers/spi/Kconfig +1 -1
@@ -276,7 +276,7 @@ config LPC32XX_SSP config MPC8XX_SPI bool "MPC8XX SPI Driver" - depends on 8xx + depends on MPC8xx help Enable support for SPI on MPC8XX
include/asm-generic/u-boot.h +1 -1
@@ -37,7 +37,7 @@ typedef struct bd_info {unsigned long bi_dsp_freq;/* dsp core frequency */ unsigned long bi_ddr_freq;/* ddr frequency */ #endif -#if defined(CONFIG_8xx) || defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx) +#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx)unsigned long bi_immr_base;/* base of IMMR register */ #endif #if defined(CONFIG_M68K )
include/commproc.h +1 -1
@@ -16,7 +16,7 @@#ifndef __CPM_8XX__#define __CPM_8XX__ -#include <asm/8xx_immap.h> +#include <asm/immap_8xx.h> /* CPM Command register. */
include/mpc8xx.h +2 -2
@@ -81,7 +81,7 @@#define TBSCR_TBIRQ2 0x0400/* Time Base Interrupt Request 2 */ #define TBSCR_TBIRQ1 0x0200/* Time Base Interrupt Request 1 */ #define TBSCR_TBIRQ0 0x0100/* Time Base Interrupt Request 0 */ -#if 0 /* already in asm/8xx_immap.h */ +#if 0 /* already in asm/immap_8xx.h */ #define TBSCR_REFA 0x0080/* Reference Interrupt Status A */ #define TBSCR_REFB 0x0040/* Reference Interrupt Status B */ #define TBSCR_REFAE 0x0008/* Second Interrupt Enable A */
@@ -95,7 +95,7 @@*/ #undef PISCR_PIRQ/* TBD */ #define PISCR_PITF 0x0002/* Periodic Interrupt Timer Freeze */ -#if 0 /* already in asm/8xx_immap.h */ +#if 0 /* already in asm/immap_8xx.h */ #define PISCR_PS 0x0080/* Periodic interrupt Status */ #define PISCR_PIE 0x0004/* Periodic Interrupt Enable */ #define PISCR_PTE 0x0001/* Periodic Timer Enable */
include/ppc_asm.tmpl +3 -3
@@ -81,7 +81,7 @@ #define r30 30 #define r31 31 -#if defined(CONFIG_8xx) +#if defined(CONFIG_MPC8xx) /* Some special registers */
@@ -93,10 +93,10 @@ #define LCTRL2 157 /* Load/Store Support (37-41) */ #define ICTRL 158 -#endif /* CONFIG_8xx */ +#endif /* CONFIG_MPC8xx */ -#if defined(CONFIG_8xx) +#if defined(CONFIG_MPC8xx) /* Registers in the processor's internal memory map that we use. */
Signature · 1 line
2.13.3
PATCH v2 9/10 powerpc: 8xx: get rid of the multiple PVR_ values
In reply to Christophe LeroyNone of those values are used at the time being.
Just keep one and call it PVR_8xx
--- arch/powerpc/include/asm/processor.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/processor.h +2 -4
@@ -973,10 +973,8 @@* differentiated by the version number in the Communication Processor * Module (CPM). */ -#define PVR_821 0x00500000 -#define PVR_823 PVR_821 -#define PVR_850 PVR_821 -#define PVR_860 PVR_821 +#define PVR_8xx 0x00500000 +#define PVR_7400 0x000C0000/*
Signature · 1 line
2.13.3
PATCH v2 10/10 powerpc: mpc8xx: refactorise reginfo
In reply to Christophe Leroyreginfo is redundant with some of the commands in immap.c, so move reginfo into that file and remove duplicated info.
--- arch/powerpc/cpu/mpc8xx/Makefile | 1 - arch/powerpc/cpu/mpc8xx/immap.c | 20 +++++++++++ arch/powerpc/cpu/mpc8xx/reginfo.c | 71 --------------------------------------- 3 files changed, 20 insertions(+), 72 deletions(-) delete mode 100644 arch/powerpc/cpu/mpc8xx/reginfo.c
arch/powerpc/cpu/mpc8xx/Makefile +0 -1
@@ -12,6 +12,5 @@ obj-y += cpu_init.o obj-$(CONFIG_OF_LIBFDT) += fdt.o obj-$(CONFIG_CMD_IMMAP) += immap.o obj-y += interrupts.o -obj-$(CONFIG_CMD_REGINFO) += reginfo.o obj-y += speed.o obj-y += cache.o
arch/powerpc/cpu/mpc8xx/immap.c +20 -0
@@ -342,6 +342,26 @@ static int do_brginfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])return 0 ; } +#ifdef CONFIG_CMD_REGINFO +void print_reginfo (void ) +{ +immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR ; +sit8xx_t __iomem *timers = &immap->im_sit; + +printf ("\nSystem Configuration registers\n" +"\tIMMR\t0x%08X\n" ,mfspr (SPRN_IMMR )); +do_siuinfo (NULL ,0 ,0 ,NULL ); + +printf ("Memory Controller Registers\n" ); +do_memcinfo (NULL ,0 ,0 ,NULL ); + +printf ("\nSystem Integration Timers\n" ); +printf ("\tTBSCR\t0x%04X\tRTCSC\t0x%04X\n" , +in_be16 (&timers->sit_tbscr),in_be16 (&timers->sit_rtcsc)); +printf ("\tPISCR\t0x%04X\n" ,in_be16 (&timers->sit_piscr)); +} +#endif +/***************************************************/ U_BOOT_CMD(
arch/powerpc/cpu/mpc8xx/reginfo.c deleted +0 -71
71 lines not on this page · raw message
Signature · 1 line
2.13.3