Skip to contentSkip to conversation

Support for LogicPD i.MX27-LITEKIT development board

PATCH New Ilya Yanok 12 participants 70 messages Jun 8, 2009 – Sep 1, 2009

Subsystems (7)
lore
Share & tools
lore

Ilya Yanok

author
#0 lore raw

v3 cover Support for LogicPD i.MX27-LITEKIT development board

This patch set adds support for LogicPD i.MX27-LITEKIT development board. It contains support for i.MX27 CPU, support for serial console, FEC ethernet controller, NFC NAND controller and SDHC controller.

author
#1 lore raw

PATCH v3 1/7 mx27: basic cpu support

This patch adds generic code to support Freescale's i.MX27 SoCs.

---
 cpu/arm926ejs/mx27/Makefile             |   44 +++
 cpu/arm926ejs/mx27/generic.c            |  241 +++++++++++++++
 cpu/arm926ejs/mx27/reset.c              |   57 ++++
 cpu/arm926ejs/mx27/timer.c              |  191 ++++++++++++
 include/asm-arm/arch-mx27/asm-offsets.h |   16 +
 include/asm-arm/arch-mx27/clock.h       |   39 +++
 include/asm-arm/arch-mx27/imx-regs.h    |  509 +++++++++++++++++++++++++++++++
 7 files changed, 1097 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm926ejs/mx27/Makefile
 create mode 100644 cpu/arm926ejs/mx27/generic.c
 create mode 100644 cpu/arm926ejs/mx27/reset.c
 create mode 100644 cpu/arm926ejs/mx27/timer.c
 create mode 100644 include/asm-arm/arch-mx27/asm-offsets.h
 create mode 100644 include/asm-arm/arch-mx27/clock.h
 create mode 100644 include/asm-arm/arch-mx27/imx-regs.h
cpu/arm926ejs/mx27/Makefile new file +44 -0
new file mode 100644
index 0000000..67d1b0e
@@ -0,0 +1,44 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+COBJS	= generic.o reset.o timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm926ejs/mx27/generic.c new file +241 -0

241 lines not on this page · raw message

cpu/arm926ejs/mx27/reset.c new file +57 -0

57 lines not on this page · raw message

cpu/arm926ejs/mx27/timer.c new file +191 -0

191 lines not on this page · raw message

include/asm-arm/arch-mx27/asm-offsets.h new file +16 -0
new file mode 100644
index 0000000..497afe5
@@ -0,0 +1,16 @@
+#define AIPI1_PSR0	0x10000000
+#define AIPI1_PSR1	0x10000004
+#define AIPI2_PSR0	0x10020000
+#define AIPI2_PSR1	0x10020004
+#define CSCR		0x10027000
+#define MPCTL0		0x10027004
+#define SPCTL0		0x1002700c
+#define PCDR0		0x10027018
+#define PCDR1		0x1002701c
+#define PCCR0		0x10027020
+#define PCCR1		0x10027024
+#define ESDCTL0_ROF	0x00
+#define ESDCFG0_ROF	0x04
+#define ESDCTL1_ROF	0x08
+#define ESDCFG1_ROF	0x0C
+#define ESDMISC_ROF	0x10
include/asm-arm/arch-mx27/clock.h new file +39 -0
new file mode 100644
index 0000000..5fc75c5
@@ -0,0 +1,39 @@
+/*
+ *
+ * (c) 2009 Ilya Yanok, Emcraft Systems <[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 __ASM_ARCH_CLOCK_H
+#define __ASM_ARCH_CLOCK_H
+unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref);
+
+ulong imx_get_mpllclk(void);
+ulong imx_get_armclk(void);
+ulong imx_get_spllclk(void);
+ulong imx_get_fclk(void);
+ulong imx_get_hclk(void);
+ulong imx_get_bclk(void);
+ulong imx_get_perclk1(void);
+ulong imx_get_perclk2(void);
+ulong imx_get_perclk3(void);
+ulong imx_get_ahbclk(void);
+
+#endif /* __ASM_ARCH_CLOCK_H */
include/asm-arm/arch-mx27/imx-regs.h new file +509 -0

509 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#2 lore raw

PATCH v3 1/7 mx27: basic cpu support

include/asm-arm/arch-mx27/clock.h line 28

Quoted 6 lines
include/asm-arm/arch-mx27/clock.h new file +6 -0
+
+#ifndef __ASM_ARCH_CLOCK_H
+#define __ASM_ARCH_CLOCK_H
+unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref);
+
+ulong imx_get_mpllclk(void);

I want to have common api scheme so I'll like to have this clock as the folling scheme (already for at91 as example)

get_arm_clk_rate()
get_spm_clk_rate()
etc...

this could be done in a later patch
I'll add a note in the arm readme

include/asm-arm/arch-mx27/clock.h line 37

Quoted 9 lines
include/asm-arm/arch-mx27/clock.h new file +9 -0
+ulong imx_get_armclk(void);
+ulong imx_get_spllclk(void);
+ulong imx_get_fclk(void);
+ulong imx_get_hclk(void);
+ulong imx_get_bclk(void);
+ulong imx_get_perclk1(void);
+ulong imx_get_perclk2(void);
+ulong imx_get_perclk3(void);
+ulong imx_get_ahbclk(void);

applied to u-boot-arm

Best Regards,
J.

author
#3 lore raw

PATCH v3 2/7 serial_mx31: allow it to work with mx27 too and rename to serial_mxc

In reply to Ilya Yanok

UART hardware on i.MX27 is the same as on the i.MX31 so we just need to provide the driver with correct address of the registers.

---
 drivers/serial/Makefile                        |    2 +-
 drivers/serial/{serial_mx31.c => serial_mxc.c} |   21 +++++++++++++++++++++
 include/configs/imx31_litekit.h                |    2 +-
 include/configs/imx31_phycore.h                |    2 +-
 include/configs/mx31ads.h                      |    2 +-
 include/configs/qong.h                         |    2 +-
 6 files changed, 26 insertions(+), 5 deletions(-)
 rename drivers/serial/{serial_mx31.c => serial_mxc.c} (94%)
drivers/serial/Makefile +1 -1
index 14c818d..9a572e9 100644
@@ -40,7 +40,7 @@ COBJS-$(CONFIG_IXP_SERIAL) += serial_ixp.o
 COBJS-$(CONFIG_KS8695_SERIAL) += serial_ks8695.o
 COBJS-$(CONFIG_LPC2292_SERIAL) += serial_lpc2292.o
 COBJS-$(CONFIG_MAX3100_SERIAL) += serial_max3100.o
-COBJS-$(CONFIG_MX31_UART) += serial_mx31.o
+COBJS-$(CONFIG_MXC_UART) += serial_mxc.o
 COBJS-$(CONFIG_NETARM_SERIAL) += serial_netarm.o
 COBJS-$(CONFIG_PL010_SERIAL) += serial_pl01x.o
 COBJS-$(CONFIG_PL011_SERIAL) += serial_pl01x.o
drivers/serial/serial_mxc.c renamed from drivers/serial/serial_mx31.c +21 -0
similarity index 94%
rename from drivers/serial/serial_mx31.c
rename to drivers/serial/serial_mxc.c
index 7c0682a..acc5b7d 100644
@@ -18,7 +18,12 @@
  */
 
 #include <common.h>
+#ifdef CONFIG_MX31
 #include <asm/arch/mx31.h>
+#else
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/clock.h>
+#endif
 
 #define __REG(x)     (*((volatile u32 *)(x)))
 
@@ -32,6 +37,18 @@
 #define UART_PHYS 0x43fb0000
 #elif defined(CONFIG_SYS_MX31_UART5)
 #define UART_PHYS 0x43fb4000
+#elif defined(CONFIG_SYS_MX27_UART1)
+#define UART_PHYS 0x1000a000
+#elif defined(CONFIG_SYS_MX27_UART2)
+#define UART_PHYS 0x1000b000
+#elif defined(CONFIG_SYS_MX27_UART3)
+#define UART_PHYS 0x1000c000
+#elif defined(CONFIG_SYS_MX27_UART4)
+#define UART_PHYS 0x1000d000
+#elif defined(CONFIG_SYS_MX27_UART5)
+#define UART_PHYS 0x1001b000
+#elif defined(CONFIG_SYS_MX27_UART6)
+#define UART_PHYS 0x1001c000
 #else
 #error "define CONFIG_SYS_MX31_UARTx to use the mx31 UART driver"
 #endif
@@ -149,7 +166,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void serial_setbrg (void)
 {
+#ifdef CONFIG_MX31
 	u32 clk = mx31_get_ipg_clk();
+#else
+	u32 clk = imx_get_perclk1();
+#endif
 
 	if (!gd->baudrate)
 		gd->baudrate = CONFIG_BAUDRATE;
include/configs/imx31_litekit.h +1 -1
index 9ac6eec..74f54c0 100644
@@ -60,7 +60,7 @@
  * Hardware drivers
  */
 
-#define CONFIG_MX31_UART	1
+#define CONFIG_MXC_UART	1
 #define CONFIG_SYS_MX31_UART1		1
 
 #define CONFIG_HARD_SPI		1
include/configs/imx31_phycore.h +1 -1
index cbc0b92..cb42a7c 100644
@@ -64,7 +64,7 @@
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		0xfe
 
-#define CONFIG_MX31_UART	1
+#define CONFIG_MXC_UART	1
 #define CONFIG_SYS_MX31_UART1		1
 
 /* allow to overwrite serial and ethaddr */
include/configs/mx31ads.h +1 -1
index c31c06a..363ea1b 100644
@@ -57,7 +57,7 @@
  * Hardware drivers
  */
 
-#define CONFIG_MX31_UART	1
+#define CONFIG_MXC_UART	1
 #define CONFIG_SYS_MX31_UART1		1
 
 #define CONFIG_HARD_SPI		1
include/configs/qong.h +1 -1
index a67006a..12bdc69 100644
@@ -49,7 +49,7 @@
  * Hardware drivers
  */
 
-#define CONFIG_MX31_UART	1
+#define CONFIG_MXC_UART	1
 #define CONFIG_SYS_MX31_UART1	1
 
 /* FPGA */
Signature · 1 line
1.6.0.6
#4 lore raw

PATCH v3 2/7 serial_mx31: allow it to work with mx27 too and rename to serial_mxc

Quoted 3 lines · Ilya Yanok

UART hardware on i.MX27 is the same as on the i.MX31 so we just need to provide the driver with correct address of the registers.

IIRC the imx1 share the same too

Quoted 64 lines
---
 drivers/serial/Makefile                        |    2 +-
 drivers/serial/{serial_mx31.c => serial_mxc.c} |   21 +++++++++++++++++++++
 include/configs/imx31_litekit.h                |    2 +-
 include/configs/imx31_phycore.h                |    2 +-
 include/configs/mx31ads.h                      |    2 +-
 include/configs/qong.h                         |    2 +-
 6 files changed, 26 insertions(+), 5 deletions(-)
 rename drivers/serial/{serial_mx31.c => serial_mxc.c} (94%)
drivers/serial/Makefile +1 -1
index 14c818d..9a572e9 100644
@@ -40,7 +40,7 @@ COBJS-$(CONFIG_IXP_SERIAL) += serial_ixp.o
 COBJS-$(CONFIG_KS8695_SERIAL) += serial_ks8695.o
 COBJS-$(CONFIG_LPC2292_SERIAL) += serial_lpc2292.o
 COBJS-$(CONFIG_MAX3100_SERIAL) += serial_max3100.o
-COBJS-$(CONFIG_MX31_UART) += serial_mx31.o
+COBJS-$(CONFIG_MXC_UART) += serial_mxc.o
 COBJS-$(CONFIG_NETARM_SERIAL) += serial_netarm.o
 COBJS-$(CONFIG_PL010_SERIAL) += serial_pl01x.o
 COBJS-$(CONFIG_PL011_SERIAL) += serial_pl01x.o
drivers/serial/serial_mxc.c renamed from drivers/serial/serial_mx31.c +17 -0
similarity index 94%
rename from drivers/serial/serial_mx31.c
rename to drivers/serial/serial_mxc.c
index 7c0682a..acc5b7d 100644
@@ -18,7 +18,12 @@
  */
 
 #include <common.h>
+#ifdef CONFIG_MX31
 #include <asm/arch/mx31.h>
+#else
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/clock.h>
+#endif
 
 #define __REG(x)     (*((volatile u32 *)(x)))
 
@@ -32,6 +37,18 @@
 #define UART_PHYS 0x43fb0000
 #elif defined(CONFIG_SYS_MX31_UART5)
 #define UART_PHYS 0x43fb4000
+#elif defined(CONFIG_SYS_MX27_UART1)
+#define UART_PHYS 0x1000a000
+#elif defined(CONFIG_SYS_MX27_UART2)
+#define UART_PHYS 0x1000b000
+#elif defined(CONFIG_SYS_MX27_UART3)
+#define UART_PHYS 0x1000c000
+#elif defined(CONFIG_SYS_MX27_UART4)
+#define UART_PHYS 0x1000d000
+#elif defined(CONFIG_SYS_MX27_UART5)
+#define UART_PHYS 0x1001b000
+#elif defined(CONFIG_SYS_MX27_UART6)
+#define UART_PHYS 0x1001c000
 #else
 #error "define CONFIG_SYS_MX31_UARTx to use the mx31 UART driver"
 #endif

drivers/serial/serial_mxc.c DECLARE_GLOBAL_DATA_PTR; · line 173

Quoted 8 lines
drivers/serial/serial_mxc.c renamed from drivers/serial/serial_mx31.c +4 -0
@@ -149,7 +166,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void serial_setbrg (void)
 {
+#ifdef CONFIG_MX31
 	u32 clk = mx31_get_ipg_clk();
+#else
+	u32 clk = imx_get_perclk1();
+#endif

here we need to have a common clock rate function name as we do for avr32 & at91

this could done in a next patch but mandatory for other board adding

applied to u-boot-arm

Best Regards,
J.

author
#5 lore raw

PATCH v3 3/7 fec_imx27: driver for FEC ethernet controller on i.MX27

In reply to Ilya Yanok
---
 cpu/arm926ejs/mx27/generic.c |   10 +
 drivers/net/Makefile         |    1 +
 drivers/net/fec_imx27.c      |  713 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/fec_imx27.h      |  304 ++++++++++++++++++
 include/netdev.h             |    1 +
 5 files changed, 1029 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/fec_imx27.c
 create mode 100644 drivers/net/fec_imx27.h
cpu/arm926ejs/mx27/generic.c +10 -0
index eab54d8..b52f934 100644
@@ -20,6 +20,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 
@@ -159,6 +160,15 @@ int print_cpuinfo (void)
 }
 #endif
 
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_FEC_IMX27)
+	return fecimx27_initialize(bis);
+#else
+	return 0;
+#endif
+}
+
 void imx_gpio_mode(int gpio_mode)
 {
 	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
drivers/net/Makefile +1 -0
index a360a50..8bbbd2b 100644
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_DNET) += dnet.o
 COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
 COBJS-$(CONFIG_ENC28J60) += enc28j60.o
+COBJS-$(CONFIG_FEC_IMX27) += fec_imx27.o
 COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
drivers/net/fec_imx27.c new file +713 -0

713 lines not on this page · raw message

drivers/net/fec_imx27.h new file +304 -0

304 lines not on this page · raw message

include/netdev.h +1 -0
index 63cf730..2d999ad 100644
@@ -49,6 +49,7 @@ int e1000_initialize(bd_t *bis);
 int eepro100_initialize(bd_t *bis);
 int eth_3com_initialize (bd_t * bis);
 int fec_initialize (bd_t *bis);
+int fecimx27_initialize (bd_t *bis);
 int greth_initialize(bd_t *bis);
 void gt6426x_eth_initialize(bd_t *bis);
 int inca_switch_initialize(bd_t *bis);
Signature · 1 line
1.6.0.6
author
#6 lore raw

PATCH 1/1 fec_mxc: driver for FEC ethernet controller on i.MX27

---
 cpu/arm926ejs/mx27/generic.c |   10 +
 drivers/net/Makefile         |    1 +
 drivers/net/fec_mxc.c        |  742 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/fec_mxc.h        |  304 +++++++++++++++++
 include/netdev.h             |    1 +
 5 files changed, 1058 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/fec_mxc.c
 create mode 100644 drivers/net/fec_mxc.h
cpu/arm926ejs/mx27/generic.c +10 -0
index bcf7899..7f6fc69 100644
@@ -20,6 +20,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 
@@ -159,6 +160,15 @@ int print_cpuinfo (void)
 }
 #endif
 
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_FEC_IMX27)
+	return fecimx27_initialize(bis);
+#else
+	return 0;
+#endif
+}
+
 void imx_gpio_mode(int gpio_mode)
 {
 	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
drivers/net/Makefile +1 -0
index c6097c3..f92dba7 100644
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_DNET) += dnet.o
 COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
 COBJS-$(CONFIG_ENC28J60) += enc28j60.o
+COBJS-$(CONFIG_FEC_MXC) += fec_mxc.o
 COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
drivers/net/fec_mxc.c new file +742 -0

742 lines not on this page · raw message

drivers/net/fec_mxc.h new file +304 -0

304 lines not on this page · raw message

include/netdev.h +1 -0
index aed5c4c..7d88ca4 100644
@@ -50,6 +50,7 @@ int e1000_initialize(bd_t *bis);
 int eepro100_initialize(bd_t *bis);
 int eth_3com_initialize (bd_t * bis);
 int fec_initialize (bd_t *bis);
+int fecimx27_initialize (bd_t *bis);
 int greth_initialize(bd_t *bis);
 void gt6426x_eth_initialize(bd_t *bis);
 int inca_switch_initialize(bd_t *bis);
Signature · 1 line
1.6.0.6
#7 lore raw

PATCH 1/1 fec_mxc: driver for FEC ethernet controller on i.MX27

Hi Ilya,

Quoted 27 lines · Ilya Yanok
---
 cpu/arm926ejs/mx27/generic.c |   10 +
 drivers/net/Makefile         |    1 +
 drivers/net/fec_mxc.c        |  742
++++++++++++++++++++++++++++++++++++++++++
 drivers/net/fec_mxc.h        |  304 +++++++++++++++++
 include/netdev.h             |    1 +
 5 files changed, 1058 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/fec_mxc.c
 create mode 100644 drivers/net/fec_mxc.h
cpu/arm926ejs/mx27/generic.c +1 -0
index bcf7899..7f6fc69 100644
@@ -20,6 +20,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 
@@ -159,6 +160,15 @@ int print_cpuinfo (void)
 }
 #endif

cpu/arm926ejs/mx27/generic.c int print_cpuinfo (void) · line 171

Quoted 10 lines
cpu/arm926ejs/mx27/generic.c +9 -0
 
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_FEC_IMX27)
+       return fecimx27_initialize(bis);
+#else
+       return 0;
+#endif
+}
+

The main reason why this was rejected previously was because you needlessly restricted the scope to imx27, when there are other CPUs that apparently share this FEC. I see you've changed the name of the driver to something more appropriately generic, but why not the name of the initialization function?

Please rationalize this. If you do so, I'll make sure to get the driver in this release.

regards,
Ben

author
#8 lore raw

PATCH 1/1 fec_mxc: driver for FEC ethernet controller on i.MX27

---
 cpu/arm926ejs/mx27/generic.c |   10 +
 drivers/net/Makefile         |    1 +
 drivers/net/fec_mxc.c        |  742 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/fec_mxc.h        |  304 +++++++++++++++++
 include/netdev.h             |    1 +
 5 files changed, 1058 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/fec_mxc.c
 create mode 100644 drivers/net/fec_mxc.h
cpu/arm926ejs/mx27/generic.c +10 -0
index bcf7899..47fa4b4 100644
@@ -20,6 +20,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 
@@ -159,6 +160,15 @@ int print_cpuinfo (void)
 }
 #endif
 
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_FEC_MXC)
+	return fecmxc_initialize(bis);
+#else
+	return 0;
+#endif
+}
+
 void imx_gpio_mode(int gpio_mode)
 {
 	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
drivers/net/Makefile +1 -0
index c6097c3..f92dba7 100644
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_DNET) += dnet.o
 COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
 COBJS-$(CONFIG_ENC28J60) += enc28j60.o
+COBJS-$(CONFIG_FEC_MXC) += fec_mxc.o
 COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
drivers/net/fec_mxc.c new file +742 -0

742 lines not on this page · raw message

drivers/net/fec_mxc.h new file +304 -0

304 lines not on this page · raw message

include/netdev.h +1 -0
index aed5c4c..842525f 100644
@@ -50,6 +50,7 @@ int e1000_initialize(bd_t *bis);
 int eepro100_initialize(bd_t *bis);
 int eth_3com_initialize (bd_t * bis);
 int fec_initialize (bd_t *bis);
+int fecmxc_initialize (bd_t *bis);
 int greth_initialize(bd_t *bis);
 void gt6426x_eth_initialize(bd_t *bis);
 int inca_switch_initialize(bd_t *bis);
Signature · 1 line
1.6.0.6
#9 lore raw

PATCH 1/1 fec_mxc: driver for FEC ethernet controller on i.MX27

Quoted 10 lines · Ilya Yanok
---
 cpu/arm926ejs/mx27/generic.c |   10 +
 drivers/net/Makefile         |    1 +
 drivers/net/fec_mxc.c        |  742 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/fec_mxc.h        |  304 +++++++++++++++++
 include/netdev.h             |    1 +
 5 files changed, 1058 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/fec_mxc.c
 create mode 100644 drivers/net/fec_mxc.h

Ben ping

Best Regards,
J.

#10 lore raw

PATCH 1/1 fec_mxc: driver for FEC ethernet controller on i.MX27

Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines · Ilya Yanok
---
 cpu/arm926ejs/mx27/generic.c |   10 +
 drivers/net/Makefile         |    1 +
 drivers/net/fec_mxc.c        |  742 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/fec_mxc.h        |  304 +++++++++++++++++
 include/netdev.h             |    1 +
 5 files changed, 1058 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/fec_mxc.c
 create mode 100644 drivers/net/fec_mxc.h
Quoted 5 lines

Ben ping

Best Regards,
J.

Planning on getting to it tonight.

Ben

Applied
#11 lore raw

PATCH 1/1 fec_mxc: driver for FEC ethernet controller on i.MX27

In reply to Ilya Yanok
Quoted 11 lines · Ilya Yanok
---
 cpu/arm926ejs/mx27/generic.c |   10 +
 drivers/net/Makefile         |    1 +
 drivers/net/fec_mxc.c        |  742 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/fec_mxc.h        |  304 +++++++++++++++++
 include/netdev.h             |    1 +
 5 files changed, 1058 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/fec_mxc.c
 create mode 100644 drivers/net/fec_mxc.h

Applied to net repo.

thanks,
Ben

author
#12 lore raw

PATCH v3 4/7 mxc_nand: add nand driver for MX2/MX3

In reply to Ilya Yanok

Driver for NFC NAND controller found on Freescale's MX2 and MX3 processors. Ported from Linux. Tested only with i.MX27 but should works with other MX2 and MX3 processors too.

---
 drivers/mtd/nand/Makefile   |    1 +
 drivers/mtd/nand/mxc_nand.c |  932 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 933 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/Makefile +1 -0
index 471cd6b..24de947 100644
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o
 COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
 COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
+COBJS-$(CONFIG_NAND_MXC) += mxc_nand.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.c
 COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
drivers/mtd/nand/mxc_nand.c new file +932 -0

932 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#13 lore raw

PATCH v3 4/7 mxc_nand: add nand driver for MX2/MX3

Quoted 10 lines · Ilya Yanok

Driver for NFC NAND controller found on Freescale's MX2 and MX3 processors. Ported from Linux. Tested only with i.MX27 but should works with other MX2 and MX3 processors too.

---
 drivers/mtd/nand/Makefile   |    1 +
 drivers/mtd/nand/mxc_nand.c |  932 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 933 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/mxc_nand.c

Scott could you take a look on it?

Best Regards,
J.

#14 lore raw

PATCH 4/7 mxc_nand: add nand driver for MX2/MX3

In reply to Ilya Yanok
Quoted 5 lines · Ilya Yanok

Driver for NFC NAND controller found on Freescale's MX2 and MX3 processors. Ported from Linux. Tested only with i.MX27 but should works with other MX2 and MX3 processors too.

Please look at drivers/mtd/nand/mpc5121_nfc.c, which AFAICT is very similar hardware, and see if anything can be factored out into common code, and try to keep the rest looking the same except where the hardware actually differs.

drivers/mtd/nand/mxc_nand.c line 148

Quoted 5 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+static struct nand_ecclayout nand_hw_eccoob_16 = {
+	.eccbytes = 5,
+	.eccpos = {6, 7, 8, 9, 10},
+	.oobfree = {{0, 6}, {12, 4}, }
+};

This implies the bad block marker is one byte at offset 11 (it's all that's left), but I don't see any override of the bad block pattern.

drivers/mtd/nand/mxc_nand.c line 158

Quoted 9 lines
drivers/mtd/nand/mxc_nand.c new file +9 -0
+static void *mxc_nand_memcpy32(void *dest, void *source, size_t size)
+{
+	uint32_t *s = source, *d = dest;
+
+	size >>= 2;
+	while (size--)
+		*d++ = *s++;
+	return dest;
+}

This should probably be using I/O accessors (possibly raw) -- and should take uint32_t *, not void *.

Quoted 8 lines
drivers/mtd/nand/mxc_nand.c new file +8 -0
+/*
+ * This function requests the NANDFC to perform a read of the
+ * NAND device status and returns the current status.
+ */
+static uint16_t get_dev_status(struct mxc_nand_host *host)
+{
+	void __iomem *main_buf = host->regs->main_area1;
+	uint32_t store;

drivers/mtd/nand/mxc_nand.c line 318

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+	uint16_t ret, tmp;
+	/* Issue status request to NAND device */
+
+	/* store the main area1 first word, later do recovery */
+	store = readl(main_buf);
+	/*
+	 * NANDFC buffer 1 is used for device status to prevent
+	 * corruption of read/write buffer on status requests.
+	 */
+	writew(1, &host->regs->nfc_buf_addr);

But it looks like buffer 1 is used for data with large page flash.

Other drivers don't seem to have any problem with status reads clobbering the buffer...

drivers/mtd/nand/mxc_nand.c line 341

Quoted 2 lines
drivers/mtd/nand/mxc_nand.c new file +2 -0
+/* This functions is used by upper layer to checks if device is ready */
+static int mxc_nand_dev_ready(struct mtd_info *mtd)

"This functions is"? I'd say this comment is pretty redundant with respect to the function name anyway...

drivers/mtd/nand/mxc_nand.c line 397

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+static u_char mxc_nand_read_byte(struct mtd_info *mtd)
+{
+	struct nand_chip *nand_chip = mtd->priv;
+	struct mxc_nand_host *host = nand_chip->priv;
+	uint8_t ret = 0;
+	uint16_t col, rd_word;
+	uint16_t __iomem *main_buf =
+		(uint16_t __iomem *)host->regs->main_area0;
+	uint16_t __iomem *spare_buf =
+		(uint16_t __iomem *)host->regs->spare_area0;

According to Magnus Lilja, "the nand flash controller can only handle 32 bit read/write operations, any other size will cause an abort (or something like that)". But now we're accessing it as 16-bit?

Quoted 18 lines
drivers/mtd/nand/mxc_nand.c new file +18 -0
+static uint16_t mxc_nand_read_word(struct mtd_info *mtd)
+{
+	struct nand_chip *nand_chip = mtd->priv;
+	struct mxc_nand_host *host = nand_chip->priv;
+	uint16_t col, rd_word, ret;
+	uint16_t __iomem *p;
+
+	MTDDEBUG(MTD_DEBUG_LEVEL3,
+	      "mxc_nand_read_word(col = %d)\n", host->col_addr);
+
+	col = host->col_addr;
+	/* Adjust saved column address */
+	if (col < mtd->writesize && host->spare_only)
+		col += mtd->writesize;
+
+	if (col < mtd->writesize) {
+		p = (uint16_t __iomem *)(host->regs->main_area0 + (col >> 1));
+	} else {

drivers/mtd/nand/mxc_nand.c line 451

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+		p = (uint16_t __iomem *)(host->regs->spare_area0 +
+				((col - mtd->writesize) >> 1));
+	}
+
+	if (col & 1) {
+		rd_word = readw(p);
+		ret = (rd_word >> 8) & 0xff;
+		rd_word = readw(&p[1]);
+		ret |= (rd_word << 8) & 0xff00;
+

col should never be odd if you're reading words.

Quoted 19 lines
drivers/mtd/nand/mxc_nand.c new file +19 -0
+/*
+ * Write data of length len to buffer buf. The data to be
+ * written on NAND Flash is first copied to RAMbuffer. After the Data Input
+ * Operation by the NFC, the data is written to NAND Flash
+ */
+static void mxc_nand_write_buf(struct mtd_info *mtd,
+				const u_char *buf, int len)
+{
+	struct nand_chip *nand_chip = mtd->priv;
+	struct mxc_nand_host *host = nand_chip->priv;
+	int n, col, i = 0;
+
+	MTDDEBUG(MTD_DEBUG_LEVEL3,
+	      "mxc_nand_write_buf(col = %d, len = %d)\n", host->col_addr,
+	      len);
+
+	col = host->col_addr;
+
+	/* Adjust saved column address */

drivers/mtd/nand/mxc_nand.c line 490

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+	if (col < mtd->writesize && host->spare_only)
+		col += mtd->writesize;
+
+	n = mtd->writesize + mtd->oobsize - col;
+	n = min(len, n);
+
+	MTDDEBUG(MTD_DEBUG_LEVEL3,
+	      "%s:%d: col = %d, n = %d\n", __func__, __LINE__, col, n);
+
+	while (n) {

Safer to do while (n > 0), especially when the code is this complex.

drivers/mtd/nand/mxc_nand.c line 503

Quoted 13 lines
drivers/mtd/nand/mxc_nand.c new file +13 -0
+		void __iomem *p;
+
+		if (col < mtd->writesize) {
+			p = host->regs->main_area0 + (col & ~3);
+		} else {
+			p = host->regs->spare_area0 -
+						mtd->writesize + (col & ~3);
+		}
+
+		MTDDEBUG(MTD_DEBUG_LEVEL3, "%s:%d: p = %p\n", __func__,
+		      __LINE__, p);
+
+		if (((col | (int)&buf[i]) & 3) || n < 16) {

Do not cast pointers to "int". Use "uintptr_t" or "unsigned long" if you must.

Why < 16 and not < 4?

drivers/mtd/nand/mxc_nand.c line 507

Quoted 4 lines
drivers/mtd/nand/mxc_nand.c new file +4 -0
+			uint32_t data = 0;
+
+			if (col & 3 || n < 4)
+				data = readl(p);

If that condition doesn't hold, the data we use is zero?

Quoted 22 lines
drivers/mtd/nand/mxc_nand.c new file +22 -0
+
+			switch (col & 3) {
+			case 0:
+				if (n) {
+					data = (data & 0xffffff00) |
+					    (buf[i++] << 0);
+					n--;
+					col++;
+				}
+			case 1:
+				if (n) {
+					data = (data & 0xffff00ff) |
+					    (buf[i++] << 8);
+					n--;
+					col++;
+				}
+			case 2:
+				if (n) {
+					data = (data & 0xff00ffff) |
+					    (buf[i++] << 16);
+					n--;
+					col++;

drivers/mtd/nand/mxc_nand.c line 540

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+				}
+			case 3:
+				if (n) {
+					data = (data & 0x00ffffff) |
+					    (buf[i++] << 24);
+					n--;
+					col++;
+				}
+			}
+			writel(data, p);

Might I suggest this?

union {
	uint32_t word;
	uint8_t bytes[4];
} nfc_word;

nfc_word.word = readl(p);
nfc_word.bytes[col & 3] = buf[i++];
n--;
col++;

writel(nfc_word.word, p);

As a side benefit, you lose the endian dependency.

drivers/mtd/nand/mxc_nand.c line 553

Quoted 1 line
drivers/mtd/nand/mxc_nand.c new file +1 -0
+			mxc_nand_memcpy32(p, (void *)&buf[i], m);

Unnecessary cast.

drivers/mtd/nand/mxc_nand.c line 594

Quoted 4 lines
drivers/mtd/nand/mxc_nand.c new file +4 -0
+	/* Update saved column address */
+	host->col_addr = col;
+
+}

No blank lines before the brace at the end of a block.

drivers/mtd/nand/mxc_nand.c line 653

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+
+/*
+ * Used by the upper layer to verify the data in NAND Flash
+ * with the data in the buf.
+ */
+static int mxc_nand_verify_buf(struct mtd_info *mtd,
+				const u_char *buf, int len)
+{
+	return -EFAULT;
+}

Umm...

Quoted 4 lines
drivers/mtd/nand/mxc_nand.c new file +4 -0
+	case NAND_CMD_SEQIN:
+		if (column >= mtd->writesize) {
+			/*
+			 * FIXME: before send SEQIN command for write OOB,

drivers/mtd/nand/mxc_nand.c line 748

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+			 * We must read one page out.
+			 * For K9F1GXX has no READ1 command to set current HW
+			 * pointer to spare area, we must write the whole page
+			 * including OOB together.
+			 */
+			if (host->pagesize_2k) {
+				/* call ourself to read a page */
+				mxc_nand_command(mtd, NAND_CMD_READ0, 0,
+						page_addr);
+			}

Should this be #ifdef HWECC? And update the comment to indicate the actual problem, which is the unusual hardware ECC implementation. I don't see what the lack of a "READ1" command has to do with it.

And is this actually a FIXME if it's already being done?

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+#ifdef CONFIG_MXC_NAND_HWECC
+	this->ecc.calculate = mxc_nand_calculate_ecc;
+	this->ecc.hwctl = mxc_nand_enable_hwecc;
+	this->ecc.correct = mxc_nand_correct_data;
+	this->ecc.mode = NAND_ECC_HW;
+	this->ecc.size = 512;
+	this->ecc.bytes = 3;
+	this->ecc.layout = &nand_hw_eccoob_8;
+	tmp = readw(&host->regs->nfc_config1);
+	tmp |= NFC_ECC_EN;

drivers/mtd/nand/mxc_nand.c line 904

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+	writew(tmp, &host->regs->nfc_config1);
+#else
+	this->ecc.size = 512;
+	this->ecc.bytes = 3;
+	this->ecc.layout = &nand_hw_eccoob_8;
+	this->ecc.mode = NAND_ECC_SOFT;
+	tmp = readw(&host->regs->nfc_config1);
+	tmp &= ~NFC_ECC_EN;
+	writew(tmp, &host->regs->nfc_config1);
+#endif

Soft ECC only supports 256-byte ECC blocks (anything you set here to the contrary will just be overwritten), and you'll need a layout that accommodates that with enough ECC bytes.

Alternatively, you can implement 512-byte soft ECC if you don't want to waste those 3 extra OOB bytes. :-)

drivers/mtd/nand/mxc_nand.c line 928

Quoted 1 line
drivers/mtd/nand/mxc_nand.c new file +1 -0
+	host->pagesize_2k = 0;

So large page is currently unsupported?

-Scott

#15 lore raw

PATCH 4/7 mxc_nand: add nand driver for MX2/MX3

Hi

2009/6/23 Scott Wood <[email protected]>:

Quoted 5 lines · Ilya Yanok
Quoted 4 lines

Driver for NFC NAND controller found on Freescale's MX2 and MX3 processors. Ported from Linux. Tested only with i.MX27 but should works with other MX2 and MX3 processors too.

Quoted 15 lines

Review

Quoted 11 lines
(quoted diff) +10 -0
+static u_char mxc_nand_read_byte(struct mtd_info *mtd)
+{
+ ? ? struct nand_chip *nand_chip = mtd->priv;
+ ? ? struct mxc_nand_host *host = nand_chip->priv;
+ ? ? uint8_t ret = 0;
+ ? ? uint16_t col, rd_word;
+ ? ? uint16_t __iomem *main_buf =
+ ? ? ? ? ? ? (uint16_t __iomem *)host->regs->main_area0;
+ ? ? uint16_t __iomem *spare_buf =
+ ? ? ? ? ? ? (uint16_t __iomem *)host->regs->spare_area0;

According to Magnus Lilja, "the nand flash controller can only handle 32 bit read/write operations, any other size will cause an abort (or something like that)". ?But now we're accessing it as 16-bit?

I'm not sure if the controller allows 16 bit accesses or not, don't remember if I've tried that. 8 bit accesses don't work. Also, I don't know if it's the controller itself that can't cope with 8 bit accesses or if it's the bus interface to the NFC block in i.MX31.

Regards, Magnus

#16 lore raw

PATCH 4/7 mxc_nand: add nand driver for MX2/MX3

Hello,

I'm using the imx27lite-v2 branch for our opensource imx27 board. Right now I'm trying to get the nand to work. I'm using a Micron 2Gb x8 part (p/n MT29F2G08ABDHC). When I do "nand info" I get "Device 0: NAND 256MiB 1,8V 8-bit, sector size 128 KiB" which is correct. mtdparts returns:

device nand0 <mxc_nand.0>, # parts = 4

 #: name                size            offset          mask_flags
 0: IPL-SPL             0x00040000      0x00000000      0
 1: kernel              0x00200000      0x00040000      0
 2: rootfs              0x00b00000      0x00240000      0
 3: userfs              0x0f2c0000      0x00d40000      0

active partition: nand0,0 - (IPL-SPL) 0x00040000 @ 0x00000000

defaults:
mtdids : nor0=physmap-flash.0,nand0=mxc_nand.0
mtdparts: mtdparts=mxc_nand.0:256k(IPL-SPL),2m(kernel),11m(rootfs),-(userfs)

But when I do other commands like fsinfo or ls I get "read_nand_cached:
error reading nand off 0x2000 size 8192 bytes" errors.

My questions are: should the current driver support this chip? Do I need to do anything else to prepare the mtd partitions? Is there a low level test I could run on the NAND?

thanks,
Paul

#17 lore raw

PATCH 4/7 mxc_nand: add nand driver for MX2/MX3

Quoted 25 lines · Paul Thomas

Hello,

I'm using the imx27lite-v2 branch for our opensource imx27 board. Right now I'm trying to get the nand to work. I'm using a Micron 2Gb x8 part (p/n MT29F2G08ABDHC). When I do "nand info" I get "Device 0: NAND 256MiB 1,8V 8-bit, sector size 128 KiB" which is correct. mtdparts returns:

device nand0 <mxc_nand.0>, # parts = 4

 #: name                size            offset          mask_flags
 0: IPL-SPL             0x00040000      0x00000000      0
 1: kernel              0x00200000      0x00040000      0
 2: rootfs              0x00b00000      0x00240000      0
 3: userfs              0x0f2c0000      0x00d40000      0

active partition: nand0,0 - (IPL-SPL) 0x00040000 @ 0x00000000

defaults:
mtdids : nor0=physmap-flash.0,nand0=mxc_nand.0 mtdparts:
mtdparts=mxc_nand.0:256k(IPL-SPL),2m(kernel),11m(rootfs),-(userfs)

But when I do other commands like fsinfo or ls I get "read_nand_cached:
error reading nand off 0x2000 size 8192 bytes" errors.

Quoted 7 lines

My questions are: should the current driver support this chip? Do I need to do anything else to prepare the mtd partitions? Is there a low level test I could run on the NAND?

thanks,
Paul

Also "nand bad" reports that all the blocks are bad, and if I do "nand scrub" it says "Erasing at 0xffe0000 -- 100% complete.
OK", but "nand bad" still returns that all the blocks are bad.

thanks,
Paul

author
#18 lore raw

PATCH v3 4/7 mxc_nand: add nand driver for MX2/MX3

In reply to Scott Wood

Hi Scott,

please review the updated patch (will be posted as a follow-up).

Quoted 5 lines · Scott Wood

Please look at drivers/mtd/nand/mpc5121_nfc.c, which AFAICT is very similar hardware, and see if anything can be factored out into common code, and try to keep the rest looking the same except where the hardware actually differs.

Hmm... For now we just can't spend enough effort for this...

Quoted 10 lines

drivers/mtd/nand/mxc_nand.c line 148

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+static struct nand_ecclayout nand_hw_eccoob_16 = {
+	.eccbytes = 5,
+	.eccpos = {6, 7, 8, 9, 10},
+	.oobfree = {{0, 6}, {12, 4}, }
+};

This implies the bad block marker is one byte at offset 11 (it's all that's left), but I don't see any override of the bad block pattern.

This is surely a bug. Fixed.

Quoted 5 lines
Quoted 5 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+static void *mxc_nand_memcpy32(void *dest, void *source, size_t size)
+{
+	uint32_t *s = source, *d = dest;
+
+	size >>= 2;
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 158

Quoted 5 lines
drivers/mtd/nand/mxc_nand.c new file +4 -0
+	while (size--)
+		*d++ = *s++;
+	return dest;
+}

This should probably be using I/O accessors (possibly raw) -- and should take uint32_t *, not void *.

Fixed.

Quoted 13 lines
Quoted 13 lines
drivers/mtd/nand/mxc_nand.c new file +13 -0
+/*
+ * This function requests the NANDFC to perform a read of the
+ * NAND device status and returns the current status.
+ */
+static uint16_t get_dev_status(struct mxc_nand_host *host)
+{
+	void __iomem *main_buf = host->regs->main_area1;
+	uint32_t store;
+	uint16_t ret, tmp;
+	/* Issue status request to NAND device */
+
+	/* store the main area1 first word, later do recovery */
+	store = readl(main_buf);
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 318

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+	/*
+	 * NANDFC buffer 1 is used for device status to prevent
+	 * corruption of read/write buffer on status requests.
+	 */
+	writew(1, &host->regs->nfc_buf_addr);

But it looks like buffer 1 is used for data with large page flash.

Well, we save first word of the buffer and then recover it.

Quoted 11 lines

Other drivers don't seem to have any problem with status reads clobbering the buffer...

drivers/mtd/nand/mxc_nand.c line 341

Quoted 3 lines
drivers/mtd/nand/mxc_nand.c new file +2 -0
+/* This functions is used by upper layer to checks if device is ready */
+static int mxc_nand_dev_ready(struct mtd_info *mtd)

"This functions is"? I'd say this comment is pretty redundant with respect to the function name anyway...

Fixed.

Quoted 7 lines
Quoted 7 lines
drivers/mtd/nand/mxc_nand.c new file +7 -0
+static u_char mxc_nand_read_byte(struct mtd_info *mtd)
+{
+	struct nand_chip *nand_chip = mtd->priv;
+	struct mxc_nand_host *host = nand_chip->priv;
+	uint8_t ret = 0;
+	uint16_t col, rd_word;
+	uint16_t __iomem *main_buf =
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 397

Quoted 4 lines
drivers/mtd/nand/mxc_nand.c new file +3 -0
+		(uint16_t __iomem *)host->regs->main_area0;
+	uint16_t __iomem *spare_buf =
+		(uint16_t __iomem *)host->regs->spare_area0;

According to Magnus Lilja, "the nand flash controller can only handle 32 bit read/write operations, any other size will cause an abort (or something like that)". But now we're accessing it as 16-bit?

16-bit accesses work quite well. Problem was with 8-bit accesses.

Quoted 23 lines
Quoted 23 lines
drivers/mtd/nand/mxc_nand.c new file +23 -0
+static uint16_t mxc_nand_read_word(struct mtd_info *mtd)
+{
+	struct nand_chip *nand_chip = mtd->priv;
+	struct mxc_nand_host *host = nand_chip->priv;
+	uint16_t col, rd_word, ret;
+	uint16_t __iomem *p;
+
+	MTDDEBUG(MTD_DEBUG_LEVEL3,
+	      "mxc_nand_read_word(col = %d)\n", host->col_addr);
+
+	col = host->col_addr;
+	/* Adjust saved column address */
+	if (col < mtd->writesize && host->spare_only)
+		col += mtd->writesize;
+
+	if (col < mtd->writesize) {
+		p = (uint16_t __iomem *)(host->regs->main_area0 + (col >> 1));
+	} else {
+		p = (uint16_t __iomem *)(host->regs->spare_area0 +
+				((col - mtd->writesize) >> 1));
+	}
+
+	if (col & 1) {
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 451

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+		rd_word = readw(p);
+		ret = (rd_word >> 8) & 0xff;
+		rd_word = readw(&p[1]);
+		ret |= (rd_word << 8) & 0xff00;
+

col should never be odd if you're reading words.

It can be odd if previously we've read a byte.

Quoted 24 lines
Quoted 24 lines
drivers/mtd/nand/mxc_nand.c new file +24 -0
+/*
+ * Write data of length len to buffer buf. The data to be
+ * written on NAND Flash is first copied to RAMbuffer. After the Data Input
+ * Operation by the NFC, the data is written to NAND Flash
+ */
+static void mxc_nand_write_buf(struct mtd_info *mtd,
+				const u_char *buf, int len)
+{
+	struct nand_chip *nand_chip = mtd->priv;
+	struct mxc_nand_host *host = nand_chip->priv;
+	int n, col, i = 0;
+
+	MTDDEBUG(MTD_DEBUG_LEVEL3,
+	      "mxc_nand_write_buf(col = %d, len = %d)\n", host->col_addr,
+	      len);
+
+	col = host->col_addr;
+
+	/* Adjust saved column address */
+	if (col < mtd->writesize && host->spare_only)
+		col += mtd->writesize;
+
+	n = mtd->writesize + mtd->oobsize - col;
+	n = min(len, n);
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 490

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+
+	MTDDEBUG(MTD_DEBUG_LEVEL3,
+	      "%s:%d: col = %d, n = %d\n", __func__, __LINE__, col, n);
+
+	while (n) {

Safer to do while (n > 0), especially when the code is this complex.

Fixed.

Quoted 18 lines
Quoted 4 lines
drivers/mtd/nand/mxc_nand.c new file +3 -0
+		void __iomem *p;
+
+		if (col < mtd->writesize) {

drivers/mtd/nand/mxc_nand.c line 503

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+			p = host->regs->main_area0 + (col & ~3);
+		} else {
+			p = host->regs->spare_area0 -
+						mtd->writesize + (col & ~3);
+		}
+
+		MTDDEBUG(MTD_DEBUG_LEVEL3, "%s:%d: p = %p\n", __func__,
+		      __LINE__, p);
+
+		if (((col | (int)&buf[i]) & 3) || n < 16) {

Do not cast pointers to "int". Use "uintptr_t" or "unsigned long" if you must.

Quoted 2 lines

Why < 16 and not < 4?

Fixed.

Quoted 8 lines

drivers/mtd/nand/mxc_nand.c line 507

Quoted 5 lines
drivers/mtd/nand/mxc_nand.c new file +4 -0
+			uint32_t data = 0;
+
+			if (col & 3 || n < 4)
+				data = readl(p);

If that condition doesn't hold, the data we use is zero?

If that condition doesn't hold we are going to rewrite a whole 32-bit word so there is no need to read it's old content. But I've changed that piece of code as you suggested anyway.

Quoted 41 lines
Quoted 23 lines
drivers/mtd/nand/mxc_nand.c new file +22 -0
+
+			switch (col & 3) {
+			case 0:
+				if (n) {
+					data = (data & 0xffffff00) |
+					    (buf[i++] << 0);
+					n--;
+					col++;
+				}
+			case 1:
+				if (n) {
+					data = (data & 0xffff00ff) |
+					    (buf[i++] << 8);
+					n--;
+					col++;
+				}
+			case 2:
+				if (n) {
+					data = (data & 0xff00ffff) |
+					    (buf[i++] << 16);
+					n--;
+					col++;

drivers/mtd/nand/mxc_nand.c line 540

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+				}
+			case 3:
+				if (n) {
+					data = (data & 0x00ffffff) |
+					    (buf[i++] << 24);
+					n--;
+					col++;
+				}
+			}
+			writel(data, p);

Might I suggest this?

union {
	uint32_t word;
	uint8_t bytes[4];
} nfc_word;
Quoted 9 lines

nfc_word.word = readl(p);
nfc_word.bytes[col & 3] = buf[i++];
n--;
col++;

writel(nfc_word.word, p);

As a side benefit, you lose the endian dependency.

Thanks! I've used your code.

Quoted 5 lines

drivers/mtd/nand/mxc_nand.c line 553

Quoted 2 lines
drivers/mtd/nand/mxc_nand.c new file +1 -0
+			mxc_nand_memcpy32(p, (void *)&buf[i], m);

Unnecessary cast.

Fixed.

Quoted 8 lines

drivers/mtd/nand/mxc_nand.c line 594

Quoted 5 lines
drivers/mtd/nand/mxc_nand.c new file +4 -0
+	/* Update saved column address */
+	host->col_addr = col;
+
+}

No blank lines before the brace at the end of a block.

Fixed.

Quoted 5 lines
Quoted 5 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+
+/*
+ * Used by the upper layer to verify the data in NAND Flash
+ * with the data in the buf.
+ */
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 653

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+static int mxc_nand_verify_buf(struct mtd_info *mtd,
+				const u_char *buf, int len)
+{
+	return -EFAULT;
+}

Umm...

I've added verify_buf function.

Quoted 11 lines
Quoted 11 lines
drivers/mtd/nand/mxc_nand.c new file +11 -0
+	case NAND_CMD_SEQIN:
+		if (column >= mtd->writesize) {
+			/*
+			 * FIXME: before send SEQIN command for write OOB,
+			 * We must read one page out.
+			 * For K9F1GXX has no READ1 command to set current HW
+			 * pointer to spare area, we must write the whole page
+			 * including OOB together.
+			 */
+			if (host->pagesize_2k) {
+				/* call ourself to read a page */
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 748

Quoted 4 lines
drivers/mtd/nand/mxc_nand.c new file +3 -0
+				mxc_nand_command(mtd, NAND_CMD_READ0, 0,
+						page_addr);
+			}

Should this be #ifdef HWECC? And update the comment to indicate the actual problem, which is the unusual hardware ECC implementation. I don't see what the lack of a "READ1" command has to do with it.

I've updated the comment.

Quoted 29 lines

And is this actually a FIXME if it's already being done?

Quoted 11 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+#ifdef CONFIG_MXC_NAND_HWECC
+	this->ecc.calculate = mxc_nand_calculate_ecc;
+	this->ecc.hwctl = mxc_nand_enable_hwecc;
+	this->ecc.correct = mxc_nand_correct_data;
+	this->ecc.mode = NAND_ECC_HW;
+	this->ecc.size = 512;
+	this->ecc.bytes = 3;
+	this->ecc.layout = &nand_hw_eccoob_8;
+	tmp = readw(&host->regs->nfc_config1);
+	tmp |= NFC_ECC_EN;

drivers/mtd/nand/mxc_nand.c line 904

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+	writew(tmp, &host->regs->nfc_config1);
+#else
+	this->ecc.size = 512;
+	this->ecc.bytes = 3;
+	this->ecc.layout = &nand_hw_eccoob_8;
+	this->ecc.mode = NAND_ECC_SOFT;
+	tmp = readw(&host->regs->nfc_config1);
+	tmp &= ~NFC_ECC_EN;
+	writew(tmp, &host->regs->nfc_config1);
+#endif

Soft ECC only supports 256-byte ECC blocks (anything you set here to the contrary will just be overwritten), and you'll need a layout that accommodates that with enough ECC bytes.

Quoted 9 lines

Alternatively, you can implement 512-byte soft ECC if you don't want to waste those 3 extra OOB bytes. :-)

drivers/mtd/nand/mxc_nand.c line 928

Quoted 2 lines
drivers/mtd/nand/mxc_nand.c new file +1 -0
+	host->pagesize_2k = 0;

So large page is currently unsupported?

Linux driver was fixed recently and now it claims to support 2K page size... I've added all needed fixes but I can understand how this driver should detect the pagesize... Linux driver calls nand_scan_ident() itself for this... Do you think I can calls nand_scan_ident() from my board_nand_init() function?

Regards, Ilya.

author
#19 lore raw

PATCH 1/1 mxc_nand: add nand driver for MX2/MX3

Driver for NFC NAND controller found on Freescale's MX2 and MX3 processors. Ported from Linux. Tested only with i.MX27 but should works with other MX2 and MX3 processors too.

---
 drivers/mtd/nand/Makefile   |    1 +
 drivers/mtd/nand/mxc_nand.c |  902 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 903 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/Makefile +1 -0
index a5680e8..e068676 100644
@@ -42,6 +42,7 @@ COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
 COBJS-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o
+COBJS-$(CONFIG_NAND_MXC) += mxc_nand.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
 COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
drivers/mtd/nand/mxc_nand.c new file +902 -0

902 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#20 lore raw

PATCH 1/1 mxc_nand: add nand driver for MX2/MX3

Quoted 10 lines · Ilya Yanok

Driver for NFC NAND controller found on Freescale's MX2 and MX3 processors. Ported from Linux. Tested only with i.MX27 but should works with other MX2 and MX3 processors too.

---
 drivers/mtd/nand/Makefile   |    1 +
 drivers/mtd/nand/mxc_nand.c |  902 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 903 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/mxc_nand.c

Scott for you is it fine?

Best Regards,
J.

#21 lore raw

PATCH 1/1 mxc_nand: add nand driver for MX2/MX3

In reply to Ilya Yanok
Quoted 4 lines · Ilya Yanok
drivers/mtd/nand/mxc_nand.c new file +4 -0
+/* OOB placement block for use with hardware ecc generation */
+static struct nand_ecclayout nand_hw_eccoob = {
+	.eccbytes = 5,
+	.eccpos = {6, 7, 8, 9, 10},

drivers/mtd/nand/mxc_nand.c line 150

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+	.oobfree = {{0, 5}, {11, 5}, }
+};
+
+#ifndef CONFIG_MXC_NAND_HWECC
+static struct nand_ecclayout nand_hw_eccoob_soft = {
+	.eccbytes = 6,
+	.eccpos = {6, 7, 8, 9, 10, 11},
+	.oobfree = {{0, 5}, {12, 4}, }
+};
+#endif

Why is one struct #ifndef, but the other isn't #ifdef?

drivers/mtd/nand/mxc_nand.c line 227

Quoted 11 lines
drivers/mtd/nand/mxc_nand.c new file +11 -0
+/*
+ * This function requests the NANDFC to initate the transfer
+ * of data currently in the NANDFC RAM buffer to the NAND device.
+ */
+static void send_prog_page(struct mxc_nand_host *host, uint8_t buf_id,
+			int spare_only)
+{
+	MTDDEBUG(MTD_DEBUG_LEVEL3, "send_prog_page (%d)\n", spare_only);
+
+	/* NANDFC buffer 0 is used for page read/write */
+	writew(buf_id, &host->regs->nfc_buf_addr);

Comment does not match code.

Quoted 5 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+	/*
+	 * NANDFC buffer 1 is used for device status to prevent
+	 * corruption of read/write buffer on status requests.
+	 */
+	writew(1, &host->regs->nfc_buf_addr);
author
#22 lore raw

PATCH 1/1 mxc_nand: add nand driver for MX2/MX3

Driver for NFC NAND controller found on Freescale's MX2 and MX3 processors. Ported from Linux. Tested only with i.MX27 but should works with other MX2 and MX3 processors too.

---
 drivers/mtd/nand/Makefile   |    1 +
 drivers/mtd/nand/mxc_nand.c |  902 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 903 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/Makefile +1 -0
index 89ccec2..ea8572f 100644
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
 COBJS-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o
+COBJS-$(CONFIG_NAND_MXC) += mxc_nand.o
 COBJS-$(CONFIG_NAND_NDFC) += ndfc.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
drivers/mtd/nand/mxc_nand.c new file +902 -0

902 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#23 lore raw

PATCH 1/1 mxc_nand: add nand driver for MX2/MX3

drivers/mtd/nand/mxc_nand.c line 298

Quoted 9 lines · Ilya Yanok
drivers/mtd/nand/mxc_nand.c new file +9 -0
+	if (this->options & NAND_BUSWIDTH_16) {
+		void __iomem *main_buf = host->regs->main_area0;
+		/* compress the ID info */
+		writeb(readb(main_buf + 2), main_buf + 1);
+		writeb(readb(main_buf + 4), main_buf + 2);
+		writeb(readb(main_buf + 6), main_buf + 3);
+		writeb(readb(main_buf + 8), main_buf + 4);
+		writeb(readb(main_buf + 10), main_buf + 5);
+	}

This indicates that read_byte isn't doing what the generic NAND code is expecting. It should advance by a word in the buffer for each byte read -- the implementation of nand_read_byte16 confirms this.

In that case, though, why have separate read_byte and read_word? Just to provide an endian-broken alternative, that is only used where endianness doesn't matter (checking bad block markers)? :-(

drivers/mtd/nand/mxc_nand.c line 453

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c new file +10 -0
+	if (col & 1) {
+		union {
+			uint16_t word;
+			uint8_t bytes[2];
+		} nfc_word;
+
+		nfc_word.word = readw(p);
+		ret = nfc_word.bytes[1];
+		nfc_word.word = readw(&p[1]);
+		ret |= nfc_word.bytes[0] << 16;

This still has an endian assumption (and shouldn't << 16 be << 8, and require a cast to avoid shifting beyond the type width?) -- it's moot given the nature of read_byte and read_word, but if this were necessary it should be something like:

union {
	...
} nfc_word[3];

nfc_word[0] = readw(p);
nfc_word[1] = readw(p + 1);

nfc_word[2].bytes[0] = nfc_word[0].bytes[1];
nfc_word[2].bytes[1] = nfc_word[1].bytes[0];

ret = nfc_word[2].word;

Alternatively, you could apply le16_to_cpu to the result of something like your version.

-Scott

author
#24 lore raw

PATCH 1/1 mxc_nand: add nand driver for MX2/MX3

Driver for NFC NAND controller found on Freescale's MX2 and MX3 processors. Ported from Linux. Tested only with i.MX27 but should works with other MX2 and MX3 processors too.

---
 drivers/mtd/nand/Makefile   |    1 +
 drivers/mtd/nand/mxc_nand.c |  880 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 881 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/Makefile +1 -0
index 89ccec2..ea8572f 100644
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
 COBJS-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o
+COBJS-$(CONFIG_NAND_MXC) += mxc_nand.o
 COBJS-$(CONFIG_NAND_NDFC) += ndfc.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
drivers/mtd/nand/mxc_nand.c new file +880 -0

880 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#25 lore raw

PATCH 1/1 mxc_nand: add nand driver for MX2/MX3

Quoted 5 lines · Ilya Yanok

Driver for NFC NAND controller found on Freescale's MX2 and MX3 processors. Ported from Linux. Tested only with i.MX27 but should works with other MX2 and MX3 processors too.

Applied to u-boot-nand-flash/next.

-Scott

author
#26 lore raw

PATCH 1/1 mxc_nand: add nand driver for MX2/MX3

In reply to Scott Wood

Hi Scott,

thanks for the review.

Quoted 9 lines · Scott Wood
Quoted 9 lines
drivers/mtd/nand/mxc_nand.c new file +9 -0
+/* OOB placement block for use with hardware ecc generation */
+static struct nand_ecclayout nand_hw_eccoob = {
+	.eccbytes = 5,
+	.eccpos = {6, 7, 8, 9, 10},
+	.oobfree = {{0, 5}, {11, 5}, }
+};
+
+#ifndef CONFIG_MXC_NAND_HWECC
+static struct nand_ecclayout nand_hw_eccoob_soft = {
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 150

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+	.eccbytes = 6,
+	.eccpos = {6, 7, 8, 9, 10, 11},
+	.oobfree = {{0, 5}, {12, 4}, }
+};
+#endif

Why is one struct #ifndef, but the other isn't #ifdef?

Fixed.

Quoted 6 lines
Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +6 -0
+/*
+ * This function requests the NANDFC to initate the transfer
+ * of data currently in the NANDFC RAM buffer to the NAND device.
+ */
+static void send_prog_page(struct mxc_nand_host *host, uint8_t buf_id,
+			int spare_only)
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 227

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+{
+	MTDDEBUG(MTD_DEBUG_LEVEL3, "send_prog_page (%d)\n", spare_only);
+
+	/* NANDFC buffer 0 is used for page read/write */
+	writew(buf_id, &host->regs->nfc_buf_addr);

Comment does not match code.

Comment removed.

Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 320

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+	/*
+	 * NANDFC buffer 1 is used for device status to prevent
+	 * corruption of read/write buffer on status requests.
+	 */
+	writew(1, &host->regs->nfc_buf_addr);

From discussion on the previous patch:

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

But it looks like buffer 1 is used for data with large page flash.

Well, we save first word of the buffer and then recover it.

So then there's no longer any special reason to use buffer 1 for status, and that comment is misleading...

Misleading comment removed.

Quoted 26 lines
Quoted 26 lines
drivers/mtd/nand/mxc_nand.c new file +26 -0
+static u_char mxc_nand_read_byte(struct mtd_info *mtd)
+{
+	struct nand_chip *nand_chip = mtd->priv;
+	struct mxc_nand_host *host = nand_chip->priv;
+	uint8_t ret = 0;
+	uint16_t col, rd_word;
+	uint16_t __iomem *main_buf =
+		(uint16_t __iomem *)host->regs->main_area0;
+	uint16_t __iomem *spare_buf =
+		(uint16_t __iomem *)host->regs->spare_area0;
+
+	/* Check for status request */
+	if (host->status_request)
+		return get_dev_status(host) & 0xFF;
+
+	/* Get column for 16-bit access */
+	col = host->col_addr >> 1;
+
+	/* If we are accessing the spare region */
+	if (host->spare_only)
+		rd_word = readw(&spare_buf[col]);
+	else
+		rd_word = readw(&main_buf[col]);
+
+	/* Pick upper/lower byte of word from RAM buffer */
+	if (host->col_addr & 0x1)
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 418

Quoted 4 lines
drivers/mtd/nand/mxc_nand.c new file +3 -0
+		ret = (rd_word >> 8) & 0xFF;
+	else
+		ret = rd_word & 0xFF;

Use a union, as in read_buf(). Otherwise, this breaks on big-endian -- you may not care, but it's better to not have such dependencies lurking in the code that could be reused who-knows-where.

Ok. Fixed.

Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 452

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+	if (col & 1) {
+		rd_word = readw(p);
+		ret = (rd_word >> 8) & 0xff;
+		rd_word = readw(&p[1]);
+		ret |= (rd_word << 8) & 0xff00;

Again, this is unnecessary, but if you insist, use a union.

I understood that read_byte()/read_word() never mix up in existing code but the API doesn't completely exclude such possibility so I'd like this case to be treated correctly. I've updated the code to use union but if you insist I'll remove this if clause completely.

Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 636

Quoted 5 lines
drivers/mtd/nand/mxc_nand.c new file +4 -0
+#ifdef CONFIG_MTD_NAND_MXC_FORCE_CE
+	if (chip > 0) {
+		MTDDEBUG(MTD_DEBUG_LEVEL0,
+		      "ERROR:  Illegal chip select (chip = %d)\n", chip);

If it's an error, that's not exactly debug (especially since there's no way to propagate the error upwards)...

Changed to printf().

Quoted 7 lines
Quoted 7 lines
drivers/mtd/nand/mxc_nand.c new file +7 -0
+		return;
+	}
+
+	if (chip == -1) {
+		writew(readw(&host->regs->nfc_config1) & ~NFC_CE,
+				&host->regs->nfc_config1);
+		return;
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 648

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+	}
+
+	writew(readw(&host->regs->nfc_config1) | NFC_CE,
+			&host->regs->nfc_config1);
+#endif

#else?

For me it just works (I've never defined CONFIG_MTD_NAND_MXC_FORCE_CE).

Quoted 8 lines
Quoted 8 lines
drivers/mtd/nand/mxc_nand.c new file +8 -0
+		if (column >= mtd->writesize) {
+			/*
+			 * before sending SEQIN command for partial write,
+			 * we need read one page out. FSL NFC does not support
+			 * partial write. It alway send out 512+ecc+512+ecc ...
+			 * for large page nand flash. But for small page nand
+			 * flash, it does support SPARE ONLY operation.
+			 */
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 717

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+			if (host->pagesize_2k) {
+				/* call ourself to read a page */
+				mxc_nand_command(mtd, NAND_CMD_READ0, 0,
+						page_addr);
+			}

#ifdef CONFIG_MXC_NAND_HWECC?

Uh... I have to admit I don't really have clear understanding of this problem and I can't find it's description in i.MX27 Reference Manual... Maybe you can point me in some direction? For now I'm not sure if putting this under #ifdef won't break something...

Quoted 6 lines

drivers/mtd/nand/mxc_nand.c line 845

Quoted 3 lines
drivers/mtd/nand/mxc_nand.c new file +2 -0
+	/* 50 us command delay time */
+	this->chip_delay = 5;

5 or 50?

Comment fixed.

Quoted 7 lines

drivers/mtd/nand/mxc_nand.c line 899

Quoted 2 lines
drivers/mtd/nand/mxc_nand.c new file +1 -0
+	host->pagesize_2k = 0;

Make this board-configurable. Has large page been tested? If not, perhaps it should stay out for now, given how weird it is on this controller.

I've never tested it with large page devices... So I'd vote to leave large-page support disabled.

Regards, Ilya.

#27 lore raw

PATCH 1/1 mxc_nand: add nand driver for MX2/MX3

Quoted 17 lines · Ilya Yanok
Quoted 7 lines
Quoted 7 lines
drivers/mtd/nand/mxc_nand.c new file +7 -0
+		return;
+	}
+
+	if (chip == -1) {
+		writew(readw(&host->regs->nfc_config1) & ~NFC_CE,
+				&host->regs->nfc_config1);
+		return;
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 648

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+	}
+
+	writew(readw(&host->regs->nfc_config1) | NFC_CE,
+			&host->regs->nfc_config1);
+#endif

#else?

Quoted 1 line

For me it just works (I've never defined CONFIG_MTD_NAND_MXC_FORCE_CE).

If you've never defined it, how do you know it "just works"? :-)

Under what circumstances would one define it? Should we take it out, to be added later by someone who can test it, and understands it better?

Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
drivers/mtd/nand/mxc_nand.c new file +8 -0
+		if (column >= mtd->writesize) {
+			/*
+			 * before sending SEQIN command for partial write,
+			 * we need read one page out. FSL NFC does not support
+			 * partial write. It alway send out 512+ecc+512+ecc ...
+			 * for large page nand flash. But for small page nand
+			 * flash, it does support SPARE ONLY operation.
+			 */
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 717

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+			if (host->pagesize_2k) {
+				/* call ourself to read a page */
+				mxc_nand_command(mtd, NAND_CMD_READ0, 0,
+						page_addr);
+			}

#ifdef CONFIG_MXC_NAND_HWECC?

Quoted 4 lines

Uh... I have to admit I don't really have clear understanding of this problem and I can't find it's description in i.MX27 Reference Manual... Maybe you can point me in some direction? For now I'm not sure if putting this under #ifdef won't break something...

It was my understanding that the whole reason for using soft ecc on this controller was to avoid the weird OOB layout. If you're only testing with hard ecc, though, then I'd leave it as is -- I don't want to make untested changes.

-Scott

#28 lore raw

PATCH 4/7 mxc_nand: add nand driver for MX2/MX3

In reply to Ilya Yanok
Quoted 8 lines · Ilya Yanok
Quoted 5 lines · Scott Wood

Please look at drivers/mtd/nand/mpc5121_nfc.c, which AFAICT is very similar hardware, and see if anything can be factored out into common code, and try to keep the rest looking the same except where the hardware actually differs.

Hmm... For now we just can't spend enough effort for this...

Understood -- but I have to grumble about it regardless. :-)

Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
drivers/mtd/nand/mxc_nand.c new file +13 -0
+/*
+ * This function requests the NANDFC to perform a read of the
+ * NAND device status and returns the current status.
+ */
+static uint16_t get_dev_status(struct mxc_nand_host *host)
+{
+	void __iomem *main_buf = host->regs->main_area1;
+	uint32_t store;
+	uint16_t ret, tmp;
+	/* Issue status request to NAND device */
+
+	/* store the main area1 first word, later do recovery */
+	store = readl(main_buf);
Quoted 9 lines

drivers/mtd/nand/mxc_nand.c line 318

Quoted 6 lines
drivers/mtd/nand/mxc_nand.c new file +5 -0
+	/*
+	 * NANDFC buffer 1 is used for device status to prevent
+	 * corruption of read/write buffer on status requests.
+	 */
+	writew(1, &host->regs->nfc_buf_addr);

But it looks like buffer 1 is used for data with large page flash.

Quoted 1 line

Well, we save first word of the buffer and then recover it.

So then there's no longer any special reason to use buffer 1 for status, and that comment is misleading...

Quoted 2 lines
Quoted 2 lines

Other drivers don't seem to have any problem with status reads clobbering the buffer...

What's different about this hardware in that regard? I'm wondering if you're being more tolerant than you need to be of status requests coming in at odd times.

Quoted 6 lines
Quoted 4 lines

According to Magnus Lilja, "the nand flash controller can only handle 32 bit read/write operations, any other size will cause an abort (or something like that)". But now we're accessing it as 16-bit?

16-bit accesses work quite well. Problem was with 8-bit accesses.

OK. But in that case I'd think it would have been simpler to use 16-bit accesses rather than 32-bit when emulating byte accesses in read_buf()/write_buf().

Quoted 4 lines
Quoted 2 lines

col should never be odd if you're reading words.

It can be odd if previously we've read a byte.

I don't think that accesses will ever be mixed in that way -- correct me if I'm wrong.

In fact, I only see one use of read_word, which is to read the bad block marker.

Quoted 11 lines
Quoted 5 lines

drivers/mtd/nand/mxc_nand.c line 928

Quoted 2 lines
drivers/mtd/nand/mxc_nand.c new file +1 -0
+	host->pagesize_2k = 0;

So large page is currently unsupported?

Linux driver was fixed recently and now it claims to support 2K page size... I've added all needed fixes but I can understand how this driver should detect the pagesize... Linux driver calls nand_scan_ident() itself for this... Do you think I can calls nand_scan_ident() from my board_nand_init() function?

No, at the moment you should probably just hard code it in the board config file. I need to find some time to rework the NAND init mechanism to be driven more from platform code so that it can split up nand_scan_ident() and nand_scan_tail().

-Scott

author
#29 lore raw

PATCH v3 5/7 mxc-mmc: sdhc host driver for MX2 and MX3 proccessor

In reply to Ilya Yanok

This is a port of Linux driver for SDHC host controller hardware found on Freescale's MX2 and MX3 processors. Uses new generic MMC framework (CONFIG_GENERIC_MMC) and it looks like there are some problems with a framework (at least on LE cpus). Some of these problems are addressed in the following patches.

---
 cpu/arm926ejs/mx27/generic.c       |   16 ++
 drivers/mmc/Makefile               |    1 +
 drivers/mmc/mxcmmc.c               |  523 ++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx27/mxcmmc.h |   25 ++
 4 files changed, 565 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/mxcmmc.c
 create mode 100644 include/asm-arm/arch-mx27/mxcmmc.h
cpu/arm926ejs/mx27/generic.c +16 -0
index b52f934..b1c8bed 100644
@@ -23,6 +23,9 @@
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
+#ifdef CONFIG_MXC_MMC
+#include <asm/arch/mxcmmc.h>
+#endif
 
 /*
  *  get the system pll clock in Hz
@@ -169,6 +172,19 @@ int cpu_eth_init(bd_t *bis)
 #endif
 }
 
+/*
+ * Initializes on-chip MMC controllers.
+ * to override, implement board_mmc_init()
+ */
+int cpu_mmc_init(bd_t *bis)
+{
+#ifdef CONFIG_MXC_MMC
+	return mxc_mmc_init(bis);
+#else
+	return 0;
+#endif
+}
+
 void imx_gpio_mode(int gpio_mode)
 {
 	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
drivers/mmc/Makefile +1 -0
index 1b0af12..6fa04b8 100644
@@ -30,6 +30,7 @@ COBJS-$(CONFIG_ATMEL_MCI) += atmel_mci.o
 COBJS-$(CONFIG_BFIN_SDH) += bfin_sdh.o
 COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o
 COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o
+COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o
 COBJS-$(CONFIG_PXA_MMC) += pxa_mmc.o
 
 COBJS	:= $(COBJS-y)
drivers/mmc/mxcmmc.c new file +523 -0

523 lines not on this page · raw message

include/asm-arm/arch-mx27/mxcmmc.h new file +25 -0
new file mode 100644
index 0000000..4c83cc7
@@ -0,0 +1,25 @@
+/*
+ *  Copyright (c) 2009 Ilya Yanok <[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
+ */
+
+#ifndef ASM_ARCH_MXCMMC_H
+#define ASM_ARCH_MXCMMC_H
+
+int mxc_mmc_init(bd_t *bis);
+
+#endif
Signature · 1 line
1.6.0.6
#30 lore raw

PATCH v3 5/7 mxc-mmc: sdhc host driver for MX2 and MX3 proccessor

Quoted 8 lines · Ilya Yanok

This is a port of Linux driver for SDHC host controller hardware found on Freescale's MX2 and MX3 processors. Uses new generic MMC framework (CONFIG_GENERIC_MMC) and it looks like there are some problems with a framework (at least on LE cpus). Some of these problems are addressed in the following patches.

---

seem ok to mee

Andy, Haavard for you?

Best Regards,
J.

#31 lore raw

PATCH 5/7 mxc-mmc: sdhc host driver for MX2 and MX3 proccessor

In reply to Ilya Yanok

Hi Ilya,

Quoted 5 lines

This is a port of Linux driver for SDHC host controller hardware found on Freescale's MX2 and MX3 processors. Uses new generic MMC framework (CONFIG_GENERIC_MMC) and it looks like there are some problems with a framework (at least on LE cpus). Some of these problems are addressed in the following patches.

Have you tested this driver interfaces to load a kernel image(uImage) from the SD card? Does it work for you?
Thanks,
Alfred.

#32 lore raw

PATCH v3 5/7 mxc-mmc: sdhc host driver for MX2 and MX3 proccessor

In reply to Ilya Yanok
Quoted 7 lines · Ilya Yanok

This is a port of Linux driver for SDHC host controller hardware found on Freescale's MX2 and MX3 processors. Uses new generic MMC framework (CONFIG_GENERIC_MMC) and it looks like there are some problems with a framework (at least on LE cpus). Some of these problems are addressed in the following patches.

Quoted 8 lines
---
 cpu/arm926ejs/mx27/generic.c       |   16 ++
 drivers/mmc/Makefile               |    1 +
 drivers/mmc/mxcmmc.c               |  523 ++++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mx27/mxcmmc.h |   25 ++
 4 files changed, 565 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/mxcmmc.c
 create mode 100644 include/asm-arm/arch-mx27/mxcmmc.h

applied to u-boot-arm

Best Regards,
J.

author
#33 lore raw

PATCH v3 6/7 arm: add support for CONFIG_GENERIC_MMC

In reply to Ilya Yanok
---
 lib_arm/board.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
lib_arm/board.c +7 -0
index 5d05d9b..268532f 100644
@@ -48,6 +48,7 @@
 #include <serial.h>
 #include <nand.h>
 #include <onenand_uboot.h>
+#include <mmc.h>
 
 #ifdef CONFIG_DRIVER_SMC91111
 #include "../drivers/net/smc91111.h"
@@ -439,6 +440,12 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
 #ifdef BOARD_LATE_INIT
 	board_late_init ();
 #endif
+
+#ifdef CONFIG_GENERIC_MMC
+	puts ("MMC:   ");
+	mmc_initialize (gd->bd);
+#endif
+
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
 	puts ("Net:   ");
Signature · 1 line
1.6.0.6
author
#35 lore raw

PATCH v3 7/7 imx27lite: add support for imx27lite board from LogicPD

In reply to Ilya Yanok

This patch adds support for i.MX27-LITEKIT development board from LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash, 64MB NAND flash, FEC ethernet controller integrated into i.MX27.

---
 MAINTAINERS                             |    1 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/logicpd/imx27lite/Makefile        |   51 +++++++
 board/logicpd/imx27lite/config.mk       |    1 +
 board/logicpd/imx27lite/imx27lite.c     |   97 +++++++++++++
 board/logicpd/imx27lite/lowlevel_init.S |  223 +++++++++++++++++++++++++++++++
 board/logicpd/imx27lite/u-boot.lds      |   56 ++++++++
 include/configs/imx27lite.h             |  195 +++++++++++++++++++++++++++
 9 files changed, 628 insertions(+), 0 deletions(-)
 create mode 100644 board/logicpd/imx27lite/Makefile
 create mode 100644 board/logicpd/imx27lite/config.mk
 create mode 100644 board/logicpd/imx27lite/imx27lite.c
 create mode 100644 board/logicpd/imx27lite/lowlevel_init.S
 create mode 100644 board/logicpd/imx27lite/u-boot.lds
 create mode 100644 include/configs/imx27lite.h
MAINTAINERS +1 -0
index 3d50668..98efd69 100644
@@ -519,6 +519,7 @@ George G. Davis <[email protected]>
 	gcplus		SA1100
 
 Wolfgang Denk <[email protected]>
+	imx27lite	i.MX27
 	qong		i.MX31
 
 Thomas Elste <[email protected]>
MAKEALL +1 -0
index 57dd425..2aaec13 100755
@@ -504,6 +504,7 @@ LIST_ARM9="			\
 	cp926ejs		\
 	cp946es			\
 	cp966			\
+	imx27lite		\
 	lpd7a400		\
 	mx1ads			\
 	mx1fs2			\
Makefile +3 -0
index 24e6410..cd02a36 100644
@@ -2790,6 +2790,9 @@ davinci_sffsdr_config :	unconfig
 davinci_sonata_config :	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs sonata davinci davinci
 
+imx27lite_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
+
 lpd7a400_config \
 lpd7a404_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm lh7a40x lpd7a40x
board/logicpd/imx27lite/Makefile new file +51 -0

51 lines not on this page · raw message

board/logicpd/imx27lite/config.mk new file +1 -0
new file mode 100644
index 0000000..a2e7768
@@ -0,0 +1 @@
+TEXT_BASE = 0xA7F00000
board/logicpd/imx27lite/imx27lite.c new file +97 -0

97 lines not on this page · raw message

board/logicpd/imx27lite/lowlevel_init.S new file +223 -0

223 lines not on this page · raw message

board/logicpd/imx27lite/u-boot.lds new file +56 -0

56 lines not on this page · raw message

include/configs/imx27lite.h new file +195 -0

195 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#36 lore raw

PATCH v3 7/7 imx27lite: add support for imx27lite board from LogicPD

Quoted 28 lines · Ilya Yanok

This patch adds support for i.MX27-LITEKIT development board from LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash, 64MB NAND flash, FEC ethernet controller integrated into i.MX27.

---
 MAINTAINERS                             |    1 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/logicpd/imx27lite/Makefile        |   51 +++++++
 board/logicpd/imx27lite/config.mk       |    1 +
 board/logicpd/imx27lite/imx27lite.c     |   97 +++++++++++++
 board/logicpd/imx27lite/lowlevel_init.S |  223 +++++++++++++++++++++++++++++++
 board/logicpd/imx27lite/u-boot.lds      |   56 ++++++++
 include/configs/imx27lite.h             |  195 +++++++++++++++++++++++++++
 9 files changed, 628 insertions(+), 0 deletions(-)
 create mode 100644 board/logicpd/imx27lite/Makefile
 create mode 100644 board/logicpd/imx27lite/config.mk
 create mode 100644 board/logicpd/imx27lite/imx27lite.c
 create mode 100644 board/logicpd/imx27lite/lowlevel_init.S
 create mode 100644 board/logicpd/imx27lite/u-boot.lds
 create mode 100644 include/configs/imx27lite.h
MAINTAINERS +0 -0
index 3d50668..98efd69 100644

MAINTAINERS George G. Davis <[email protected]> · line 522

Quoted 4 lines
MAINTAINERS +1 -0
@@ -519,6 +519,7 @@ George G. Davis <[email protected]>
 	gcplus		SA1100
 
 Wolfgang Denk <[email protected]>
+	imx27lite	i.MX27

Wolfgang could you ack it?

Quoted 15 lines
MAINTAINERS +0 -0
 	qong		i.MX31
 
 Thomas Elste <[email protected]>
MAKEALL +1 -0
index 57dd425..2aaec13 100755
@@ -504,6 +504,7 @@ LIST_ARM9="			\
 	cp926ejs		\
 	cp946es			\
 	cp966			\
+	imx27lite		\
 	lpd7a400		\
 	mx1ads			\
 	mx1fs2			\

<snip>

Quoted 35 lines
board/logicpd/imx27lite/imx27lite.c new file +29 -0
new file mode 100644
index 0000000..7c2658c
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2007 Sascha Hauer, Pengutronix
+ * Copyright (C) 2008,2009 Eric Jarrige <[email protected]>
+ * Copyright (C) 2009 Ilya Yanok <[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 <common.h>
+#include <asm/arch/imx-regs.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int imx27lite_devices_init(void)
+{

board/logicpd/imx27lite/imx27lite.c line 39

Quoted 10 lines
board/logicpd/imx27lite/imx27lite.c new file +10 -0
+	int i;
+	unsigned int mode[] = {
+		PD0_AIN_FEC_TXD0,
+		PD1_AIN_FEC_TXD1,
+		PD2_AIN_FEC_TXD2,
+		PD3_AIN_FEC_TXD3,
+		PD4_AOUT_FEC_RX_ER,
+		PD5_AOUT_FEC_RXD1,
+		PD6_AOUT_FEC_RXD2,
+		PD7_AOUT_FEC_RXD3,

please create a device init api as done for at91 davinci as example

Quoted 30 lines
board/logicpd/imx27lite/imx27lite.c new file +30 -0
+		PD8_AF_FEC_MDIO,
+		PD9_AIN_FEC_MDC | GPIO_PUEN,
+		PD10_AOUT_FEC_CRS,
+		PD11_AOUT_FEC_TX_CLK,
+		PD12_AOUT_FEC_RXD0,
+		PD13_AOUT_FEC_RX_DV,
+		PD14_AOUT_FEC_CLR,
+		PD15_AOUT_FEC_COL,
+		PD16_AIN_FEC_TX_ER,
+		PF23_AIN_FEC_TX_EN,
+		PE12_PF_UART1_TXD,
+		PE13_PF_UART1_RXD,
+		PB4_PF_SD2_D0,
+		PB5_PF_SD2_D1,
+		PB6_PF_SD2_D2,
+		PB7_PF_SD2_D3,
+		PB8_PF_SD2_CMD,
+		PB9_PF_SD2_CLK,
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);
+
+	return 0;
+}
+
+int board_init (void)
+{
+	gd->bd->bi_arch_number = MACH_TYPE_IMX27LITE;
+	gd->bd->bi_boot_params = 0xa0000100;

board/logicpd/imx27lite/imx27lite.c line 79

Quoted 10 lines
board/logicpd/imx27lite/imx27lite.c new file +10 -0
+
+	imx27lite_devices_init();
+
+	return 0;
+}
+
+int dram_init (void)
+{
+
+#if ( CONFIG_NR_DRAM_BANKS > 0 )

no need of ()
please remove

Quoted 85 lines
board/logicpd/imx27lite/imx27lite.c new file +18 -0
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = get_ram_size((volatile void *)PHYS_SDRAM_1,
+			PHYS_SDRAM_1_SIZE);
+#endif
+#if ( CONFIG_NR_DRAM_BANKS > 1 )
+	gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+	gd->bd->bi_dram[1].size = get_ram_size((volatile void *)PHYS_SDRAM_2,
+			PHYS_SDRAM_2_SIZE);
+#endif
+
+	return 0;
+}
+
+int checkboard(void)
+{
+	printf("LogicPD imx27lite\n");
+	return 0;
+}
board/logicpd/imx27lite/lowlevel_init.S new file +61 -0
new file mode 100644
index 0000000..ba02ad4
@@ -0,0 +1,223 @@
+/*
+ * For clock initialization, see chapter 3 of the "MCIMX27 Multimedia
+ * Applications Processor Reference Manual, Rev. 0.2".
+ *
+ * (C) Copyright 2008 Eric Jarrige <[email protected]>
+ * (C) Copyright 2009 Ilya Yanok <[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 <config.h>
+#include <version.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/asm-offsets.h>
+
+#define SDRAM_ESDCFG_REGISTER_VAL(cas)	\
+		(ESDCFG_TRC(10) |	\
+		ESDCFG_TRCD(3) |	\
+		ESDCFG_TCAS(cas) |	\
+		ESDCFG_TRRD(1) |	\
+		ESDCFG_TRAS(5) |	\
+		ESDCFG_TWR |		\
+		ESDCFG_TMRD(2) |	\
+		ESDCFG_TRP(2) |		\
+		ESDCFG_TXP(3))
+
+#define SDRAM_ESDCTL_REGISTER_VAL	\
+		(ESDCTL_PRCT(0) |	\
+		 ESDCTL_BL |		\
+		 ESDCTL_PWDT(0) |	\
+		 ESDCTL_SREFR(3) |	\
+		 ESDCTL_DSIZ_32 |	\
+		 ESDCTL_COL10 |		\
+		 ESDCTL_ROW13 |		\
+		 ESDCTL_SDE)
+
+#define SDRAM_ALL_VAL		0xf00
+
+#define SDRAM_MODE_REGISTER_VAL	0x33	/* BL: 8, CAS: 3 */
+#define SDRAM_EXT_MODE_REGISTER_VAL	0x1000000
+
+#define MPCTL0_VAL	0x1ef15d5
+
+#define SPCTL0_VAL	0x043a1c09
+
+#define CSCR_VAL	0x33f08107
+

board/logicpd/imx27lite/lowlevel_init.S line 71

Quoted 10 lines
board/logicpd/imx27lite/lowlevel_init.S new file +10 -0
+#define PCDR0_VAL	0x120470c3
+#define PCDR1_VAL	0x03030303
+#define PCCR0_VAL	0xffffffff
+#define PCCR1_VAL	0xfffffffc
+
+#define AIPI1_PSR0_VAL	0x20040304
+#define AIPI1_PSR1_VAL	0xdffbfcfb
+#define AIPI2_PSR0_VAL	0x07ffc200
+#define AIPI2_PSR1_VAL	0xffffffff
+

please move those define to the config header

board/logicpd/imx27lite/lowlevel_init.S line 75

Quoted 4 lines
board/logicpd/imx27lite/lowlevel_init.S new file +4 -0
+#define writel(reg, val) \
+	ldr		r0,	=reg;	\
+	ldr		r1,	=val;	\
+	str		r1,   [r0];

please use write32

Quoted 4 lines
board/logicpd/imx27lite/lowlevel_init.S new file +4 -0
+
+SOC_ESDCTL_BASE_W:	.word	IMX_ESD_BASE
+SOC_SI_ID_REG_W:	.word	IMX_SYSTEM_CTL_BASE
+SDRAM_ESDCFG_T1_W:	.word	SDRAM_ESDCFG_REGISTER_VAL(0)

board/logicpd/imx27lite/lowlevel_init.S line 89

Quoted 10 lines
board/logicpd/imx27lite/lowlevel_init.S new file +10 -0
+SDRAM_ESDCFG_T2_W:	.word	SDRAM_ESDCFG_REGISTER_VAL(3)
+SDRAM_PRECHARGE_CMD_W:	.word	(ESDCTL_SDE | ESDCTL_SMODE_PRECHARGE | \
+				 ESDCTL_ROW13 | ESDCTL_COL10)
+SDRAM_AUTOREF_CMD_W:	.word	(ESDCTL_SDE | ESDCTL_SMODE_AUTO_REF | \
+				 ESDCTL_ROW13 | ESDCTL_COL10)
+SDRAM_LOADMODE_CMD_W:	.word	(ESDCTL_SDE | ESDCTL_SMODE_LOAD_MODE | \
+				 ESDCTL_ROW13 | ESDCTL_COL10)
+SDRAM_NORMAL_CMD_W:	.word	SDRAM_ESDCTL_REGISTER_VAL
+
+	.macro init_aipi

please indent it as
.macro x

	....

.endm

Quoted 42 lines
board/logicpd/imx27lite/lowlevel_init.S new file +42 -0
+	/*
+	 * setup AIPI1 and AIPI2
+	 */
+	writel(AIPI1_PSR0, AIPI1_PSR0_VAL)
+	writel(AIPI1_PSR1, AIPI1_PSR1_VAL)
+	writel(AIPI2_PSR0, AIPI2_PSR0_VAL)
+	writel(AIPI2_PSR1, AIPI2_PSR1_VAL)
+
+	.endm /* init_aipi */
+
+	.macro init_clock
+	ldr r0, =CSCR
+	/* disable MPLL/SPLL first */
+	ldr r1, [r0]
+	bic r1, r1, #(CSCR_MPEN|CSCR_SPEN)
+	str r1, [r0]
+
+	writel(MPCTL0, MPCTL0_VAL)
+	writel(SPCTL0, SPCTL0_VAL)
+
+	writel(CSCR, CSCR_VAL | CSCR_MPLL_RESTART | CSCR_SPLL_RESTART)
+
+	/*
+	 * add some delay here
+	 */
+	mov r1, #0x1000
+1:	subs r1, r1, #0x1
+	bne 1b
+
+	/* peripheral clock divider */
+	writel(PCDR0, PCDR0_VAL)
+	writel(PCDR1, PCDR1_VAL)
+
+	/* Configure PCCR0 and PCCR1 */
+	writel(PCCR0, PCCR0_VAL)
+	writel(PCCR1, PCCR1_VAL)
+
+	.endm /* init_clock */
+
+	.macro sdram_init
+	ldr r0, SOC_ESDCTL_BASE_W
+	mov r2, #PHYS_SDRAM_1

board/logicpd/imx27lite/lowlevel_init.S line 141

Quoted 10 lines
board/logicpd/imx27lite/lowlevel_init.S new file +10 -0
+
+	/* Do initial reset */
+	mov r1, #ESDMISC_MDDR_DL_RST
+	str r1, [r0, #ESDMISC_ROF]
+
+	/* Hold for more than 200ns */
+	ldr r1, =0x10000
+1:
+	subs r1, r1, #0x1
+	bne 1b

please use delay macro

Quoted 60 lines
board/logicpd/imx27lite/lowlevel_init.S new file +60 -0
+
+	/* Activate LPDDR iface */
+	mov r1, #ESDMISC_MDDREN
+	str r1, [r0, #ESDMISC_ROF]
+
+	/* Check The chip version TO1 or TO2 */
+	ldr r1, SOC_SI_ID_REG_W
+	ldr r1, [r1]
+	ands r1, r1, #0xF0000000
+	/* add Latency on CAS only for TO2 */
+	ldreq r1, SDRAM_ESDCFG_T2_W
+	ldrne r1, SDRAM_ESDCFG_T1_W
+	str r1, [r0, #ESDCFG0_ROF]
+
+	/* Run initialization sequence */
+	ldr r1, SDRAM_PRECHARGE_CMD_W
+	str r1, [r0, #ESDCTL0_ROF]
+	ldr r1, [r2, #SDRAM_ALL_VAL]
+
+	ldr r1, SDRAM_AUTOREF_CMD_W
+	str r1, [r0, #ESDCTL0_ROF]
+	ldr r1, [r2, #SDRAM_ALL_VAL]
+	ldr r1, [r2, #SDRAM_ALL_VAL]
+
+	ldr r1, SDRAM_LOADMODE_CMD_W
+	str r1, [r0, #ESDCTL0_ROF]
+	ldrb r1, [r2, #SDRAM_MODE_REGISTER_VAL]
+	add r3, r2, #SDRAM_EXT_MODE_REGISTER_VAL
+	ldrb r1, [r3]
+
+	ldr r1, SDRAM_NORMAL_CMD_W
+	str r1, [r0, #ESDCTL0_ROF]
+
+#if (CONFIG_NR_DRAM_BANKS > 1)
+	/* 2nd sdram */
+	mov r2, #PHYS_SDRAM_2
+
+	/* Check The chip version TO1 or TO2 */
+	ldr r1, SOC_SI_ID_REG_W
+	ldr r1, [r1]
+	ands r1, r1, #0xF0000000
+	/* add Latency on CAS only for TO2 */
+	ldreq r1, SDRAM_ESDCFG_T2_W
+	ldrne r1, SDRAM_ESDCFG_T1_W
+	str r1, [r0, #ESDCFG1_ROF]
+
+	/* Run initialization sequence */
+	ldr r1, SDRAM_PRECHARGE_CMD_W
+	str r1, [r0, #ESDCTL1_ROF]
+	ldr r1, [r2, #SDRAM_ALL_VAL]
+
+	ldr r1, SDRAM_AUTOREF_CMD_W
+	str r1, [r0, #ESDCTL1_ROF]
+	ldr r1, [r2, #SDRAM_ALL_VAL]
+	ldr r1, [r2, #SDRAM_ALL_VAL]
+
+	ldr r1, SDRAM_LOADMODE_CMD_W
+	str r1, [r0, #ESDCTL1_ROF]
+	ldrb r1, [r2, #SDRAM_MODE_REGISTER_VAL]
+	add r3, r2, #SDRAM_EXT_MODE_REGISTER_VAL

board/logicpd/imx27lite/lowlevel_init.S line 211

Quoted 10 lines
board/logicpd/imx27lite/lowlevel_init.S new file +10 -0
+	ldrb r1, [r3]
+
+	ldr r1, SDRAM_NORMAL_CMD_W
+	str r1, [r0, #ESDCTL1_ROF]
+#endif  /* CONFIG_NR_DRAM_BANKS > 1 */
+
+	.endm /* sdram_init */
+
+	.globl board_init_lowlevel
+	board_init_lowlevel:

why do you need dual declaration???
and please indent it as
.globl lowlevel_init
lowlevel_init:

board/logicpd/imx27lite/u-boot.lds

Quoted 17 lines
board/logicpd/imx27lite/lowlevel_init.S new file +12 -0
+	.globl	lowlevel_init
+	lowlevel_init:
+
+	mov	r10, lr
+
+	init_aipi
+
+	init_clock
+
+	sdram_init
+
+	mov	pc,r10
board/logicpd/imx27lite/u-boot.lds new file +0 -0
new file mode 100644
index 0000000..f66f20e

no need please remove

Quoted 45 lines
include/configs/imx27lite.h new file +39 -0
new file mode 100644
index 0000000..570a94d
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2009 Ilya Yanok <[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
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*===================*/
+/* SoC Configuration */
+/*===================*/
+#define CONFIG_ARM926EJS			/* arm926ejs CPU core */
+#define CONFIG_MX27
+#define CONFIG_IMX27LITE
+#define CONFIG_MX27_CLK32	32768		/* OSC32K frequency */
+#define CONFIG_SYS_HZ		1000
+
+#define CONFIG_DISPLAY_CPUINFO
+
+#define CONFIG_CMDLINE_TAG		1	/* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS	1
+#define CONFIG_INITRD_TAG		1
+
+/*=============*/
+/* Memory Info */

include/configs/imx27lite.h line 49

Quoted 10 lines
include/configs/imx27lite.h new file +10 -0
+/*=============*/
+/* malloc() len */
+#define CONFIG_SYS_MALLOC_LEN		(0x10000 + 256*1024)
+/* reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE	128
+/* memtest start address */
+#define CONFIG_SYS_MEMTEST_START	0xA0000000
+#define CONFIG_SYS_MEMTEST_END		0xA1000000	/* 16MB RAM test */
+#define CONFIG_NR_DRAM_BANKS	1		/* we have 1 bank of DRAM */
+#define CONFIG_STACKSIZE	(256*1024)	/* regular stack */

please add space before and after '*'

include/configs/imx27lite.h line 55

Quoted 6 lines
include/configs/imx27lite.h new file +6 -0
+#define PHYS_SDRAM_1		0xA0000000	/* DDR Start */
+#define PHYS_SDRAM_1_SIZE	0x08000000	/* DDR size 128MB */
+
+/*====================*/
+/* Serial Driver info */
+/*====================*/

please no more of those XXXX comments
please use this style
/*
*
*/

Quoted 60 lines
include/configs/imx27lite.h new file +60 -0
+#define CONFIG_MXC_UART
+#define CONFIG_SYS_MX27_UART1
+#define CONFIG_CONS_INDEX	1		/* use UART0 for console */
+#define CONFIG_BAUDRATE		115200		/* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
+
+/*=====================*/
+/* Flash & Environment */
+/*=====================*/
+#define CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_FLASH_CFI_DRIVER
+#define CONFIG_SYS_FLASH_CFI
+/* Use buffered writes (~10x faster) */
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE	1
+/* Use hardware sector protection */
+#define CONFIG_SYS_FLASH_PROTECTION		1
+#define CONFIG_SYS_MAX_FLASH_BANKS	1	/* max number of flash banks */
+#define CONFIG_SYS_FLASH_SECT_SZ	0x2000	/* 8KB sect size Intel Flash */
+/* end of flash */
+#define CONFIG_ENV_OFFSET		(PHYS_FLASH_SIZE - 0x20000)
+/* CS2 Base address */
+#define PHYS_FLASH_1			0xc0000000
+/* Flash Base for U-Boot */
+#define CONFIG_SYS_FLASH_BASE		PHYS_FLASH_1
+/* Flash size 2MB */
+#define PHYS_FLASH_SIZE			0x200000
+#define CONFIG_SYS_MAX_FLASH_SECT	(PHYS_FLASH_SIZE / \
+		CONFIG_SYS_FLASH_SECT_SZ)
+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN		0x40000		/* Reserve 256KiB */
+#define CONFIG_ENV_SECT_SIZE		0x10000		/* Env sector Size */
+#define CONFIG_ENV_SIZE		CONFIG_ENV_SECT_SIZE
+/* Address and size of Redundant Environment Sector	*/
+#define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND	CONFIG_ENV_SIZE
+
+/*
+ * Ethernet
+ */
+#define CONFIG_FEC_IMX27
+#define CONFIG_MII
+#define CONFIG_NET_MULTI
+
+/*
+ * NAND
+ */
+#define CONFIG_NAND_MXC
+#define CONFIG_MXC_NAND_REGS_BASE	0xd8000000
+#define CONFIG_SYS_MAX_NAND_DEVICE	1
+#define CONFIG_SYS_NAND_BASE		0xd8000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_MXC_NAND_HWECC
+
+/*
+ * SD/MMC
+ */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MXC_MMC
+#define CONFIG_MXC_MCI_REGS_BASE	0x10014000

include/configs/imx27lite.h line 125

Quoted 10 lines
include/configs/imx27lite.h new file +10 -0
+#define CONFIG_DOS_PARTITION
+
+/*
+ * MTD partitions
+ */
+#define CONFIG_CMD_MTDPARTS
+#define MTDIDS_DEFAULT		"nor0=physmap-flash.0,nand0=mxc_nand.0"
+#define MTDPARTS_DEFAULT	\
+	"mtdparts=physmap-flash.0:256k(U-Boot),1664k(user),64k(env1),"	\
+	"64k(env2);mxc_nand.0:128k(IPL-SPL),4m(kernel),22m(rootfs),-(userfs)"

something like this will be more readable

	"mtdparts="			\
		"physmap-flash.0:"	\
			"256k(U-Boot),"	\
			"1664k(user),"	\
			"64k(env1),"	\
			"64k(env2);"	\
		"mxc_nand.0:"		\
			"128k(IPL-SPL),"\
			"4m(kernel),"	\
			"22m(rootfs),"	\
			"-(userfs)"

Best Regards,
J.

#37 lore raw

PATCH 7/7 imx27lite: add support for imx27lite board from LogicPD

Hi Jean-Christophe,

Quoted 31 lines · Ilya Yanok
Quoted 30 lines

This patch adds support for i.MX27-LITEKIT development board from LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash, 64MB NAND flash, FEC ethernet controller integrated into i.MX27.

---
 MAINTAINERS                             |    1 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/logicpd/imx27lite/Makefile        |   51 +++++++
 board/logicpd/imx27lite/config.mk       |    1 +
 board/logicpd/imx27lite/imx27lite.c     |   97 +++++++++++++
 board/logicpd/imx27lite/lowlevel_init.S |  223 +++++++++++++++++++++++++++++++
 board/logicpd/imx27lite/u-boot.lds      |   56 ++++++++
 include/configs/imx27lite.h             |  195 +++++++++++++++++++++++++++
 9 files changed, 628 insertions(+), 0 deletions(-)
 create mode 100644 board/logicpd/imx27lite/Makefile
 create mode 100644 board/logicpd/imx27lite/config.mk
 create mode 100644 board/logicpd/imx27lite/imx27lite.c
 create mode 100644 board/logicpd/imx27lite/lowlevel_init.S
 create mode 100644 board/logicpd/imx27lite/u-boot.lds
 create mode 100644 include/configs/imx27lite.h
MAINTAINERS +0 -0
index 3d50668..98efd69 100644
@@ -519,6 +519,7 @@ George G. Davis <[email protected]>
 	gcplus		SA1100
 
Quoted 3 lines

MAINTAINERS George G. Davis <[email protected]> · line 522

Quoted 2 lines
MAINTAINERS +1 -0
 Wolfgang Denk <[email protected]>
+	imx27lite	i.MX27

Wolfgang could you ack it?

I ack that on behalf of Wolfgang.

Cheers
Detlev

Signature · 5 lines
Markov does it in chains.
--
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
#38 lore raw

PATCH 7/7 imx27lite: add support for imx27lite board from LogicPD

In reply to Jean-Christophe PLAGNIOL-VILLARD

Dear Jean-Christophe PLAGNIOL-VILLARD,

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

MAINTAINERS George G. Davis <[email protected]> · line 522

Quoted 3 lines

Wolfgang Denk <[email protected]>

MAINTAINERS +1 -0
+	imx27lite	i.MX27

Wolfgang could you ack it?

Quoted 1 line

qong i.MX31

Yes, that's ok with me.

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
Anyone who isn't confused here doesn't really know what's going on.
author
#39 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

In reply to Jean-Christophe PLAGNIOL-VILLARD

This patch adds support for i.MX27-LITEKIT development board from LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash, 64MB NAND flash, FEC ethernet controller integrated into i.MX27.

---
 MAINTAINERS                             |    1 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/logicpd/imx27lite/Makefile        |   51 ++++++
 board/logicpd/imx27lite/config.mk       |    1 +
 board/logicpd/imx27lite/imx27lite.c     |  102 ++++++++++++
 board/logicpd/imx27lite/lowlevel_init.S |  170 ++++++++++++++++++++
 include/configs/imx27lite.h             |  255 +++++++++++++++++++++++++++++++
 8 files changed, 584 insertions(+), 0 deletions(-)
 create mode 100644 board/logicpd/imx27lite/Makefile
 create mode 100644 board/logicpd/imx27lite/config.mk
 create mode 100644 board/logicpd/imx27lite/imx27lite.c
 create mode 100644 board/logicpd/imx27lite/lowlevel_init.S
 create mode 100644 include/configs/imx27lite.h
MAINTAINERS +1 -0
index 575a7ec..61ea2cf 100644
@@ -533,6 +533,7 @@ George G. Davis <[email protected]>
 	gcplus		SA1100
 
 Wolfgang Denk <[email protected]>
+	imx27lite	i.MX27
 	qong		i.MX31
 
 Thomas Elste <[email protected]>
MAKEALL +1 -0
index 020ff73..69520fc 100755
@@ -510,6 +510,7 @@ LIST_ARM9="			\
 	cp926ejs		\
 	cp946es			\
 	cp966			\
+	imx27lite		\
 	lpd7a400		\
 	mx1ads			\
 	mx1fs2			\
Makefile +3 -0
index 090e645..5e95558 100644
@@ -2888,6 +2888,9 @@ davinci_sonata_config :	unconfig
 davinci_dm355evm_config :	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs dm355evm davinci davinci
 
+imx27lite_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
+
 lpd7a400_config \
 lpd7a404_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm lh7a40x lpd7a40x
board/logicpd/imx27lite/Makefile new file +51 -0

51 lines not on this page · raw message

board/logicpd/imx27lite/config.mk new file +1 -0
new file mode 100644
index 0000000..a2e7768
@@ -0,0 +1 @@
+TEXT_BASE = 0xA7F00000
board/logicpd/imx27lite/imx27lite.c new file +102 -0

102 lines not on this page · raw message

board/logicpd/imx27lite/lowlevel_init.S new file +170 -0

170 lines not on this page · raw message

include/configs/imx27lite.h new file +255 -0

255 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#40 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Quoted 34 lines

+ */

board/logicpd/imx27lite/imx27lite.c new file +33 -0
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int imx27lite_devices_init(void)
+{
+	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
+	int i;
+	unsigned int mode[] = {
+		PD0_AIN_FEC_TXD0,
+		PD1_AIN_FEC_TXD1,
+		PD2_AIN_FEC_TXD2,
+		PD3_AIN_FEC_TXD3,
+		PD4_AOUT_FEC_RX_ER,
+		PD5_AOUT_FEC_RXD1,
+		PD6_AOUT_FEC_RXD2,
+		PD7_AOUT_FEC_RXD3,
+		PD8_AF_FEC_MDIO,
+		PD9_AIN_FEC_MDC | GPIO_PUEN,
+		PD10_AOUT_FEC_CRS,
+		PD11_AOUT_FEC_TX_CLK,
+		PD12_AOUT_FEC_RXD0,
+		PD13_AOUT_FEC_RX_DV,
+		PD14_AOUT_FEC_CLR,
+		PD15_AOUT_FEC_COL,
+		PD16_AIN_FEC_TX_ER,
+		PF23_AIN_FEC_TX_EN,
+		PE12_PF_UART1_TXD,
+		PE13_PF_UART1_RXD,
+		PB4_PF_SD2_D0,

board/logicpd/imx27lite/imx27lite.c line 64

Quoted 10 lines
board/logicpd/imx27lite/imx27lite.c new file +10 -0
+		PB5_PF_SD2_D1,
+		PB6_PF_SD2_D2,
+		PB7_PF_SD2_D3,
+		PB8_PF_SD2_CMD,
+		PB9_PF_SD2_CLK,
+		(GPIO_PORTC | GPIO_OUT | GPIO_PUEN | GPIO_GPIO | 31),
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);

you do not answer about my api comment?
do you plan to create one for device init?

otherwise ok

Best Regards,
J.

author
#41 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Hi Jean-Christophe,

Quoted 30 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 30 lines
board/logicpd/imx27lite/imx27lite.c new file +30 -0
+static int imx27lite_devices_init(void)
+{
+	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
+	int i;
+	unsigned int mode[] = {
+		PD0_AIN_FEC_TXD0,
+		PD1_AIN_FEC_TXD1,
+		PD2_AIN_FEC_TXD2,
+		PD3_AIN_FEC_TXD3,
+		PD4_AOUT_FEC_RX_ER,
+		PD5_AOUT_FEC_RXD1,
+		PD6_AOUT_FEC_RXD2,
+		PD7_AOUT_FEC_RXD3,
+		PD8_AF_FEC_MDIO,
+		PD9_AIN_FEC_MDC | GPIO_PUEN,
+		PD10_AOUT_FEC_CRS,
+		PD11_AOUT_FEC_TX_CLK,
+		PD12_AOUT_FEC_RXD0,
+		PD13_AOUT_FEC_RX_DV,
+		PD14_AOUT_FEC_CLR,
+		PD15_AOUT_FEC_COL,
+		PD16_AIN_FEC_TX_ER,
+		PF23_AIN_FEC_TX_EN,
+		PE12_PF_UART1_TXD,
+		PE13_PF_UART1_RXD,
+		PB4_PF_SD2_D0,
+		PB5_PF_SD2_D1,
+		PB6_PF_SD2_D2,
+		PB7_PF_SD2_D3,
+		PB8_PF_SD2_CMD,
Quoted 9 lines

board/logicpd/imx27lite/imx27lite.c line 64

Quoted 7 lines
board/logicpd/imx27lite/imx27lite.c new file +6 -0
+		PB9_PF_SD2_CLK,
+		(GPIO_PORTC | GPIO_OUT | GPIO_PUEN | GPIO_GPIO | 31),
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);

you do not answer about my api comment?

Sorry, I forgot to write a separate mail to ask you.

Quoted 2 lines

do you plan to create one for device init?

What kind of API you expect me to create here? It's just IO pins initialization...

Regards, Ilya.

#42 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Quoted 43 lines · Ilya Yanok

Hi Jean-Christophe,

Quoted 30 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 30 lines
board/logicpd/imx27lite/imx27lite.c new file +30 -0
+static int imx27lite_devices_init(void)
+{
+	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
+	int i;
+	unsigned int mode[] = {
+		PD0_AIN_FEC_TXD0,
+		PD1_AIN_FEC_TXD1,
+		PD2_AIN_FEC_TXD2,
+		PD3_AIN_FEC_TXD3,
+		PD4_AOUT_FEC_RX_ER,
+		PD5_AOUT_FEC_RXD1,
+		PD6_AOUT_FEC_RXD2,
+		PD7_AOUT_FEC_RXD3,
+		PD8_AF_FEC_MDIO,
+		PD9_AIN_FEC_MDC | GPIO_PUEN,
+		PD10_AOUT_FEC_CRS,
+		PD11_AOUT_FEC_TX_CLK,
+		PD12_AOUT_FEC_RXD0,
+		PD13_AOUT_FEC_RX_DV,
+		PD14_AOUT_FEC_CLR,
+		PD15_AOUT_FEC_COL,
+		PD16_AIN_FEC_TX_ER,
+		PF23_AIN_FEC_TX_EN,
+		PE12_PF_UART1_TXD,
+		PE13_PF_UART1_RXD,
+		PB4_PF_SD2_D0,
+		PB5_PF_SD2_D1,
+		PB6_PF_SD2_D2,
+		PB7_PF_SD2_D3,
+		PB8_PF_SD2_CMD,
Quoted 9 lines

board/logicpd/imx27lite/imx27lite.c line 64

Quoted 7 lines
board/logicpd/imx27lite/imx27lite.c new file +6 -0
+		PB9_PF_SD2_CLK,
+		(GPIO_PORTC | GPIO_OUT | GPIO_PUEN | GPIO_GPIO | 31),
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);

you do not answer about my api comment?

Quoted 7 lines

Sorry, I forgot to write a separate mail to ask you.

Quoted 2 lines

do you plan to create one for device init?

What kind of API you expect me to create here? It's just IO pins initialization...

do as at91, davinci all related init for rs232, usb, net in one function per init

Best Regards,
J.

author
#43 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

This patch adds support for i.MX27-LITEKIT development board from LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash, 64MB NAND flash, FEC ethernet controller integrated into i.MX27.

---
 MAINTAINERS                             |    1 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/logicpd/imx27lite/Makefile        |   51 ++++++
 board/logicpd/imx27lite/config.mk       |    1 +
 board/logicpd/imx27lite/imx27lite.c     |  137 +++++++++++++++++
 board/logicpd/imx27lite/lowlevel_init.S |  170 ++++++++++++++++++++
 include/configs/imx27lite.h             |  255 +++++++++++++++++++++++++++++++
 8 files changed, 619 insertions(+), 0 deletions(-)
 create mode 100644 board/logicpd/imx27lite/Makefile
 create mode 100644 board/logicpd/imx27lite/config.mk
 create mode 100644 board/logicpd/imx27lite/imx27lite.c
 create mode 100644 board/logicpd/imx27lite/lowlevel_init.S
 create mode 100644 include/configs/imx27lite.h
MAINTAINERS +1 -0
index 620604c..60185ab 100644
@@ -539,6 +539,7 @@ George G. Davis <[email protected]>
 	gcplus		SA1100
 
 Wolfgang Denk <[email protected]>
+	imx27lite	i.MX27
 	qong		i.MX31
 
 Thomas Elste <[email protected]>
MAKEALL +1 -0
index dd0b761..48c3bc2 100755
@@ -515,6 +515,7 @@ LIST_ARM9="			\
 	cp926ejs		\
 	cp946es			\
 	cp966			\
+	imx27lite		\
 	lpd7a400		\
 	mv88f6281gtw_ge		\
 	mx1ads			\
Makefile +3 -0
index 8096f91..01e93c4 100644
@@ -2879,6 +2879,9 @@ davinci_sonata_config :	unconfig
 davinci_dm355evm_config :	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs dm355evm davinci davinci
 
+imx27lite_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
+
 lpd7a400_config \
 lpd7a404_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm lh7a40x lpd7a40x
board/logicpd/imx27lite/Makefile new file +51 -0

51 lines not on this page · raw message

board/logicpd/imx27lite/config.mk new file +1 -0
new file mode 100644
index 0000000..a2e7768
@@ -0,0 +1 @@
+TEXT_BASE = 0xA7F00000
board/logicpd/imx27lite/imx27lite.c new file +137 -0

137 lines not on this page · raw message

board/logicpd/imx27lite/lowlevel_init.S new file +170 -0

170 lines not on this page · raw message

include/configs/imx27lite.h new file +255 -0

255 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#44 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Quoted 84 lines

+ * Copyright (C) 2008,2009 Eric Jarrige <[email protected]>
+ * Copyright (C) 2009 Ilya Yanok <[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
+ *
+ */

board/logicpd/imx27lite/imx27lite.c new file +65 -0
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_MXC_UART
+static void imx27lite_uart_init()
+{
+	int i;
+	unsigned int mode[] = {
+		PE12_PF_UART1_TXD,
+		PE13_PF_UART1_RXD,
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);
+
+}
+#endif /* CONFIGL_MXC_UART */
+
+#ifdef CONFIG_FEC_MXC
+static void imx27lite_fec_init()
+{
+	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE;
+	int i;
+	unsigned int mode[] = {
+		PD0_AIN_FEC_TXD0,
+		PD1_AIN_FEC_TXD1,
+		PD2_AIN_FEC_TXD2,
+		PD3_AIN_FEC_TXD3,
+		PD4_AOUT_FEC_RX_ER,
+		PD5_AOUT_FEC_RXD1,
+		PD6_AOUT_FEC_RXD2,
+		PD7_AOUT_FEC_RXD3,
+		PD8_AF_FEC_MDIO,
+		PD9_AIN_FEC_MDC | GPIO_PUEN,
+		PD10_AOUT_FEC_CRS,
+		PD11_AOUT_FEC_TX_CLK,
+		PD12_AOUT_FEC_RXD0,
+		PD13_AOUT_FEC_RX_DV,
+		PD14_AOUT_FEC_CLR,
+		PD15_AOUT_FEC_COL,
+		PD16_AIN_FEC_TX_ER,
+		PF23_AIN_FEC_TX_EN,
+		(GPIO_PORTC | GPIO_OUT | GPIO_PUEN | GPIO_GPIO | 31),
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);
+
+	writel(readl(&regs->port[PORTC].dr) | (1 << 31),
+				&regs->port[PORTC].dr);
+}
+#endif /* CONFIG_FEC_MXC */
+
+#ifdef CONFIG_MXC_MMC
+static void imx27lite_sd_init()
+{
+	int i;
+	unsigned int mode[] = {
+		PB4_PF_SD2_D0,
+		PB5_PF_SD2_D1,
+		PB6_PF_SD2_D2,

board/logicpd/imx27lite/imx27lite.c line 96

Quoted 10 lines
board/logicpd/imx27lite/imx27lite.c new file +10 -0
+		PB7_PF_SD2_D3,
+		PB8_PF_SD2_CMD,
+		PB9_PF_SD2_CLK,
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);
+
+}
+#endif /* CONFIG_MXC_MMC */

tks for the udpate
but the init function are not board specific but soc specific please move the to cpu/arm926ejs/soc/something.c

board/logicpd/imx27lite/imx27lite.c line 101

Quoted 5 lines
board/logicpd/imx27lite/imx27lite.c new file +5 -0
+
+int board_init (void)
+{
+	gd->bd->bi_arch_number = MACH_TYPE_IMX27LITE;
+	gd->bd->bi_boot_params = 0xa0000100;

please BASE + 0x100;

Quoted 40 lines
board/logicpd/imx27lite/imx27lite.c new file +36 -0
+
+#ifdef CONFIG_MXC_UART
+	imx27lite_uart_init();
+#endif
+#ifdef CONFIG_FEC_MXC
+	imx27lite_fec_init();
+#endif
+#ifdef CONFIG_MXC_MMC
+	imx27lite_sd_init();
+#endif
+
+	return 0;
+}
+
+int dram_init (void)
+{
+
+#if CONFIG_NR_DRAM_BANKS > 0
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = get_ram_size((volatile void *)PHYS_SDRAM_1,
+			PHYS_SDRAM_1_SIZE);
+#endif
+#if CONFIG_NR_DRAM_BANKS > 1
+	gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+	gd->bd->bi_dram[1].size = get_ram_size((volatile void *)PHYS_SDRAM_2,
+			PHYS_SDRAM_2_SIZE);
+#endif
+
+	return 0;
+}
+
+int checkboard(void)
+{
+	printf("LogicPD imx27lite\n");
+	return 0;
+}
board/logicpd/imx27lite/lowlevel_init.S new file +0 -1
new file mode 100644
index 0000000..e2cdecb
--- /dev/null

<snip>

Quoted 15 lines
board/logicpd/imx27lite/lowlevel_init.S new file +15 -0
+
+#define SDRAM_MODE_REGISTER_VAL	0x33	/* BL: 8, CAS: 3 */
+#define SDRAM_EXT_MODE_REGISTER_VAL	0x1000000
+
+#define MPCTL0_VAL	0x1ef15d5
+
+#define SPCTL0_VAL	0x043a1c09
+
+#define CSCR_VAL	0x33f08107
+
+#define PCDR0_VAL	0x120470c3
+#define PCDR1_VAL	0x03030303
+#define PCCR0_VAL	0xffffffff
+#define PCCR1_VAL	0xfffffffc
+

board/logicpd/imx27lite/lowlevel_init.S

Quoted 10 lines
board/logicpd/imx27lite/lowlevel_init.S new file +10 -0
+#define AIPI1_PSR0_VAL	0x20040304
+#define AIPI1_PSR1_VAL	0xdffbfcfb
+#define AIPI2_PSR0_VAL	0x07ffc200
+#define AIPI2_PSR1_VAL	0xffffffff
+
+/*
+ * Memory Info
+ */
+/* malloc() len */
+#define CONFIG_SYS_MALLOC_LEN		(0x10000 + 256 * 1024)

please do not mix hexa and decimal

Quoted 120 lines
board/logicpd/imx27lite/lowlevel_init.S new file +120 -0
+/* reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE	128
+/* memtest start address */
+#define CONFIG_SYS_MEMTEST_START	0xA0000000
+#define CONFIG_SYS_MEMTEST_END		0xA1000000	/* 16MB RAM test */
+#define CONFIG_NR_DRAM_BANKS	1		/* we have 1 bank of DRAM */
+#define CONFIG_STACKSIZE	(256 * 1024)	/* regular stack */
+#define PHYS_SDRAM_1		0xA0000000	/* DDR Start */
+#define PHYS_SDRAM_1_SIZE	0x08000000	/* DDR size 128MB */
+
+/*
+ * Serial Driver info
+ */
+#define CONFIG_MXC_UART
+#define CONFIG_SYS_MX27_UART1
+#define CONFIG_CONS_INDEX	1		/* use UART0 for console */
+#define CONFIG_BAUDRATE		115200		/* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
+
+/*
+ * Flash & Environment
+ */
+#define CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_FLASH_CFI_DRIVER
+#define CONFIG_SYS_FLASH_CFI
+/* Use buffered writes (~10x faster) */
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE	1
+/* Use hardware sector protection */
+#define CONFIG_SYS_FLASH_PROTECTION		1
+#define CONFIG_SYS_MAX_FLASH_BANKS	1	/* max number of flash banks */
+#define CONFIG_SYS_FLASH_SECT_SZ	0x2000	/* 8KB sect size Intel Flash */
+/* end of flash */
+#define CONFIG_ENV_OFFSET		(PHYS_FLASH_SIZE - 0x20000)
+/* CS2 Base address */
+#define PHYS_FLASH_1			0xc0000000
+/* Flash Base for U-Boot */
+#define CONFIG_SYS_FLASH_BASE		PHYS_FLASH_1
+/* Flash size 2MB */
+#define PHYS_FLASH_SIZE			0x200000
+#define CONFIG_SYS_MAX_FLASH_SECT	(PHYS_FLASH_SIZE / \
+		CONFIG_SYS_FLASH_SECT_SZ)
+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN		0x40000		/* Reserve 256KiB */
+#define CONFIG_ENV_SECT_SIZE		0x10000		/* Env sector Size */
+#define CONFIG_ENV_SIZE		CONFIG_ENV_SECT_SIZE
+/* Address and size of Redundant Environment Sector	*/
+#define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND	CONFIG_ENV_SIZE
+
+/*
+ * Ethernet
+ */
+#define CONFIG_FEC_MXC
+#define CONFIG_FEC_MXC_PHYADDR		0x1f
+#define CONFIG_MII
+#define CONFIG_NET_MULTI
+
+/*
+ * MTD
+ */
+#define CONFIG_MTD_DEVICE
+
+/*
+ * NAND
+ */
+#define CONFIG_NAND_MXC
+#define CONFIG_MXC_NAND_REGS_BASE	0xd8000000
+#define CONFIG_SYS_MAX_NAND_DEVICE	1
+#define CONFIG_SYS_NAND_BASE		0xd8000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_MXC_NAND_HWECC
+
+/*
+ * SD/MMC
+ */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MXC_MMC
+#define CONFIG_MXC_MCI_REGS_BASE	0x10014000
+#define CONFIG_DOS_PARTITION
+
+/*
+ * MTD partitions
+ */
+#define CONFIG_CMD_MTDPARTS
+#define MTDIDS_DEFAULT		"nor0=physmap-flash.0,nand0=mxc_nand.0"
+#define MTDPARTS_DEFAULT			\
+	"mtdparts="				\
+		"physmap-flash.0:"		\
+			"256k(U-Boot),"		\
+			"1664k(user),"		\
+			"64k(env1),"		\
+			"64k(env2);"		\
+		"mxc_nand.0:"			\
+			"128k(IPL-SPL),"	\
+			"4m(kernel),"		\
+			"22m(rootfs),"		\
+			"-(userfs)"
+
+/*
+ * U-Boot general configuration
+ */
+#define CONFIG_BOOTFILE		"uImage"	/* Boot file name */
+#define CONFIG_SYS_PROMPT	"=> "	/* Monitor Command Prompt */
+#define CONFIG_SYS_CBSIZE	1024	/* Console I/O Buffer Size  */
+/* Print buffer sz */
+#define CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE + \
+		sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_MAXARGS	16	/* max number of command args */
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE	CONFIG_SYS_CBSIZE
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_LONGHELP
+
+/*
+ * U-Boot commands
+ */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_BDI

board/logicpd/imx27lite/lowlevel_init.S

Quoted 10 lines
board/logicpd/imx27lite/lowlevel_init.S new file +10 -0
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_DIAG
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_JFFS2
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_PING

you redefine cmd that are defined in the default

board/logicpd/imx27lite/lowlevel_init.S

Quoted 5 lines
board/logicpd/imx27lite/lowlevel_init.S new file +5 -0
+
+#define CONFIG_BOOTDELAY	5
+
+#define CONFIG_LOADADDR		0xa0800000	/* loadaddr env var */
+#define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR

why 2?

Best Regards,
J.

#45 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 1 line · In message <[email protected]> you wrote:

...

Quoted 3 lines

include/configs/imx27lite.h line 87

Quoted 2 lines
include/configs/imx27lite.h new file +2 -0
+/* malloc() len */
+#define CONFIG_SYS_MALLOC_LEN		(0x10000 + 256 * 1024)

please do not mix hexa and decimal

Please be reasonable. This is a perfectly valid and easy to read notation. I see no reason to change this - anything else would probably be much harder to read.

Quoted 3 lines

include/configs/imx27lite.h line 222

Quoted 2 lines
include/configs/imx27lite.h new file +2 -0
+#define CONFIG_LOADADDR		0xa0800000	/* loadaddr env var */
+#define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR

why 2?

Because they do different things.

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
"Where humor is concerned there are no standards -- no  one  can  say
what is good or bad, although you can be sure that everyone will.
- John Kenneth Galbraith
#46 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Quoted 8 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 1 line · In message <[email protected]> you wrote:

...

Quoted 3 lines

include/configs/imx27lite.h line 87

Quoted 2 lines
include/configs/imx27lite.h new file +2 -0
+/* malloc() len */
+#define CONFIG_SYS_MALLOC_LEN		(0x10000 + 256 * 1024)

please do not mix hexa and decimal

I've as there is other think to fix otherwise I'll not have ask

Quoted 10 lines

Please be reasonable. This is a perfectly valid and easy to read notation. I see no reason to change this - anything else would probably be much harder to read.

Quoted 3 lines

include/configs/imx27lite.h line 222

Quoted 2 lines
include/configs/imx27lite.h new file +2 -0
+#define CONFIG_LOADADDR		0xa0800000	/* loadaddr env var */
+#define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR

why 2?

Because they do different things.

I've take a look they do nearly the same think it will be better to avoid have 2 configs specialy when there are the same

btw I've found nothing about it in the README

Best Regards,
J.

#47 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Dear Jean-Christophe PLAGNIOL-VILLARD,

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

+#define CONFIG_SYS_MALLOC_LEN (0x10000 + 256 * 1024)

please do not mix hexa and decimal

I've as there is other think to fix otherwise I'll not have ask

Quoted 4 lines

Please be reasonable. This is a perfectly valid and easy to read notation. I see no reason to change this - anything else would probably be much harder to read.

Please do not insist in changing this. No matter how you wrote it, "0x10000 + 0x100 * 0x400" or "0x10000 + 0x40000" or "65536 + 256 * 1024" or "65536 + 262144" - all thesde forms are more difficult to parse and give less insight into what is intended.

I say: there is no reason to change this.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

include/configs/imx27lite.h line 222

Quoted 2 lines
include/configs/imx27lite.h new file +2 -0
+#define CONFIG_LOADADDR		0xa0800000	/* loadaddr env var */
+#define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR

why 2?

Because they do different things.

I've take a look they do nearly the same think it will be better to avoid have 2 configs specialy when there are the same

Please feel free to submit a patch if you do not like the current design. But this has nothing to do with the current patch in question, i. e. it is not a reason to reject it or ask for changes.

Quoted 1 line

btw I've found nothing about it in the README

Indeed, documentation is not exactly perfect. Please feel free to submit a patch.

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
Heavier than air flying machines are impossible.
                    -- Lord Kelvin, President, Royal Society, c. 1895
#48 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Hi,
What happened with this patch? Was it applied or did it have any problems? Is it tested?

Thank you.

Signature · 8 lines
Javier Martin
Vista Silicon S.L.
Universidad de Cantabria
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
#49 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

2009/8/5 javier Martin <[email protected]>:

Quoted 3 lines

Hi,
What happened with this patch? Was it applied or did it have any problems? Is it tested?

I have applied it but when compiling it gives the following errors:

hdog/libwatchdog.a common/libcommon.a libfdt/libfdt.a api/libapi.a
post/libpost.a board/freescale/mx31ads/libmx31ads.a --end-group -L /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2 -lgcc -Map u-boot.map -o u-boot
arm-none-linux-gnueabi-ld: ERROR: Source object /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_udivsi3.o) has EABI version 4, but target u-boot has EABI version 0
arm-none-linux-gnueabi-ld: failed to merge target specific data of
file /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_udivsi3.o)
arm-none-linux-gnueabi-ld: ERROR: Source object /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_divsi3.o) has EABI version 4, but target u-boot has EABI version 0
arm-none-linux-gnueabi-ld: failed to merge target specific data of
file /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_divsi3.o)
arm-none-linux-gnueabi-ld: ERROR: Source object /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_umodsi3.o) has EABI version 4, but target u-boot has EABI version 0
arm-none-linux-gnueabi-ld: failed to merge target specific data of
file /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_umodsi3.o)
arm-none-linux-gnueabi-ld: ERROR: Source object /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_modsi3.o) has EABI version 4, but target u-boot has EABI version 0
arm-none-linux-gnueabi-ld: failed to merge target specific data of
file /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_modsi3.o)
arm-none-linux-gnueabi-ld: ERROR: Source object /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_dvmd_lnx.o) has EABI version 4, but target u-boot has EABI version 0
arm-none-linux-gnueabi-ld: failed to merge target specific data of
file /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_dvmd_lnx.o) /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_dvmd_lnx.o):
In function `__div0':
/usr/src/redhat/BUILD/cross-mlib/source/gcc-4.1.2/gcc/config/arm/lib1funcs.asm:1000:
undefined reference to `raise'
make: *** [u-boot] Error 1

Any ideas about this problem?

Thank you.

Quoted 11 lines

--
Javier Martin
Vista Silicon S.L.
Universidad de Cantabria
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com

Signature · 8 lines
Javier Martin
Vista Silicon S.L.
Universidad de Cantabria
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
#50 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Dear javier Martin,

Quoted 2 lines · In message <[email protected]> you…

I have applied it but when compiling it gives the following errors:

...

Quoted 3 lines

arm-none-linux-gnueabi-ld: ERROR: Source object /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_udivsi3.o) has EABI version 4, but target u-boot has EABI version 0

...

Quoted 1 line

Any ideas about this problem?

You want to read the FAQ:
http://www.denx.de/wiki/view/DULG/SourceObjectHasEABIVersion4ButTargetHasEABIVersion0

Jean-Christophe once had a patch to add the libgcc routines as used by the Linux kernel, but despite all my asking he did not re-submit this yet.

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
"What the scientists have in their briefcases is terrifying."
- Nikita Khrushchev
#51 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

2009/8/5 Wolfgang Denk <[email protected]>:

Quoted 6 lines

Dear javier Martin,

Quoted 2 lines · In message <[email protected]> you…

I have applied it but when compiling it gives the following errors:

...

Quoted 8 lines
Quoted 3 lines

arm-none-linux-gnueabi-ld: ERROR: Source object /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_udivsi3.o) has EABI version 4, but target u-boot has EABI version 0

...

Quoted 1 line

Any ideas about this problem?

You want to read the FAQ:
http://www.denx.de/wiki/view/DULG/SourceObjectHasEABIVersion4ButTargetHasEABIVersion0

What toolchains do you use then?
I have tried with the toolchains provided with ELDK4 but no luck. They also seem to be EABI version 4.

Signature · 8 lines
Javier Martin
Vista Silicon S.L.
Universidad de Cantabria
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
#52 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Dear javier Martin,

Quoted 6 lines · In message <[email protected]> you…
Quoted 2 lines

http://www.denx.de/wiki/view/DULG/SourceObjectHasEABIVersion4ButTargetHasEABIVersion0

What toolchains do you use then?
I have tried with the toolchains provided with ELDK4 but no luck. They also seem to be EABI version 4.

I'm waiting for Jean-Christophe's patch. In the meantime I use ELDK 4.1 which uses the old ABI.

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
: ... and it's got weird formatting - Notepad, Write, Works  3  can't
: decipher it, and it's too big to go in DOS Edit. Help!
Install an operating system. :-)                  -- Tom Christiansen
#53 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Now, I am using 4.1 version of eldk.

With the previous patch applied I get this problem with "board_nand_init". I don't know if it's still a problem of my toolchain of this is a BUG:

drivers/mtd/nand/libnand.a(nand.o): In function `nand_init':
/home/javier/GIT/u-boot/drivers/mtd/nand/nand.c:53: undefined reference to `board_nand_init'

Regards.

Signature · 8 lines
Javier Martin
Vista Silicon S.L.
Universidad de Cantabria
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
#54 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

In reply to javier Martin

Dear Javier,

In message <[email protected]> you wrote:
...

Quoted 1 line

I have applied it but when compiling it gives the following errors:

...

Quoted 3 lines

arm-none-linux-gnueabi-ld: ERROR: Source object /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/4.1.2/libgcc.a(_udivsi3.o) has EABI version 4, but target u-boot has EABI version 0

I have just posted a patch:

[PATCH] ARM EABI: add new helper functions resp. function names

(see http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/65473

Combined with commit 52b1bf2c:

Make linking against libgcc configurable

I can run a "USE_PRIVATE_LIBGCC=yes ./MAKEALL arm" with an EABI conformant tool chain (ELDK 4.2) without any related issues.

It would be great if you all could test this, so we can get this in as quickly as possible.

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
"You know, after a woman's raised a family and so on,  she  wants  to
start living her own life."   "Whose life she's _been_ living, then?"
                                  - Terry Pratchett, _Witches Abroad_
#55 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

2009/8/6 Wolfgang Denk <[email protected]>:

Quoted 9 lines

I have just posted a patch:

[PATCH] ARM EABI: add new helper functions resp. function names

(see http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/65473

Combined with commit 52b1bf2c:

Quoted 7 lines

? ? ? ?Make linking against libgcc configurable

I can run a "USE_PRIVATE_LIBGCC=yes ./MAKEALL arm" with an EABI conformant tool chain (ELDK 4.2) without any related issues.

It would be great if you all could test this, so we can get this in as quickly as possible.

This also works for me using Freescale's toolchain included in LTIB for i.mx27 ads board.

One thing that confuses me a little about this imx27litekit patch is that TEXT_ADDRESS is a RAM address but, according to the FAQ u-boot cannot be run from RAM by another bootloader.

Why is TEXT_ADDRESS in RAM then?

Thanks.

Signature · 8 lines
Javier Martin
Vista Silicon S.L.
Universidad de Cantabria
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
#56 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Dear javier Martin,

Quoted 6 lines · In message <[email protected]> you…
Quoted 3 lines

It would be great if you all could test this, so we can get this in as quickly as possible.

This also works for me using Freescale's toolchain included in LTIB for i.mx27 ads board.

thanks a lot for the confirmation.

Quoted 5 lines

One thing that confuses me a little about this imx27litekit patch is that TEXT_ADDRESS is a RAM address but, according to the FAQ u-boot cannot be run from RAM by another bootloader.

Why is TEXT_ADDRESS in RAM then?

This is "normal" on ARM systems - there TEXT_BASE holds the address of the image after copying (I hesitate to call it relocating) it to RAM.

Best regards,

Wolfgang Denk

Signature · 7 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
But it's real. And if it's real it can be affected ... we may not  be
able  to break it, but, I'll bet you credits to Navy Beans we can put
a dent in it.
	-- deSalle, "Catspaw", stardate 3018.2
author
#57 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

In reply to Jean-Christophe PLAGNIOL-VILLARD

This patch adds support for i.MX27-LITEKIT development board from LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash, 64MB NAND flash, FEC ethernet controller integrated into i.MX27.

---
 MAINTAINERS                             |    1 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/logicpd/imx27lite/Makefile        |   51 ++++++
 board/logicpd/imx27lite/config.mk       |    1 +
 board/logicpd/imx27lite/imx27lite.c     |   73 +++++++++
 board/logicpd/imx27lite/lowlevel_init.S |  170 +++++++++++++++++++++
 cpu/arm926ejs/mx27/generic.c            |   65 ++++++++
 include/asm-arm/arch-mx27/imx-regs.h    |   12 ++
 include/configs/imx27lite.h             |  252 +++++++++++++++++++++++++++++++
 10 files changed, 629 insertions(+), 0 deletions(-)
 create mode 100644 board/logicpd/imx27lite/Makefile
 create mode 100644 board/logicpd/imx27lite/config.mk
 create mode 100644 board/logicpd/imx27lite/imx27lite.c
 create mode 100644 board/logicpd/imx27lite/lowlevel_init.S
 create mode 100644 include/configs/imx27lite.h
MAINTAINERS +1 -0
index 620604c..60185ab 100644
@@ -539,6 +539,7 @@ George G. Davis <[email protected]>
 	gcplus		SA1100
 
 Wolfgang Denk <[email protected]>
+	imx27lite	i.MX27
 	qong		i.MX31
 
 Thomas Elste <[email protected]>
MAKEALL +1 -0
index edebaea..3b0fd56 100755
@@ -515,6 +515,7 @@ LIST_ARM9="			\
 	cp926ejs		\
 	cp946es			\
 	cp966			\
+	imx27lite		\
 	lpd7a400		\
 	mv88f6281gtw_ge		\
 	mx1ads			\
Makefile +3 -0
index 329e0f5..c0f30d1 100644
@@ -2879,6 +2879,9 @@ davinci_sonata_config :	unconfig
 davinci_dm355evm_config :	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs dm355evm davinci davinci
 
+imx27lite_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
+
 lpd7a400_config \
 lpd7a404_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm lh7a40x lpd7a40x
board/logicpd/imx27lite/Makefile new file +51 -0

51 lines not on this page · raw message

board/logicpd/imx27lite/config.mk new file +1 -0
new file mode 100644
index 0000000..a2e7768
@@ -0,0 +1 @@
+TEXT_BASE = 0xA7F00000
board/logicpd/imx27lite/imx27lite.c new file +73 -0

73 lines not on this page · raw message

board/logicpd/imx27lite/lowlevel_init.S new file +170 -0

170 lines not on this page · raw message

cpu/arm926ejs/mx27/generic.c +65 -0

68 lines not on this page · raw message

include/asm-arm/arch-mx27/imx-regs.h +12 -0
index cff2b0e..d36a6da 100644
@@ -28,6 +28,18 @@
 
 extern void imx_gpio_mode (int gpio_mode);
 
+#ifdef CONFIG_MXC_UART
+extern void mx27_uart_init_pins(void);
+#endif /* CONFIG_MXC_UART */
+
+#ifdef CONFIG_FEC_MXC
+extern void mx27_fec_init_pins(void);
+#endif /* CONFIG_FEC_MXC */
+
+#ifdef CONFIG_MXC_MMC
+extern void mx27_sd2_init_pins(void);
+#endif /* CONFIG_MXC_MMC */
+
 /* AIPI */
 struct aipi_regs {
 	u32 psr0;
include/configs/imx27lite.h new file +252 -0

252 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#58 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Quoted 12 lines · Ilya Yanok

From: Ilya Yanok <[email protected]>
Subject: [U-Boot] [PATCH] imx27lite: add support for imx27lite board from LogicPD
To: plagnioj at jcrosoft.com
Cc: u-boot at lists.denx.de, "Ilya Yanok" <[email protected]>
Date: Monday, August 10, 2009, 7:32 PM
This patch adds support for
i.MX27-LITEKIT development board from
LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash,
64MB NAND
flash, FEC ethernet controller integrated into i.MX27.

...

Quoted 2 lines

cpu/arm926ejs/mx27/generic.c ? |???65 ++++++++
include/asm-arm/arch-mx27/imx-regs.h? ?

Shouldn't these two files be part of a separate patch as they are not specific to the iMX27 Lite board support?

Regards,

Fabio Estevam

author
#59 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Hi Fabio,

Quoted 6 lines · Fabio Estevam
Quoted 3 lines
 cpu/arm926ejs/mx27/generic.c   |   65 ++++++++

include/asm-arm/arch-mx27/imx-regs.h

Shouldn't these two files be part of a separate patch as they are not specific to the iMX27 Lite board support?

Well, I thought about this... Let's wait for a Jean-Christophe opinion.

Regards, Ilya.

#60 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

In reply to Ilya Yanok
Quoted 14 lines · Ilya Yanok

This patch adds support for i.MX27-LITEKIT development board from LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash, 64MB NAND flash, FEC ethernet controller integrated into i.MX27.

---
 MAINTAINERS                             |    1 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/logicpd/imx27lite/Makefile        |   51 ++++++
 board/logicpd/imx27lite/config.mk       |    1 +
 board/logicpd/imx27lite/imx27lite.c     |   73 +++++++++
 board/logicpd/imx27lite/lowlevel_init.S |  170 +++++++++++++++++++++
 cpu/arm926ejs/mx27/generic.c            |   65 ++++++++
Quoted 8 lines
 include/asm-arm/arch-mx27/imx-regs.h    |   12 ++
 include/configs/imx27lite.h             |  252 +++++++++++++++++++++++++++++++
 10 files changed, 629 insertions(+), 0 deletions(-)
 create mode 100644 board/logicpd/imx27lite/Makefile
 create mode 100644 board/logicpd/imx27lite/config.mk
 create mode 100644 board/logicpd/imx27lite/imx27lite.c
 create mode 100644 board/logicpd/imx27lite/lowlevel_init.S
 create mode 100644 include/configs/imx27lite.h

Scott could you applied on your tree as this one need the nand patch that you handle

Best Regards,
J.

#61 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Dear Scott,

Quoted 23 lines · In message <[email protected]> Jean-Christophe…
Quoted 14 lines · Ilya Yanok

This patch adds support for i.MX27-LITEKIT development board from LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash, 64MB NAND flash, FEC ethernet controller integrated into i.MX27.

---
 MAINTAINERS                             |    1 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/logicpd/imx27lite/Makefile        |   51 ++++++
 board/logicpd/imx27lite/config.mk       |    1 +
 board/logicpd/imx27lite/imx27lite.c     |   73 +++++++++
 board/logicpd/imx27lite/lowlevel_init.S |  170 +++++++++++++++++++++
 cpu/arm926ejs/mx27/generic.c            |   65 ++++++++
Quoted 8 lines
 include/asm-arm/arch-mx27/imx-regs.h    |   12 ++
 include/configs/imx27lite.h             |  252 +++++++++++++++++++++++++++++++
 10 files changed, 629 insertions(+), 0 deletions(-)
 create mode 100644 board/logicpd/imx27lite/Makefile
 create mode 100644 board/logicpd/imx27lite/config.mk
 create mode 100644 board/logicpd/imx27lite/imx27lite.c
 create mode 100644 board/logicpd/imx27lite/lowlevel_init.S
 create mode 100644 include/configs/imx27lite.h
Quoted 4 lines

Scott could you applied on your tree as this one need the nand patch that you handle

Could you please run this through your "next" branch and send a pullr equest? TIA.

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
A father doesn't destroy his children.
	-- Lt. Carolyn Palamas, "Who Mourns for Adonais?",
	   stardate 3468.1.
#62 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

Quoted 7 lines · Wolfgang Denk
Quoted 2 lines

Scott could you applied on your tree as this one need the nand patch that you handle

Could you please run this through your "next" branch and send a pullr equest? TIA.

I don't have that patch in my inbox anymore -- but I've sent a pull request for what I do have in "next". You (or JC) should be able to apply this after pulling that.

-Scott

#63 lore raw

PATCH 1/1 imx27lite: add support for imx27lite board from LogicPD

In reply to Ilya Yanok
Quoted 14 lines · Ilya Yanok

This patch adds support for i.MX27-LITEKIT development board from LogicPD. This board uses i.MX27 SoC and has 2MB NOR flash, 64MB NAND flash, FEC ethernet controller integrated into i.MX27.

---
 MAINTAINERS                             |    1 +
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/logicpd/imx27lite/Makefile        |   51 ++++++
 board/logicpd/imx27lite/config.mk       |    1 +
 board/logicpd/imx27lite/imx27lite.c     |   73 +++++++++
 board/logicpd/imx27lite/lowlevel_init.S |  170 +++++++++++++++++++++
 cpu/arm926ejs/mx27/generic.c            |   65 ++++++++
Quoted 8 lines
 include/asm-arm/arch-mx27/imx-regs.h    |   12 ++
 include/configs/imx27lite.h             |  252 +++++++++++++++++++++++++++++++
 10 files changed, 629 insertions(+), 0 deletions(-)
 create mode 100644 board/logicpd/imx27lite/Makefile
 create mode 100644 board/logicpd/imx27lite/config.mk
 create mode 100644 board/logicpd/imx27lite/imx27lite.c
 create mode 100644 board/logicpd/imx27lite/lowlevel_init.S
 create mode 100644 include/configs/imx27lite.h

Applie to u-boot-arm

Best Regards,
J.

#64 lore raw

v3 cover Support for LogicPD i.MX27-LITEKIT development board

In reply to Ilya Yanok
Quoted 5 lines · Ilya Yanok

This patch set adds support for LogicPD i.MX27-LITEKIT development board. It contains support for i.MX27 CPU, support for serial console, FEC ethernet controller, NFC NAND controller and SDHC controller.

ping no news for this patch series?

Best Regards,
J.

#65 lore raw

PATCH 1/1 ARM EABI: add new helper functions resp. function names

The ARM EABI defines new names for GCC helper functions, and GCC seems to need some new functions as well.

This patch is a minimal-invasive approach to fix problems with EABI conformant tool chains (to be used with "USE_PRIVATE_LIBGCC=yes").

---
 lib_arm/_ashldi3.S |    2 ++
 lib_arm/_ashrdi3.S |    2 ++
 lib_arm/_divsi3.S  |    2 ++
 lib_arm/_lshrdi3.S |    2 ++
 lib_arm/_udivsi3.S |   34 +++++++++++++++++++++++++---------
 5 files changed, 33 insertions(+), 9 deletions(-)
lib_arm/_ashldi3.S +2 -0
index de4403d..834ddc2 100644
@@ -35,7 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #endif
 
 .globl __ashldi3
+.globl	__aeabi_llsl
 __ashldi3:
+__aeabi_llsl:
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
lib_arm/_ashrdi3.S +2 -0
index 5edbcb3..671ac87 100644
@@ -35,7 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #endif
 
 .globl __ashrdi3
+.globl __aeabi_lasr
 __ashrdi3:
+__aeabi_lasr:
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
lib_arm/_divsi3.S +2 -0
index 9dc15f6..cfbadb2 100644
@@ -96,7 +96,9 @@
 
 	.align	5
 .globl __divsi3
+.globl __aeabi_idiv
 __divsi3:
+__aeabi_idiv:
 	cmp	r1, #0
 	eor	ip, r0, r1			@ save the sign of the result.
 	beq	Ldiv0
lib_arm/_lshrdi3.S +2 -0
index fabfd9f..e7fa799 100644
@@ -35,7 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #endif
 
 .globl __lshrdi3
+.globl __aeabi_llsr
 __lshrdi3:
+__aeabi_llsr:
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
lib_arm/_udivsi3.S +25 -9
index a3f9b59..1309802 100644
@@ -11,9 +11,12 @@ curbit		.req	r3
 /* pc		.req	r15	*/
 	.text
 	.globl	 __udivsi3
-	.type  __udivsi3       ,function
+	.type	__udivsi3 ,function
+	.globl	__aeabi_uidiv
+	.type	__aeabi_uidiv ,function
 	.align	0
- __udivsi3      :
+ __udivsi3:
+ __aeabi_uidiv:
 	cmp	divisor, #0
 	beq	Ldiv0
 	mov	curbit, #1
@@ -68,10 +71,23 @@ Ldiv0:
 	mov	r0, #0			@ about as wrong as it could be
 	ldmia	sp!, {pc}
 	.size  __udivsi3       , . -  __udivsi3
-/* # 235 "libgcc1.S" */
-/* # 320 "libgcc1.S" */
-/* # 421 "libgcc1.S" */
-/* # 433 "libgcc1.S" */
-/* # 456 "libgcc1.S" */
-/* # 500 "libgcc1.S" */
-/* # 580 "libgcc1.S" */
+
+.globl __aeabi_uidivmod
+__aeabi_uidivmod:
+
+	stmfd	sp!, {r0, r1, ip, lr}
+	bl	__aeabi_uidiv
+	ldmfd	sp!, {r1, r2, ip, lr}
+	mul	r3, r0, r2
+	sub	r1, r1, r3
+	mov	pc, lr
+
+.globl __aeabi_idivmod
+__aeabi_idivmod:
+
+	stmfd	sp!, {r0, r1, ip, lr}
+	bl	__aeabi_idiv
+	ldmfd	sp!, {r1, r2, ip, lr}
+	mul	r3, r0, r2
+	sub	r1, r1, r3
+	mov	pc, lr
Signature · 1 line
1.6.0.6
#66 lore raw

PATCH 1/1 ARM EABI: add new helper functions resp. function names

Quoted 5 lines · Wolfgang Denk

The ARM EABI defines new names for GCC helper functions, and GCC seems to need some new functions as well.

This patch is a minimal-invasive approach to fix problems with EABI conformant tool chains (to be used with "USE_PRIVATE_LIBGCC=yes").

Using my broken toolchain, which needs USE_PRIVATE_LIBGCC=yes for successful linking, I did ./MAKEALL ARM_CORTEX_A8 without and with this patch and both compile fine recent git head.

Thanks

Dirk

#67 lore raw

PATCH 1/1 ARM EABI: add new helper functions resp. function names

Dear Dirk,

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

Using my broken toolchain, which needs USE_PRIVATE_LIBGCC=yes for successful linking, I did ./MAKEALL ARM_CORTEX_A8 without and with this patch and both compile fine recent git head.

Thanks for testing.

May I interpret this a s "Tested-by:" message?

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 right is not what someone gives you; it's what no one can take from
you.                                                   - Ramsey Clark
#68 lore raw

PATCH 1/1 ARM EABI: add new helper functions resp. function names

Quoted 10 lines · Wolfgang Denk

Dear Dirk,

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

Using my broken toolchain, which needs USE_PRIVATE_LIBGCC=yes for successful linking, I did ./MAKEALL ARM_CORTEX_A8 without and with this patch and both compile fine recent git head.

Thanks for testing.

May I interpret this a s "Tested-by:" message?

After boot test on BeagleBoard:

#69 lore raw

PATCH 1/1 ARM EABI: add new helper functions resp. function names

In reply to Wolfgang Denk
Quoted 6 lines · In message <[email protected]> I wrote:

The ARM EABI defines new names for GCC helper functions, and GCC seems to need some new functions as well.

This patch is a minimal-invasive approach to fix problems with EABI conformant tool chains (to be used with "USE_PRIVATE_LIBGCC=yes").

Quoted 8 lines
---
 lib_arm/_ashldi3.S |    2 ++
 lib_arm/_ashrdi3.S |    2 ++
 lib_arm/_divsi3.S  |    2 ++
 lib_arm/_lshrdi3.S |    2 ++
 lib_arm/_udivsi3.S |   34 +++++++++++++++++++++++++---------
 5 files changed, 33 insertions(+), 9 deletions(-)

Applied.

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
Never underestimate the power of human stupidity  when  it  comes  to
using technology they don't understand.