public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
Subject: [PATCH 3/6] mpc85xx: Replace magic values in BR/OR PRELIM config options by proper C macros
Date: Sun,  1 May 2022 16:23:54 +0200	[thread overview]
Message-ID: <20220501142357.16778-4-pali@kernel.org> (raw)
In-Reply-To: <20220501142357.16778-1-pali@kernel.org>

This change allows to understand how are Preliminary Base and Option
registers configured and later fix improper configuration.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 include/configs/P2041RDB.h     |  7 ++++---
 include/configs/corenet_ds.h   |  8 +++++---
 include/configs/p1_p2_rdb_pc.h | 11 ++++++++---
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h
index 687b88bd2abd..c2d7c76f6063 100644
--- a/include/configs/P2041RDB.h
+++ b/include/configs/P2041RDB.h
@@ -118,7 +118,8 @@
 		(BR_PHYS_ADDR((CONFIG_SYS_FLASH_BASE_PHYS + 0x8000000)) | \
 		BR_PS_16 | BR_V)
 #define CONFIG_SYS_FLASH_OR_PRELIM \
-		((0xf8000ff7 & ~OR_GPCM_SCY & ~OR_GPCM_EHTR) \
+		(OR_AM_128MB | OR_GPCM_CSNT | OR_GPCM_ACS_DIV2 \
+		 | OR_GPCM_XACS | OR_GPCM_TRLX | OR_GPCM_EAD \
 		 | OR_GPCM_SCY_8 | OR_GPCM_EHTR_CLEAR)
 
 #define CONFIG_FSL_CPLD
@@ -162,11 +163,11 @@
 
 /* NAND flash config */
 #define CONFIG_SYS_NAND_BR_PRELIM  (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
-			       | (2<<BR_DECC_SHIFT)    /* Use HW ECC */ \
+			       | BR_DECC_CHK_GEN       /* Use HW ECC */ \
 			       | BR_PS_8	       /* Port Size = 8 bit */ \
 			       | BR_MS_FCM	       /* MSEL = FCM */ \
 			       | BR_V)		       /* valid */
-#define CONFIG_SYS_NAND_OR_PRELIM  (0xFFFC0000	      /* length 256K */ \
+#define CONFIG_SYS_NAND_OR_PRELIM  (OR_AM_256KB	       /* length 256K */ \
 			       | OR_FCM_PGS	       /* Large Page*/ \
 			       | OR_FCM_CSCT \
 			       | OR_FCM_CST \
diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index 9108f206b696..c908269b24c7 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -117,7 +117,9 @@
 #define CONFIG_SYS_FLASH_BR_PRELIM \
 		(BR_PHYS_ADDR(CONFIG_SYS_FLASH_BASE_PHYS + 0x8000000) \
 		 | BR_PS_16 | BR_V)
-#define CONFIG_SYS_FLASH_OR_PRELIM ((0xf8000ff7 & ~OR_GPCM_SCY & ~OR_GPCM_EHTR) \
+#define CONFIG_SYS_FLASH_OR_PRELIM (OR_AM_128MB | OR_GPCM_CSNT | \
+					| OR_GPCM_ACS_DIV2 | OR_GPCM_XACS \
+					| OR_GPCM_TRLX | OR_GPCM_EAD \
 					| OR_GPCM_SCY_8 | OR_GPCM_EHTR_CLEAR)
 
 #define CONFIG_SYS_BR1_PRELIM \
@@ -164,11 +166,11 @@
 
 /* NAND flash config */
 #define CONFIG_SYS_NAND_BR_PRELIM  (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
-			       | (2<<BR_DECC_SHIFT)    /* Use HW ECC */ \
+			       | BR_DECC_CHK_GEN       /* Use HW ECC */ \
 			       | BR_PS_8	       /* Port Size = 8 bit */ \
 			       | BR_MS_FCM	       /* MSEL = FCM */ \
 			       | BR_V)		       /* valid */
-#define CONFIG_SYS_NAND_OR_PRELIM  (0xFFFC0000	      /* length 256K */ \
+#define CONFIG_SYS_NAND_OR_PRELIM  (OR_AM_256KB	       /* length 256K */ \
 			       | OR_FCM_PGS	       /* Large Page*/ \
 			       | OR_FCM_CSCT \
 			       | OR_FCM_CST \
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index 9726ef3077f7..b567eb1a03cc 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -243,7 +243,10 @@
 #define CONFIG_FLASH_BR_PRELIM (BR_PHYS_ADDR(CONFIG_SYS_FLASH_BASE_PHYS) \
 	| BR_PS_16 | BR_V)
 
-#define CONFIG_FLASH_OR_PRELIM	0xfc000ff7
+#define CONFIG_FLASH_OR_PRELIM		(OR_AM_64MB | OR_GPCM_CSNT | \
+					 OR_GPCM_ACS_DIV2 | OR_GPCM_XACS | \
+					 OR_GPCM_SCY_15 | OR_GPCM_TRLX | \
+					 OR_GPCM_EHTR | OR_GPCM_EAD)
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS}
 #define CONFIG_SYS_FLASH_QUIET_TEST
@@ -268,7 +271,7 @@
 #define CONFIG_SYS_MAX_NAND_DEVICE	1
 
 #define CONFIG_SYS_NAND_BR_PRELIM (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
-	| (2<<BR_DECC_SHIFT)	/* Use HW ECC */ \
+	| BR_DECC_CHK_GEN	/* Use HW ECC */ \
 	| BR_PS_8	/* Port Size = 8 bit */ \
 	| BR_MS_FCM	/* MSEL = FCM */ \
 	| BR_V)	/* valid */
@@ -325,7 +328,9 @@
 /* CPLD config size: 1Mb */
 #define CONFIG_CPLD_BR_PRELIM	(BR_PHYS_ADDR(CONFIG_SYS_CPLD_BASE_PHYS) | \
 					BR_PS_8 | BR_V)
-#define CONFIG_CPLD_OR_PRELIM	(0xfff009f7)
+#define CONFIG_CPLD_OR_PRELIM	(OR_AM_1MB | OR_GPCM_CSNT | OR_GPCM_XACS | \
+					OR_GPCM_SCY_15 | OR_GPCM_TRLX | \
+					OR_GPCM_EHTR | OR_GPCM_EAD)
 
 #define CONFIG_SYS_PMC_BASE	0xff980000
 #define CONFIG_SYS_PMC_BASE_PHYS	CONFIG_SYS_PMC_BASE
-- 
2.20.1


  parent reply	other threads:[~2022-05-01 14:26 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 ` Pali Rohár [this message]
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 ` [PATCH 6/6] board: freescale: p1_p2_rdb_pc: Fix size of NAND mapping Pali Rohár

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-4-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