Skip to contentSkip to conversation

TQMA31: new board

PATCH Superseded Jens Gehrlein 6 participants 34 messages Jul 4, 2008 – Jul 9, 2008

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover TQMA31: new board

Hi,

the following patches introduce the i.MX31 (ARM1136) based board TQMA31. Used toolchain was ELDK 4.1.

The first three patches fix some bugs in mxc/mx31 common parts. I compiled the im31_phycore, the imx31_litekit and the mx31ads U-Boots for this. But I don't have boards to test them.

Patch 04/10 cannot successfully be compiled without having Patch 03/10 applied.

Patch 03/10 has been on the mailing list in a similar form, but it seems that nobody picked it up. So I want give it a chance with my patch series.

Who will pick up this patch series (if there are no complaints)? Peter?

Kind regards,
Jens

---

Jens Gehrlein (10):
[ARM] TQMA31: new kernel param. to pass the eth MAC addr to the Linux eth chip driver [ARM] TQMA31: add FPGA configuration flash
[ARM] TQMA31: adjust pad property of IPU pin FPSHIFT for the display [ARM] TQMA31: adjust voltage regulators in PMIC MC13738
[ARM] TQMA31: add support for SPI and SPI device MC13783-RTC
[ARM] TQMA31: add support for I2C, I2C temperature sensor and I2C-EEPROM [ARM] TQMA31: add new board with i.MX31 processor
[ARM] MX31: fix typos in defines for UART and SPI IO multiplexer pins [ARM] MX31: fix bit masks in function mx31_decode_pll()
[ARM] MXC: insert bus busy check in i2c_probe

 MAINTAINERS                           |    4 
 MAKEALL                               |    1 
 Makefile                              |    3 
 board/imx31_litekit/imx31_litekit.c   |    2 
 board/imx31_phycore/imx31_phycore.c   |    4 
 board/mx31ads/mx31ads.c               |    2 
 board/tqc/tqma31/Makefile             |   48 ++++
 board/tqc/tqma31/config.mk            |    2 
 board/tqc/tqma31/lowlevel_init.S      |  375 +++++++++++++++++++++++++++++++++
 board/tqc/tqma31/tqma31.c             |  269 ++++++++++++++++++++++++
 board/tqc/tqma31/u-boot.lds           |   72 ++++++
 cpu/arm1136/mx31/generic.c            |   21 ++
 drivers/i2c/mxc_i2c.c                 |   23 ++
 include/asm-arm/arch-mx31/mx31-regs.h |   92 ++++++++
 include/asm-arm/arch-mx31/mx31.h      |    1 
 include/configs/TQMA31.h              |  337 ++++++++++++++++++++++++++++++
 16 files changed, 1248 insertions(+), 8 deletions(-)
 create mode 100644 board/tqc/tqma31/Makefile
 create mode 100644 board/tqc/tqma31/config.mk
 create mode 100644 board/tqc/tqma31/lowlevel_init.S
 create mode 100644 board/tqc/tqma31/tqma31.c
 create mode 100644 board/tqc/tqma31/u-boot.lds
 create mode 100644 include/configs/TQMA31.h
#1 lore raw

PATCH 1/10 MXC: insert bus busy check in i2c_probe

On fast CPUs the time between two chip queries can become too short to issue clear start and stop conditions. The bus seems to be blocked. This cannot be compensated by just waiting for completed byte transfer. The patch introduces polling of the bus busy bit in the I2C controller's status register before the next bus access is possible.

---

 drivers/i2c/mxc_i2c.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/i2c/mxc_i2c.c +10 -0
index a218329..6f9306f 100644
@@ -115,6 +115,16 @@ static int rx_byte(void)
 int i2c_probe(uchar chip)
 {
 	int ret;
+	int timeout = 100000;
+
+	/* Check if bus is busy before probing next chip */
+	while ((__REG16(I2C_BASE + I2SR) & I2SR_IBB) && --timeout)
+		udelay(1);
+
+	if (timeout == 0) {
+		printf ("\nerror: bus blocked\n");
+		return -1;
+	}
 
 	__REG16(I2C_BASE + I2CR) = 0; /* Reset module */
 	__REG16(I2C_BASE + I2CR) = I2CR_IEN;
#2 lore raw

PATCH 1/10 MXC: insert bus busy check in i2c_probe

Quoted 18 lines · Jens Gehrlein

On fast CPUs the time between two chip queries can become too short to issue clear start and stop conditions. The bus seems to be blocked. This cannot be compensated by just waiting for completed byte transfer. The patch introduces polling of the bus busy bit in the I2C controller's status register before the next bus access is possible.

---

 drivers/i2c/mxc_i2c.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/i2c/mxc_i2c.c +0 -0
index a218329..6f9306f 100644

drivers/i2c/mxc_i2c.c static int rx_byte(void) · line 118

Quoted 4 lines
drivers/i2c/mxc_i2c.c +1 -0
@@ -115,6 +115,16 @@ static int rx_byte(void)
 int i2c_probe(uchar chip)
 {
 	int ret;
+	int timeout = 100000;

Could you explain why 100000?

drivers/i2c/mxc_i2c.c static int rx_byte(void) · line 130

Quoted 12 lines
drivers/i2c/mxc_i2c.c +9 -0
+
+	/* Check if bus is busy before probing next chip */
+	while ((__REG16(I2C_BASE + I2SR) & I2SR_IBB) && --timeout)
+		udelay(1);
+
+	if (timeout == 0) {
+		printf ("\nerror: bus blocked\n");
+		return -1;
+	}
 
 	__REG16(I2C_BASE + I2CR) = 0; /* Reset module */
 	__REG16(I2C_BASE + I2CR) = I2CR_IEN;

Best Regards,
J.

#3 lore raw

PATCH 1/10 MXC: insert bus busy check in i2c_probe

Quoted 34 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 18 lines · Jens Gehrlein

On fast CPUs the time between two chip queries can become too short to issue clear start and stop conditions. The bus seems to be blocked. This cannot be compensated by just waiting for completed byte transfer. The patch introduces polling of the bus busy bit in the I2C controller's status register before the next bus access is possible.

---

 drivers/i2c/mxc_i2c.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/i2c/mxc_i2c.c +0 -0
index a218329..6f9306f 100644

drivers/i2c/mxc_i2c.c static int rx_byte(void) · line 118

Quoted 4 lines
drivers/i2c/mxc_i2c.c +1 -0
@@ -115,6 +115,16 @@ static int rx_byte(void)
 int i2c_probe(uchar chip)
 {
 	int ret;
+	int timeout = 100000;

Could you explain why 100000?

Quoted 10 lines
drivers/i2c/mxc_i2c.c +9 -0
+
+	/* Check if bus is busy before probing next chip */
+	while ((__REG16(I2C_BASE + I2SR) & I2SR_IBB) && --timeout)
+		udelay(1);
+
+	if (timeout == 0) {
+		printf ("\nerror: bus blocked\n");
+		return -1;
+	}
 
Quoted 2 lines

drivers/i2c/mxc_i2c.c static int rx_byte(void) · line 130

Quoted 2 lines
drivers/i2c/mxc_i2c.c +0 -0
 	__REG16(I2C_BASE + I2CR) = 0; /* Reset module */
 	__REG16(I2C_BASE + I2CR) = I2CR_IEN;

You are right. 100 ms is too high, although it should be irrelevant for a U-Boot command. Measurement showed, that some 100 microseconds would be enough. Do you agree if I set the timeout value to 1 ms? Other proposals?

Kind regards,
Jens

#4 lore raw

PATCH 1/10 MXC: insert bus busy check in i2c_probe

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

You are right. 100 ms is too high, although it should be irrelevant for a U-Boot command. Measurement showed, that some 100 microseconds would be enough. Do you agree if I set the timeout value to 1 ms? Other proposals?

Never say 100 ms is irrelevant for U-Boot. It's 100 ms of total boot time that you burn for nothing.

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
The price one pays for pursuing any profession,  or  calling,  is  an
intimate knowledge of its ugly side.                  - James Baldwin
#5 lore raw

PATCH 1/10 MXC: insert bus busy check in i2c_probe

Quoted 7 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:

You are right. 100 ms is too high, although it should be irrelevant for a U-Boot command. Measurement showed, that some 100 microseconds would be enough. Do you agree if I set the timeout value to 1 ms? Other proposals?

Never say 100 ms is irrelevant for U-Boot. It's 100 ms of total boot time that you burn for nothing.

If it was relevant for booting, you would be right. But this routine isn't executed at boot time. It's called by the iprobe command invoked by the user on the command line.

As I proposed, 1 ms should be sufficient.

Kind regards,
Jens

#6 lore raw

PATCH 2/10 MX31: fix bit masks in function mx31_decode_pll()

In reply to Jens Gehrlein

Bits MPCTL[MFN] and MPCTL[MFD] were not fully covered.

---

 cpu/arm1136/mx31/generic.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
cpu/arm1136/mx31/generic.c +2 -2
index 29c08c1..bf4c99c 100644
@@ -27,8 +27,8 @@
 static u32 mx31_decode_pll(u32 reg, u32 infreq)
 {
 	u32 mfi = (reg >> 10) & 0xf;
-	u32 mfn = reg & 0x3f;
-	u32 mfd = (reg >> 16) & 0x3f;
+	u32 mfn = reg & 0x3ff;
+	u32 mfd = (reg >> 16) & 0x3ff;
 	u32 pd =  (reg >> 26) & 0xf;
 
 	mfi = mfi <= 5 ? 5 : mfi;
#7 lore raw

PATCH 3/10 MX31: fix typos in defines for UART and SPI IO multiplexer pins

In reply to Jens Gehrlein

---

 board/imx31_litekit/imx31_litekit.c   |    2 +-
 board/imx31_phycore/imx31_phycore.c   |    4 ++--
 board/mx31ads/mx31ads.c               |    2 +-
 include/asm-arm/arch-mx31/mx31-regs.h |    4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)
board/imx31_litekit/imx31_litekit.c +1 -1
index 263dd9f..8cbc26e 100644
@@ -50,7 +50,7 @@ int board_init (void)
 	mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX);
 	mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX);
 	mx31_gpio_mux(MUX_RTS1__UART1_RTS_B);
-	mx31_gpio_mux(MUX_RTS1__UART1_CTS_B);
+	mx31_gpio_mux(MUX_CTS1__UART1_CTS_B);
 
 	/* SPI2 */
 	mx31_gpio_mux((MUX_CTL_FUNC << 8) | MUX_CTL_CSPI2_SS2);
board/imx31_phycore/imx31_phycore.c +2 -2
index 42ecb1e..ae93444 100644
@@ -54,11 +54,11 @@ int board_init (void)
 	mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX);
 	mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX);
 	mx31_gpio_mux(MUX_RTS1__UART1_RTS_B);
-	mx31_gpio_mux(MUX_RTS1__UART1_CTS_B);
+	mx31_gpio_mux(MUX_CTS1__UART1_CTS_B);
 
 	/* setup pins for I2C2 (for EEPROM, RTC) */
 	mx31_gpio_mux(MUX_CSPI2_MOSI__I2C2_SCL);
-	mx31_gpio_mux(MUX_CSPI2_MISO__I2C2_SCL);
+	mx31_gpio_mux(MUX_CSPI2_MISO__I2C2_SDA);
 
 	gd->bd->bi_arch_number = 447;		/* board id for linux */
 	gd->bd->bi_boot_params = (0x80000100);	/* adress of boot parameters */
board/mx31ads/mx31ads.c +1 -1
index dd0e150..b6928fc 100644
@@ -55,7 +55,7 @@ int board_init (void)
 	mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX);
 	mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX);
 	mx31_gpio_mux(MUX_RTS1__UART1_RTS_B);
-	mx31_gpio_mux(MUX_RTS1__UART1_CTS_B);
+	mx31_gpio_mux(MUX_CTS1__UART1_CTS_B);
 
 	/* SPI2 */
 	mx31_gpio_mux((MUX_CTL_FUNC << 8) | MUX_CTL_CSPI2_SS2);
include/asm-arm/arch-mx31/mx31-regs.h +2 -2
index 02b7dcb..abe61f0 100644
@@ -133,10 +133,10 @@
 #define MUX_RXD1__UART1_RXD_MUX	((MUX_CTL_FUNC << 8) | MUX_CTL_RXD1)
 #define MUX_TXD1__UART1_TXD_MUX	((MUX_CTL_FUNC << 8) | MUX_CTL_TXD1)
 #define MUX_RTS1__UART1_RTS_B	((MUX_CTL_FUNC << 8) | MUX_CTL_RTS1)
-#define MUX_RTS1__UART1_CTS_B	((MUX_CTL_FUNC << 8) | MUX_CTL_CTS1)
+#define MUX_CTS1__UART1_CTS_B	((MUX_CTL_FUNC << 8) | MUX_CTL_CTS1)
 
 #define MUX_CSPI2_MOSI__I2C2_SCL ((MUX_CTL_ALT1 << 8) | MUX_CTL_CSPI2_MOSI)
-#define MUX_CSPI2_MISO__I2C2_SCL ((MUX_CTL_ALT1 << 8) | MUX_CTL_CSPI2_MISO)
+#define MUX_CSPI2_MISO__I2C2_SDA ((MUX_CTL_ALT1 << 8) | MUX_CTL_CSPI2_MISO)
 
 /*
  * Memory regions and CS
#8 lore raw

PATCH 4/10 TQMA31: add new board with i.MX31 processor

In reply to Jens Gehrlein

---

 MAINTAINERS                           |    4 
 MAKEALL                               |    1 
 Makefile                              |    3 
 board/tqc/tqma31/Makefile             |   48 ++++
 board/tqc/tqma31/config.mk            |    2 
 board/tqc/tqma31/lowlevel_init.S      |  375 +++++++++++++++++++++++++++++++++
 board/tqc/tqma31/tqma31.c             |   95 ++++++++
 board/tqc/tqma31/u-boot.lds           |   72 ++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   42 ++++
 include/configs/TQMA31.h              |  271 ++++++++++++++++++++++++
 10 files changed, 913 insertions(+), 0 deletions(-)
 create mode 100644 board/tqc/tqma31/Makefile
 create mode 100644 board/tqc/tqma31/config.mk
 create mode 100644 board/tqc/tqma31/lowlevel_init.S
 create mode 100644 board/tqc/tqma31/tqma31.c
 create mode 100644 board/tqc/tqma31/u-boot.lds
 create mode 100644 include/configs/TQMA31.h
MAINTAINERS +4 -0
index a3d70b1..dff1757 100644
@@ -591,6 +591,10 @@ Michael Schwingen <[email protected]>
 	actux3			xscale
 	actux4			xscale
 
+Jens Gehrlein <[email protected]>
+
+	TQMA31			i.MX31
+
 #########################################################################
 # x86 Systems:								#
 #									#
MAKEALL +1 -0
index 32caab7..4e442c5 100755
@@ -524,6 +524,7 @@ LIST_ARM11="		\
 	imx31_litekit	\
 	imx31_phycore	\
 	mx31ads		\
+	TQMA31		\
 "
 
 #########################################################################
Makefile +3 -0
index 8bfc891..e3ade25 100644
@@ -2664,6 +2664,9 @@ imx31_phycore_config	: unconfig
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads NULL mx31
 
+TQMA31_config		: unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm1136 tqma31 tqc mx31
+
 #========================================================================
 # i386
 #========================================================================
board/tqc/tqma31/Makefile new file +48 -0

48 lines not on this page · raw message

board/tqc/tqma31/config.mk new file +2 -0
new file mode 100644
index 0000000..19df69e
@@ -0,0 +1,2 @@
+TEXT_BASE = 0x8ff00000
+
board/tqc/tqma31/lowlevel_init.S new file +375 -0

375 lines not on this page · raw message

board/tqc/tqma31/tqma31.c new file +95 -0

95 lines not on this page · raw message

board/tqc/tqma31/u-boot.lds new file +72 -0

72 lines not on this page · raw message

include/asm-arm/arch-mx31/mx31-regs.h +42 -0

53 lines not on this page · raw message

include/configs/TQMA31.h new file +271 -0

271 lines not on this page · raw message

#9 lore raw

PATCH 4/10 TQMA31: add new board with i.MX31 processor

Hi,

Quoted 55 lines · Jens Gehrlein
board/tqc/tqma31/lowlevel_init.S new file +49 -0
new file mode 100644
index 0000000..50db3a1
@@ -0,0 +1,375 @@
+/*
+ * Copyright (C) 2008, Guennadi Liakhovetski <[email protected]>
+ * Copyright (C) 2008, Jens Gehrlein <[email protected]>
+ *
+ * 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 <asm/arch/mx31-regs.h>
+#include <config.h>
+
+.macro REG reg, val
+	ldr r2, =\reg
+	ldr r3, =\val
+	str r3, [r2]
+.endm
+
+.macro REG8 reg, val
+	ldr r2, =\reg
+	ldr r3, =\val
+	strb r3, [r2]
+.endm
+
+.macro DELAY loops
+	ldr r2, =\loops
+1:
+	subs	r2, r2, #1
+	nop
+	bcs 1b
+.endm
+
+
+/*
+ * AIPS setup - Only setup MPROTx registers.
+ * The PACR default values are good.
+ */
+.macro init_aips

board/tqc/tqma31/lowlevel_init.S line 59

Quoted 10 lines
board/tqc/tqma31/lowlevel_init.S new file +10 -0
+
+	/* Setup the Peripheral Port Remap register inside the core */
+	ldr r0, =0x40000015        /* start from AIPS 2GB region */
+	mcr p15, 0, r0, c15, c2, 4
+
+	/*
+	 * Set all MPROTx to be non-bufferable, trusted for R/W,
+	 * not forced to user-mode.
+	 */
+	ldr r0, =0x43F00000

How about adding/using symbolic names for i.MX31 register addresses also in the init_aips, init_max, init_m3if and init_drive_strength macros? It helps readability IMO.

Regards, Magnus

#10 lore raw

PATCH 4/10 TQMA31: add new board with i.MX31 processor

In reply to Jens Gehrlein

Hi again

Quoted 35 lines
board/tqc/tqma31/Makefile new file +29 -0
new file mode 100644
index 0000000..ed403e8
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2008, Guennadi Liakhovetski <[email protected]>
+# Copyright (C) 2008, Jens Gehrlein <[email protected]>
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).a
+
+COBJS  := tqma31.o
+SOBJS  := lowlevel_init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))

board/tqc/tqma31/Makefile line 39

Quoted 10 lines
board/tqc/tqma31/Makefile new file +10 -0
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
+       $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend

The .depend file needs a $(obj)-prefix here (Wolfgang recenty corrected this in a number of Makefiles):
rm -f $(LIB) core *.bak $(obj).depend

Regards, Magnus

#11 lore raw

PATCH 4/10 TQMA31: add new board with i.MX31 processor

In reply to Jens Gehrlein

Hi Jens,

board/tqc/tqma31/tqma31.c line 60

Quoted 7 lines
board/tqc/tqma31/tqma31.c new file +7 -0
+int dram_init (void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+
+	return 0;
+}

Can't you use autodetection code like we do on many (hopefully most) PowerPC boards?

Cheers
Detlev

Signature · 6 lines
If we knew what it was we were doing, we wouldn't call it research.
                                            -- Einstein
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#12 lore raw

PATCH 4/10 TQMA31: add new board with i.MX31 processor

Hi Detlev,

Quoted 12 lines · Detlev Zundel

Hi Jens,

board/tqc/tqma31/tqma31.c line 60

Quoted 7 lines
board/tqc/tqma31/tqma31.c new file +7 -0
+int dram_init (void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+
+	return 0;
+}

Can't you use autodetection code like we do on many (hopefully most) PowerPC boards?

I wish I could, believe me. But for a nice C-routine I need a stack while running in flash. Unlike the PowerPC code, current U-Boot ARM code doesn't provide such mechanism. I think, the effort to provide it isn't little.

Kind regards,
Jens

#13 lore raw

PATCH 5/10 TQMA31: add support for I2C, I2C temperature sensor and I2C-EEPROM

In reply to Jens Gehrlein

---

 board/tqc/tqma31/tqma31.c             |    6 +++++
 cpu/arm1136/mx31/generic.c            |   17 ++++++++++++++
 drivers/i2c/mxc_i2c.c                 |   13 +++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   32 ++++++++++++++++++++++++++
 include/asm-arm/arch-mx31/mx31.h      |    1 +
 include/configs/TQMA31.h              |   40 +++++++++++++++++++++++++++++++++
 6 files changed, 109 insertions(+), 0 deletions(-)
board/tqc/tqma31/tqma31.c +6 -0
index 7cec8db..0c67af3 100644
@@ -49,6 +49,12 @@ static void setup_iomux (void)
 	mx31_gpio_mux (MUX_TXD1__UART1_TXD_MUX);
 	mx31_gpio_mux (MUX_RTS1__UART1_RTS_B);
 	mx31_gpio_mux (MUX_CTS1__UART1_CTS_B);
+
+	/* Pins for I2C1 */
+	mx31_gpio_mux (MUX_I2C_CLK__I2C1_SCL);
+	mx31_gpio_mux (MUX_I2C_DAT__I2C1_SDA);
+	mx31_pad_ctl (PAD_CTL_I2C_CLK, PAD_CTL_IPP_ODE_OD);
+	mx31_pad_ctl (PAD_CTL_I2C_DAT, PAD_CTL_IPP_ODE_OD);
 }
 
 int dram_init (void)
cpu/arm1136/mx31/generic.c +17 -0
index bf4c99c..9999e12 100644
@@ -90,6 +90,23 @@ void mx31_gpio_mux(unsigned long mode)
 	__REG(reg) = tmp;
 }
 
+void mx31_pad_ctl (u32 field, u32 val)
+{
+	u32 reg, shift, mask, tmp;
+
+	/* extract 32 bit register address and shifter for bit field */
+	reg = IOMUXC_BASE + (field >> 8);
+	shift = field & 0xFF;
+
+	/* field consists of 10 bits */
+	mask = 0x3FF << shift;
+
+	tmp = __REG(reg);
+	tmp &= ~mask;
+	tmp |= (val << shift) & mask;
+	__REG(reg) = tmp;
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo (void)
 {
drivers/i2c/mxc_i2c.c +13 -0
index 6f9306f..68d2720 100644
@@ -209,4 +209,17 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len)
 	return 0;
 }
 
+int i2c_get_bus_speed(void)
+{
+	return -1;
+}
+
+int i2c_set_bus_speed (unsigned int speed)
+{
+	if (speed != CFG_I2C_SPEED)
+		return -1;
+
+	return 0;
+}
+
 #endif /* CONFIG_HARD_I2C */
include/asm-arm/arch-mx31/mx31-regs.h +32 -0
index ea15108..c0e516f 100644
@@ -168,6 +168,9 @@
 #define MUX_CTL_CSPI2_SS2	0x87
 #define MUX_CTL_CSPI2_MOSI	0x8b
 
+#define MUX_CTL_I2C_CLK		0xa2
+#define MUX_CTL_I2C_DAT		0xa3
+
 /* The modes a specific pin can be in
  * these macros can be used in mx31_gpio_mux() and have the form
  * MUX_[contact name]__[pin function]
@@ -180,6 +183,35 @@
 #define MUX_CSPI2_MOSI__I2C2_SCL ((MUX_CTL_ALT1 << 8) | MUX_CTL_CSPI2_MOSI)
 #define MUX_CSPI2_MISO__I2C2_SDA ((MUX_CTL_ALT1 << 8) | MUX_CTL_CSPI2_MISO)
 
+#define MUX_I2C_CLK__I2C1_SCL	((MUX_CTL_FUNC << 8) | MUX_CTL_I2C_CLK)
+#define MUX_I2C_DAT__I2C1_SDA	((MUX_CTL_FUNC << 8) | MUX_CTL_I2C_DAT)
+
+/* bits in the SW_PAD_CTL registers */
+#define PAD_CTL_LOOPBACK_DIS		(0 << 9)
+#define PAD_CTL_LOOPBACK_ENA		(1 << 9)
+#define PAD_CTL_IPP_PUE_DIS		(0 << 7)
+#define PAD_CTL_IPP_PUE_KEEPER		(2 << 7)
+#define PAD_CTL_IPP_PUE_PULL		(3 << 7)
+#define PAD_CTL_IPP_PUS_100K_DN		(0 << 5)
+#define PAD_CTL_IPP_PUS_100K_UP		(1 << 5)
+#define PAD_CTL_IPP_HYS_STD		(0 << 4)
+#define PAD_CTL_IPP_HYS_SCHMITT		(1 << 4)
+#define PAD_CTL_IPP_ODE_STD		(0 << 3)
+#define PAD_CTL_IPP_ODE_OD		(1 << 3)
+#define PAD_CTL_IPP_DSE_STD		(0 << 1)
+#define PAD_CTL_IPP_DSE_HIGH		(1 << 1)
+#define PAD_CTL_IPP_DSE_MAX		(2 << 1)
+#define PAD_CTL_IPP_SRE_SLOW		(0 << 0)
+#define PAD_CTL_IPP_SRE_FAST		(1 << 0)
+
+/* bit fields in the SW_PAD_CTL registers, offsets based on IOMUXC_BASE */
+#define	PAD_CTL_IO1_SHIFT		0
+#define	PAD_CTL_IO2_SHIFT		10
+#define	PAD_CTL_IO3_SHIFT		20
+#define PAD_CTL_I2C_CLK			((0x21C << 8) | PAD_CTL_IO2_SHIFT)
+#define PAD_CTL_I2C_DAT			((0x21C << 8) | PAD_CTL_IO1_SHIFT)
+
+
 /*
  * Memory regions and CS
  */
include/asm-arm/arch-mx31/mx31.h +1 -0
index 0552c27..7b784e6 100644
@@ -26,5 +26,6 @@
 
 extern u32 mx31_get_ipg_clk(void);
 extern void mx31_gpio_mux(unsigned long mode);
+extern void mx31_pad_ctl (u32 field, u32 val);
 
 #endif /* __ASM_ARCH_MX31_H */
include/configs/TQMA31.h +40 -0
index 255355d..f96fd74 100644
@@ -154,6 +154,43 @@
 
 
 /*******************************************************************************
+ * I2C
+ ******************************************************************************/
+
+/* Use the processor internal controller */
+#define CONFIG_HARD_I2C
+#define CONFIG_I2C_MXC
+
+/* Configure I2C1 */
+#define CFG_I2C_MX31_PORT1
+
+#define CFG_I2C_SPEED 			100000
+#define CFG_I2C_SLAVE 			0
+
+/* Don't probe these addrs */
+#define CFG_I2C_NOPROBES		{0x00}
+
+/* I2C EEPROM, configuration for onboard EEPROM */
+#define CFG_I2C_EEPROM_ADDR		0x50
+#define CFG_I2C_EEPROM_ADDR_LEN		2
+
+/* 32 bytes per write */
+#define CFG_EEPROM_PAGE_WRITE_BITS	5
+
+#define CFG_EEPROM_PAGE_WRITE_ENABLE
+
+/* 10ms +/- 20% */
+#define CFG_EEPROM_PAGE_WRITE_DELAY_MS	12
+
+/* I2C SYSMON (LM75) */
+#define CONFIG_DTT_LM75			1	/* ON Semi's LM75 */
+#define CONFIG_DTT_SENSORS		{0}	/* Sensor addresses */
+#define CFG_DTT_MAX_TEMP		70
+#define CFG_DTT_LOW_TEMP		-30
+#define CFG_DTT_HYSTERESIS		3
+
+
+/*******************************************************************************
  * Commands
  ******************************************************************************/
 
@@ -161,6 +198,9 @@
 
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_DTT
+#define CONFIG_CMD_EEPROM
 
 
 /*******************************************************************************
#14 lore raw

PATCH 5/10 TQMA31: add support for I2C, I2C temperature sensor and I2C-EEPROM

Quoted 13 lines

#if defined(CONFIG_DISPLAY_CPUINFO)
int print_cpuinfo (void)
{

drivers/i2c/mxc_i2c.c +2 -0
index 6f9306f..68d2720 100644
@@ -209,4 +209,17 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len)
 	return 0;
 }
 
+int i2c_get_bus_speed(void)
+{

drivers/i2c/mxc_i2c.c int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len) · line 223

Quoted 10 lines
drivers/i2c/mxc_i2c.c +10 -0
+	return -1;
+}
+
+int i2c_set_bus_speed (unsigned int speed)
+{
+	if (speed != CFG_I2C_SPEED)
+		return -1;
+
+	return 0;
+}

why do you refuse to change the i2c bus speed?

Quoted 22 lines
drivers/i2c/mxc_i2c.c +1 -0
+
 #endif /* CONFIG_HARD_I2C */
include/asm-arm/arch-mx31/mx31-regs.h +1 -0
index ea15108..c0e516f 100644
@@ -168,6 +168,9 @@
 
 extern u32 mx31_get_ipg_clk(void);
 extern void mx31_gpio_mux(unsigned long mode);
+extern void mx31_pad_ctl (u32 field, u32 val);
 
 #endif /* __ASM_ARCH_MX31_H */
include/configs/TQMA31.h +1 -0
index 255355d..f96fd74 100644
@@ -154,6 +154,43 @@
 
 
 /*******************************************************************************
+ * I2C

include/configs/TQMA31.h line 167

Quoted 10 lines
include/configs/TQMA31.h +10 -0
+ ******************************************************************************/
+
+/* Use the processor internal controller */
+#define CONFIG_HARD_I2C
+#define CONFIG_I2C_MXC
+
+/* Configure I2C1 */
+#define CFG_I2C_MX31_PORT1
+
+#define CFG_I2C_SPEED 			100000

please use tab instead of whitespace

include/configs/TQMA31.h line 168

Quoted 1 line
include/configs/TQMA31.h +1 -0
+#define CFG_I2C_SLAVE 			0

please use tab instead of whitespace

include/configs/TQMA31.h line 172

Quoted 4 lines
include/configs/TQMA31.h +4 -0
+
+/* Don't probe these addrs */
+#define CFG_I2C_NOPROBES		{0x00}
+

Best Regards,
J.

#15 lore raw

PATCH 5/10 TQMA31: add support for I2C, I2C temperature sensor and I2C-EEPROM

Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines

#if defined(CONFIG_DISPLAY_CPUINFO)
int print_cpuinfo (void)
{

drivers/i2c/mxc_i2c.c +0 -0
index 6f9306f..68d2720 100644
@@ -209,4 +209,17 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len)
 	return 0;
 }
 
Quoted 13 lines

drivers/i2c/mxc_i2c.c int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len) · line 223

Quoted 12 lines
drivers/i2c/mxc_i2c.c +12 -0
+int i2c_get_bus_speed(void)
+{
+	return -1;
+}
+
+int i2c_set_bus_speed (unsigned int speed)
+{
+	if (speed != CFG_I2C_SPEED)
+		return -1;
+
+	return 0;
+}

why do you refuse to change the i2c bus speed?

Those two routines were missing at all before I started the board BSP. I just added them to compile the U-Boot successfully. Or did I miss something (e.g. overlaying-of-functions-technique or so)?
I copied the source code from another driver (can't remember from where). It's no real excuse, I know.
So, shall I change it or can I leave it for now?

Quoted 4 lines

drivers/i2c/mxc_i2c.c int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len) · line 224

Quoted 1 line
drivers/i2c/mxc_i2c.c +1 -0
+#define CFG_I2C_SPEED 			100000

please use tab instead of whitespace

drivers/i2c/mxc_i2c.c int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len) · line 225

Quoted 1 line
drivers/i2c/mxc_i2c.c +1 -0
+#define CFG_I2C_SLAVE 			0

please use tab instead of whitespace

Will do. Thank you.

Kind regards,
Jens

#16 lore raw

PATCH 6/10 TQMA31: add support for SPI and SPI device MC13783-RTC

In reply to Jens Gehrlein

---

 board/tqc/tqma31/tqma31.c             |   13 +++++++++++++
 include/asm-arm/arch-mx31/mx31-regs.h |   12 ++++++++++++
 include/configs/TQMA31.h              |   20 ++++++++++++++++++++
 3 files changed, 45 insertions(+), 0 deletions(-)
board/tqc/tqma31/tqma31.c +13 -0
index 0c67af3..c704c41 100644
@@ -55,6 +55,19 @@ static void setup_iomux (void)
 	mx31_gpio_mux (MUX_I2C_DAT__I2C1_SDA);
 	mx31_pad_ctl (PAD_CTL_I2C_CLK, PAD_CTL_IPP_ODE_OD);
 	mx31_pad_ctl (PAD_CTL_I2C_DAT, PAD_CTL_IPP_ODE_OD);
+
+	/* Pins for SPI2 */
+	mx31_gpio_mux (MUX_CSPI2_MOSI__CSPI2_MOSI);
+	mx31_gpio_mux (MUX_CSPI2_MISO__CSPI2_MISO);
+	mx31_gpio_mux (MUX_CSPI2_SS0__CSPI2_SS0_B);
+	mx31_gpio_mux (MUX_CSPI2_SCLK__CSPI2_CLK);
+	mx31_pad_ctl (PAD_CTL_CSPI2_SS0, 0);
+	mx31_pad_ctl (PAD_CTL_CSPI2_SS1, 0);
+	mx31_pad_ctl (PAD_CTL_CSPI2_SS2, 0);
+	mx31_pad_ctl (PAD_CTL_CSPI2_SCLK, 0);
+	mx31_pad_ctl (PAD_CTL_CSPI2_SPI_RDY, 0);
+	mx31_pad_ctl (PAD_CTL_CSPI2_MISO, 0);
+	mx31_pad_ctl (PAD_CTL_CSPI2_MOSI, 0);
 }
 
 int dram_init (void)
include/asm-arm/arch-mx31/mx31-regs.h +12 -0
index c0e516f..4d661e8 100644
@@ -183,6 +183,11 @@
 #define MUX_CSPI2_MOSI__I2C2_SCL ((MUX_CTL_ALT1 << 8) | MUX_CTL_CSPI2_MOSI)
 #define MUX_CSPI2_MISO__I2C2_SDA ((MUX_CTL_ALT1 << 8) | MUX_CTL_CSPI2_MISO)
 
+#define MUX_CSPI2_MOSI__CSPI2_MOSI ((MUX_CTL_FUNC << 8) | MUX_CTL_CSPI2_MOSI)
+#define MUX_CSPI2_MISO__CSPI2_MISO ((MUX_CTL_FUNC << 8) | MUX_CTL_CSPI2_MISO)
+#define MUX_CSPI2_SS0__CSPI2_SS0_B ((MUX_CTL_FUNC << 8) | MUX_CTL_CSPI2_SS0)
+#define MUX_CSPI2_SCLK__CSPI2_CLK  ((MUX_CTL_FUNC << 8) | MUX_CTL_CSPI2_SCLK)
+
 #define MUX_I2C_CLK__I2C1_SCL	((MUX_CTL_FUNC << 8) | MUX_CTL_I2C_CLK)
 #define MUX_I2C_DAT__I2C1_SDA	((MUX_CTL_FUNC << 8) | MUX_CTL_I2C_DAT)
 
@@ -208,6 +213,13 @@
 #define	PAD_CTL_IO1_SHIFT		0
 #define	PAD_CTL_IO2_SHIFT		10
 #define	PAD_CTL_IO3_SHIFT		20
+#define PAD_CTL_CSPI2_SS2		((0x1F4 << 8) | PAD_CTL_IO3_SHIFT)
+#define PAD_CTL_CSPI2_SCLK		((0x1F4 << 8) | PAD_CTL_IO2_SHIFT)
+#define PAD_CTL_CSPI2_SPI_RDY		((0x1F4 << 8) | PAD_CTL_IO1_SHIFT)
+#define PAD_CTL_CSPI2_MISO		((0x1F8 << 8) | PAD_CTL_IO3_SHIFT)
+#define PAD_CTL_CSPI2_SS0		((0x1F8 << 8) | PAD_CTL_IO2_SHIFT)
+#define PAD_CTL_CSPI2_SS1		((0x1F8 << 8) | PAD_CTL_IO1_SHIFT)
+#define PAD_CTL_CSPI2_MOSI		((0x1FC << 8) | PAD_CTL_IO1_SHIFT)
 #define PAD_CTL_I2C_CLK			((0x21C << 8) | PAD_CTL_IO2_SHIFT)
 #define PAD_CTL_I2C_DAT			((0x21C << 8) | PAD_CTL_IO1_SHIFT)
 
include/configs/TQMA31.h +20 -0
index f96fd74..ac81a32 100644
@@ -191,6 +191,24 @@
 
 
 /*******************************************************************************
+ * SPI
+ ******************************************************************************/
+
+/* Use the processor internal controller */
+#define CONFIG_HARD_SPI			1
+#define CONFIG_MXC_SPI			1
+
+/* 0=CSPI1, 1=CSPI2, 2=CSPI3 */
+#define CONFIG_DEFAULT_SPI_BUS		1
+
+/* SCLK polarity: high; chipselect: active high */
+#define CONFIG_DEFAULT_SPI_MODE		(SPI_MODE_2 | SPI_CS_HIGH)
+
+/* Add PMIC RTC driver */
+#define CONFIG_RTC_MC13783		1
+
+
+/*******************************************************************************
  * Commands
  ******************************************************************************/
 
@@ -201,6 +219,8 @@
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_DTT
 #define CONFIG_CMD_EEPROM
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_DATE
 
 
 /*******************************************************************************
#17 lore raw

PATCH 7/10 TQMA31: adjust voltage regulators in PMIC MC13738

In reply to Jens Gehrlein
VRFDIG: 1.875 V -> 1.8 V
VGEN:   1.5 V -> 1.8 V
VDIG:   1.5 V -> 1.3 V

Unused PMIC switchers and regulators are disabled

---

 board/tqc/tqma31/tqma31.c |  142 +++++++++++++++++++++++++++++++++++++++++++++
 include/configs/TQMA31.h  |    2 +
 2 files changed, 144 insertions(+), 0 deletions(-)
board/tqc/tqma31/tqma31.c +142 -0
index c704c41..abb8db0 100644
@@ -22,6 +22,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <spi.h>
 #include <asm/arch/mx31.h>
 #include <asm/arch/mx31-regs.h>
 
@@ -70,6 +71,132 @@ static void setup_iomux (void)
 	mx31_pad_ctl (PAD_CTL_CSPI2_MOSI, 0);
 }
 
+static int adjust_voltages (void)
+{
+	u32 reg;
+	u32 val;
+	static struct spi_slave *slave = NULL;
+
+	slave = spi_setup_slave(1, 0, 1000000,
+		SPI_MODE_2 | SPI_CS_HIGH);
+	if (!slave)
+		return -1;
+
+	if (spi_claim_bus(slave))
+		return -1;
+
+	/* Set PMIC arbitration switchers */
+	val = 0x000020;
+	reg = 0x14000000 | val | 0x80000000;
+	if (spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&val,
+		SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	/* Set PMIC regulator enable to 0x0 */
+	val = 0x000000;
+	reg = 0x20000000 | val | 0x80000000;
+	if (spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&val,
+		SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	/*
+	 * Set PMIC regulator setting 0
+	 *	VRFDIG = 1,8V / reset value = 1,875V
+	 *	VGEN   = 1,8V / reset value = 1,5V
+	 *	VDIG   = 1,3V / reset value = 1,5V
+	 */
+	val = 0x63cdc;
+	reg = 0x3c000000 | val | 0x80000000;
+	if (spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&val,
+		SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	/*
+	 * Set PMIC regulator mode 0 to 0x24924
+	 *	VAUDIO	= on
+	 *	VIOH	= off
+	 *	VIOLO	= on
+	 *	VDIG	= on
+	 *	VGEN	= on
+	 *	VRFDIG	= on
+	 *	VRFREF	= on
+	 *	VRFCP	= on
+	 */
+	val = 0x249241;
+	reg = 0x40000000 | val | 0x80000000;
+	if (spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&val,
+		SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	/*
+	 * Set PMIC regulator mode 1 to 0x0
+	 *	VSIM	= off
+	 *	VESIM	= off
+	 *	VCAM	= off
+	 *	VRFBG	= off
+	 *	VVIB	= off
+	 *	VRF1	= off
+	 *	VRF2	= off
+	 *	VMMC1	= off
+	 *	VMMC2	= off
+	 */
+	val = 0x0;
+	reg = 0x42000000 | val | 0x80000000;
+	if (spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&val,
+		SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	/*
+	 * FIXME: switcher settings 0 and 1.
+	 * Kernel hangs when unpacking itself.
+	 * Workaround:
+	 * Up to now CPU can operate at maximum allowed voltage 1.6 V.
+	 */
+	/*
+	 * Set PMIC switcher setting 0
+	 *	SW1A     = 1,2V / reset value = 1,6V
+	 *	SW1ADVS  = 1,6V / reset value = 1,6V
+	 *	SW1ASTBY = 1,2V / reset value = 1,6V
+	 */
+	/*
+	val = 0xc70c;
+	reg = 0x30000000 | val | 0x80000000;
+	if (spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&val,
+		SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+	*/
+
+	/*
+	 * Set PMIC switcher setting 1
+	 *	SW1A     = 1,2V / reset value = 1,6V
+	 *	SW1ADVS  = 1,6V / reset value = 1,6V
+	 *	SW1ASTBY = 1,2V / reset value = 1,6V
+	 */
+	/*
+	val = 0xc70c;
+	reg = 0x32000000 | val | 0x80000000;
+	if (spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&val,
+		SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+	*/
+
+	/*
+	 * Set PMIC switcher setting 5
+	 *	SW5 = 5V
+	 *	SW5 = off
+	 */
+	val = 0x021605;
+	reg = 0x3A000000 | val | 0x80000000;
+	if (spi_xfer(slave, 32, (uchar *)&reg, (uchar *)&val,
+		SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	spi_release_bus(slave);
+	spi_free_slave(slave);
+
+	return 0;
+}
+
 int dram_init (void)
 {
 	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
@@ -112,3 +239,18 @@ int checkboard (void)
 	printf ("Board: TQMA31\n");
 	return 0;
 }
+
+int board_late_init(void)
+{
+	/*
+	 * Must call this function in late init stage, because the SPI driver,
+	 * required by this function, uses malloc(). The malloc space has not
+	 * been setup in the board_init() stage.
+	 */
+	if (adjust_voltages ()) {
+		printf ("Adjusting voltages failed!\n");
+		return -1;
+	}
+	return 0;
+}
+
include/configs/TQMA31.h +2 -0
index ac81a32..a174940 100644
@@ -299,6 +299,8 @@
  * Miscellaneous
  ******************************************************************************/
 
+#define BOARD_LATE_INIT
+
 /* Total available space for malloc in bytes */
 #define CFG_MALLOC_LEN			(CFG_ENV_SIZE + 128 * 1024)
 
#18 lore raw

PATCH 7/10 TQMA31: adjust voltage regulators in PMIC MC13738

Hi,

Quoted 7 lines · Jens Gehrlein
board/tqc/tqma31/tqma31.c +7 -0
+static int adjust_voltages (void)
+{
+	u32 reg;
+	u32 val;
+	static struct spi_slave *slave = NULL;
+
+	slave = spi_setup_slave(1, 0, 1000000,

board/tqc/tqma31/tqma31.c static void setup_iomux (void) · line 90

Quoted 10 lines
board/tqc/tqma31/tqma31.c +10 -0
+		SPI_MODE_2 | SPI_CS_HIGH);
+	if (!slave)
+		return -1;
+
+	if (spi_claim_bus(slave))
+		return -1;
+
+	/* Set PMIC arbitration switchers */
+	val = 0x000020;
+	reg = 0x14000000 | val | 0x80000000;

It seems like it's time to create a MC13783 header file containing some helper macros and symbolic names to the 13783's registers so we can write:
reg = MC13783_READ_CMD(MC_REG_FOO);
...
val = something_symbolic | something_symbolic2;
reg = MC13783_WRITE_CMD(MC_REG_FOO, val);
...
etc..

Also, I'm pretty sure some other i.MX31 boards could benefit from changing some voltages in U-boot so perhaps we could have a mc13783-reg.c (-reg as in regulators) file containing stuff like mc13783_set_regulator(MC_VRFDIG, VRFDIG_1V8)?

board/tqc/tqma31/tqma31.c static void setup_iomux (void) · line 154

Quoted 6 lines
board/tqc/tqma31/tqma31.c +6 -0
+	/*
+	 * FIXME: switcher settings 0 and 1.
+	 * Kernel hangs when unpacking itself.
+	 * Workaround:
+	 * Up to now CPU can operate at maximum allowed voltage 1.6 V.
+	 */

I suppose you know that 1.6V is only needed if the CPU is clocked at 532MHz, if it's clocked at 399MHz it can be supplied with 1.2V.

Regards, Magnus

#19 lore raw

PATCH 7/10 TQMA31: adjust voltage regulators in PMIC MC13738

Hi Magnus,

Quoted 30 lines · Magnus Lilja

Hi,

Quoted 7 lines · Jens Gehrlein
board/tqc/tqma31/tqma31.c +7 -0
+static int adjust_voltages (void)
+{
+	u32 reg;
+	u32 val;
+	static struct spi_slave *slave = NULL;
+
+	slave = spi_setup_slave(1, 0, 1000000,

board/tqc/tqma31/tqma31.c static void setup_iomux (void) · line 90

Quoted 10 lines
board/tqc/tqma31/tqma31.c +10 -0
+		SPI_MODE_2 | SPI_CS_HIGH);
+	if (!slave)
+		return -1;
+
+	if (spi_claim_bus(slave))
+		return -1;
+
+	/* Set PMIC arbitration switchers */
+	val = 0x000020;
+	reg = 0x14000000 | val | 0x80000000;

It seems like it's time to create a MC13783 header file containing some helper macros and symbolic names to the 13783's registers so we can write:
reg = MC13783_READ_CMD(MC_REG_FOO);
...
val = something_symbolic | something_symbolic2;
reg = MC13783_WRITE_CMD(MC_REG_FOO, val);
...
etc..

Quoted 1 line

Also, I'm pretty sure some other i.MX31 boards could benefit from changing some voltages in U-boot so perhaps we could have a mc13783-reg.c (-reg as in regulators) file containing stuff like mc13783_set_regulator(MC_VRFDIG, VRFDIG_1V8)?

Basically, I agree. But would you accept the current patch for now? The new routines and macros later could be implemented later.

Kind regards,
Jens

#20 lore raw

PATCH 7/10 TQMA31: adjust voltage regulators in PMIC MC13738

Hi Jens,

Quoted 36 lines · Jens Gehrlein

Hi Magnus,

Quoted 33 lines · Magnus Lilja

Hi,

Quoted 8 lines · Jens Gehrlein
board/tqc/tqma31/tqma31.c +7 -0
+static int adjust_voltages (void)
+{
+       u32 reg;
+       u32 val;
+       static struct spi_slave *slave = NULL;
+
+       slave = spi_setup_slave(1, 0, 1000000,

board/tqc/tqma31/tqma31.c static void setup_iomux (void) · line 90

Quoted 10 lines
board/tqc/tqma31/tqma31.c +10 -0
+               SPI_MODE_2 | SPI_CS_HIGH);
+       if (!slave)
+               return -1;
+
+       if (spi_claim_bus(slave))
+               return -1;
+
+       /* Set PMIC arbitration switchers */
+       val = 0x000020;
+       reg = 0x14000000 | val | 0x80000000;

It seems like it's time to create a MC13783 header file containing some helper macros and symbolic names to the 13783's registers so we can write:
reg = MC13783_READ_CMD(MC_REG_FOO);
...
val = something_symbolic | something_symbolic2;
reg = MC13783_WRITE_CMD(MC_REG_FOO, val);
...
etc..

Quoted 7 lines
Quoted 4 lines

Also, I'm pretty sure some other i.MX31 boards could benefit from changing some voltages in U-boot so perhaps we could have a mc13783-reg.c (-reg as in regulators) file containing stuff like mc13783_set_regulator(MC_VRFDIG, VRFDIG_1V8)?

Basically, I agree. But would you accept the current patch for now? The new routines and macros later could be implemented later.

I don't think it's up to me to ACK or NAK this, but I can accept the current patch.

Regards, Magnus Lilja

#21 lore raw

PATCH 7/10 TQMA31: adjust voltage regulators in PMIC MC13738

Hi Magnus and Jens,

Quoted 5 lines
Quoted 2 lines

Basically, I agree. But would you accept the current patch for now? The new routines and macros later could be implemented later.

I don't think it's up to me to ACK or NAK this, but I can accept the current patch.

Yes, this decision is up to the custodian. But lets be honest here, we all know what "we can implement this later" means.

We really need to fix problems as they arise. Especially in this case I don't think that it is such a significant effort to fix it now. Fixing it later will only need even more effort.

Usually this effort(t-[detection time]) is an exponential function and I am not kidding on this.

Cheers
Detlev

Signature · 5 lines
Among the  -) the .-) is king
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#22 lore raw

PATCH 7/10 TQMA31: adjust voltage regulators in PMIC MC13738

Quoted 11 lines · Detlev Zundel

Hi Magnus and Jens,

Quoted 5 lines
Quoted 2 lines

Basically, I agree. But would you accept the current patch for now? The new routines and macros later could be implemented later.

I don't think it's up to me to ACK or NAK this, but I can accept the current patch.

Yes, this decision is up to the custodian. But lets be honest here, we all know what "we can implement this later" means.

Quoted 6 lines

We really need to fix problems as they arise. Especially in this case I don't think that it is such a significant effort to fix it now. Fixing it later will only need even more effort.

Usually this effort(t-[detection time]) is an exponential function and I am not kidding on this.

I fully agree with you.

We need to fix this and not use a workaround which will became the status quo.

Best Regards,
J.

#23 lore raw

PATCH 8/10 TQMA31: adjust pad property of IPU pin FPSHIFT for the display

In reply to Jens Gehrlein

---

 board/tqc/tqma31/tqma31.c             |    7 +++++++
 include/asm-arm/arch-mx31/mx31-regs.h |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)
board/tqc/tqma31/tqma31.c +7 -0
index abb8db0..dd2bb0a 100644
@@ -69,6 +69,13 @@ static void setup_iomux (void)
 	mx31_pad_ctl (PAD_CTL_CSPI2_SPI_RDY, 0);
 	mx31_pad_ctl (PAD_CTL_CSPI2_MISO, 0);
 	mx31_pad_ctl (PAD_CTL_CSPI2_MOSI, 0);
+
+	/* Pins for IPU */
+	mx31_pad_ctl (PAD_CTL_FPSHIFT, PAD_CTL_IPP_PUE_PULL \
+					| PAD_CTL_IPP_PUS_100K_DN \
+					| PAD_CTL_IPP_HYS_STD \
+					| PAD_CTL_IPP_ODE_STD \
+					| PAD_CTL_IPP_SRE_FAST);
 }
 
 static int adjust_voltages (void)
include/asm-arm/arch-mx31/mx31-regs.h +1 -0
index 4d661e8..407b2c6 100644
@@ -213,6 +213,7 @@
 #define	PAD_CTL_IO1_SHIFT		0
 #define	PAD_CTL_IO2_SHIFT		10
 #define	PAD_CTL_IO3_SHIFT		20
+#define PAD_CTL_FPSHIFT			((0x184 << 8) | PAD_CTL_IO1_SHIFT)
 #define PAD_CTL_CSPI2_SS2		((0x1F4 << 8) | PAD_CTL_IO3_SHIFT)
 #define PAD_CTL_CSPI2_SCLK		((0x1F4 << 8) | PAD_CTL_IO2_SHIFT)
 #define PAD_CTL_CSPI2_SPI_RDY		((0x1F4 << 8) | PAD_CTL_IO1_SHIFT)
#24 lore raw

PATCH 9/10 TQMA31: add FPGA configuration flash

In reply to Jens Gehrlein

---

 board/tqc/tqma31/tqma31.c             |    6 ++++++
 include/asm-arm/arch-mx31/mx31-regs.h |    1 +
 include/configs/TQMA31.h              |    7 +++++--
 3 files changed, 12 insertions(+), 2 deletions(-)
board/tqc/tqma31/tqma31.c +6 -0
index dd2bb0a..30584fe 100644
@@ -36,6 +36,12 @@ static void setup_chipselects (void)
 	__REG (CSCR_L(0)) = CSCR_L_OEA_10 | CSCR_L_EBWA_3 | CSCR_L_EBWN_3 \
 		| CSCR_L_EBC_ONLY_WA | CSCR_L_DSZ_16_MUM0 | CSCR_L_CSEN;
 
+	/* FPGA configuration flash on CS1 */
+	__REG (CSCR_U(1)) = CSCR_U_CNC_3 | CSCR_U_WSC_13 | CSCR_U_EDC_4;
+	__REG (CSCR_A(1)) = CSCR_A_RWA_2 | CSCR_A_RWN_2 | CSCR_A_LBN_2_MUM0;
+	__REG (CSCR_L(1)) = CSCR_L_OEA_10 | CSCR_L_EBWA_3 | CSCR_L_EBWN_3 \
+		| CSCR_L_EBC_ONLY_WA | CSCR_L_DSZ_16_MUM0 | CSCR_L_CSEN;
+
 	/* Ethernet controller on CS4 */
 	__REG (CSCR_U(4)) = CSCR_U_CNC_1 | CSCR_U_WSC_22 | CSCR_U_EDC_4;
 	__REG (CSCR_A(4)) = CSCR_A_RWA_2 | CSCR_A_RWN_15;
include/asm-arm/arch-mx31/mx31-regs.h +1 -0
index 407b2c6..69d7614 100644
@@ -84,6 +84,7 @@
 #define CSCR_U_WSC_9		0x00000900
 #define CSCR_U_WSC_12		0x00000C00
 #define CSCR_U_WSC_22		0x00001600
+#define CSCR_U_WSC_13		0x00000D00
 #define CSCR_U_EDC_4		0x00000004
 #define CSCR_U_EDC_13		0x0000000D
 
include/configs/TQMA31.h +5 -2
index a174940..504cb57 100644
@@ -89,18 +89,21 @@
 #define CFG_FLASH_BASE			CS0_BASE
 
 /* Max number of memory banks */
-#define CFG_MAX_FLASH_BANKS		4
+#define CFG_MAX_FLASH_BANKS		5
 
 /*
  * Bank start addresses.
  * 4 x 32 MiB is the maximum for user and U-Boot code. Please adapt the list
  * as well as CFG_MAX_FLASH_BANKS to your TQM. Also consider dual die chips
  * or single die chips, e.g. one dual die chip represents two banks.
+ * The fifth bank is a separate chip for the FPGA configuration. It's
+ * controlled by chipselect 1.
  */
 #define CFG_FLASH_BANKS_LIST		{CFG_FLASH_BASE, 		\
 					CFG_FLASH_BASE + 32*1024*1024,	\
 					CFG_FLASH_BASE + 64*1024*1024,	\
-					CFG_FLASH_BASE + 96*1024*1024}
+					CFG_FLASH_BASE + 96*1024*1024,  \
+					CS1_BASE}
 
 /* Max number of sectors on one chip */
 #define CFG_MAX_FLASH_SECT		259
#25 lore raw

PATCH 9/10 TQMA31: add FPGA configuration flash

Quoted 8 lines

/*
* Bank start addresses.
* 4 x 32 MiB is the maximum for user and U-Boot code. Please adapt the list
* as well as CFG_MAX_FLASH_BANKS to your TQM. Also consider dual die chips
* or single die chips, e.g. one dual die chip represents two banks.
+ * The fifth bank is a separate chip for the FPGA configuration. It's
+ * controlled by chipselect 1.
*/

same commnets as patch 04

include/configs/TQMA31.h line 109

Quoted 10 lines

#define CFG_FLASH_BANKS_LIST {CFG_FLASH_BASE, \

include/configs/TQMA31.h +2 -1
 					CFG_FLASH_BASE + 32*1024*1024,	\
 					CFG_FLASH_BASE + 64*1024*1024,	\
-					CFG_FLASH_BASE + 96*1024*1024}
+					CFG_FLASH_BASE + 96*1024*1024,  \
+					CS1_BASE}
 
 /* Max number of sectors on one chip */
 #define CFG_MAX_FLASH_SECT		259

Best Regards,
J.

#26 lore raw

PATCH 10/10 TQMA31: new kernel param. to pass the eth MAC addr to the Linux eth chip driver

In reply to Jens Gehrlein

Some Linux drivers like the smc911x driver, as used on TQMA31, rely on the MAC address in the appropriate register, but U-Boot resets the controller after every transfer. A patch for the Linux driver is necessary to extract the MAC address from the kernel boot parameter line and set the MAC address register accordingly.
This patch adds the paramater "ethaddr" to the U-Boot default environment so that the user cannot forget it.

---

 include/configs/TQMA31.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/TQMA31.h +1 -0
index 504cb57..e9e5d78 100644
@@ -275,6 +275,7 @@
 		"jtag=on "						\
 		"console=ttymxc0,115200\0"				\
 	"bootargs_nfs=setenv bootargs ${bootargs} "			\
+		"ethaddr=${ethaddr} "				        \
 		"root=/dev/nfs "					\
 		"ip=${ipaddr}:${serverip}:${gatewayip}:"		\
 			"${netmask}:${hostname}:${netdev}:off "		\
#27 lore raw

PATCH 10/10 TQMA31: new kernel param. to pass the eth MAC addr to the Linux eth chip driver

Quoted 19 lines · Jens Gehrlein

Some Linux drivers like the smc911x driver, as used on TQMA31, rely on the MAC address in the appropriate register, but U-Boot resets the controller after every transfer. A patch for the Linux driver is necessary to extract the MAC address from the kernel boot parameter line and set the MAC address register accordingly.
This patch adds the paramater "ethaddr" to the U-Boot default environment so that the user cannot forget it.

---

 include/configs/TQMA31.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/TQMA31.h +0 -0
index 504cb57..e9e5d78 100644

include/configs/TQMA31.h line 278

Quoted 4 lines
include/configs/TQMA31.h +1 -0
@@ -275,6 +275,7 @@
 		"jtag=on "						\
 		"console=ttymxc0,115200\0"				\
 	"bootargs_nfs=setenv bootargs ${bootargs} "			\
+		"ethaddr=${ethaddr} "				        \

why don't you use nwhwconf parameter?

Best Regards,
J.

#28 lore raw

PATCH 10/10 TQMA31: new kernel param. to pass the eth MAC addr to the Linux eth chip driver

Hi Jean-Christophe,

Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

why don't you use nwhwconf parameter?

Thank you for response.
I found some U-Boot examples how to pass this parameter. But were can I find Linux related information? nwhwconf is new to me. I have never heard before.
I use Kernel 2.6.22-6 from the LTIB for mx31ads.

Kind regards,
Jens

#29 lore raw

cover TQMA31: new board

In reply to Jens Gehrlein
Quoted 1 line · Jens Gehrlein

Who will pick up this patch series (if there are no complaints)? Peter?

Of course, we could put them into the TQ custodian tree. Awkward, that I forgot this.

Kind regards,
Jens

#30 lore raw

cover TQMA31: new board

Quoted 10 lines

-----Original Message-----
From: u-boot-users-bounces at lists.sourceforge.net [mailto:u-boot-users-bounces at lists.sourceforge.net] On Behalf Of Jens Gehrlein
Sent: 04 July 2008 16:02
To: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] [PATCH 00/10] [ARM] TQMA31: new board

Quoted 8 lines
Quoted 1 line · Jens Gehrlein

Who will pick up this patch series (if there are no

complaints)? Peter?

Of course, we could put them into the TQ custodian tree. Awkward, that I forgot this.

So I'm assuming I need take no u-boot-arm actions

Regards

Peter

#31 lore raw

cover TQMA31: new board

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

Of course, we could put them into the TQ custodian tree. Awkward, that I forgot this.

So I'm assuming I need take no u-boot-arm actions

But please do. It's ARM specific code, and needs to be reviewed and confirmed by an independent ARM expert.

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
It is surely a great calamity for  a  human  being  to  have  no  ob-
sessions.                                                - Robert Bly
#32 lore raw

cover TQMA31: new board

In reply to Jens Gehrlein
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 1 line · Jens Gehrlein

Who will pick up this patch series (if there are no complaints)? Peter?

Of course, we could put them into the TQ custodian tree. Awkward, that I forgot this.

But it still has to go through the respective custodian.

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
2000 pounds of chinese soup                               = 1 Won Ton
#33 lore raw

cover TQMA31: new board

In reply to Jens Gehrlein

Hi,

Jens Gehrlein skrev:

Quoted 5 lines

Hi,

the following patches introduce the i.MX31 (ARM1136) based board TQMA31. Used toolchain was ELDK 4.1.

Quoted 8 lines

The first three patches fix some bugs in mxc/mx31 common parts. I compiled the im31_phycore, the imx31_litekit and the mx31ads U-Boots for this. But I don't have boards to test them.

Patch 04/10 cannot successfully be compiled without having Patch 03/10 applied.

Patch 03/10 has been on the mailing list in a similar form, but it seems that nobody picked it up. So I want give it a chance with my patch series.

Don't know why those patches weren't picked up, I think they were submitted before the merge window closed. Your patch doesn't fix the bug in mx31_gpio_mux() though.

Regards, Magnus