From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 14:20:10
Hello,
A bit of context to explain the motivation behind those conversions
I've been sending for the last few weeks. The raw NAND subsystem
carries a lot of history which makes any rework not only painful, but
also subject to regressions which we only detect when someone dares to
update its kernel on one of those ancient HW. While carrying drivers
for old HW is not a problem per se, carrying ancient and unmaintained
drivers that are not converted to new APIs is a maintenance burden,
hence this massive conversion attempt I'm conducting here.
So here is a series converting the FSM UPM NAND controller driver to
exec_op(), plus a bunch of minor improvements done along the way.
I hope I'll find someone to test those changes, but if there's no one
still having access to this HW or no interest in keeping it supported
in recent kernel versions, we should definitely consider removing the
driver instead.
Regards,
Boris
Boris Brezillon (10):
mtd: rawnand: fsl_upm: Remove unused mtd var
mtd: rawnand: fsl_upm: Get rid of the unused fsl_upm_nand.parts field
mtd: rawnand: fsl_upm: Allocate the fsl_upm_nand object using
devm_kzalloc()
mtd: rawnand: fsl_upm: Use devm_kasprintf() to allocate the MTD name
mtd: rawnand: fsl_upm: Use platform_get_resource() +
devm_ioremap_resource()
mtd: rawnand: fsl_upm: Use gpio descriptors
mtd: rawnand: fsl_upm: Inherit from nand_controller
mtd: rawnand: fsl_upm: Implement exec_op()
mtd: rawnand: fsl_upm: Get rid of the legacy interface implementation
dt-bindings: mtd: fsl-upm-nand: Deprecate chip-delay and
fsl,upm-wait-flags
.../devicetree/bindings/mtd/fsl-upm-nand.txt | 10 +-
drivers/mtd/nand/raw/fsl_upm.c | 311 +++++++-----------
2 files changed, 117 insertions(+), 204 deletions(-)
--
2.25.4
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 13:52:30
And I forgot to Cc the DT maintainer/ML on this one :-/
On Wed, 3 Jun 2020 15:49:22 +0200
Boris Brezillon [off-list ref] wrote:
quoted hunk
Those properties are no longer parsed by the driver which is being passed
those information by the core now. Let's deprecate them.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
@@ -7,14 +7,16 @@ Required properties: - fsl,upm-cmd-offset : UPM pattern offset for the command latch. Optional properties:-- fsl,upm-wait-flags : add chip-dependent short delays after running the- UPM pattern (0x1), after writing a data byte (0x2) or after- writing out a buffer (0x4). - fsl,upm-addr-line-cs-offsets : address offsets for multi-chip support. The corresponding address lines are used to select the chip. - gpios : may specify optional GPIOs connected to the Ready-Not-Busy pins (R/B#). For multi-chip devices, "n" GPIO definitions are required according to the number of chips.++Deprecated properties:+- fsl,upm-wait-flags : add chip-dependent short delays after running the+ UPM pattern (0x1), after writing a data byte (0x2) or after+ writing out a buffer (0x4). - chip-delay : chip dependent delay for transferring data from array to read registers (tR). Required if property "gpios" is not used (R/B# pins not connected).
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 14:09:33
Replace the of_address_to_resource() + devm_ioremap() calls by
platform_get_resource() + devm_ioremap_resource() ones which allows us
to get rid of one error message since devm_ioremap_resource() already
takes care of that.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 14:12:49
The integer-based GPIO ids are now deprecated in favor of the GPIO desc
API. The PPC platforms have already been converted to GPIOLIB, so let's
use gpio descs in the NAND driver too.
While at it, we use devm_gpiod_get_index_optional() so we can get rid
of the manual gpio desc release done in the init error path and in the
remove function.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 44 ++++++++--------------------------
1 file changed, 10 insertions(+), 34 deletions(-)
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 14:16:36
fsl_upm_nand.parts is unused, let's get rid of it.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 1 -
1 file changed, 1 deletion(-)
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 14:24:04
Now that the driver implements exec_op(), we can get rid of the legacy
interface implementation.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 133 ---------------------------------
1 file changed, 133 deletions(-)
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 14:27:00
The mtd var in fun_wait_rnb() is now unused, let's get rid of it and
fix the warning resulting from this unused var.
Fixes: 50a487e7719c ("mtd: rawnand: Pass a nand_chip object to chip->dev_ready()")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 1 -
1 file changed, 1 deletion(-)
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 14:29:35
Explicitly inherit from nand_controller instead of relying on the
nand_chip.legacy.dummy_controller field.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 3 +++
1 file changed, 3 insertions(+)
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 14:36:35
Implement exec_op() so we can get rid of the legacy interface
implementation.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 86 ++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 14:47:44
Those properties are no longer parsed by the driver which is being passed
those information by the core now. Let's deprecate them.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
@@ -7,14 +7,16 @@ Required properties: - fsl,upm-cmd-offset : UPM pattern offset for the command latch. Optional properties:-- fsl,upm-wait-flags : add chip-dependent short delays after running the- UPM pattern (0x1), after writing a data byte (0x2) or after- writing out a buffer (0x4). - fsl,upm-addr-line-cs-offsets : address offsets for multi-chip support. The corresponding address lines are used to select the chip. - gpios : may specify optional GPIOs connected to the Ready-Not-Busy pins (R/B#). For multi-chip devices, "n" GPIO definitions are required according to the number of chips.++Deprecated properties:+- fsl,upm-wait-flags : add chip-dependent short delays after running the+ UPM pattern (0x1), after writing a data byte (0x2) or after+ writing out a buffer (0x4). - chip-delay : chip dependent delay for transferring data from array to read registers (tR). Required if property "gpios" is not used (R/B# pins not connected).
Boris Brezillon [off-list ref] wrote on Wed, 3 Jun
2020 15:49:17 +0200:
quoted hunk
Replace the of_address_to_resource() + devm_ioremap() calls by
platform_get_resource() + devm_ioremap_resource() ones which allows us
to get rid of one error message since devm_ioremap_resource() already
takes care of that.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
Boris Brezillon [off-list ref] wrote on Wed, 3 Jun
2020 15:49:13 +0200:
quoted hunk
The mtd var in fun_wait_rnb() is now unused, let's get rid of it and
fix the warning resulting from this unused var.
Fixes: 50a487e7719c ("mtd: rawnand: Pass a nand_chip object to chip->dev_ready()")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 1 -
1 file changed, 1 deletion(-)
Boris Brezillon [off-list ref] wrote on Wed, 3 Jun
2020 15:49:14 +0200:
quoted hunk
fsl_upm_nand.parts is unused, let's get rid of it.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 1 -
1 file changed, 1 deletion(-)
Boris Brezillon [off-list ref] wrote on Wed, 3 Jun
2020 15:49:18 +0200:
The integer-based GPIO ids are now deprecated in favor of the GPIO desc
API. The PPC platforms have already been converted to GPIOLIB, so let's
use gpio descs in the NAND driver too.
While at it, we use devm_gpiod_get_index_optional() so we can get rid
of the manual gpio desc release done in the init error path and in the
remove function.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 44 ++++++++--------------------------
1 file changed, 10 insertions(+), 34 deletions(-)
From: Boris Brezillon <boris.brezillon@collabora.com> Date: 2020-06-03 15:09:52
On Wed, 3 Jun 2020 15:58:02 +0200
Miquel Raynal [off-list ref] wrote:
Boris Brezillon [off-list ref] wrote on Wed, 3 Jun
2020 15:49:17 +0200:
quoted
Replace the of_address_to_resource() + devm_ioremap() calls by
platform_get_resource() + devm_ioremap_resource() ones which allows us
to get rid of one error message since devm_ioremap_resource() already
takes care of that.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
Boris Brezillon [off-list ref] wrote on Wed, 3 Jun
2020 15:49:19 +0200:
quoted hunk
Explicitly inherit from nand_controller instead of relying on the
nand_chip.legacy.dummy_controller field.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 3 +++
1 file changed, 3 insertions(+)
Boris Brezillon [off-list ref] wrote on Wed, 3 Jun
2020 15:49:20 +0200:
quoted hunk
Implement exec_op() so we can get rid of the legacy interface
implementation.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/mtd/nand/raw/fsl_upm.c | 86 ++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
On Wed, 2020-06-03 at 13:49:21 UTC, Boris Brezillon wrote:
Now that the driver implements exec_op(), we can get rid of the legacy
interface implementation.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
On Wed, 2020-06-03 at 13:49:20 UTC, Boris Brezillon wrote:
Implement exec_op() so we can get rid of the legacy interface
implementation.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
On Wed, 2020-06-03 at 13:49:19 UTC, Boris Brezillon wrote:
Explicitly inherit from nand_controller instead of relying on the
nand_chip.legacy.dummy_controller field.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
On Wed, 2020-06-03 at 13:49:18 UTC, Boris Brezillon wrote:
The integer-based GPIO ids are now deprecated in favor of the GPIO desc
API. The PPC platforms have already been converted to GPIOLIB, so let's
use gpio descs in the NAND driver too.
While at it, we use devm_gpiod_get_index_optional() so we can get rid
of the manual gpio desc release done in the init error path and in the
remove function.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
On Wed, 2020-06-03 at 13:49:17 UTC, Boris Brezillon wrote:
Replace the of_address_to_resource() + devm_ioremap() calls by
platform_get_resource() + devm_ioremap_resource() ones which allows us
to get rid of one error message since devm_ioremap_resource() already
takes care of that.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
On Wed, 2020-06-03 at 13:49:15 UTC, Boris Brezillon wrote:
This simplifies the init error patch and remove function.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
On Wed, 2020-06-03 at 13:49:14 UTC, Boris Brezillon wrote:
fsl_upm_nand.parts is unused, let's get rid of it.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
On Wed, 2020-06-03 at 13:49:13 UTC, Boris Brezillon wrote:
The mtd var in fun_wait_rnb() is now unused, let's get rid of it and
fix the warning resulting from this unused var.
Fixes: 50a487e7719c ("mtd: rawnand: Pass a nand_chip object to chip->dev_ready()")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
On Wed, 2020-06-03 at 13:49:22 UTC, Boris Brezillon wrote:
Those properties are no longer parsed by the driver which is being passed
those information by the core now. Let's deprecate them.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>