public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: u-boot@lists.denx.de
Subject: [PATCH 10/11] imx: ventana: enable dm for MTD and NAND
Date: Mon,  1 Mar 2021 14:33:36 -0800	[thread overview]
Message-ID: <20210301223337.7763-11-tharvey@gateworks.com> (raw)
In-Reply-To: <20210301223337.7763-1-tharvey@gateworks.com>

Enable driver model for MTD and NAND support allowing us to remove
the iomux, init, and most of the static configuration.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 board/gateworks/gw_ventana/gw_ventana.c | 52 -------------------------
 configs/gwventana_nand_defconfig        |  2 +
 include/configs/gw_ventana.h            | 14 +------
 3 files changed, 4 insertions(+), 64 deletions(-)

diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 4c6e5097a4..c86e7a4a0c 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -79,54 +79,6 @@ static iomux_v3_cfg_t const enet_pads[] = {
 	IOMUX_PADS(PAD_ENET_TXD0__GPIO1_IO30 | DIO_PAD_CFG),
 };
 
-#ifdef CONFIG_CMD_NAND
-static iomux_v3_cfg_t const nfc_pads[] = {
-	IOMUX_PADS(PAD_NANDF_CLE__NAND_CLE     | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_ALE__NAND_ALE     | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_WP_B__NAND_WP_B   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_RB0__NAND_READY_B | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_CS0__NAND_CE0_B   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_SD4_CMD__NAND_RE_B      | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_SD4_CLK__NAND_WE_B      | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_D0__NAND_DATA00   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_D1__NAND_DATA01   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_D2__NAND_DATA02   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_D3__NAND_DATA03   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_D4__NAND_DATA04   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_D5__NAND_DATA05   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_D6__NAND_DATA06   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-	IOMUX_PADS(PAD_NANDF_D7__NAND_DATA07   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-};
-
-static void setup_gpmi_nand(void)
-{
-	struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
-
-	/* config gpmi nand iomux */
-	SETUP_IOMUX_PADS(nfc_pads);
-
-	/* config gpmi and bch clock to 100 MHz */
-	clrsetbits_le32(&mxc_ccm->cs2cdr,
-			MXC_CCM_CS2CDR_ENFC_CLK_PODF_MASK |
-			MXC_CCM_CS2CDR_ENFC_CLK_PRED_MASK |
-			MXC_CCM_CS2CDR_ENFC_CLK_SEL_MASK,
-			MXC_CCM_CS2CDR_ENFC_CLK_PODF(0) |
-			MXC_CCM_CS2CDR_ENFC_CLK_PRED(3) |
-			MXC_CCM_CS2CDR_ENFC_CLK_SEL(3));
-
-	/* enable gpmi and bch clock gating */
-	setbits_le32(&mxc_ccm->CCGR4,
-		     MXC_CCM_CCGR4_RAWNAND_U_BCH_INPUT_APB_MASK |
-		     MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_BCH_MASK |
-		     MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK |
-		     MXC_CCM_CCGR4_RAWNAND_U_GPMI_INPUT_APB_MASK |
-		     MXC_CCM_CCGR4_PL301_MX6QPER1_BCH_OFFSET);
-
-	/* enable apbh clock gating */
-	setbits_le32(&mxc_ccm->CCGR0, MXC_CCM_CCGR0_APBHDMA_MASK);
-}
-#endif
-
 static void setup_iomux_enet(int gpio)
 {
 	SETUP_IOMUX_PADS(enet_pads);
@@ -638,10 +590,6 @@ int board_init(void)
 	setup_ventana_i2c(0);
 	board_type = read_eeprom(CONFIG_I2C_GSC, &ventana_info);
 
-#ifdef CONFIG_CMD_NAND
-	if (gpio_cfg[board_type].nand)
-		setup_gpmi_nand();
-#endif
 #ifdef CONFIG_MXC_SPI
 	setup_spi();
 #endif
diff --git a/configs/gwventana_nand_defconfig b/configs/gwventana_nand_defconfig
index 533d31af9f..ea5ed052b5 100644
--- a/configs/gwventana_nand_defconfig
+++ b/configs/gwventana_nand_defconfig
@@ -87,8 +87,10 @@ CONFIG_SUPPORT_EMMC_RPMB=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_MXS=y
+CONFIG_NAND_MXS_DT=y
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
 CONFIG_MII=y
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index 1d68abda59..5754b6aef0 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -35,18 +35,8 @@
 /* Serial */
 #define CONFIG_MXC_UART_BASE	       UART2_BASE
 
-#if !defined(CONFIG_SPI_FLASH) && defined(CONFIG_SPL_NAND_SUPPORT)
-/* Enable NAND support */
-#ifdef CONFIG_CMD_NAND
-  #define CONFIG_SYS_MAX_NAND_DEVICE	1
-  #define CONFIG_SYS_NAND_BASE		0x40000000
-  #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-  #define CONFIG_SYS_NAND_ONFI_DETECTION
-
-  /* DMA stuff, needed for GPMI/MXS NAND support */
-#endif
-
-#endif /* CONFIG_SPI_FLASH */
+/* NAND */
+#define CONFIG_SYS_MAX_NAND_DEVICE	1
 
 /* I2C Configs */
 #define CONFIG_SYS_I2C
-- 
2.17.1

  parent reply	other threads:[~2021-03-01 22:33 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 22:33 [PATCH 00/11] imx: ventana: convert Gateworks Ventana to dm Tim Harvey
2021-03-01 22:33 ` [PATCH 01/11] spl: fit: nand: skip bad block handling if NAND chip not fully defined Tim Harvey
2021-03-02 13:28   ` Tom Rini
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 02/11] spl: fit: nand: allow for non-page-aligned elements Tim Harvey
2021-03-02 13:28   ` Tom Rini
2021-04-08 20:58   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 03/11] dt-bindings: add tda1997x and bindings Tim Harvey
2021-03-02 13:28   ` Tom Rini
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 04/11] imx: ventana: add Gateworks Ventana dts Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 05/11] arm: dts: imx6qdl-gw*: add dr_mode prop to dt to avoid error Tim Harvey
2021-04-05 21:27   ` Peter Robinson
2021-04-05 23:46     ` Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 06/11] imx: ventana: convert U-Boot to OF_CONTROL using FIT image Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
     [not found]   ` <606f6e37.1c69fb81.a6d7.559aSMTPIN_ADDED_MISSING@mx.google.com>
2021-04-09 19:52     ` Tim Harvey
2021-04-09 20:00       ` Stefano Babic
2021-04-09 20:08         ` Tim Harvey
2021-04-09 20:14           ` Tim Harvey
2021-04-10  0:32             ` Tim Harvey
2021-03-01 22:33 ` [PATCH 07/11] imx: ventana: add pinctrl and remove unneeded UART init and config Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 08/11] imx: ventana: enable dm support for USB Tim Harvey
2021-04-08 20:59   ` sbabic at denx.de
2021-03-01 22:33 ` [PATCH 09/11] imx: ventana: enable dm support for MMC and SATA Tim Harvey
2021-03-01 22:48   ` Peter Robinson
2021-03-02  0:19     ` Fabio Estevam
2021-03-02  1:41       ` Tim Harvey
2021-03-02 13:28         ` Tom Rini
2021-03-03  1:15     ` Kever Yang
2021-04-08 20:58   ` sbabic at denx.de
2021-03-01 22:33 ` Tim Harvey [this message]
2021-04-08 20:59   ` [PATCH 10/11] imx: ventana: enable dm for MTD and NAND sbabic at denx.de
2021-03-01 22:33 ` [PATCH 11/11] imx: ventana: enable dm for SPI Tim Harvey
2021-04-08 20:57   ` sbabic at denx.de
2021-03-25 13:59 ` [PATCH 00/11] imx: ventana: convert Gateworks Ventana to dm Tim Harvey

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=20210301223337.7763-11-tharvey@gateworks.com \
    --to=tharvey@gateworks.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