fsl/sleep: updated the deep sleep framework for QorIQ platforms
PATCH 1/1 fsl/sleep: updated the deep sleep framework for QorIQ platforms
From: Tang Yuantian <[email protected]>
With the introducing of generic board and ARM-based cores, current deep sleep framework doesn't work anymore.
This patch will convert the current framework to adapt this change. Basically it does:
1. Converts all the Freescale's DDR driver to support deep sleep.
2. Added basic framework support for ARM-based and PPC-based cores separately.
--- board/freescale/common/Makefile | 6 +++ board/freescale/common/arm_sleep.c | 95 ++++++++++++++++++++++++++++++++++ board/freescale/common/mpc85xx_sleep.c | 88 +++++++++++++++++++++++++++++++ board/freescale/common/sleep.h | 21 ++++++++ drivers/ddr/fsl/arm_ddr_gen3.c | 45 +++++++++++++--- drivers/ddr/fsl/fsl_ddr_gen4.c | 44 ++++++++++++++-- drivers/ddr/fsl/mpc85xx_ddr_gen3.c | 67 +++++++++--------------- include/fsl_ddr_sdram.h | 12 +++-- 8 files changed, 322 insertions(+), 56 deletions(-) create mode 100644 board/freescale/common/arm_sleep.c create mode 100644 board/freescale/common/mpc85xx_sleep.c create mode 100644 board/freescale/common/sleep.h
board/freescale/common/Makefile +6 -0
@@ -36,6 +36,12 @@ endif obj-$(CONFIG_FSL_DIU_CH7301) += diu_ch7301.o +ifdef CONFIG_ARM +obj-$(CONFIG_DEEP_SLEEP) += arm_sleep.o +else +obj-$(CONFIG_DEEP_SLEEP) += mpc85xx_sleep.o +endif + obj-$(CONFIG_FSL_DCU_SII9022A) += dcu_sii9022a.o obj-$(CONFIG_MPC8541CDS) += cds_pci_ft.o
board/freescale/common/arm_sleep.c new file +95 -0
95 lines not on this page · raw message
board/freescale/common/mpc85xx_sleep.c new file +88 -0
88 lines not on this page · raw message
board/freescale/common/sleep.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright 2014 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __SLEEP_H +#define __SLEEP_H + +#define DCFG_CCSR_CRSTSR_WDRFR (1 << 3) +#define DDR_BUFF_LEN 128 + +/* determine if it is a wakeup from deep sleep */ +bool is_warm_boot (void ); + +/* disable console output */ +void fsl_dp_disable_console (void ); + +/* clean up everything and jump to kernel */ +int fsl_dp_resume (void ); +#endif
drivers/ddr/fsl/arm_ddr_gen3.c +39 -6
74 lines not on this page · raw message
drivers/ddr/fsl/fsl_ddr_gen4.c +39 -5
73 lines not on this page · raw message
drivers/ddr/fsl/mpc85xx_ddr_gen3.c +25 -42
115 lines not on this page · raw message
include/fsl_ddr_sdram.h +9 -3
@@ -114,6 +114,7 @@ typedef struct ddr4_spd_eeprom_s generic_spd_eeprom_t;#define SDRAM_CFG_2T_EN 0x00008000#define SDRAM_CFG_BI 0x00000001 +#define SDRAM_CFG2_FRC_SR 0x80000000#define SDRAM_CFG2_D_INIT 0x00000010#define SDRAM_CFG2_ODT_CFG_MASK 0x00600000#define SDRAM_CFG2_ODT_NEVER 0
@@ -163,6 +164,7 @@ typedef struct ddr4_spd_eeprom_s generic_spd_eeprom_t;#define DDR_CDR1_ODT (x) ((x & DDR_CDR1_ODT_MASK) << DDR_CDR1_ODT_SHIFT)#define DDR_CDR2_ODT (x) (x & DDR_CDR2_ODT_MASK)#define DDR_CDR2_VREF_OVRD (x) (0x00008080 | ((((x) - 37) & 0x3F) << 8)) +#define DDR_CDR2_VREF_TRAIN_EN 0x00000080#if (defined(CONFIG_SYS_FSL_DDR_VER ) && \ (CONFIG_SYS_FSL_DDR_VER >=FSL_DDR_VER_4_7 ))
@@ -202,6 +204,8 @@ typedef struct ddr4_spd_eeprom_s generic_spd_eeprom_t;#define DDR_CDR_ODT_120ohm 0x6#endif +#define DDR_INIT_ADDR_EXT_UIA (1 << 31) +/* Record of register values computed */ typedef struct fsl_ddr_cfg_regs_s { struct {
@@ -414,9 +418,11 @@ static int __board_need_mem_reset(void)int board_need_mem_reset (void ) __attribute__((weak,alias ("__board_need_mem_reset" ))); -void __weak board_mem_sleep_setup (void ) -{ -} +#if defined(CONFIG_DEEP_SLEEP ) +void board_mem_sleep_setup (void ); +bool is_warm_boot (void ); +int fsl_dp_resume (void ); +#endif /* * The 85xx boards have a common prototype for fixed_sdram so put the
Signature · 1 line
2.1.0.27.g96db324
PATCH 1/1 mpc85xx/t104xrdb: convert deep sleep to generic board interface
From: Tang Yuantian <[email protected]>
A new interface is introduced to support generic board structure. Converts it to use new interface.
--- board/freescale/t104xrdb/ddr.c | 19 +++++++++++++++++++ board/freescale/t104xrdb/spl.c | 19 +++---------------- board/freescale/t104xrdb/t104xrdb.c | 24 +++++++++++------------- include/configs/T104xRDB.h | 3 +++ 4 files changed, 36 insertions(+), 29 deletions(-)
board/freescale/t104xrdb/ddr.c +19 -0
@@ -11,6 +11,7 @@#include <fsl_ddr_sdram.h> #include <fsl_ddr_dimm_params.h> #include <asm/fsl_law.h> +#include <asm/mpc85xx_gpio.h> #include "ddr.h" DECLARE_GLOBAL_DATA_PTR ;
@@ -109,6 +110,19 @@ found: popts->ddr_cdr2 =DDR_CDR2_ODT (DDR_CDR_ODT_75ohm); } +#if defined(CONFIG_DEEP_SLEEP ) +void board_mem_sleep_setup (void ) +{ +void __iomem *cpld_base = (void *)CONFIG_SYS_CPLD_BASE ; + +/* does not provide HW signals for power management */ +clrbits_8 (cpld_base +0x17 ,0x40 ); +/* Disable MCKE isolation */ +gpio_set_value (2 ,0 ); +udelay (1 ); +} +#endif +phys_size_t initdram (int board_type) {phys_size_t dram_size;
@@ -124,5 +138,10 @@ phys_size_t initdram(int board_type)#else dram_size =fsl_ddr_sdram_size ();#endif + +#if defined(CONFIG_DEEP_SLEEP ) && !defined(CONFIG_SPL_BUILD ) +fsl_dp_resume (); +#endif +return dram_size; }
board/freescale/t104xrdb/spl.c +3 -16
@@ -11,7 +11,7 @@#include <mmc.h> #include <fsl_esdhc.h> #include <spi_flash.h> -#include <asm/mpc85xx_gpio.h> +#include "../common/sleep.h" DECLARE_GLOBAL_DATA_PTR ;
@@ -58,8 +58,8 @@ void board_init_f(ulong bootflag)#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_DISABLE_CONSOLE ; +if (is_warm_boot ()) +fsl_dp_disable_console ();#endif /* compiler optimization barrier needed for GCC >= 3.4 */ __asm__ __volatile__("" : : :"memory" );
@@ -126,16 +126,3 @@ void board_init_r(gd_t *gd, ulong dest_addr)nand_boot ();#endif } - -#ifdef CONFIG_DEEP_SLEEP -void board_mem_sleep_setup (void ) -{ -void __iomem *cpld_base = (void *)CONFIG_SYS_CPLD_BASE ; - -/* does not provide HW signals for power management */ -clrbits_8 (cpld_base +0x17 ,0x40 ); -/* Disable MCKE isolation */ -gpio_set_value (2 ,0 ); -udelay (1 ); -} -#endif
board/freescale/t104xrdb/t104xrdb.c +11 -13
@@ -17,8 +17,7 @@#include <asm/fsl_portals.h> #include <asm/fsl_liodn.h> #include <fm_eth.h> -#include <asm/mpc85xx_gpio.h> - +#include "../common/sleep.h" #include "t104xrdb.h" #include "cpld.h"
@@ -44,6 +43,16 @@ int checkboard(void)return 0 ; } +int board_early_init_f (void ) +{ +#if defined(CONFIG_DEEP_SLEEP ) +if (is_warm_boot ()) +fsl_dp_disable_console (); +#endif + +return 0 ; +} +int board_early_init_r (void ) {#ifdef CONFIG_SYS_FLASH_BASE
@@ -111,14 +120,3 @@ void ft_board_setup(void *blob, bd_t *bd)fdt_fixup_fman_ethernet (blob);#endif } - -#ifdef CONFIG_DEEP_SLEEP -void board_mem_sleep_setup (void ) -{ -/* does not provide HW signals for power management */ -CPLD_WRITE (misc_ctl_status, (CPLD_READ (misc_ctl_status) & ~0x40 )); -/* Disable MCKE isolation */ -gpio_set_value (2 ,0 ); -udelay (1 ); -} -#endif
include/configs/T104xRDB.h +3 -0
@@ -100,7 +100,10 @@/* support deep sleep */ #define CONFIG_DEEP_SLEEP +#if defined(CONFIG_DEEP_SLEEP ) +#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_SILENT_CONSOLE +#endif #ifndef CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_TEXT_BASE 0xeff40000
Signature · 1 line
2.1.0.27.g96db324
PATCH 1/1 mpc85xx/t104xrdb: convert deep sleep to generic board interface
Quoted 7 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <[email protected]>
A new interface is introduced to support generic board structure. Converts it to use new interface.
Signed-off-by Tang Yuantian <[email protected]>---
Applied to u-boot-mpc85xx master, awaiting upstream.
York
PATCH 1/1 fsl/sleep: updated the deep sleep framework for QorIQ platforms
In reply to Yuantian.Tang at freescale.comQuoted 10 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <[email protected]>
With the introducing of generic board and ARM-based cores, current deep sleep framework doesn't work anymore.
This patch will convert the current framework to adapt this change. Basically it does:
1. Converts all the Freescale's DDR driver to support deep sleep.
2. Added basic framework support for ARM-based and PPC-based cores separately.
Quoted 2 lines
Signed-off-by Tang Yuantian <[email protected]>---
Applied to u-boot-fsl-qoriq master, awaiting upstream.
York