Skip to contentSkip to conversation

mtd: spi-nor: cqspi: Fix build on arches missing readsl/writesl

PATCH Applied Marek Vasut 2 participants 4 messages Aug 2, 2016 – Nov 30, 2016

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

PATCH 1/1 mtd: spi-nor: cqspi: Fix build on arches missing readsl/writesl

The x86-64 and some other architectures are missing readsl/writesl functions, so this driver won't build on them. Use a more portable ioread32_rep()/iowrite32_rep() instead.

Cc Alan Tull <[email protected]>
Cc Brian Norris <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Graham Moore <[email protected]>
Cc Vignesh R <[email protected]>
Cc Yves Vandervennet <[email protected]>
---
 drivers/mtd/spi-nor/Kconfig           | 2 +-
 drivers/mtd/spi-nor/cadence-quadspi.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/spi-nor/Kconfig +1 -1
index 4a682ee..1e6f037 100644
@@ -40,7 +40,7 @@ config SPI_ATMEL_QUADSPI
 
 config SPI_CADENCE_QUADSPI
 	tristate "Cadence Quad SPI controller"
-	depends on OF && ARM
+	depends on OF && (ARM || COMPILE_TEST)
 	help
 	  Enable support for the Cadence Quad SPI Flash controller.
 
drivers/mtd/spi-nor/cadence-quadspi.c +4 -2
index d403ba7..08c9483 100644
@@ -526,7 +526,8 @@ static int cqspi_indirect_read_execute(struct spi_nor *nor,
 			bytes_to_read *= cqspi->fifo_width;
 			bytes_to_read = bytes_to_read > remaining ?
 					remaining : bytes_to_read;
-			readsl(ahb_base, rxbuf, DIV_ROUND_UP(bytes_to_read, 4));
+			ioread32_rep(ahb_base, rxbuf,
+				     DIV_ROUND_UP(bytes_to_read, 4));
 			rxbuf += bytes_to_read;
 			remaining -= bytes_to_read;
 			bytes_to_read = cqspi_get_rd_sram_level(cqspi);
@@ -610,7 +611,8 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor,
 
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
-		writesl(cqspi->ahb_base, txbuf, DIV_ROUND_UP(write_bytes, 4));
+		iowrite32_rep(cqspi->ahb_base, txbuf,
+			      DIV_ROUND_UP(write_bytes, 4));
 
 		ret = wait_for_completion_timeout(&cqspi->transfer_complete,
 						  msecs_to_jiffies
Signature · 1 line
2.8.1
#1 lore raw
Quoted 13 lines · Marek Vasut

The x86-64 and some other architectures are missing readsl/writesl functions, so this driver won't build on them. Use a more portable ioread32_rep()/iowrite32_rep() instead.

Cc Alan Tull <[email protected]>
Cc Brian Norris <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Graham Moore <[email protected]>
Cc Vignesh R <[email protected]>
Cc Yves Vandervennet <[email protected]>
Quoted 1 line

---

Bump ?

Quoted 42 lines
 drivers/mtd/spi-nor/Kconfig           | 2 +-
 drivers/mtd/spi-nor/cadence-quadspi.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/spi-nor/Kconfig +1 -1
index 4a682ee..1e6f037 100644
@@ -40,7 +40,7 @@ config SPI_ATMEL_QUADSPI
 
 config SPI_CADENCE_QUADSPI
 	tristate "Cadence Quad SPI controller"
-	depends on OF && ARM
+	depends on OF && (ARM || COMPILE_TEST)
 	help
 	  Enable support for the Cadence Quad SPI Flash controller.
 
drivers/mtd/spi-nor/cadence-quadspi.c +4 -2
index d403ba7..08c9483 100644
@@ -526,7 +526,8 @@ static int cqspi_indirect_read_execute(struct spi_nor *nor,
 			bytes_to_read *= cqspi->fifo_width;
 			bytes_to_read = bytes_to_read > remaining ?
 					remaining : bytes_to_read;
-			readsl(ahb_base, rxbuf, DIV_ROUND_UP(bytes_to_read, 4));
+			ioread32_rep(ahb_base, rxbuf,
+				     DIV_ROUND_UP(bytes_to_read, 4));
 			rxbuf += bytes_to_read;
 			remaining -= bytes_to_read;
 			bytes_to_read = cqspi_get_rd_sram_level(cqspi);
@@ -610,7 +611,8 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor,
 
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
-		writesl(cqspi->ahb_base, txbuf, DIV_ROUND_UP(write_bytes, 4));
+		iowrite32_rep(cqspi->ahb_base, txbuf,
+			      DIV_ROUND_UP(write_bytes, 4));
 
 		ret = wait_for_completion_timeout(&cqspi->transfer_complete,
 						  msecs_to_jiffies
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw
In reply to Marek Vasut
Quoted 4 lines · Marek Vasut

The x86-64 and some other architectures are missing readsl/writesl functions, so this driver won't build on them. Use a more portable ioread32_rep()/iowrite32_rep() instead.

Quoted 9 lines
Cc Alan Tull <[email protected]>
Cc Brian Norris <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Graham Moore <[email protected]>
Cc Vignesh R <[email protected]>
Cc Yves Vandervennet <[email protected]>

Maybe you can review and pick this one finally ?

Quoted 43 lines
---
 drivers/mtd/spi-nor/Kconfig           | 2 +-
 drivers/mtd/spi-nor/cadence-quadspi.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/spi-nor/Kconfig +1 -1
index 4a682ee..1e6f037 100644
@@ -40,7 +40,7 @@ config SPI_ATMEL_QUADSPI
 
 config SPI_CADENCE_QUADSPI
 	tristate "Cadence Quad SPI controller"
-	depends on OF && ARM
+	depends on OF && (ARM || COMPILE_TEST)
 	help
 	  Enable support for the Cadence Quad SPI Flash controller.
 
drivers/mtd/spi-nor/cadence-quadspi.c +4 -2
index d403ba7..08c9483 100644
@@ -526,7 +526,8 @@ static int cqspi_indirect_read_execute(struct spi_nor *nor,
 			bytes_to_read *= cqspi->fifo_width;
 			bytes_to_read = bytes_to_read > remaining ?
 					remaining : bytes_to_read;
-			readsl(ahb_base, rxbuf, DIV_ROUND_UP(bytes_to_read, 4));
+			ioread32_rep(ahb_base, rxbuf,
+				     DIV_ROUND_UP(bytes_to_read, 4));
 			rxbuf += bytes_to_read;
 			remaining -= bytes_to_read;
 			bytes_to_read = cqspi_get_rd_sram_level(cqspi);
@@ -610,7 +611,8 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor,
 
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
-		writesl(cqspi->ahb_base, txbuf, DIV_ROUND_UP(write_bytes, 4));
+		iowrite32_rep(cqspi->ahb_base, txbuf,
+			      DIV_ROUND_UP(write_bytes, 4));
 
 		ret = wait_for_completion_timeout(&cqspi->transfer_complete,
 						  msecs_to_jiffies
#3 lore raw
In reply to Marek Vasut
Quoted 4 lines · Marek Vasut

The x86-64 and some other architectures are missing readsl/writesl functions, so this driver won't build on them. Use a more portable ioread32_rep()/iowrite32_rep() instead.

Quoted 9 lines
Cc Alan Tull <[email protected]>
Cc Brian Norris <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Graham Moore <[email protected]>
Cc Vignesh R <[email protected]>
Cc Yves Vandervennet <[email protected]>

Applied to git://github.com/spi-nor/linux.git

Thanks!

Quoted 43 lines
---
 drivers/mtd/spi-nor/Kconfig           | 2 +-
 drivers/mtd/spi-nor/cadence-quadspi.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/spi-nor/Kconfig +1 -1
index 4a682ee..1e6f037 100644
@@ -40,7 +40,7 @@ config SPI_ATMEL_QUADSPI
 
 config SPI_CADENCE_QUADSPI
 	tristate "Cadence Quad SPI controller"
-	depends on OF && ARM
+	depends on OF && (ARM || COMPILE_TEST)
 	help
 	  Enable support for the Cadence Quad SPI Flash controller.
 
drivers/mtd/spi-nor/cadence-quadspi.c +4 -2
index d403ba7..08c9483 100644
@@ -526,7 +526,8 @@ static int cqspi_indirect_read_execute(struct spi_nor *nor,
 			bytes_to_read *= cqspi->fifo_width;
 			bytes_to_read = bytes_to_read > remaining ?
 					remaining : bytes_to_read;
-			readsl(ahb_base, rxbuf, DIV_ROUND_UP(bytes_to_read, 4));
+			ioread32_rep(ahb_base, rxbuf,
+				     DIV_ROUND_UP(bytes_to_read, 4));
 			rxbuf += bytes_to_read;
 			remaining -= bytes_to_read;
 			bytes_to_read = cqspi_get_rd_sram_level(cqspi);
@@ -610,7 +611,8 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor,
 
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
-		writesl(cqspi->ahb_base, txbuf, DIV_ROUND_UP(write_bytes, 4));
+		iowrite32_rep(cqspi->ahb_base, txbuf,
+			      DIV_ROUND_UP(write_bytes, 4));
 
 		ret = wait_for_completion_timeout(&cqspi->transfer_complete,
 						  msecs_to_jiffies