Skip to contentSkip to conversation

ARM: Support for splashimage om i.MX31-based phycore "eet" variant

PATCH Superseded Guennadi Liakhovetski 8 participants 116 messages Feb 4, 2009 – Feb 24, 2009

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

cover ARM: Support for splashimage om i.MX31-based phycore "eet" variant

Hi,

this series of patches adds support for the graphics engine on i.MX31 SoC. Specifically it allows to display 8-bit BMPs on an OLED display, controlled by an SPI s6e63d6 controller from Samsung. A (fixed formatting) version of the

From: Mark Jackson <[email protected]>
Subject: [PATCH] Add 16bpp BMP support

patch is included for completeness. The cumulative diffstat is

 Makefile                              |    6
 board/imx31_phycore/imx31_phycore.c   |   51 ++
 common/lcd.c                          |  106 ++--
 drivers/gpio/Makefile                 |    3
 drivers/gpio/mx31_gpio.c              |   71 ++
 drivers/spi/mxc_spi.c                 |   99 +++
 drivers/video/Makefile                |    2
 drivers/video/mx3fb.c                 |  866 +++++++++++++++++++++++++++++++++-
 drivers/video/s6e63d6.c               |   68 ++
 include/asm-arm/arch-mx31/mx31-regs.h |   16
 include/asm-arm/arch-mx31/mx31.h      |   10
 include/configs/imx31_phycore.h       |   24
 include/lcd.h                         |   22
 include/s6e63d6.h                     |   37 +
 lib_arm/board.c                       |    7
 15 files changed, 1314 insertions(+), 74 deletions(-)

i.e., most changes go under drivers/video and to common/lcd.c, so, I would suggest to collect respective Acks and pull it through the video tree. Hence Anatolij is cc'ed on all patches:-) Also many need an Ack from the ARM maintainer, so, he is on cc on respective patches and on this one.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#1 lore raw

PATCH 1/9 i.MX31: fix SPI driver for shorter than 32 bit transfers

Fix 8 and 16-bit transfers in mxc_spi driver and a wrong pointer in the free routine.

---

No SPI custodian, so, Jean-Christophe will have to Ack it?

 drivers/spi/mxc_spi.c |   62 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 50 insertions(+), 12 deletions(-)
drivers/spi/mxc_spi.c +50 -12
index 5957ada..9267341 100644
@@ -85,17 +85,12 @@ static inline void reg_write(unsigned long addr, u32 val)
 	*(volatile unsigned long*)addr = val;
 }
 
-static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
+static u32 spi_xchg_single(struct spi_slave *slave, u32 data,
+			   unsigned long flags)
 {
 	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
 	unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
 
-	if (MXC_CSPICTRL_BITCOUNT(bitlen - 1) != (cfg_reg & MXC_CSPICTRL_BITCOUNT(31))) {
-		cfg_reg = (cfg_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
-			MXC_CSPICTRL_BITCOUNT(bitlen - 1);
-		reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
-	}
-
 	reg_write(mxcs->base + MXC_CSPITXDATA, data);
 
 	cfg_reg |= MXC_CSPICTRL_XCH;
@@ -108,13 +103,46 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 	return reg_read(mxcs->base + MXC_CSPIRXDATA);
 }
 
+/*
+ * bitlen is the total number of bits to be sent. Therefore, if you have to send
+ * using < 32-bit words, you have to send each single word individually. If
+ * bitlen > 32 we assume you meant to send 32-bit words...
+ */
 int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
-		void *din, unsigned long flags)
+	     void *din, unsigned long flags)
 {
-	int n_blks = (bitlen + 31) / 32;
+	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
+	int n_blks = bitlen / 32;
 	u32 *out_l, *in_l;
 	int i;
 
+	mxcs->ctrl_reg = (mxcs->ctrl_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
+		MXC_CSPICTRL_BITCOUNT(bitlen - 1);
+
+	reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg);
+
+	if (bitlen <= 8) {
+		u32 iword, oword = *(const u8 *)dout;
+
+		iword = spi_xchg_single(slave, oword, flags);
+		*(u8 *)din = iword;
+		return 0;
+	}
+
+	if (bitlen <= 16) {
+		u32 iword, oword = *(const u16 *)dout;
+
+		if ((int)dout & 1 || (int)din & 1) {
+			printf("Error: unaligned buffers in: %p, out: %p\n",
+			       din, dout);
+			return 1;
+		}
+
+		iword = spi_xchg_single(slave, oword, flags);
+		*(u16 *)din = iword;
+		return 0;
+	}
+
 	if ((int)dout & 3 || (int)din & 3) {
 		printf("Error: unaligned buffers in: %p, out: %p\n", din, dout);
 		return 1;
@@ -122,8 +150,17 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
 
 	for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
 	     i < n_blks;
-	     i++, in_l++, out_l++, bitlen -= 32)
-		*in_l = spi_xchg_single(slave, *out_l, bitlen);
+	     i++, in_l++, out_l++)
+		*in_l = spi_xchg_single(slave, *out_l, flags);
+
+	if (bitlen & 31) {
+		/* Exchange the residue, treat data as 32 bits */
+		mxcs->ctrl_reg = (mxcs->ctrl_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
+			MXC_CSPICTRL_BITCOUNT((bitlen & 31) - 1);
+		reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg);
+
+		*in_l = spi_xchg_single(slave, *out_l, flags);
+	}
 
 	return 0;
 }
@@ -169,7 +206,8 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 
 void spi_free_slave(struct spi_slave *slave)
 {
-	free(slave);
+	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
+	free(mxcs);
 }
 
 int spi_claim_bus(struct spi_slave *slave)
Signature · 1 line
1.5.4
#2 lore raw

PATCH 1/9 i.MX31: fix SPI driver for shorter than 32 bit transfers

Dear Guennadi Liakhovetski,

Quoted 5 lines · In message <[email protected]> you wrote:

Fix 8 and 16-bit transfers in mxc_spi driver and a wrong pointer in the free routine.

---

...

drivers/spi/mxc_spi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, · line 154

Quoted 6 lines
drivers/spi/mxc_spi.c +2 -2
 	for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
 	     i < n_blks;
-	     i++, in_l++, out_l++, bitlen -= 32)
-		*in_l = spi_xchg_single(slave, *out_l, bitlen);
+	     i++, in_l++, out_l++)
+		*in_l = spi_xchg_single(slave, *out_l, flags);

Please use TABs for indentation, and add curly braces because of the multi-line for construct.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There are three principal ways to lose money: wine, women, and engi-
neers. While the first two are more pleasant, the third is by far the
more certain."                           - Baron Rothschild, ca. 1800
#3 lore raw

PATCH 1/9 i.MX31: fix SPI driver for shorter than 32 bit transfers

Quoted 9 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

Quoted 5 lines · In message <[email protected]> you wrote:

Fix 8 and 16-bit transfers in mxc_spi driver and a wrong pointer in the free routine.

---

...

Quoted 9 lines

drivers/spi/mxc_spi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, · line 154

Quoted 6 lines
drivers/spi/mxc_spi.c +2 -2
 	for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
 	     i < n_blks;
-	     i++, in_l++, out_l++, bitlen -= 32)
-		*in_l = spi_xchg_single(slave, *out_l, bitlen);
+	     i++, in_l++, out_l++)
+		*in_l = spi_xchg_single(slave, *out_l, flags);

Please use TABs for indentation, and add curly braces because of the multi-line for construct.

I think you mistook the continuation line for the for-body? Why would you want to TAB the continuation line, making it even less distinct from the body of the for-statement?

Besides, the above patch doesn't change formatting in any way.

That said, it could certainly use most of the loop content being moved into the body.

-Scott

#4 lore raw

PATCH 1/9 i.MX31: fix SPI driver for shorter than 32 bit transfers

Dear Scott Wood,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+	     i++, in_l++, out_l++)
+		*in_l = spi_xchg_single(slave, *out_l, flags);

Please use TABs for indentation, and add curly braces because of the multi-line for construct.

I think you mistook the continuation line for the for-body? Why would you want to TAB the continuation line, making it even less distinct from the body of the for-statement?

Your're right.

Guennadi, please ignore this part.

Quoted 1 line

Besides, the above patch doesn't change formatting in any way.

That doesn't mean it should not be fixed if it was wrong :-)

Quoted 2 lines

That said, it could certainly use most of the loop content being moved into the body.

Indeed - that woul dbe much easier to read.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
What kind of love is that?  Not to be loved; never to have shown love.
	-- Commissioner Nancy Hedford, "Metamorphosis",
	   stardate 3219.8
#5 lore raw

[U-Boot] MPC8548_eTSEC to Marvell 88E1145 E0 version Phy Initialization

Hello,

We have a custom board with MPC8548E processor.
eTSECn are connected to a Marvell 88E1145 PHY(Quad PHY- 4 Ports) chip. Connection is of type RGMII.
Also, we are able to read all the PHY addresses and registers. But the contents are not according to our usage, this is due to the default h/w configuration pins on PHY chip.
We also read in the Marvell data sheet that PHY chip is register configurable too.
But during initialization ( under drivers/tsec.c) below, even though I'm giving {MIIM_ANAR, MIIM_ANAR_INIT, NULL},
It is not reflecting in the register after system boots up.

What might be the problem?? Please help me in this regard.

static struct phy_info phy_info_M88E1145 = {
        0x01410cd,
        "Marvell 88E1145",
        4,
        (struct phy_cmd[]){     /* config */
                           /* Reset the PHY */
                           {MIIM_CONTROL, MIIM_CONTROL_RESET, NULL},

                           /* Errata E0, E1 */
                           {29, 0x001b, NULL},
                           {30, 0x418f, NULL},
                           {29, 0x0016, NULL},
                           {30, 0xa2da, NULL},

                           /*Configure the PHY*/
                           {MIIM_GBIT_CONTROL, MIIM_GBIT_CONTROL_INIT,

NULL},
{MIIM_STATUS, miim_read, NULL}, {MIIM_ANAR, MIIM_ANAR_INIT, NULL}, {MIIM_88E1011_PHY_SCR,
MIIM_88E1011_PHY_MDI_X_AUTO,NULL},

                           {MIIM_88E1145_PHY_EXT_CR, 0, &m88e1145_setmode},
                           {MIIM_CONTROL, MIIM_CONTROL_RESET, NULL},
                           {MIIM_CONTROL, MIIM_CONTROL_INIT, NULL},
                           {miim_end,}
                           },
        (struct phy_cmd[]){     /* startup */
                           /* Status is read once to clear old link state */
                           {MIIM_STATUS, miim_read, NULL},
                           /* Auto-negotiate */
                           {MIIM_STATUS, miim_read, &mii_parse_sr},

{MIIM_88E1111_PHY_LED_CONTROL,MIIM_88E1111_PHY_LED_DIRECT, NULL},

                           /* Read the Status */
                           {MIIM_88E1011_PHY_STATUS,
miim_read,&mii_parse_88E1011_psr},
                           {miim_end,}
                           },
        (struct phy_cmd[]){     /* shutdown */
                           {miim_end,}
                           },
};

Thanks,
Ajeesh Kumar

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments contained in it.

#7 lore raw

PATCH 1/9 i.MX31: fix SPI driver for shorter than 32 bit transfers

Quoted 10 lines · On Wednesday 04 February 2009 17:39:45 Jean-Christophe PLAGNIOL-VILLARD wrote:
Quoted 7 lines · Guennadi Liakhovetski

Fix 8 and 16-bit transfers in mxc_spi driver and a wrong pointer in the free routine.

---

No SPI custodian, so, Jean-Christophe will have to Ack it?

I'd like to have Mike and Haaward ack too

i dont have any arm hardware let alone familiar with any hardware-level things like the SPI controller. so from a quick high level look ...

does this controller actually support transfers that arent a multiple of 8 ? if the smallest increment you can do is 8bits, then you should be rejecting anything that isnt a multiple of it rather than holding the user's hand. as for the assumption that "more than 32bits means do 32bit transfers", that sounds plain wrong to me. u-boot should do exactly as instructed and nothing more/less. so if the user tries to send 40bits, that better be 40bits and not 64bits.

the spi_free_slave() change looks correct ... not that it should change the generated code as spi_slave is the first member of mxc_spi_slave, so they'll be the same pointer and gcc will do the right thing.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090204/d6316726/attachment.pgp

#8 lore raw

PATCH 1/9 i.MX31: fix SPI driver for shorter than 32 bit transfers

Quoted 8 lines · Mike Frysinger
Quoted 7 lines · On Wednesday 04 February 2009 17:39:45 Jean-Christophe PLAGNIOL-VILLARD wrote:
Quoted 6 lines · Guennadi Liakhovetski

Fix 8 and 16-bit transfers in mxc_spi driver and a wrong pointer in the free routine.

---

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

No SPI custodian, so, Jean-Christophe will have to Ack it?

I'd like to have Mike and Haaward ack too

i dont have any arm hardware let alone familiar with any hardware-level things like the SPI controller. so from a quick high level look ...

does this controller actually support transfers that arent a multiple of 8 ?

Yes, it does.

Quoted 6 lines

if the smallest increment you can do is 8bits, then you should be rejecting anything that isnt a multiple of it rather than holding the user's hand. as for the assumption that "more than 32bits means do 32bit transfers", that sounds plain wrong to me. u-boot should do exactly as instructed and nothing more/less. so if the user tries to send 40bits, that better be 40bits and not 64bits.

That's what my patch would do, but it is actually unclear to me what you should do for 40 bits? Do you want to send 32 + 8 or 20 + 20 or?.. In fact, I would reject if (bitlen > 32 && (bitlen & 31)). But, for example, mpc8xxx_spi.c also first sends data in 32-bit chunks, and then the rest. But I just noticed there is another bug in my driver, the bit-length in the control register is set wrongly if (bitlen > 32). Also, the function can be simplified by putting the 32-bit loop bofore residue transfer. I'll change both in the next revision.

Quoted 3 lines

the spi_free_slave() change looks correct ... not that it should change the generated code as spi_slave is the first member of mxc_spi_slave, so they'll be the same pointer and gcc will do the right thing.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#9 lore raw

PATCH 1/9 i.MX31: fix SPI driver for shorter than 32 bit transfers

Quoted 8 lines · On Thursday 05 February 2009 03:28:17 Guennadi Liakhovetski wrote:
Quoted 6 lines · Mike Frysinger

if the smallest increment you can do is 8bits, then you should be rejecting anything that isnt a multiple of it rather than holding the user's hand. as for the assumption that "more than 32bits means do 32bit transfers", that sounds plain wrong to me. u-boot should do exactly as instructed and nothing more/less. so if the user tries to send 40bits, that better be 40bits and not 64bits.

Quoted 8 lines

That's what my patch would do, but it is actually unclear to me what you should do for 40 bits? Do you want to send 32 + 8 or 20 + 20 or?.. In fact, I would reject if (bitlen > 32 && (bitlen & 31)). But, for example, mpc8xxx_spi.c also first sends data in 32-bit chunks, and then the rest. But I just noticed there is another bug in my driver, the bit-length in the control register is set wrongly if (bitlen > 32). Also, the function can be simplified by putting the 32-bit loop bofore residue transfer. I'll change both in the next revision.

sending out in 32bit chunks and then sending out the remainder with the correct size sounds like the most efficient. there is no requirement in terms of how bits get grouped as any sane SPI device should operate properly as data is only read when the clock is asserted, and the clock is only asserted when actual bits are being shifted.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090205/06d17ff8/attachment.pgp

#10 lore raw

PATCH 2/9 i.MX31: add a simple gpio driver

In reply to Guennadi Liakhovetski

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

Jean-Christophe: also an ack from you, please.

 drivers/gpio/Makefile            |    3 +-
 drivers/gpio/mx31_gpio.c         |   71 ++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31.h |    9 +++++
 3 files changed, 82 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/mx31_gpio.c
drivers/gpio/Makefile +2 -1
index dd618ed..ce049e4 100644
@@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB 	:= $(obj)libgpio.a
 
-COBJS-$(CONFIG_PCA953X)	+= pca953x.o
+COBJS-$(CONFIG_PCA953X)		+= pca953x.o
+COBJS-$(CONFIG_MX31_GPIO)	+= mx31_gpio.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/gpio/mx31_gpio.c new file +71 -0

71 lines not on this page · raw message

include/asm-arm/arch-mx31/mx31.h +9 -0
index 0552c27..fb8d8c0 100644
@@ -27,4 +27,13 @@
 extern u32 mx31_get_ipg_clk(void);
 extern void mx31_gpio_mux(unsigned long mode);
 
+enum mx31_gpio_direction {
+	MX31_GPIO_DIRECTION_IN,
+	MX31_GPIO_DIRECTION_OUT,
+};
+
+extern void mx31_gpio_direction(unsigned int gpio,
+				enum mx31_gpio_direction direction);
+extern void mx31_gpio_set(unsigned int gpio, unsigned int value);
+
 #endif /* __ASM_ARCH_MX31_H */
Signature · 1 line
1.5.4
#11 lore raw

PATCH 2/9 i.MX31: add a simple gpio driver

Hi

2009/2/4 Guennadi Liakhovetski <[email protected]>:

Quoted 19 lines

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

Jean-Christophe: also an ack from you, please.

 drivers/gpio/Makefile            |    3 +-
 drivers/gpio/mx31_gpio.c         |   71 ++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31.h |    9 +++++
 3 files changed, 82 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/mx31_gpio.c
drivers/gpio/Makefile +0 -0
index dd618ed..ce049e4 100644

drivers/gpio/Makefile include $(TOPDIR)/config.mk · line 29

Quoted 6 lines
drivers/gpio/Makefile +2 -1
@@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB    := $(obj)libgpio.a
 
-COBJS-$(CONFIG_PCA953X)        += pca953x.o
+COBJS-$(CONFIG_PCA953X)                += pca953x.o
+COBJS-$(CONFIG_MX31_GPIO)      += mx31_gpio.o

Might want to sort these in alphabetically order.

...

include/asm-arm/arch-mx31/mx31.h line 28

Quoted 7 lines
include/asm-arm/arch-mx31/mx31.h +0 -0
index 0552c27..fb8d8c0 100644
@@ -27,4 +27,13 @@
 extern u32 mx31_get_ipg_clk(void);
 extern void mx31_gpio_mux(unsigned long mode);

'extern' is not needed here. Some header files seems to have extern while some don't.

include/asm-arm/arch-mx31/mx31.h line 37

Quoted 9 lines
include/asm-arm/arch-mx31/mx31.h +8 -0
+enum mx31_gpio_direction {
+       MX31_GPIO_DIRECTION_IN,
+       MX31_GPIO_DIRECTION_OUT,
+};
+
+extern void mx31_gpio_direction(unsigned int gpio,
+                               enum mx31_gpio_direction direction);
+extern void mx31_gpio_set(unsigned int gpio, unsigned int value);

'extern' is not needed here.

Regards, Magnus

#12 lore raw

PATCH v3 2/9 i.MX31: add a simple gpio driver

In reply to Guennadi Liakhovetski

Hello Guennadi,

drivers/gpio/mx31_gpio.c line 3

Quoted 9 lines
drivers/gpio/mx31_gpio.c new file +3 -0
new file mode 100644
index 0000000..871601f
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DEXN Software Engineering, <[email protected]>

please fix: s/DEXN/DENX/

Best regards,
Anatolij

#13 lore raw

PATCH 2/9 i.MX31: add a simple gpio driver

Quoted 13 lines · Anatolij Gustschin

Hello Guennadi,

drivers/gpio/mx31_gpio.c line 3

Quoted 9 lines
drivers/gpio/mx31_gpio.c new file +3 -0
new file mode 100644
index 0000000..871601f
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DEXN Software Engineering, <[email protected]>

please fix: s/DEXN/DENX/

Oops, * copypaste = 4 occurrences in 3 patches:-(

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#14 lore raw

PATCH v3 2/9 i.MX31: add a simple gpio driver

In reply to Guennadi Liakhovetski
Quoted 7 lines · Guennadi Liakhovetski

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

Jean-Christophe: also an ack from you, please.

I'd like to see a gpio_lib one day to simplify gpio use in u-boot

Quoted 48 lines
 drivers/gpio/Makefile            |    3 +-
 drivers/gpio/mx31_gpio.c         |   71 ++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31.h |    9 +++++
 3 files changed, 82 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/mx31_gpio.c
drivers/gpio/Makefile +2 -1
index dd618ed..ce049e4 100644
@@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB 	:= $(obj)libgpio.a
 
-COBJS-$(CONFIG_PCA953X)	+= pca953x.o
+COBJS-$(CONFIG_PCA953X)		+= pca953x.o
+COBJS-$(CONFIG_MX31_GPIO)	+= mx31_gpio.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/gpio/mx31_gpio.c new file +21 -0
new file mode 100644
index 0000000..871601f
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DEXN Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA

drivers/gpio/mx31_gpio.c line 31

Quoted 10 lines
drivers/gpio/mx31_gpio.c new file +10 -0
+ */
+#include <common.h>
+#include <asm/arch/mx31.h>
+#include <asm/arch/mx31-regs.h>
+
+/* GPIO port description */
+static unsigned long gpio_ports[] = {
+	[0] = 0x53fcc000,
+	[1] = 0x53fd0000,
+	[2] = 0x53fa4000,

hardcoded?

drivers/gpio/mx31_gpio.c line 34

Quoted 3 lines
drivers/gpio/mx31_gpio.c new file +3 -0
+};
+
+void mx31_gpio_direction(unsigned int gpio, enum mx31_gpio_direction direction)

enum? do we really need this?

drivers/gpio/mx31_gpio.c line 39

Quoted 5 lines
drivers/gpio/mx31_gpio.c new file +5 -0
+{
+	unsigned int port = gpio >> 5;
+	u32 l;
+
+	if (port > sizeof(gpio_ports) / sizeof(gpio_ports[0]) - 1)

ARRAY_SIZE?

Quoted 4 lines
drivers/gpio/mx31_gpio.c new file +4 -0
+		return;
+
+	gpio &= 0x1f;
+

drivers/gpio/mx31_gpio.c line 53

Quoted 10 lines
drivers/gpio/mx31_gpio.c new file +10 -0
+	l = __REG(gpio_ports[port] + 4);
+	switch (direction) {
+	case MX31_GPIO_DIRECTION_OUT:
+		l |= 1 << gpio;
+		break;
+	case MX31_GPIO_DIRECTION_IN:
+		l &= ~(1 << gpio);
+	}
+	__REG(gpio_ports[port] + 4) = l;
+}

Best Regards,
J.

#15 lore raw

PATCH 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

In reply to Guennadi Liakhovetski

Some SPI devices have special requirements on chip-select handling. With this patch we can use a GPIO as a chip-select and strictly follow the SPI_XFER_BEGIN and SPI_XFER_END flags.

---

Jean-Christophe: one more for you to ack.

 drivers/spi/mxc_spi.c |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)
drivers/spi/mxc_spi.c +29 -6
index 9267341..eacd36c 100644
@@ -32,6 +32,8 @@
 
 #else
 
+#include <asm/arch/mx31.h>
+
 #define MXC_CSPIRXDATA		0x00
 #define MXC_CSPITXDATA		0x04
 #define MXC_CSPICTRL		0x08
@@ -68,6 +70,7 @@ struct mxc_spi_slave {
 	struct spi_slave slave;
 	unsigned long	base;
 	u32		ctrl_reg;
+	int		gpio;
 };
 
 static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave)
@@ -91,6 +94,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data,
 	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
 	unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_BEGIN))
+		mx31_gpio_set(mxcs->gpio, !!(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));
+
 	reg_write(mxcs->base + MXC_CSPITXDATA, data);
 
 	cfg_reg |= MXC_CSPICTRL_XCH;
@@ -100,6 +106,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data,
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
+		mx31_gpio_set(mxcs->gpio, !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));
+
 	return reg_read(mxcs->base + MXC_CSPIRXDATA);
 }
 
@@ -175,10 +184,28 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	unsigned int ctrl_reg;
 	struct mxc_spi_slave *mxcs;
 
-	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]) ||
-	    cs > 3)
+	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]))
+		return NULL;
+
+	mxcs = malloc(sizeof(struct mxc_spi_slave));
+	if (!mxcs)
 		return NULL;
 
+	/*
+	 * Some SPI devices require active chip-select over multiple
+	 * transactions, we achieve this using a GPIO. Still, the SPI
+	 * controller has to be configured to use one of its own chipselects.
+	 * To use this feature you have to call spi_setup_slave() with
+	 * cs = internal_cs | (gpio << 8), and you have to use some unused
+	 * on this SPI controller cs between 0 and 3.
+	 */
+	if (cs > 3) {
+		mxcs->gpio = cs >> 8;
+		cs &= 3;
+		mx31_gpio_direction(mxcs->gpio, MX31_GPIO_DIRECTION_OUT);
+	} else
+		mxcs->gpio = -1;
+
 	ctrl_reg = MXC_CSPICTRL_CHIPSELECT(cs) |
 		MXC_CSPICTRL_BITCOUNT(31) |
 		MXC_CSPICTRL_DATARATE(7) | /* FIXME: calculate data rate */
@@ -192,10 +219,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	if (mode & SPI_CS_HIGH)
 		ctrl_reg |= MXC_CSPICTRL_SSPOL;
 
-	mxcs = malloc(sizeof(struct mxc_spi_slave));
-	if (!mxcs)
-		return NULL;
-
 	mxcs->slave.bus = bus;
 	mxcs->slave.cs = cs;
 	mxcs->base = spi_bases[bus];
Signature · 1 line
1.5.4
#16 lore raw

PATCH v3 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

Hello Guennadi,

Quoted 4 lines
drivers/spi/mxc_spi.c +0 -0
index 9267341..eacd36c 100644

<snip>

drivers/spi/mxc_spi.c static u32 spi_xchg_single(struct spi_slave *slave, u32 data, · line 98

Quoted 6 lines
drivers/spi/mxc_spi.c +2 -0
@@ -91,6 +94,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data,
 	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
 	unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_BEGIN))
+		mx31_gpio_set(mxcs->gpio, !!(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));

above line to long (> 80 chars).

Also you add mx31_gpio_* calls from the new mx31 GPIO driver to this driver unconditionally. I think, this will break linking for imx31_litekit and mx31ads boards as these boards include the mxc_spi driver but do not define CONFIG_MX31_GPIO. How can we separate this? Or am I missing something?

drivers/spi/mxc_spi.c static u32 spi_xchg_single(struct spi_slave *slave, u32 data, · line 110

Quoted 6 lines
drivers/spi/mxc_spi.c +2 -0
@@ -100,6 +106,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data,
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
+		mx31_gpio_set(mxcs->gpio, !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));

above line to long (> 80 chars).

Best regargs,
Anatolij

#17 lore raw

PATCH 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

Quoted 22 lines · Anatolij Gustschin

Hello Guennadi,

Quoted 4 lines
drivers/spi/mxc_spi.c +0 -0
index 9267341..eacd36c 100644

<snip>

drivers/spi/mxc_spi.c static u32 spi_xchg_single(struct spi_slave *slave, u32 data, · line 98

Quoted 6 lines
drivers/spi/mxc_spi.c +2 -0
@@ -91,6 +94,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data,
 	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
 	unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_BEGIN))
+		mx31_gpio_set(mxcs->gpio, !!(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));

above line to long (> 80 chars).

Also you add mx31_gpio_* calls from the new mx31 GPIO driver to this driver unconditionally. I think, this will break linking for imx31_litekit and mx31ads boards as these boards include the mxc_spi driver but do not define CONFIG_MX31_GPIO. How can we separate this? Or am I missing something?

Quoted 8 lines

drivers/spi/mxc_spi.c static u32 spi_xchg_single(struct spi_slave *slave, u32 data, · line 110

Quoted 6 lines
drivers/spi/mxc_spi.c +2 -0
@@ -100,6 +106,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data,
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
+		mx31_gpio_set(mxcs->gpio, !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));

above line to long (> 80 chars).

Right, will fix all above.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#18 lore raw

PATCH 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

In reply to Guennadi Liakhovetski

Dear Guennadi Liakhovetski,

Quoted 5 lines · In message <[email protected]> you wrote:

Some SPI devices have special requirements on chip-select handling. With this patch we can use a GPIO as a chip-select and strictly follow the SPI_XFER_BEGIN and SPI_XFER_END flags.

...

drivers/spi/mxc_spi.c static u32 spi_xchg_single(struct spi_slave *slave, u32 data, · line 99

Quoted 3 lines
drivers/spi/mxc_spi.c +3 -0
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_BEGIN))
+		mx31_gpio_set(mxcs->gpio, !!(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));
+

If you really need the '!!' then I consider the code to be broken.

Omit?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A woman should have compassion.
	-- Kirk, "Catspaw", stardate 3018.2
#19 lore raw

PATCH v3 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

In reply to Guennadi Liakhovetski
Quoted 71 lines · Guennadi Liakhovetski

Some SPI devices have special requirements on chip-select handling. With this patch we can use a GPIO as a chip-select and strictly follow the SPI_XFER_BEGIN and SPI_XFER_END flags.

---

Jean-Christophe: one more for you to ack.

 drivers/spi/mxc_spi.c |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)
drivers/spi/mxc_spi.c +19 -2
index 9267341..eacd36c 100644
@@ -32,6 +32,8 @@
 
 #else
 
+#include <asm/arch/mx31.h>
+
 #define MXC_CSPIRXDATA		0x00
 #define MXC_CSPITXDATA		0x04
 #define MXC_CSPICTRL		0x08
@@ -68,6 +70,7 @@ struct mxc_spi_slave {
 	struct spi_slave slave;
 	unsigned long	base;
 	u32		ctrl_reg;
+	int		gpio;
 };
 
 static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave)
@@ -91,6 +94,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data,
 	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
 	unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_BEGIN))
+		mx31_gpio_set(mxcs->gpio, !!(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));
+
 	reg_write(mxcs->base + MXC_CSPITXDATA, data);
 
 	cfg_reg |= MXC_CSPICTRL_XCH;
@@ -100,6 +106,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data,
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
+		mx31_gpio_set(mxcs->gpio, !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));
+
 	return reg_read(mxcs->base + MXC_CSPIRXDATA);
 }
 
@@ -175,10 +184,28 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	unsigned int ctrl_reg;
 	struct mxc_spi_slave *mxcs;
 
-	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]) ||
-	    cs > 3)
+	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]))
+		return NULL;
+
+	mxcs = malloc(sizeof(struct mxc_spi_slave));
+	if (!mxcs)
 		return NULL;
 
+	/*
+	 * Some SPI devices require active chip-select over multiple
+	 * transactions, we achieve this using a GPIO. Still, the SPI
+	 * controller has to be configured to use one of its own chipselects.
+	 * To use this feature you have to call spi_setup_slave() with

drivers/spi/mxc_spi.c struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, · line 208

Quoted 10 lines
drivers/spi/mxc_spi.c +10 -0
+	 * cs = internal_cs | (gpio << 8), and you have to use some unused
+	 * on this SPI controller cs between 0 and 3.
+	 */
+	if (cs > 3) {
+		mxcs->gpio = cs >> 8;
+		cs &= 3;
+		mx31_gpio_direction(mxcs->gpio, MX31_GPIO_DIRECTION_OUT);
+	} else
+		mxcs->gpio = -1;
+

why not add a callback for the chipselect instead
as example if you have to use a gpio extender it will simplest to implent instead of hack the SPI driver

Best Regars,
J.

#20 lore raw

PATCH 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines · Guennadi Liakhovetski
drivers/spi/mxc_spi.c +10 -0
+	/*
+	 * Some SPI devices require active chip-select over multiple
+	 * transactions, we achieve this using a GPIO. Still, the SPI
+	 * controller has to be configured to use one of its own chipselects.
+	 * To use this feature you have to call spi_setup_slave() with
+	 * cs = internal_cs | (gpio << 8), and you have to use some unused
+	 * on this SPI controller cs between 0 and 3.
+	 */
+	if (cs > 3) {
+		mxcs->gpio = cs >> 8;
Quoted 8 lines

drivers/spi/mxc_spi.c struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, · line 208

Quoted 5 lines
drivers/spi/mxc_spi.c +5 -0
+		cs &= 3;
+		mx31_gpio_direction(mxcs->gpio, MX31_GPIO_DIRECTION_OUT);
+	} else
+		mxcs->gpio = -1;
+

why not add a callback for the chipselect instead
as example if you have to use a gpio extender it will simplest to implent instead of hack the SPI driver

and how shall I pass this callback to

struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)

?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#21 lore raw

PATCH 4/9 A driver for the S6E63D6 SPI display controller from Samsung

In reply to Guennadi Liakhovetski

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

---
 drivers/video/Makefile  |    1 +
 drivers/video/s6e63d6.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 include/s6e63d6.h       |   36 +++++++++++++++++++++++++
 3 files changed, 105 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/s6e63d6.c
 create mode 100644 include/s6e63d6.h
drivers/video/Makefile +1 -0
index 7fba29f..a7dc74c 100644
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o
+COBJS-$(CONFIG_DISPLAY_S6E63D6) += s6e63d6.o
 COBJS-y += videomodes.o
 
 COBJS	:= $(COBJS-y)
drivers/video/s6e63d6.c new file +68 -0

68 lines not on this page · raw message

include/s6e63d6.h new file +36 -0
new file mode 100644
index 0000000..9665dc5
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DEXN Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef _S6E63D6_H_
+#define _S6E63D6_H_
+
+struct s6e63d6 {
+	unsigned int bus;
+	unsigned int cs;
+	struct spi_slave *slave;
+};
+
+extern int s6e63d6_init(struct s6e63d6 *);
+extern int s6e63d6_index(struct s6e63d6 *, u8);
+extern int s6e63d6_param(struct s6e63d6 *, u16);
+
+#endif
Signature · 1 line
1.5.4
#22 lore raw

PATCH 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Hi

2009/2/4 Guennadi Liakhovetski <[email protected]>:

Quoted 129 lines

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

---
 drivers/video/Makefile  |    1 +
 drivers/video/s6e63d6.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 include/s6e63d6.h       |   36 +++++++++++++++++++++++++
 3 files changed, 105 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/s6e63d6.c
 create mode 100644 include/s6e63d6.h
drivers/video/Makefile +1 -0
index 7fba29f..a7dc74c 100644
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o
+COBJS-$(CONFIG_DISPLAY_S6E63D6) += s6e63d6.o
 COBJS-y += videomodes.o
 
 COBJS  := $(COBJS-y)
drivers/video/s6e63d6.c new file +68 -0
new file mode 100644
index 0000000..27ff976
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DEXN Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+#include <spi.h>
+#include <s6e63d6.h>
+
+/* Hardware selected value - 0 or 0x4 */
+#define ID 0
+
+/*
+ * Each transfer is performed as:
+ * 1. chip-select active
+ * 2. send 8-bit start code
+ * 3. send 16-bit data
+ * 4. chip-select inactive
+ */
+static int send_word(struct spi_slave *spi, u8 rs, u16 data)
+{
+       u32 buf8 = 0x70 | ID | (rs & 2);
+       u32 buf16 = cpu_to_le16(data);
+       u32 buf_in;
+       int err;
+
+       err = spi_xfer(spi, 8, &buf8, &buf_in, SPI_XFER_BEGIN);
+       if (err)
+               return err;
+       return spi_xfer(spi, 16, &buf16, &buf_in, SPI_XFER_END);
+}
+
+/* Index and param differ in Register Select bit */
+int s6e63d6_index(struct s6e63d6 *data, u8 idx)
+{
+       return send_word(data->slave, 0, idx);
+}
+
+int s6e63d6_param(struct s6e63d6 *data, u16 param)
+{
+       return send_word(data->slave, 2, param);
+}
+
+int s6e63d6_init(struct s6e63d6 *data)
+{
+       data->slave = spi_setup_slave(data->bus, data->cs, 100000, SPI_MODE_3);
+       if (!data->slave)
+               return 1;
+
+       return 0;
+}
include/s6e63d6.h new file +24 -0
new file mode 100644
index 0000000..9665dc5
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DEXN Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef _S6E63D6_H_
+#define _S6E63D6_H_

include/s6e63d6.h line 34

Quoted 10 lines
include/s6e63d6.h new file +10 -0
+
+struct s6e63d6 {
+       unsigned int bus;
+       unsigned int cs;
+       struct spi_slave *slave;
+};
+
+extern int s6e63d6_init(struct s6e63d6 *);
+extern int s6e63d6_index(struct s6e63d6 *, u8);
+extern int s6e63d6_param(struct s6e63d6 *, u16);

'extern' not needed.

Also, personally I prefer to have the parameter names in the prototypes as well, not just the data types.

Regards, Magnus

#23 lore raw

PATCH 4/9 A driver for the S6E63D6 SPI display controller from Samsung

In message <[email protected]> Magnus Lilja wrote:
...

Quoted 8 lines

include/s6e63d6.h line 34

Quoted 3 lines
include/s6e63d6.h new file +3 -0
+extern int s6e63d6_init(struct s6e63d6 *);
+extern int s6e63d6_index(struct s6e63d6 *, u8);
+extern int s6e63d6_param(struct s6e63d6 *, u16);

'extern' not needed.

Also, personally I prefer to have the parameter names in the prototypes as well, not just the data types.

Strongly supported!

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
My play was a complete success.  The audience was a failure.
#24 lore raw

PATCH 4/9 A driver for the S6E63D6 SPI display controller from Samsung

In reply to Guennadi Liakhovetski

Dear Guennadi Liakhovetski,

Quoted 5 lines · In message <[email protected]> you wrote:

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

...

drivers/video/Makefile COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o · line 37

Quoted 9 lines
drivers/video/Makefile +1 -0
index 7fba29f..a7dc74c 100644
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o
+COBJS-$(CONFIG_DISPLAY_S6E63D6) += s6e63d6.o

Please keep lists sorted.

And maybe we can omit the "DISPLAY_" part?

Quoted 1 line
drivers/video/Makefile +1 -0
+++ b/drivers/video/s6e63d6.c

...

drivers/video/Makefile

Quoted 2 lines
drivers/video/Makefile +2 -0
+/* Hardware selected value - 0 or 0x4 */
+#define ID 0

Should this go into the board config file?

Quoted 9 lines
drivers/video/Makefile +9 -0
+/* Index and param differ in Register Select bit */
+int s6e63d6_index(struct s6e63d6 *data, u8 idx)
+{
+	return send_word(data->slave, 0, idx);
+}
+
+int s6e63d6_param(struct s6e63d6 *data, u16 param)
+{
+	return send_word(data->slave, 2, param);

drivers/video/Makefile

Quoted 10 lines
drivers/video/Makefile +10 -0
+}
+
+int s6e63d6_init(struct s6e63d6 *data)
+{
+	data->slave = spi_setup_slave(data->bus, data->cs, 100000, SPI_MODE_3);
+	if (!data->slave)
+		return 1;
+
+	return 0;
+}

static? or inline?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Substitute "damn" every time you're inclined to write "very"; your
editor will delete it and the writing will be just as it should be.
                - Mark Twain
#25 lore raw

PATCH 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Quoted 21 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

Quoted 5 lines · In message <[email protected]> you wrote:

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

...

drivers/video/Makefile COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o · line 37

Quoted 9 lines
drivers/video/Makefile +1 -0
index 7fba29f..a7dc74c 100644
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o
+COBJS-$(CONFIG_DISPLAY_S6E63D6) += s6e63d6.o

Please keep lists sorted.

Quoted 1 line

And maybe we can omit the "DISPLAY_" part?

Well, I tried to follow the CONFIG_VIDEO_* style, but can remove, sure.

Quoted 6 lines
Quoted 1 line
drivers/video/Makefile +1 -0
+++ b/drivers/video/s6e63d6.c

...

drivers/video/Makefile

Quoted 2 lines
drivers/video/Makefile +2 -0
+/* Hardware selected value - 0 or 0x4 */
+#define ID 0

Should this go into the board config file?

Can do.

Quoted 13 lines
Quoted 13 lines
drivers/video/Makefile +13 -0
+/* Index and param differ in Register Select bit */
+int s6e63d6_index(struct s6e63d6 *data, u8 idx)
+{
+	return send_word(data->slave, 0, idx);
+}
+
+int s6e63d6_param(struct s6e63d6 *data, u16 param)
+{
+	return send_word(data->slave, 2, param);
+}
+
+int s6e63d6_init(struct s6e63d6 *data)
+{
Quoted 8 lines

drivers/video/Makefile

Quoted 6 lines
drivers/video/Makefile +6 -0
+	data->slave = spi_setup_slave(data->bus, data->cs, 100000, SPI_MODE_3);
+	if (!data->slave)
+		return 1;
+
+	return 0;
+}

static? or inline?

Neither, nor. It is declared in the header in this patch and called in [PATCH 9/9].

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#26 lore raw

PATCH v3 4/9 A driver for the S6E63D6 SPI display controller from Samsung

In reply to Guennadi Liakhovetski

Hi Guennadi,

include/s6e63d6.h line 30

Quoted 5 lines
include/s6e63d6.h new file +5 -0
+struct s6e63d6 {
+	unsigned int bus;
+	unsigned int cs;
+	struct spi_slave *slave;
+};

could we use "bus" and "cs" from struct spi_slave? "struct spi_slave" declares them already. Maybe we should drop struct s6e63d6 entirely and use struct spi_slave instead?

Best regards,
Anatolij

#27 lore raw

PATCH 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Quoted 11 lines · Anatolij Gustschin

Hi Guennadi,

include/s6e63d6.h line 30

Quoted 5 lines
include/s6e63d6.h new file +5 -0
+struct s6e63d6 {
+	unsigned int bus;
+	unsigned int cs;
+	struct spi_slave *slave;
+};

could we use "bus" and "cs" from struct spi_slave? "struct spi_slave" declares them already. Maybe we should drop struct s6e63d6 entirely and use struct spi_slave instead?

No, cs and bus here are input parameters, set up by the caller to s6e63d6_init() and used by the latter to setup the SPI-slave. slave is driver-"private" field, the caller doesn't need to know what is under s6e63d6.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#28 lore raw

PATCH v3 4/9 A driver for the S6E63D6 SPI display controller from Samsung

In reply to Guennadi Liakhovetski
Quoted 49 lines · Guennadi Liakhovetski

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

---
 drivers/video/Makefile  |    1 +
 drivers/video/s6e63d6.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 include/s6e63d6.h       |   36 +++++++++++++++++++++++++
 3 files changed, 105 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/s6e63d6.c
 create mode 100644 include/s6e63d6.h
drivers/video/Makefile +1 -0
index 7fba29f..a7dc74c 100644
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o
+COBJS-$(CONFIG_DISPLAY_S6E63D6) += s6e63d6.o
 COBJS-y += videomodes.o
 
 COBJS	:= $(COBJS-y)
drivers/video/s6e63d6.c new file +18 -0
new file mode 100644
index 0000000..27ff976
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DEXN Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License

drivers/video/s6e63d6.c line 28

Quoted 10 lines
drivers/video/s6e63d6.c new file +10 -0
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+#include <spi.h>
+#include <s6e63d6.h>
+
+/* Hardware selected value - 0 or 0x4 */
+#define ID 0

Why hardcoded?

drivers/video/s6e63d6.c line 39

Quoted 11 lines
drivers/video/s6e63d6.c new file +11 -0
+
+/*
+ * Each transfer is performed as:
+ * 1. chip-select active
+ * 2. send 8-bit start code
+ * 3. send 16-bit data
+ * 4. chip-select inactive
+ */
+static int send_word(struct spi_slave *spi, u8 rs, u16 data)
+{
+	u32 buf8 = 0x70 | ID | (rs & 2);

why?

drivers/video/s6e63d6.c line 49

Quoted 10 lines
drivers/video/s6e63d6.c new file +10 -0
+	u32 buf16 = cpu_to_le16(data);
+	u32 buf_in;
+	int err;
+
+	err = spi_xfer(spi, 8, &buf8, &buf_in, SPI_XFER_BEGIN);
+	if (err)
+		return err;
+	return spi_xfer(spi, 16, &buf16, &buf_in, SPI_XFER_END);
+}
+

Best Regards,
J.

#29 lore raw

PATCH 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD

drivers/video/s6e63d6.c line 39

Quoted 11 lines · Guennadi Liakhovetski
drivers/video/s6e63d6.c new file +11 -0
+
+/*
+ * Each transfer is performed as:
+ * 1. chip-select active
+ * 2. send 8-bit start code
+ * 3. send 16-bit data
+ * 4. chip-select inactive
+ */
+static int send_word(struct spi_slave *spi, u8 rs, u16 data)
+{
+	u32 buf8 = 0x70 | ID | (rs & 2);

why?

That's how the start byte looks like:

01110<ID><RS><R/W>

rs is 0 for index or 1 for data, and R/W is 0 for write.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#30 lore raw

PATCH 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Dear Guennadi Liakhovetski,

Quoted 16 lines · In message <[email protected]> you wrote:
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD

drivers/video/s6e63d6.c line 39

Quoted 11 lines · Guennadi Liakhovetski
drivers/video/s6e63d6.c new file +11 -0
+
+/*
+ * Each transfer is performed as:
+ * 1. chip-select active
+ * 2. send 8-bit start code
+ * 3. send 16-bit data
+ * 4. chip-select inactive
+ */
+static int send_word(struct spi_slave *spi, u8 rs, u16 data)
+{
+	u32 buf8 = 0x70 | ID | (rs & 2);

why?

Quoted 5 lines

That's how the start byte looks like:

01110<ID><RS><R/W>

rs is 0 for index or 1 for data, and R/W is 0 for write.

Good. Now add this as comment, please?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Question: How does one get fresh air into a Russian church?
Answer:   One clicks on an icon, and a window opens!
#31 lore raw

PATCH 5/9 ARM: remove unused variable

In reply to Guennadi Liakhovetski

The "size" variable in start_armboot() in lib_arm/board.c is only really used in
#if !defined(CONFIG_SYS_NO_FLASH)
case, remove where unused.

---

This one actually doesn't have to be in this series, so, it can go separately over the ARM tree.

 lib_arm/board.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
lib_arm/board.c +3 -3
index 964f5cc..2257b2e 100644
@@ -287,7 +287,7 @@ void start_armboot (void)
 {
 	init_fnc_t **init_fnc_ptr;
 	char *s;
-#if !defined(CONFIG_SYS_NO_FLASH) || defined (CONFIG_VFD) || defined(CONFIG_LCD)
+#if !defined(CONFIG_SYS_NO_FLASH)
 	ulong size;
 #endif
 #if defined(CONFIG_VFD) || defined(CONFIG_LCD)
@@ -328,7 +328,7 @@ void start_armboot (void)
 	 */
 	/* bss_end is defined in the board-specific linker script */
 	addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-	size = vfd_setmem (addr);
+	vfd_setmem (addr);
 	gd->fb_base = addr;
 #endif /* CONFIG_VFD */
 
@@ -343,7 +343,7 @@ void start_armboot (void)
 		 */
 		/* bss_end is defined in the board-specific linker script */
 		addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-		size = lcd_setmem (addr);
+		lcd_setmem (addr);
 		gd->fb_base = addr;
 	}
 #endif /* CONFIG_LCD */
Signature · 1 line
1.5.4
#32 lore raw

PATCH v3 5/9 ARM: remove unused variable

Quoted 5 lines · Guennadi Liakhovetski

The "size" variable in start_armboot() in lib_arm/board.c is only really used in
#if !defined(CONFIG_SYS_NO_FLASH)
case, remove where unused.

why not remove it
in the CONFIG_SYS_NO_FLASH you can not use it at all

Best Regards,
J.

#33 lore raw

PATCH 5/9 ARM: remove unused variable

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Guennadi Liakhovetski

The "size" variable in start_armboot() in lib_arm/board.c is only really used in
#if !defined(CONFIG_SYS_NO_FLASH)
case, remove where unused.

why not remove it
in the CONFIG_SYS_NO_FLASH you can not use it at all

Sorry? remove what? the "size" variable? Have a look at the code - it is _used_ if CONFIG_SYS_NO_FLASH is _not_ defined, and so it is also defined for this case. Or have I misunderstood you?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#34 lore raw

PATCH v3 5/9 ARM: remove unused variable

Quoted 11 lines · Guennadi Liakhovetski
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Guennadi Liakhovetski

The "size" variable in start_armboot() in lib_arm/board.c is only really used in
#if !defined(CONFIG_SYS_NO_FLASH)
case, remove where unused.

why not remove it
in the CONFIG_SYS_NO_FLASH you can not use it at all

why not do this

Best Regards,
J.
---

lib_arm/board.c +3 -7
index 2358beb..9afd15f 100644
@@ -275,9 +275,6 @@ void start_armboot (void)
 {
 	init_fnc_t **init_fnc_ptr;
 	char *s;
-#if !defined(CONFIG_SYS_NO_FLASH) || defined (CONFIG_VFD) || defined(CONFIG_LCD)
-	ulong size;
-#endif
 #if defined(CONFIG_VFD) || defined(CONFIG_LCD)
 	unsigned long addr;
 #endif
@@ -303,8 +300,7 @@ void start_armboot (void)
 
 #ifndef CONFIG_SYS_NO_FLASH
 	/* configure available FLASH banks */
-	size = flash_init ();
-	display_flash_config (size);
+	display_flash_config (flash_init ());
 #endif /* CONFIG_SYS_NO_FLASH */
 
 #ifdef CONFIG_VFD
@@ -316,7 +312,7 @@ void start_armboot (void)
 	 */
 	/* bss_end is defined in the board-specific linker script */
 	addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-	size = vfd_setmem (addr);
+	vfd_setmem (addr);
 	gd->fb_base = addr;
 #endif /* CONFIG_VFD */
 
@@ -331,7 +327,7 @@ void start_armboot (void)
 		 */
 		/* bss_end is defined in the board-specific linker script */
 		addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-		size = lcd_setmem (addr);
+		lcd_setmem (addr);
 		gd->fb_base = addr;
 	}
 #endif /* CONFIG_LCD */
#35 lore raw

PATCH 6/9 Add 16bpp BMP support

In reply to Guennadi Liakhovetski

From: Mark Jackson <[email protected]>

This patch adds 16bpp BMP support to the common lcd code.

Use CONFIG_BMP_16BPP and set LCD_BPP to LCD_COLOR16 to enable the code.

At the moment it's only been tested on the MIMC200 AVR32 board, but extending this to other platforms should be a simple task !!

---
 common/lcd.c |   49 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 39 insertions(+), 10 deletions(-)
common/lcd.c +39 -10
index 5f73247..14a0d01 100644
@@ -84,7 +84,7 @@ extern void lcd_enable (void);
 static void *lcd_logo (void);
 
 
-#if LCD_BPP == LCD_COLOR8
+#if (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
 extern void lcd_setcolreg (ushort regno,
 				ushort red, ushort green, ushort blue);
 #endif
@@ -656,7 +656,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
 	bpix = NBITS(panel_info.vl_bpix);
 
-	if ((bpix != 1) && (bpix != 8)) {
+	if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
 		printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
 			bpix);
 		return 1;
@@ -738,17 +738,46 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
 	fb   = (uchar *) (lcd_base +
 		(y + height - 1) * lcd_line_length + x);
-	for (i = 0; i < height; ++i) {
-		WATCHDOG_RESET();
-		for (j = 0; j < width ; j++)
+
+	switch (bpix) {
+	case 1: /* pass through */
+	case 8:
+		for (i = 0; i < height; ++i) {
+			WATCHDOG_RESET();
+			for (j = 0; j < width ; j++)
 #if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
-			*(fb++) = *(bmap++);
+				*(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
-			*(fb++)=255-*(bmap++);
+				*(fb++)=255-*(bmap++);
 #endif
-		bmap += (width - padded_line);
-		fb   -= (width + lcd_line_length);
-	}
+			bmap += (width - padded_line);
+			fb   -= (width + lcd_line_length);
+		}
+		break;
+
+#if defined(CONFIG_BMP_16BPP)
+	case 16:
+		for (i = 0; i < height; ++i) {
+			WATCHDOG_RESET();
+			for (j = 0; j < width; j++) {
+#if defined(CONFIG_ATMEL_LCD_BGR555)
+				*(fb++) = ((bmap[0] & 0x1f) << 2) | (bmap[1] & 0x03);
+				*(fb++) = (bmap[0] & 0xe0) | ((bmap[1] & 0x7c) >> 2);
+				bmap += 2;
+#else
+				*(fb++) = *(bmap++);
+				*(fb++) = *(bmap++);
+#endif
+			}
+			bmap += (padded_line - width) * 2;
+			fb   -= (width * 2 + lcd_line_length);
+		}
+		break;
+#endif /* CONFIG_BMP_16BPP */
+
+	default:
+		break;
+	};
 
 	return (0);
 }
Signature · 1 line
1.5.4
#36 lore raw

PATCH 6/9 Add 16bpp BMP support

Dear Guennadi Liakhovetski,

Quoted 6 lines · In message <[email protected]> you wrote:

From: Mark Jackson <[email protected]>

This patch adds 16bpp BMP support to the common lcd code.

Use CONFIG_BMP_16BPP and set LCD_BPP to LCD_COLOR16 to enable the code.

Quoted 8 lines

At the moment it's only been tested on the MIMC200 AVR32 board, but extending this to other platforms should be a simple task !!

---
 common/lcd.c |   49 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 39 insertions(+), 10 deletions(-)

No comment? Please explain why you repost this here?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If all the Chinese simultaneously jumped into the Pacific  off  a  10
foot platform erected 10 feet off their coast, it would cause a tidal
wave that would destroy everything in this country west of Nebraska.
#37 lore raw

PATCH 6/9 Add 16bpp BMP support

Quoted 12 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

Quoted 9 lines · In message <[email protected]> you wrote:

From: Mark Jackson <[email protected]>

This patch adds 16bpp BMP support to the common lcd code.

Use CONFIG_BMP_16BPP and set LCD_BPP to LCD_COLOR16 to enable the code.

At the moment it's only been tested on the MIMC200 AVR32 board, but extending this to other platforms should be a simple task !!

Quoted 7 lines
Quoted 5 lines
---
 common/lcd.c |   49 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 39 insertions(+), 10 deletions(-)

No comment? Please explain why you repost this here?

I explained it in [PATCH 0/9]:

<quote>
A (fixed formatting) version of the

From: Mark Jackson <[email protected]>
Subject: [PATCH] Add 16bpp BMP support

patch is included for completeness.
</quote>

but you're right, would be better to explain it in a non-commit comment to this patch.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#38 lore raw

PATCH v3 6/9 Add 16bpp BMP support

In reply to Guennadi Liakhovetski
Quoted 4 lines · Guennadi Liakhovetski

From: Mark Jackson <[email protected]>

This patch adds 16bpp BMP support to the common lcd code.

Quoted 8 lines

Use CONFIG_BMP_16BPP and set LCD_BPP to LCD_COLOR16 to enable the code.

At the moment it's only been tested on the MIMC200 AVR32 board, but extending this to other platforms should be a simple task !!

---

I'll check on at91

Best Regards,
J.

#39 lore raw

PATCH v3 6/9 Add 16bpp BMP support

In reply to Guennadi Liakhovetski

Hello Guennadi,

common/lcd.c int lcd_display_bitmap(ulong bmp_image, int x, int y) · line 751

Quoted 6 lines

#if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)

common/lcd.c +2 -2
-			*(fb++) = *(bmap++);
+				*(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
-			*(fb++)=255-*(bmap++);
+				*(fb++)=255-*(bmap++);

please add space around '=' and '-' here.

common/lcd.c int lcd_display_bitmap(ulong bmp_image, int x, int y) · line 765

Quoted 3 lines
common/lcd.c +3 -0
+#if defined(CONFIG_ATMEL_LCD_BGR555)
+				*(fb++) = ((bmap[0] & 0x1f) << 2) | (bmap[1] & 0x03);
+				*(fb++) = (bmap[0] & 0xe0) | ((bmap[1] & 0x7c) >> 2);

both lines above to long (> 80), please fix.

Thanks,
Anatolij

#40 lore raw

PATCH v3 6/9 Add 16bpp BMP support

Quoted 10 lines · Anatolij Gustschin

Hello Guennadi,

common/lcd.c int lcd_display_bitmap(ulong bmp_image, int x, int y) · line 751

Quoted 6 lines

#if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)

common/lcd.c +2 -2
-			*(fb++) = *(bmap++);
+				*(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
-			*(fb++)=255-*(bmap++);
+				*(fb++)=255-*(bmap++);

please add space around '=' and '-' here.

Ah, ignore this part as this is addressed in the next patch 7/9.

Thanks,
Anatolij

#41 lore raw

PATCH 7/9 LCD: support 8bpp BMPs on 16bpp displays

In reply to Guennadi Liakhovetski

This patch also simplifies some ifdefs in lcd.c, introduces a generic vidinfo_t, which new drivers are encouraged to use and old drivers to switch over to.

---
 common/lcd.c  |   56 ++++++++++++++++++++++++++++++++------------------------
 include/lcd.h |   21 +++++++++++++--------
 2 files changed, 45 insertions(+), 32 deletions(-)
common/lcd.c +32 -24
index 14a0d01..ef0d488 100644
@@ -622,19 +622,15 @@ void bitmap_plot (int x, int y)
  */
 int lcd_display_bitmap(ulong bmp_image, int x, int y)
 {
-#ifdef CONFIG_ATMEL_LCD
-	uint *cmap;
-#elif !defined(CONFIG_MCC200)
-	ushort *cmap;
-#endif
+	ushort *cmap = NULL, *cmap_base = NULL;
 	ushort i, j;
 	uchar *fb;
 	bmp_image_t *bmp=(bmp_image_t *)bmp_image;
 	uchar *bmap;
 	ushort padded_line;
-	unsigned long width, height;
+	unsigned long width, height, byte_width;
 	unsigned long pwidth = panel_info.vl_col;
-	unsigned colors,bpix;
+	unsigned colors, bpix, bmp_bpix;
 	unsigned long compression;
 #if defined(CONFIG_PXA250)
 	struct pxafb_info *fbi = &panel_info.pxa;
@@ -647,22 +643,24 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		(bmp->header.signature[1]=='M'))) {
 		printf ("Error: no valid bmp image at %lx\n", bmp_image);
 		return 1;
-}
+	}
 
 	width = le32_to_cpu (bmp->header.width);
 	height = le32_to_cpu (bmp->header.height);
-	colors = 1<<le16_to_cpu (bmp->header.bit_count);
+	bmp_bpix = le16_to_cpu(bmp->header.bit_count);
+	colors = 1 << bmp_bpix;
 	compression = le32_to_cpu (bmp->header.compression);
 
 	bpix = NBITS(panel_info.vl_bpix);
 
 	if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
-		printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
-			bpix);
+		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
+			bpix, bmp_bpix);
 		return 1;
 	}
 
-	if (bpix != le16_to_cpu(bmp->header.bit_count)) {
+	/* We support displaying 8bpp BMPs on 16bpp LCDs */
+	if (bpix != bmp_bpix && (bmp_bpix != 8 || bpix != 16)) {
 		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
 			bpix,
 			le16_to_cpu(bmp->header.bit_count));
@@ -674,17 +672,17 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
 #if !defined(CONFIG_MCC200)
 	/* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
-	if (bpix==8) {
+	if (bmp_bpix == 8) {
 #if defined(CONFIG_PXA250)
 		cmap = (ushort *)fbi->palette;
 #elif defined(CONFIG_MPC823)
 		cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
-#elif defined(CONFIG_ATMEL_LCD)
-		cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0));
-#else
-# error "Don't know location of color map"
+#elif !defined(CONFIG_ATMEL_LCD)
+		cmap = panel_info.cmap;
 #endif
 
+		cmap_base = cmap;
+
 		/* Set color map */
 		for (i=0; i<colors; ++i) {
 			bmp_color_table_entry_t cte = bmp->color_table[i];
@@ -698,10 +696,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 #else
 			*cmap = colreg;
 #endif
-#if defined(CONFIG_PXA250)
-			cmap++;
-#elif defined(CONFIG_MPC823)
+#if defined(CONFIG_MPC823)
 			cmap--;
+#else
+			cmap++;
 #endif
 #else /* CONFIG_ATMEL_LCD */
 			lcd_setcolreg(i, cte.red, cte.green, cte.blue);
@@ -739,19 +737,29 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	fb   = (uchar *) (lcd_base +
 		(y + height - 1) * lcd_line_length + x);
 
-	switch (bpix) {
+	switch (bmp_bpix) {
 	case 1: /* pass through */
 	case 8:
+		if (bpix != 16)
+			byte_width = width;
+		else
+			byte_width = width * 2;
+
 		for (i = 0; i < height; ++i) {
 			WATCHDOG_RESET();
 			for (j = 0; j < width ; j++)
+				if (bpix!=16) {
 #if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
-				*(fb++) = *(bmap++);
+					*(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
-				*(fb++)=255-*(bmap++);
+					*(fb++) = 255 - *(bmap++);
 #endif
+				} else {
+					*(uint16_t *)fb = cmap_base[*(bmap++)];
+					fb += sizeof(uint16_t) / sizeof(*fb);
+				}
 			bmap += (width - padded_line);
-			fb   -= (width + lcd_line_length);
+			fb   -= (byte_width + lcd_line_length);
 		}
 		break;
 
include/lcd.h +13 -8
index 512221e..f054cac 100644
@@ -148,14 +148,6 @@ typedef struct vidinfo {
 
 extern vidinfo_t panel_info;
 
-#elif defined(CONFIG_MCC200)
-typedef struct vidinfo {
-	ushort	vl_col;		/* Number of columns (i.e. 160) */
-	ushort	vl_row;		/* Number of rows (i.e. 100) */
-
-	u_char	vl_bpix;	/* Bits per pixel, 0 = 1 */
-} vidinfo_t;
-
 #elif defined(CONFIG_ATMEL_LCD)
 
 typedef struct vidinfo {
@@ -183,6 +175,19 @@ typedef struct vidinfo {
 
 extern vidinfo_t panel_info;
 
+#else
+
+typedef struct vidinfo {
+	ushort	vl_col;		/* Number of columns (i.e. 160) */
+	ushort	vl_row;		/* Number of rows (i.e. 100) */
+
+	u_char	vl_bpix;	/* Bits per pixel, 0 = 1 */
+
+	ushort	*cmap;		/* Pointer to the colormap */
+
+	void	*priv;		/* Pointer to driver-specific data */
+} vidinfo_t;
+
 #endif /* CONFIG_MPC823, CONFIG_PXA250 or CONFIG_MCC200 or CONFIG_ATMEL_LCD */
 
 /* Video functions */
Signature · 1 line
1.5.4
#42 lore raw

PATCH v3 7/9 LCD: support 8bpp BMPs on 16bpp displays

Quoted 4 lines · Guennadi Liakhovetski

This patch also simplifies some ifdefs in lcd.c, introduces a generic vidinfo_t, which new drivers are encouraged to use and old drivers to switch over to.

IMHO you will need to fix the other drivers too

I'll test on at91

Best Regards,
J.

#43 lore raw

PATCH 8/9 video: add a i.MX31 framebuffer driver only for bitmaps so far

In reply to Guennadi Liakhovetski

Add a driver for the Synchronous Display Controller and the Display Interface on i.MX31, using IPU for DMA channel setup. So far only displaying of bitmaps is supported, no text output.

---
 drivers/video/Makefile |    1 +
 drivers/video/mx3fb.c  |  865 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 866 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/mx3fb.c
drivers/video/Makefile +1 -0
index a7dc74c..2d3711e 100644
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o
 COBJS-$(CONFIG_DISPLAY_S6E63D6) += s6e63d6.o
+COBJS-$(CONFIG_VIDEO_MX3) += mx3fb.o
 COBJS-y += videomodes.o
 
 COBJS	:= $(COBJS-y)
drivers/video/mx3fb.c new file +865 -0

865 lines not on this page · raw message

Signature · 1 line
1.5.4
#44 lore raw

PATCH 8/9 video: add a i.MX31 framebuffer driver only for bitmaps so far

Hi

2009/2/4 Guennadi Liakhovetski <[email protected]>:

Quoted 10 lines

Add a driver for the Synchronous Display Controller and the Display Interface on i.MX31, using IPU for DMA channel setup. So far only displaying of bitmaps is supported, no text output.

---
 drivers/video/Makefile |    1 +
 drivers/video/mx3fb.c  |  865 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 866 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/mx3fb.c

....

Quoted 5 lines
drivers/video/mx3fb.c new file +5 -0
+/**
+ * ipu_enable_channel() - enable an IPU channel.
+ * @channel:   channel ID.
+ * @return:    0 on success or negative error code on failure.
+ */

drivers/video/mx3fb.c line 663

Quoted 10 lines
drivers/video/mx3fb.c new file +10 -0
+static int ipu_enable_channel(enum ipu_channel channel)
+{
+       uint32_t reg;
+
+       /* Reset to buffer 0 */
+       reg_write(1UL << channel, IPU_CHA_CUR_BUF);
+
+       switch (channel) {
+       case IDMAC_SDC_0:
+               ipu_channel_set_priority(channel, 1);

Missing break?

Quoted 81 lines
drivers/video/mx3fb.c new file +81 -0
+       default:
+               break;
+       }
+
+       reg = reg_read(IDMAC_CHA_EN);
+       reg_write(reg | (1UL << channel), IDMAC_CHA_EN);
+
+       return 0;
+}
+
+static int ipu_update_channel_buffer(enum ipu_channel channel, void *buf)
+{
+       uint32_t reg;
+
+       reg = reg_read(IPU_CHA_BUF0_RDY);
+       if (reg & (1UL << channel))
+               return -EACCES;
+
+       /* 44.3.3.1.9 - Row Number 1 (WORD1, offset 0) */
+       reg_write(dma_param_addr(channel) + 0x0008UL, IPU_IMA_ADDR);
+       reg_write((u32)buf, IPU_IMA_DATA);
+
+       return 0;
+}
+
+static int idmac_tx_submit(enum ipu_channel channel, void *buf)
+{
+       int ret;
+
+       ipu_init_channel_buffer(channel, buf);
+
+
+       /* ipu_idmac.c::ipu_submit_channel_buffers() */
+       ret = ipu_update_channel_buffer(channel, buf);
+       if (ret < 0)
+               return ret;
+
+       /* ipu_idmac.c::ipu_select_buffer() */
+       /* Mark buffer 0 as ready. */
+       reg_write(1UL << channel, IPU_CHA_BUF0_RDY);
+
+
+       ret = ipu_enable_channel(channel);
+       return ret;
+}
+
+static void sdc_enable_channel(void *fbmem)
+{
+       int ret;
+       u32 reg;
+
+       ret = idmac_tx_submit(IDMAC_SDC_0, fbmem);
+
+       /* mx3fb.c::sdc_fb_init() */
+       if (ret >= 0) {
+               reg = reg_read(SDC_COM_CONF);
+               reg_write(reg | SDC_COM_BG_EN, SDC_COM_CONF);
+       }
+
+       /*
+        * Attention! Without this msleep the channel keeps generating
+        * interrupts. Next sdc_set_brightness() is going to be called
+        * from mx3fb_blank().
+        */
+       msleep(2);
+}
+
+/**
+ * mx3fb_set_par() - set framebuffer parameters and change the operating mode.
+ * @fbi:       framebuffer information pointer.
+ * @return:    0 on success or negative error code on failure.
+ */
+static int mx3fb_set_par(void *fbmem)
+{
+       int ret;
+
+       ret = sdc_init_panel(XRES, YRES, PIXEL_FMT);
+       if (ret < 0)
+               return ret;
+
+       reg_write((H_START_WIDTH << 16) | V_START_WIDTH, SDC_BG_POS);

drivers/video/mx3fb.c line 754

Quoted 10 lines
drivers/video/mx3fb.c new file +10 -0
+
+       return 0;
+}
+
+/* References in this function refer to respective Linux kernel sources */
+void lcd_enable (void)
+{
+       u32 reg;
+
+       /* pcm037.c::mxc_board_init() */

Strance comment in a generic file.

Quoted 18 lines
drivers/video/mx3fb.c new file +18 -0
+
+       /* Display Interface #3 */
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD0, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD1, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD2, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD3, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD4, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD5, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD6, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD7, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD8, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD9, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD10, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD11, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD12, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD13, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD14, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD15, MUX_CTL_FUNC));

drivers/video/mx3fb.c line 782

Quoted 10 lines
drivers/video/mx3fb.c new file +10 -0
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD16, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD17, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_VSYNC3, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_HSYNC, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_FPSHIFT, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_DRDY0, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_D3_REV, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_CONTRAST, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_D3_SPL, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_D3_CLS, MUX_CTL_FUNC));

The above seems board specific, although most of these pins can only function as IPU pins or SDMA_DEBUG.

drivers/video/mx3fb.c line 785

Quoted 3 lines
drivers/video/mx3fb.c new file +3 -0
+
+
+       /* ipu_idmac.c::ipu_probe() */

More odd comments in this functions (more below).

Quoted 83 lines
drivers/video/mx3fb.c new file +80 -1
+
+       /* Start the clock */
+       __REG(CCM_CGR1) = __REG(CCM_CGR1) | (3 << 22);
+
+
+       /* ipu_idmac.c::ipu_idmac_init() */
+
+       /* Service request counter to maximum - shouldn't be needed */
+       reg_write(0x00000070, IDMAC_CONF);
+
+
+       /* ipu_idmac.c::ipu_init_channel() */
+
+       /* Enable IPU sub modules */
+       reg = reg_read(IPU_CONF) | IPU_CONF_SDC_EN | IPU_CONF_DI_EN;
+       reg_write(reg, IPU_CONF);
+
+
+       /* mx3fb.c::init_fb_chan() */
+
+       /* set Display Interface clock period */
+       reg_write(0x00100010L, DI_HSP_CLK_PER);
+       /* Might need to trigger HSP clock change - see 44.3.3.8.5 */
+
+
+       /* mx3fb.c::sdc_set_brightness() */
+
+       /* This might be board-specific */
+       reg_write(0x03000000UL | 255 << 16, SDC_PWM_CTRL);
+
+
+       /* mx3fb.c::sdc_set_global_alpha() */
+
+       /* Use global - not per-pixel - Alpha-blending */
+       reg = reg_read(SDC_GW_CTRL) & 0x00FFFFFFL;
+       reg_write(reg | ((uint32_t) 0xff << 24), SDC_GW_CTRL);
+
+       reg = reg_read(SDC_COM_CONF);
+       reg_write(reg | SDC_COM_GLB_A, SDC_COM_CONF);
+
+
+       /* mx3fb.c::sdc_set_color_key() */
+
+       /* Disable colour-keying for background */
+       reg = reg_read(SDC_COM_CONF) &
+               ~(SDC_COM_GWSEL | SDC_COM_KEY_COLOR_G);
+       reg_write(reg, SDC_COM_CONF);
+
+
+       mx3fb_set_par(lcd_base);
+
+       sdc_enable_channel(lcd_base);
+
+       /* Linux driver calls sdc_set_brightness() here again, once is enough for us */
+}
+
+void lcd_ctrl_init(void *lcdbase)
+{
+       u32 mem_len = XRES * YRES * BIT_PER_PIXEL / 8;
+       /*
+        * We rely on fbmem being a physical address, i.e., either MMU off,
+        * or 1-to-1 mapping. Might want to add some virt2phys here.
+        */
+       if (!lcdbase)
+               return;
+
+       memset(lcdbase, 0, mem_len);
+}
+
+ulong calc_fbsize(void)
+{
+       return ((panel_info.vl_col * panel_info.vl_row *
+               NBITS(panel_info.vl_bpix)) / 8) + PAGE_SIZE;
+}
+
+int overwrite_console (void)
+{
+       /* Keep stdout / stderr on serial, our LCD is for splashscreen only */
+       return 1;
+}
--

1.5.4

Quoted 5 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Regards, Magnus

#45 lore raw

PATCH 8/9 video: add a i.MX31 framebuffer driver only for bitmaps so far

Quoted 5 lines · Magnus Lilja

drivers/video/mx3fb.c line 663

Quoted 3 lines
drivers/video/mx3fb.c new file +3 -0
+       switch (channel) {
+       case IDMAC_SDC_0:
+               ipu_channel_set_priority(channel, 1);

Missing break?

You don't mean inserting a break here would change anything, do you?

Quoted 3 lines
Quoted 3 lines
drivers/video/mx3fb.c new file +3 -0
+       default:
+               break;
+       }

[snip]

Quoted 8 lines

drivers/video/mx3fb.c line 754

Quoted 6 lines
drivers/video/mx3fb.c new file +6 -0
+/* References in this function refer to respective Linux kernel sources */
+void lcd_enable (void)
+{
+       u32 reg;
+
+       /* pcm037.c::mxc_board_init() */

Strance comment in a generic file.

"Strance"? See just 5 lines above.

Quoted 28 lines
Quoted 17 lines
drivers/video/mx3fb.c new file +17 -0
+       /* Display Interface #3 */
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD0, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD1, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD2, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD3, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD4, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD5, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD6, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD7, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD8, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD9, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD10, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD11, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD12, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD13, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD14, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD15, MUX_CTL_FUNC));

drivers/video/mx3fb.c line 782

Quoted 10 lines
drivers/video/mx3fb.c new file +10 -0
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD16, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_LD17, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_VSYNC3, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_HSYNC, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_FPSHIFT, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_DRDY0, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_D3_REV, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_CONTRAST, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_D3_SPL, MUX_CTL_FUNC));
+       mx31_gpio_mux(IOMUX_MODE_L(MX31_PIN_D3_CLS, MUX_CTL_FUNC));
Quoted 2 lines

The above seems board specific, although most of these pins can only function as IPU pins or SDMA_DEBUG.

Well, I think, SDC LCD functions are only available on one pin each, so, you have no choice. Just looked through and haven't found any alternatives.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#46 lore raw

PATCH 8/9 video: add a i.MX31 framebuffer driver only for bitmaps so far

Hi

2009/2/4 Guennadi Liakhovetski <[email protected]>:

Quoted 9 lines · Magnus Lilja
Quoted 6 lines

drivers/video/mx3fb.c line 663

Quoted 4 lines
drivers/video/mx3fb.c new file +3 -0
+       switch (channel) {
+       case IDMAC_SDC_0:
+               ipu_channel_set_priority(channel, 1);

Missing break?

You don't mean inserting a break here would change anything, do you?

Not in this code but when the next developer adds a case
IDMAC_MMM_NNN: after the existing case it's easy to forget to add that missing break.

Quoted 16 lines
Quoted 4 lines
Quoted 4 lines
drivers/video/mx3fb.c new file +3 -0
+       default:
+               break;
+       }

[snip]

Quoted 8 lines

drivers/video/mx3fb.c line 754

Quoted 6 lines
drivers/video/mx3fb.c new file +6 -0
+/* References in this function refer to respective Linux kernel sources */
+void lcd_enable (void)
+{
+       u32 reg;
+
+       /* pcm037.c::mxc_board_init() */

Strance comment in a generic file.

Quoted 1 line

"Strance"? See just 5 lines above.

Ok, I missed that comment. ("Strance" => "Strange")

Thanks, Magnus

#47 lore raw

PATCH 8/9 video: add a i.MX31 framebuffer driver only for bitmaps so far

In reply to Guennadi Liakhovetski

Dear Guennadi Liakhovetski,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 5 lines · Magnus Lilja

drivers/video/mx3fb.c line 663

Quoted 3 lines
drivers/video/mx3fb.c new file +3 -0
+       switch (channel) {
+       case IDMAC_SDC_0:
+               ipu_channel_set_priority(channel, 1);

Missing break?

You don't mean inserting a break here would change anything, do you?

Yes, it would change the code considerably: it would make clear what the intentions of the programmer were.

Please do what has been asked for.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The use of COBOL cripples the mind; its teaching  should,  therefore,
be regarded as a criminal offence.
          -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
#48 lore raw

PATCH 9/9 ARM: add an "eet" variant of the imx31_phycore board

In reply to Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Jean-Christophe: another ack, please.

 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   51 +++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   16 ++++++++++
 include/configs/imx31_phycore.h       |   23 +++++++++++++++
 4 files changed, 95 insertions(+), 1 deletions(-)
Makefile +5 -1
index 787c5f2..6151e2c 100644
@@ -3025,8 +3025,12 @@ apollon_config		: unconfig
 imx31_litekit_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
+imx31_phycore_eet_config \
 imx31_phycore_config	: unconfig
-	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+	@if [ -n "$(findstring imx31_phycore_eet_config,$@)" ]; then			\
+		echo "#define CONFIG_IMX31_PHYCORE_EET" >> $(obj)include/config.h;	\
+	fi
+	@$(MKCONFIG) -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
 
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
board/imx31_phycore/imx31_phycore.c +51 -0

63 lines not on this page · raw message

include/asm-arm/arch-mx31/mx31-regs.h +16 -0
index e736052..dcc0805 100644
@@ -124,7 +124,14 @@
 #define MUX_CTL_CSPI2_SS0	0x85
 #define MUX_CTL_CSPI2_SS1	0x86
 #define MUX_CTL_CSPI2_SS2	0x87
+#define MUX_CTL_CSPI1_SS2	0x88
+#define MUX_CTL_CSPI1_SCLK	0x89
+#define MUX_CTL_CSPI1_SPI_RDY	0x8a
 #define MUX_CTL_CSPI2_MOSI	0x8b
+#define MUX_CTL_CSPI1_MOSI	0x8c
+#define MUX_CTL_CSPI1_MISO	0x8d
+#define MUX_CTL_CSPI1_SS0	0x8e
+#define MUX_CTL_CSPI1_SS1	0x8f
 
 /*
  * Helper macros for the MUX_[contact name]__[pin function] macros
@@ -150,6 +157,15 @@
 	IOMUX_MODE(MUX_CTL_CSPI2_SPI_RDY, MUX_CTL_FUNC)
 #define MUX_CSPI2_SCLK__CSPI2_CLK IOMUX_MODE(MUX_CTL_CSPI2_SCLK, MUX_CTL_FUNC)
 
+#define MUX_CSPI1_SS0__CSPI1_SS0_B IOMUX_MODE(MUX_CTL_CSPI1_SS0, MUX_CTL_FUNC)
+#define MUX_CSPI1_SS1__CSPI1_SS1_B IOMUX_MODE(MUX_CTL_CSPI1_SS1, MUX_CTL_FUNC)
+#define MUX_CSPI1_SS2__CSPI1_SS2_B IOMUX_MODE(MUX_CTL_CSPI1_SS2, MUX_CTL_FUNC)
+#define MUX_CSPI1_MOSI__CSPI1_MOSI IOMUX_MODE(MUX_CTL_CSPI1_MOSI, MUX_CTL_FUNC)
+#define MUX_CSPI1_MISO__CSPI1_MISO IOMUX_MODE(MUX_CTL_CSPI1_MISO, MUX_CTL_FUNC)
+#define MUX_CSPI1_SPI_RDY__CSPI1_DATAREADY_B \
+	IOMUX_MODE(MUX_CTL_CSPI1_SPI_RDY, MUX_CTL_FUNC)
+#define MUX_CSPI1_SCLK__CSPI1_CLK IOMUX_MODE(MUX_CTL_CSPI1_SCLK, MUX_CTL_FUNC)
+
 #define MUX_CSPI2_MOSI__I2C2_SCL IOMUX_MODE(MUX_CTL_CSPI2_MOSI, MUX_CTL_ALT1)
 #define MUX_CSPI2_MISO__I2C2_SDA IOMUX_MODE(MUX_CTL_CSPI2_MISO, MUX_CTL_ALT1)
 
include/configs/imx31_phycore.h +23 -0
index f0d28ee..257a2f9 100644
@@ -178,4 +178,27 @@
 #undef CONFIG_JFFS2_CMDLINE
 #define CONFIG_JFFS2_DEV	"nor0"
 
+/* EET platform additions */
+#ifdef CONFIG_IMX31_PHYCORE_EET
+#define BOARD_LATE_INIT
+
+#define CONFIG_MX31_GPIO				1
+
+#define CONFIG_HARD_SPI				1
+#define CONFIG_MXC_SPI				1
+#define CONFIG_CMD_SPI
+
+#define CONFIG_DISPLAY_S6E63D6			1
+
+#define CONFIG_LCD				1
+#define CONFIG_VIDEO_MX3			1
+#define CONFIG_SYS_WHITE_ON_BLACK		1
+#define LCD_BPP					LCD_COLOR8
+#define	CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE	1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV		1
+
+#define	CONFIG_SPLASH_SCREEN			1
+#define CONFIG_CMD_BMP				1
+#endif
+
 #endif /* __CONFIG_H */
Signature · 1 line
1.5.4
#49 lore raw

PATCH v3 9/9 ARM: add an "eet" variant of the imx31_phycore board

Quoted 21 lines · Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Jean-Christophe: another ack, please.

 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   51 +++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   16 ++++++++++
 include/configs/imx31_phycore.h       |   23 +++++++++++++++
 4 files changed, 95 insertions(+), 1 deletions(-)
Makefile +0 -0
index 787c5f2..6151e2c 100644

Makefile apollon_config : unconfig · line 3030

Quoted 7 lines
Makefile +2 -1
@@ -3025,8 +3025,12 @@ apollon_config		: unconfig
 imx31_litekit_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
+imx31_phycore_eet_config \
 imx31_phycore_config	: unconfig
-	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+	@if [ -n "$(findstring imx31_phycore_eet_config,$@)" ]; then			\

maybe just search for eet will be simplest

Quoted 19 lines
Makefile +3 -0
+		echo "#define CONFIG_IMX31_PHYCORE_EET" >> $(obj)include/config.h;	\
+	fi
+	@$(MKCONFIG) -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
 
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
board/imx31_phycore/imx31_phycore.c +1 -0
index 4c64cb9..c70353d 100644
@@ -23,6 +23,7 @@
 
 
 #include <common.h>
+#include <s6e63d6.h>
 #include <asm/arch/mx31.h>
 #include <asm/arch/mx31-regs.h>
 

board/imx31_phycore/imx31_phycore.c int board_init (void) · line 70

Quoted 4 lines
board/imx31_phycore/imx31_phycore.c +1 -0
@@ -66,6 +67,56 @@ int board_init (void)
 	return 0;
 }
 
+#ifdef BOARD_LATE_INIT

CONFIG_?

board/imx31_phycore/imx31_phycore.c int board_init (void) · line 72

Quoted 2 lines
board/imx31_phycore/imx31_phycore.c +2 -0
+int board_late_init(void)
+{

Best Regards,
J.

#50 lore raw

PATCH 9/9 ARM: add an "eet" variant of the imx31_phycore board

Quoted 25 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 24 lines · Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Jean-Christophe: another ack, please.

 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   51 +++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   16 ++++++++++
 include/configs/imx31_phycore.h       |   23 +++++++++++++++
 4 files changed, 95 insertions(+), 1 deletions(-)
Makefile +0 -0
index 787c5f2..6151e2c 100644
@@ -3025,8 +3025,12 @@ apollon_config		: unconfig
 imx31_litekit_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
Quoted 5 lines

Makefile apollon_config : unconfig · line 3030

Quoted 4 lines
Makefile +2 -1
+imx31_phycore_eet_config \
 imx31_phycore_config	: unconfig
-	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+	@if [ -n "$(findstring imx31_phycore_eet_config,$@)" ]; then			\

maybe just search for eet will be simplest

simplest for whom?

Quoted 18 lines
Quoted 18 lines
Makefile +3 -0
+		echo "#define CONFIG_IMX31_PHYCORE_EET" >> $(obj)include/config.h;	\
+	fi
+	@$(MKCONFIG) -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
 
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
board/imx31_phycore/imx31_phycore.c +1 -0
index 4c64cb9..c70353d 100644
@@ -23,6 +23,7 @@
 
 
 #include <common.h>
+#include <s6e63d6.h>
 #include <asm/arch/mx31.h>
 #include <asm/arch/mx31-regs.h>
 
Quoted 6 lines

board/imx31_phycore/imx31_phycore.c int board_init (void) · line 70

Quoted 5 lines
board/imx31_phycore/imx31_phycore.c +1 -0
@@ -66,6 +67,56 @@ int board_init (void)
 	return 0;
 }
 
+#ifdef BOARD_LATE_INIT

CONFIG_?

grep?:

$ grep -r BOARD_LATE_INIT lib*
lib_arm/board.c:#ifdef BOARD_LATE_INIT
lib_nios2/board.c:#if defined(CONFIG_BOARD_LATE_INIT)
lib_sh/board.c:#ifdef BOARD_LATE_INIT
lib_sparc/board.c:#if defined(CONFIG_BOARD_LATE_INIT)

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#51 lore raw

PATCH v3 9/9 ARM: add an "eet" variant of the imx31_phycore board

Quoted 57 lines · Guennadi Liakhovetski
Quoted 25 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 24 lines · Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Jean-Christophe: another ack, please.

 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   51 +++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   16 ++++++++++
 include/configs/imx31_phycore.h       |   23 +++++++++++++++
 4 files changed, 95 insertions(+), 1 deletions(-)
Makefile +0 -0
index 787c5f2..6151e2c 100644
@@ -3025,8 +3025,12 @@ apollon_config		: unconfig
 imx31_litekit_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
Quoted 5 lines

Makefile apollon_config : unconfig · line 3030

Quoted 4 lines
Makefile +2 -1
+imx31_phycore_eet_config \
 imx31_phycore_config	: unconfig
-	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+	@if [ -n "$(findstring imx31_phycore_eet_config,$@)" ]; then			\

maybe just search for eet will be simplest

simplest for whom?

Quoted 22 lines
Quoted 22 lines
Makefile +3 -0
+		echo "#define CONFIG_IMX31_PHYCORE_EET" >> $(obj)include/config.h;	\
+	fi
+	@$(MKCONFIG) -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
 
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
board/imx31_phycore/imx31_phycore.c +1 -0
index 4c64cb9..c70353d 100644
@@ -23,6 +23,7 @@
 
 
 #include <common.h>
+#include <s6e63d6.h>
 #include <asm/arch/mx31.h>
 #include <asm/arch/mx31-regs.h>
 
@@ -66,6 +67,56 @@ int board_init (void)
 	return 0;
 }
 
Quoted 7 lines
Quoted 2 lines

board/imx31_phycore/imx31_phycore.c int board_init (void) · line 70

Quoted 1 line
board/imx31_phycore/imx31_phycore.c +1 -0
+#ifdef BOARD_LATE_INIT

CONFIG_?

grep?:

$ grep -r BOARD_LATE_INIT lib*
lib_arm/board.c:#ifdef BOARD_LATE_INIT

that a bug CONFIG_BOARD_LATE_INIT is supposed

Quoted 2 lines

lib_nios2/board.c:#if defined(CONFIG_BOARD_LATE_INIT) lib_sh/board.c:#ifdef BOARD_LATE_INIT

ditto on the SH

Best Regards,
J.

#52 lore raw

PATCH 9/9 ARM: add an "eet" variant of the imx31_phycore board

In reply to Guennadi Liakhovetski

Dear Guennadi Liakhovetski,

Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Quoted 2 lines

+#ifdef BOARD_LATE_INIT

CONFIG_?

grep?:

$ grep -r BOARD_LATE_INIT lib*
lib_arm/board.c:#ifdef BOARD_LATE_INIT
lib_nios2/board.c:#if defined(CONFIG_BOARD_LATE_INIT)
lib_sh/board.c:#ifdef BOARD_LATE_INIT
lib_sparc/board.c:#if defined(CONFIG_BOARD_LATE_INIT)

Good idea to search - so you can fix the other occurances, too.

Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Children begin by loving their parents. After a time they judge them.
Rarely, if ever, do they forgive them.                  - Oscar Wilde
#53 lore raw

PATCH 9/9 ARM: add an "eet" variant of the imx31_phycore board

Quoted 9 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Quoted 2 lines

+#ifdef BOARD_LATE_INIT

CONFIG_?

grep?:

Quoted 7 lines
Quoted 5 lines
$ grep -r BOARD_LATE_INIT lib*
lib_arm/board.c:#ifdef BOARD_LATE_INIT
lib_nios2/board.c:#if defined(CONFIG_BOARD_LATE_INIT)
lib_sh/board.c:#ifdef BOARD_LATE_INIT
lib_sparc/board.c:#if defined(CONFIG_BOARD_LATE_INIT)

Good idea to search - so you can fix the other occurances, too.

This is outside of the scope of this patch series, so, I'll put it on my todo.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#54 lore raw

v2 cover ARM: Support for splashimage om i.MX31-based phycore "eet" variant

In reply to Guennadi Liakhovetski

On Wed, 4 Feb 2009, Guennadi Liakhovetski wrote:

Hi again,

this is version 2 of the patch-series, that adds support for the graphics engine on i.MX31 SoC. Changes since v1 will be reflected in each single patch. And - we still have one more day in the merge window...:-)

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#56 lore raw

PATCH v2 2/9 i.MX31: add a simple gpio driver

In reply to Guennadi Liakhovetski

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

Changes since v1: alphabetical order, typo in copyright fixed, use ARRAY_SIZE.

 drivers/gpio/Makefile            |    3 +-
 drivers/gpio/mx31_gpio.c         |   73 ++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31.h |   20 ++++++++++
 3 files changed, 95 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/mx31_gpio.c
drivers/gpio/Makefile +2 -1
index dd618ed..f10144f 100644
@@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB 	:= $(obj)libgpio.a
 
-COBJS-$(CONFIG_PCA953X)	+= pca953x.o
+COBJS-$(CONFIG_MX31_GPIO)	+= mx31_gpio.o
+COBJS-$(CONFIG_PCA953X)		+= pca953x.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/gpio/mx31_gpio.c new file +73 -0

73 lines not on this page · raw message

include/asm-arm/arch-mx31/mx31.h +20 -0
index 0552c27..e957d72 100644
@@ -27,4 +27,24 @@
 extern u32 mx31_get_ipg_clk(void);
 extern void mx31_gpio_mux(unsigned long mode);
 
+enum mx31_gpio_direction {
+	MX31_GPIO_DIRECTION_IN,
+	MX31_GPIO_DIRECTION_OUT,
+};
+
+#ifdef CONFIG_MX31_GPIO
+extern int mx31_gpio_direction(unsigned int gpio,
+			       enum mx31_gpio_direction direction);
+extern void mx31_gpio_set(unsigned int gpio, unsigned int value);
+#else
+static inline int mx31_gpio_direction(unsigned int gpio,
+			       enum mx31_gpio_direction direction)
+{
+	return 1;
+}
+static inline void mx31_gpio_set(unsigned int gpio, unsigned int value)
+{
+}
+#endif
+
 #endif /* __ASM_ARCH_MX31_H */
Signature · 1 line
1.5.4
#57 lore raw

PATCH v2 2/9 i.MX31: add a simple gpio driver

Hi Guennadi,

Quoted 5 lines · Guennadi Liakhovetski
drivers/gpio/mx31_gpio.c new file +0 -0
new file mode 100644
index 0000000..6487e63

<snip>

drivers/gpio/mx31_gpio.c line 32

Quoted 10 lines
drivers/gpio/mx31_gpio.c new file +10 -0
+#include <common.h>
+#include <asm/arch/mx31.h>
+#include <asm/arch/mx31-regs.h>
+
+/* GPIO port description */
+static unsigned long gpio_ports[] = {
+	[0] = 0x53fcc000,
+	[1] = 0x53fd0000,
+	[2] = 0x53fa4000,
+};

Ilya send a patch for mx31 GPIO register definitions today
http://lists.denx.de/pipermail/u-boot/2009-February/046884.html

Could you please provide additional patch for drivers/gpio/mx31_gpio.c based on Ilya's patch to use these GPIOx_BASE macros here and to use GPIO_DR / GPIO_GDIR for 0 / 4 below? Thanks!

drivers/gpio/mx31_gpio.c line 62

Quoted 6 lines
drivers/gpio/mx31_gpio.c new file +6 -0
+void mx31_gpio_set(unsigned int gpio, unsigned int value)
+{
+	unsigned int port = gpio >> 5;
+	u32 l;
+
+	if (port > sizeof(gpio_ports) / sizeof(gpio_ports[0]) - 1)

also please change this one to
if (port >= ARRAY_SIZE(gpio_ports))
too, to be consistent with coding in this file, Thanks!

Quoted 17 lines
drivers/gpio/mx31_gpio.c new file +11 -0
+		return;
+
+	gpio &= 0x1f;
+
+	l = __REG(gpio_ports[port] + 0);
+	if (value)
+		l |= 1 << gpio;
+	else
+		l &= ~(1 << gpio);
+	__REG(gpio_ports[port] + 0) = l;
+}
include/asm-arm/arch-mx31/mx31.h +0 -0
index 0552c27..e957d72 100644
@@ -27,4 +27,24 @@
 extern u32 mx31_get_ipg_clk(void);

include/asm-arm/arch-mx31/mx31.h line 37

Quoted 10 lines
include/asm-arm/arch-mx31/mx31.h +8 -0
 extern void mx31_gpio_mux(unsigned long mode);
 
+enum mx31_gpio_direction {
+	MX31_GPIO_DIRECTION_IN,
+	MX31_GPIO_DIRECTION_OUT,
+};
+
+#ifdef CONFIG_MX31_GPIO
+extern int mx31_gpio_direction(unsigned int gpio,
+			       enum mx31_gpio_direction direction);

________________________^^^^^^^
please remove spaces here, Thanks!

include/asm-arm/arch-mx31/mx31.h line 41

Quoted 4 lines
include/asm-arm/arch-mx31/mx31.h +4 -0
+extern void mx31_gpio_set(unsigned int gpio, unsigned int value);
+#else
+static inline int mx31_gpio_direction(unsigned int gpio,
+			       enum mx31_gpio_direction direction)

________________________^^^^^^^
please remove spaces here too, Thanks!

Best regards,
Anatolij

#58 lore raw

PATCH v2 2/9 i.MX31: add a simple gpio driver

Quoted 24 lines · Anatolij Gustschin

Hi Guennadi,

Quoted 5 lines · Guennadi Liakhovetski
drivers/gpio/mx31_gpio.c new file +0 -0
new file mode 100644
index 0000000..6487e63

<snip>

drivers/gpio/mx31_gpio.c line 32

Quoted 10 lines
drivers/gpio/mx31_gpio.c new file +10 -0
+#include <common.h>
+#include <asm/arch/mx31.h>
+#include <asm/arch/mx31-regs.h>
+
+/* GPIO port description */
+static unsigned long gpio_ports[] = {
+	[0] = 0x53fcc000,
+	[1] = 0x53fd0000,
+	[2] = 0x53fa4000,
+};

Ilya send a patch for mx31 GPIO register definitions today
http://lists.denx.de/pipermail/u-boot/2009-February/046884.html

Quoted 3 lines

Could you please provide additional patch for drivers/gpio/mx31_gpio.c based on Ilya's patch to use these GPIOx_BASE macros here and to use GPIO_DR / GPIO_GDIR for 0 / 4 below? Thanks!

Do you mean an incremental patch or a v3?

Quoted 8 lines
Quoted 8 lines
include/asm-arm/arch-mx31/mx31.h +0 -0
index 0552c27..e957d72 100644
@@ -27,4 +27,24 @@
 extern u32 mx31_get_ipg_clk(void);
 extern void mx31_gpio_mux(unsigned long mode);
 
Quoted 10 lines

include/asm-arm/arch-mx31/mx31.h line 37

Quoted 8 lines
include/asm-arm/arch-mx31/mx31.h +8 -0
+enum mx31_gpio_direction {
+	MX31_GPIO_DIRECTION_IN,
+	MX31_GPIO_DIRECTION_OUT,
+};
+
+#ifdef CONFIG_MX31_GPIO
+extern int mx31_gpio_direction(unsigned int gpio,
+			       enum mx31_gpio_direction direction);

________________________^^^^^^^
please remove spaces here, Thanks!

No, these are intentional and correct. They align beginning of the second line with the first character after the opening parenthesis.

Quoted 6 lines

include/asm-arm/arch-mx31/mx31.h line 41

Quoted 4 lines
include/asm-arm/arch-mx31/mx31.h +4 -0
+extern void mx31_gpio_set(unsigned int gpio, unsigned int value);
+#else
+static inline int mx31_gpio_direction(unsigned int gpio,
+			       enum mx31_gpio_direction direction)

________________________^^^^^^^
please remove spaces here too, Thanks!

Ok, this one I just copy-pasted from above, so, it broke alignment.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#59 lore raw

PATCH v2 2/9 i.MX31: add a simple gpio driver

Quoted 9 lines · Guennadi Liakhovetski
Quoted 9 lines

drivers/gpio/mx31_gpio.c line 32

Quoted 6 lines
drivers/gpio/mx31_gpio.c new file +6 -0
+/* GPIO port description */
+static unsigned long gpio_ports[] = {
+	[0] = 0x53fcc000,
+	[1] = 0x53fd0000,
+	[2] = 0x53fa4000,
+};

Ilya send a patch for mx31 GPIO register definitions today
http://lists.denx.de/pipermail/u-boot/2009-February/046884.html

Quoted 5 lines
Quoted 3 lines

Could you please provide additional patch for drivers/gpio/mx31_gpio.c based on Ilya's patch to use these GPIOx_BASE macros here and to use GPIO_DR / GPIO_GDIR for 0 / 4 below? Thanks!

Do you mean an incremental patch or a v3?

yes, an incremental patch, as I don't know when Ilya's patch will be applied. This way we will be able to use the driver now (not dependent on Ilya's patch) and fix things later by applying an incremental patch.

Quoted 8 lines
Quoted 5 lines

include/asm-arm/arch-mx31/mx31.h line 37

Quoted 3 lines
include/asm-arm/arch-mx31/mx31.h +3 -0
+#ifdef CONFIG_MX31_GPIO
+extern int mx31_gpio_direction(unsigned int gpio,
+			       enum mx31_gpio_direction direction);

________________________^^^^^^^
please remove spaces here, Thanks!

No, these are intentional and correct. They align beginning of the second line with the first character after the opening parenthesis.

yes this is correct, I'm aware of it. But while reviewing the spi patch an so looking on the code in drivers/spi/mxc_spi.c I noticed that you also used indentation by tabs in spi_xfer() and spi_setup_slave() and also in the mx31_gpio_direction() prototype definition. So it seemed for me that you would prefer to use indentation by tabs here. So ignore this one please, Sorry.

Thanks,
Anatolij

#60 lore raw

PATCH v2 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

In reply to Guennadi Liakhovetski

Some SPI devices have special requirements on chip-select handling. With this patch we can use a GPIO as a chip-select and strictly follow the SPI_XFER_BEGIN and SPI_XFER_END flags.

---

Changes since v1: long lines split, mx31_gpio_* calls now also defined if CONFIG_MX31_GPIO is not defined (see patch 2/9), '!!' removed.

 drivers/spi/mxc_spi.c |   47 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 8 deletions(-)
drivers/spi/mxc_spi.c +39 -8
index b7bd84b..1341543 100644
@@ -32,6 +32,8 @@
 
 #else
 
+#include <asm/arch/mx31.h>
+
 #define MXC_CSPIRXDATA		0x00
 #define MXC_CSPITXDATA		0x04
 #define MXC_CSPICTRL		0x08
@@ -68,6 +70,7 @@ struct mxc_spi_slave {
 	struct spi_slave slave;
 	unsigned long	base;
 	u32		ctrl_reg;
+	int		gpio;
 };
 
 static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave)
@@ -85,7 +88,8 @@ static inline void reg_write(unsigned long addr, u32 val)
 	*(volatile unsigned long*)addr = val;
 }
 
-static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
+static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen,
+			   unsigned long flags)
 {
 	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
 	unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
@@ -96,6 +100,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 		reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
 	}
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_BEGIN))
+		mx31_gpio_set(mxcs->gpio, mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL);
+
 	reg_write(mxcs->base + MXC_CSPITXDATA, data);
 
 	cfg_reg |= MXC_CSPICTRL_XCH;
@@ -105,6 +112,10 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
+		mx31_gpio_set(mxcs->gpio,
+			      !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));
+
 	return reg_read(mxcs->base + MXC_CSPIRXDATA);
 }
 
@@ -123,7 +134,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
 	for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
 	     i < n_blks;
 	     i++, in_l++, out_l++, bitlen -= 32) {
-		u32 data = spi_xchg_single(slave, *out_l, bitlen);
+		u32 data = spi_xchg_single(slave, *out_l, bitlen, flags);
 
 		/* Check if we're only transfering 8 or 16 bits */
 		if (!i) {
@@ -146,11 +157,35 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 {
 	unsigned int ctrl_reg;
 	struct mxc_spi_slave *mxcs;
+	int ret;
 
-	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]) ||
-	    cs > 3)
+	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]))
+		return NULL;
+
+	mxcs = malloc(sizeof(struct mxc_spi_slave));
+	if (!mxcs)
 		return NULL;
 
+	/*
+	 * Some SPI devices require active chip-select over multiple
+	 * transactions, we achieve this using a GPIO. Still, the SPI
+	 * controller has to be configured to use one of its own chipselects.
+	 * To use this feature you have to call spi_setup_slave() with
+	 * cs = internal_cs | (gpio << 8), and you have to use some unused
+	 * on this SPI controller cs between 0 and 3.
+	 */
+	if (cs > 3) {
+		mxcs->gpio = cs >> 8;
+		cs &= 3;
+		ret = mx31_gpio_direction(mxcs->gpio, MX31_GPIO_DIRECTION_OUT);
+		if (ret) {
+			printf("mxc_spi: cannot setup gpio %d\n", mxcs->gpio);
+			return NULL;
+		}
+	} else {
+		mxcs->gpio = -1;
+	}
+
 	ctrl_reg = MXC_CSPICTRL_CHIPSELECT(cs) |
 		MXC_CSPICTRL_BITCOUNT(31) |
 		MXC_CSPICTRL_DATARATE(7) | /* FIXME: calculate data rate */
@@ -164,10 +199,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	if (mode & SPI_CS_HIGH)
 		ctrl_reg |= MXC_CSPICTRL_SSPOL;
 
-	mxcs = malloc(sizeof(struct mxc_spi_slave));
-	if (!mxcs)
-		return NULL;
-
 	mxcs->slave.bus = bus;
 	mxcs->slave.cs = cs;
 	mxcs->base = spi_bases[bus];
Signature · 1 line
1.5.4
#61 lore raw

PATCH v2 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

Quoted 4 lines · Guennadi Liakhovetski
drivers/spi/mxc_spi.c +0 -0
index b7bd84b..1341543 100644

<snip>

drivers/spi/mxc_spi.c static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen) · line 117

Quoted 7 lines
drivers/spi/mxc_spi.c +3 -0
@@ -105,6 +112,10 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
+		mx31_gpio_set(mxcs->gpio,
+			      !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));

this is a multi-line if statement, I think the preferred coding style is as follows:

	if (...) {
		/*
		 * multi-line if statement
		 */
		...
	}

please fix, Thanks!

drivers/spi/mxc_spi.c struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, · line 162

Quoted 9 lines
drivers/spi/mxc_spi.c +2 -2
@@ -146,11 +157,35 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 {
 	unsigned int ctrl_reg;
 	struct mxc_spi_slave *mxcs;
+	int ret;
 
-	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]) ||
-	    cs > 3)
+	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]))

please use ARRAY_SIZE() here, too. Thanks!

Best regards,
Anatolij

#62 lore raw

PATCH v2 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

Quoted 17 lines · Anatolij Gustschin
Quoted 4 lines · Guennadi Liakhovetski
drivers/spi/mxc_spi.c +0 -0
index b7bd84b..1341543 100644

<snip>

drivers/spi/mxc_spi.c static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen) · line 117

Quoted 7 lines
drivers/spi/mxc_spi.c +3 -0
@@ -105,6 +112,10 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
+		mx31_gpio_set(mxcs->gpio,
+			      !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));

this is a multi-line if statement, I think the preferred coding style is as follows:

Quoted 7 lines
	if (...) {
		/*
		 * multi-line if statement
		 */
		...
	}

please fix, Thanks!

Sorry, cannot find this in CodingStyle. Can you point me out? What I do find there is this example in Chapter 2:

	if (condition)
		printk(KERN_WARNING "Warning this is a long printk with "
						"3 parameters a: %u b: %u "
						"c: %u \n", a, b, c);
	else
		next_statement;

which implicitly (it is given as an example of breaking lines, not parenthesising) states the contrary to your proposition.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#63 lore raw

PATCH v2 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

Quoted 26 lines · Guennadi Liakhovetski
Quoted 16 lines · Anatolij Gustschin
Quoted 4 lines · Guennadi Liakhovetski
drivers/spi/mxc_spi.c +0 -0
index b7bd84b..1341543 100644

<snip>

drivers/spi/mxc_spi.c static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen) · line 117

Quoted 7 lines
drivers/spi/mxc_spi.c +3 -0
@@ -105,6 +112,10 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_END))
+		mx31_gpio_set(mxcs->gpio,
+			      !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));

this is a multi-line if statement, I think the preferred coding style is as follows:

Quoted 7 lines
	if (...) {
		/*
		 * multi-line if statement
		 */
		...
	}

please fix, Thanks!

Quoted 1 line

Sorry, cannot find this in CodingStyle. Can you point me out?

please see appropriate comments in

http://lists.denx.de/pipermail/u-boot/2008-December/044435.html
or in
http://lists.denx.de/pipermail/u-boot/2008-October/042634.html
(search for "Braces around multi-line if-bodies").

Quoted 10 lines

What I do
find there is this example in Chapter 2:

	if (condition)
		printk(KERN_WARNING "Warning this is a long printk with "
						"3 parameters a: %u b: %u "
						"c: %u \n", a, b, c);
	else
		next_statement;
Quoted 2 lines

which implicitly (it is given as an example of breaking lines, not parenthesising) states the contrary to your proposition.

Linux CodingStyle mostly applies for U-Boot coding style, but sometimes there are little differences.

Best regargs,
Anatolij

#64 lore raw

PATCH v2 4/9 A driver for the S6E63D6 SPI display controller from Samsung

In reply to Guennadi Liakhovetski

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

---

Changes since v1: parameters added in function declarations, alphabetical order in Makefile, id made configurable by the user, renamed configuration parameter to CONFIG_S6E63D6.

 drivers/video/Makefile  |    1 +
 drivers/video/s6e63d6.c |   70 +++++++++++++++++++++++++++++++++++++++++++++++
 include/s6e63d6.h       |   37 +++++++++++++++++++++++++
 3 files changed, 108 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/s6e63d6.c
 create mode 100644 include/s6e63d6.h
drivers/video/Makefile +1 -0
index 7fba29f..84d4cb7 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libvideo.a
 COBJS-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o
 COBJS-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
 COBJS-$(CONFIG_CFB_CONSOLE) += cfb_console.o
+COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
 COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o
 COBJS-$(CONFIG_VIDEO_MB862xx) += mb862xx.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
drivers/video/s6e63d6.c new file +70 -0

70 lines not on this page · raw message

include/s6e63d6.h new file +37 -0
new file mode 100644
index 0000000..9f17fc0
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DENX Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef _S6E63D6_H_
+#define _S6E63D6_H_
+
+struct s6e63d6 {
+	unsigned int bus;
+	unsigned int cs;
+	unsigned int id;
+	struct spi_slave *slave;
+};
+
+extern int s6e63d6_init(struct s6e63d6 *data);
+extern int s6e63d6_index(struct s6e63d6 *data, u8 idx);
+extern int s6e63d6_param(struct s6e63d6 *data, u16 param);
+
+#endif
Signature · 1 line
1.5.4
#65 lore raw

PATCH v2 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Quoted 5 lines · Guennadi Liakhovetski
drivers/video/s6e63d6.c new file +0 -0
new file mode 100644
index 0000000..4a59f05

<snip>

drivers/video/s6e63d6.c line 44

Quoted 11 lines
drivers/video/s6e63d6.c new file +11 -0
+static int send_word(struct s6e63d6 *data, u8 rs, u16 word)
+{
+	u32 buf8 = 0x70 | data->id | (rs & 2);
+	u32 buf16 = cpu_to_le16(word);
+	u32 buf_in;
+	int err;
+
+	err = spi_xfer(data->slave, 8, &buf8, &buf_in, SPI_XFER_BEGIN);
+	if (err)
+		return err;
+	return spi_xfer(data->slave, 16, &buf16, &buf_in, SPI_XFER_END);

please add an empty line between two return statements here, Thanks!

Best regards,
Anatolij

#66 lore raw

PATCH v2 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Quoted 8 lines · Anatolij Gustschin
Quoted 5 lines · Guennadi Liakhovetski
drivers/video/s6e63d6.c new file +0 -0
new file mode 100644
index 0000000..4a59f05

<snip>

Quoted 13 lines

drivers/video/s6e63d6.c line 44

Quoted 11 lines
drivers/video/s6e63d6.c new file +11 -0
+static int send_word(struct s6e63d6 *data, u8 rs, u16 word)
+{
+	u32 buf8 = 0x70 | data->id | (rs & 2);
+	u32 buf16 = cpu_to_le16(word);
+	u32 buf_in;
+	int err;
+
+	err = spi_xfer(data->slave, 8, &buf8, &buf_in, SPI_XFER_BEGIN);
+	if (err)
+		return err;
+	return spi_xfer(data->slave, 16, &buf16, &buf_in, SPI_XFER_END);

please add an empty line between two return statements here, Thanks!

Is this also required by CodingStyle?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#67 lore raw

PATCH v2 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Quoted 7 lines · Guennadi Liakhovetski
Quoted 5 lines

drivers/video/s6e63d6.c line 44

Quoted 4 lines
drivers/video/s6e63d6.c new file +4 -0
+	err = spi_xfer(data->slave, 8, &buf8, &buf_in, SPI_XFER_BEGIN);
+	if (err)
+		return err;
+	return spi_xfer(data->slave, 16, &buf16, &buf_in, SPI_XFER_END);

please add an empty line between two return statements here, Thanks!

Is this also required by CodingStyle?

not explicitly, but IMHO, it slightly improves readability and also will be consistent with style used in s6e63d6_init() some lines below. It seems to be preferred style in other code, too.

Best regards,
Anatolij

#68 lore raw

PATCH v2 5/9 ARM: remove unused variable

In reply to Guennadi Liakhovetski

The "size" variable in start_armboot() in lib_arm/board.c is only really used in
#ifndef CONFIG_SYS_NO_FLASH
case, and even there it can be eliminated (thanks to Jean-Christophe PLAGNIOL-VILLARD for a suggestion.)

---

Changes since v1: removed the "size" variable completely.

 lib_arm/board.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
lib_arm/board.c +3 -7
index 964f5cc..41f7603 100644
@@ -287,9 +287,6 @@ void start_armboot (void)
 {
 	init_fnc_t **init_fnc_ptr;
 	char *s;
-#if !defined(CONFIG_SYS_NO_FLASH) || defined (CONFIG_VFD) || defined(CONFIG_LCD)
-	ulong size;
-#endif
 #if defined(CONFIG_VFD) || defined(CONFIG_LCD)
 	unsigned long addr;
 #endif
@@ -315,8 +312,7 @@ void start_armboot (void)
 
 #ifndef CONFIG_SYS_NO_FLASH
 	/* configure available FLASH banks */
-	size = flash_init ();
-	display_flash_config (size);
+	display_flash_config (flash_init ());
 #endif /* CONFIG_SYS_NO_FLASH */
 
 #ifdef CONFIG_VFD
@@ -328,7 +324,7 @@ void start_armboot (void)
 	 */
 	/* bss_end is defined in the board-specific linker script */
 	addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-	size = vfd_setmem (addr);
+	vfd_setmem (addr);
 	gd->fb_base = addr;
 #endif /* CONFIG_VFD */
 
@@ -343,7 +339,7 @@ void start_armboot (void)
 		 */
 		/* bss_end is defined in the board-specific linker script */
 		addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-		size = lcd_setmem (addr);
+		lcd_setmem (addr);
 		gd->fb_base = addr;
 	}
 #endif /* CONFIG_LCD */
Signature · 1 line
1.5.4
#69 lore raw

PATCH v2 6/9 Add 16bpp BMP support

In reply to Guennadi Liakhovetski

From: Mark Jackson <[email protected]>

This patch adds 16bpp BMP support to the common lcd code.

Use CONFIG_BMP_16BPP and set LCD_BPP to LCD_COLOR16 to enable the code.

At the moment it's only been tested on the MIMC200 AVR32 board, but extending this to other platforms should be a simple task !!

---

Changes since v1: added this comment to explain, that this patch from Mark Jackson is included in this patch series for completeness, because future patches base on it, long lines split.

 common/lcd.c |   51 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 10 deletions(-)
common/lcd.c +41 -10
index 5f73247..756b30d 100644
@@ -84,7 +84,7 @@ extern void lcd_enable (void);
 static void *lcd_logo (void);
 
 
-#if LCD_BPP == LCD_COLOR8
+#if (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
 extern void lcd_setcolreg (ushort regno,
 				ushort red, ushort green, ushort blue);
 #endif
@@ -656,7 +656,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
 	bpix = NBITS(panel_info.vl_bpix);
 
-	if ((bpix != 1) && (bpix != 8)) {
+	if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
 		printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
 			bpix);
 		return 1;
@@ -738,17 +738,48 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
 	fb   = (uchar *) (lcd_base +
 		(y + height - 1) * lcd_line_length + x);
-	for (i = 0; i < height; ++i) {
-		WATCHDOG_RESET();
-		for (j = 0; j < width ; j++)
+
+	switch (bpix) {
+	case 1: /* pass through */
+	case 8:
+		for (i = 0; i < height; ++i) {
+			WATCHDOG_RESET();
+			for (j = 0; j < width ; j++)
 #if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
-			*(fb++) = *(bmap++);
+				*(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
-			*(fb++)=255-*(bmap++);
+				*(fb++)=255-*(bmap++);
 #endif
-		bmap += (width - padded_line);
-		fb   -= (width + lcd_line_length);
-	}
+			bmap += (width - padded_line);
+			fb   -= (width + lcd_line_length);
+		}
+		break;
+
+#if defined(CONFIG_BMP_16BPP)
+	case 16:
+		for (i = 0; i < height; ++i) {
+			WATCHDOG_RESET();
+			for (j = 0; j < width; j++) {
+#if defined(CONFIG_ATMEL_LCD_BGR555)
+				*(fb++) = ((bmap[0] & 0x1f) << 2) |
+					(bmap[1] & 0x03);
+				*(fb++) = (bmap[0] & 0xe0) |
+					((bmap[1] & 0x7c) >> 2);
+				bmap += 2;
+#else
+				*(fb++) = *(bmap++);
+				*(fb++) = *(bmap++);
+#endif
+			}
+			bmap += (padded_line - width) * 2;
+			fb   -= (width * 2 + lcd_line_length);
+		}
+		break;
+#endif /* CONFIG_BMP_16BPP */
+
+	default:
+		break;
+	};
 
 	return (0);
 }
Signature · 1 line
1.5.4
#70 lore raw

PATCH v2 7/9 LCD: support 8bpp BMPs on 16bpp displays

In reply to Guennadi Liakhovetski

This patch also simplifies some ifdefs in lcd.c, introduces a generic vidinfo_t, which new drivers are encouraged to use and old drivers to switch over to.

---

Changes since v1: no changes.

 common/lcd.c  |   56 ++++++++++++++++++++++++++++++++------------------------
 include/lcd.h |   21 +++++++++++++--------
 2 files changed, 45 insertions(+), 32 deletions(-)
common/lcd.c +32 -24
index 756b30d..e4ac6c2 100644
@@ -622,19 +622,15 @@ void bitmap_plot (int x, int y)
  */
 int lcd_display_bitmap(ulong bmp_image, int x, int y)
 {
-#ifdef CONFIG_ATMEL_LCD
-	uint *cmap;
-#elif !defined(CONFIG_MCC200)
-	ushort *cmap;
-#endif
+	ushort *cmap = NULL, *cmap_base = NULL;
 	ushort i, j;
 	uchar *fb;
 	bmp_image_t *bmp=(bmp_image_t *)bmp_image;
 	uchar *bmap;
 	ushort padded_line;
-	unsigned long width, height;
+	unsigned long width, height, byte_width;
 	unsigned long pwidth = panel_info.vl_col;
-	unsigned colors,bpix;
+	unsigned colors, bpix, bmp_bpix;
 	unsigned long compression;
 #if defined(CONFIG_PXA250)
 	struct pxafb_info *fbi = &panel_info.pxa;
@@ -647,22 +643,24 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		(bmp->header.signature[1]=='M'))) {
 		printf ("Error: no valid bmp image at %lx\n", bmp_image);
 		return 1;
-}
+	}
 
 	width = le32_to_cpu (bmp->header.width);
 	height = le32_to_cpu (bmp->header.height);
-	colors = 1<<le16_to_cpu (bmp->header.bit_count);
+	bmp_bpix = le16_to_cpu(bmp->header.bit_count);
+	colors = 1 << bmp_bpix;
 	compression = le32_to_cpu (bmp->header.compression);
 
 	bpix = NBITS(panel_info.vl_bpix);
 
 	if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
-		printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
-			bpix);
+		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
+			bpix, bmp_bpix);
 		return 1;
 	}
 
-	if (bpix != le16_to_cpu(bmp->header.bit_count)) {
+	/* We support displaying 8bpp BMPs on 16bpp LCDs */
+	if (bpix != bmp_bpix && (bmp_bpix != 8 || bpix != 16)) {
 		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
 			bpix,
 			le16_to_cpu(bmp->header.bit_count));
@@ -674,17 +672,17 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
 #if !defined(CONFIG_MCC200)
 	/* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
-	if (bpix==8) {
+	if (bmp_bpix == 8) {
 #if defined(CONFIG_PXA250)
 		cmap = (ushort *)fbi->palette;
 #elif defined(CONFIG_MPC823)
 		cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
-#elif defined(CONFIG_ATMEL_LCD)
-		cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0));
-#else
-# error "Don't know location of color map"
+#elif !defined(CONFIG_ATMEL_LCD)
+		cmap = panel_info.cmap;
 #endif
 
+		cmap_base = cmap;
+
 		/* Set color map */
 		for (i=0; i<colors; ++i) {
 			bmp_color_table_entry_t cte = bmp->color_table[i];
@@ -698,10 +696,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 #else
 			*cmap = colreg;
 #endif
-#if defined(CONFIG_PXA250)
-			cmap++;
-#elif defined(CONFIG_MPC823)
+#if defined(CONFIG_MPC823)
 			cmap--;
+#else
+			cmap++;
 #endif
 #else /* CONFIG_ATMEL_LCD */
 			lcd_setcolreg(i, cte.red, cte.green, cte.blue);
@@ -739,19 +737,29 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	fb   = (uchar *) (lcd_base +
 		(y + height - 1) * lcd_line_length + x);
 
-	switch (bpix) {
+	switch (bmp_bpix) {
 	case 1: /* pass through */
 	case 8:
+		if (bpix != 16)
+			byte_width = width;
+		else
+			byte_width = width * 2;
+
 		for (i = 0; i < height; ++i) {
 			WATCHDOG_RESET();
 			for (j = 0; j < width ; j++)
+				if (bpix!=16) {
 #if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
-				*(fb++) = *(bmap++);
+					*(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
-				*(fb++)=255-*(bmap++);
+					*(fb++) = 255 - *(bmap++);
 #endif
+				} else {
+					*(uint16_t *)fb = cmap_base[*(bmap++)];
+					fb += sizeof(uint16_t) / sizeof(*fb);
+				}
 			bmap += (width - padded_line);
-			fb   -= (width + lcd_line_length);
+			fb   -= (byte_width + lcd_line_length);
 		}
 		break;
 
include/lcd.h +13 -8
index 512221e..f054cac 100644
@@ -148,14 +148,6 @@ typedef struct vidinfo {
 
 extern vidinfo_t panel_info;
 
-#elif defined(CONFIG_MCC200)
-typedef struct vidinfo {
-	ushort	vl_col;		/* Number of columns (i.e. 160) */
-	ushort	vl_row;		/* Number of rows (i.e. 100) */
-
-	u_char	vl_bpix;	/* Bits per pixel, 0 = 1 */
-} vidinfo_t;
-
 #elif defined(CONFIG_ATMEL_LCD)
 
 typedef struct vidinfo {
@@ -183,6 +175,19 @@ typedef struct vidinfo {
 
 extern vidinfo_t panel_info;
 
+#else
+
+typedef struct vidinfo {
+	ushort	vl_col;		/* Number of columns (i.e. 160) */
+	ushort	vl_row;		/* Number of rows (i.e. 100) */
+
+	u_char	vl_bpix;	/* Bits per pixel, 0 = 1 */
+
+	ushort	*cmap;		/* Pointer to the colormap */
+
+	void	*priv;		/* Pointer to driver-specific data */
+} vidinfo_t;
+
 #endif /* CONFIG_MPC823, CONFIG_PXA250 or CONFIG_MCC200 or CONFIG_ATMEL_LCD */
 
 /* Video functions */
Signature · 1 line
1.5.4
#72 lore raw

PATCH v2 8/9 video: add a i.MX31 framebuffer driver

Quoted 5 lines · Guennadi Liakhovetski

Add a driver for the Synchronous Display Controller and the Display Interface on i.MX31, using IPU for DMA channel setup. So far only displaying of bitmaps is supported, no text output.

mostly looks good, please see some comments below.

Quoted 5 lines
drivers/video/mx3fb.c new file +0 -0
new file mode 100644
index 0000000..d9b673e

<snip>

Quoted 12 lines
drivers/video/mx3fb.c new file +12 -0
+/**
+ * sdc_init_panel() - initialize a synchronous LCD panel.
+ * @mx3fb:		mx3fb context.
+ * @panel:		panel type.
+ * @pixel_clk:		desired pixel clock frequency in Hz.
+ * @width:		width of panel in pixels.
+ * @height:		height of panel in pixels.
+ * @pixel_fmt:		pixel format of buffer as FOURCC ASCII code.
+ * @h_start_width:	number of pixel clocks between the HSYNC signal pulse
+ *			and the start of valid data.
+ * @h_sync_width:	width of the HSYNC signal in units of pixel clocks.
+ * @h_end_width:	number of pixel clocks between the end of valid data

drivers/video/mx3fb.c

Quoted 10 lines
drivers/video/mx3fb.c new file +10 -0
+ *			and the HSYNC signal for next line.
+ * @v_start_width:	number of lines between the VSYNC signal pulse and the
+ *			start of valid data.
+ * @v_sync_width:	width of the VSYNC signal in units of lines
+ * @v_end_width:	number of lines between the end of valid data and the
+ *			VSYNC signal for next frame.
+ * @sig:		bitfield of signal polarities for LCD interface.
+ * @return:		0 on success or negative error code on failure.
+ */
+static int sdc_init_panel(u16 width, u16 height, enum pixel_fmt pixel_fmt)

function parameters description is from the Linux driver, however most of them are not present here in U-Boot driver. Is there any reason you leave the original description here? Also please replace starting '/**' with '/*'.

<snip>

drivers/video/mx3fb.c

Quoted 10 lines
drivers/video/mx3fb.c new file +10 -0
+static void ipu_ch_param_set_size(union chan_param_mem *params,
+				  uint32_t pixel_fmt, uint16_t width,
+				  uint16_t height, uint16_t stride)
+{
+	params->pp.fw		= width - 1;
+	params->pp.fh_l		= height - 1;
+	params->pp.fh_h		= (height - 1) >> 8;
+	params->pp.sl		= stride - 1;
+
+	/* See above, for further formats see tge Linux driver */

s/tge/the/
?

<snip>

drivers/video/mx3fb.c

Quoted 6 lines
drivers/video/mx3fb.c new file +6 -0
+/**
+ * ipu_enable_channel() - enable an IPU channel.
+ * @channel:	channel ID.
+ * @return:	0 on success or negative error code on failure.
+ */
+static int ipu_enable_channel(enum ipu_channel channel)

just use '/*' here, too.

<snip>

drivers/video/mx3fb.c

Quoted 6 lines
drivers/video/mx3fb.c new file +6 -0
+/**
+ * mx3fb_set_par() - set framebuffer parameters and change the operating mode.
+ * @fbi:	framebuffer information pointer.
+ * @return:	0 on success or negative error code on failure.
+ */
+static int mx3fb_set_par(void *fbmem)

use '/*' here, too. Thanks!
Also @fbi description doesn't apply here, 'fbmem' is frame buffer memory pointer.

Best regards,
Anatolij

#73 lore raw

PATCH v2 9/9 ARM: add an "eet" variant of the imx31_phycore board

In reply to Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Changes since v1: adjusted to reflect changes in earlier patches: add .id field initialisation, configuration parameter renamed to CONFIG_S6E63D6.

 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   52 +++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   16 ++++++++++
 include/configs/imx31_phycore.h       |   23 ++++++++++++++
 4 files changed, 96 insertions(+), 1 deletions(-)
Makefile +5 -1
index 787c5f2..6151e2c 100644
@@ -3025,8 +3025,12 @@ apollon_config		: unconfig
 imx31_litekit_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
+imx31_phycore_eet_config \
 imx31_phycore_config	: unconfig
-	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+	@if [ -n "$(findstring imx31_phycore_eet_config,$@)" ]; then			\
+		echo "#define CONFIG_IMX31_PHYCORE_EET" >> $(obj)include/config.h;	\
+	fi
+	@$(MKCONFIG) -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
 
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
board/imx31_phycore/imx31_phycore.c +52 -0

64 lines not on this page · raw message

include/asm-arm/arch-mx31/mx31-regs.h +16 -0
index e736052..dcc0805 100644
@@ -124,7 +124,14 @@
 #define MUX_CTL_CSPI2_SS0	0x85
 #define MUX_CTL_CSPI2_SS1	0x86
 #define MUX_CTL_CSPI2_SS2	0x87
+#define MUX_CTL_CSPI1_SS2	0x88
+#define MUX_CTL_CSPI1_SCLK	0x89
+#define MUX_CTL_CSPI1_SPI_RDY	0x8a
 #define MUX_CTL_CSPI2_MOSI	0x8b
+#define MUX_CTL_CSPI1_MOSI	0x8c
+#define MUX_CTL_CSPI1_MISO	0x8d
+#define MUX_CTL_CSPI1_SS0	0x8e
+#define MUX_CTL_CSPI1_SS1	0x8f
 
 /*
  * Helper macros for the MUX_[contact name]__[pin function] macros
@@ -150,6 +157,15 @@
 	IOMUX_MODE(MUX_CTL_CSPI2_SPI_RDY, MUX_CTL_FUNC)
 #define MUX_CSPI2_SCLK__CSPI2_CLK IOMUX_MODE(MUX_CTL_CSPI2_SCLK, MUX_CTL_FUNC)
 
+#define MUX_CSPI1_SS0__CSPI1_SS0_B IOMUX_MODE(MUX_CTL_CSPI1_SS0, MUX_CTL_FUNC)
+#define MUX_CSPI1_SS1__CSPI1_SS1_B IOMUX_MODE(MUX_CTL_CSPI1_SS1, MUX_CTL_FUNC)
+#define MUX_CSPI1_SS2__CSPI1_SS2_B IOMUX_MODE(MUX_CTL_CSPI1_SS2, MUX_CTL_FUNC)
+#define MUX_CSPI1_MOSI__CSPI1_MOSI IOMUX_MODE(MUX_CTL_CSPI1_MOSI, MUX_CTL_FUNC)
+#define MUX_CSPI1_MISO__CSPI1_MISO IOMUX_MODE(MUX_CTL_CSPI1_MISO, MUX_CTL_FUNC)
+#define MUX_CSPI1_SPI_RDY__CSPI1_DATAREADY_B \
+	IOMUX_MODE(MUX_CTL_CSPI1_SPI_RDY, MUX_CTL_FUNC)
+#define MUX_CSPI1_SCLK__CSPI1_CLK IOMUX_MODE(MUX_CTL_CSPI1_SCLK, MUX_CTL_FUNC)
+
 #define MUX_CSPI2_MOSI__I2C2_SCL IOMUX_MODE(MUX_CTL_CSPI2_MOSI, MUX_CTL_ALT1)
 #define MUX_CSPI2_MISO__I2C2_SDA IOMUX_MODE(MUX_CTL_CSPI2_MISO, MUX_CTL_ALT1)
 
include/configs/imx31_phycore.h +23 -0
index f0d28ee..2dd9e92 100644
@@ -178,4 +178,27 @@
 #undef CONFIG_JFFS2_CMDLINE
 #define CONFIG_JFFS2_DEV	"nor0"
 
+/* EET platform additions */
+#ifdef CONFIG_IMX31_PHYCORE_EET
+#define BOARD_LATE_INIT
+
+#define CONFIG_MX31_GPIO			1
+
+#define CONFIG_HARD_SPI				1
+#define CONFIG_MXC_SPI				1
+#define CONFIG_CMD_SPI
+
+#define CONFIG_S6E63D6				1
+
+#define CONFIG_LCD				1
+#define CONFIG_VIDEO_MX3			1
+#define CONFIG_SYS_WHITE_ON_BLACK		1
+#define LCD_BPP					LCD_COLOR8
+#define	CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE	1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV		1
+
+#define	CONFIG_SPLASH_SCREEN			1
+#define CONFIG_CMD_BMP				1
+#endif
+
 #endif /* __CONFIG_H */
Signature · 1 line
1.5.4
#74 lore raw

PATCH v2 9/9 ARM: add an "eet" variant of the imx31_phycore board

Guennadi Liakhovetski wrote:

<snip>

Quoted 4 lines
board/imx31_phycore/imx31_phycore.c +0 -0
index 4c64cb9..6b7cbb6 100644

<snip>

board/imx31_phycore/imx31_phycore.c int board_init (void) · line 73

Quoted 8 lines
board/imx31_phycore/imx31_phycore.c +4 -0
@@ -66,6 +67,57 @@ int board_init (void)
 	return 0;
 }
 
+#ifdef BOARD_LATE_INIT
+int board_late_init(void)
+{
+#ifdef CONFIG_DISPLAY_S6E63D6

please change this one to CONFIG_S6E63D6, too. Thanks!

Best regards,
Anatolij

#75 lore raw

v3 cover ARM: Support for splashimage om i.MX31-based phycore "eet" variant

In reply to Guennadi Liakhovetski

Hi again,

this is version 3 of the patch-series, that adds support for the graphics engine on i.MX31 SoC. Changes since v1 and v2 will be reflected in each single patch. As all correction requests have been addressed, I hope we can get it in on the last day of the merge window (today). Should any further problems surface, we can address them in incremental patches.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#76 lore raw

PATCH v3 1/9 i.MX31: fix SPI driver for shorter than 32 bit transfers

Fix setting the SPI Control register, 8 and 16-bit transfers and a wrong pointer in the free routine in the mxc_spi driver.

---

Changes since v1: chose a simpler fix
Changes since v2: fix the simpler fix: v2 worked as long as I just resetted the board, powering the board down showed, that v2 wasn't sufficient, it has lost the SPI Control register fix from v1.

 drivers/spi/mxc_spi.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
drivers/spi/mxc_spi.c +19 -11
index 5957ada..3135817 100644
@@ -90,17 +90,15 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
 	unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
 
-	if (MXC_CSPICTRL_BITCOUNT(bitlen - 1) != (cfg_reg & MXC_CSPICTRL_BITCOUNT(31))) {
-		cfg_reg = (cfg_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
-			MXC_CSPICTRL_BITCOUNT(bitlen - 1);
-		reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
-	}
+	mxcs->ctrl_reg = (mxcs->ctrl_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
+		MXC_CSPICTRL_BITCOUNT(bitlen - 1);
 
-	reg_write(mxcs->base + MXC_CSPITXDATA, data);
+	if (cfg_reg != mxcs->ctrl_reg)
+		reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg);
 
-	cfg_reg |= MXC_CSPICTRL_XCH;
+	reg_write(mxcs->base + MXC_CSPITXDATA, data);
 
-	reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
+	reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg | MXC_CSPICTRL_XCH);
 
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
@@ -122,8 +120,17 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
 
 	for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
 	     i < n_blks;
-	     i++, in_l++, out_l++, bitlen -= 32)
-		*in_l = spi_xchg_single(slave, *out_l, bitlen);
+	     i++, in_l++, out_l++, bitlen -= 32) {
+		u32 data = spi_xchg_single(slave, *out_l, bitlen);
+
+		/* Check if we're only transfering 8 or 16 bits */
+		if (!i) {
+			if (bitlen < 9)
+				*(u8 *)din = data;
+			else if (bitlen < 17)
+				*(u16 *)din = data;
+		}
+	}
 
 	return 0;
 }
@@ -169,7 +176,8 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 
 void spi_free_slave(struct spi_slave *slave)
 {
-	free(slave);
+	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
+	free(mxcs);
 }
 
 int spi_claim_bus(struct spi_slave *slave)
Signature · 1 line
1.5.4
#77 lore raw

PATCH v3 1/9 i.MX31: fix SPI driver for shorter than 32 bit transfers

+

Quoted 12 lines
drivers/spi/mxc_spi.c +8 -0
+		/* Check if we're only transfering 8 or 16 bits */
+		if (!i) {
+			if (bitlen < 9)
+				*(u8 *)din = data;
+			else if (bitlen < 17)
+				*(u16 *)din = data;
+		}
+	}
 
 	return 0;
 }

drivers/spi/mxc_spi.c struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, · line 180

Quoted 6 lines
drivers/spi/mxc_spi.c +2 -1
@@ -169,7 +176,8 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 
 void spi_free_slave(struct spi_slave *slave)
 {
-	free(slave);
+	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
+	free(mxcs);

please add an empty line

Review struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, · line 181

Quoted 1 line
(quoted diff) +0 -0
 }

Best Regards,
J.

#78 lore raw

PATCH v4 1/9 i.MX31: fix SPI driver for shorter than 32 bit

From: Guennadi Liakhovetski <[email protected]>

Fix setting the SPI Control register, 8 and 16-bit transfers and a wrong pointer in the free routine in the mxc_spi driver.

---

Changes since v1: chose a simpler fix
Changes since v2: fix the simpler fix: v2 worked as long as I just resetted the board, powering the board down showed, that v2 wasn't sufficient, it has lost the SPI Control register fix from v1. Changes since v3: add empty line in spi_free_slave()

I'm going to push it via video tree as Jean-Christophe mean it is more video related patch and have no objection.

Anatolij

 drivers/spi/mxc_spi.c |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)
drivers/spi/mxc_spi.c +20 -11
index 5957ada..0ac4e90 100644
@@ -90,17 +90,15 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
 	unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
 
-	if (MXC_CSPICTRL_BITCOUNT(bitlen - 1) != (cfg_reg & MXC_CSPICTRL_BITCOUNT(31))) {
-		cfg_reg = (cfg_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
-			MXC_CSPICTRL_BITCOUNT(bitlen - 1);
-		reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
-	}
+	mxcs->ctrl_reg = (mxcs->ctrl_reg & ~MXC_CSPICTRL_BITCOUNT(31)) |
+		MXC_CSPICTRL_BITCOUNT(bitlen - 1);
 
-	reg_write(mxcs->base + MXC_CSPITXDATA, data);
+	if (cfg_reg != mxcs->ctrl_reg)
+		reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg);
 
-	cfg_reg |= MXC_CSPICTRL_XCH;
+	reg_write(mxcs->base + MXC_CSPITXDATA, data);
 
-	reg_write(mxcs->base + MXC_CSPICTRL, cfg_reg);
+	reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg | MXC_CSPICTRL_XCH);
 
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
@@ -122,8 +120,17 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
 
 	for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
 	     i < n_blks;
-	     i++, in_l++, out_l++, bitlen -= 32)
-		*in_l = spi_xchg_single(slave, *out_l, bitlen);
+	     i++, in_l++, out_l++, bitlen -= 32) {
+		u32 data = spi_xchg_single(slave, *out_l, bitlen);
+
+		/* Check if we're only transfering 8 or 16 bits */
+		if (!i) {
+			if (bitlen < 9)
+				*(u8 *)din = data;
+			else if (bitlen < 17)
+				*(u16 *)din = data;
+		}
+	}
 
 	return 0;
 }
@@ -169,7 +176,9 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 
 void spi_free_slave(struct spi_slave *slave)
 {
-	free(slave);
+	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
+
+	free(mxcs);
 }
 
 int spi_claim_bus(struct spi_slave *slave)
Signature · 1 line
1.5.3.3
#79 lore raw

PATCH v4 1/9 i.MX31: fix SPI driver for shorter than 32 bit

Quoted 9 lines · Anatolij Gustschin

From: Guennadi Liakhovetski <[email protected]>

Fix setting the SPI Control register, 8 and 16-bit transfers and a wrong pointer in the free routine in the mxc_spi driver.

---

Quoted 8 lines

Changes since v1: chose a simpler fix
Changes since v2: fix the simpler fix: v2 worked as long as I just resetted the board, powering the board down showed, that v2 wasn't sufficient, it has lost the SPI Control register fix from v1. Changes since v3: add empty line in spi_free_slave()

I'm going to push it via video tree as Jean-Christophe mean it is more video related patch and have no objection.

please not I've not ack yet patch 1,2,3,5,9

please apply only after I've add it this 5 patchs

Best Regards,
J.

#80 lore raw

PATCH v4 1/9 i.MX31: fix SPI driver for shorter than 32 bit

Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 15 lines · Anatolij Gustschin

From: Guennadi Liakhovetski <[email protected]>

Fix setting the SPI Control register, 8 and 16-bit transfers and a wrong pointer in the free routine in the mxc_spi driver.

---

Changes since v1: chose a simpler fix
Changes since v2: fix the simpler fix: v2 worked as long as I just resetted the board, powering the board down showed, that v2 wasn't sufficient, it has lost the SPI Control register fix from v1. Changes since v3: add empty line in spi_free_slave()

Quoted 4 lines
Quoted 2 lines

I'm going to push it via video tree as Jean-Christophe mean it is more video related patch and have no objection.

please not I've not ack yet patch 1,2,3,5,9

actually you already ACKed patch 5, see
http://lists.denx.de/pipermail/u-boot/2009-February/047068.html
and it is already in the arm tree, AFAICS. Thanks!

Quoted 1 line

please apply only after I've add it this 5 patchs

and yes, I'm waiting for your ACK for 1,2,3 and 9 before I push them, as all these patches touch board files or related headers, spi, gpio and so on. Thanks!

Best regards,
Anatolij

#81 lore raw

PATCH v4 1/9 i.MX31: fix SPI driver for shorter than 32 bit

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 15 lines · Anatolij Gustschin

From: Guennadi Liakhovetski <[email protected]>

Fix setting the SPI Control register, 8 and 16-bit transfers and a wrong pointer in the free routine in the mxc_spi driver.

---

Changes since v1: chose a simpler fix
Changes since v2: fix the simpler fix: v2 worked as long as I just resetted the board, powering the board down showed, that v2 wasn't sufficient, it has lost the SPI Control register fix from v1. Changes since v3: add empty line in spi_free_slave()

Quoted 6 lines
Quoted 2 lines

I'm going to push it via video tree as Jean-Christophe mean it is more video related patch and have no objection.

please not I've not ack yet patch 1,2,3,5,9

please apply only after I've add it this 5 patchs

Jean-Christophe, do you ACK v4 of this patch?

Best regards,
Anatolij

#82 lore raw

PATCH v4 1/9 i.MX31: fix SPI driver for shorter than 32 bit

Quoted 18 lines · Anatolij Gustschin
Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 15 lines · Anatolij Gustschin

From: Guennadi Liakhovetski <[email protected]>

Fix setting the SPI Control register, 8 and 16-bit transfers and a wrong pointer in the free routine in the mxc_spi driver.

---

Changes since v1: chose a simpler fix
Changes since v2: fix the simpler fix: v2 worked as long as I just resetted the board, powering the board down showed, that v2 wasn't sufficient, it has lost the SPI Control register fix from v1. Changes since v3: add empty line in spi_free_slave()

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I'm going to push it via video tree as Jean-Christophe mean it is more video related patch and have no objection.

please not I've not ack yet patch 1,2,3,5,9

please apply only after I've add it this 5 patchs

Jean-Christophe, do you ACK v4 of this patch?

You've got

Best Regards,
J.

#83 lore raw

PATCH v4 1/9 i.MX31: fix SPI driver for shorter than 32 bit

In reply to Anatolij Gustschin
Quoted 15 lines

From: Guennadi Liakhovetski <[email protected]>

Fix setting the SPI Control register, 8 and 16-bit transfers and a wrong pointer in the free routine in the mxc_spi driver.

---

Changes since v1: chose a simpler fix
Changes since v2: fix the simpler fix: v2 worked as long as I just resetted the board, powering the board down showed, that v2 wasn't sufficient, it has lost the SPI Control register fix from v1. Changes since v3: add empty line in spi_free_slave()

Quoted 7 lines

I'm going to push it via video tree as Jean-Christophe mean it is more video related patch and have no objection.

Anatolij

 drivers/spi/mxc_spi.c |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

Applied to u-boot-video/master.

Thanks,
Anatolij

#84 lore raw

PATCH v3 2/9 i.MX31: add a simple gpio driver

In reply to Guennadi Liakhovetski

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

Changes since v1: alphabetical order, typo in copyright fixed, use ARRAY_SIZE.
Changes since v2: fixed wrong indentation in int mx31_gpio_direction() declaration.

 drivers/gpio/Makefile            |    3 +-
 drivers/gpio/mx31_gpio.c         |   73 ++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31.h |   20 ++++++++++
 3 files changed, 95 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/mx31_gpio.c
drivers/gpio/Makefile +2 -1
index dd618ed..f10144f 100644
@@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB 	:= $(obj)libgpio.a
 
-COBJS-$(CONFIG_PCA953X)	+= pca953x.o
+COBJS-$(CONFIG_MX31_GPIO)	+= mx31_gpio.o
+COBJS-$(CONFIG_PCA953X)		+= pca953x.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/gpio/mx31_gpio.c new file +73 -0

73 lines not on this page · raw message

include/asm-arm/arch-mx31/mx31.h +20 -0
index 0552c27..1d475dd 100644
@@ -27,4 +27,24 @@
 extern u32 mx31_get_ipg_clk(void);
 extern void mx31_gpio_mux(unsigned long mode);
 
+enum mx31_gpio_direction {
+	MX31_GPIO_DIRECTION_IN,
+	MX31_GPIO_DIRECTION_OUT,
+};
+
+#ifdef CONFIG_MX31_GPIO
+extern int mx31_gpio_direction(unsigned int gpio,
+			       enum mx31_gpio_direction direction);
+extern void mx31_gpio_set(unsigned int gpio, unsigned int value);
+#else
+static inline int mx31_gpio_direction(unsigned int gpio,
+				      enum mx31_gpio_direction direction)
+{
+	return 1;
+}
+static inline void mx31_gpio_set(unsigned int gpio, unsigned int value)
+{
+}
+#endif
+
 #endif /* __ASM_ARCH_MX31_H */
Signature · 1 line
1.5.4
#85 lore raw

PATCH v3 2/9 i.MX31: add a simple gpio driver

Quoted 59 lines · Guennadi Liakhovetski

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

Changes since v1: alphabetical order, typo in copyright fixed, use ARRAY_SIZE.
Changes since v2: fixed wrong indentation in int mx31_gpio_direction() declaration.

 drivers/gpio/Makefile            |    3 +-
 drivers/gpio/mx31_gpio.c         |   73 ++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31.h |   20 ++++++++++
 3 files changed, 95 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/mx31_gpio.c
drivers/gpio/Makefile +2 -1
index dd618ed..f10144f 100644
@@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB 	:= $(obj)libgpio.a
 
-COBJS-$(CONFIG_PCA953X)	+= pca953x.o
+COBJS-$(CONFIG_MX31_GPIO)	+= mx31_gpio.o
+COBJS-$(CONFIG_PCA953X)		+= pca953x.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/gpio/mx31_gpio.c new file +22 -0
new file mode 100644
index 0000000..166deaf
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DENX Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */

drivers/gpio/mx31_gpio.c line 32

Quoted 10 lines
drivers/gpio/mx31_gpio.c new file +10 -0
+#include <common.h>
+#include <asm/arch/mx31.h>
+#include <asm/arch/mx31-regs.h>
+
+/* GPIO port description */
+static unsigned long gpio_ports[] = {
+	[0] = 0x53fcc000,
+	[1] = 0x53fd0000,
+	[2] = 0x53fa4000,
+};

I'll add qong patch before yours
please fix it

Best Regards,
J.

#86 lore raw

PATCH v4 2/9 i.MX31: add a simple gpio driver

From: Guennadi Liakhovetski <[email protected]>

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

Changes since v1: alphabetical order, typo in copyright fixed, use ARRAY_SIZE.
Changes since v2: fixed wrong indentation in int mx31_gpio_direction() declaration.
Changes since v3: use macros defined in
"mx31: add GPIO registers definitions" patch by Ilya Yanok.

After an ACK from Jean-Christophe I'm going to push it via video tree.

Anatolij

 drivers/gpio/Makefile            |    3 +-
 drivers/gpio/mx31_gpio.c         |   73 ++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31.h |   20 ++++++++++
 3 files changed, 95 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/mx31_gpio.c
drivers/gpio/Makefile +2 -1
index dd618ed..f10144f 100644
@@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB 	:= $(obj)libgpio.a
 
-COBJS-$(CONFIG_PCA953X)	+= pca953x.o
+COBJS-$(CONFIG_MX31_GPIO)	+= mx31_gpio.o
+COBJS-$(CONFIG_PCA953X)		+= pca953x.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/gpio/mx31_gpio.c new file +73 -0

73 lines not on this page · raw message

include/asm-arm/arch-mx31/mx31.h +20 -0
index 0552c27..1d475dd 100644
@@ -27,4 +27,24 @@
 extern u32 mx31_get_ipg_clk(void);
 extern void mx31_gpio_mux(unsigned long mode);
 
+enum mx31_gpio_direction {
+	MX31_GPIO_DIRECTION_IN,
+	MX31_GPIO_DIRECTION_OUT,
+};
+
+#ifdef CONFIG_MX31_GPIO
+extern int mx31_gpio_direction(unsigned int gpio,
+			       enum mx31_gpio_direction direction);
+extern void mx31_gpio_set(unsigned int gpio, unsigned int value);
+#else
+static inline int mx31_gpio_direction(unsigned int gpio,
+				      enum mx31_gpio_direction direction)
+{
+	return 1;
+}
+static inline void mx31_gpio_set(unsigned int gpio, unsigned int value)
+{
+}
+#endif
+
 #endif /* __ASM_ARCH_MX31_H */
Signature · 1 line
1.5.3.3
#87 lore raw

PATCH v4 2/9 i.MX31: add a simple gpio driver

Quoted 19 lines

From: Guennadi Liakhovetski <[email protected]>

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

Changes since v1: alphabetical order, typo in copyright fixed, use ARRAY_SIZE.
Changes since v2: fixed wrong indentation in int mx31_gpio_direction() declaration.
Changes since v3: use macros defined in
"mx31: add GPIO registers definitions" patch by Ilya Yanok.

After an ACK from Jean-Christophe I'm going to push it via video tree.

Quoted 7 lines

Anatolij

 drivers/gpio/Makefile            |    3 +-
 drivers/gpio/mx31_gpio.c         |   73 ++++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31.h |   20 ++++++++++
 3 files changed, 95 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/mx31_gpio.c

Applied to u-boot-video/master.

Thanks,
Anatolij

#88 lore raw

PATCH v3 2/9 i.MX31: add a simple gpio driver

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 39 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 38 lines · Guennadi Liakhovetski

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

drivers/gpio/mx31_gpio.c new file +26 -0
new file mode 100644
index 0000000..166deaf
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DENX Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+#include <asm/arch/mx31.h>
+#include <asm/arch/mx31-regs.h>
+
Quoted 8 lines

drivers/gpio/mx31_gpio.c line 32

Quoted 6 lines
drivers/gpio/mx31_gpio.c new file +6 -0
+/* GPIO port description */
+static unsigned long gpio_ports[] = {
+	[0] = 0x53fcc000,
+	[1] = 0x53fd0000,
+	[2] = 0x53fa4000,
+};

I'll add qong patch before yours
please fix it

there is v4 of this patch:

http://lists.denx.de/pipermail/u-boot/2009-February/047097.html

Jean-Christophe, do you ACK it now?

Best regards,
Anatolij

#89 lore raw

PATCH v3 2/9 i.MX31: add a simple gpio driver

Quoted 50 lines · Anatolij Gustschin
Quoted 39 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 38 lines · Guennadi Liakhovetski

This is a minimal driver, so far only managing output. It will be used by the mxc_spi.c driver.

---

drivers/gpio/mx31_gpio.c new file +26 -0
new file mode 100644
index 0000000..166deaf
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DENX Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+#include <asm/arch/mx31.h>
+#include <asm/arch/mx31-regs.h>
+
Quoted 8 lines

drivers/gpio/mx31_gpio.c line 32

Quoted 6 lines
drivers/gpio/mx31_gpio.c new file +6 -0
+/* GPIO port description */
+static unsigned long gpio_ports[] = {
+	[0] = 0x53fcc000,
+	[1] = 0x53fd0000,
+	[2] = 0x53fa4000,
+};

I'll add qong patch before yours
please fix it

Quoted 5 lines

there is v4 of this patch:

http://lists.denx.de/pipermail/u-boot/2009-February/047097.html

Jean-Christophe, do you ACK it now?

you ahte it this V4

Best Regards,
J.

#90 lore raw

PATCH v3 2/9 i.MX31: add a simple gpio driver

In reply to Anatolij Gustschin
Quoted 8 lines
Quoted 7 lines

drivers/gpio/mx31_gpio.c line 32

Quoted 5 lines
drivers/gpio/mx31_gpio.c new file +5 -0
+static unsigned long gpio_ports[] = {
+	[0] = 0x53fcc000,
+	[1] = 0x53fd0000,
+	[2] = 0x53fa4000,
+};

I'll add qong patch before yours
please fix it

Quoted 5 lines

there is v4 of this patch:

http://lists.denx.de/pipermail/u-boot/2009-February/047097.html

Jean-Christophe, do you ACK it now?

ok Ack for the V4

Best Regards,
J.

#91 lore raw

PATCH v3 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

In reply to Guennadi Liakhovetski

Some SPI devices have special requirements on chip-select handling. With this patch we can use a GPIO as a chip-select and strictly follow the SPI_XFER_BEGIN and SPI_XFER_END flags.

---

Changes since v1: long lines split, mx31_gpio_* calls now also defined if CONFIG_MX31_GPIO is not defined (see patch 2/9), '!!' removed. Changes since v2: added braces in a multiline if, switched to ARRAY_SIZE().

 drivers/spi/mxc_spi.c |   48 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 40 insertions(+), 8 deletions(-)
drivers/spi/mxc_spi.c +40 -8
index 3135817..524b2e1 100644
@@ -32,6 +32,8 @@
 
 #else
 
+#include <asm/arch/mx31.h>
+
 #define MXC_CSPIRXDATA		0x00
 #define MXC_CSPITXDATA		0x04
 #define MXC_CSPICTRL		0x08
@@ -68,6 +70,7 @@ struct mxc_spi_slave {
 	struct spi_slave slave;
 	unsigned long	base;
 	u32		ctrl_reg;
+	int		gpio;
 };
 
 static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave)
@@ -85,7 +88,8 @@ static inline void reg_write(unsigned long addr, u32 val)
 	*(volatile unsigned long*)addr = val;
 }
 
-static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
+static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen,
+			   unsigned long flags)
 {
 	struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
 	unsigned int cfg_reg = reg_read(mxcs->base + MXC_CSPICTRL);
@@ -96,6 +100,9 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 	if (cfg_reg != mxcs->ctrl_reg)
 		reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg);
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_BEGIN))
+		mx31_gpio_set(mxcs->gpio, mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL);
+
 	reg_write(mxcs->base + MXC_CSPITXDATA, data);
 
 	reg_write(mxcs->base + MXC_CSPICTRL, mxcs->ctrl_reg | MXC_CSPICTRL_XCH);
@@ -103,6 +110,11 @@ static u32 spi_xchg_single(struct spi_slave *slave, u32 data, int bitlen)
 	while (reg_read(mxcs->base + MXC_CSPICTRL) & MXC_CSPICTRL_XCH)
 		;
 
+	if (mxcs->gpio > 0 && (flags & SPI_XFER_END)) {
+		mx31_gpio_set(mxcs->gpio,
+			      !(mxcs->ctrl_reg & MXC_CSPICTRL_SSPOL));
+	}
+
 	return reg_read(mxcs->base + MXC_CSPIRXDATA);
 }
 
@@ -121,7 +133,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
 	for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
 	     i < n_blks;
 	     i++, in_l++, out_l++, bitlen -= 32) {
-		u32 data = spi_xchg_single(slave, *out_l, bitlen);
+		u32 data = spi_xchg_single(slave, *out_l, bitlen, flags);
 
 		/* Check if we're only transfering 8 or 16 bits */
 		if (!i) {
@@ -144,11 +156,35 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 {
 	unsigned int ctrl_reg;
 	struct mxc_spi_slave *mxcs;
+	int ret;
 
-	if (bus >= sizeof(spi_bases) / sizeof(spi_bases[0]) ||
-	    cs > 3)
+	if (bus >= ARRAY_SIZE(spi_bases))
+		return NULL;
+
+	mxcs = malloc(sizeof(struct mxc_spi_slave));
+	if (!mxcs)
 		return NULL;
 
+	/*
+	 * Some SPI devices require active chip-select over multiple
+	 * transactions, we achieve this using a GPIO. Still, the SPI
+	 * controller has to be configured to use one of its own chipselects.
+	 * To use this feature you have to call spi_setup_slave() with
+	 * cs = internal_cs | (gpio << 8), and you have to use some unused
+	 * on this SPI controller cs between 0 and 3.
+	 */
+	if (cs > 3) {
+		mxcs->gpio = cs >> 8;
+		cs &= 3;
+		ret = mx31_gpio_direction(mxcs->gpio, MX31_GPIO_DIRECTION_OUT);
+		if (ret) {
+			printf("mxc_spi: cannot setup gpio %d\n", mxcs->gpio);
+			return NULL;
+		}
+	} else {
+		mxcs->gpio = -1;
+	}
+
 	ctrl_reg = MXC_CSPICTRL_CHIPSELECT(cs) |
 		MXC_CSPICTRL_BITCOUNT(31) |
 		MXC_CSPICTRL_DATARATE(7) | /* FIXME: calculate data rate */
@@ -162,10 +198,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	if (mode & SPI_CS_HIGH)
 		ctrl_reg |= MXC_CSPICTRL_SSPOL;
 
-	mxcs = malloc(sizeof(struct mxc_spi_slave));
-	if (!mxcs)
-		return NULL;
-
 	mxcs->slave.bus = bus;
 	mxcs->slave.cs = cs;
 	mxcs->base = spi_bases[bus];
Signature · 1 line
1.5.4
#92 lore raw

PATCH v3 3/9 i.MX31: support GPIO as a chip-select in the mxc_spi driver

Quoted 14 lines · Guennadi Liakhovetski

Some SPI devices have special requirements on chip-select handling. With this patch we can use a GPIO as a chip-select and strictly follow the SPI_XFER_BEGIN and SPI_XFER_END flags.

---

Changes since v1: long lines split, mx31_gpio_* calls now also defined if CONFIG_MX31_GPIO is not defined (see patch 2/9), '!!' removed. Changes since v2: added braces in a multiline if, switched to ARRAY_SIZE().

Review struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, · line 156

Quoted 1 line
(quoted diff) +0 -0
@@ -144,11 +156,35 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 {

Personnaly I tking we main need to replace the unsigned int cs by a callback or add one to allow us to use other gpio or I2C extender with having to this the spi driver

Best Regards,
J.

#93 lore raw

PATCH v3 4/9 A driver for the S6E63D6 SPI display controller from Samsung

In reply to Guennadi Liakhovetski

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

---

Changes since v1: parameters added in function declarations, alphabetical order in Makefile, id made configurable by the user, renamed configuration parameter to CONFIG_S6E63D6.
Changes since v2: added a comment, explaining the start byte format, empty line added before the final return in a function.

 drivers/video/Makefile  |    1 +
 drivers/video/s6e63d6.c |   76 +++++++++++++++++++++++++++++++++++++++++++++++
 include/s6e63d6.h       |   37 +++++++++++++++++++++++
 3 files changed, 114 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/s6e63d6.c
 create mode 100644 include/s6e63d6.h
drivers/video/Makefile +1 -0
index 7fba29f..84d4cb7 100644
@@ -28,6 +28,7 @@ LIB	:= $(obj)libvideo.a
 COBJS-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o
 COBJS-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
 COBJS-$(CONFIG_CFB_CONSOLE) += cfb_console.o
+COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
 COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o
 COBJS-$(CONFIG_VIDEO_MB862xx) += mb862xx.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
drivers/video/s6e63d6.c new file +76 -0

76 lines not on this page · raw message

include/s6e63d6.h new file +37 -0
new file mode 100644
index 0000000..9f17fc0
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2009
+ * Guennadi Liakhovetski, DENX Software Engineering, <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef _S6E63D6_H_
+#define _S6E63D6_H_
+
+struct s6e63d6 {
+	unsigned int bus;
+	unsigned int cs;
+	unsigned int id;
+	struct spi_slave *slave;
+};
+
+extern int s6e63d6_init(struct s6e63d6 *data);
+extern int s6e63d6_index(struct s6e63d6 *data, u8 idx);
+extern int s6e63d6_param(struct s6e63d6 *data, u16 param);
+
+#endif
Signature · 1 line
1.5.4
#94 lore raw

PATCH v3 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Quoted 6 lines · Guennadi Liakhovetski

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

---

<snip>

Quoted 6 lines
 drivers/video/Makefile  |    1 +
 drivers/video/s6e63d6.c |   76 +++++++++++++++++++++++++++++++++++++++++++++++
 include/s6e63d6.h       |   37 +++++++++++++++++++++++
 3 files changed, 114 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/s6e63d6.c
 create mode 100644 include/s6e63d6.h

Applied to u-boot-video/master.

Thanks,
Anatolij

#95 lore raw

PATCH v3 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Dear Anatolij,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines · Guennadi Liakhovetski

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

---

<snip>

Quoted 8 lines
Quoted 6 lines
 drivers/video/Makefile  |    1 +
 drivers/video/s6e63d6.c |   76 +++++++++++++++++++++++++++++++++++++++++++++++
 include/s6e63d6.h       |   37 +++++++++++++++++++++++
 3 files changed, 114 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/s6e63d6.c
 create mode 100644 include/s6e63d6.h

Applied to u-boot-video/master.

Do you plan to send a pull request soon? Please do - I would like to have a v2009.03-rc1 out soon. Thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
An armed society is a polite society.
#96 lore raw

PATCH v3 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Dear Wolfgang,

Quoted 17 lines · Wolfgang Denk

Dear Anatolij,

Quoted 14 lines · In message <[email protected]> you wrote:
Quoted 6 lines · Guennadi Liakhovetski

This is a driver for the S6E63D6 SPI OLED display controller from Samsung. It only provides access to controller's registers so the client can freely configure it.

---

<snip>

Quoted 6 lines
 drivers/video/Makefile  |    1 +
 drivers/video/s6e63d6.c |   76 +++++++++++++++++++++++++++++++++++++++++++++++
 include/s6e63d6.h       |   37 +++++++++++++++++++++++
 3 files changed, 114 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/s6e63d6.c
 create mode 100644 include/s6e63d6.h
Quoted 5 lines
Quoted 1 line

Applied to u-boot-video/master.

Do you plan to send a pull request soon? Please do - I would like to have a v2009.03-rc1 out soon. Thanks.

I'm still waiting for ACK for patches 1/9 v4, 2/9 v4, 9/9 v4 from this series. I'm going to send a pull request after Jean-Christophe ACK them. Patch 3/9 v4 was already ACKed, but I cannot apply it as it applies on top of 1/9 v4.

Best regards,
Anatolij

#97 lore raw

PATCH v3 4/9 A driver for the S6E63D6 SPI display controller from Samsung

Dear Jean-Christophe,

Quoted 8 lines · In message <[email protected]> Anatolij Gustschin wrote:
Quoted 3 lines

Do you plan to send a pull request soon? Please do - I would like to have a v2009.03-rc1 out soon. Thanks.

I'm still waiting for ACK for patches 1/9 v4, 2/9 v4, 9/9 v4 from this series. I'm going to send a pull request after Jean-Christophe ACK them. Patch 3/9 v4 was already ACKed, but I cannot apply it as it applies on top of 1/9 v4.

Could you please handle these patches ASAP?

I would like to see some progress here, but we're blocked waiting for your ACKs (or NAKs).

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"It's when they say 2 + 2 = 5 that I begin to argue."    - Eric Pepke
#98 lore raw

PATCH v3 5/9 ARM: remove unused variable

In reply to Guennadi Liakhovetski

The "size" variable in start_armboot() in lib_arm/board.c is only really used in "#ifndef CONFIG_SYS_NO_FLASH" case, and even there it can be eliminated (thanks to Jean-Christophe PLAGNIOL-VILLARD for a suggestion.)

---

Changes since v1: removed the "size" variable completely. Changes since v2: none.

 lib_arm/board.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
lib_arm/board.c +3 -7
index 964f5cc..41f7603 100644
@@ -287,9 +287,6 @@ void start_armboot (void)
 {
 	init_fnc_t **init_fnc_ptr;
 	char *s;
-#if !defined(CONFIG_SYS_NO_FLASH) || defined (CONFIG_VFD) || defined(CONFIG_LCD)
-	ulong size;
-#endif
 #if defined(CONFIG_VFD) || defined(CONFIG_LCD)
 	unsigned long addr;
 #endif
@@ -315,8 +312,7 @@ void start_armboot (void)
 
 #ifndef CONFIG_SYS_NO_FLASH
 	/* configure available FLASH banks */
-	size = flash_init ();
-	display_flash_config (size);
+	display_flash_config (flash_init ());
 #endif /* CONFIG_SYS_NO_FLASH */
 
 #ifdef CONFIG_VFD
@@ -328,7 +324,7 @@ void start_armboot (void)
 	 */
 	/* bss_end is defined in the board-specific linker script */
 	addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-	size = vfd_setmem (addr);
+	vfd_setmem (addr);
 	gd->fb_base = addr;
 #endif /* CONFIG_VFD */
 
@@ -343,7 +339,7 @@ void start_armboot (void)
 		 */
 		/* bss_end is defined in the board-specific linker script */
 		addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-		size = lcd_setmem (addr);
+		lcd_setmem (addr);
 		gd->fb_base = addr;
 	}
 #endif /* CONFIG_LCD */
Signature · 1 line
1.5.4
#99 lore raw

PATCH v3 5/9 ARM: remove unused variable

Quoted 6 lines · Guennadi Liakhovetski

The "size" variable in start_armboot() in lib_arm/board.c is only really used in "#ifndef CONFIG_SYS_NO_FLASH" case, and even there it can be eliminated (thanks to Jean-Christophe PLAGNIOL-VILLARD for a suggestion.)

---

Ack will be apply on arm soon

Best Regards,
J.

#100 lore raw

PATCH v3 6/9 Add 16bpp BMP support

In reply to Guennadi Liakhovetski

From: Mark Jackson <[email protected]>

This patch adds 16bpp BMP support to the common lcd code.

Use CONFIG_BMP_16BPP and set LCD_BPP to LCD_COLOR16 to enable the code.

At the moment it's only been tested on the MIMC200 AVR32 board, but extending this to other platforms should be a simple task !!

---

Changes since v1: added this comment to explain, that this patch from Mark Jackson is included in this patch series for completeness, because future patches base on it, long lines split.
Changes since v2: none.

 common/lcd.c |   51 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 10 deletions(-)
common/lcd.c +41 -10
index 5f73247..756b30d 100644
@@ -84,7 +84,7 @@ extern void lcd_enable (void);
 static void *lcd_logo (void);
 
 
-#if LCD_BPP == LCD_COLOR8
+#if (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
 extern void lcd_setcolreg (ushort regno,
 				ushort red, ushort green, ushort blue);
 #endif
@@ -656,7 +656,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
 	bpix = NBITS(panel_info.vl_bpix);
 
-	if ((bpix != 1) && (bpix != 8)) {
+	if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
 		printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
 			bpix);
 		return 1;
@@ -738,17 +738,48 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
 	fb   = (uchar *) (lcd_base +
 		(y + height - 1) * lcd_line_length + x);
-	for (i = 0; i < height; ++i) {
-		WATCHDOG_RESET();
-		for (j = 0; j < width ; j++)
+
+	switch (bpix) {
+	case 1: /* pass through */
+	case 8:
+		for (i = 0; i < height; ++i) {
+			WATCHDOG_RESET();
+			for (j = 0; j < width ; j++)
 #if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
-			*(fb++) = *(bmap++);
+				*(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
-			*(fb++)=255-*(bmap++);
+				*(fb++)=255-*(bmap++);
 #endif
-		bmap += (width - padded_line);
-		fb   -= (width + lcd_line_length);
-	}
+			bmap += (width - padded_line);
+			fb   -= (width + lcd_line_length);
+		}
+		break;
+
+#if defined(CONFIG_BMP_16BPP)
+	case 16:
+		for (i = 0; i < height; ++i) {
+			WATCHDOG_RESET();
+			for (j = 0; j < width; j++) {
+#if defined(CONFIG_ATMEL_LCD_BGR555)
+				*(fb++) = ((bmap[0] & 0x1f) << 2) |
+					(bmap[1] & 0x03);
+				*(fb++) = (bmap[0] & 0xe0) |
+					((bmap[1] & 0x7c) >> 2);
+				bmap += 2;
+#else
+				*(fb++) = *(bmap++);
+				*(fb++) = *(bmap++);
+#endif
+			}
+			bmap += (padded_line - width) * 2;
+			fb   -= (width * 2 + lcd_line_length);
+		}
+		break;
+#endif /* CONFIG_BMP_16BPP */
+
+	default:
+		break;
+	};
 
 	return (0);
 }
Signature · 1 line
1.5.4
#101 lore raw

PATCH v3 6/9 Add 16bpp BMP support

Quoted 13 lines · Guennadi Liakhovetski

From: Mark Jackson <[email protected]>

This patch adds 16bpp BMP support to the common lcd code.

Use CONFIG_BMP_16BPP and set LCD_BPP to LCD_COLOR16 to enable the code.

At the moment it's only been tested on the MIMC200 AVR32 board, but extending this to other platforms should be a simple task !!

---

Quoted 7 lines

Changes since v1: added this comment to explain, that this patch from Mark Jackson is included in this patch series for completeness, because future patches base on it, long lines split.
Changes since v2: none.

 common/lcd.c |   51 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 10 deletions(-)

Applied to u-boot-video/master.

Thanks,
Anatolij

#102 lore raw

PATCH v3 7/9 LCD: support 8bpp BMPs on 16bpp displays

In reply to Guennadi Liakhovetski

This patch also simplifies some ifdefs in lcd.c, introduces a generic vidinfo_t, which new drivers are encouraged to use and old drivers to switch over to.

---

Changes since v1: no changes.

 common/lcd.c  |   56 ++++++++++++++++++++++++++++++++------------------------
 include/lcd.h |   21 +++++++++++++--------
 2 files changed, 45 insertions(+), 32 deletions(-)
common/lcd.c +32 -24
index 756b30d..e4ac6c2 100644
@@ -622,19 +622,15 @@ void bitmap_plot (int x, int y)
  */
 int lcd_display_bitmap(ulong bmp_image, int x, int y)
 {
-#ifdef CONFIG_ATMEL_LCD
-	uint *cmap;
-#elif !defined(CONFIG_MCC200)
-	ushort *cmap;
-#endif
+	ushort *cmap = NULL, *cmap_base = NULL;
 	ushort i, j;
 	uchar *fb;
 	bmp_image_t *bmp=(bmp_image_t *)bmp_image;
 	uchar *bmap;
 	ushort padded_line;
-	unsigned long width, height;
+	unsigned long width, height, byte_width;
 	unsigned long pwidth = panel_info.vl_col;
-	unsigned colors,bpix;
+	unsigned colors, bpix, bmp_bpix;
 	unsigned long compression;
 #if defined(CONFIG_PXA250)
 	struct pxafb_info *fbi = &panel_info.pxa;
@@ -647,22 +643,24 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		(bmp->header.signature[1]=='M'))) {
 		printf ("Error: no valid bmp image at %lx\n", bmp_image);
 		return 1;
-}
+	}
 
 	width = le32_to_cpu (bmp->header.width);
 	height = le32_to_cpu (bmp->header.height);
-	colors = 1<<le16_to_cpu (bmp->header.bit_count);
+	bmp_bpix = le16_to_cpu(bmp->header.bit_count);
+	colors = 1 << bmp_bpix;
 	compression = le32_to_cpu (bmp->header.compression);
 
 	bpix = NBITS(panel_info.vl_bpix);
 
 	if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
-		printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
-			bpix);
+		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
+			bpix, bmp_bpix);
 		return 1;
 	}
 
-	if (bpix != le16_to_cpu(bmp->header.bit_count)) {
+	/* We support displaying 8bpp BMPs on 16bpp LCDs */
+	if (bpix != bmp_bpix && (bmp_bpix != 8 || bpix != 16)) {
 		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
 			bpix,
 			le16_to_cpu(bmp->header.bit_count));
@@ -674,17 +672,17 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
 #if !defined(CONFIG_MCC200)
 	/* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
-	if (bpix==8) {
+	if (bmp_bpix == 8) {
 #if defined(CONFIG_PXA250)
 		cmap = (ushort *)fbi->palette;
 #elif defined(CONFIG_MPC823)
 		cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
-#elif defined(CONFIG_ATMEL_LCD)
-		cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0));
-#else
-# error "Don't know location of color map"
+#elif !defined(CONFIG_ATMEL_LCD)
+		cmap = panel_info.cmap;
 #endif
 
+		cmap_base = cmap;
+
 		/* Set color map */
 		for (i=0; i<colors; ++i) {
 			bmp_color_table_entry_t cte = bmp->color_table[i];
@@ -698,10 +696,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 #else
 			*cmap = colreg;
 #endif
-#if defined(CONFIG_PXA250)
-			cmap++;
-#elif defined(CONFIG_MPC823)
+#if defined(CONFIG_MPC823)
 			cmap--;
+#else
+			cmap++;
 #endif
 #else /* CONFIG_ATMEL_LCD */
 			lcd_setcolreg(i, cte.red, cte.green, cte.blue);
@@ -739,19 +737,29 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	fb   = (uchar *) (lcd_base +
 		(y + height - 1) * lcd_line_length + x);
 
-	switch (bpix) {
+	switch (bmp_bpix) {
 	case 1: /* pass through */
 	case 8:
+		if (bpix != 16)
+			byte_width = width;
+		else
+			byte_width = width * 2;
+
 		for (i = 0; i < height; ++i) {
 			WATCHDOG_RESET();
 			for (j = 0; j < width ; j++)
+				if (bpix!=16) {
 #if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
-				*(fb++) = *(bmap++);
+					*(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
-				*(fb++)=255-*(bmap++);
+					*(fb++) = 255 - *(bmap++);
 #endif
+				} else {
+					*(uint16_t *)fb = cmap_base[*(bmap++)];
+					fb += sizeof(uint16_t) / sizeof(*fb);
+				}
 			bmap += (width - padded_line);
-			fb   -= (width + lcd_line_length);
+			fb   -= (byte_width + lcd_line_length);
 		}
 		break;
 
include/lcd.h +13 -8
index 512221e..f054cac 100644
@@ -148,14 +148,6 @@ typedef struct vidinfo {
 
 extern vidinfo_t panel_info;
 
-#elif defined(CONFIG_MCC200)
-typedef struct vidinfo {
-	ushort	vl_col;		/* Number of columns (i.e. 160) */
-	ushort	vl_row;		/* Number of rows (i.e. 100) */
-
-	u_char	vl_bpix;	/* Bits per pixel, 0 = 1 */
-} vidinfo_t;
-
 #elif defined(CONFIG_ATMEL_LCD)
 
 typedef struct vidinfo {
@@ -183,6 +175,19 @@ typedef struct vidinfo {
 
 extern vidinfo_t panel_info;
 
+#else
+
+typedef struct vidinfo {
+	ushort	vl_col;		/* Number of columns (i.e. 160) */
+	ushort	vl_row;		/* Number of rows (i.e. 100) */
+
+	u_char	vl_bpix;	/* Bits per pixel, 0 = 1 */
+
+	ushort	*cmap;		/* Pointer to the colormap */
+
+	void	*priv;		/* Pointer to driver-specific data */
+} vidinfo_t;
+
 #endif /* CONFIG_MPC823, CONFIG_PXA250 or CONFIG_MCC200 or CONFIG_ATMEL_LCD */
 
 /* Video functions */
Signature · 1 line
1.5.4
#103 lore raw

PATCH v3 7/9 LCD: support 8bpp BMPs on 16bpp displays

Quoted 4 lines · Guennadi Liakhovetski

This patch also simplifies some ifdefs in lcd.c, introduces a generic vidinfo_t, which new drivers are encouraged to use and old drivers to switch over to.

Quoted 8 lines

---

Changes since v1: no changes.

 common/lcd.c  |   56 ++++++++++++++++++++++++++++++++------------------------
 include/lcd.h |   21 +++++++++++++--------
 2 files changed, 45 insertions(+), 32 deletions(-)

Applied to u-boot-video/master.

Also fixed some style issues by additionally applying a trivial patch below.

Note that I consider this horrible ifdef mess in common/lcd.c as a bug (not your bug!) that should be fixed before 2009.03-rc1 or even earlier. pxa, mpc823 and atmel LCD drivers provide lcd_setcolreg() for color map setting and it could be used in lcd_display_bitmap() instead of duplicating the color map setting code for platforms in question. Other LCD drivers should provide own/controller-specific lcd_setcolreg().

I will try to help fixing these bugs, but I can not test the code as I do not have the hardware.

Thanks,
Anatolij

common/lcd.c +3 -2
index e4ac6c2..6ce14d2 100644
@@ -747,8 +747,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
 		for (i = 0; i < height; ++i) {
 			WATCHDOG_RESET();
-			for (j = 0; j < width ; j++)
-				if (bpix!=16) {
+			for (j = 0; j < width; j++) {
+				if (bpix != 16) {
 #if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
 					*(fb++) = *(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
@@ -758,6 +758,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 					*(uint16_t *)fb = cmap_base[*(bmap++)];
 					fb += sizeof(uint16_t) / sizeof(*fb);
 				}
+			}
 			bmap += (width - padded_line);
 			fb   -= (byte_width + lcd_line_length);
 		}
#104 lore raw

PATCH v3 7/9 LCD: support 8bpp BMPs on 16bpp displays

Quoted 19 lines · Anatolij Gustschin
Quoted 4 lines · Guennadi Liakhovetski

This patch also simplifies some ifdefs in lcd.c, introduces a generic vidinfo_t, which new drivers are encouraged to use and old drivers to switch over to.

Quoted 8 lines

---

Changes since v1: no changes.

 common/lcd.c  |   56 ++++++++++++++++++++++++++++++++------------------------
 include/lcd.h |   21 +++++++++++++--------
 2 files changed, 45 insertions(+), 32 deletions(-)

Applied to u-boot-video/master.

Also fixed some style issues by additionally applying a trivial patch below.

Quoted 7 lines

Note that I consider this horrible ifdef mess in common/lcd.c as a bug (not your bug!) that should be fixed before 2009.03-rc1 or even earlier. pxa, mpc823 and atmel LCD drivers provide lcd_setcolreg() for color map setting and it could be used in lcd_display_bitmap() instead of duplicating the color map setting code for platforms in question. Other LCD drivers should provide own/controller-specific lcd_setcolreg().

That's why I introduced a generic vidinfo_t with only members in it, used by the generic code (lcd.c,...), a pointer to a colour map and a "void *priv" pointer for driver-specific data. It shouldn't be too difficult to migrate all in-tree users to this or a similar scheme. This alone would eliminate a few ifdefs, but maybe you have a better idea how to do this.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#105 lore raw

PATCH v3 8/9 video: add an i.MX31 framebuffer driver

In reply to Guennadi Liakhovetski

Add a driver for the Synchronous Display Controller and the Display Interface on i.MX31, using IPU for DMA channel setup. So far only displaying of bitmaps is supported, no text output.

---

Changes since v1: added breaks, shorter title, splitted long lines, unified style.
Changes since v2: fixed comment formatting, function parameters in comments, a typo in a comment, and removed an unused parameter from mx3fb_set_par()

 drivers/video/Makefile |    1 +
 drivers/video/mx3fb.c  |  856 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 857 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/mx3fb.c
drivers/video/Makefile +1 -0
index 84d4cb7..bc00852 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_CFB_CONSOLE) += cfb_console.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
 COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o
 COBJS-$(CONFIG_VIDEO_MB862xx) += mb862xx.o
+COBJS-$(CONFIG_VIDEO_MX3) += mx3fb.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
drivers/video/mx3fb.c new file +856 -0

856 lines not on this page · raw message

Signature · 1 line
1.5.4
#106 lore raw

PATCH v3 8/9 video: add an i.MX31 framebuffer driver

Quoted 6 lines · Guennadi Liakhovetski

Add a driver for the Synchronous Display Controller and the Display Interface on i.MX31, using IPU for DMA channel setup. So far only displaying of bitmaps is supported, no text output.

---

<snip>

Quoted 4 lines
 drivers/video/Makefile |    1 +
 drivers/video/mx3fb.c  |  856 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 857 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/mx3fb.c

Applied to u-boot-video/master.

Thanks,
Anatolij

#107 lore raw

PATCH v3 9/9 ARM: add an "eet" variant of the imx31_phycore board

In reply to Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Changes since v1: adjusted to reflect changes in earlier patches: add .id field initialisation, configuration parameter renamed to CONFIG_S6E63D6. Changes since v2: fixed the left-over CONFIG_DISPLAY_S6E63D6 parameter.

 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   52 +++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   16 ++++++++++
 include/configs/imx31_phycore.h       |   23 ++++++++++++++
 4 files changed, 96 insertions(+), 1 deletions(-)
Makefile +5 -1
index 787c5f2..6151e2c 100644
@@ -3025,8 +3025,12 @@ apollon_config		: unconfig
 imx31_litekit_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
+imx31_phycore_eet_config \
 imx31_phycore_config	: unconfig
-	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+	@if [ -n "$(findstring imx31_phycore_eet_config,$@)" ]; then			\
+		echo "#define CONFIG_IMX31_PHYCORE_EET" >> $(obj)include/config.h;	\
+	fi
+	@$(MKCONFIG) -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
 
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
board/imx31_phycore/imx31_phycore.c +52 -0

64 lines not on this page · raw message

include/asm-arm/arch-mx31/mx31-regs.h +16 -0
index e736052..dcc0805 100644
@@ -124,7 +124,14 @@
 #define MUX_CTL_CSPI2_SS0	0x85
 #define MUX_CTL_CSPI2_SS1	0x86
 #define MUX_CTL_CSPI2_SS2	0x87
+#define MUX_CTL_CSPI1_SS2	0x88
+#define MUX_CTL_CSPI1_SCLK	0x89
+#define MUX_CTL_CSPI1_SPI_RDY	0x8a
 #define MUX_CTL_CSPI2_MOSI	0x8b
+#define MUX_CTL_CSPI1_MOSI	0x8c
+#define MUX_CTL_CSPI1_MISO	0x8d
+#define MUX_CTL_CSPI1_SS0	0x8e
+#define MUX_CTL_CSPI1_SS1	0x8f
 
 /*
  * Helper macros for the MUX_[contact name]__[pin function] macros
@@ -150,6 +157,15 @@
 	IOMUX_MODE(MUX_CTL_CSPI2_SPI_RDY, MUX_CTL_FUNC)
 #define MUX_CSPI2_SCLK__CSPI2_CLK IOMUX_MODE(MUX_CTL_CSPI2_SCLK, MUX_CTL_FUNC)
 
+#define MUX_CSPI1_SS0__CSPI1_SS0_B IOMUX_MODE(MUX_CTL_CSPI1_SS0, MUX_CTL_FUNC)
+#define MUX_CSPI1_SS1__CSPI1_SS1_B IOMUX_MODE(MUX_CTL_CSPI1_SS1, MUX_CTL_FUNC)
+#define MUX_CSPI1_SS2__CSPI1_SS2_B IOMUX_MODE(MUX_CTL_CSPI1_SS2, MUX_CTL_FUNC)
+#define MUX_CSPI1_MOSI__CSPI1_MOSI IOMUX_MODE(MUX_CTL_CSPI1_MOSI, MUX_CTL_FUNC)
+#define MUX_CSPI1_MISO__CSPI1_MISO IOMUX_MODE(MUX_CTL_CSPI1_MISO, MUX_CTL_FUNC)
+#define MUX_CSPI1_SPI_RDY__CSPI1_DATAREADY_B \
+	IOMUX_MODE(MUX_CTL_CSPI1_SPI_RDY, MUX_CTL_FUNC)
+#define MUX_CSPI1_SCLK__CSPI1_CLK IOMUX_MODE(MUX_CTL_CSPI1_SCLK, MUX_CTL_FUNC)
+
 #define MUX_CSPI2_MOSI__I2C2_SCL IOMUX_MODE(MUX_CTL_CSPI2_MOSI, MUX_CTL_ALT1)
 #define MUX_CSPI2_MISO__I2C2_SDA IOMUX_MODE(MUX_CTL_CSPI2_MISO, MUX_CTL_ALT1)
 
include/configs/imx31_phycore.h +23 -0
index f0d28ee..2dd9e92 100644
@@ -178,4 +178,27 @@
 #undef CONFIG_JFFS2_CMDLINE
 #define CONFIG_JFFS2_DEV	"nor0"
 
+/* EET platform additions */
+#ifdef CONFIG_IMX31_PHYCORE_EET
+#define BOARD_LATE_INIT
+
+#define CONFIG_MX31_GPIO			1
+
+#define CONFIG_HARD_SPI				1
+#define CONFIG_MXC_SPI				1
+#define CONFIG_CMD_SPI
+
+#define CONFIG_S6E63D6				1
+
+#define CONFIG_LCD				1
+#define CONFIG_VIDEO_MX3			1
+#define CONFIG_SYS_WHITE_ON_BLACK		1
+#define LCD_BPP					LCD_COLOR8
+#define	CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE	1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV		1
+
+#define	CONFIG_SPLASH_SCREEN			1
+#define CONFIG_CMD_BMP				1
+#endif
+
 #endif /* __CONFIG_H */
Signature · 1 line
1.5.4
#108 lore raw

PATCH v3 9/9 ARM: add an "eet" variant of the imx31_phycore board

Quoted 23 lines · Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Changes since v1: adjusted to reflect changes in earlier patches: add .id field initialisation, configuration parameter renamed to CONFIG_S6E63D6. Changes since v2: fixed the left-over CONFIG_DISPLAY_S6E63D6 parameter.

 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   52 +++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   16 ++++++++++
 include/configs/imx31_phycore.h       |   23 ++++++++++++++
 4 files changed, 96 insertions(+), 1 deletions(-)
Makefile +0 -0
index 787c5f2..6151e2c 100644

Makefile apollon_config : unconfig · line 3032

Quoted 9 lines
Makefile +4 -1
@@ -3025,8 +3025,12 @@ apollon_config		: unconfig
 imx31_litekit_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
+imx31_phycore_eet_config \
 imx31_phycore_config	: unconfig
-	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+	@if [ -n "$(findstring imx31_phycore_eet_config,$@)" ]; then			\
+		echo "#define CONFIG_IMX31_PHYCORE_EET" >> $(obj)include/config.h;	\
+	fi

One question I'll send within few minutes the dcc support for arm if you wish to use it in eet

you may create a
imx31_phycore_eet_dcc_config
config will you create a new if [ -n "(findstring imx31_phycore_eet_dcc_config... to handle and so duplicate code

or just do this

	@if [ -n "$(findstring _eet_,$@)" ]; then			\
		echo "#define CONFIG_IMX31_PHYCORE_EET" >> $(obj)include/config.h;	\
	fi
	@if [ -n "$(findstring _dcc_,$@)" ]; then			\
		echo "#define CONFIG_DCC" >> $(obj)include/config.h;	\
	fi

??
I'll suggest to add a README file to describe the board and it's specifications when it's possible maybe

Quoted 17 lines
Makefile +1 -0
+	@$(MKCONFIG) -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
 
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
board/imx31_phycore/imx31_phycore.c +1 -0
index 6b78194..9456468 100644
@@ -23,6 +23,7 @@
 
 
 #include <common.h>
+#include <s6e63d6.h>
 #include <asm/arch/mx31.h>
 #include <asm/arch/mx31-regs.h>
 

board/imx31_phycore/imx31_phycore.c int board_init (void) · line 78

Quoted 9 lines
board/imx31_phycore/imx31_phycore.c +6 -0
@@ -69,6 +70,57 @@ int board_init (void)
 	return 0;
 }
 
+#ifdef BOARD_LATE_INIT
+int board_late_init(void)
+{
+#ifdef CONFIG_S6E63D6
+	struct s6e63d6 data = {
+		.cs = 2 | (57 << 8),

why??

board/imx31_phycore/imx31_phycore.c int board_init (void) · line 83

Quoted 5 lines
board/imx31_phycore/imx31_phycore.c +5 -0
+		.bus = 0,
+		.id = 0,
+	};
+	int ret;
+

Best Regards,
J.

#109 lore raw

PATCH v3 9/9 ARM: add an "eet" variant of the imx31_phycore board

In reply to Guennadi Liakhovetski

Hi Guennadi,

Quoted 11 lines · Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Changes since v1: adjusted to reflect changes in earlier patches: add .id field initialisation, configuration parameter renamed to CONFIG_S6E63D6. Changes since v2: fixed the left-over CONFIG_DISPLAY_S6E63D6 parameter.

can you please address comments from Jean-Christophe to this 9/9 v3 patch? I'm steel waiting for ACK from Jean-Christophe for 1/9 v4, 2/9 v4 and 9/9 v3 patches from this series.

Best regards,
Anatolij

#110 lore raw

PATCH v4 9/9 ARM: add an "eet" variant of the imx31_phycore board

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Quoted 3 lines · Anatolij Gustschin

can you please address comments from Jean-Christophe to this 9/9 v3 patch? I'm steel waiting for ACK from Jean-Christophe for 1/9 v4, 2/9 v4 and 9/9 v3 patches from this series.

Oops, sorry, I was sure I had sent it already.

Changes since v1: adjusted to reflect changes in earlier patches: add .id field initialisation, configuration parameter renamed to CONFIG_S6E63D6. Changes since v2: fixed the left-over CONFIG_DISPLAY_S6E63D6 parameter. Changes since v3: added a comment to clarify the SPI chipselect value.

 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   57 +++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   16 +++++++++
 include/configs/imx31_phycore.h       |   23 +++++++++++++
 4 files changed, 101 insertions(+), 1 deletions(-)
Makefile +5 -1
index 787c5f2..6151e2c 100644
@@ -3025,8 +3025,12 @@ apollon_config		: unconfig
 imx31_litekit_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
+imx31_phycore_eet_config \
 imx31_phycore_config	: unconfig
-	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+	@if [ -n "$(findstring imx31_phycore_eet_config,$@)" ]; then			\
+		echo "#define CONFIG_IMX31_PHYCORE_EET" >> $(obj)include/config.h;	\
+	fi
+	@$(MKCONFIG) -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
 
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
board/imx31_phycore/imx31_phycore.c +57 -0

69 lines not on this page · raw message

include/asm-arm/arch-mx31/mx31-regs.h +16 -0
index e736052..dcc0805 100644
@@ -124,7 +124,14 @@
 #define MUX_CTL_CSPI2_SS0	0x85
 #define MUX_CTL_CSPI2_SS1	0x86
 #define MUX_CTL_CSPI2_SS2	0x87
+#define MUX_CTL_CSPI1_SS2	0x88
+#define MUX_CTL_CSPI1_SCLK	0x89
+#define MUX_CTL_CSPI1_SPI_RDY	0x8a
 #define MUX_CTL_CSPI2_MOSI	0x8b
+#define MUX_CTL_CSPI1_MOSI	0x8c
+#define MUX_CTL_CSPI1_MISO	0x8d
+#define MUX_CTL_CSPI1_SS0	0x8e
+#define MUX_CTL_CSPI1_SS1	0x8f
 
 /*
  * Helper macros for the MUX_[contact name]__[pin function] macros
@@ -150,6 +157,15 @@
 	IOMUX_MODE(MUX_CTL_CSPI2_SPI_RDY, MUX_CTL_FUNC)
 #define MUX_CSPI2_SCLK__CSPI2_CLK IOMUX_MODE(MUX_CTL_CSPI2_SCLK, MUX_CTL_FUNC)
 
+#define MUX_CSPI1_SS0__CSPI1_SS0_B IOMUX_MODE(MUX_CTL_CSPI1_SS0, MUX_CTL_FUNC)
+#define MUX_CSPI1_SS1__CSPI1_SS1_B IOMUX_MODE(MUX_CTL_CSPI1_SS1, MUX_CTL_FUNC)
+#define MUX_CSPI1_SS2__CSPI1_SS2_B IOMUX_MODE(MUX_CTL_CSPI1_SS2, MUX_CTL_FUNC)
+#define MUX_CSPI1_MOSI__CSPI1_MOSI IOMUX_MODE(MUX_CTL_CSPI1_MOSI, MUX_CTL_FUNC)
+#define MUX_CSPI1_MISO__CSPI1_MISO IOMUX_MODE(MUX_CTL_CSPI1_MISO, MUX_CTL_FUNC)
+#define MUX_CSPI1_SPI_RDY__CSPI1_DATAREADY_B \
+	IOMUX_MODE(MUX_CTL_CSPI1_SPI_RDY, MUX_CTL_FUNC)
+#define MUX_CSPI1_SCLK__CSPI1_CLK IOMUX_MODE(MUX_CTL_CSPI1_SCLK, MUX_CTL_FUNC)
+
 #define MUX_CSPI2_MOSI__I2C2_SCL IOMUX_MODE(MUX_CTL_CSPI2_MOSI, MUX_CTL_ALT1)
 #define MUX_CSPI2_MISO__I2C2_SDA IOMUX_MODE(MUX_CTL_CSPI2_MISO, MUX_CTL_ALT1)
 
include/configs/imx31_phycore.h +23 -0
index f0d28ee..2dd9e92 100644
@@ -178,4 +178,27 @@
 #undef CONFIG_JFFS2_CMDLINE
 #define CONFIG_JFFS2_DEV	"nor0"
 
+/* EET platform additions */
+#ifdef CONFIG_IMX31_PHYCORE_EET
+#define BOARD_LATE_INIT
+
+#define CONFIG_MX31_GPIO			1
+
+#define CONFIG_HARD_SPI				1
+#define CONFIG_MXC_SPI				1
+#define CONFIG_CMD_SPI
+
+#define CONFIG_S6E63D6				1
+
+#define CONFIG_LCD				1
+#define CONFIG_VIDEO_MX3			1
+#define CONFIG_SYS_WHITE_ON_BLACK		1
+#define LCD_BPP					LCD_COLOR8
+#define	CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE	1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV		1
+
+#define	CONFIG_SPLASH_SCREEN			1
+#define CONFIG_CMD_BMP				1
+#endif
+
 #endif /* __CONFIG_H */
Signature · 1 line
1.5.4
#111 lore raw

PATCH v4 9/9 ARM: add an "eet" variant of the imx31_phycore board

Quoted 31 lines · Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Quoted 3 lines · Anatolij Gustschin

can you please address comments from Jean-Christophe to this 9/9 v3 patch? I'm steel waiting for ACK from Jean-Christophe for 1/9 v4, 2/9 v4 and 9/9 v3 patches from this series.

Oops, sorry, I was sure I had sent it already.

Changes since v1: adjusted to reflect changes in earlier patches: add .id field initialisation, configuration parameter renamed to CONFIG_S6E63D6. Changes since v2: fixed the left-over CONFIG_DISPLAY_S6E63D6 parameter. Changes since v3: added a comment to clarify the SPI chipselect value.

 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   57 +++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   16 +++++++++
 include/configs/imx31_phycore.h       |   23 +++++++++++++
 4 files changed, 101 insertions(+), 1 deletions(-)
Makefile +0 -0
index 787c5f2..6151e2c 100644

Makefile apollon_config : unconfig · line 3030

Quoted 7 lines
Makefile +2 -1
@@ -3025,8 +3025,12 @@ apollon_config		: unconfig
 imx31_litekit_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
+imx31_phycore_eet_config \
 imx31_phycore_config	: unconfig
-	@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+	@if [ -n "$(findstring imx31_phycore_eet_config,$@)" ]; then			\

please do replace with

	@if [ -n "$(findstring _eet_,$@)" ]; then			\

And Ack

Best Regards,
J.

#112 lore raw

PATCH v4 9/9 ARM: add an "eet" variant of the imx31_phycore board

In reply to Guennadi Liakhovetski
Quoted 20 lines · Guennadi Liakhovetski

The "eet" variant of the imx31_phycore board has an OLED display, using a s6e63d6 display controller on the first SPI interface, using GPIO57 as a chip-select for it. With this configuration you can display 256 colour BMP images in 16-bit RGB (RGB565) LCD mode.

---

Quoted 3 lines · Anatolij Gustschin

can you please address comments from Jean-Christophe to this 9/9 v3 patch? I'm steel waiting for ACK from Jean-Christophe for 1/9 v4, 2/9 v4 and 9/9 v3 patches from this series.

Oops, sorry, I was sure I had sent it already.

Changes since v1: adjusted to reflect changes in earlier patches: add .id field initialisation, configuration parameter renamed to CONFIG_S6E63D6. Changes since v2: fixed the left-over CONFIG_DISPLAY_S6E63D6 parameter. Changes since v3: added a comment to clarify the SPI chipselect value.

Quoted 6 lines
 Makefile                              |    6 +++-
 board/imx31_phycore/imx31_phycore.c   |   57
+++++++++++++++++++++++++++++++++ include/asm-arm/arch-mx31/mx31-regs.h |  
16 +++++++++
 include/configs/imx31_phycore.h       |   23 +++++++++++++
 4 files changed, 101 insertions(+), 1 deletions(-)

Applied to u-boot-video/master,
also fixed by s/imx31_phycore_eet_config,/_eet_,/

Thanks,
Anatolij

#113 lore raw

v3 cover ARM: Support for splashimage om i.MX31-based phycore "eet" variant

In reply to Guennadi Liakhovetski

Hello all,

Quoted 7 lines · Guennadi Liakhovetski

Hi again,

this is version 3 of the patch-series, that adds support for the graphics engine on i.MX31 SoC. Changes since v1 and v2 will be reflected in each single patch. As all correction requests have been addressed, I hope we can get it in on the last day of the merge window (today). Should any further problems surface, we can address them in incremental patches.

I applied following patches

[PATCH 4/9 v3] A driver for the S6E63D6 SPI display controller from Samsung [PATCH 6/9 v3] Add 16bpp BMP support
[PATCH 7/9 v3] LCD: support 8bpp BMPs on 16bpp displays
[PATCH 8/9 v3] video: add an i.MX31 framebuffer driver

to the u-boot-video/master branch.

Jean-Christophe, do you prefer to push other patches from this series (1/9, 2/9, 3/9, 5/9, 9/9) to the arm tree or should I push them to the video tree? I need an ACK from you in the latter case.

Thanks,
Anatolij

#114 lore raw

v3 cover ARM: Support for splashimage om i.MX31-based phycore "eet" variant

Quoted 18 lines · Anatolij Gustschin

Hello all,

Quoted 7 lines · Guennadi Liakhovetski

Hi again,

this is version 3 of the patch-series, that adds support for the graphics engine on i.MX31 SoC. Changes since v1 and v2 will be reflected in each single patch. As all correction requests have been addressed, I hope we can get it in on the last day of the merge window (today). Should any further problems surface, we can address them in incremental patches.

I applied following patches

[PATCH 4/9 v3] A driver for the S6E63D6 SPI display controller from Samsung [PATCH 6/9 v3] Add 16bpp BMP support
[PATCH 7/9 v3] LCD: support 8bpp BMPs on 16bpp displays
[PATCH 8/9 v3] video: add an i.MX31 framebuffer driver

Quoted 5 lines

to the u-boot-video/master branch.

Jean-Christophe, do you prefer to push other patches from this series (1/9, 2/9, 3/9, 5/9, 9/9) to the arm tree or should I push them to the video tree? I need an ACK from you in the latter case.

As I said in one of the first versions of this series, it should better be pushed via one tree completely, because otherwise cross-dependencies will break things, or you'll have to imply a specific merge order, which isn't nice either.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de

#115 lore raw

v3 cover ARM: Support for splashimage om i.MX31-based phycore "eet" variant

In reply to Anatolij Gustschin
Quoted 18 lines · Anatolij Gustschin

Hello all,

Quoted 7 lines · Guennadi Liakhovetski

Hi again,

this is version 3 of the patch-series, that adds support for the graphics engine on i.MX31 SoC. Changes since v1 and v2 will be reflected in each single patch. As all correction requests have been addressed, I hope we can get it in on the last day of the merge window (today). Should any further problems surface, we can address them in incremental patches.

I applied following patches

[PATCH 4/9 v3] A driver for the S6E63D6 SPI display controller from Samsung [PATCH 6/9 v3] Add 16bpp BMP support
[PATCH 7/9 v3] LCD: support 8bpp BMPs on 16bpp displays
[PATCH 8/9 v3] video: add an i.MX31 framebuffer driver

Quoted 5 lines

to the u-boot-video/master branch.

Jean-Christophe, do you prefer to push other patches from this series (1/9, 2/9, 3/9, 5/9, 9/9) to the arm tree or should I push them to the video tree? I need an ACK from you in the latter case.

I've no problem with it I'll add the on the patch and let you manage them

It's more a video patch series than a arm one

Best Regards,
J.