mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Alexander Shiyan <eagle.alexander923@gmail.com>,
	Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 4/4] ARM: at91: sama5d3: Migrate to MFD-based SMC driver
Date: Fri,  6 Nov 2026 12:13:50 +0100	[thread overview]
Message-ID: <20261106111352.3535034-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20261106111352.3535034-1-a.fatoum@pengutronix.de>

From: Alexander Shiyan <eagle.alexander923@gmail.com>

This replaces the low-level SMC driver implementation with the
MFD-based driver for SAMA5D3 platforms.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Tested-by: Ahmad Fatoum <a.fatoum@barebox.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 arch/arm/boards/sama5d3_xplained/board.c | 46 ------------------------
 arch/arm/mach-at91/Kconfig               |  1 -
 arch/arm/mach-at91/sam9_smc.c            |  5 +--
 3 files changed, 1 insertion(+), 51 deletions(-)

diff --git a/arch/arm/boards/sama5d3_xplained/board.c b/arch/arm/boards/sama5d3_xplained/board.c
index c6c1105e5eb5..a5530bc49acc 100644
--- a/arch/arm/boards/sama5d3_xplained/board.c
+++ b/arch/arm/boards/sama5d3_xplained/board.c
@@ -3,58 +3,12 @@
 #include <common.h>
 #include <init.h>
 #include <envfs.h>
-#include <mach/at91/at91sam9_smc.h>
-#include <mach/at91/hardware.h>
-#include <linux/clk.h>
-
-static struct sam9_smc_config sama5d3_xplained_nand_smc_config = {
-	.ncs_read_setup		= 1,
-	.nrd_setup		= 2,
-	.ncs_write_setup	= 1,
-	.nwe_setup		= 2,
-
-	.ncs_read_pulse		= 5,
-	.nrd_pulse		= 3,
-	.ncs_write_pulse	= 5,
-	.nwe_pulse		= 3,
-
-	.read_cycle		= 8,
-	.write_cycle		= 8,
-
-	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
-				  AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
-	.tdf_cycles		= 3,
-
-	.tclr			= 3,
-	.tadl			= 10,
-	.tar			= 3,
-	.ocms			= 0,
-	.trr			= 4,
-	.twb			= 5,
-	.rbnsel			= 3,
-	.nfsel			= 1
-};
 
 static int sama5d3_xplained_probe(struct device *dev)
 {
-	struct clk *clk;
-
 	if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC))
 		defaultenv_append_directory(defaultenv_sama5d3_xplained);
 
-	add_generic_device("at91sam9-smc", DEVICE_ID_SINGLE, NULL,
-			   SAMA5D3_BASE_HSMC + 0x600, 0xa0,
-			   IORESOURCE_MEM, NULL);
-
-	clk = clk_lookup("hsmc_clk");
-	if (IS_ERR(clk))
-		dev_warn(dev, "couldn't get hsmc_clk: %pe\n", clk);
-
-	clk_enable(clk);
-
-	/* configure chip-select 3 (NAND) */
-	sama5_smc_configure(0, 3, &sama5d3_xplained_nand_smc_config);
-
 	return 0;
 }
 
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index df20943254a9..fb55c9c2817f 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -107,7 +107,6 @@ config SOC_SAMA5D2
 config SOC_SAMA5D3
 	bool
 	select SOC_SAMA5
-	select AT91SAM9_SMC
 	select CLOCKSOURCE_ATMEL_PIT
 	select HAVE_AT91_SMD
 	select HAVE_AT91_USB_CLK
diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c
index 6c9e169a8e3e..66b30694ce96 100644
--- a/arch/arm/mach-at91/sam9_smc.c
+++ b/arch/arm/mach-at91/sam9_smc.c
@@ -14,8 +14,7 @@
 
 #define AT91_SAM9_SMC_CS_STRIDE		0x10
 #define AT91_SAMA5_SMC_CS_STRIDE	0x14
-#define AT91_SMC_CS_STRIDE	((at91_soc_initdata.type == AT91_SOC_SAMA5D3 \
-				 || at91_soc_initdata.type == AT91_SOC_SAMA5D4) \
+#define AT91_SMC_CS_STRIDE	((at91_soc_initdata.type == AT91_SOC_SAMA5D4) \
 				 ? AT91_SAMA5_SMC_CS_STRIDE : AT91_SAM9_SMC_CS_STRIDE)
 #define AT91_SMC_CS(id, n)	(smc_base_addr[id] + ((n) * AT91_SMC_CS_STRIDE))
 
@@ -27,7 +26,6 @@ static void sam9_smc_cs_write_mode(void __iomem *base,
 	void __iomem *mode_reg;
 
 	switch (at91_soc_initdata.type) {
-	case AT91_SOC_SAMA5D3:
 	case AT91_SOC_SAMA5D4:
 		mode_reg = base + AT91_SAMA5_SMC_MODE;
 		break;
@@ -101,7 +99,6 @@ static void sam9_smc_cs_read_mode(void __iomem *base,
 	void __iomem *mode_reg;
 
 	switch (at91_soc_initdata.type) {
-	case AT91_SOC_SAMA5D3:
 	case AT91_SOC_SAMA5D4:
 		mode_reg = base + AT91_SAMA5_SMC_MODE;
 		break;
-- 
2.47.3




  parent reply	other threads:[~2026-11-06 11:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 11:13 [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Ahmad Fatoum
2026-11-06 11:13 ` [PATCH 2/4] ARM: at91: sama5d3_xplained: drop invalid hostname Ahmad Fatoum
2026-11-06 11:13 ` [PATCH 3/4] pwm: atmel: look up the clock without a name Ahmad Fatoum
2026-11-06 11:13 ` Ahmad Fatoum [this message]
2026-11-09  9:52 ` [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Sascha Hauer

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=20261106111352.3535034-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    --cc=eagle.alexander923@gmail.com \
    /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