aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-bsp
diff options
context:
space:
mode:
authorYuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>2017-06-10 19:34:35 +0900
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-06-20 09:47:23 +0000
commit077caaf7ec0cb71b457ec8925819b8bec130178c (patch)
tree5d684ea22b19fbb841e5252a8904bcf6ee699d17 /meta-agl-bsp
parent8ae8c01240bddc1f88a2350094eedcfff2ad58c2 (diff)
Add hibernation image area
This patch set add DDR hibernation image area. 0x40000000 <-> 0x77FFFFFF : kernel 0x78000000 <-> 0x7FFFFFFF : hibernation image area and Enable swsusp DMA support(sdhi DMA support). Change-Id: Ia3011d4979f38f0d1cbc5f9f1964e8fa07a7fc20 Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com> Reviewed-on: https://gerrit.automotivelinux.org/gerrit/9697 Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'meta-agl-bsp')
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-hibernation-image-area.patch101
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Enable-swsusp-DMA-support.patch95
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-hibernation-image-area.patch91
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend3
4 files changed, 290 insertions, 0 deletions
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-hibernation-image-area.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-hibernation-image-area.patch
new file mode 100644
index 000000000..95fc3b247
--- /dev/null
+++ b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-hibernation-image-area.patch
@@ -0,0 +1,101 @@
+From 0b5f63c7224cb5c9a00397f0e0ef4a16aa58e516 Mon Sep 17 00:00:00 2001
+From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
+Date: Fri, 9 Jun 2017 20:43:06 +0900
+Subject: [PATCH 1/3] Add hibernation image area
+
+0x40000000 <-> 0x77FFFFFF : kernel
+0x78000000 <-> 0x7FFFFFFF : hibernation image area
+and Enable sdhi DMA support
+
+Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
+---
+ arch/arm/include/asm/arch-rmobile/r8a7791.h | 3 +++
+ arch/arm/include/asm/armv7.h | 3 +++
+ include/configs/porter.h | 24 ++++++++++++------------
+ 3 files changed, 18 insertions(+), 12 deletions(-)
+
+diff --git a/arch/arm/include/asm/arch-rmobile/r8a7791.h b/arch/arm/include/asm/arch-rmobile/r8a7791.h
+index c964f13..9e08da4 100644
+--- a/arch/arm/include/asm/arch-rmobile/r8a7791.h
++++ b/arch/arm/include/asm/arch-rmobile/r8a7791.h
+@@ -147,6 +147,8 @@
+
+ #define DBSC3_0_DBADJ2 0xE67900C8
+ #define DBSC3_1_DBADJ2 0xE67A00C8
++#define DBSC3_0_DBCALTR 0xE67900F8
++#define DBSC3_1_DBCALTR 0xE67A00F8
+
+ #define CCI_400_MAXOT_1 0xF0091110
+ #define CCI_400_MAXOT_2 0xF0092110
+@@ -154,6 +156,7 @@
+ #define CCI_400_QOSCNTL_2 0xF009210C
+
+ #define MXI_BASE 0xFE960000
++#define MXI_VIN_QOS 0xFE96020C
+ #define MXI_QOS_BASE 0xFE960300
+
+ #define SYS_AXI_SYX64TO128_BASE 0xFF800300
+diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
+index aad5bf7..0d4d612 100644
+--- a/arch/arm/include/asm/armv7.h
++++ b/arch/arm/include/asm/armv7.h
+@@ -31,6 +31,9 @@
+ #define MIDR_CORTEX_A9_R1P3 0x411FC093
+ #define MIDR_CORTEX_A9_R2P10 0x412FC09A
+
++/* valid bits in CBAR register / PERIPHBASE value */
++#define CBAR_MASK 0xFFFF8000
++
+ /* Cortex-A15 revisions */
+ #define MIDR_CORTEX_A15_R0P0 0x410FC0F0
+
+diff --git a/include/configs/porter.h b/include/configs/porter.h
+index 5567c7c..f652bab 100644
+--- a/include/configs/porter.h
++++ b/include/configs/porter.h
+@@ -91,14 +91,14 @@
+
+ /* MEMORY */
+ #define PORTER_SDRAM_BASE 0x40000000
+-#define PORTER_SDRAM_SIZE 0x48000000
++#define PORTER_SDRAM_SIZE 0x80000000
+ #define PORTER_UBOOT_SDRAM_SIZE 0x40000000
+
+ #define CONFIG_SYS_LONGHELP
+ #define CONFIG_SYS_PROMPT "=> "
+-#define CONFIG_SYS_CBSIZE 512
+-#define CONFIG_SYS_PBSIZE 512
+-#define CONFIG_SYS_MAXARGS 32
++#define CONFIG_SYS_CBSIZE 256
++#define CONFIG_SYS_PBSIZE 256
++#define CONFIG_SYS_MAXARGS 16
+ #define CONFIG_SYS_BARGSIZE 512
+ #define CONFIG_SYS_BAUDRATE_TABLE { 38400, 115200 }
+
+@@ -205,15 +205,15 @@
+ #define CONFIG_USB_HOST_ETHER /* Enable USB Ethernet adapters */
+ #define CONFIG_USB_ETHER_ASIX /* Asix, or whatever driver(s) you want */
+
+-#define CONFIG_ARMV7_LPAE /* 64-bit MMU descriptors */
+-#define CONFIG_SYS_ARM_CACHE_WRITEALLOC /* Make memory operations faster */
+-
+-#define CONFIG_SYS_ARCH_TIMER /* Init arch timer */
+-#define CONFIG_VE_ENABLED /* Virtualization Extensions are enabled*/
+-#define CONFIG_SYS_HZ_CLOCK CONFIG_SYS_CLK_FREQ
++#define CONFIG_ARMV7_LPAE /* 64-bit MMU descriptors */
++#define CONFIG_SYS_ARM_CACHE_WRITEALLOC /* Make memory operations faster */
++#define CONFIG_SYS_ARCH_TIMER /* Init arch timer */
++#define CONFIG_SYS_HZ_CLOCK CONFIG_SYS_CLK_FREQ
+
++#if 1
+ #define CONFIG_SH_DMA
+-#define CONFIG_SH_SYS_DMAL_BASE 0xE6700000
+-#define CONFIG_SH_SYS_DMAL_NCH 15
++#define CONFIG_SH_SYS_DMAL_BASE 0xE6700000
++#define CONFIG_SH_SYS_DMAL_NCH 15
++#endif
+
+ #endif /* __PORTER_H */
+--
+1.8.3.1
+
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Enable-swsusp-DMA-support.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Enable-swsusp-DMA-support.patch
new file mode 100644
index 000000000..2a525d39a
--- /dev/null
+++ b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Enable-swsusp-DMA-support.patch
@@ -0,0 +1,95 @@
+From 33dfe19185b35fc61613070032836beee0f48c45 Mon Sep 17 00:00:00 2001
+From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
+Date: Fri, 9 Jun 2017 20:45:39 +0900
+Subject: [PATCH 2/3] Enable swsusp DMA support
+
+Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
+---
+ common/cmd_swsusp.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 58 insertions(+)
+
+diff --git a/common/cmd_swsusp.c b/common/cmd_swsusp.c
+index ba05aa4..b1d6c22 100644
+--- a/common/cmd_swsusp.c
++++ b/common/cmd_swsusp.c
+@@ -226,6 +226,53 @@ static inline void *malloc_aligned(u32 size, u32 align)
+ return (void *)(((u32)malloc(size + align) + align - 1) & ~(align - 1));
+ }
+
++static int block_read(u32 page, void *addr, u32 count)
++{
++ __u32 cnt;
++ int blk_per_page;
++
++ blk_per_page = PAGE_SIZE / swap_dev->blksz;
++ cnt = swap_dev->block_read(swap_dev->dev,
++ swap_info.start + (page * blk_per_page),
++ count * blk_per_page, addr);
++
++ return cnt != count * blk_per_page;
++}
++
++static int get_block(unsigned char *buffer, u32 size)
++{
++ int need_num_pages = size / PAGE_SIZE;
++ int read_pages = 0;
++ int count;
++ u64 start;
++
++ do {
++ u64 prev;
++ count = 0;
++
++ if (!get_meta())
++ goto exit;
++
++ prev = start = meta_map->entries[meta_idx];
++ do {
++ count++;
++ meta_idx++;
++ if (meta_map->entries[meta_idx] - prev > 1)
++ break;
++ prev = meta_map->entries[meta_idx];
++ } while (read_pages + count < need_num_pages &&
++ meta_idx < ARRAY_SIZE(meta_map->entries));
++
++ if (block_read(start, buffer, count))
++ return -1;
++ read_pages += count;
++ buffer += count * PAGE_SIZE;
++ } while (read_pages < need_num_pages);
++
++exit:
++ return read_pages * PAGE_SIZE;
++}
++
+ #endif
+
+ static int page_read(u32 page, void *addr)
+@@ -465,12 +512,23 @@ static int image_page_get_next(void *buffer)
+ cmp_len = *(size_t *) cmp_buf;
+ cmp_avail = PAGE_SIZE;
+
++#ifdef CONFIG_SH_DMA
++ while (cmp_avail < cmp_len + LZO_HEADER) {
++ /* try to DMA-read whole block */
++ ret = get_block(cmp_buf + cmp_avail,
++ cmp_len + LZO_HEADER);
++ if (unlikely(ret <= 0))
++ return ret;
++ cmp_avail += ret;
++ }
++#else
+ while (cmp_avail < cmp_len + LZO_HEADER) {
+ ret = raw_page_get_next(cmp_buf + cmp_avail);
+ if (unlikely(ret <= 0))
+ return ret;
+ cmp_avail += PAGE_SIZE;
+ }
++#endif
+ unc_len = LZO_UNC_SIZE;
+ ret = lzo1x_decompress_safe(cmp_buf + LZO_HEADER,
+ cmp_len, unc_buf, &unc_len);
+--
+1.8.3.1
+
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-hibernation-image-area.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-hibernation-image-area.patch
new file mode 100644
index 000000000..e6682354e
--- /dev/null
+++ b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-hibernation-image-area.patch
@@ -0,0 +1,91 @@
+From eae2ee2090f8c9c140a1b766bd7312be5f0f308d Mon Sep 17 00:00:00 2001
+From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
+Date: Fri, 9 Jun 2017 20:46:54 +0900
+Subject: [PATCH 3/3] Add hibernation image area
+
+0x40000000 <-> 0x77FFFFFF : kernel
+0x78000000 <-> 0x7FFFFFFF : hibernation image area
+
+Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
+---
+ common/cmd_swsuspmem.c | 20 +++++++++++++-------
+ 1 file changed, 13 insertions(+), 7 deletions(-)
+
+diff --git a/common/cmd_swsuspmem.c b/common/cmd_swsuspmem.c
+index 6980aaf..dbc000c 100644
+--- a/common/cmd_swsuspmem.c
++++ b/common/cmd_swsuspmem.c
+@@ -116,8 +116,9 @@ struct swsusp_finish_context {
+ #define USED_ADDRESS_TOP (CONFIG_SYS_SDRAM_BASE)
+ #define USED_ADDRESS_END (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_LOAD_OFFSET)
+ #else
+-#define USED_ADDRESS_TOP (0x40000000)
+-#define USED_ADDRESS_END (0x48000000)
++#define CONFIG_SYS_LOAD_OFFSET 0x0
++#define USED_ADDRESS_TOP (CONFIG_SYS_SDRAM_BASE)
++#define USED_ADDRESS_END (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_LOAD_OFFSET)
+ #endif
+ #define PG_UB2ZERO(pg) ((pg) - CONFIG_SYS_SDRAM_BASE / PAGE_SIZE)
+ static u32 const exclude_min_page =
+@@ -157,7 +158,7 @@ static struct swsuspmem_hook *_hook;
+ } while (0)
+
+ #ifdef PAGEMAP_DEBUG
+-static int debugout;
++static int debugout = 1;
+ static int _last_read_pages;
+ #define PAGEMAP_INFO(_msg, ...) \
+ do { \
+@@ -231,7 +232,7 @@ static inline u32 addr2pg(void *addr)
+ {
+ return ((u32)(addr)) / PAGE_SIZE;
+ }
+-static void *offt_addr = (void *)0x44000000;
++static void *offt_addr = (void *)0x78000000;
+ static int page_read_mem(u64 page, void *addr)
+ {
+ memcpy(addr, (u8 *)offt_addr + page * PAGE_SIZE, PAGE_SIZE);
+@@ -577,7 +578,7 @@ int do_checksnapimage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+
+ if (memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)
+ || (swsusp_header->img_size == 0)
+- || (swsusp_header->img_size > 0x03fff000)) {
++ || (swsusp_header->img_size > 0x05fff000)) {
+ printf("No hibernation image present\n");
+ CALL_HOOK(err_hook, SWSUSPMEM_BROKENIMAGE);
+ return 0;
+@@ -674,7 +675,9 @@ int do_swsuspmem(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+ /* Allow for 16 pages of stack */
+ max_page = gd->start_addr_sp / PAGE_SIZE - 32;
+ high_page = (((gd->relocaddr + _bss_end_ofs)
+- + (PAGE_SIZE - 1)) / PAGE_SIZE) + 1;
++ + (PAGE_SIZE - 1)) / PAGE_SIZE) + 1 + 0xf;
++ if (high_page > 0x7ffff)
++ high_page = 0x7ffff;
+ #define pfn_is_occupied(pfn) (page > max_page && page <= high_page)
+ #ifdef PAGEMAP_DEBUG
+ PAGEMAP_INFO(" *gd->start_addr_sp:%p\n",
+@@ -711,7 +714,7 @@ int do_swsuspmem(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+
+ if (memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)
+ || (swsusp_header->img_size == 0)
+- || (swsusp_header->img_size > 0x03fff000)) {
++ || (swsusp_header->img_size > 0x05fff000)) {
+ printf("No hibernation image present\n");
+ CALL_HOOK(err_hook, SWSUSPMEM_BROKENIMAGE);
+ return 0;
+@@ -830,8 +833,11 @@ int do_swsuspmem(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+ continue;
+ } else if (unlikely(pfn_is_low(page) &&
+ pfn_is_occupied(page))) {
++ /* Virtual 32-bit original address */
+ remap_orig[remap_idx] = pg2addr(page);
++ /* allocating new free page */
+ page = free_page_get_next();
++ /* Virtual 32-bit remap address */
+ remap_temp[remap_idx] = pg2addr(page);
+ remap_idx++;
+ #ifdef PAGEMAP_DEBUG
+--
+1.8.3.1
+
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend
index 9a489e398..9535e174d 100644
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend
+++ b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend
@@ -6,5 +6,8 @@ SRC_URI_append_agl-porter-hibernate = " file://hibernation/0001-Add-rcar-sdhi-DM
file://hibernation/0002-Add-Hibernation-swsusp-command-support.patch \
file://hibernation/0003-Add-Hibernation-swsuspmem-command-support.patch \
file://hibernation/0004-Add-porter-board-Hibernation-code.patch \
+ file://hibernation/0001-Add-hibernation-image-area.patch \
+ file://hibernation/0002-Enable-swsusp-DMA-support.patch \
+ file://hibernation/0003-Add-hibernation-image-area.patch \
"