mpc85xx: Add support for the supplement configuration unit register
PATCH v2 1/2 mpc85xx: Add support for the supplement configuration unit register
From: Tang Yuantian <[email protected]>
The supplement configuration unit (SCFG) provides chip-specific configuration and status registers for the device. It is the chip defined module for extending the device configuration unit (DCFG) module. It provides a set of CCSR registers in addition to those available in the device configuration unit.
The base address for this unit is 0x0F_C000.
---
v2:
- no change
arch/powerpc/include/asm/immap_85xx.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/powerpc/include/asm/immap_85xx.h +22 -0
@@ -3124,4 +3124,26 @@ struct dcsr_dcfg_regs {#define DCSR_DCFG_ECC_DISABLE_USB2 0x00004000 u8 res_524[0x1000 - 0x524]; /* 0x524 - 0x1000 */ }; + +#define CONFIG_SYS_MPC85xx_SCFG \ + (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_SCFG_OFFSET) +#define CONFIG_SYS_MPC85xx_SCFG_OFFSET 0xfc000 +/* The supplement configuration unit register */ +struct ccsr_scfg { +u32 dpslpcr;/* 0x000 Deep Sleep Control register */ +u32 usb1dpslpcsr;/* 0x004 USB1 Deep Sleep Control Status register */ +u32 usb2dpslpcsr;/* 0x008 USB2 Deep Sleep Control Status register */ +u32 fmclkdpslpcr;/* 0x00c FM Clock Deep Sleep Control register */ +u32 res1[4 ]; +u32 esgmiiselcr;/* 0x020 Ethernet Switch SGMII Select Control register */ +u32 res2; +u32 pixclkcr;/* 0x028 Pixel Clock Control register */ +u32 res3[245 ]; +u32 qeioclkcr;/* 0x400 QUICC Engine IO Clock Control register */ +u32 emiiocr;/* 0x404 EMI MDIO Control Register */ +u32 sdhciovselcr;/* 0x408 SDHC IO VSEL Control register */ +u32 qmifrstcr;/* 0x40c QMAN Interface Reset Control register */ +u32 res4[60 ]; +u32 sparecr[8 ];/* 0x500 Spare Control register(0-7) */ +};#endif /*__IMMAP_85xx__*/
Signature · 1 line
1.8.5
PATCH v2 2/2 mpc85xx/t104x: Add deep sleep framework support
From: Tang Yuantian <[email protected]>
When T104x soc wakes up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
---
v2:
- added explaination for CONFIG_DEEP_SLEEP
- fixed some issues
README | 4 +++ arch/powerpc/cpu/mpc85xx/asm-offsets.c | 24 ++++++++++++++ arch/powerpc/cpu/mpc85xx/cpu_init.c | 7 +++++ arch/powerpc/cpu/mpc85xx/fdt.c | 25 +++++++++++++++ arch/powerpc/cpu/mpc85xx/liodn.c | 27 +++++++++++----- arch/powerpc/cpu/mpc85xx/start.S | 12 +++++++ arch/powerpc/include/asm/global_data.h | 2 ++ arch/powerpc/lib/board.c | 57 +++++++++++++++++++++++++++++++--- drivers/ddr/fsl/mpc85xx_ddr_gen3.c | 42 ++++++++++++++++++++++--- include/fsl_ddr_sdram.h | 6 ++++ 10 files changed, 190 insertions(+), 16 deletions(-) create mode 100644 arch/powerpc/cpu/mpc85xx/asm-offsets.c
README +4 -0
@@ -427,6 +427,10 @@ The following options need to be configured: In this mode, a single differential clock is used to supply clocks to the sysclock, ddrclock and usbclock. + CONFIG_DEEP_SLEEP + Inidcates this SoC supports deep sleep feature. If deep sleep is + supported, core will start to execute uboot when wakes up. + - Generic CPU options: CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN
arch/powerpc/cpu/mpc85xx/asm-offsets.c new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Adapted from Linux v2.6.36 kernel: arch/powerpc/kernel/asm-offsets.c +* +* This program is used to generate definitions needed by +* assembly language modules. +* +* We use the technique used in the OSF Mach kernel code: +* generate asm statements containing #defines, +* compile this file to assembler, and then extract the +* #defines from the assembly-language output. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> + +#include <linux/kbuild.h> + +int main (void ) +{ +DEFINE (GD_FLAGS_OFF , offsetof(struct global_data , flags)); + +return 0 ; +}
arch/powerpc/cpu/mpc85xx/cpu_init.c +7 -0
@@ -231,6 +231,7 @@ void cpu_init_f (void)#ifdef CONFIG_MPC8548 ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);uint svr =get_svr (); + gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR +CONFIG_SYS_GBL_DATA_OFFSET );/* * CPU2 errata workaround: A core hang possible while executing
@@ -282,6 +283,12 @@ void cpu_init_f (void)in_be32 (&gur->dcsrcr);#endif +#ifdef CONFIG_DEEP_SLEEP +/* disable the console if boot from deep sleep */ +if (in_be32 (&gur->scrtsr[0 ]) & (1 <<3 )) + gd->flags |=GD_FLG_SILENT | +GD_FLG_DEEP_SLEEP |GD_FLG_DISABLE_CONSOLE ; +#endif }/* Implement a dummy function for those platforms w/o SERDES */
arch/powerpc/cpu/mpc85xx/fdt.c +25 -0
@@ -24,6 +24,7 @@ DECLARE_GLOBAL_DATA_PTR;extern void ft_qe_setup (void *blob);extern void ft_fixup_num_cores (void *blob);extern void ft_srio_setup (void *blob); +extern ulong __bss_end;#ifdef CONFIG_MP #include "mp.h"
@@ -35,6 +36,9 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)u32 bootpg =determine_mp_bootpg (NULL );u32 id =get_my_id ();const char *enable_method; +#ifdef CONFIG_DEEP_SLEEP +ulong len; +#endif off =fdt_node_offset_by_prop_value (blob,-1 ,"device_type" ,"cpu" ,4 );while (off != -FDT_ERR_NOTFOUND ) {
@@ -77,6 +81,25 @@ void ft_fixup_cpu(void *blob, u64 memory_limit) "device_type", "cpu", 4); } +#ifdef CONFIG_DEEP_SLEEP +/* +* reserve the memory space for deep sleep. +* This space will be re-used next time when boot from deep sleep. +* The space includes bd_t, gd_t, stack and uboot image. +* Reserve 1K for stack. +*/ + len =sizeof (bd_t) +sizeof (gd_t) + (1 <<10 ); +/* round up to 4K */ + len = (len + (4096 -1 )) & ~(4096 -1 ); + + off =fdt_add_mem_rsv (blob, gd->relocaddr - len, + len + ((ulong )&__bss_end - gd->relocaddr)); +if (off <0 ) +printf ("Failed to reserve memory for deep sleep: %s\n" , +fdt_strerror (off)); + +#endif +/* Reserve the boot page so OSes dont use it */ if ((u64 )bootpg < memory_limit) { off =fdt_add_mem_rsv (blob, bootpg, (u64 )4096 );
@@ -100,6 +123,7 @@ void ft_fixup_cpu(void *blob, u64 memory_limit) }#endif +#ifndef CONFIG_DEEP_SLEEP /* Reserve spin table page */ if (spin_tbl_addr < memory_limit) { off = fdt_add_mem_rsv(blob,
@@ -108,6 +132,7 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)printf ("Failed to reserve memory for spin table: %s\n" ,fdt_strerror (off)); } +#endif }#endif
arch/powerpc/cpu/mpc85xx/liodn.c +20 -7
@@ -14,6 +14,8 @@#include <asm/fsl_portals.h> #include <asm/fsl_liodn.h> +DECLARE_GLOBAL_DATA_PTR ; +int get_dpaa_liodn (enum fsl_dpaa_dev dpaa_dev,u32 *liodns,int liodn_offset) { liodns[0 ] = liodn_bases[dpaa_dev].id[0 ] + liodn_offset;
@@ -164,6 +166,8 @@ static void setup_rman_liodn_base(struct liodn_id_table *tbl, int size)void set_liodns (void ) { +bool is_deepsleep = false; +/* setup general liodn offsets */ set_liodn (liodn_tbl, liodn_tbl_sz);
@@ -179,16 +183,25 @@ void set_liodns(void) }/* setup FMAN block(s) liodn bases & offsets if we have one */ +#ifdef CONFIG_DEEP_SLEEP +if (gd->flags &GD_FLG_DEEP_SLEEP ) + is_deepsleep = true; +#endif +#ifdef CONFIG_SYS_DPAA_FMAN -set_liodn (fman1_liodn_tbl, fman1_liodn_tbl_sz); -setup_fman_liodn_base (FSL_HW_PORTAL_FMAN1 , fman1_liodn_tbl, - fman1_liodn_tbl_sz); +if (!is_deepsleep) { +set_liodn (fman1_liodn_tbl, fman1_liodn_tbl_sz); +setup_fman_liodn_base (FSL_HW_PORTAL_FMAN1 , fman1_liodn_tbl, + fman1_liodn_tbl_sz); + } +#endif #if (CONFIG_SYS_NUM_FMAN ==2 ) -set_liodn (fman2_liodn_tbl, fman2_liodn_tbl_sz); -setup_fman_liodn_base (FSL_HW_PORTAL_FMAN2 , fman2_liodn_tbl, - fman2_liodn_tbl_sz); -#endif +if (!is_deepsleep) { +set_liodn (fman2_liodn_tbl, fman2_liodn_tbl_sz); +setup_fman_liodn_base (FSL_HW_PORTAL_FMAN2 , fman2_liodn_tbl, + fman2_liodn_tbl_sz); + }#endif /* setup PME liodn base */ setup_pme_liodn_base ();
arch/powerpc/cpu/mpc85xx/start.S +12 -0
@@ -23,6 +23,8 @@ #include <asm/cache.h> #include <asm/mmu.h> +#include <generated/asm-offsets.h> + #undef MSR_KERNEL #define MSR_KERNEL ( MSR_ME ) /* Machine Check */
@@ -1669,6 +1671,16 @@ relocate_code: * Now relocate code */ +#ifdef CONFIG_DEEP_SLEEP + /* don't copy uboot again in deep sleep case */ + mr r0, r3 + lwz r3, GD_FLAGS_OFF(r9) + andis. r3, r3, 1 + cmpwi r3, 0 + bne 7f + mr r3, r0 +#endif + cmplw cr1,r3,r4 addi r0,r5,3 srwi. r0,r0,2
arch/powerpc/include/asm/global_data.h +2 -0
@@ -117,6 +117,8 @@ struct arch_global_data {#include <asm-generic/global_data.h> #if 1 +/* Indicates the deep sleep case */ +#define GD_FLG_DEEP_SLEEP 0x10000#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")#else /* We could use plain global data, but the resulting code is bigger */ #define XTRN_DECLARE_GLOBAL_DATA_PTR extern
arch/powerpc/lib/board.c +52 -5
94 lines not on this page · raw message
drivers/ddr/fsl/mpc85xx_ddr_gen3.c +38 -4
71 lines not on this page · raw message
include/fsl_ddr_sdram.h +6 -0
@@ -357,6 +357,12 @@ static int __board_need_mem_reset(void)int board_need_mem_reset (void ) __attribute__((weak,alias ("__board_need_mem_reset" ))); +static void __board_mem_sleep_setup (void ) +{ +} +void board_mem_sleep_setup (void ) + __attribute__((weak,alias ("__board_mem_sleep_setup" ))); +/* * The 85xx boards have a common prototype for fixed_sdram so put the * declaration here.
Signature · 1 line
1.8.5
PATCH v2 2/2 mpc85xx/t104x: Add deep sleep framework support
Quoted 7 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <[email protected]>
When T104x soc wakes up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Quoted 8 lines
Signed-off-by Tang Yuantian <[email protected]>---
v2:
- added explaination forCONFIG_DEEP_SLEEP
- fixed some issuesREADME | 4 +++ arch/powerpc/cpu/mpc85xx/asm-offsets.c | 24 ++++++++++++++
Please fix the out-of-tree compiling issue. You will see it if you run make with O=<path> parameter.
York
PATCH v2 2/2 mpc85xx/t104x: Add deep sleep framework support
Quoted 23 lines
-----Original Message-----
From: Sun York-R58495
Sent: Tuesday, March 11, 2014 1:45 AM
To: Tang Yuantian-B29983
Cc: u-boot at lists.denx.de; Li Yang-Leo-R58472; Jin Zhengxiong-R64188; Wood Scott-B07421
Subject: Re: [PATCH 2/2 v2] mpc85xx/t104x: Add deep sleep framework supportQuoted 13 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <[email protected]>
When T104x soc wakes up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Signed-off-by Tang Yuantian <[email protected]>---
v2:
- added explaination forCONFIG_DEEP_SLEEP
- fixed some issues
Quoted 7 lines
Quoted 2 lines
README | 4 +++ arch/powerpc/cpu/mpc85xx/asm-offsets.c | 24 ++++++++++++++Please fix the out-of-tree compiling issue. You will see it if you run make with O=<path> parameter.
York
Could you be more specific? What *path* should I give? If I do the below, I got error:
$ make O=/home/tangyt/opensource/u-boot/ /home/tangyt/opensource/u-boot is not clean, please run 'make mrproper' in the '/home/tangyt/opensource/u-boot' directory. make[1]: *** [prepare3] Error 1 make: *** [sub-make] Error 2
Thanks,
Yuantian
PATCH v2 2/2 mpc85xx/t104x: Add deep sleep framework support
Quoted 29 lines · Yuantian Tang
Quoted 23 lines
-----Original Message-----
From: Sun York-R58495
Sent: Tuesday, March 11, 2014 1:45 AM
To: Tang Yuantian-B29983
Cc: u-boot at lists.denx.de; Li Yang-Leo-R58472; Jin Zhengxiong-R64188; Wood Scott-B07421
Subject: Re: [PATCH 2/2 v2] mpc85xx/t104x: Add deep sleep framework supportQuoted 13 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <[email protected]>
When T104x soc wakes up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Signed-off-by Tang Yuantian <[email protected]>---
v2:
- added explaination forCONFIG_DEEP_SLEEP
- fixed some issuesQuoted 6 lines
Quoted 2 lines
README | 4 +++ arch/powerpc/cpu/mpc85xx/asm-offsets.c | 24 ++++++++++++++Please fix the out-of-tree compiling issue. You will see it if you run make with O=<path> parameter.
York
Quoted 10 lines
Could you be more specific? What *path* should I give? If I do the below, I got error:
$ make O=/home/tangyt/opensource/u-boot/ /home/tangyt/opensource/u-boot is not clean, please run 'make mrproper' in the '/home/tangyt/opensource/u-boot' directory. make[1]: *** [prepare3] Error 1 make: *** [sub-make] Error 2
You may try
MAKEALL with BUILD_NBUILDS=<num> for out-of-tree build.
Regards,
Prabhakar
PATCH v2 2/2 mpc85xx/t104x: Add deep sleep framework support
In reply to Yuantian TangQuoted 31 lines · On 03/10/2014 11:16 PM, Tang Yuantian-B29983 wrote:
Quoted 23 lines
-----Original Message-----
From: Sun York-R58495
Sent: Tuesday, March 11, 2014 1:45 AM
To: Tang Yuantian-B29983
Cc: u-boot at lists.denx.de; Li Yang-Leo-R58472; Jin Zhengxiong-R64188; Wood Scott-B07421
Subject: Re: [PATCH 2/2 v2] mpc85xx/t104x: Add deep sleep framework supportQuoted 13 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <[email protected]>
When T104x soc wakes up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Signed-off-by Tang Yuantian <[email protected]>---
v2:
- added explaination forCONFIG_DEEP_SLEEP
- fixed some issuesQuoted 7 lines
Quoted 2 lines
README | 4 +++ arch/powerpc/cpu/mpc85xx/asm-offsets.c | 24 ++++++++++++++Please fix the out-of-tree compiling issue. You will see it if you run make with O=<path> parameter.
York
Quoted 9 lines
Could you be more specific? What *path* should I give? If I do the below, I got error:
$ make O=/home/tangyt/opensource/u-boot/ /home/tangyt/opensource/u-boot is not clean, please run 'make mrproper' in the '/home/tangyt/opensource/u-boot' directory. make[1]: *** [prepare3] Error 1 make: *** [sub-make] Error 2
It is out-of-tree compiling. You should use a clean path.
cd <u-boot source)
mkdir ../build
make O=../build T1040QDS_config
make O=../build
You should add other flags you normally use.
York
PATCH v2 2/2 mpc85xx/t104x: Add deep sleep framework support
Quoted 14 lines
Quoted 6 lines
Could you be more specific? What *path* should I give? If I do the below, I got error:
$ make O=/home/tangyt/opensource/u-boot/ /home/tangyt/opensource/u-boot is not clean, please run 'makemrproper'
Quoted 4 lines
in the '
/home/tangyt/opensource/u-boot' directory.
make[1]: *** [prepare3] Error 1
make: *** [sub-make] Error 2It is out-of-tree compiling. You should use a clean path.
Quoted 9 lines
cd <u-boot source)
mkdir ../build
make O=../buildT1040QDS_config
make O=../buildYou should add other flags you normally use.
York
I reproduced this issue.
I am trying to fix it. Meanwhile please continue to review.
Regards,
Yuantian