mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] mtd: nand: trim down NAND layer a bit
@ 2024-06-14 13:36 Sascha Hauer
  2024-06-14 13:36 ` [PATCH 1/3] mtd: nand: Kconfig: whitespace cleanups Sascha Hauer
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-06-14 13:36 UTC (permalink / raw)
  To: Barebox List

The NAND layer has become bigger with the last update causing size
constrained configs like am335x_mlo_defconfig to fail because the binary
gets too big.  Squeeze some bytes out of the binary space for such
configs by disabling some unneeded features.

Sascha Hauer (3):
  mtd: nand: Kconfig: whitespace cleanups
  mtd: nand: make exec_op optional
  mtd: nand: make interleaved placement optional

 drivers/mtd/nand/raw/Kconfig     | 33 +++++++++++++++++++++-----------
 drivers/mtd/nand/raw/internals.h |  5 +++++
 drivers/mtd/nand/raw/nand_base.c |  2 ++
 3 files changed, 29 insertions(+), 11 deletions(-)

-- 
2.39.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] mtd: nand: Kconfig: whitespace cleanups
  2024-06-14 13:36 [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer
@ 2024-06-14 13:36 ` Sascha Hauer
  2024-06-14 13:36 ` [PATCH 2/3] mtd: nand: make exec_op optional Sascha Hauer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-06-14 13:36 UTC (permalink / raw)
  To: Barebox List

Use tabs instead of spaces for indentation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/raw/Kconfig | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index cf65a90db1..a48670b190 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -147,19 +147,19 @@ config MTD_NAND_NOMADIK
 	  Driver for the NAND flash controller on the Nomadik, with ECC.
 
 config MTD_NAND_DENALI
-        tristate "Support Denali NAND controller"
-        depends on HAS_DMA
-        help
-          Enable support for the Denali NAND controller.  This should be
-          combined with either the PCI or platform drivers to provide device
-          registration.
+	tristate "Support Denali NAND controller"
+	depends on HAS_DMA
+	help
+	  Enable support for the Denali NAND controller.  This should be
+	  combined with either the PCI or platform drivers to provide device
+	  registration.
 
 config MTD_NAND_DENALI_DT
-        tristate "Support Denali NAND controller as a DT device"
-        depends on HAVE_CLK && MTD_NAND_DENALI
-        help
-          Enable the driver for NAND flash on platforms using a Denali NAND
-          controller as a DT device.
+	tristate "Support Denali NAND controller as a DT device"
+	depends on HAVE_CLK && MTD_NAND_DENALI
+	help
+	  Enable the driver for NAND flash on platforms using a Denali NAND
+	  controller as a DT device.
 
 if MTD_NAND_DENALI
 
-- 
2.39.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] mtd: nand: make exec_op optional
  2024-06-14 13:36 [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer
  2024-06-14 13:36 ` [PATCH 1/3] mtd: nand: Kconfig: whitespace cleanups Sascha Hauer
@ 2024-06-14 13:36 ` Sascha Hauer
  2024-06-14 13:36 ` [PATCH 3/3] mtd: nand: make interleaved placement optional Sascha Hauer
  2024-06-18  6:13 ` [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-06-14 13:36 UTC (permalink / raw)
  To: Barebox List

While exec_op is the way to go for new drivers, not all drivers use it
yet. Make support for it optional to safe a few bytes of binary space
when only drivers without exec_op are compiled in.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/raw/Kconfig     | 7 +++++++
 drivers/mtd/nand/raw/internals.h | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index a48670b190..e9d1b83706 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -32,12 +32,16 @@ config NAND_ALLOW_ERASE_BAD
 	  to '1' it will be allowed to erase bad blocks. This is a potientially
 	  dangerous operation, so if unsure say no to this option.
 
+config NAND_NEED_EXEC_OP
+	bool
+
 comment "Raw/parallel NAND flash controllers"
 
 config NAND_IMX
 	bool
 	prompt "i.MX21 to 53 NAND driver aka 'mxc', for NFC"
 	depends on ARCH_IMX
+	select NAND_NEED_EXEC_OP
 	help
 	  Support for NAND flash on Freescale/NXP i.MX devices.  This is for the
 	  "MXC" series:  i.MX21/25/27/31/35/51/53.
@@ -104,6 +108,7 @@ config NAND_STM32
 	select STM32_FMC2_EBI if ARCH_STM32MP
 	select RESET_CONTROLLER if ARCH_STM32MP
 	select RESET_SIMPLE if ARCH_STM32MP
+	select NAND_NEED_EXEC_OP
 	help
 	  Enables support for NAND Flash chips on SoCs containing the FMC2
 	  NAND controller. This controller is found on STM32MP SoCs.
@@ -114,6 +119,7 @@ config NAND_ATMEL
 	bool
 	prompt "Atmel (AT91SAM9xxx) NAND driver"
 	select GENERIC_ALLOCATOR if OFDEVICE
+	select NAND_NEED_EXEC_OP
 	depends on ARCH_AT91 || (OFDEVICE && COMPILE_TEST)
 
 config NAND_ATMEL_LEGACY
@@ -149,6 +155,7 @@ config MTD_NAND_NOMADIK
 config MTD_NAND_DENALI
 	tristate "Support Denali NAND controller"
 	depends on HAS_DMA
+	select NAND_NEED_EXEC_OP
 	help
 	  Enable support for the Denali NAND controller.  This should be
 	  combined with either the PCI or platform drivers to provide device
diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h
index 6dab25ecab..191244801b 100644
--- a/drivers/mtd/nand/raw/internals.h
+++ b/drivers/mtd/nand/raw/internals.h
@@ -118,6 +118,11 @@ static inline bool nand_has_exec_op(struct nand_chip *chip)
 	    !chip->controller->ops->exec_op)
 		return false;
 
+	if (!IS_ENABLED(CONFIG_NAND_NEED_EXEC_OP)) {
+		pr_err("driver needs exec_op, but CONFIG_NAND_NEED_EXEC_OP is disabled\n");
+		return false;
+	}
+
 	return true;
 }
 
-- 
2.39.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] mtd: nand: make interleaved placement optional
  2024-06-14 13:36 [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer
  2024-06-14 13:36 ` [PATCH 1/3] mtd: nand: Kconfig: whitespace cleanups Sascha Hauer
  2024-06-14 13:36 ` [PATCH 2/3] mtd: nand: make exec_op optional Sascha Hauer
@ 2024-06-14 13:36 ` Sascha Hauer
  2024-06-18  6:13 ` [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-06-14 13:36 UTC (permalink / raw)
  To: Barebox List

Currently only one driver in the tree (denali.c) needs interleaved
layout support. Make support for it optional to safe a few bytes
of binary space when interleaved support is not needed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/raw/Kconfig     | 4 ++++
 drivers/mtd/nand/raw/nand_base.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index e9d1b83706..b6c6e62731 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -35,6 +35,9 @@ config NAND_ALLOW_ERASE_BAD
 config NAND_NEED_EXEC_OP
 	bool
 
+config NAND_NEED_ECC_PLACEMENT_INTERLEAVED
+	bool
+
 comment "Raw/parallel NAND flash controllers"
 
 config NAND_IMX
@@ -156,6 +159,7 @@ config MTD_NAND_DENALI
 	tristate "Support Denali NAND controller"
 	depends on HAS_DMA
 	select NAND_NEED_EXEC_OP
+	select NAND_NEED_ECC_PLACEMENT_INTERLEAVED
 	help
 	  Enable support for the Denali NAND controller.  This should be
 	  combined with either the PCI or platform drivers to provide device
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index cf4d510211..5ab5e9e03a 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -5671,6 +5671,8 @@ static int nand_set_ecc_on_host_ops(struct nand_chip *chip)
 		fallthrough;
 
 	case NAND_ECC_PLACEMENT_INTERLEAVED:
+		if (!IS_ENABLED(CONFIG_NAND_NEED_ECC_PLACEMENT_INTERLEAVED))
+			break;
 		if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) &&
 		    (!ecc->read_page ||
 		     ecc->read_page == nand_read_page_hwecc ||
-- 
2.39.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] mtd: nand: trim down NAND layer a bit
  2024-06-14 13:36 [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer
                   ` (2 preceding siblings ...)
  2024-06-14 13:36 ` [PATCH 3/3] mtd: nand: make interleaved placement optional Sascha Hauer
@ 2024-06-18  6:13 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-06-18  6:13 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Fri, 14 Jun 2024 15:36:00 +0200, Sascha Hauer wrote:
> The NAND layer has become bigger with the last update causing size
> constrained configs like am335x_mlo_defconfig to fail because the binary
> gets too big.  Squeeze some bytes out of the binary space for such
> configs by disabling some unneeded features.
> 
> Sascha Hauer (3):
>   mtd: nand: Kconfig: whitespace cleanups
>   mtd: nand: make exec_op optional
>   mtd: nand: make interleaved placement optional
> 
> [...]

Applied, thanks!

[1/3] mtd: nand: Kconfig: whitespace cleanups
      https://git.pengutronix.de/cgit/barebox/commit/?id=eb6429a2b87b (link may not be stable)
[2/3] mtd: nand: make exec_op optional
      https://git.pengutronix.de/cgit/barebox/commit/?id=0958c15cebd7 (link may not be stable)
[3/3] mtd: nand: make interleaved placement optional
      https://git.pengutronix.de/cgit/barebox/commit/?id=d1fe68f1b010 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-18  6:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-14 13:36 [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer
2024-06-14 13:36 ` [PATCH 1/3] mtd: nand: Kconfig: whitespace cleanups Sascha Hauer
2024-06-14 13:36 ` [PATCH 2/3] mtd: nand: make exec_op optional Sascha Hauer
2024-06-14 13:36 ` [PATCH 3/3] mtd: nand: make interleaved placement optional Sascha Hauer
2024-06-18  6:13 ` [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox