Skip to contentSkip to conversation

Add support for SPI based DataImage LCD panel

PATCH Superseded Nikita Kiryanov 3 participants 19 messages Oct 16, 2013 – Nov 12, 2013

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

v2 cover Add support for SPI based DataImage LCD panel

This patch ports the Linux driver for DataImage SCF0403852GGU04 and SCF0403526GGU20 LCD panels into U-Boot. As a preparation step, variable SPI word length support is added to omap3_spi and the generic SPI interface. Finally, the driver is used in cm_t35 board.

The SPI changes were tested with a Beagle I2C/SPI/MDIO Protocol Analyzer, and also with a DataImage SCF0403 lcd as part of the DataImage driver test.

Patch number 6 depends on http://patchwork.ozlabs.org/patch/275283/

Cc Tom Rini <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>

Changes in V2:
- Rebased on top of latest U-Boot
- New patches:
1) spi: omap3: remove semicolon from #define
2) spi: define SPI_XFER_ONCE
3) omap3_dss: define DSS_ONOFF
1 is a preliminary cleanup suggested by Gerhard Sittig and Igor Grinberg 2 and 3 are splitting off some new #defines to separate patches
- Moved wordlen to generic spi_slave struct, and added generic implementation for spi_set_wordlen which only updates the struct without touching the hardware (Igor Grinberg)
- Updated wordlen in hardware just before doing SPI transactions, not when changing wordlen (Igor Grinberg)
- OMAP3 specific check of wordlen value from old implementation of spi_set_wordlen moved to xfer. It refines the more general check done in the new spi_set_wordlen.
- Fixed comment style in spi.h following a rebase on top of latest U-Boot
- Added SPDX-License-Identifier to all new files (Anatolij Gustschin)
- s/printf/puts for not formatted strings in scf0403 driver (Anatolij Gustschin)
- Do not fail scf0403 driver init if an invalid reset_gpio is given (Igor Grinberg)

Nikita Kiryanov (6):
spi: omap3: remove semicolon from #define
spi: omap3: add support for more word lengths
spi: define SPI_XFER_ONCE
lcd: add DataImage SCF0403x LCD panel support
omap3_dss: define DSS_ONOFF
cm_t35: use scf0403 driver

 arch/arm/include/asm/arch-omap3/dss.h |   9 +-
 board/compulab/cm_t35/cm_t35.c        |  12 ++
 board/compulab/common/omap3_display.c |  46 +++++-
 drivers/spi/omap3_spi.c               |  71 +++++---
 drivers/spi/omap3_spi.h               |   8 +-
 drivers/spi/spi.c                     |  13 ++
 drivers/video/Makefile                |   1 +
 drivers/video/scf0403_lcd.c           | 296 ++++++++++++++++++++++++++++++++++
 include/configs/cm_t35.h              |   3 +
 include/scf0403_lcd.h                 |  11 ++
 include/spi.h                         |  17 ++
 11 files changed, 456 insertions(+), 31 deletions(-)
 create mode 100644 drivers/video/scf0403_lcd.c
 create mode 100644 include/scf0403_lcd.h
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH v2 1/6 spi: omap3: remove semicolon from #define

Remove unnecessary semicolon from #define SPI_WAIT_TIMEOUT

Cc Tom Rini <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Gerhard Sittig <[email protected]>

---
NOTE: New patch in series (Gerhard Sittig, Igor Grinberg)

 drivers/spi/omap3_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/omap3_spi.c +1 -1
index e80be8e..116276c 100644
@@ -21,7 +21,7 @@
 #include "omap3_spi.h"
 
 #define WORD_LEN	8
-#define SPI_WAIT_TIMEOUT 3000000;
+#define SPI_WAIT_TIMEOUT 3000000
 
 static void spi_reset(struct omap3_spi_slave *ds)
 {
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH v2 1/6 spi: omap3: remove semicolon from #define

Quoted 7 lines · On Wed, 16 Oct 2013 17:23:24 +0300 Nikita Kiryanov <[email protected]>…

Remove unnecessary semicolon from #define SPI_WAIT_TIMEOUT

Cc Tom Rini <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Gerhard Sittig <[email protected]>
Quoted 5 lines

---
NOTE: New patch in series (Gerhard Sittig, Igor Grinberg)

 drivers/spi/omap3_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

applied to u-boot-video/master, thanks!

Anatolij

#3 lore raw

PATCH v2 2/6 spi: omap3: add support for more word lengths

In reply to Nikita Kiryanov

Current implementation only supports 8 bit word lengths, even though omap3 can handle anything between 4 and 32.

Update the spi interface to support changing the SPI word length, and implement it in omap3_spi driver to support the full range of possible word lengths.
This implementation is backwards compatible by defaulting to the old behavior of 8 bit word lengths.
Also, it required a change to the omap3_spi non static I/O functions, but since they are not used anywhere else, no collateral changes are required.

Cc Tom Rini <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>
Cc Igor Grinberg <[email protected]>

---
Changes in V2:
- Removed semicolon from #define SPI_DEFAULT_WORDLEN (Gerhard Sittig, Igor Grinberg)
- Moved wordlen to generic spi_slave struct, and added generic implementation for spi_set_wordlen which only updates the struct without touching the hardware (Igor Grinberg)
- Update wordlen in hardware just before doing SPI transactions, not when changing wordlen (Igor Grinberg)
- OMAP3 specific check of wordlen value from old implementation of spi_set_wordlen moved to xfer. It refines the more general check done in the new spi_set_wordlen.
- Fixed comment style in spi.h following a rebase on top of latest U-Boot

 drivers/spi/omap3_spi.c | 69 +++++++++++++++++++++++++++++++++++--------------
 drivers/spi/omap3_spi.h |  8 +++---
 drivers/spi/spi.c       | 13 ++++++++++
 include/spi.h           | 16 ++++++++++++
 4 files changed, 82 insertions(+), 24 deletions(-)
drivers/spi/omap3_spi.c +49 -20
index 116276c..a3ad056 100644
@@ -20,7 +20,6 @@
 #include <asm/io.h>
 #include "omap3_spi.h"
 
-#define WORD_LEN	8
 #define SPI_WAIT_TIMEOUT 3000000
 
 static void spi_reset(struct omap3_spi_slave *ds)
@@ -185,7 +184,7 @@ int spi_claim_bus(struct spi_slave *slave)
 
 	/* wordlength */
 	conf &= ~OMAP3_MCSPI_CHCONF_WL_MASK;
-	conf |= (WORD_LEN - 1) << 7;
+	conf |= (ds->slave.wordlen - 1) << 7;
 
 	/* set chipselect polarity; manage with FORCE */
 	if (!(ds->mode & SPI_CS_HIGH))
@@ -223,7 +222,7 @@ void spi_release_bus(struct spi_slave *slave)
 	spi_reset(ds);
 }
 
-int omap3_spi_write(struct spi_slave *slave, unsigned int len, const u8 *txp,
+int omap3_spi_write(struct spi_slave *slave, unsigned int len, const void *txp,
 		    unsigned long flags)
 {
 	struct omap3_spi_slave *ds = to_omap3_spi(slave);
@@ -234,7 +233,8 @@ int omap3_spi_write(struct spi_slave *slave, unsigned int len, const u8 *txp,
 	/* Enable the channel */
 	omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_EN);
 
-	chconf &= ~OMAP3_MCSPI_CHCONF_TRM_MASK;
+	chconf &= ~(OMAP3_MCSPI_CHCONF_TRM_MASK | OMAP3_MCSPI_CHCONF_WL_MASK);
+	chconf |= (ds->slave.wordlen - 1) << 7;
 	chconf |= OMAP3_MCSPI_CHCONF_TRM_TX_ONLY;
 	chconf |= OMAP3_MCSPI_CHCONF_FORCE;
 	omap3_spi_write_chconf(ds,chconf);
@@ -250,7 +250,13 @@ int omap3_spi_write(struct spi_slave *slave, unsigned int len, const u8 *txp,
 			}
 		}
 		/* Write the data */
-		writel(txp[i], &ds->regs->channel[ds->slave.cs].tx);
+		unsigned int *tx = &ds->regs->channel[ds->slave.cs].tx;
+		if (ds->slave.wordlen > 16)
+			writel(((u32 *)txp)[i], tx);
+		else if (ds->slave.wordlen > 8)
+			writel(((u16 *)txp)[i], tx);
+		else
+			writel(((u8 *)txp)[i], tx);
 	}
 
 	/* wait to finish of transfer */
@@ -268,7 +274,7 @@ int omap3_spi_write(struct spi_slave *slave, unsigned int len, const u8 *txp,
 	return 0;
 }
 
-int omap3_spi_read(struct spi_slave *slave, unsigned int len, u8 *rxp,
+int omap3_spi_read(struct spi_slave *slave, unsigned int len, void *rxp,
 		   unsigned long flags)
 {
 	struct omap3_spi_slave *ds = to_omap3_spi(slave);
@@ -279,7 +285,8 @@ int omap3_spi_read(struct spi_slave *slave, unsigned int len, u8 *rxp,
 	/* Enable the channel */
 	omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_EN);
 
-	chconf &= ~OMAP3_MCSPI_CHCONF_TRM_MASK;
+	chconf &= ~(OMAP3_MCSPI_CHCONF_TRM_MASK | OMAP3_MCSPI_CHCONF_WL_MASK);
+	chconf |= (ds->slave.wordlen - 1) << 7;
 	chconf |= OMAP3_MCSPI_CHCONF_TRM_RX_ONLY;
 	chconf |= OMAP3_MCSPI_CHCONF_FORCE;
 	omap3_spi_write_chconf(ds,chconf);
@@ -302,7 +309,13 @@ int omap3_spi_read(struct spi_slave *slave, unsigned int len, u8 *rxp,
 			omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_DIS);
 
 		/* Read the data */
-		rxp[i] = readl(&ds->regs->channel[ds->slave.cs].rx);
+		unsigned int *rx = &ds->regs->channel[ds->slave.cs].rx;
+		if (ds->slave.wordlen > 16)
+			((u32 *)rxp)[i] = readl(rx);
+		else if (ds->slave.wordlen > 8)
+			((u16 *)rxp)[i] = (u16)readl(rx);
+		else
+			((u8 *)rxp)[i] = (u8)readl(rx);
 	}
 
 	if (flags & SPI_XFER_END) {
@@ -314,8 +327,8 @@ int omap3_spi_read(struct spi_slave *slave, unsigned int len, u8 *rxp,
 }
 
 /*McSPI Transmit Receive Mode*/
-int omap3_spi_txrx(struct spi_slave *slave,
-		unsigned int len, const u8 *txp, u8 *rxp, unsigned long flags)
+int omap3_spi_txrx(struct spi_slave *slave, unsigned int len,
+		   const void *txp, void *rxp, unsigned long flags)
 {
 	struct omap3_spi_slave *ds = to_omap3_spi(slave);
 	int timeout = SPI_WAIT_TIMEOUT;
@@ -327,7 +340,8 @@ int omap3_spi_txrx(struct spi_slave *slave,
 	omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_EN);
 
 	/*set TRANSMIT-RECEIVE Mode*/
-	chconf &= ~OMAP3_MCSPI_CHCONF_TRM_MASK;
+	chconf &= ~(OMAP3_MCSPI_CHCONF_TRM_MASK | OMAP3_MCSPI_CHCONF_WL_MASK);
+	chconf |= (ds->slave.wordlen - 1) << 7;
 	chconf |= OMAP3_MCSPI_CHCONF_FORCE;
 	omap3_spi_write_chconf(ds,chconf);
 
@@ -344,7 +358,13 @@ int omap3_spi_txrx(struct spi_slave *slave,
 			}
 		}
 		/* Write the data */
-		writel(txp[i], &ds->regs->channel[ds->slave.cs].tx);
+		unsigned int *tx = &ds->regs->channel[ds->slave.cs].tx;
+		if (ds->slave.wordlen > 16)
+			writel(((u32 *)txp)[i], tx);
+		else if (ds->slave.wordlen > 8)
+			writel(((u16 *)txp)[i], tx);
+		else
+			writel(((u8 *)txp)[i], tx);
 
 		/*Read: wait for RX containing data (RXS == 1)*/
 		while (!(readl(&ds->regs->channel[ds->slave.cs].chstat) &
@@ -356,7 +376,13 @@ int omap3_spi_txrx(struct spi_slave *slave,
 			}
 		}
 		/* Read the data */
-		rxp[i] = readl(&ds->regs->channel[ds->slave.cs].rx);
+		unsigned int *rx = &ds->regs->channel[ds->slave.cs].rx;
+		if (ds->slave.wordlen > 16)
+			((u32 *)rxp)[i] = readl(rx);
+		else if (ds->slave.wordlen > 8)
+			((u16 *)rxp)[i] = (u16)readl(rx);
+		else
+			((u8 *)rxp)[i] = (u8)readl(rx);
 	}
 	/* Disable the channel */
 	omap3_spi_set_enable(ds,OMAP3_MCSPI_CHCTRL_DIS);
@@ -375,14 +401,17 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
 {
 	struct omap3_spi_slave *ds = to_omap3_spi(slave);
 	unsigned int	len;
-	const u8	*txp = dout;
-	u8		*rxp = din;
 	int ret = -1;
 
-	if (bitlen % 8)
+	if (ds->slave.wordlen < 4 || ds->slave.wordlen > 32) {
+		printf("omap3_spi: invalid wordlen %d\n", ds->slave.wordlen);
+		return -1;
+	}
+
+	if (bitlen % ds->slave.wordlen)
 		return -1;
 
-	len = bitlen / 8;
+	len = bitlen / ds->slave.wordlen;
 
 	if (bitlen == 0) {	 /* only change CS */
 		int chconf = readl(&ds->regs->channel[ds->slave.cs].chconf);
@@ -400,11 +429,11 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
 		ret = 0;
 	} else {
 		if (dout != NULL && din != NULL)
-			ret = omap3_spi_txrx(slave, len, txp, rxp, flags);
+			ret = omap3_spi_txrx(slave, len, dout, din, flags);
 		else if (dout != NULL)
-			ret = omap3_spi_write(slave, len, txp, flags);
+			ret = omap3_spi_write(slave, len, dout, flags);
 		else if (din != NULL)
-			ret = omap3_spi_read(slave, len, rxp, flags);
+			ret = omap3_spi_read(slave, len, din, flags);
 	}
 	return ret;
 }
drivers/spi/omap3_spi.h +4 -4
index 01537b6..ab7cd84 100644
@@ -99,11 +99,11 @@ static inline struct omap3_spi_slave *to_omap3_spi(struct spi_slave *slave)
 	return container_of(slave, struct omap3_spi_slave, slave);
 }
 
-int omap3_spi_txrx(struct spi_slave *slave, unsigned int len, const u8 *txp,
-			u8 *rxp, unsigned long flags);
-int omap3_spi_write(struct spi_slave *slave, unsigned int len, const u8 *txp,
+int omap3_spi_txrx(struct spi_slave *slave, unsigned int len, const void *txp,
+			void *rxp, unsigned long flags);
+int omap3_spi_write(struct spi_slave *slave, unsigned int len, const void *txp,
 		    unsigned long flags);
-int omap3_spi_read(struct spi_slave *slave, unsigned int len, u8 *rxp,
+int omap3_spi_read(struct spi_slave *slave, unsigned int len, void *rxp,
 		   unsigned long flags);
 
 #endif /* _OMAP3_SPI_H_ */
drivers/spi/spi.c +13 -0
index ea39d1a..b76a26c 100644
@@ -8,6 +8,18 @@
 #include <malloc.h>
 #include <spi.h>
 
+int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen)
+{
+	if (wordlen == 0 || wordlen > 32) {
+		printf("spi: invalid wordlen %d\n", wordlen);
+		return -1;
+	}
+
+	slave->wordlen = wordlen;
+
+	return 0;
+}
+
 void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
 			 unsigned int cs)
 {
@@ -20,6 +32,7 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
 		slave = (struct spi_slave *)(ptr + offset);
 		slave->bus = bus;
 		slave->cs = cs;
+		slave->wordlen = SPI_DEFAULT_WORDLEN;
 	}
 
 	return ptr;
include/spi.h +16 -0
index ad9248b..67da75c 100644
@@ -33,6 +33,8 @@
 /* Header byte that marks the start of the message */
 #define SPI_PREAMBLE_END_BYTE	0xec
 
+#define SPI_DEFAULT_WORDLEN 8
+
 /**
  * struct spi_slave - Representation of a SPI slave
  *
@@ -40,6 +42,7 @@
  *
  * @bus:		ID of the bus that the slave is attached to.
  * @cs:			ID of the chip select connected to the slave.
+ * @wordlen:		Size of SPI word in number of bits
  * @max_write_size:	If non-zero, the maximum number of bytes which can
  *			be written at once, excluding command bytes.
  * @memory_map:		Address of read-only SPI flash access.
@@ -47,6 +50,7 @@
 struct spi_slave {
 	unsigned int bus;
 	unsigned int cs;
+	unsigned int wordlen;
 	unsigned int max_write_size;
 	void *memory_map;
 };
@@ -153,6 +157,18 @@ int spi_claim_bus(struct spi_slave *slave);
 void spi_release_bus(struct spi_slave *slave);
 
 /**
+ * Set the word length for SPI transactions
+ *
+ * Set the word length (number of bits per word) for SPI transactions.
+ *
+ * @slave:	The SPI slave
+ * @wordlen:	The number of bits in a word
+ *
+ * Returns: 0 on success, -1 on failure.
+ */
+int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen);
+
+/**
  * SPI transfer
  *
  * This writes "bitlen" bits out the SPI MOSI port and simultaneously clocks
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH v2 2/6 spi: omap3: add support for more word lengths

Quoted 30 lines · On Wed, 16 Oct 2013 17:23:25 +0300 Nikita Kiryanov <[email protected]>…

Current implementation only supports 8 bit word lengths, even though omap3 can handle anything between 4 and 32.

Update the spi interface to support changing the SPI word length, and implement it in omap3_spi driver to support the full range of possible word lengths.
This implementation is backwards compatible by defaulting to the old behavior of 8 bit word lengths.
Also, it required a change to the omap3_spi non static I/O functions, but since they are not used anywhere else, no collateral changes are required.

Cc Tom Rini <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>
Cc Igor Grinberg <[email protected]>

---
Changes in V2:
- Removed semicolon from #define SPI_DEFAULT_WORDLEN (Gerhard Sittig, Igor Grinberg)
- Moved wordlen to generic spi_slave struct, and added generic implementation for spi_set_wordlen which only updates the struct without touching the hardware (Igor Grinberg)
- Update wordlen in hardware just before doing SPI transactions, not when changing wordlen (Igor Grinberg)
- OMAP3 specific check of wordlen value from old implementation of spi_set_wordlen moved to xfer. It refines the more general check done in the new spi_set_wordlen.
- Fixed comment style in spi.h following a rebase on top of latest U-Boot

Quoted 5 lines
 drivers/spi/omap3_spi.c | 69 +++++++++++++++++++++++++++++++++++--------------
 drivers/spi/omap3_spi.h |  8 +++---
 drivers/spi/spi.c       | 13 ++++++++++
 include/spi.h           | 16 ++++++++++++
 4 files changed, 82 insertions(+), 24 deletions(-)

applied to u-boot-video/master, thanks!

Anatolij

#5 lore raw

PATCH v2 3/6 spi: define SPI_XFER_ONCE

In reply to Nikita Kiryanov

The flag combination "SPI_XFER_BEGIN | SPI_XFER_END" is a common use case of spi_xfer, and it can easily cause an already long line (spi_xfer takes 5 parameters) to go over the 80 character limit.

define SPI_XFER_ONCE to be a shorter version of the above flag combination.

Cc Tom Rini <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>
Cc Igor Grinberg <[email protected]>

---
NOTE: This is a new patch. Its contents were originally part of "lcd: add
DataImage SCF0403x LCD panel support". Split because it is unrelated to the patch it was originally in. (Igor Grinberg)

 include/spi.h | 1 +
 1 file changed, 1 insertion(+)
include/spi.h +1 -0
index 67da75c..e2563c9 100644
@@ -29,6 +29,7 @@
 #define SPI_XFER_END		0x02	/* Deassert CS after transfer */
 #define SPI_XFER_MMAP		0x08	/* Memory Mapped start */
 #define SPI_XFER_MMAP_END	0x10	/* Memory Mapped End */
+#define SPI_XFER_ONCE		(SPI_XFER_BEGIN | SPI_XFER_END)
 
 /* Header byte that marks the start of the message */
 #define SPI_PREAMBLE_END_BYTE	0xec
Signature · 1 line
1.8.1.2
#6 lore raw

PATCH v2 3/6 spi: define SPI_XFER_ONCE

Quoted 10 lines · On Wed, 16 Oct 2013 17:23:26 +0300 Nikita Kiryanov <[email protected]>…

The flag combination "SPI_XFER_BEGIN | SPI_XFER_END" is a common use case of spi_xfer, and it can easily cause an already long line (spi_xfer takes 5 parameters) to go over the 80 character limit.

define SPI_XFER_ONCE to be a shorter version of the above flag combination.

Cc Tom Rini <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>
Cc Igor Grinberg <[email protected]>
Quoted 7 lines

---
NOTE: This is a new patch. Its contents were originally part of "lcd: add
DataImage SCF0403x LCD panel support". Split because it is unrelated to the patch it was originally in. (Igor Grinberg)

 include/spi.h | 1 +
 1 file changed, 1 insertion(+)

applied to u-boot-video/master, thanks!

Anatolij

#7 lore raw

PATCH v2 4/6 lcd: add DataImage SCF0403x LCD panel support

In reply to Nikita Kiryanov

Add SPI-based driver for DataImage SCF0403852GGU04 and SCF0403526GGU20 LCD panels.

Cc Tom Rini <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Igor Grinberg <[email protected]>

---
Changes in V2:
- Added SPDX-License-Identifier to all new files (Anatolij Gustschin)
- s/printf/puts for not formatted strings (Anatolij Gustschin)
- Do not fail init if an invalid reset_gpio is given (Igor Grinberg)
- Move definition of SPI_XFER_ONCE to a separate patch (Igor Grinberg)

 drivers/video/Makefile      |   1 +
 drivers/video/scf0403_lcd.c | 296 ++++++++++++++++++++++++++++++++++++++++++++
 include/scf0403_lcd.h       |  11 ++
 3 files changed, 308 insertions(+)
 create mode 100644 drivers/video/scf0403_lcd.c
 create mode 100644 include/scf0403_lcd.h
drivers/video/Makefile +1 -0
index 6c208c5..e7324d1 100644
@@ -22,6 +22,7 @@ COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
 COBJS-$(CONFIG_L5F31188) += l5f31188.o
 COBJS-$(CONFIG_MPC8XX_LCD) += mpc8xx_lcd.o
 COBJS-$(CONFIG_PXA_LCD) += pxa_lcd.o
+COBJS-$(CONFIG_SCF0403_LCD) += scf0403_lcd.o
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
 COBJS-$(CONFIG_LD9040) += ld9040.o
drivers/video/scf0403_lcd.c new file +296 -0

296 lines not on this page · raw message

include/scf0403_lcd.h new file +11 -0
new file mode 100644
index 0000000..d71896b
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2013, Compulab Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef SCF0403_LCD_H_
+#define SCF0403_LCD_H_
+
+int scf0403_init(int reset_gpio);
+
+#endif
Signature · 1 line
1.8.1.2
#9 lore raw

PATCH v2 4/6 lcd: add DataImage SCF0403x LCD panel support

In reply to Nikita Kiryanov
Quoted 14 lines · On Wed, 16 Oct 2013 17:23:27 +0300 Nikita Kiryanov <[email protected]>…

Add SPI-based driver for DataImage SCF0403852GGU04 and SCF0403526GGU20 LCD panels.

Cc Tom Rini <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Igor Grinberg <[email protected]>

---
Changes in V2:
- Added SPDX-License-Identifier to all new files (Anatolij Gustschin)
- s/printf/puts for not formatted strings (Anatolij Gustschin)
- Do not fail init if an invalid reset_gpio is given (Igor Grinberg)
- Move definition of SPI_XFER_ONCE to a separate patch (Igor Grinberg)

Quoted 6 lines
 drivers/video/Makefile      |   1 +
 drivers/video/scf0403_lcd.c | 296 ++++++++++++++++++++++++++++++++++++++++++++
 include/scf0403_lcd.h       |  11 ++
 3 files changed, 308 insertions(+)
 create mode 100644 drivers/video/scf0403_lcd.c
 create mode 100644 include/scf0403_lcd.h

applied to u-boot-video/master, thanks!

Anatolij

#10 lore raw

PATCH v2 5/6 omap3_dss: define DSS_ONOFF

In reply to Nikita Kiryanov

Add DSS_ONOFF to polarity defines

---
NOTE: This is a new patch. Its contents were originally part of "cm_t35: use
scf0403 driver". Split because it is unrelated to the patch it was originally in.

 arch/arm/include/asm/arch-omap3/dss.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arm/include/asm/arch-omap3/dss.h +5 -4
index ae0babf..8bf6b48 100644
@@ -178,10 +178,11 @@ struct venc_regs {
 #define LCD_INTERFACE_24_BIT	3
 
 /* Polarity */
-#define DSS_IVS	(1 << 12)
-#define DSS_IHS	(1 << 13)
-#define DSS_IPC	(1 << 14)
-#define DSS_IEO	(1 << 15)
+#define DSS_IVS		(1 << 12)
+#define DSS_IHS		(1 << 13)
+#define DSS_IPC		(1 << 14)
+#define DSS_IEO		(1 << 15)
+#define DSS_ONOFF	(1 << 17)
 
 /* GFX format */
 #define GFXFORMAT_BITMAP1		(0x0 << 1)
Signature · 1 line
1.8.1.2
#12 lore raw

PATCH v2 5/6 omap3_dss: define DSS_ONOFF

In reply to Nikita Kiryanov
Quoted 7 lines · On Wed, 16 Oct 2013 17:23:28 +0300 Nikita Kiryanov <[email protected]>…

Add DSS_ONOFF to polarity defines

Quoted 7 lines

---
NOTE: This is a new patch. Its contents were originally part of "cm_t35: use
scf0403 driver". Split because it is unrelated to the patch it was originally in.

 arch/arm/include/asm/arch-omap3/dss.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

applied to u-boot-video/master, thanks!

Anatolij

#13 lore raw

PATCH v2 6/6 cm_t35: use scf0403 driver

In reply to Nikita Kiryanov

Use scf0403 driver to add scf0403x LCD support for cm-t35 and cm-t3730 boards.

---
NOTE: This patch depends on http://patchwork.ozlabs.org/patch/275283/

Changes in V2:
- Changes to arch/arm/include/asm/arch-omap3/dss.h were split off to another patch.

 board/compulab/cm_t35/cm_t35.c        | 12 +++++++++
 board/compulab/common/omap3_display.c | 46 +++++++++++++++++++++++++++++++++--
 include/configs/cm_t35.h              |  3 +++
 3 files changed, 59 insertions(+), 2 deletions(-)
board/compulab/cm_t35/cm_t35.c +12 -0
index a6d4aba..51dd4a4 100644
@@ -268,6 +268,9 @@ static void cm_t3x_set_common_muxconf(void)
 	/* DVI enable */
 	MUX_VAL(CP(GPMC_NCS3),		(IDIS  | PTU | DIS  | M4));/*GPMC_nCS3*/
 
+	/* DataImage backlight */
+	MUX_VAL(CP(GPMC_NCS7),		(IDIS  | PTU | DIS  | M4));/*GPIO_58*/
+
 	/* CM-T3x Ethernet */
 	MUX_VAL(CP(GPMC_NCS5),		(IDIS | PTU | DIS | M0)); /*GPMC_nCS5*/
 	MUX_VAL(CP(GPMC_CLK),		(IEN  | PTD | DIS | M4)); /*GPIO_59*/
@@ -374,6 +377,15 @@ static void cm_t3x_set_common_muxconf(void)
 	MUX_VAL(CP(MMC1_DAT1),		(IEN  | PTU | EN  | M0)); /*MMC1_DAT1*/
 	MUX_VAL(CP(MMC1_DAT2),		(IEN  | PTU | EN  | M0)); /*MMC1_DAT2*/
 	MUX_VAL(CP(MMC1_DAT3),		(IEN  | PTU | EN  | M0)); /*MMC1_DAT3*/
+
+	/* SPI */
+	MUX_VAL(CP(MCBSP1_CLKR),	(IEN | PTD | DIS | M1)); /*MCSPI4_CLK*/
+	MUX_VAL(CP(MCBSP1_DX),		(IEN | PTD | DIS | M1)); /*MCSPI4_SIMO*/
+	MUX_VAL(CP(MCBSP1_DR),		(IEN | PTD | DIS | M1)); /*MCSPI4_SOMI*/
+	MUX_VAL(CP(MCBSP1_FSX),		(IEN | PTU | EN  | M1)); /*MCSPI4_CS0*/
+
+	/* display controls */
+	MUX_VAL(CP(MCBSP1_FSR),		(IDIS | PTU | DIS | M4)); /*GPIO_157*/
 }
 
 static void cm_t35_set_muxconf(void)
board/compulab/common/omap3_display.c +44 -2

86 lines not on this page · raw message

include/configs/cm_t35.h +3 -0
index eff35b9..f01958d 100644
@@ -326,5 +326,8 @@
 #define CONFIG_SPLASH_SCREEN
 #define CONFIG_CMD_BMP
 #define CONFIG_BMP_16BPP
+#define CONFIG_SCF0403_LCD
+
+#define CONFIG_OMAP3_SPI
 
 #endif /* __CONFIG_H */
Signature · 1 line
1.8.1.2
#14 lore raw

PATCH v2 6/6 cm_t35: use scf0403 driver

Quoted 8 lines · On Wed, 16 Oct 2013 17:23:29 +0300 Nikita Kiryanov <[email protected]>…

Use scf0403 driver to add scf0403x LCD support for cm-t35 and cm-t3730 boards.

---
NOTE: This patch depends on http://patchwork.ozlabs.org/patch/275283/

Quoted 8 lines

Changes in V2:
- Changes to arch/arm/include/asm/arch-omap3/dss.h were split off to another patch.

 board/compulab/cm_t35/cm_t35.c        | 12 +++++++++
 board/compulab/common/omap3_display.c | 46 +++++++++++++++++++++++++++++++++--
 include/configs/cm_t35.h              |  3 +++
 3 files changed, 59 insertions(+), 2 deletions(-)

applied to u-boot-video/master, thanks!

Anatolij

#15 lore raw

v2 cover Add support for SPI based DataImage LCD panel

In reply to Nikita Kiryanov
Quoted 47 lines · Nikita Kiryanov

This patch ports the Linux driver for DataImage SCF0403852GGU04 and SCF0403526GGU20 LCD panels into U-Boot. As a preparation step, variable SPI word length support is added to omap3_spi and the generic SPI interface. Finally, the driver is used in cm_t35 board.

The SPI changes were tested with a Beagle I2C/SPI/MDIO Protocol Analyzer, and also with a DataImage SCF0403 lcd as part of the DataImage driver test.

Patch number 6 depends on http://patchwork.ozlabs.org/patch/275283/

Cc Tom Rini <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>

Changes in V2:
- Rebased on top of latest U-Boot
- New patches:
1) spi: omap3: remove semicolon from #define
2) spi: define SPI_XFER_ONCE
3) omap3_dss: define DSS_ONOFF
1 is a preliminary cleanup suggested by Gerhard Sittig and Igor Grinberg 2 and 3 are splitting off some new #defines to separate patches
- Moved wordlen to generic spi_slave struct, and added generic implementation for spi_set_wordlen which only updates the struct without touching the hardware (Igor Grinberg)
- Updated wordlen in hardware just before doing SPI transactions, not when changing wordlen (Igor Grinberg)
- OMAP3 specific check of wordlen value from old implementation of spi_set_wordlen moved to xfer. It refines the more general check done in the new spi_set_wordlen.
- Fixed comment style in spi.h following a rebase on top of latest U-Boot
- Added SPDX-License-Identifier to all new files (Anatolij Gustschin)
- s/printf/puts for not formatted strings in scf0403 driver (Anatolij Gustschin)
- Do not fail scf0403 driver init if an invalid reset_gpio is given (Igor Grinberg)

Nikita Kiryanov (6):
spi: omap3: remove semicolon from #define
spi: omap3: add support for more word lengths
spi: define SPI_XFER_ONCE
lcd: add DataImage SCF0403x LCD panel support
omap3_dss: define DSS_ONOFF
cm_t35: use scf0403 driver

Quoted 14 lines
 arch/arm/include/asm/arch-omap3/dss.h |   9 +-
 board/compulab/cm_t35/cm_t35.c        |  12 ++
 board/compulab/common/omap3_display.c |  46 +++++-
 drivers/spi/omap3_spi.c               |  71 +++++---
 drivers/spi/omap3_spi.h               |   8 +-
 drivers/spi/spi.c                     |  13 ++
 drivers/video/Makefile                |   1 +
 drivers/video/scf0403_lcd.c           | 296 ++++++++++++++++++++++++++++++++++
 include/configs/cm_t35.h              |   3 +
 include/scf0403_lcd.h                 |  11 ++
 include/spi.h                         |  17 ++
 11 files changed, 456 insertions(+), 31 deletions(-)
 create mode 100644 drivers/video/scf0403_lcd.c
 create mode 100644 include/scf0403_lcd.h

Did the mailing list eat the CC? I expect these changes to come in via the spi tree, since Anatolij acked the other parts. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131104/d12efc30/attachment.pgp>
#16 lore raw

v2 cover Add support for SPI based DataImage LCD panel

Perhaps we should try his other email address; he seems to be using it more than the gmail one now (added Cc).

Quoted 67 lines · Tom Rini
Quoted 59 lines · Nikita Kiryanov

This patch ports the Linux driver for DataImage SCF0403852GGU04 and SCF0403526GGU20 LCD panels into U-Boot. As a preparation step, variable SPI word length support is added to omap3_spi and the generic SPI interface. Finally, the driver is used in cm_t35 board.

The SPI changes were tested with a Beagle I2C/SPI/MDIO Protocol Analyzer, and also with a DataImage SCF0403 lcd as part of the DataImage driver test.

Patch number 6 depends on http://patchwork.ozlabs.org/patch/275283/

Cc Tom Rini <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>

Changes in V2:
- Rebased on top of latest U-Boot
- New patches:
1) spi: omap3: remove semicolon from #define
2) spi: define SPI_XFER_ONCE
3) omap3_dss: define DSS_ONOFF
1 is a preliminary cleanup suggested by Gerhard Sittig and Igor Grinberg 2 and 3 are splitting off some new #defines to separate patches
- Moved wordlen to generic spi_slave struct, and added generic implementation for spi_set_wordlen which only updates the struct without touching the hardware (Igor Grinberg)
- Updated wordlen in hardware just before doing SPI transactions, not when changing wordlen (Igor Grinberg)
- OMAP3 specific check of wordlen value from old implementation of spi_set_wordlen moved to xfer. It refines the more general check done in the new spi_set_wordlen.
- Fixed comment style in spi.h following a rebase on top of latest U-Boot
- Added SPDX-License-Identifier to all new files (Anatolij Gustschin)
- s/printf/puts for not formatted strings in scf0403 driver (Anatolij Gustschin)
- Do not fail scf0403 driver init if an invalid reset_gpio is given (Igor Grinberg)

Nikita Kiryanov (6):
spi: omap3: remove semicolon from #define
spi: omap3: add support for more word lengths
spi: define SPI_XFER_ONCE
lcd: add DataImage SCF0403x LCD panel support
omap3_dss: define DSS_ONOFF
cm_t35: use scf0403 driver

  arch/arm/include/asm/arch-omap3/dss.h |   9 +-
  board/compulab/cm_t35/cm_t35.c        |  12 ++
  board/compulab/common/omap3_display.c |  46 +++++-
  drivers/spi/omap3_spi.c               |  71 +++++---
  drivers/spi/omap3_spi.h               |   8 +-
  drivers/spi/spi.c                     |  13 ++
  drivers/video/Makefile                |   1 +
  drivers/video/scf0403_lcd.c           | 296 ++++++++++++++++++++++++++++++++++
  include/configs/cm_t35.h              |   3 +
  include/scf0403_lcd.h                 |  11 ++
  include/spi.h                         |  17 ++
  11 files changed, 456 insertions(+), 31 deletions(-)
Quoted 2 lines

create mode 100644 drivers/video/scf0403_lcd.c
create mode 100644 include/scf0403_lcd.h

Did the mailing list eat the CC? I expect these changes to come in via the spi tree, since Anatolij acked the other parts. Thanks!

Signature · 2 lines
Regards,
Nikita.
#17 lore raw

v2 cover Add support for SPI based DataImage LCD panel

In reply to Tom Rini
Quoted 64 lines · On Mon, 4 Nov 2013 15:49:57 -0500 Tom Rini <[email protected]> wrote:
Quoted 47 lines · Nikita Kiryanov

This patch ports the Linux driver for DataImage SCF0403852GGU04 and SCF0403526GGU20 LCD panels into U-Boot. As a preparation step, variable SPI word length support is added to omap3_spi and the generic SPI interface. Finally, the driver is used in cm_t35 board.

The SPI changes were tested with a Beagle I2C/SPI/MDIO Protocol Analyzer, and also with a DataImage SCF0403 lcd as part of the DataImage driver test.

Patch number 6 depends on http://patchwork.ozlabs.org/patch/275283/

Cc Tom Rini <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Jagannadha Sutradharudu Teki <[email protected]>

Changes in V2:
- Rebased on top of latest U-Boot
- New patches:
1) spi: omap3: remove semicolon from #define
2) spi: define SPI_XFER_ONCE
3) omap3_dss: define DSS_ONOFF
1 is a preliminary cleanup suggested by Gerhard Sittig and Igor Grinberg 2 and 3 are splitting off some new #defines to separate patches
- Moved wordlen to generic spi_slave struct, and added generic implementation for spi_set_wordlen which only updates the struct without touching the hardware (Igor Grinberg)
- Updated wordlen in hardware just before doing SPI transactions, not when changing wordlen (Igor Grinberg)
- OMAP3 specific check of wordlen value from old implementation of spi_set_wordlen moved to xfer. It refines the more general check done in the new spi_set_wordlen.
- Fixed comment style in spi.h following a rebase on top of latest U-Boot
- Added SPDX-License-Identifier to all new files (Anatolij Gustschin)
- s/printf/puts for not formatted strings in scf0403 driver (Anatolij Gustschin)
- Do not fail scf0403 driver init if an invalid reset_gpio is given (Igor Grinberg)

Nikita Kiryanov (6):
spi: omap3: remove semicolon from #define
spi: omap3: add support for more word lengths
spi: define SPI_XFER_ONCE
lcd: add DataImage SCF0403x LCD panel support
omap3_dss: define DSS_ONOFF
cm_t35: use scf0403 driver

Quoted 14 lines
 arch/arm/include/asm/arch-omap3/dss.h |   9 +-
 board/compulab/cm_t35/cm_t35.c        |  12 ++
 board/compulab/common/omap3_display.c |  46 +++++-
 drivers/spi/omap3_spi.c               |  71 +++++---
 drivers/spi/omap3_spi.h               |   8 +-
 drivers/spi/spi.c                     |  13 ++
 drivers/video/Makefile                |   1 +
 drivers/video/scf0403_lcd.c           | 296 ++++++++++++++++++++++++++++++++++
 include/configs/cm_t35.h              |   3 +
 include/scf0403_lcd.h                 |  11 ++
 include/spi.h                         |  17 ++
 11 files changed, 456 insertions(+), 31 deletions(-)
 create mode 100644 drivers/video/scf0403_lcd.c
 create mode 100644 include/scf0403_lcd.h
Quoted 2 lines

Did the mailing list eat the CC? I expect these changes to come in via the spi tree, since Anatolij acked the other parts. Thanks!

The patch this series depends on is not in u-boot.git/master branch yet (but in u-boot-arm.git tree already). So, after the arm tree is merged to master this series can be applied. I can push it via the video tree if nobody objects.

Thanks,
Anatolij

#18 lore raw

v2 cover Add support for SPI based DataImage LCD panel

Quoted 11 lines · Anatolij Gustschin
Quoted 3 lines · On Mon, 4 Nov 2013 15:49:57 -0500 Tom Rini <[email protected]> wrote:

Did the mailing list eat the CC? I expect these changes to come in via the spi tree, since Anatolij acked the other parts. Thanks!

The patch this series depends on is not in u-boot.git/master branch yet (but in u-boot-arm.git tree already). So, after the arm tree is merged to master this series can be applied. I can push it via the video tree if nobody objects.

Fine by me.

Quoted 4 lines

Thanks,
Anatolij

Signature · 2 lines
Regards,
Nikita.