From: "Pali Rohár" <pali@kernel.org>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
Subject: [PATCH 6/6] board: freescale: p1_p2_rdb_pc: Fix size of NAND mapping
Date: Sun, 1 May 2022 16:23:57 +0200 [thread overview]
Message-ID: <20220501142357.16778-7-pali@kernel.org> (raw)
In-Reply-To: <20220501142357.16778-1-pali@kernel.org>
P1020RDB-PD has NAND with large page. All other P1/P2 RDB boards have NAND
with small page. According to P1/P2 RM documentation, for NAND with large
page it is needed to use 256 kB mapping and for small page just 32 kB.
Currenly in p1_p2_rdb_pc board code there is a mix of 32 kB and 1 MB
settings which effetively restrict to just 32 kB. Fix this issue and set
TLB, LAW and LBC OR registers which correct mapping size based on the
selected board.
Note that E500 core does not support Book-E page of 32 kB, so choose 64 kB
settings for TLB.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
board/freescale/p1_p2_rdb_pc/law.c | 4 ++++
board/freescale/p1_p2_rdb_pc/tlb.c | 11 +++++++++--
include/configs/p1_p2_rdb_pc.h | 4 ++--
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/board/freescale/p1_p2_rdb_pc/law.c b/board/freescale/p1_p2_rdb_pc/law.c
index 80adf21a1183..60672d34e11c 100644
--- a/board/freescale/p1_p2_rdb_pc/law.c
+++ b/board/freescale/p1_p2_rdb_pc/law.c
@@ -19,8 +19,12 @@ struct law_entry law_table[] = {
SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_LBC),
#endif
#ifdef CONFIG_SYS_NAND_BASE_PHYS
+#ifdef CONFIG_TARGET_P1020RDB_PD
+ SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_256K, LAW_TRGT_IF_LBC),
+#else
SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_32K, LAW_TRGT_IF_LBC),
#endif
+#endif
};
int num_law_entries = ARRAY_SIZE(law_table);
diff --git a/board/freescale/p1_p2_rdb_pc/tlb.c b/board/freescale/p1_p2_rdb_pc/tlb.c
index 5bbeae302ad0..a5b80762f0fc 100644
--- a/board/freescale/p1_p2_rdb_pc/tlb.c
+++ b/board/freescale/p1_p2_rdb_pc/tlb.c
@@ -78,10 +78,17 @@ struct fsl_e_tlb_entry tlb_table[] = {
#endif /* not SPL */
#ifdef CONFIG_SYS_NAND_BASE
- /* *I*G - NAND */
+#ifdef CONFIG_TARGET_P1020RDB_PD
+ /* *I*G - NAND large page 256K */
SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
- 0, 7, BOOKE_PAGESZ_1M, 1),
+ 0, 7, BOOKE_PAGESZ_256K, 1),
+#else
+ /* *I*G - NAND small page 64K (effective only 32K; e500 does not support BOOKE_PAGESZ_32K) */
+ SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
+ MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+ 0, 7, BOOKE_PAGESZ_64K, 1),
+#endif
#endif
#if defined(CONFIG_SYS_RAMBOOT) || \
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index cf84f4045538..2ddf768f2c82 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -214,7 +214,7 @@
* 0xec00_0000 0xefff_ffff NOR flash Up to 64M non-cacheable CS0/1
* 0xf8f8_0000 0xf8ff_ffff L2 SRAM Up to 512K cacheable
* (early boot only)
- * 0xff80_0000 0xff80_7fff NAND flash 32K non-cacheable CS1/0
+ * 0xff80_0000 0xff83_ffff NAND flash 32K/256K non-cacheable CS1/0
* 0xff98_0000 0xff98_ffff PMC 64K non-cacheable CS2
* 0xffa0_0000 0xffa1_ffff CPLD 128K non-cacheable CS3
* 0xffb0_0000 0xffbf_ffff VSC7385 switch 1M non-cacheable CS2
@@ -283,7 +283,7 @@
| BR_MS_FCM /* MSEL = FCM */ \
| BR_V) /* valid */
#if defined(CONFIG_TARGET_P1020RDB_PD)
-#define CONFIG_SYS_NAND_OR_PRELIM (OR_AM_32KB \
+#define CONFIG_SYS_NAND_OR_PRELIM (OR_AM_256KB \
| OR_FCM_PGS /* Large Page*/ \
| OR_FCM_CSCT \
| OR_FCM_CST \
--
2.20.1
prev parent reply other threads:[~2022-05-01 14:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-01 14:23 [PATCH 0/6] board: freescale: p1_p2_rdb_pc: Fix sizes of LBC peripherals Pali Rohár
2022-05-01 14:23 ` [PATCH 1/6] Revert "Convert CONFIG_SYS_BR0_PRELIM et al to Kconfig" Pali Rohár
2022-05-01 14:39 ` Tom Rini
2022-05-01 14:44 ` Pali Rohár
2022-05-01 15:14 ` Tom Rini
2022-05-01 15:33 ` Pali Rohár
2022-05-01 16:17 ` Tom Rini
2022-05-12 16:01 ` Tom Rini
2022-05-12 16:05 ` Pali Rohár
2022-05-01 14:23 ` [PATCH 2/6] Revert "p1_p2_rdb: Remove CONFIG_CPLD_[BO]R_PRELIM" Pali Rohár
2022-05-01 14:38 ` Tom Rini
2022-05-01 14:40 ` Pali Rohár
2022-05-01 14:23 ` [PATCH 3/6] mpc85xx: Replace magic values in BR/OR PRELIM config options by proper C macros Pali Rohár
2022-05-01 14:23 ` [PATCH 4/6] board: freescale: p1_p2_rdb_pc: Fix size of CPLD mapping Pali Rohár
2022-05-01 14:23 ` [PATCH 5/6] board: freescale: p1_p2_rdb_pc: Fix size of FLASH NOR mapping Pali Rohár
2022-05-01 14:23 ` Pali Rohár [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220501142357.16778-7-pali@kernel.org \
--to=pali@kernel.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox