public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH 08/17] ti: keystone: Clean up or migrate some NAND related options.
Date: Sun, 12 Sep 2021 20:32:24 -0400	[thread overview]
Message-ID: <20210913003233.4125-8-trini@konsulko.com> (raw)
In-Reply-To: <20210913003233.4125-1-trini@konsulko.com>

The COFNIG_KEYSTONE_RBL_NAND option is always enabled for the driver on
keystone platforms, but not older davinci platforms.  Use def_bool for
the symbol. For CONFIG_KEYSTONE_NAND_MAX_RBL_PAGE, it's only used within
the driver and derived from another symbol, so remove CONFIG from the
name.  Finally, CONFIG_KEYSTONE_NAND_MAX_RBL_SIZE is a bit more fixed.
For now, use the value directly.  Long term, as part of DM'ifying NAND,
this should come from the device tree.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 drivers/mtd/nand/raw/Kconfig         |  4 ++++
 drivers/mtd/nand/raw/davinci_nand.c  | 12 ++++++------
 include/configs/ti_armv7_keystone2.h |  2 --
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index f7b1334ddb47..bb8cffcabcef 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -105,6 +105,10 @@ config NAND_DAVINCI
 	  Enable this driver for NAND flash controllers available in TI Davinci
 	  and Keystone2 platforms
 
+config KEYSTONE_RBL_NAND
+	depends on ARCH_KEYSTONE
+	def_bool y
+
 config NAND_DENALI
 	bool
 	select SYS_NAND_SELF_INIT
diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 9ad3a57690e5..ef8e85a00212 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -347,9 +347,9 @@ static struct nand_ecclayout nand_keystone_rbl_4bit_layout_oobfirst = {
 };
 
 #ifdef CONFIG_SYS_NAND_PAGE_2K
-#define CONFIG_KEYSTONE_NAND_MAX_RBL_PAGE	CONFIG_KEYSTONE_NAND_MAX_RBL_SIZE >> 11
+#define KEYSTONE_NAND_MAX_RBL_PAGE	(0x100000 >> 11)
 #elif defined(CONFIG_SYS_NAND_PAGE_4K)
-#define CONFIG_KEYSTONE_NAND_MAX_RBL_PAGE	CONFIG_KEYSTONE_NAND_MAX_RBL_SIZE >> 12
+#define KEYSTONE_NAND_MAX_RBL_PAGE	(0x100000 >> 12)
 #endif
 
 /**
@@ -371,7 +371,7 @@ static int nand_davinci_write_page(struct mtd_info *mtd, struct nand_chip *chip,
 	struct nand_ecclayout *saved_ecc_layout;
 
 	/* save current ECC layout and assign Keystone RBL ECC layout */
-	if (page < CONFIG_KEYSTONE_NAND_MAX_RBL_PAGE) {
+	if (page < KEYSTONE_NAND_MAX_RBL_PAGE) {
 		saved_ecc_layout = chip->ecc.layout;
 		chip->ecc.layout = &nand_keystone_rbl_4bit_layout_oobfirst;
 		mtd->oobavail = chip->ecc.layout->oobavail;
@@ -402,7 +402,7 @@ static int nand_davinci_write_page(struct mtd_info *mtd, struct nand_chip *chip,
 
 err:
 	/* restore ECC layout */
-	if (page < CONFIG_KEYSTONE_NAND_MAX_RBL_PAGE) {
+	if (page < KEYSTONE_NAND_MAX_RBL_PAGE) {
 		chip->ecc.layout = saved_ecc_layout;
 		mtd->oobavail = saved_ecc_layout->oobavail;
 	}
@@ -433,7 +433,7 @@ static int nand_davinci_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *
 	struct nand_ecclayout *saved_ecc_layout = chip->ecc.layout;
 
 	/* save current ECC layout and assign Keystone RBL ECC layout */
-	if (page < CONFIG_KEYSTONE_NAND_MAX_RBL_PAGE) {
+	if (page < KEYSTONE_NAND_MAX_RBL_PAGE) {
 		chip->ecc.layout = &nand_keystone_rbl_4bit_layout_oobfirst;
 		mtd->oobavail = chip->ecc.layout->oobavail;
 	}
@@ -463,7 +463,7 @@ static int nand_davinci_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *
 	}
 
 	/* restore ECC layout */
-	if (page < CONFIG_KEYSTONE_NAND_MAX_RBL_PAGE) {
+	if (page < KEYSTONE_NAND_MAX_RBL_PAGE) {
 		chip->ecc.layout = saved_ecc_layout;
 		mtd->oobavail = saved_ecc_layout->oobavail;
 	}
diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h
index aa7b6ca9b809..512be7d328ea 100644
--- a/include/configs/ti_armv7_keystone2.h
+++ b/include/configs/ti_armv7_keystone2.h
@@ -119,8 +119,6 @@
 /* EEPROM definitions */
 
 /* NAND Configuration */
-#define CONFIG_KEYSTONE_RBL_NAND
-#define CONFIG_KEYSTONE_NAND_MAX_RBL_SIZE	CONFIG_ENV_OFFSET
 #define CONFIG_SYS_NAND_MASK_CLE		0x4000
 #define CONFIG_SYS_NAND_MASK_ALE		0x2000
 #define CONFIG_SYS_NAND_CS			2
-- 
2.17.1


  parent reply	other threads:[~2021-09-13  0:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13  0:32 [PATCH 01/17] am335x_guardian: Enable SPL_OF_CONTROL Tom Rini
2021-09-13  0:32 ` [PATCH 02/17] am335x_boneblack_vboot: " Tom Rini
2021-09-13  0:32 ` [PATCH 03/17] am335x: Remove legacy non-DM_USB code Tom Rini
2021-09-13  0:32 ` [PATCH 04/17] keystone2: Move CONFIG_AEMIF_CNTRL_BASE out of CONFIG namespace Tom Rini
2021-09-28 23:20   ` Tom Rini
2021-09-13  0:32 ` [PATCH 05/17] usb: phy: ti: Remove non-DM PHY code Tom Rini
2021-09-28 23:20   ` Tom Rini
2021-09-13  0:32 ` [PATCH 06/17] Convert CONFIG_USB_XHCI_OMAP to Kconfig Tom Rini
2021-09-28 23:20   ` Tom Rini
2021-09-13  0:32 ` [PATCH 07/17] compulab: Clean up some unused symbols Tom Rini
2021-09-28 23:21   ` Tom Rini
2021-09-13  0:32 ` Tom Rini [this message]
2021-09-28 23:21   ` [PATCH 08/17] ti: keystone: Clean up or migrate some NAND related options Tom Rini
2021-09-13  0:32 ` [PATCH 09/17] ti: keystone: dma: Migrate to Kconfig Tom Rini
2021-09-28 23:21   ` Tom Rini
2021-09-13  0:32 ` [PATCH 10/17] omapl138_lcdk: Stop using CONFIG_MACH_OMAPL138_LCDK Tom Rini
2021-09-28 23:21   ` Tom Rini
2021-09-13  0:32 ` [PATCH 11/17] usb: ehci-omap: Drop non-DM_USB legacy code Tom Rini
2021-09-28 23:21   ` Tom Rini
2021-09-13  0:32 ` [PATCH 12/17] Convert CONFIG_OMAP_EHCI_PHY1_RESET_GPIO et al to Kconfig Tom Rini
2021-09-28 23:21   ` Tom Rini
2021-09-13  0:32 ` [PATCH 13/17] am3517_evm: Remove unused comments/code Tom Rini
2021-09-28 23:21   ` Tom Rini
2021-09-13  0:32 ` [PATCH 14/17] omap3_logic: " Tom Rini
2021-09-28 23:21   ` Tom Rini
2021-09-13  0:32 ` [PATCH 15/17] omap4_panda: " Tom Rini
2021-09-28 23:21   ` Tom Rini
2021-09-13  0:32 ` [PATCH 16/17] ti: keystone: Move away from CONFIG_SOC_KEYSTONE Tom Rini
2021-09-28 23:21   ` Tom Rini
2021-09-13  0:32 ` [PATCH 17/17] ti: keystone: Migrate CONFIG_SOC_K2* to Kconfig Tom Rini
2021-09-28 23:21   ` Tom Rini

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=20210913003233.4125-8-trini@konsulko.com \
    --to=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