Skip to contentSkip to conversation

mtd: spi-nor: controllers: intel-spi: Add support for command line partitions

PATCH In review Ronald G. Minnich 6 participants 6 messages Apr 17, 2020 – Jan 4, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: spi-nor: controllers: intel-spi: Add support for command line partitions

On Intel platforms, the usable SPI area is located several MiB in from the start, to leave room for descriptors and the Management Engine binary. Further, not all the remaining space can be used, as the last 16 MiB contains firmware.

To make the SPI usable for mtdblock and other devices, it is necessary to enable command line partitions so the middle usable region can be specified.

Add a part_probes array which includes only "cmdelineparts", and change to mtd_device_parse_register to use this part_probes.

---
 drivers/mtd/spi-nor/controllers/intel-spi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/controllers/intel-spi.c +4 -1
index 61d2a0ad2131..132129e89d07 100644
@@ -894,6 +894,8 @@ static const struct spi_nor_controller_ops intel_spi_controller_ops = {
 	.erase = intel_spi_erase,
 };
 
+static const char * const part_probes[] = { "cmdlinepart", NULL };
+
 struct intel_spi *intel_spi_probe(struct device *dev,
 	struct resource *mem, const struct intel_spi_boardinfo *info)
 {
@@ -941,7 +943,8 @@ struct intel_spi *intel_spi_probe(struct device *dev,
 	if (!ispi->writeable || !writeable)
 		ispi->nor.mtd.flags &= ~MTD_WRITEABLE;
 
-	ret = mtd_device_register(&ispi->nor.mtd, &part, 1);
+	ret = mtd_device_parse_register(&ispi->nor.mtd, part_probes,
+				       NULL, &part, 1);
 	if (ret)
 		return ERR_PTR(ret);
 
Signature · 1 line
2.26.1.301.g55bc3eb7cb9-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Ronald G. Minnich

On Intel platforms, the usable SPI area is located several MiB in from the start, to leave room for descriptors and the Management Engine binary. Further, not all the remaining space can be used, as the last 16 MiB contains firmware.

Quoted 8 lines

To make the SPI usable for mtdblock and other devices, it is necessary to enable command line partitions so the middle usable region can be specified.

Add a part_probes array which includes only "cmdelineparts", and change to mtd_device_parse_register to use this part_probes.

#2 lore raw
Quoted 10 lines · Mika Westerberg
Quoted 9 lines · Ronald G. Minnich

On Intel platforms, the usable SPI area is located several MiB in from the start, to leave room for descriptors and the Management Engine binary. Further, not all the remaining space can be used, as the last 16 MiB contains firmware.

To make the SPI usable for mtdblock and other devices, it is necessary to enable command line partitions so the middle usable region can be specified.

Quoted 7 lines
Quoted 4 lines

Add a part_probes array which includes only "cmdelineparts", and change to mtd_device_parse_register to use this part_probes.

scripts/checkpatch.pl --strict complains:

CHECK: Alignment should match open parenthesis #46: FILE: drivers/mtd/spi-nor/controllers/intel-spi.c:956:
+ ret = mtd_device_parse_register(&ispi->nor.mtd, part_probes,
+ NULL, &part, 1);

WARNING: Missing Signed-off-by: line by nominal patch author '"Ronald G. Minnich" <[email protected]>'

Regards
Vignesh

#3 lore raw

PATCH 1/1 mtd: parser: cmdline: Support MTD names containing one or more colons

On Intel platforms, the usable SPI area is located several MiB in from the start, to leave room for descriptors and the Management Engine binary. Further, not all the remaining space can be used, as the last 16 MiB contains firmware.

To make the SPI usable for mtdblock and other devices, it is necessary to enable command line partitions so the middle usable region can be specified.

Add a part_probes array which includes only "cmdelineparts", and change to mtd_device_parse_register to use this part_probes.

---
 drivers/mtd/spi-nor/controllers/intel-spi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/controllers/intel-spi.c +4 -1
index b54a56a68100..9de38851c411 100644
@@ -903,6 +903,8 @@ static const struct spi_nor_controller_ops intel_spi_controller_ops = {
 	.erase = intel_spi_erase,
 };
 
+static const char * const part_probes[] = { "cmdlinepart", NULL };
+
 struct intel_spi *intel_spi_probe(struct device *dev,
 	struct resource *mem, const struct intel_spi_boardinfo *info)
 {
@@ -950,7 +952,8 @@ struct intel_spi *intel_spi_probe(struct device *dev,
 	if (!ispi->writeable || !writeable)
 		ispi->nor.mtd.flags &= ~MTD_WRITEABLE;
 
-	ret = mtd_device_register(&ispi->nor.mtd, &part, 1);
+	ret = mtd_device_parse_register(&ispi->nor.mtd, part_probes,
+					NULL, &part, 1);
 	if (ret)
 		return ERR_PTR(ret);
 
Signature · 1 line
2.29.2.729.g45daf8777d-goog
maintainer
#4 lore raw

Re: [PATCH] mtd: parser: cmdline: Support MTD names containing one or more colons

Hello Ian,

Ian Goegebuer <[email protected]> wrote on Wed, 23 Dec 2020 13:56:30 -0800:

Quoted 11 lines

On Intel platforms, the usable SPI area is located several MiB in from the start, to leave room for descriptors and the Management Engine binary. Further, not all the remaining space can be used, as the last 16 MiB contains firmware.

To make the SPI usable for mtdblock and other devices, it is necessary to enable command line partitions so the middle usable region can be specified.

Add a part_probes array which includes only "cmdelineparts", and change to mtd_device_parse_register to use this part_probes.

The commit title seem to be taken from another patch and does not match the below change. Or am I missing something?

Quoted 20 lines
---
 drivers/mtd/spi-nor/controllers/intel-spi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/controllers/intel-spi.c +2 -0
index b54a56a68100..9de38851c411 100644
@@ -903,6 +903,8 @@ static const struct spi_nor_controller_ops intel_spi_controller_ops = {
 	.erase = intel_spi_erase,
 };
 
+static const char * const part_probes[] = { "cmdlinepart", NULL };
+
 struct intel_spi *intel_spi_probe(struct device *dev,
 	struct resource *mem, const struct intel_spi_boardinfo *info)
 {

drivers/mtd/spi-nor/controllers/intel-spi.c struct intel_spi *intel_spi_probe(struct device *dev, · line 959

Quoted 9 lines
drivers/mtd/spi-nor/controllers/intel-spi.c +2 -1
@@ -950,7 +952,8 @@ struct intel_spi *intel_spi_probe(struct device *dev,
 	if (!ispi->writeable || !writeable)
 		ispi->nor.mtd.flags &= ~MTD_WRITEABLE;
 
-	ret = mtd_device_register(&ispi->nor.mtd, &part, 1);
+	ret = mtd_device_parse_register(&ispi->nor.mtd, part_probes,
+					NULL, &part, 1);
 	if (ret)
 		return ERR_PTR(ret);
 

Thanks,
Miquèl

#5 lore raw

Re: [PATCH] mtd: parser: cmdline: Support MTD names containing one or more colons

It is likely we're missing something -- I am not fully checked out on the Linux patch process and it's Ian's first patch.

Guidance appreciated.

Quoted 53 lines · Miquel Raynal

Hello Ian,

Ian Goegebuer <[email protected]> wrote on Wed, 23 Dec 2020 13:56:30 -0800:

Quoted 11 lines

On Intel platforms, the usable SPI area is located several MiB in from the start, to leave room for descriptors and the Management Engine binary. Further, not all the remaining space can be used, as the last 16 MiB contains firmware.

To make the SPI usable for mtdblock and other devices, it is necessary to enable command line partitions so the middle usable region can be specified.

Add a part_probes array which includes only "cmdelineparts", and change to mtd_device_parse_register to use this part_probes.

The commit title seem to be taken from another patch and does not match the below change. Or am I missing something?

Quoted 20 lines
---
 drivers/mtd/spi-nor/controllers/intel-spi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/controllers/intel-spi.c +2 -0
index b54a56a68100..9de38851c411 100644
@@ -903,6 +903,8 @@ static const struct spi_nor_controller_ops intel_spi_controller_ops = {
      .erase = intel_spi_erase,
 };
 
+static const char * const part_probes[] = { "cmdlinepart", NULL };
+
 struct intel_spi *intel_spi_probe(struct device *dev,
      struct resource *mem, const struct intel_spi_boardinfo *info)
 {

drivers/mtd/spi-nor/controllers/intel-spi.c struct intel_spi *intel_spi_probe(struct device *dev, · line 959

Quoted 9 lines
drivers/mtd/spi-nor/controllers/intel-spi.c +2 -1
@@ -950,7 +952,8 @@ struct intel_spi *intel_spi_probe(struct device *dev,
      if (!ispi->writeable || !writeable)
              ispi->nor.mtd.flags &= ~MTD_WRITEABLE;
 
-     ret = mtd_device_register(&ispi->nor.mtd, &part, 1);
+     ret = mtd_device_parse_register(&ispi->nor.mtd, part_probes,
+                                     NULL, &part, 1);
      if (ret)
              return ERR_PTR(ret);
 

Thanks,
Miquèl