RE: [PATCH 00/13] x86: Various minor enhancements for coreboot

2023-02-21 Thread Jason Liu


> -Original Message-
> From: Simon Glass 
> Sent: 2023年2月21日 3:49
> To: U-Boot Mailing List 
> Cc: Bin Meng ; Simon Glass ;
> AKASHI Takahiro ; Andrew Scull
> ; Heinrich Schuchardt ; Ilias
> Apalodimas ; Jason Liu
;
> John Keeping ; Marek Vasut ;
> Masahisa Kojima ; Michal Suchanek
> ; Pali Rohár ; Pierre-Clément Tosi
> ; Rasmus Villemoes ;
> Stefan Roese 
> Subject: [PATCH 00/13] x86: Various minor enhancements for coreboot
> 
> This series includes some patches generated while getting U-Boot to boot
more
> nicely on Brya, an Adler Lake Chromebook.
> 
> This includes:
> - show the ACPI tables with 'acpi list'
> - get the UART to work even if coreboot doesn't enable it
> - show unimplemented sysinfo tags
> - fix for keyboard not working
> - fix for trying to set up PCI regions when the info is not available
> - fix for looking at inaccessible memory to find the sysinfo table
> 
> 
> Simon Glass (13):
>   mtrr: Don't show an invalid CPU number
>   x86: Adjust search range for sysinfo table
>   input: Only reset the keyboard when running bare metal
>   x86: coreboot: Allow ACPI tables to be recorded
>   x86: coreboot: Collect the address of the ACPI tables
>   x86: Allow locating UARTs by device ID
>   pci: coreboot: Don't read regions when booting
>   usb: Quieten a debug message
>   x86: coreboot: Use a memory-mapped UART
>   x86: coreboot: Document how to enable the debug UART
>   x86: coreboot: Scan PCI after relocation
>   x86: coreboot: Log function names and line numbers
>   x86: coreboot: Show unimplemented sysinfo tags

This patch-set looks fine to me, thus,

Reviewed-by: Jason Liu 

> 
>  arch/x86/cpu/cpu.c |  2 +-
>  arch/x86/dts/coreboot.dts  |  4 ++
>  arch/x86/include/asm/cb_sysinfo.h  |  8 +++
>  arch/x86/include/asm/coreboot_tables.h |  2 +
>  arch/x86/lib/coreboot/cb_sysinfo.c | 13 +
>  cmd/Kconfig|  3 +-
>  cmd/acpi.c |  4 ++
>  cmd/x86/cbsysinfo.c|  9 
>  cmd/x86/mtrr.c |  3 +-
>  configs/coreboot_defconfig |  5 ++
>  doc/board/coreboot/coreboot.rst| 29 +++
>  drivers/input/i8042.c  | 13 +++--
>  drivers/pci/pci-uclass.c   |  4 ++
>  drivers/serial/serial_coreboot.c   | 69 +++---
>  drivers/usb/host/xhci.c|  4 +-
>  include/asm-generic/global_data.h  |  4 +-
>  include/configs/coreboot.h |  2 +
>  include/pci_ids.h  |  3 ++
>  18 files changed, 161 insertions(+), 20 deletions(-)
> 
> --
> 2.39.2.637.g21b0678d19-goog



smime.p7s
Description: S/MIME cryptographic signature


[U-Boot] [PATCH] i.mx: i.mx6q: add the initial support for i.mx6q Sabre Lite board

2011-12-05 Thread Jason Liu
From: Dirk Behme 

Add the initial support for Freescale i.MX6Q Sabre Lite board

Signed-off-by: Dirk Behme 
Signed-off-by: Jason Liu 
Cc: Stefano Babic 
---
 MAINTAINERS   |1 +
 board/freescale/mx6qsabrelite/Makefile|   42 ++
 board/freescale/mx6qsabrelite/imximage.cfg|  170 +
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |  150 ++
 boards.cfg|1 +
 include/configs/mx6qsabrelite.h   |  158 +++
 6 files changed, 522 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 52d86bd..8a4060f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -569,6 +569,7 @@ Jason Liu 
mx53evk i.MX53
mx53locoi.MX53
mx6qarm2i.MX6Q
+   mx6qsabrelite   i.MX6Q
 
 Enric Balletbo i Serra 
 
diff --git a/board/freescale/mx6qsabrelite/Makefile 
b/board/freescale/mx6qsabrelite/Makefile
new file mode 100644
index 000..9b3c493
--- /dev/null
+++ b/board/freescale/mx6qsabrelite/Makefile
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2007, Guennadi Liakhovetski 
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx6qsabrelite.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx6qsabrelite/imximage.cfg 
b/board/freescale/mx6qsabrelite/imximage.cfg
new file mode 100644
index 000..8d3848f
--- /dev/null
+++ b/board/freescale/mx6qsabrelite/imximage.cfg
@@ -0,0 +1,170 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM  sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type   AddressValue
+#
+# where:
+#  Addr-type register length (1,2 or 4 bytes)
+#  Address   absolute address of the register
+#  value value to be stored in the register
+DATA 4 0x020e05a8 0x0030
+DATA 4 0x020e05b0 0x0030
+DATA 4 0x020e0524 0x0030
+DATA 4 0x020e051c 0x0030
+
+DATA 4 0x020e0518 0x0030
+DATA 4 0x020e050c 0x0030
+DATA 4 0x020e05b8 0x0030
+DATA 4 0x020e05c0 0x0030
+
+DATA 4 0x020e05ac 0x00020030
+DATA 4 0x020e05b4 0x00020030
+DATA 4 0x020e0528 0x00020030
+DATA 4 0x020e0520 0x00020030
+
+DATA 4 0x020e0514 0x00020030
+DATA 4 0x020e0510 0x00020030
+DATA 4 0x020e05bc 0x00020030
+DATA 4 0x020e05c4 0x00020030
+
+DATA 4 0x020e056c 0x00020030
+DATA 4 0x020e0578 0x00020030
+DATA 4 0x020e0588 0x00020030
+DATA 4 0x020e0594 0x00020030
+
+DATA 4 0x020e057c 0x00020030
+DATA 4 0x020e0590 0x3000
+DATA 4 0x020e0598 0x3000
+DATA 4 0x020e058c 0x
+
+DATA 4 0x020e059c 0x3030
+DATA 4 0x020e05a0 0x3030
+DATA 4 0x020e0784

[U-Boot] [PATCH V2 1/1] i.mx: i.mx6q: add the initial support for i.mx6q Sabre Lite board

2011-12-13 Thread Jason Liu
Add the initial support for Freescale i.MX6Q Sabre Lite board

Signed-off-by: Dirk Behme 
Signed-off-by: Jason Liu 

---
V2: change the default script to let linaro image boot, and also
change the default env to dev 0, which is normal SD slot, not
the Micro-SD slot
---
 MAINTAINERS   |1 +
 board/freescale/mx6qsabrelite/Makefile|   42 ++
 board/freescale/mx6qsabrelite/imximage.cfg|  170 +
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |  150 ++
 boards.cfg|1 +
 include/configs/mx6qsabrelite.h   |  162 +++
 6 files changed, 526 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 52d86bd..8a4060f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -569,6 +569,7 @@ Jason Liu 
mx53evk i.MX53
mx53locoi.MX53
mx6qarm2i.MX6Q
+   mx6qsabrelite   i.MX6Q
 
 Enric Balletbo i Serra 
 
diff --git a/board/freescale/mx6qsabrelite/Makefile 
b/board/freescale/mx6qsabrelite/Makefile
new file mode 100644
index 000..9b3c493
--- /dev/null
+++ b/board/freescale/mx6qsabrelite/Makefile
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2007, Guennadi Liakhovetski 
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx6qsabrelite.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx6qsabrelite/imximage.cfg 
b/board/freescale/mx6qsabrelite/imximage.cfg
new file mode 100644
index 000..8d3848f
--- /dev/null
+++ b/board/freescale/mx6qsabrelite/imximage.cfg
@@ -0,0 +1,170 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM  sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type   AddressValue
+#
+# where:
+#  Addr-type register length (1,2 or 4 bytes)
+#  Address   absolute address of the register
+#  value value to be stored in the register
+DATA 4 0x020e05a8 0x0030
+DATA 4 0x020e05b0 0x0030
+DATA 4 0x020e0524 0x0030
+DATA 4 0x020e051c 0x0030
+
+DATA 4 0x020e0518 0x0030
+DATA 4 0x020e050c 0x0030
+DATA 4 0x020e05b8 0x0030
+DATA 4 0x020e05c0 0x0030
+
+DATA 4 0x020e05ac 0x00020030
+DATA 4 0x020e05b4 0x00020030
+DATA 4 0x020e0528 0x00020030
+DATA 4 0x020e0520 0x00020030
+
+DATA 4 0x020e0514 0x00020030
+DATA 4 0x020e0510 0x00020030
+DATA 4 0x020e05bc 0x00020030
+DATA 4 0x020e05c4 0x00020030
+
+DATA 4 0x020e056c 0x00020030
+DATA 4 0x020e0578 0x00020030
+DATA 4 0x020e0588 0x00020030
+DATA 4 0x020e0594 0x00020030
+
+DATA 4 0x020e057c 0x00020030
+DATA 4 0x020e0590 0x3000
+DATA 4 0x020e0598

[U-Boot] [PATCH 0/3] i.mx6q: Add the ethernet function support

2011-12-13 Thread Jason Liu
This patch add the ethernet function support for i.mx6q/arm2 board.

The patch has been tested ok by: Dirk Behme 
on freescale i.mx6qarm2 board.

Jason Liu (3):
  i.mx: i.mx6q: Add the enet clock function
  fec: add the i.mx6q enet driver support
  i.mx6q: arm2: Add the enet function support

 arch/arm/cpu/armv7/mx6/clock.c  |5 ++
 board/freescale/mx6qarm2/mx6qarm2.c |   90 +++
 drivers/net/fec_mxc.c   |   10 
 drivers/net/fec_mxc.h   |7 ++-
 include/configs/mx6qarm2.h  |   13 -
 5 files changed, 122 insertions(+), 3 deletions(-)

-- 
1.7.4.1


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


[U-Boot] [PATCH 1/3] i.mx: i.mx6q: Add the enet clock function

2011-12-13 Thread Jason Liu
Cc: Stefano Babic 
Signed-off-by: Jason Liu 
---
 arch/arm/cpu/armv7/mx6/clock.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
index b143535..fa3a124 100644
--- a/arch/arm/cpu/armv7/mx6/clock.c
+++ b/arch/arm/cpu/armv7/mx6/clock.c
@@ -285,6 +285,11 @@ u32 imx_get_uartclk(void)
return get_uart_clk();
 }
 
+u32 imx_get_fecclk(void)
+{
+   return decode_pll(PLL_ENET, CONFIG_SYS_MX6_HCLK);
+}
+
 unsigned int mxc_get_clock(enum mxc_clock clk)
 {
switch (clk) {
-- 
1.7.4.1


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


[U-Boot] [PATCH 2/3] fec: add the i.mx6q enet driver support

2011-12-13 Thread Jason Liu
Cc: Stefano Babic 
Signed-off-by: Jason Liu 
---
 drivers/net/fec_mxc.c |   10 ++
 drivers/net/fec_mxc.h |7 ++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index b05a4c0..3affda8 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -384,6 +384,14 @@ static int fec_open(struct eth_device *edev)
writel(1 << 2, &fec->eth->x_cntrl);
fec->rbd_index = 0;
 
+#if defined(CONFIG_MX6Q)
+   /* Enable ENET HW endian SWAP */
+   writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_DBSWAP,
+   &fec->eth->ecntrl);
+   /* Enable ENET store and forward mode */
+   writel(readl(&fec->eth->x_wmrk) | FEC_X_WMRK_STRFWD,
+   &fec->eth->x_wmrk);
+#endif
/*
 * Enable FEC-Lite controller
 */
@@ -485,6 +493,8 @@ static int fec_init(struct eth_device *dev, bd_t* bd)
rcntrl = PKTSIZE << FEC_RCNTRL_MAX_FL_SHIFT;
if (fec->xcv_type == SEVENWIRE)
rcntrl |= FEC_RCNTRL_FCE;
+   else if (fec->xcv_type == RGMII)
+   rcntrl |= FEC_RCNTRL_RGMII;
else if (fec->xcv_type == RMII)
rcntrl |= FEC_RCNTRL_RMII;
else/* MII mode */
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h
index 8b26645..39337bf 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -196,6 +196,7 @@ struct ethernet_regs {
 #define FEC_RCNTRL_PROM0x0008
 #define FEC_RCNTRL_BC_REJ  0x0010
 #define FEC_RCNTRL_FCE 0x0020
+#define FEC_RCNTRL_RGMII   0x0040
 #define FEC_RCNTRL_RMII0x0100
 
 #define FEC_TCNTRL_GTS 0x0001
@@ -206,6 +207,9 @@ struct ethernet_regs {
 
 #define FEC_ECNTRL_RESET   0x0001  /* reset the FEC */
 #define FEC_ECNTRL_ETHER_EN0x0002  /* enable the FEC */
+#define FEC_ECNTRL_DBSWAP  0x0100
+
+#define FEC_X_WMRK_STRFWD  0x0100
 
 #if defined(CONFIG_MX25) || defined(CONFIG_MX53)
 /* defines for MIIGSK */
@@ -261,7 +265,8 @@ enum xceiver_type {
SEVENWIRE,  /* 7-wire   */
MII10,  /* MII 10Mbps   */
MII100, /* MII 100Mbps  */
-   RMII/* RMII */
+   RMII,   /* RMII */
+   RGMII,  /* RGMII */
 };
 
 /**
-- 
1.7.4.1


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


[U-Boot] [PATCH 3/3] i.mx6q: arm2: Add the enet function support

2011-12-13 Thread Jason Liu
This enable the network function on the i.mx6q armadillo2
board(arm2), thus we can use tftp to load image from network.

Cc: Stefano Babic 
Signed-off-by: Jason Liu 
Tested-by: Dirk Behme 
---
 board/freescale/mx6qarm2/mx6qarm2.c |   90 +++
 include/configs/mx6qarm2.h  |   13 -
 2 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6qarm2/mx6qarm2.c 
b/board/freescale/mx6qarm2/mx6qarm2.c
index 89e0e76..1df063a 100644
--- a/board/freescale/mx6qarm2/mx6qarm2.c
+++ b/board/freescale/mx6qarm2/mx6qarm2.c
@@ -29,6 +29,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,6 +42,10 @@ DECLARE_GLOBAL_DATA_PTR;
PAD_CTL_PUS_47K_UP  | PAD_CTL_SPEED_LOW |   \
PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
+#define ENET_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |\
+   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   | \
+   PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+
 int dram_init(void)
 {
gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
@@ -79,11 +85,35 @@ iomux_v3_cfg_t usdhc4_pads[] = {
MX6Q_PAD_SD4_DAT7__USDHC4_DAT7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
 };
 
+iomux_v3_cfg_t enet_pads[] = {
+   MX6Q_PAD_KEY_COL1__ENET_MDIO| MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_KEY_COL2__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TXC__ENET_RGMII_TXC  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD0__ENET_RGMII_TD0  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD1__ENET_RGMII_TD1  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD2__ENET_RGMII_TD2  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD3__ENET_RGMII_TD3  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RXC__ENET_RGMII_RXC  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD0__ENET_RGMII_RD0  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD1__ENET_RGMII_RD1  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
+};
+
+
 static void setup_iomux_uart(void)
 {
imx_iomux_v3_setup_multiple_pads(uart4_pads, ARRAY_SIZE(uart4_pads));
 }
 
+static void setup_iomux_enet(void)
+{
+   imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
+}
+
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg usdhc_cfg[2] = {
{USDHC3_BASE_ADDR, 1},
@@ -132,9 +162,69 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+#define MII_MMD_ACCESS_CTRL_REG0xd
+#define MII_MMD_ACCESS_ADDR_DATA_REG   0xe
+#define MII_DBG_PORT_REG   0x1d
+#define MII_DBG_PORT2_REG  0x1e
+
+int fecmxc_mii_postcall(int phy)
+{
+   unsigned short val;
+
+   /*
+* Due to the i.MX6Q Armadillo2 board HW design,there is
+* no 125Mhz clock input from SOC. In order to use RGMII,
+* We need enable AR8031 ouput a 125MHz clk from CLK_25M
+*/
+   miiphy_write("FEC", phy, MII_MMD_ACCESS_CTRL_REG, 0x7);
+   miiphy_write("FEC", phy, MII_MMD_ACCESS_ADDR_DATA_REG, 0x8016);
+   miiphy_write("FEC", phy, MII_MMD_ACCESS_CTRL_REG, 0x4007);
+   miiphy_read("FEC", phy, MII_MMD_ACCESS_ADDR_DATA_REG, &val);
+   val &= 0xffe3;
+   val |= 0x18;
+   miiphy_write("FEC", phy, MII_MMD_ACCESS_ADDR_DATA_REG, val);
+
+   /* For the RGMII phy, we need enable tx clock delay */
+   miiphy_write("FEC", phy, 0x1d, 0x5);
+   miiphy_read("FEC", phy, 0x1e, &val);
+   val |= 0x0100;
+   miiphy_write("FEC", phy, 0x1e, val);
+
+   miiphy_write("FEC", phy, MII_BMCR, 0xa100);
+
+   return 0;
+}
+
+int board_eth_init(bd_t *bis)
+{
+   struct eth_device *dev;
+   int ret;
+
+   ret = cpu_eth_init(bis);
+   if (ret) {
+   printf("FEC MXC: %s:failed\n", __func__);
+   return ret;
+   }
+
+   dev = eth_get_dev_by_name("FEC");
+   if (!dev) {
+   printf("FEC MXC: Unable to get FEC device entry\n");
+   return -EINVAL;
+   }
+
+   ret = fecmxc_register_mii_postcall(dev, fecmxc_mii_postcall);
+   if (ret) {
+   printf("FEC MXC: Unable to register FEC mii postcall\n");
+   return ret;
+   }
+
+   return 0;
+}
+
 int board_early_init_f(void)
 {
setup_iomux_uart();
+   setup_iomux_enet();
 
return 0;
 }
diff --git a/include/configs/mx6qarm2.h b/include/configs/mx6qarm2.h
index a7b363d..3a30679 100644
--- 

[U-Boot] [PATCH v2 0/3] i.mx6q: Add the ethernet function support

2011-12-16 Thread Jason Liu
This patch add the ethernet function support for i.mx6q/arm2 board.

The patch has been tested ok by: Dirk Behme 
on freescale i.mx6qarm2 board.

Jason Liu (3):
  i.mx: i.mx6q: Add the enet clock function
  fec: add the i.mx6q enet driver support
  i.mx6q: arm2: Add the enet function support

 arch/arm/cpu/armv7/mx6/clock.c  |5 ++
 board/freescale/mx6qarm2/mx6qarm2.c |   90 +++
 drivers/net/fec_mxc.c   |   10 
 drivers/net/fec_mxc.h   |7 ++-
 include/configs/mx6qarm2.h  |   12 -
 5 files changed, 121 insertions(+), 3 deletions(-)

-- 
1.7.4.1


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


[U-Boot] [PATCH v2 1/3] i.mx: i.mx6q: Add the enet clock function

2011-12-16 Thread Jason Liu
Cc: Stefano Babic 
Signed-off-by: Jason Liu 
Acked-by: Stefano Babic 

---
v2: Add Stefano's ack
---
 arch/arm/cpu/armv7/mx6/clock.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
index b143535..fa3a124 100644
--- a/arch/arm/cpu/armv7/mx6/clock.c
+++ b/arch/arm/cpu/armv7/mx6/clock.c
@@ -285,6 +285,11 @@ u32 imx_get_uartclk(void)
return get_uart_clk();
 }
 
+u32 imx_get_fecclk(void)
+{
+   return decode_pll(PLL_ENET, CONFIG_SYS_MX6_HCLK);
+}
+
 unsigned int mxc_get_clock(enum mxc_clock clk)
 {
switch (clk) {
-- 
1.7.4.1


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


[U-Boot] [PATCH v2 2/3] fec: add the i.mx6q enet driver support

2011-12-16 Thread Jason Liu
Cc: Stefano Babic 
Signed-off-by: Jason Liu 
Acked-by: Stefano Babic 

---
v2: Add Stefano's ack
---
 drivers/net/fec_mxc.c |   10 ++
 drivers/net/fec_mxc.h |7 ++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index b05a4c0..3affda8 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -384,6 +384,14 @@ static int fec_open(struct eth_device *edev)
writel(1 << 2, &fec->eth->x_cntrl);
fec->rbd_index = 0;
 
+#if defined(CONFIG_MX6Q)
+   /* Enable ENET HW endian SWAP */
+   writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_DBSWAP,
+   &fec->eth->ecntrl);
+   /* Enable ENET store and forward mode */
+   writel(readl(&fec->eth->x_wmrk) | FEC_X_WMRK_STRFWD,
+   &fec->eth->x_wmrk);
+#endif
/*
 * Enable FEC-Lite controller
 */
@@ -485,6 +493,8 @@ static int fec_init(struct eth_device *dev, bd_t* bd)
rcntrl = PKTSIZE << FEC_RCNTRL_MAX_FL_SHIFT;
if (fec->xcv_type == SEVENWIRE)
rcntrl |= FEC_RCNTRL_FCE;
+   else if (fec->xcv_type == RGMII)
+   rcntrl |= FEC_RCNTRL_RGMII;
else if (fec->xcv_type == RMII)
rcntrl |= FEC_RCNTRL_RMII;
else/* MII mode */
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h
index 8b26645..39337bf 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -196,6 +196,7 @@ struct ethernet_regs {
 #define FEC_RCNTRL_PROM0x0008
 #define FEC_RCNTRL_BC_REJ  0x0010
 #define FEC_RCNTRL_FCE 0x0020
+#define FEC_RCNTRL_RGMII   0x0040
 #define FEC_RCNTRL_RMII0x0100
 
 #define FEC_TCNTRL_GTS 0x0001
@@ -206,6 +207,9 @@ struct ethernet_regs {
 
 #define FEC_ECNTRL_RESET   0x0001  /* reset the FEC */
 #define FEC_ECNTRL_ETHER_EN0x0002  /* enable the FEC */
+#define FEC_ECNTRL_DBSWAP  0x0100
+
+#define FEC_X_WMRK_STRFWD  0x0100
 
 #if defined(CONFIG_MX25) || defined(CONFIG_MX53)
 /* defines for MIIGSK */
@@ -261,7 +265,8 @@ enum xceiver_type {
SEVENWIRE,  /* 7-wire   */
MII10,  /* MII 10Mbps   */
MII100, /* MII 100Mbps  */
-   RMII/* RMII */
+   RMII,   /* RMII */
+   RGMII,  /* RGMII */
 };
 
 /**
-- 
1.7.4.1


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


[U-Boot] [PATCH v2 3/3] i.mx6q: arm2: Add the enet function support

2011-12-16 Thread Jason Liu
This enable the network function on the i.mx6q armadillo2
board(arm2), thus we can use tftp to load image from network.

Cc: Stefano Babic 
Signed-off-by: Jason Liu 
Tested-by: Dirk Behme 

---
v2: use constant define and remove ETHPRIME config
---
 board/freescale/mx6qarm2/mx6qarm2.c |   90 +++
 include/configs/mx6qarm2.h  |   12 -
 2 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6qarm2/mx6qarm2.c 
b/board/freescale/mx6qarm2/mx6qarm2.c
index 89e0e76..9894245 100644
--- a/board/freescale/mx6qarm2/mx6qarm2.c
+++ b/board/freescale/mx6qarm2/mx6qarm2.c
@@ -29,6 +29,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,6 +42,10 @@ DECLARE_GLOBAL_DATA_PTR;
PAD_CTL_PUS_47K_UP  | PAD_CTL_SPEED_LOW |   \
PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
+#define ENET_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |\
+   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   | \
+   PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+
 int dram_init(void)
 {
gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
@@ -79,11 +85,35 @@ iomux_v3_cfg_t usdhc4_pads[] = {
MX6Q_PAD_SD4_DAT7__USDHC4_DAT7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
 };
 
+iomux_v3_cfg_t enet_pads[] = {
+   MX6Q_PAD_KEY_COL1__ENET_MDIO| MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_KEY_COL2__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TXC__ENET_RGMII_TXC  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD0__ENET_RGMII_TD0  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD1__ENET_RGMII_TD1  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD2__ENET_RGMII_TD2  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD3__ENET_RGMII_TD3  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RXC__ENET_RGMII_RXC  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD0__ENET_RGMII_RD0  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD1__ENET_RGMII_RD1  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
+};
+
+
 static void setup_iomux_uart(void)
 {
imx_iomux_v3_setup_multiple_pads(uart4_pads, ARRAY_SIZE(uart4_pads));
 }
 
+static void setup_iomux_enet(void)
+{
+   imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
+}
+
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg usdhc_cfg[2] = {
{USDHC3_BASE_ADDR, 1},
@@ -132,9 +162,69 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+#define MII_MMD_ACCESS_CTRL_REG0xd
+#define MII_MMD_ACCESS_ADDR_DATA_REG   0xe
+#define MII_DBG_PORT_REG   0x1d
+#define MII_DBG_PORT2_REG  0x1e
+
+int fecmxc_mii_postcall(int phy)
+{
+   unsigned short val;
+
+   /*
+* Due to the i.MX6Q Armadillo2 board HW design,there is
+* no 125Mhz clock input from SOC. In order to use RGMII,
+* We need enable AR8031 ouput a 125MHz clk from CLK_25M
+*/
+   miiphy_write("FEC", phy, MII_MMD_ACCESS_CTRL_REG, 0x7);
+   miiphy_write("FEC", phy, MII_MMD_ACCESS_ADDR_DATA_REG, 0x8016);
+   miiphy_write("FEC", phy, MII_MMD_ACCESS_CTRL_REG, 0x4007);
+   miiphy_read("FEC", phy, MII_MMD_ACCESS_ADDR_DATA_REG, &val);
+   val &= 0xffe3;
+   val |= 0x18;
+   miiphy_write("FEC", phy, MII_MMD_ACCESS_ADDR_DATA_REG, val);
+
+   /* For the RGMII phy, we need enable tx clock delay */
+   miiphy_write("FEC", phy, MII_DBG_PORT_REG, 0x5);
+   miiphy_read("FEC", phy, MII_DBG_PORT2_REG, &val);
+   val |= 0x0100;
+   miiphy_write("FEC", phy, MII_DBG_PORT2_REG, val);
+
+   miiphy_write("FEC", phy, MII_BMCR, 0xa100);
+
+   return 0;
+}
+
+int board_eth_init(bd_t *bis)
+{
+   struct eth_device *dev;
+   int ret;
+
+   ret = cpu_eth_init(bis);
+   if (ret) {
+   printf("FEC MXC: %s:failed\n", __func__);
+   return ret;
+   }
+
+   dev = eth_get_dev_by_name("FEC");
+   if (!dev) {
+   printf("FEC MXC: Unable to get FEC device entry\n");
+   return -EINVAL;
+   }
+
+   ret = fecmxc_register_mii_postcall(dev, fecmxc_mii_postcall);
+   if (ret) {
+   printf("FEC MXC: Unable to register FEC mii postcall\n");
+   return ret;
+   }
+
+   return 0;
+}
+
 int board_early_init_f(void)
 {
setup_iomux_uart();
+   setup_iomux_enet();
 
return 0;
 }
diff --git a/includ

Re: [U-Boot] __mmc_get_env_addr() is not being called?

2011-12-18 Thread Jason Liu
2011/12/16 Stefano Babic :
> On 16/12/2011 06:54, Shawn Guo wrote:
>> Hi,
>>
>
> Hi Shawn,
>
>> I'm running v2011.12-rc1 (with one missing usdhc patch applied) on
>> mx6qarm2 board, and seeing a problem.  When I install u-boot on a
>> blank SD card, it boots fine with messge "*** Warning - bad CRC,
>> using default environment" seen as expected.  But once I run command
>> 'save' to write envs to the card, the card stop booting.
>>
>> I tracked the issue a little bit, and found __mmc_get_env_addr() does
>> not get called at all.  Therefore when I run 'save' for the first time,
>> the envs are written to offset 0 of the card, which in turn overwrites
>> the boot image.
>>
>> I have not figured out why it does.  But the following change fixes
>> the problem for me.
>>
>> diff --git a/common/env_mmc.c b/common/env_mmc.c
>> index 8441c77..3832fe4 100644
>> --- a/common/env_mmc.c
>> +++ b/common/env_mmc.c
>> @@ -46,13 +46,11 @@ DECLARE_GLOBAL_DATA_PTR;
>>  #define CONFIG_ENV_OFFSET 0
>>  #endif
>>
>> -static int __mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
>> +static int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
>>  {
>>         *env_addr = CONFIG_ENV_OFFSET;
>>         return 0;
>>  }
>> -int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
>> -       __attribute__((weak, alias("__mmc_get_env_addr")));
>>
>> Any comment on why the change fixes the problem is appreciated.
>
> The function is declared weak, this means that a specific architecture
> could implement its own version. The reason why it does not work is that
> there is a specific implementation in board/freescale/sdhc_boot.c, and
> the mmc_get_env_addr() in this file is taken instead of the default when
> CONFIG_ENV_IS_IN_MMC (as in our case) is set. Instead of your proposal,
> we should surround mmc_get_env_addr() in sdhc_boot.c with something like
> #ifndef CONFIG_MX6Q, or check if we can reuse this function, that really
> does not use CONFIG_ENV_OFFSET at all.
>
> I put Jason (board maintainer) in CC - Jason, what do mind ? Do you get
> the same issue when you tested the board ?

Stefano, I saw the issue.
Fabio's patch can fix the i.mx28evk issue, but can't fix the following
platforms:

11144  include/configs/efikamx.h <>
 #define CONFIG_FSL_ESDHC
  12 86  include/configs/mx51evk.h <>
 #define CONFIG_FSL_ESDHC
  13 58  include/configs/mx53ard.h <>
 #define CONFIG_FSL_ESDHC
  14 68  include/configs/mx53evk.h <>
 #define CONFIG_FSL_ESDHC
  15 51  include/configs/mx53loco.h <>
 #define CONFIG_FSL_ESDHC
  16 58  include/configs/mx53smd.h <>
 #define CONFIG_FSL_ESDHC
  17 48  include/configs/mx6qarm2.h <>
 #define CONFIG_FSL_ESDHC
  18 48  include/configs/mx6qsabrelite.h <>
 #define CONFIG_FSL_ESDHC
  20105  include/configs/vision2.h <>
 #define CONFIG_FSL_ESDHC

The commit  97039ab98 (env_mmc: Allow board code to override the
environment address)
break the i.mx5/6 boards support.

 BR,
Jason

>
> Best regards,
> Stefano Babic
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] i.mx6:imx6q: allign MAC address with burned-in ordering

2011-12-19 Thread Jason Liu
For the i.mx6q, the burned-in MAC address will be the following odering,

fuse: 0x620[7:0]   MAC_ADDR[7:0] ---> mac[5]
fuse: 0x620[15:8]  MAC_ADDR[15:8]---> mac[4]
fuse: 0x620[23:16] MAC_ADDR[23:16]   ---> mac[3]
fuse: 0x620[31:24] MAC_ADDR[31:24]   ---> mac[2]
fuse: 0x630[7:0]   MAC_ADDR[39:32]   ---> mac[1]
fuse: 0x630[15:8]  MAC_ADDR[47:40]   ---> mac[0]

This patch also fix the error caculation for the fuse bank[0] address

Signed-off-by: Jason Liu 
Cc: Stefano Babic 
---
 arch/arm/cpu/armv7/mx6/soc.c |   14 --
 arch/arm/include/asm/arch-mx6/imx-regs.h |2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index dff5e4e..bd59cf5 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -70,13 +70,15 @@ void imx_get_mac_from_fuse(unsigned char *mac)
struct fuse_bank4_regs *fuse =
(struct fuse_bank4_regs *)bank->fuse_regs;
 
-   u32 mac_lo = readl(&fuse->mac_addr_low);
-   u32 mac_hi = readl(&fuse->mac_addr_high);
+   u32 value = readl(&fuse->mac_addr_high);
+   mac[0] = (value >> 8);
+   mac[1] = value ;
 
-   *(u32 *)mac = mac_lo;
-
-   mac[4] = mac_hi & 0xff;
-   mac[5] = (mac_hi >> 8) & 0xff;
+   value = readl(&fuse->mac_addr_low);
+   mac[2] = value >> 24 ;
+   mac[3] = value >> 16 ;
+   mac[4] = value >> 8 ;
+   mac[5] = value ;
 
 }
 #endif
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 85d55b7..5fe9748 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -214,7 +214,7 @@ struct iim_regs {
u32 crc_value;
u32 rsvd6[3];
u32 version;
-   u32 rsvd7[0xd8];
+   u32 rsvd7[0xdb];
 
struct fuse_bank {
u32 fuse_regs[0x20];
-- 
1.7.4.1


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


Re: [U-Boot] [PATCH] i.mx6q: mx6qarm2: Enable the usboh3 clock

2011-12-26 Thread Jason Liu
2011/12/26 Dirk Behme :
> From: Eric Nelson 
>
> Bits 0 and 1 of CCM_CCGR7 are the usboh3 clock enable bits. Enabling this
> clock is necessary for the USB download.
>
> Signed-off-by: Eric Nelson 
> CC: Jason Hui 

Acked-by: Jason Hui 

> ---
>  board/freescale/mx6qarm2/imximage.cfg |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/board/freescale/mx6qarm2/imximage.cfg 
> b/board/freescale/mx6qarm2/imximage.cfg
> index ffac1b4..5f0ee0d 100644
> --- a/board/freescale/mx6qarm2/imximage.cfg
> +++ b/board/freescale/mx6qarm2/imximage.cfg
> @@ -164,4 +164,4 @@ DATA 4 0x020c4070 0x0FFFC000
>  DATA 4 0x020c4074 0x3FF0
>  DATA 4 0x020c4078 0x00FFF300
>  DATA 4 0x020c407c 0x0FC3
> -DATA 4 0x020c4080 0x03FC
> +DATA 4 0x020c4080 0x03FF
> --
> 1.7.7.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] i.mx6:imx6q: allign MAC address with burned-in ordering

2011-12-29 Thread Jason Liu
Stefano,

2011/12/19 Jason Liu :
> For the i.mx6q, the burned-in MAC address will be the following odering,
>
> fuse: 0x620[7:0]   MAC_ADDR[7:0]     ---> mac[5]
> fuse: 0x620[15:8]  MAC_ADDR[15:8]    ---> mac[4]
> fuse: 0x620[23:16] MAC_ADDR[23:16]   ---> mac[3]
> fuse: 0x620[31:24] MAC_ADDR[31:24]   ---> mac[2]
> fuse: 0x630[7:0]   MAC_ADDR[39:32]   ---> mac[1]
> fuse: 0x630[15:8]  MAC_ADDR[47:40]   ---> mac[0]
>
> This patch also fix the error caculation for the fuse bank[0] address
>
> Signed-off-by: Jason Liu 
> Cc: Stefano Babic 
> ---
>  arch/arm/cpu/armv7/mx6/soc.c             |   14 --
>  arch/arm/include/asm/arch-mx6/imx-regs.h |    2 +-
>  2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index dff5e4e..bd59cf5 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
> @@ -70,13 +70,15 @@ void imx_get_mac_from_fuse(unsigned char *mac)
>        struct fuse_bank4_regs *fuse =
>                        (struct fuse_bank4_regs *)bank->fuse_regs;
>
> -       u32 mac_lo = readl(&fuse->mac_addr_low);
> -       u32 mac_hi = readl(&fuse->mac_addr_high);
> +       u32 value = readl(&fuse->mac_addr_high);
> +       mac[0] = (value >> 8);
> +       mac[1] = value ;
>
> -       *(u32 *)mac = mac_lo;
> -
> -       mac[4] = mac_hi & 0xff;
> -       mac[5] = (mac_hi >> 8) & 0xff;
> +       value = readl(&fuse->mac_addr_low);
> +       mac[2] = value >> 24 ;
> +       mac[3] = value >> 16 ;
> +       mac[4] = value >> 8 ;
> +       mac[5] = value ;
>
>  }
>  #endif
> diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
> b/arch/arm/include/asm/arch-mx6/imx-regs.h
> index 85d55b7..5fe9748 100644
> --- a/arch/arm/include/asm/arch-mx6/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
> @@ -214,7 +214,7 @@ struct iim_regs {
>        u32     crc_value;
>        u32     rsvd6[3];
>        u32     version;
> -       u32     rsvd7[0xd8];
> +       u32     rsvd7[0xdb];
>
>        struct fuse_bank {
>                u32     fuse_regs[0x20];

Ping. Any comments?

> --
> 1.7.4.1
>
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 3/4] mmc: fsl_esdhc: Implement card-detect hook.

2012-01-03 Thread Jason Liu
2012/1/2 Thierry Reding :
> This card-detect hook probably doesn't work. Perhaps somebody with more
> knowledge about the hardware can comment on this. I think that perhaps
> even the complete code from esdhc_init() could go into the getcd()
> function instead or mmc_getcd() needs to be called at some later time
> after mmc_init(), which, however, would require many other drivers to
> change.

yes, the hook in the patch does not work for the fsl i.mx sdhc controller due to
silicon issues and we need always use gpio to read the card detection status.

>
> In addition to implementing the hook, this patch also removes the call
> to the board_mmc_getcd() function which is now called from the MMC
> framework and is no longer required here.
>
> Signed-off-by: Thierry Reding 
> ---

Tested ok on i.mx51evk board,

Tested-by: Jason Liu 

>  drivers/mmc/fsl_esdhc.c |   29 -
>  1 files changed, 12 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index f038acc..1ed5355 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -418,7 +418,6 @@ static int esdhc_init(struct mmc *mmc)
>        struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
>        struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
>        int timeout = 1000;
> -       int ret = 0;
>
>        /* Reset the entire host controller */
>        esdhc_write32(®s->sysctl, SYSCTL_RSTA);
> @@ -445,24 +444,19 @@ static int esdhc_init(struct mmc *mmc)
>        /* Set timout to the maximum value */
>        esdhc_clrsetbits32(®s->sysctl, SYSCTL_TIMEOUT_MASK, 14 << 16);
>
> -       /* Check if there is a callback for detecting the card */
> -       ret = board_mmc_getcd(mmc);
> -       if (ret < 0) {
> -               timeout = 1000;
> -               while (!(esdhc_read32(®s->prsstat) & PRSSTAT_CINS) &&
> -                               --timeout)
> -                       udelay(1000);
> +       return 0;
> +}
>
> -               if (timeout <= 0)
> -                       ret = NO_CARD_ERR;
> -       } else {
> -               if (ret == 0)
> -                       ret = NO_CARD_ERR;
> -               else
> -                       ret = 0;
> -       }
> +static int esdhc_getcd(struct mmc *mmc)
> +{
> +       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
> +       struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
> +       int timeout = 1000;
> +
> +       while (!(esdhc_read32(®s->prsstat) & PRSSTAT_CINS) && --timeout)
> +               udelay(1000);
>
> -       return ret;
> +       return timeout > 0;
>  }
>
>  static void esdhc_reset(struct fsl_esdhc *regs)
> @@ -500,6 +494,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg 
> *cfg)
>        mmc->send_cmd = esdhc_send_cmd;
>        mmc->set_ios = esdhc_set_ios;
>        mmc->init = esdhc_init;
> +       mmc->getcd = esdhc_getcd;
>
>        voltage_caps = 0;
>        caps = regs->hostcapblt;
> --
> 1.7.8.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 1/4] mmc: Change board_mmc_getcd() function prototype.

2012-01-03 Thread Jason Liu
2012/1/2 Thierry Reding :
> The new API no longer uses the extra cd parameter that was used to store
> the card presence state. Instead, this information is returned via the
> function's return value. board_mmc_getcd() returns -1 to indicate that
> no card-detection mechanism is implemented; 0 indicates that no card is
> present and 1 is returned if it was detected that a card is present.
>
> The rationale for this change can be found in the following email
> thread:
>
>        http://lists.denx.de/pipermail/u-boot/2011-November/110180.html
>
> In summary, the old API was not consistent with the rest of the MMC API
> which always passes a struct mmc as the first parameter. Furthermore the
> cd parameter was used to mean "card absence" in some implementations and
> "card presence" in others.
>
> Signed-off-by: Thierry Reding 
> ---
>  board/efikamx/efikamx.c             |    9 +
>  board/emk/top9000/top9000.c         |   12 ++--
>  board/freescale/mx51evk/mx51evk.c   |    9 +
>  board/freescale/mx53ard/mx53ard.c   |    9 +
>  board/freescale/mx53evk/mx53evk.c   |    9 +
>  board/freescale/mx53loco/mx53loco.c |    9 +
>  board/freescale/mx53smd/mx53smd.c   |    6 ++
>  doc/README.atmel_mci                |   12 ++--
>  drivers/mmc/fsl_esdhc.c             |    8 +---
>  drivers/mmc/mmc.c                   |    4 ++--
>  include/mmc.h                       |    2 +-
>  11 files changed, 39 insertions(+), 50 deletions(-)


Tested ok on i.mx51evk board,

Tested-by: Jason Liu 

>
[...]
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 2/4] mmc: Implement card detection.

2012-01-03 Thread Jason Liu
2012/1/2 Thierry Reding :
> Check for card detect each time an MMC/SD device is initialized. If card
> detection is not implemented, this code behaves as before and continues
> assuming a card is present. If no card is detected, has_init is reset
> for the MMC/SD device (to force initialization next time) and an error
> is returned.
>
> Signed-off-by: Thierry Reding 
> ---
>  drivers/mmc/arm_pl180_mmci.c |    1 +
>  drivers/mmc/bfin_sdh.c       |    1 +
>  drivers/mmc/davinci_mmc.c    |    1 +
>  drivers/mmc/ftsdc010_esdhc.c |    1 +
>  drivers/mmc/gen_atmel_mci.c  |    1 +
>  drivers/mmc/mmc.c            |   18 ++
>  drivers/mmc/mmc_spi.c        |    1 +
>  drivers/mmc/mxcmmc.c         |    1 +
>  drivers/mmc/mxsmmc.c         |    1 +
>  drivers/mmc/omap_hsmmc.c     |    1 +
>  drivers/mmc/pxa_mmc_gen.c    |    1 +
>  drivers/mmc/s5p_mmc.c        |    1 +
>  drivers/mmc/sdhci.c          |    1 +
>  drivers/mmc/sh_mmcif.c       |    1 +
>  include/mmc.h                |    2 ++
>  15 files changed, 33 insertions(+), 0 deletions(-)

Tested ok on i.mx51evk board,

Tested-by: Jason Liu 

>
[...]
> --
> 1.7.8.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] imx: mx6q: add aipstz init for off platform periph

2012-01-10 Thread Jason Liu
Init peripheral access control register of AIPSTZ OPACRx:

Buffer Writes(BW):  0 -> not bufferable,
Supervisor Protect(SP): 0 -> not require supervisor privilege level for 
accesses.
Write Protect(WP):  0 -> allows write accesses.
Trusted Protect(TP):0 -> allows unstrusted master

Signed-off-by: Jason Liu 
Cc: Stefano Babic 
---
 arch/arm/cpu/armv7/mx6/soc.c |   29 +++--
 arch/arm/include/asm/arch-mx6/imx-regs.h |   11 +++
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index bd59cf5..bec53cd 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -40,18 +40,35 @@ u32 get_cpu_rev(void)
 #ifdef CONFIG_ARCH_CPU_INIT
 void init_aips(void)
 {
-   u32 reg = AIPS1_BASE_ADDR;
+   struct aipstz_regs *aips1, *aips2;
+
+   aips1 = (struct aipstz_regs *)AIPS1_BASE_ADDR;
+   aips2 = (struct aipstz_regs *)AIPS2_BASE_ADDR;
 
/*
 * Set all MPROTx to be non-bufferable, trusted for R/W,
 * not forced to user-mode.
 */
-   writel(0x, reg + 0x00);
-   writel(0x, reg + 0x04);
+   writel(0x, &aips1->mprot0);
+   writel(0x, &aips1->mprot1);
+   writel(0x, &aips2->mprot0);
+   writel(0x, &aips2->mprot1);
 
-   reg = AIPS2_BASE_ADDR;
-   writel(0x, reg + 0x00);
-   writel(0x, reg + 0x04);
+   /*
+* Set all OPACRx to be non-bufferable, not require
+* supervisor privilege level for access,allow for
+* write access and untrusted master access.
+*/
+   writel(0x, &aips1->opacr0);
+   writel(0x, &aips1->opacr1);
+   writel(0x, &aips1->opacr2);
+   writel(0x, &aips1->opacr3);
+   writel(0x, &aips1->opacr4);
+   writel(0x, &aips2->opacr0);
+   writel(0x, &aips2->opacr1);
+   writel(0x, &aips2->opacr2);
+   writel(0x, &aips2->opacr3);
+   writel(0x, &aips2->opacr4);
 }
 
 int arch_cpu_init(void)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 5fe9748..7650cb9 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -232,5 +232,16 @@ struct fuse_bank4_regs {
u32 rsvd3[0x13];
 };
 
+struct aipstz_regs {
+   u32 mprot0;
+   u32 mprot1;
+   u32 rsvd[0xe];
+   u32 opacr0;
+   u32 opacr1;
+   u32 opacr2;
+   u32 opacr3;
+   u32 opacr4;
+};
+
 #endif /* __ASSEMBLER__*/
 #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
-- 
1.7.4.1


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


Re: [U-Boot] [PATCH 12/14] MX5: mx53evk: make use of GPIO framework

2011-08-21 Thread Jason Liu
2011/8/21 Stefano Babic :
> Signed-off-by: Stefano Babic 
> CC: Jason Liu 
> ---
>  board/freescale/mx53evk/mx53evk.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/board/freescale/mx53evk/mx53evk.c 
> b/board/freescale/mx53evk/mx53evk.c
> index 88095dc..81857ff 100644
> --- a/board/freescale/mx53evk/mx53evk.c
> +++ b/board/freescale/mx53evk/mx53evk.c
> @@ -33,7 +33,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -213,9 +213,9 @@ int board_mmc_getcd(u8 *cd, struct mmc *mmc)
>        struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
>
>        if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
> -               *cd = mxc_gpio_get(77); /*GPIO3_13*/
> +               *cd = gpio_get_value(77); /*GPIO3_13*/
>        else
> -               *cd = mxc_gpio_get(75); /*GPIO3_11*/
> +               *cd = gpio_get_value(75); /*GPIO3_11*/
>
>        return 0;
>  }

Acked-by: Jason Liu 
Tested-by: Jason Liu 

> --
> 1.7.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 13/14] MX5: mx53loco: make use of GPIO framework

2011-08-21 Thread Jason Liu
2011/8/21 Stefano Babic :
> Signed-off-by: Stefano Babic 
> CC: Jason Liu 
> ---
>  board/freescale/mx53loco/mx53loco.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/board/freescale/mx53loco/mx53loco.c 
> b/board/freescale/mx53loco/mx53loco.c
> index 18b388e..ade1006 100644
> --- a/board/freescale/mx53loco/mx53loco.c
> +++ b/board/freescale/mx53loco/mx53loco.c
> @@ -34,7 +34,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> @@ -146,9 +146,9 @@ int board_mmc_getcd(u8 *cd, struct mmc *mmc)
>        struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
>
>        if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
> -               *cd = mxc_gpio_get(77); /*GPIO3_13*/
> +               *cd = gpio_get_value(77); /*GPIO3_13*/
>        else
> -               *cd = mxc_gpio_get(75); /*GPIO3_11*/
> +               *cd = gpio_get_value(75); /*GPIO3_11*/
>
>        return 0;
>  }

Acked-by: Jason Liu 
Tested-by: Jason Liu 

> --
> 1.7.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] MX25: Add initial support for MX25PDK

2011-08-29 Thread Jason Liu
2011/8/30 Fabio Estevam :
> Add the initial support for MX25PDK booting from SD card via internal boot.
>
> Signed-off-by: Fabio Estevam 
> ---
[...]
> --- /dev/null
> +++ b/include/configs/mx25pdk.h
> @@ -0,0 +1,109 @@
> +/*
> + * (C) Copyright 2011 Freescale Semiconductor, Inc.
> + *
> + * 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.
> + */
> +
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +/* High Level Configuration Options */
> +
> +#define CONFIG_ARM926EJS                       /* arm926ejs CPU core */
> +#define CONFIG_MX25
> +#define CONFIG_MX25PDK
> +#define CONFIG_MX25_CLK32              32768   /* OSC32K frequency */
> +#define CONFIG_SYS_HZ                  1000
> +#define CONFIG_SYS_TEXT_BASE           0x8120
> +
> +#define CONFIG_DISPLAY_CPUINFO
> +#define CONFIG_DISPLAY_BOARDINFO
> +
> +#define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
> +#define CONFIG_SETUP_MEMORY_TAGS
> +#define CONFIG_INITRD_TAG
> +
> +/* Size of malloc() pool */
> +#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
> +
> +/* Physical Memory Map */
> +
> +#define CONFIG_NR_DRAM_BANKS   1
> +#define PHYS_SDRAM_1           0x8000
> +#define PHYS_SDRAM_1_SIZE      (64 * 1024 * 1024)
> +
> +#define CONFIG_BOARD_EARLY_INIT_F
> +
> +#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
> +#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 
> 0x1000 - \
> +                                               GENERATED_GBL_DATA_SIZE)
> +
> +/* Memory Test */
> +#define CONFIG_SYS_MEMTEST_START       PHYS_SDRAM_1
> +#define CONFIG_SYS_MEMTEST_END         (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE)

Can we test the full DDR memory size?


Jason

> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] I2C: mxc_i2c rework

2011-09-20 Thread Jason Liu
Hi, Stefano,

2011/9/19 Stefano Babic :
> On 09/15/2011 02:09 AM, Marek Vasut wrote:
>> Rewrite the mxc_i2c driver.
>>  * This version is much closer to Linux implementation.
>>  * Fixes IPG_PERCLK being incorrectly used as clock source
>>  * Fixes behaviour of the driver on iMX51
>>  * Clean up coding style a bit ;-)
>>
>> Signed-off-by: Marek Vasut 
>> ---
>
> Hi Marek,
>
> you miss to set the version number of your patchset. This can confuse
> us, as confuses patchwork.
>
> Jason, do you have any issue with the last version of this patch (again,
> without version number, sent by Marek last 15/9) ? I saw Heiko's ACK in
> a previous version, but I won't push if some boards/SOC will be broken
> by this patchset. Any comments ?

I will give one test on the latest patch set (v4) tomorrow and send out the test
result. Sorry for the delay.

Jason

>
> Best regards,
> Stefano Babic
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] cosmetic: fsl_pmic: cosmetic for the help message

2011-09-21 Thread Jason Liu
This is cosmetic patch for the help message:

Before:
pmic dump [numregs] dump registers
After:
pmic dump [numregs] - dump registers

Signed-off-by: Jason Liu 
---
 drivers/misc/fsl_pmic.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/fsl_pmic.c b/drivers/misc/fsl_pmic.c
index ef80ad9..23255a5 100644
--- a/drivers/misc/fsl_pmic.c
+++ b/drivers/misc/fsl_pmic.c
@@ -230,6 +230,6 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 U_BOOT_CMD(
pmic,   CONFIG_SYS_MAXARGS, 1, do_pmic,
"Freescale PMIC (Atlas)",
-   "dump [numregs] dump registers\n"
+   "dump [numregs] - dump registers\n"
"pmic write   - write register"
 );
-- 
1.7.4.1


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


Re: [U-Boot] [PATCH 1/1] fsl_esdhc: Fix multi-block read restriction on i.MX53 eSDHCv2

2011-04-10 Thread Jason Liu
Hi, Kumar Gala

2011/3/22 Jason Liu :
> For freescale i.MX53 eSDHCv2, when using CMD12, cmdtype need
> to be set to ABORT, otherwise, next read command will hang.
>
> This is a software Software Restrictions in i.MX53 reference manual:
>
> 29.7.8 Multi-block Read
> For pre-defined multi-block read operation, that is,the number of blocks
> to read has been defined by previous CMD23 for MMC, or pre-defined number
> of blocks in CMD53 for SDIO/SDCombo,or whatever multi-block read without
> abort command at card side, an abort command, either automatic or manual
> CMD12/CMD52, is still required by ESDHC after the pre-defined number of
> blocks are done, to drive the internal state machine to idle mode. In this
> case, the card may not respond to this extra abort command and ESDHC will
> get Response Timeout.  It is recommended to manually send an abort command
> with RSPTYP[1:0] both bits cleared.
>
> Signed-off-by: Jason Liu 
> ---
>  drivers/mmc/fsl_esdhc.c |    4 
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index f3cccbe..5c3618b 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -99,6 +99,10 @@ uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data 
> *data)
>        else if (cmd->resp_type & MMC_RSP_PRESENT)
>                xfertyp |= XFERTYP_RSPTYP_48;
>
> +#ifdef CONFIG_MX53
> +       if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
> +               xfertyp |= XFERTYP_CMDTYP_ABORT;
> +#endif
>        return XFERTYP_CMD(cmd->cmdidx) | xfertyp;
>  }

Ping, Any comments?

>
> --
> 1.7.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] fsl_esdhc: Fix multi-block read restriction on i.MX53 eSDHCv2

2011-04-10 Thread Jason Liu
2011/4/11 Kumar Gala :
>
> On Apr 10, 2011, at 11:43 PM, Jason Liu wrote:
>
>> Hi, Kumar Gala
>>
>> 2011/3/22 Jason Liu :
>>> For freescale i.MX53 eSDHCv2, when using CMD12, cmdtype need
>>> to be set to ABORT, otherwise, next read command will hang.
>>>
>>> This is a software Software Restrictions in i.MX53 reference manual:
>>>
>>> 29.7.8 Multi-block Read
>>> For pre-defined multi-block read operation, that is,the number of blocks
>>> to read has been defined by previous CMD23 for MMC, or pre-defined number
>>> of blocks in CMD53 for SDIO/SDCombo,or whatever multi-block read without
>>> abort command at card side, an abort command, either automatic or manual
>>> CMD12/CMD52, is still required by ESDHC after the pre-defined number of
>>> blocks are done, to drive the internal state machine to idle mode. In this
>>> case, the card may not respond to this extra abort command and ESDHC will
>>> get Response Timeout.  It is recommended to manually send an abort command
>>> with RSPTYP[1:0] both bits cleared.
>>>
>>> Signed-off-by: Jason Liu 
>>> ---
>>>  drivers/mmc/fsl_esdhc.c |    4 
>>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
>>> index f3cccbe..5c3618b 100644
>>> --- a/drivers/mmc/fsl_esdhc.c
>>> +++ b/drivers/mmc/fsl_esdhc.c
>>> @@ -99,6 +99,10 @@ uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data 
>>> *data)
>>>        else if (cmd->resp_type & MMC_RSP_PRESENT)
>>>                xfertyp |= XFERTYP_RSPTYP_48;
>>>
>>> +#ifdef CONFIG_MX53
>>> +       if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
>>> +               xfertyp |= XFERTYP_CMDTYP_ABORT;
>>> +#endif
>>>        return XFERTYP_CMD(cmd->cmdidx) | xfertyp;
>>>  }
>>
>> Ping, Any comments?
>
> No issues as this is protected with a CONFIG_MX53 so will not impact an PPC 
> SoCs

Thanks. Kumar,

Who will pick up this patch?

Jason

>
> - k
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] fsl_esdhc: Fix multi-block read restriction on i.MX53 eSDHCv2

2011-04-12 Thread Jason Liu
Hi, Wolfgang,

2011/4/11 Wolfgang Denk :
> Dear Jason Liu,
>
> In message  you wrote:
>>
>> >>> --- a/drivers/mmc/fsl_esdhc.c
>> >>> +++ b/drivers/mmc/fsl_esdhc.c
> ...
>>
>> Who will pick up this patch?
>
> It's MMC code, so that would be MMC custodian.

>From http://www.denx.de/wiki/U-Boot/Custodians:
MMC drivers  Andy Flemingafleming {AT} gmail {DOT} com  u-boot-mmc

So, Andy, could you please pick this patch up. Thanks,

>
> Maybe you should put the responsible custodian on Cc.

Yes,  Thanks,

BR,
Jason

>
> Best regards,
>
> Wolfgang Denk
>
> --
> 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: w...@denx.de
> All men should freely use those seven words which have the  power  to
> make any marriage run smoothly: You know dear, you may be right.
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] MX51: mx51evk: Use struct to access SRSR register instead of offset

2011-04-12 Thread Jason Liu
2011/4/13 Fabio Estevam :
> Signed-off-by: Fabio Estevam 
> ---
>  board/freescale/mx51evk/mx51evk.c |    6 +-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/board/freescale/mx51evk/mx51evk.c 
> b/board/freescale/mx51evk/mx51evk.c
> index 02a765d..3f2217c 100644
> --- a/board/freescale/mx51evk/mx51evk.c
> +++ b/board/freescale/mx51evk/mx51evk.c
> @@ -431,6 +431,10 @@ int board_late_init(void)
>
>  int checkboard(void)
>  {
> +       u32 reset;
> +       struct src *src_regs = (struct src *)SRC_BASE_ADDR;
> +       reset = src_regs->srsr;

Would better to use __raw_readl(&src_regs->srsr) here.

> +
>        puts("Board: MX51EVK ");
>
>        switch (system_rev & 0xff) {
> @@ -452,7 +456,7 @@ int checkboard(void)
>                break;
>        }
>
> -       switch (__raw_readl(SRC_BASE_ADDR + 0x8)) {
> +       switch (reset) {
>        case 0x0001:
>                puts("POR");
>                break;
> --
> 1.6.0.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V1 1/1] MX5: Keep L2 cache enabled before jump to kernel

2011-04-13 Thread Jason Liu
Currently, Linux kernel does not do any L2 cache enable
Operation.So,Keep L2 cache enabled(L2EN=1) in the u-boot
before Jump to the Linux Kernel and thus L2 cache can be
effectively used in Linux Kernel.

Signed-off-by: Jason Liu 
---
 arch/arm/cpu/armv7/mx5/Makefile   |2 +-
 arch/arm/cpu/armv7/mx5/cache.S|   43 +
 arch/arm/cpu/armv7/mx5/soc.c  |6 
 arch/arm/include/asm/arch-mx5/sys_proto.h |2 +
 include/configs/mx51evk.h |2 -
 include/configs/mx53evk.h |2 -
 include/configs/mx53loco.h|2 -
 7 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx5/Makefile b/arch/arm/cpu/armv7/mx5/Makefile
index e8be9c9..a7df7a6 100644
--- a/arch/arm/cpu/armv7/mx5/Makefile
+++ b/arch/arm/cpu/armv7/mx5/Makefile
@@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk
 LIB= $(obj)lib$(SOC).o
 
 COBJS  = soc.o clock.o iomux.o timer.o speed.o
-SOBJS = lowlevel_init.o
+SOBJS = lowlevel_init.o cache.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
diff --git a/arch/arm/cpu/armv7/mx5/cache.S b/arch/arm/cpu/armv7/mx5/cache.S
new file mode 100644
index 000..c81c8be
--- /dev/null
+++ b/arch/arm/cpu/armv7/mx5/cache.S
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2011 Linaro Ltd.
+ *
+ * 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
+ */
+
+.align 5
+.global invalidate_dcache
+.global l2_cache_enable
+.global l2_cache_disable
+
+/*
+ * Sine we did not enable D-cache in uboot,this is the
+ * Dummy function for L2 ON to make build pass. please
+ * Check the arch/arm/cpu/armv7/cpu.c file
+ */
+invalidate_dcache:
+   mov pc, lr
+
+l2_cache_enable:
+   mrc p15, 0, r0, c1, c0, 1;
+   orr r0, r0, #0x2
+   mcr p15, 0, r0, c1, c0, 1;
+   mov pc, lr
+
+l2_cache_disable:
+   mrc p15, 0, r0, c1, c0, 1;
+   bic r0, r0, #0x2
+   mcr p15, 0, r0, c1, c0, 1;
+   mov pc, lr
diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c
index 09500b3..e3b6269 100644
--- a/arch/arm/cpu/armv7/mx5/soc.c
+++ b/arch/arm/cpu/armv7/mx5/soc.c
@@ -144,3 +144,9 @@ void reset_cpu(ulong addr)
 {
__raw_writew(4, WDOG1_BASE_ADDR);
 }
+
+/*dummy function for L2 ON*/
+u32 get_device_type(void)
+{
+   return 0;
+}
diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h 
b/arch/arm/include/asm/arch-mx5/sys_proto.h
index f687503..89ab8e8 100644
--- a/arch/arm/include/asm/arch-mx5/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
@@ -27,5 +27,7 @@
 u32 get_cpu_rev(void);
 #define is_soc_rev(rev)((get_cpu_rev() & 0xFF) - rev)
 void sdelay(unsigned long);
+void invalidate_dcache(u32);
+u32 get_device_type(void);
 
 #endif
diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index 50caacd..abf6cb9 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -35,8 +35,6 @@
 
 #define CONFIG_SYS_TEXT_BASE   0x9780
 
-#define CONFIG_L2_OFF
-
 #include 
 /*
  * Disabled for now due to build problems under Debian and a significant
diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
index 6ac910b..410795f 100644
--- a/include/configs/mx53evk.h
+++ b/include/configs/mx53evk.h
@@ -29,8 +29,6 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
-#define CONFIG_L2_OFF
-
 #include 
 
 #define CONFIG_CMDLINE_TAG 1   /* enable passing of ATAGs */
diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
index 9c7dcc9..1e60335 100644
--- a/include/configs/mx53loco.h
+++ b/include/configs/mx53loco.h
@@ -30,8 +30,6 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
-#define CONFIG_L2_OFF
-
 #include 
 
 #define CONFIG_CMDLINE_TAG 1   /* enable passing of ATAGs */
-- 
1.7.1

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


[U-Boot] [PATCH 1/1] MX5: clock: Add clock config interface

2011-04-13 Thread Jason Liu
Add clock config interface support, so that we
can configure CPU or DDR clock in the later init

Signed-off-by: Jason Liu 
---
 arch/arm/cpu/armv7/mx5/clock.c   |  551 +-
 arch/arm/include/asm/arch-mx5/clock.h|4 +
 arch/arm/include/asm/arch-mx5/crm_regs.h |6 +
 arch/arm/include/asm/arch-mx5/imx-regs.h |1 +
 4 files changed, 559 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
index 0b04a88..04d9f71 100644
--- a/arch/arm/cpu/armv7/mx5/clock.c
+++ b/arch/arm/cpu/armv7/mx5/clock.c
@@ -24,6 +24,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,7 @@ enum pll_clocks {
PLL1_CLOCK = 0,
PLL2_CLOCK,
PLL3_CLOCK,
+   PLL4_CLOCK,
PLL_CLOCKS,
 };
 
@@ -41,8 +43,42 @@ struct mxc_pll_reg *mxc_plls[PLL_CLOCKS] = {
[PLL1_CLOCK] = (struct mxc_pll_reg *)PLL1_BASE_ADDR,
[PLL2_CLOCK] = (struct mxc_pll_reg *)PLL2_BASE_ADDR,
[PLL3_CLOCK] = (struct mxc_pll_reg *)PLL3_BASE_ADDR,
+   [PLL4_CLOCK] = (struct mxc_pll_reg *)PLL4_BASE_ADDR,
 };
 
+#define AHB_CLK_ROOT1
+#define SZ_DEC_1M   100
+#define PLL_PD_MAX  16  /* Actual pd+1 */
+#define PLL_MFI_MAX 15
+#define PLL_MFI_MIN 5
+#define ARM_DIV_MAX 8
+#define IPG_DIV_MAX 4
+#define AHB_DIV_MAX 8
+#define EMI_DIV_MAX 8
+#define NFC_DIV_MAX 8
+
+struct fixed_pll_mfd {
+   u32 ref_clk_hz;
+   u32 mfd;
+};
+
+const struct fixed_pll_mfd fixed_mfd[] = {
+   {CONFIG_SYS_MX5_HCLK, 24 * 16},
+};
+
+struct pll_param {
+   u32 pd;
+   u32 mfi;
+   u32 mfn;
+   u32 mfd;
+};
+
+#define PLL_FREQ_MAX(ref_clk)  (4 * (ref_clk) * PLL_MFI_MAX)
+#define PLL_FREQ_MIN(ref_clk) \
+   ((2 * (ref_clk) * (PLL_MFI_MIN - 1)) / PLL_PD_MAX)
+#define MAX_DDR_CLK 42000
+#define NFC_CLK_MAX 3400
+
 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
 
 /*
@@ -175,7 +211,7 @@ static u32 get_uart_clk(void)
 /*
  * This function returns the low power audio clock.
  */
-u32 get_lp_apm(void)
+static u32 get_lp_apm(void)
 {
u32 ret_val = 0;
u32 ccsr = __raw_readl(&mxc_ccm->ccsr);
@@ -191,7 +227,7 @@ u32 get_lp_apm(void)
 /*
  * get cspi clock rate.
  */
-u32 imx_get_cspiclk(void)
+static u32 get_cspi_clk(void)
 {
u32 ret_val = 0, pdf, pre_pdf, clk_sel;
u32 cscmr1 = __raw_readl(&mxc_ccm->cscmr1);
@@ -228,6 +264,94 @@ u32 imx_get_cspiclk(void)
return ret_val;
 }
 
+static u32 get_axi_a_clk(void)
+{
+   u32 cbcdr =  __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_AXI_A_PODF_MASK) \
+   >> MXC_CCM_CBCDR_AXI_A_PODF_OFFSET;
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_axi_b_clk(void)
+{
+   u32 cbcdr =  __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_AXI_B_PODF_MASK) \
+   >> MXC_CCM_CBCDR_AXI_B_PODF_OFFSET;
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_ahb_clk(void)
+{
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_AHB_PODF_MASK) \
+   >> MXC_CCM_CBCDR_AHB_PODF_OFFSET;
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_emi_slow_clk(void)
+{
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   u32 emi_clk_sel = cbcdr & MXC_CCM_CBCDR_EMI_CLK_SEL;
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_EMI_PODF_MASK) \
+   >> MXC_CCM_CBCDR_EMI_PODF_OFFSET;
+
+   if (emi_clk_sel)
+   return  get_ahb_clk() / (pdf + 1);
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_nfc_clk(void)
+{
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_NFC_PODF_MASK) \
+   >> MXC_CCM_CBCDR_NFC_PODF_OFFSET;
+
+   return  get_emi_slow_clk() / (pdf + 1);
+}
+
+static u32 get_ddr_clk(void)
+{
+   u32 ret_val = 0;
+   u32 cbcmr = __raw_readl(&mxc_ccm->cbcmr);
+   u32 ddr_clk_sel = (cbcmr & MXC_CCM_CBCMR_DDR_CLK_SEL_MASK) \
+   >> MXC_CCM_CBCMR_DDR_CLK_SEL_OFFSET;
+#ifdef CONFIG_MX51
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   if (cbcdr & MXC_CCM_CBCDR_DDR_HIFREQ_SEL) {
+   u32 ddr_clk_podf = (cbcdr & MXC_CCM_CBCDR_DDR_PODF_MASK) >> \
+   MXC_CCM_CBCDR_DDR_PODF_OFFSET;
+
+   ret_val = decode_pll(mxc_plls[PLL1_CLOCK], CONFIG_SYS_MX5_HCLK);
+   ret_val /= ddr_clk_podf + 1;
+
+   return ret_val;
+   }
+#endif
+   switch (ddr_clk_sel) {
+   case 0:
+   ret_val = get_axi_a_clk();
+   break;
+   case 1:
+   ret_val = get_axi_b_clk();
+ 

[U-Boot] [PATCH 1/2] PMIC: Add dialog pmic support

2011-04-13 Thread Jason Liu
Add dialog pmic(DA9053) driver with I2C interface support

Signed-off-by: Jason Liu 
---
 drivers/misc/Makefile  |1 +
 drivers/misc/dialog_pmic.c |  123 +
 include/da9053.h   |  186 
 3 files changed, 310 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index b152486..c557a14 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_NS87308) += ns87308.o
 COBJS-$(CONFIG_PDSP188x) += pdsp188x.o
 COBJS-$(CONFIG_STATUS_LED) += status_led.o
 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
+COBJS-$(CONFIG_DIALOG_PMIC) += dialog_pmic.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/misc/dialog_pmic.c b/drivers/misc/dialog_pmic.c
new file mode 100644
index 000..95dc6ea
--- /dev/null
+++ b/drivers/misc/dialog_pmic.c
@@ -0,0 +1,123 @@
+/*
+ * (C) Copyright 2011 Freescale Semiconductor, Inc.
+ * Based on drivers/misc/fsl_pmic.c
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+
+static int check_param(u32 reg, u32 write)
+{
+   if (reg > 142 || write > 1) {
+   printf(" = %d is invalid. Should be less then 142\n",
+   reg);
+   return -1;
+   }
+
+   return 0;
+}
+
+static u32 pmic_reg(u32 reg, u32 val, u32 write)
+{
+   unsigned char buf[1] = { 0 };
+   u32 ret_val = 0;
+
+   if (check_param(reg, write))
+   return -1;
+
+   if (write) {
+   buf[0] = (val) & 0xff;
+   if (i2c_write(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR, reg, 1, buf, 1))
+   return -1;
+   } else {
+   if (i2c_read(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR, reg, 1, buf, 1))
+   return -1;
+   ret_val = buf[0];
+   }
+
+   return ret_val;
+}
+
+void pmic_reg_write(u32 reg, u32 value)
+{
+   pmic_reg(reg, value, 1);
+}
+
+u32 pmic_reg_read(u32 reg)
+{
+   return pmic_reg(reg, 0, 0);
+}
+
+static void pmic_dump(int numregs)
+{
+   u32 val;
+   int i;
+
+   for (i = 0; i < numregs; i++) {
+   val = pmic_reg_read(i);
+   if (!(i % 8))
+   printf("\n0x%02x: ", i);
+   printf("%02x ", val);
+   }
+   puts("\n");
+}
+
+int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   char *cmd;
+   int nregs;
+   u32 val;
+
+   /* at least two arguments please */
+   if (argc < 2)
+   return cmd_usage(cmdtp);
+
+   cmd = argv[1];
+   if (strcmp(cmd, "dump") == 0) {
+   if (argc < 3)
+   return cmd_usage(cmdtp);
+
+   nregs = simple_strtoul(argv[2], NULL, 16);
+   pmic_dump(nregs);
+   return 0;
+   }
+   if (strcmp(cmd, "write") == 0) {
+   if (argc < 4)
+   return cmd_usage(cmdtp);
+
+   nregs = simple_strtoul(argv[2], NULL, 16);
+   val = simple_strtoul(argv[3], NULL, 16);
+   pmic_reg_write(nregs, val);
+   return 0;
+   }
+   /* No subcommand found */
+   return 1;
+}
+
+U_BOOT_CMD(
+   pmic,   CONFIG_SYS_MAXARGS, 1, do_pmic,
+   "Dialog PMIC (DA905x)",
+   "dump [numregs] dump registers\n"
+   "pmic write   - write register"
+);
diff --git a/include/da9053.h b/include/da9053.h
new file mode 100644
index 000..f69408a
--- /dev/null
+++ b/include/da9053.h
@@ -0,0 +1,186 @@
+/*
+ * da9053 register declarations.
+ *
+ * Copyright(c) 2009 Dialog Semiconductor Ltd.
+ *
+ * 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
+

[U-Boot] [PATCH 2/2] MX53: loco: Add power init support

2011-04-13 Thread Jason Liu
Increase CPU core power to 1.25v via DA9053 PMIC,
and after that CPU can ran to 1GHZ and DDR 400Mhz.

Signed-off-by: Jason Liu 
---
 arch/arm/include/asm/arch-mx5/sys_proto.h |2 +
 board/freescale/mx53loco/mx53loco.c   |   94 +
 include/configs/mx53loco.h|   13 ++--
 3 files changed, 102 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h 
b/arch/arm/include/asm/arch-mx5/sys_proto.h
index 89ab8e8..9fc209d 100644
--- a/arch/arm/include/asm/arch-mx5/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
@@ -29,5 +29,7 @@ u32 get_cpu_rev(void);
 void sdelay(unsigned long);
 void invalidate_dcache(u32);
 u32 get_device_type(void);
+void pmic_reg_write(u32 reg, u32 value);
+u32 pmic_reg_read(u32 reg);
 
 #endif
diff --git a/board/freescale/mx53loco/mx53loco.c 
b/board/freescale/mx53loco/mx53loco.c
index fd56c3d..9f15fa4 100755
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -28,12 +28,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -273,6 +275,93 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+static void setup_i2c(unsigned int port_number)
+{
+   switch (port_number) {
+   case 0:
+   /* i2c1 SDA */
+   mxc_request_iomux(MX53_PIN_CSI0_D8,
+   IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
+   mxc_iomux_set_input(MX53_I2C1_IPP_SDA_IN_SELECT_INPUT,
+   INPUT_CTL_PATH0);
+   mxc_iomux_set_pad(MX53_PIN_CSI0_D8,
+   PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+   PAD_CTL_100K_PU | PAD_CTL_PKE_ENABLE |
+   PAD_CTL_PUE_PULL |
+   PAD_CTL_ODE_OPENDRAIN_ENABLE);
+   /* i2c1 SCL */
+   mxc_request_iomux(MX53_PIN_CSI0_D9,
+   IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
+   mxc_iomux_set_input(MX53_I2C1_IPP_SCL_IN_SELECT_INPUT,
+   INPUT_CTL_PATH0);
+   mxc_iomux_set_pad(MX53_PIN_CSI0_D9,
+   PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+   PAD_CTL_100K_PU | PAD_CTL_PKE_ENABLE |
+   PAD_CTL_PUE_PULL |
+   PAD_CTL_ODE_OPENDRAIN_ENABLE);
+   break;
+   case 1:
+   /* i2c2 SDA */
+   mxc_request_iomux(MX53_PIN_KEY_ROW3,
+   IOMUX_CONFIG_ALT4 | IOMUX_CONFIG_SION);
+   mxc_iomux_set_input(MX53_I2C2_IPP_SDA_IN_SELECT_INPUT,
+   INPUT_CTL_PATH0);
+   mxc_iomux_set_pad(MX53_PIN_KEY_ROW3,
+   PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+   PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE |
+   PAD_CTL_ODE_OPENDRAIN_ENABLE);
+
+   /* i2c2 SCL */
+   mxc_request_iomux(MX53_PIN_KEY_COL3,
+   IOMUX_CONFIG_ALT4 | IOMUX_CONFIG_SION);
+   mxc_iomux_set_input(MX53_I2C2_IPP_SCL_IN_SELECT_INPUT,
+   INPUT_CTL_PATH0);
+   mxc_iomux_set_pad(MX53_PIN_KEY_COL3,
+   PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+   PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE |
+   PAD_CTL_ODE_OPENDRAIN_ENABLE);
+   break;
+   default:
+   printf("Warning: Wrong I2C port number\n");
+   break;
+   }
+}
+
+static void clock_init(void)
+{
+   int ret;
+   u32 ref_clk = CONFIG_SYS_MX5_HCLK;
+   /*
+* After increase voltage to 1.25V, We can switch
+* CPU clokc to 1Ghz and DDR to 400Mhz safely now
+*/
+   ret = mxc_set_clock(ref_clk, 1000, MXC_ARM_CLK);
+   if (!ret)
+   printf("CPU:   Switch CPU clock to 1GHZ OK\n");
+   else
+   printf("CPU:   Switch CPU clock to 1GHZ failed\n");
+
+   ret = mxc_set_clock(ref_clk, 400, MXC_PERIPH_CLK);
+   ret |= mxc_set_clock(ref_clk, 400, MXC_DDR_CLK);
+   if (!ret)
+   printf("DDR:   Switch DDR clock to 400MHz OK\n");
+   else
+   printf("CPU:   Switch DDR clock to 1GHZ failed\n");
+}
+
+static void power_init(void)
+{
+   unsigned int val;
+
+   /* Set VDDA to 1.25V */
+   val = DA9052_BUCKCORE_BCOREEN;
+   val |= DA_BUCKCORE_VBCORE_1_250V;
+   pmic_reg_write(DA9053_BUCKCORE_REG, val);
+   val = pmic_reg_read(DA9053_SUPPLY_REG);
+   val |= DA9052_SUPPLY_VBCOREGO;
+   pmic_reg_write(DA9053_SUPPLY_REG, val);
+}
+
 int board_early_init_f(void)
 {
setup_iomux_uart();
@@ -286,6 +375,11 @@ i

Re: [U-Boot] [PATCH 1/1] MX5:MX53: support for freescale MX53LOCO board

2011-04-13 Thread Jason Liu
Hi, Wolfgang,

2011/4/14 Wolfgang Denk :
> Dear Jason Liu,
>
> In message <1298283316-3443-1-git-send-email-r64...@freescale.com> you wrote:
>> This patch add initial support for freescale MX53LOCO board.
>> Network(FEC),SD/MMC, UART have been supported by this patch.
>>
>> Signed-off-by: Jason Liu 
> ...
>> +int dram_init(void)
>> +{
>> +     gd->ram_size = get_ram_size((volatile void *)CONFIG_SYS_SDRAM_BASE,
>> +                             PHYS_SDRAM_1_SIZE);
>> +
>> +     return 0;
>> +}
>> +void dram_init_banksize(void)
>> +{
>> +     gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
>> +     gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
>> +
>> +     gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
>> +     gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
>> +}
>
> This is apparently wrong: in dram_init() you run get_ram_size() only
> over the first bank of memory, but dram_init_banksize() says you have
> two of them ??

Yes, I have already thought about it before I submit patches. The fact is that
there is there are two DDR chips connected to CS0 and CS1 of MX53 on loco
board, but each DDR chip is 512MB, but CS0 and CS1 can support up to 1GB,
which means the memory space is not continuous, when set:
gd->ram_size = get_ram_size((volatile void *)CONFIG_SYS_SDRAM_BASE,
                          PHYS_SDRAM_1_SIZE + PHYS_SDRAM_2_SIZE);
it will return the same as:

gd->ram_size = get_ram_size((volatile void *)CONFIG_SYS_SDRAM_BASE,
                            PHYS_SDRAM_1_SIZE);


I think the gd->ram_size is just used for uboot, but
dram_init_banksize will tell
linux kernel about the real memory layout.

If you still think that I really need fix it, I will do it.

>
>
>> +int board_mmc_getcd(u8 *cd, struct mmc *mmc)
>> +{
>> +     struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
>> +
>> +     if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
>> +             *cd = mxc_gpio_get(77); /*GPIO3_13*/
>> +     else
>> +             *cd = mxc_gpio_get(75); /*GPIO3_11*/
>
> Is this just data or a device?  If the latter should be the case you
> mustuse I/O accessors instead.

It's data not a device here, so no need use I/O accessors.

>
> ...
>> +     puts("Board: MX53LOCO [");
>> +
>> +     cause = src_regs->srsr;
>> +     switch (cause) {
>> +     case 0x0001:
>> +             printf("POR");
>> +             break;
>> +     case 0x0009:
>> +             printf("RST");
>> +             break;
>> +     case 0x0010:
>> +     case 0x0011:
>> +             printf("WDOG");
>> +             break;
>> +     default:
>> +             printf("unknown");
>> +     }
>
> This has been discussed before: this code should be factored out into
> common code.

Yes, I think I can send out another clean up patch for it to fix all
the boards including
mx31/35/51/53 later.

>
> ...
>> +#define CONFIG_CMDLINE_TAG           1       /* enable passing of ATAGs */
>> +#define CONFIG_REVISION_TAG          1
>> +#define CONFIG_SETUP_MEMORY_TAGS     1
>> +#define CONFIG_INITRD_TAG            1
>
> Please remove the '1' from all #defines that just enable features,
> i.  e. where no specific numeric value is needed.

Yes, I can send out another clean up patch to fix all the i.mx board config file

>
>
>> +#define CONFIG_SYS_MEMTEST_START       0x7000
>> +#define CONFIG_SYS_MEMTEST_END         0x1
>
> Has this actually been tested?

Yes, I have tested with mtest command.

BTW, this patch set has been send out 2 months ago and Stefano has
send out pull request
to Albert and Albert has pulled in already, do you agree I send out
another patch to address
your comments? Thanks for your consideration.

BR,
Jason

>
> Best regards,
>
> Wolfgang Denk
>
> --
> 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: w...@denx.de
> People seldom know what they want until you give them what  they  ask
> for.
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] MX5:MX53: support for freescale MX53LOCO board

2011-04-14 Thread Jason Liu
2011/4/14 Wolfgang Denk :
> Dear Jason Liu,
>
> In message  you wrote:
[...]
>> BTW, this patch set has been send out 2 months ago and Stefano has
>> send out pull request
>> to Albert and Albert has pulled in already, do you agree I send out
>> another patch to address
>> your comments? Thanks for your consideration.
>
> No, this patch has serious bugs (memory size calculation) and other
> issues (needs cleanup) and is thus rejected.

OK, I will send out v3 patch to address it. Thanks,

Jason

>
> Best regards,
>
> Wolfgang Denk
>
> --
> 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: w...@denx.de
> "Anyone attempting to generate random numbers by deterministic  means
> is, of course, living in a state of sin."          - John Von Neumann
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] MX5:MX53: support for freescale MX53LOCO board

2011-04-14 Thread Jason Liu
Hi, Stefano,

2011/4/14 Jason Liu :
> 2011/4/14 Wolfgang Denk :
>> Dear Jason Liu,
>>
>> In message  you wrote:
> [...]
>>> BTW, this patch set has been send out 2 months ago and Stefano has
>>> send out pull request
>>> to Albert and Albert has pulled in already, do you agree I send out
>>> another patch to address
>>> your comments? Thanks for your consideration.
>>
>> No, this patch has serious bugs (memory size calculation) and other
>> issues (needs cleanup) and is thus rejected.
>
> OK, I will send out v3 patch to address it. Thanks,

Please drop the mx53loco board support patch from u-boot-imx master branch
and I will resubmit the following patches soon since the merge window will be
closed soon.

(1) clean-up patch:factor out the boot reason code to common code for
all the mx5
(2) fix-up: address Wolfgang's last minute comments and resubmit the patch.

Stefano, do you have some comments about what else I should do?

Sorry for bring your trouble and thanks for consideration.


BR,
Jason


>>
>> Best regards,
>>
>> Wolfgang Denk
>>
>> --
>> 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: w...@denx.de
>> "Anyone attempting to generate random numbers by deterministic  means
>> is, of course, living in a state of sin."          - John Von Neumann
>>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V3 1/2] MX5: factor out boot cause funciton to common code

2011-04-15 Thread Jason Liu
From: Liu Hui-R64343 

factor out boot cause funciton to common code to avoid
the duplicate code in each board support package

Signed-off-by: Jason Liu 
---
 arch/arm/cpu/armv7/mx5/soc.c  |   18 ++
 arch/arm/include/asm/arch-mx5/sys_proto.h |1 +
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c
index 09500b3..a08 100644
--- a/arch/arm/cpu/armv7/mx5/soc.c
+++ b/arch/arm/cpu/armv7/mx5/soc.c
@@ -77,6 +77,24 @@ u32 get_cpu_rev(void)
return system_rev;
 }
 
+char *get_reset_cause(void)
+{
+   u32 cause;
+   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+
+   cause = readl(&src_regs->srsr);
+   switch (cause) {
+   case 0x0001:
+   return "POR";
+   case 0x0009:
+   return "RST";
+   case 0x0010:
+   case 0x0011:
+   return "WDOG";
+   default:
+   return "unknown reset";
+   }
+}
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h 
b/arch/arm/include/asm/arch-mx5/sys_proto.h
index f687503..00c2c5d 100644
--- a/arch/arm/include/asm/arch-mx5/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
@@ -27,5 +27,6 @@
 u32 get_cpu_rev(void);
 #define is_soc_rev(rev)((get_cpu_rev() & 0xFF) - rev)
 void sdelay(unsigned long);
+char *get_reset_cause(void);
 
 #endif
-- 
1.7.1


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


[U-Boot] [PATCH V3 2/2] MX53: support for freescale MX53LOCO board

2011-04-15 Thread Jason Liu
From: Liu Hui-R64343 

This patch add initial support for freescale MX53LOCO board.
Network(FEC),SD/MMC, UART have been supported by this patch.

Signed-off-by: Jason Liu 
---
changes since V2:
-factor out the boot cause function to common code,
-fix gd->ram_size with full memory size
-remove the '1' from all #defines that just enable features
-correct memory test end address value
---
 MAINTAINERS   |1 +
 board/freescale/mx53loco/Makefile |   47 +
 board/freescale/mx53loco/imximage.cfg |   96 +++
 board/freescale/mx53loco/mx53loco.c   |  301 +
 boards.cfg|1 +
 include/configs/mx53loco.h|  196 +
 6 files changed, 642 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4756f14..7c311f7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -567,6 +567,7 @@ Stefano Babic 
 Jason Liu 
 
mx53evk i.MX53
+   mx53locoi.MX53
 
 Enric Balletbo i Serra 
 
diff --git a/board/freescale/mx53loco/Makefile 
b/board/freescale/mx53loco/Makefile
new file mode 100644
index 000..2088a48
--- /dev/null
+++ b/board/freescale/mx53loco/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx53loco.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak .depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx53loco/imximage.cfg 
b/board/freescale/mx53loco/imximage.cfg
new file mode 100755
index 000..ce9c8fc
--- /dev/null
+++ b/board/freescale/mx53loco/imximage.cfg
@@ -0,0 +1,96 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM  sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type   AddressValue
+#
+# where:
+#  Addr-type register length (1,2 or 4 bytes)
+#  Address   absolute address of the register
+#  value value to be stored in the register
+
+DATA 4 0x53fa8554 0x0030
+DATA 4 0x53fa8558 0x00300040
+DATA 4 0x53fa8560 0x0030
+DATA 4 0x53fa8564 0x00300040
+DATA 4 0x53fa8568 0x00300040
+DATA 4 0x53fa8570 0x0030
+DATA 4 0x53fa8574 0x0030
+DATA 4 0x53fa8578 0x0030
+DATA 4 0x53fa857c 0x00300040
+DATA 4 0x53fa8580 0x00300040
+DATA 4 0x53fa8584 0x0030
+DATA 4 0x53fa8588 0x0030
+DATA 4 0x53fa8590 0x00300040
+DATA 4 0x53fa8594 0x0030
+DATA 4 0x53fa86f0 0x0030
+DATA 4 0x53fa86f4 0x
+DATA 4 0x53fa86fc 0x
+DATA 4 0x53fa8714 0x
+DATA 4 0x53fa8718 0x0030
+DATA 4 0x53fa871c 0x0030
+DATA 4 0x53fa8720 0x003

Re: [U-Boot] [PATCH V1 1/1] MX5: Keep L2 cache enabled before jump to kernel

2011-04-15 Thread Jason Liu
Hi, Stefano,

2011/4/15 Stefano Babic :
> On 04/13/2011 03:25 PM, Jason Liu wrote:
>
> Hi Jason,
>
>> Currently, Linux kernel does not do any L2 cache enable
>> Operation.So,Keep L2 cache enabled(L2EN=1) in the u-boot
>> before Jump to the Linux Kernel and thus L2 cache can be
>> effectively used in Linux Kernel.
>
> If the cache is not active in the kernel for MX5, this should be fixed
> in the kernel for this architecture. Normally, cache is activated inside
> the kernel itself, as I cann see for other architectures and other ARMV7
> processors (omap)

Here the cache is L2 cache. I have observed that if uboot does not enable it,
then L2 cache will not get enabled through current ARM linux core code.

And for the uboot itself it provide the following code in cpu.c to
enable L2 cache
before jump to linux kernel, and this code maybe implemented by omap guys:
If linux kernel already enabled it, then there is no need for the L2
related code here?

int cleanup_before_linux(void)
{
unsigned int i;

/*
 * this function is called just before we call linux
 * it prepares the processor for linux
 *
 * we turn off caches etc ...
 */
disable_interrupts();

/* turn off I/D-cache */
icache_disable();
dcache_disable();

/* invalidate I-cache */
cache_flush();

#ifndef CONFIG_L2_OFF
/* turn off L2 cache */
l2_cache_disable();
/* invalidate L2 cache also */
invalidate_dcache(get_device_type());
#endif
i = 0;
/* mem barrier to sync up things */
asm("mcr p15, 0, %0, c7, c10, 4": :"r"(i));

#ifndef CONFIG_L2_OFF
l2_cache_enable();
#endif

>
> However, if you plan to add cache support, why not add the functions to
> get the cache enabled in u-boot ?

Yes, good point.
This is my to-do task but It will need much work to make the driver work
when enable d-cache support.

>
>> +
>> +/*
>> + * Sine we did not enable D-cache in uboot,this is the
>> + * Dummy function for L2 ON to make build pass. please
>> + * Check the arch/arm/cpu/armv7/cpu.c file
>> + */
>
> This seems to me a workaround for a non clear problem (at least, not
> clear for me..) to activate the cache at the startup of the kernel.
> There are already processors in u-boot supporting the cache, and if we
> add caching functions to u-boot for i.MX5, we must implement the full
> support to have cache active in the bootloader.

Here, as the comment said, since uboot does not enable L2 cache before
it jump to linux kernel, so, this function is just the dummy function to
pass build. Take the code from arch/arm/cpu/armv7/cpu.c:
int cleanup_before_linux(void)
{
...
#ifndef CONFIG_L2_OFF
/* turn off L2 cache */
l2_cache_disable();
/* invalidate L2 cache also */
invalidate_dcache(get_device_type());
#endif

>
>
>> +invalidate_dcache:
>> +     mov     pc, lr
>> +
>> +l2_cache_enable:
>> +     mrc     p15, 0, r0, c1, c0, 1;
>
> No registers are saved before calling this funtion ?

I don't think it needs save any register.

Jason

>
> Best regards,
> Stefano Babic
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] MX5:MX53: support for freescale MX53LOCO board

2011-04-15 Thread Jason Liu
Hi, Stefano,

2011/4/16 Stefano Babic :
> On 04/14/2011 10:12 AM, Jason Liu wrote:
>> Hi, Stefano,
>
> Hi Jason,
>
>> Please drop the mx53loco board support patch from u-boot-imx master branch
>> and I will resubmit the following patches soon since the merge window will be
>> closed soon.
>
> Ok - I'll do it.
>
>>
>> (1) clean-up patch:factor out the boot reason code to common code for
>> all the mx5
>> (2) fix-up: address Wolfgang's last minute comments and resubmit the patch.
>>
>> Stefano, do you have some comments about what else I should do?
>
> Please merge your other two patches for the LOCO board together - these
> other patches correct only some CONFIG_ in the board configuration file:
>
>        mx53loco: set mmc env to MMC slot1
>        MX5: Enable flat-device-tree support on mx53 loco board
>
> Submit a single patch with already the correct configuration for the
> LOCO board. I will drop all three current patches from u-boot-imx.

I have sent out V4 patch as you tell. Thanks.

Jason

>
> Best regards,
> Stefano
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V4 1/2] MX5: factor out boot cause funciton to common code

2011-04-15 Thread Jason Liu
From: Liu Hui-R64343 

factor out boot cause funciton to common code to avoid
the duplicate code in each board support package

Signed-off-by: Jason Liu 
---
changes since v3:
- add full boot reset cause
---
 arch/arm/cpu/armv7/mx5/soc.c  |   27 +++
 arch/arm/include/asm/arch-mx5/sys_proto.h |1 +
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c
index 09500b3..975864d 100644
--- a/arch/arm/cpu/armv7/mx5/soc.c
+++ b/arch/arm/cpu/armv7/mx5/soc.c
@@ -77,6 +77,33 @@ u32 get_cpu_rev(void)
return system_rev;
 }
 
+char *get_reset_cause(void)
+{
+   u32 cause;
+   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+
+   cause = readl(&src_regs->srsr);
+   writel(cause, &src_regs->srsr);
+
+   switch (cause) {
+   case 0x1:
+   return "POR";
+   case 0x4:
+   return "CSU";
+   case 0x8:
+   return "IPP USER";
+   case 0x00010:
+   return "WDOG";
+   case 0x00020:
+   return "JTAG HIGH-Z";
+   case 0x00040:
+   return "JTAG SW";
+   case 0x1:
+   return "WARM BOOT";
+   default:
+   return "unknown reset";
+   }
+}
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h 
b/arch/arm/include/asm/arch-mx5/sys_proto.h
index f687503..00c2c5d 100644
--- a/arch/arm/include/asm/arch-mx5/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
@@ -27,5 +27,6 @@
 u32 get_cpu_rev(void);
 #define is_soc_rev(rev)((get_cpu_rev() & 0xFF) - rev)
 void sdelay(unsigned long);
+char *get_reset_cause(void);
 
 #endif
-- 
1.7.1


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


[U-Boot] [PATCH V4 2/2] MX53: support for freescale MX53LOCO board

2011-04-15 Thread Jason Liu
From: Liu Hui-R64343 

This patch add initial support for freescale MX53LOCO board.
Network(FEC),SD/MMC, UART have been supported by this patch.

Signed-off-by: Jason Liu 
---
changes since v3:
- include other two small patch into this commit,
mx53loco: set mmc env to MMC slot1
MX5: Enable flat-device-tree support on mx53 loco board

changes since V2:
-factor out the boot cause function to common code,
-fix gd->ram_size with full memory size
-remove the '1' from all #defines that just enable features
-correct memory test end address value

---
 MAINTAINERS   |1 +
 board/freescale/mx53loco/Makefile |   47 +
 board/freescale/mx53loco/imximage.cfg |   96 +++
 board/freescale/mx53loco/mx53loco.c   |  301 +
 boards.cfg|1 +
 include/configs/mx53loco.h|  199 ++
 6 files changed, 645 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4756f14..7c311f7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -567,6 +567,7 @@ Stefano Babic 
 Jason Liu 
 
mx53evk i.MX53
+   mx53locoi.MX53
 
 Enric Balletbo i Serra 
 
diff --git a/board/freescale/mx53loco/Makefile 
b/board/freescale/mx53loco/Makefile
new file mode 100644
index 000..2088a48
--- /dev/null
+++ b/board/freescale/mx53loco/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx53loco.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak .depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx53loco/imximage.cfg 
b/board/freescale/mx53loco/imximage.cfg
new file mode 100755
index 000..ce9c8fc
--- /dev/null
+++ b/board/freescale/mx53loco/imximage.cfg
@@ -0,0 +1,96 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM  sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type   AddressValue
+#
+# where:
+#  Addr-type register length (1,2 or 4 bytes)
+#  Address   absolute address of the register
+#  value value to be stored in the register
+
+DATA 4 0x53fa8554 0x0030
+DATA 4 0x53fa8558 0x00300040
+DATA 4 0x53fa8560 0x0030
+DATA 4 0x53fa8564 0x00300040
+DATA 4 0x53fa8568 0x00300040
+DATA 4 0x53fa8570 0x0030
+DATA 4 0x53fa8574 0x0030
+DATA 4 0x53fa8578 0x0030
+DATA 4 0x53fa857c 0x00300040
+DATA 4 0x53fa8580 0x00300040
+DATA 4 0x53fa8584 0x0030
+DATA 4 0x53fa8588 0x0030
+DATA 4 0x53fa8590 0x00300040
+DATA 4 0x53fa8594 0x0030
+DATA 4 0x53fa86f0 0x0030
+DATA 4 0x53fa86

Re: [U-Boot] [PATCH V4 1/2] MX5: factor out boot cause funciton to common code

2011-04-18 Thread Jason Liu
Hi, Stefano,

2011/4/16 Jason Liu :
> From: Liu Hui-R64343 
>
> factor out boot cause funciton to common code to avoid
> the duplicate code in each board support package
>
> Signed-off-by: Jason Liu 
> ---
> changes since v3:
> - add full boot reset cause

Ping, any comments?


> 1.7.1
>
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V4 2/2] MX53: support for freescale MX53LOCO board

2011-04-18 Thread Jason Liu
Hi, Stefano,

2011/4/16 Jason Liu :
> From: Liu Hui-R64343 
>
> This patch add initial support for freescale MX53LOCO board.
> Network(FEC),SD/MMC, UART have been supported by this patch.
>
> Signed-off-by: Jason Liu 
> ---
> changes since v3:
> - include other two small patch into this commit,
> mx53loco: set mmc env to MMC slot1
> MX5: Enable flat-device-tree support on mx53 loco board
>
> changes since V2:
> -factor out the boot cause function to common code,
> -fix gd->ram_size with full memory size
> -remove the '1' from all #defines that just enable features
> -correct memory test end address value
>
Ping, any comments?

>
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/1] mx5: drop boot cause code from board support code

2011-04-20 Thread Jason Liu
The boot cause code has been factor out to soc common
code,we need drop the part from the board support code

Signed-off-by: Jason Liu 
---
 board/efikamx/efikamx.c   |   30 ++
 board/freescale/mx51evk/mx51evk.c |   26 ++
 board/freescale/mx53evk/mx53evk.c |   21 +
 board/ttcontrol/vision2/vision2.c |   28 ++--
 4 files changed, 19 insertions(+), 86 deletions(-)

diff --git a/board/efikamx/efikamx.c b/board/efikamx/efikamx.c
index f735260..0aef654 100644
--- a/board/efikamx/efikamx.c
+++ b/board/efikamx/efikamx.c
@@ -644,46 +644,28 @@ int board_late_init(void)
 int checkboard(void)
 {
u32 system_rev = get_cpu_rev();
-   u32 cause;
-   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
 
puts("Board: Efika MX ");
 
switch (system_rev & 0xff) {
case CHIP_REV_3_0:
-   puts("3.0 [");
+   puts("3.0");
break;
case CHIP_REV_2_5:
-   puts("2.5 [");
+   puts("2.5");
break;
case CHIP_REV_2_0:
-   puts("2.0 [");
+   puts("2.0");
break;
case CHIP_REV_1_1:
-   puts("1.1 [");
+   puts("1.1");
break;
case CHIP_REV_1_0:
default:
-   puts("1.0 [");
+   puts("1.0");
break;
}
 
-   cause = src_regs->srsr;
-   switch (cause) {
-   case 0x0001:
-   puts("POR");
-   break;
-   case 0x0009:
-   puts("RST");
-   break;
-   case 0x0010:
-   case 0x0011:
-   puts("WDOG");
-   break;
-   default:
-   printf("unknown 0x%x", cause);
-   }
-   puts("]\n");
-
+   puts("\n");
return 0;
 }
diff --git a/board/freescale/mx51evk/mx51evk.c 
b/board/freescale/mx51evk/mx51evk.c
index 02a765d..cff2ff1 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -435,37 +435,23 @@ int checkboard(void)
 
switch (system_rev & 0xff) {
case CHIP_REV_3_0:
-   puts("3.0 [");
+   puts("3.0");
break;
case CHIP_REV_2_5:
-   puts("2.5 [");
+   puts("2.5");
break;
case CHIP_REV_2_0:
-   puts("2.0 [");
+   puts("2.0");
break;
case CHIP_REV_1_1:
-   puts("1.1 [");
+   puts("1.1");
break;
case CHIP_REV_1_0:
default:
-   puts("1.0 [");
+   puts("1.0");
break;
}
 
-   switch (__raw_readl(SRC_BASE_ADDR + 0x8)) {
-   case 0x0001:
-   puts("POR");
-   break;
-   case 0x0009:
-   puts("RST");
-   break;
-   case 0x0010:
-   case 0x0011:
-   puts("WDOG");
-   break;
-   default:
-   puts("unknown");
-   }
-   puts("]\n");
+   puts("\n");
return 0;
 }
diff --git a/board/freescale/mx53evk/mx53evk.c 
b/board/freescale/mx53evk/mx53evk.c
index e71701b..a89aa25 100644
--- a/board/freescale/mx53evk/mx53evk.c
+++ b/board/freescale/mx53evk/mx53evk.c
@@ -372,26 +372,7 @@ int board_late_init(void)
 
 int checkboard(void)
 {
-   u32 cause;
-   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+   puts("Board: MX53EVK\n");
 
-   puts("Board: MX53EVK [");
-
-   cause = src_regs->srsr;
-   switch (cause) {
-   case 0x0001:
-   printf("POR");
-   break;
-   case 0x0009:
-   printf("RST");
-   break;
-   case 0x0010:
-   case 0x0011:
-   printf("WDOG");
-   break;
-   default:
-   printf("unknown");
-   }
-   printf("]\n");
return 0;
 }
diff --git a/board/ttcontrol/vision2/vision2.c 
b/board/ttcontrol/vision2/vision2.c
index f8ef4fc..8423110 100644
--- a/board/ttcontrol/vision2/vision2.c
+++ b/board/ttcontrol/vision2/vision2.c
@@ -708,40 +708,24 @@ int checkboard(void)
 
switch (system_rev & 0xff) {
case CHIP_REV_3_0:
-   puts("3.0 [");
+   puts("3.0");
break;
case CHIP_REV_2_5:
-   puts("2.5 [");
+   puts("2.5");
break;
case CHIP_REV_2_0:
- 

[U-Boot] [PATCH V5 1/2] MX5: factor out boot cause funciton to common code

2011-04-20 Thread Jason Liu
factor out boot cause funciton to common code to avoid
the duplicate code in each board support package

Signed-off-by: Jason Liu 
---
change since v4:
- make common code soc specific
changes since v3:
- add full boot reset cause
---
 arch/arm/cpu/armv7/mx5/soc.c |   28 
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c
index 09500b3..6f4e8db 100644
--- a/arch/arm/cpu/armv7/mx5/soc.c
+++ b/arch/arm/cpu/armv7/mx5/soc.c
@@ -77,6 +77,33 @@ u32 get_cpu_rev(void)
return system_rev;
 }
 
+static char *get_reset_cause(void)
+{
+   u32 cause;
+   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+
+   cause = readl(&src_regs->srsr);
+   writel(cause, &src_regs->srsr);
+
+   switch (cause) {
+   case 0x1:
+   return "POR";
+   case 0x4:
+   return "CSU";
+   case 0x8:
+   return "IPP USER";
+   case 0x00010:
+   return "WDOG";
+   case 0x00020:
+   return "JTAG HIGH-Z";
+   case 0x00040:
+   return "JTAG SW";
+   case 0x1:
+   return "WARM BOOT";
+   default:
+   return "unknown reset";
+   }
+}
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
@@ -89,6 +116,7 @@ int print_cpuinfo(void)
(cpurev & 0x000F0) >> 4,
(cpurev & 0xF) >> 0,
mxc_get_clock(MXC_ARM_CLK) / 100);
+   printf("Reset cause: %s\n", get_reset_cause());
return 0;
 }
 #endif
-- 
1.7.1

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


[U-Boot] [PATCH V5 2/2] MX53: support for freescale MX53LOCO board

2011-04-20 Thread Jason Liu
This patch add initial support for freescale MX53LOCO board.
Network(FEC),SD/MMC, UART have been supported by this patch.

Signed-off-by: Jason Liu 
---
changes since v4:
- remove the boot reset cause from board support
changes since v3:
- include other two small patch into this commit,
mx53loco: set mmc env to MMC slot1
MX5: Enable flat-device-tree support on mx53 loco board
changes since V2:
-factor out the boot cause function to common code,
-fix gd->ram_size with full memory size
-remove the '1' from all #defines that just enable features
-correct memory test end address value
---
 MAINTAINERS   |1 +
 arch/arm/cpu/armv7/mx5/soc.c  |2 +-
 board/freescale/mx53loco/Makefile |   47 +
 board/freescale/mx53loco/imximage.cfg |   96 +++
 board/freescale/mx53loco/mx53loco.c   |  301 +
 boards.cfg|1 +
 include/configs/mx53loco.h|  199 ++
 7 files changed, 646 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4756f14..7c311f7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -567,6 +567,7 @@ Stefano Babic 
 Jason Liu 
 
mx53evk i.MX53
+   mx53locoi.MX53
 
 Enric Balletbo i Serra 
 
diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c
index 6f4e8db..9c03474 100644
--- a/arch/arm/cpu/armv7/mx5/soc.c
+++ b/arch/arm/cpu/armv7/mx5/soc.c
@@ -116,7 +116,7 @@ int print_cpuinfo(void)
(cpurev & 0x000F0) >> 4,
(cpurev & 0xF) >> 0,
mxc_get_clock(MXC_ARM_CLK) / 100);
-   printf("Reset cause: %s\n", get_reset_cause());
+   printf("Reset  cause: %s\n", get_reset_cause());
return 0;
 }
 #endif
diff --git a/board/freescale/mx53loco/Makefile 
b/board/freescale/mx53loco/Makefile
new file mode 100644
index 000..2088a48
--- /dev/null
+++ b/board/freescale/mx53loco/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx53loco.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak .depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx53loco/imximage.cfg 
b/board/freescale/mx53loco/imximage.cfg
new file mode 100644
index 000..ce9c8fc
--- /dev/null
+++ b/board/freescale/mx53loco/imximage.cfg
@@ -0,0 +1,96 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM  sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type   AddressValue
+#
+# whe

Re: [U-Boot] [PATCH V3 1/2] MX5: factor out boot cause funciton to common code

2011-04-20 Thread Jason Liu
Hi, Stefano,

2011/4/20 Stefano Babic :
> On 04/18/2011 11:19 AM, Detlev Zundel wrote:
>> Hi Stefano,
>>
>>> On 04/15/2011 02:47 PM, Fabio Estevam wrote:
> +char *get_reset_cause(void)
> +{
> +    u32 cause;
> +    struct src *src_regs = (struct src
> *)SRC_BASE_ADDR;
> +
> +    cause = readl(&src_regs->srsr);

 You need to mask the 7 LSB of SRSR register.

 If you don´t bit 16 can still affect its result.
>>>
>>> Why ? As this becomes a general function for i.MX5, should we not
>>> provide a way to check all significant bits ? Why should we exclude the
>>> "warm boot" bit to be checked and printed out ?
>>
>> And _please_ (as indictated in my i.MX31 mail) use the code for _all_
>> iMX51 boards withoput the need for them to call a function and print the
>> result.
>
> Jason,
>
> I noted only now that this comment was not directly addressed to you,
> but it is related to your patch. As you see for the i.MX31, the result
> of the discussion was to call the get_reset_cause() inside the
> print_cpuinfo() function, to make automatically this function available
> for all MX5 boards.

Yes, I have send out the v5 patch for it. please review it. Thanks,

Jason

>
> Regards,
> Stefano
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] mx5: drop boot cause code from board support code

2011-04-22 Thread Jason Liu
Hi, Stefano,

2011/4/22 Stefano Babic :
> On 04/22/2011 07:45 AM, Jason Hui wrote:
>> Hi, Stefano,
>
> Hi Jason,
>
  int checkboard(void)
  {
       u32 system_rev = get_cpu_rev();
 -     u32 cause;
 -     struct src *src_regs = (struct src *)SRC_BASE_ADDR;
>>>
>>> This seems to me not the best solution. If we have now factored out code
>>> to print the reset cause and the silicon version (inside print_cpuinfo),
>>> why do we need to repeat this code for each board ? Calling get_cpu_rev
>>> seems to me redundant (then each board should only set
>>> CONFIG_DISPLAY_CPUINFO). And then the CPU revision is printed again, and
>>> this is redundant.
>>
>> The purpose for this patch is to remove the boot cause code and and don't 
>> change
>> any cpu rev code. The cpu rev part of code is as it is as before.
>
> However, it seems to me a half-way clean up. As we have already
> factorize function for printing the cpu revision and the reset cause, I
> will see in the checkboard only board related information. If there is
> no revision number for board, printing only the board name as you make
> for the LOCO is correct.
>
> Taking as example the efika board (all boards make the same):
>
>>
>>>

       puts("Board: Efika MX ");

       switch (system_rev & 0xff) {
>
> The only new information is the board name. If I am not wrong,
> system_rev & 0xff contains only the cpu revision, and the switch prints
> out the silicon version. Everything already done in print_cpuinfo as well.
>
>>
>> Ditto, as I only remove the boot cause part of code as the patch tile said.
>
> Yes, but this it is redundant with the print_cpuinfo(). As you plan to
> clean up the code, this part should be cleaned up as well. Or do you
> think there is something not covered by the common code ?
>
>>> I think we need more clean up, removing all part related to CPU revision
>>> and leaving (if any) only the output related to the board revision.
>>
>> If that, I need change the patch tile, and include more clean up in the patch
>> and send again.
>
> Agree.

OK, I will re-send the patch with more clean-up.

Jason

>
> Best regards,
> Stefano Babic
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V5 2/2] MX53: support for freescale MX53LOCO board

2011-04-22 Thread Jason Liu
Hi, Stefano,

2011/4/22 Stefano Babic :
> On 04/22/2011 06:36 AM, Jason Hui wrote:
>>
>> OK, I will resend the patchset as the following layout:
>>
>> MX5: clock: Add clock config interface
>> MX5: factor out boot cause funciton to common code
>> PMIC: Add dialog pmic support
>> MX53: support for freescale MX53LOCO board (merge "Add power init support")
>>
>> I will rebase on the u-boot-imx git, do you think is it OK?
>
> Yes, thanks.
>
 +#define CONFIG_SYS_MEMTEST_START       0x7000
 +#define CONFIG_SYS_MEMTEST_END         0x7001
>>>
>>> There is still an open question about this range. Can you answer to
>>> Wolfgang's question ?
>>
>> In fact, I want to give one simple test range when use mtest, I don't know
>> what you are worrying about, please tell it clearly?
>
> I think the only issue is if there is some reasons to set the test range
> to only 64KB, except the fact this was the value set for the mx51evk. If
> you do not see any special reasons, you could increase the
> CONFIG_SYS_MEMTEST_END to a larger value.

Is there any rule that we need must follow to set the
CONFIG_SYS_MEMTEST_START
CONFIG_SYS_MEMTEST_END ??

If no, I think the value we set is free. Here I set for 64KB is just
for simple and quick
test, there is no other reasons.

In fact, mtest command line can override the value.

What the value you think I need set?

Jason

>
> Best regards,
> Stefano
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V2 1/1] mx5: board: code clean up for checkboard code

2011-04-22 Thread Jason Liu
The boot cause code has been factor out to soc common
code,we need drop the part from the board support code

This patch also remove the redundant cpu version print

Signed-off-by: Jason Liu 
---
changes since v1
-include more clean up by remove the redundant cpu version print
---
 board/efikamx/efikamx.c   |   42 +
 board/freescale/mx51evk/mx51evk.c |   36 +--
 board/freescale/mx53evk/mx53evk.c |   21 +-
 board/ttcontrol/vision2/vision2.c |   42 +
 4 files changed, 4 insertions(+), 137 deletions(-)

diff --git a/board/efikamx/efikamx.c b/board/efikamx/efikamx.c
index f735260..16be532 100644
--- a/board/efikamx/efikamx.c
+++ b/board/efikamx/efikamx.c
@@ -643,47 +643,7 @@ int board_late_init(void)
 
 int checkboard(void)
 {
-   u32 system_rev = get_cpu_rev();
-   u32 cause;
-   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
-
-   puts("Board: Efika MX ");
-
-   switch (system_rev & 0xff) {
-   case CHIP_REV_3_0:
-   puts("3.0 [");
-   break;
-   case CHIP_REV_2_5:
-   puts("2.5 [");
-   break;
-   case CHIP_REV_2_0:
-   puts("2.0 [");
-   break;
-   case CHIP_REV_1_1:
-   puts("1.1 [");
-   break;
-   case CHIP_REV_1_0:
-   default:
-   puts("1.0 [");
-   break;
-   }
-
-   cause = src_regs->srsr;
-   switch (cause) {
-   case 0x0001:
-   puts("POR");
-   break;
-   case 0x0009:
-   puts("RST");
-   break;
-   case 0x0010:
-   case 0x0011:
-   puts("WDOG");
-   break;
-   default:
-   printf("unknown 0x%x", cause);
-   }
-   puts("]\n");
+   puts("Board: Efika MX\n");
 
return 0;
 }
diff --git a/board/freescale/mx51evk/mx51evk.c 
b/board/freescale/mx51evk/mx51evk.c
index 02a765d..e2d3d74 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -431,41 +431,7 @@ int board_late_init(void)
 
 int checkboard(void)
 {
-   puts("Board: MX51EVK ");
-
-   switch (system_rev & 0xff) {
-   case CHIP_REV_3_0:
-   puts("3.0 [");
-   break;
-   case CHIP_REV_2_5:
-   puts("2.5 [");
-   break;
-   case CHIP_REV_2_0:
-   puts("2.0 [");
-   break;
-   case CHIP_REV_1_1:
-   puts("1.1 [");
-   break;
-   case CHIP_REV_1_0:
-   default:
-   puts("1.0 [");
-   break;
-   }
+   puts("Board: MX51EVK\n");
 
-   switch (__raw_readl(SRC_BASE_ADDR + 0x8)) {
-   case 0x0001:
-   puts("POR");
-   break;
-   case 0x0009:
-   puts("RST");
-   break;
-   case 0x0010:
-   case 0x0011:
-   puts("WDOG");
-   break;
-   default:
-   puts("unknown");
-   }
-   puts("]\n");
return 0;
 }
diff --git a/board/freescale/mx53evk/mx53evk.c 
b/board/freescale/mx53evk/mx53evk.c
index e71701b..a89aa25 100644
--- a/board/freescale/mx53evk/mx53evk.c
+++ b/board/freescale/mx53evk/mx53evk.c
@@ -372,26 +372,7 @@ int board_late_init(void)
 
 int checkboard(void)
 {
-   u32 cause;
-   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+   puts("Board: MX53EVK\n");
 
-   puts("Board: MX53EVK [");
-
-   cause = src_regs->srsr;
-   switch (cause) {
-   case 0x0001:
-   printf("POR");
-   break;
-   case 0x0009:
-   printf("RST");
-   break;
-   case 0x0010:
-   case 0x0011:
-   printf("WDOG");
-   break;
-   default:
-   printf("unknown");
-   }
-   printf("]\n");
return 0;
 }
diff --git a/board/ttcontrol/vision2/vision2.c 
b/board/ttcontrol/vision2/vision2.c
index f8ef4fc..7f37bad 100644
--- a/board/ttcontrol/vision2/vision2.c
+++ b/board/ttcontrol/vision2/vision2.c
@@ -700,47 +700,7 @@ int board_late_init(void)
 
 int checkboard(void)
 {
-   u32 system_rev = get_cpu_rev();
-   u32 cause;
-   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
-
-   puts("Board: TTControl Vision II CPU V");
-
-   switch (system_rev & 0xff) {
-   case CHIP_REV_3_0:
-   puts("3.0 [");
-   break;
-   case CHIP_REV_2_5:
-   puts("2.5 [");
-   break;
-   case CHIP

[U-Boot] [PATCH V6 1/3] MX5: clock: Add clock config interface

2011-04-22 Thread Jason Liu
Add clock config interface support, so that we
can configure CPU or DDR clock in the later init

Signed-off-by: Jason Liu 
---
 arch/arm/cpu/armv7/mx5/clock.c   |  551 +-
 arch/arm/include/asm/arch-mx5/clock.h|4 +
 arch/arm/include/asm/arch-mx5/crm_regs.h |6 +
 arch/arm/include/asm/arch-mx5/imx-regs.h |1 +
 4 files changed, 559 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
index 0b04a88..04d9f71 100644
--- a/arch/arm/cpu/armv7/mx5/clock.c
+++ b/arch/arm/cpu/armv7/mx5/clock.c
@@ -24,6 +24,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,7 @@ enum pll_clocks {
PLL1_CLOCK = 0,
PLL2_CLOCK,
PLL3_CLOCK,
+   PLL4_CLOCK,
PLL_CLOCKS,
 };
 
@@ -41,8 +43,42 @@ struct mxc_pll_reg *mxc_plls[PLL_CLOCKS] = {
[PLL1_CLOCK] = (struct mxc_pll_reg *)PLL1_BASE_ADDR,
[PLL2_CLOCK] = (struct mxc_pll_reg *)PLL2_BASE_ADDR,
[PLL3_CLOCK] = (struct mxc_pll_reg *)PLL3_BASE_ADDR,
+   [PLL4_CLOCK] = (struct mxc_pll_reg *)PLL4_BASE_ADDR,
 };
 
+#define AHB_CLK_ROOT1
+#define SZ_DEC_1M   100
+#define PLL_PD_MAX  16  /* Actual pd+1 */
+#define PLL_MFI_MAX 15
+#define PLL_MFI_MIN 5
+#define ARM_DIV_MAX 8
+#define IPG_DIV_MAX 4
+#define AHB_DIV_MAX 8
+#define EMI_DIV_MAX 8
+#define NFC_DIV_MAX 8
+
+struct fixed_pll_mfd {
+   u32 ref_clk_hz;
+   u32 mfd;
+};
+
+const struct fixed_pll_mfd fixed_mfd[] = {
+   {CONFIG_SYS_MX5_HCLK, 24 * 16},
+};
+
+struct pll_param {
+   u32 pd;
+   u32 mfi;
+   u32 mfn;
+   u32 mfd;
+};
+
+#define PLL_FREQ_MAX(ref_clk)  (4 * (ref_clk) * PLL_MFI_MAX)
+#define PLL_FREQ_MIN(ref_clk) \
+   ((2 * (ref_clk) * (PLL_MFI_MIN - 1)) / PLL_PD_MAX)
+#define MAX_DDR_CLK 42000
+#define NFC_CLK_MAX 3400
+
 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
 
 /*
@@ -175,7 +211,7 @@ static u32 get_uart_clk(void)
 /*
  * This function returns the low power audio clock.
  */
-u32 get_lp_apm(void)
+static u32 get_lp_apm(void)
 {
u32 ret_val = 0;
u32 ccsr = __raw_readl(&mxc_ccm->ccsr);
@@ -191,7 +227,7 @@ u32 get_lp_apm(void)
 /*
  * get cspi clock rate.
  */
-u32 imx_get_cspiclk(void)
+static u32 get_cspi_clk(void)
 {
u32 ret_val = 0, pdf, pre_pdf, clk_sel;
u32 cscmr1 = __raw_readl(&mxc_ccm->cscmr1);
@@ -228,6 +264,94 @@ u32 imx_get_cspiclk(void)
return ret_val;
 }
 
+static u32 get_axi_a_clk(void)
+{
+   u32 cbcdr =  __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_AXI_A_PODF_MASK) \
+   >> MXC_CCM_CBCDR_AXI_A_PODF_OFFSET;
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_axi_b_clk(void)
+{
+   u32 cbcdr =  __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_AXI_B_PODF_MASK) \
+   >> MXC_CCM_CBCDR_AXI_B_PODF_OFFSET;
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_ahb_clk(void)
+{
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_AHB_PODF_MASK) \
+   >> MXC_CCM_CBCDR_AHB_PODF_OFFSET;
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_emi_slow_clk(void)
+{
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   u32 emi_clk_sel = cbcdr & MXC_CCM_CBCDR_EMI_CLK_SEL;
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_EMI_PODF_MASK) \
+   >> MXC_CCM_CBCDR_EMI_PODF_OFFSET;
+
+   if (emi_clk_sel)
+   return  get_ahb_clk() / (pdf + 1);
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_nfc_clk(void)
+{
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_NFC_PODF_MASK) \
+   >> MXC_CCM_CBCDR_NFC_PODF_OFFSET;
+
+   return  get_emi_slow_clk() / (pdf + 1);
+}
+
+static u32 get_ddr_clk(void)
+{
+   u32 ret_val = 0;
+   u32 cbcmr = __raw_readl(&mxc_ccm->cbcmr);
+   u32 ddr_clk_sel = (cbcmr & MXC_CCM_CBCMR_DDR_CLK_SEL_MASK) \
+   >> MXC_CCM_CBCMR_DDR_CLK_SEL_OFFSET;
+#ifdef CONFIG_MX51
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   if (cbcdr & MXC_CCM_CBCDR_DDR_HIFREQ_SEL) {
+   u32 ddr_clk_podf = (cbcdr & MXC_CCM_CBCDR_DDR_PODF_MASK) >> \
+   MXC_CCM_CBCDR_DDR_PODF_OFFSET;
+
+   ret_val = decode_pll(mxc_plls[PLL1_CLOCK], CONFIG_SYS_MX5_HCLK);
+   ret_val /= ddr_clk_podf + 1;
+
+   return ret_val;
+   }
+#endif
+   switch (ddr_clk_sel) {
+   case 0:
+   ret_val = get_axi_a_clk();
+   break;
+   case 1:
+   ret_val = get_axi_b_clk();
+ 

[U-Boot] [PATCH V6 2/3] PMIC: Add dialog pmic support

2011-04-22 Thread Jason Liu
Add dialog pmic(DA9053) driver with I2C interface support

Signed-off-by: Jason Liu 
---
 drivers/misc/Makefile  |1 +
 drivers/misc/dialog_pmic.c |  123 +
 include/da9053.h   |  186 
 3 files changed, 310 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index b152486..c557a14 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_NS87308) += ns87308.o
 COBJS-$(CONFIG_PDSP188x) += pdsp188x.o
 COBJS-$(CONFIG_STATUS_LED) += status_led.o
 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
+COBJS-$(CONFIG_DIALOG_PMIC) += dialog_pmic.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/misc/dialog_pmic.c b/drivers/misc/dialog_pmic.c
new file mode 100644
index 000..95dc6ea
--- /dev/null
+++ b/drivers/misc/dialog_pmic.c
@@ -0,0 +1,123 @@
+/*
+ * (C) Copyright 2011 Freescale Semiconductor, Inc.
+ * Based on drivers/misc/fsl_pmic.c
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+
+static int check_param(u32 reg, u32 write)
+{
+   if (reg > 142 || write > 1) {
+   printf(" = %d is invalid. Should be less then 142\n",
+   reg);
+   return -1;
+   }
+
+   return 0;
+}
+
+static u32 pmic_reg(u32 reg, u32 val, u32 write)
+{
+   unsigned char buf[1] = { 0 };
+   u32 ret_val = 0;
+
+   if (check_param(reg, write))
+   return -1;
+
+   if (write) {
+   buf[0] = (val) & 0xff;
+   if (i2c_write(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR, reg, 1, buf, 1))
+   return -1;
+   } else {
+   if (i2c_read(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR, reg, 1, buf, 1))
+   return -1;
+   ret_val = buf[0];
+   }
+
+   return ret_val;
+}
+
+void pmic_reg_write(u32 reg, u32 value)
+{
+   pmic_reg(reg, value, 1);
+}
+
+u32 pmic_reg_read(u32 reg)
+{
+   return pmic_reg(reg, 0, 0);
+}
+
+static void pmic_dump(int numregs)
+{
+   u32 val;
+   int i;
+
+   for (i = 0; i < numregs; i++) {
+   val = pmic_reg_read(i);
+   if (!(i % 8))
+   printf("\n0x%02x: ", i);
+   printf("%02x ", val);
+   }
+   puts("\n");
+}
+
+int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   char *cmd;
+   int nregs;
+   u32 val;
+
+   /* at least two arguments please */
+   if (argc < 2)
+   return cmd_usage(cmdtp);
+
+   cmd = argv[1];
+   if (strcmp(cmd, "dump") == 0) {
+   if (argc < 3)
+   return cmd_usage(cmdtp);
+
+   nregs = simple_strtoul(argv[2], NULL, 16);
+   pmic_dump(nregs);
+   return 0;
+   }
+   if (strcmp(cmd, "write") == 0) {
+   if (argc < 4)
+   return cmd_usage(cmdtp);
+
+   nregs = simple_strtoul(argv[2], NULL, 16);
+   val = simple_strtoul(argv[3], NULL, 16);
+   pmic_reg_write(nregs, val);
+   return 0;
+   }
+   /* No subcommand found */
+   return 1;
+}
+
+U_BOOT_CMD(
+   pmic,   CONFIG_SYS_MAXARGS, 1, do_pmic,
+   "Dialog PMIC (DA905x)",
+   "dump [numregs] dump registers\n"
+   "pmic write   - write register"
+);
diff --git a/include/da9053.h b/include/da9053.h
new file mode 100644
index 000..f69408a
--- /dev/null
+++ b/include/da9053.h
@@ -0,0 +1,186 @@
+/*
+ * da9053 register declarations.
+ *
+ * Copyright(c) 2009 Dialog Semiconductor Ltd.
+ *
+ * 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
+

[U-Boot] [PATCH V6 3/3] MX53: support for freescale MX53LOCO board

2011-04-22 Thread Jason Liu
This patch add initial support for freescale MX53LOCO board.
Network(FEC),SD/MMC,UART have been supported by this patch

The patch also config CPU:1GHZ,DDR:400MHZ for better peformance

Signed-off-by: Jason Liu 
---
Changes since v5:
- merge the "Add power init support" patch
changes since v4:
- remove the boot reset cause from board support
changes since v3:
- include other two small patch into this commit,
mx53loco: set mmc env to MMC slot1
MX5: Enable flat-device-tree support on mx53 loco board
changes since V2:
-factor out the boot cause function to common code,
-fix gd->ram_size with full memory size
-remove the '1' from all #defines that just enable features
-correct memory test end address value
---
 MAINTAINERS   |1 +
 arch/arm/cpu/armv7/mx5/soc.c  |2 +-
 arch/arm/include/asm/arch-mx5/sys_proto.h |2 +
 board/freescale/mx53loco/Makefile |   47 
 board/freescale/mx53loco/imximage.cfg |   96 +++
 board/freescale/mx53loco/mx53loco.c   |  395 +
 boards.cfg|1 +
 include/configs/mx53loco.h|  198 +++
 8 files changed, 741 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1299cbb..c00a196 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -567,6 +567,7 @@ Stefano Babic 
 Jason Liu 
 
mx53evk i.MX53
+   mx53locoi.MX53
 
 Enric Balletbo i Serra 
 
diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c
index 6f4e8db..9c03474 100644
--- a/arch/arm/cpu/armv7/mx5/soc.c
+++ b/arch/arm/cpu/armv7/mx5/soc.c
@@ -116,7 +116,7 @@ int print_cpuinfo(void)
(cpurev & 0x000F0) >> 4,
(cpurev & 0xF) >> 0,
mxc_get_clock(MXC_ARM_CLK) / 100);
-   printf("Reset cause: %s\n", get_reset_cause());
+   printf("Reset  cause: %s\n", get_reset_cause());
return 0;
 }
 #endif
diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h 
b/arch/arm/include/asm/arch-mx5/sys_proto.h
index f687503..2d7e9ed 100644
--- a/arch/arm/include/asm/arch-mx5/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
@@ -27,5 +27,7 @@
 u32 get_cpu_rev(void);
 #define is_soc_rev(rev)((get_cpu_rev() & 0xFF) - rev)
 void sdelay(unsigned long);
+void pmic_reg_write(u32 reg, u32 value);
+u32 pmic_reg_read(u32 reg);
 
 #endif
diff --git a/board/freescale/mx53loco/Makefile 
b/board/freescale/mx53loco/Makefile
new file mode 100644
index 000..2088a48
--- /dev/null
+++ b/board/freescale/mx53loco/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx53loco.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak .depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx53loco/imximage.cfg 
b/board/freescale/mx53loco/imximage.cfg
new file mode 100644
index 000..ce9c8fc
--- /dev/null
+++ b/board/freescale/mx53loco/imximage.cfg
@@ -0,0 +1,96 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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.
+#
+

Re: [U-Boot] [PATCH V5 2/2] MX53: support for freescale MX53LOCO board

2011-04-22 Thread Jason Liu
Hi, Wolfgang,

2011/4/22 Wolfgang Denk :
> Dear Jason Liu,
>
> In message  you wrote:
>>
>> > I think the only issue is if there is some reasons to set the test range
>> > to only 64KB, except the fact this was the value set for the mx51evk. If
>> > you do not see any special reasons, you could increase the
>> > CONFIG_SYS_MEMTEST_END to a larger value.
>>
>> Is there any rule that we need must follow to set the
>> CONFIG_SYS_MEMTEST_START
>> CONFIG_SYS_MEMTEST_END ??
>
> The only strict rule is that the test must work with the defined area.

Agree, I have tested it and it works.

>
>> If no, I think the value we set is free. Here I set for 64KB is just
>> for simple and quick
>> test, there is no other reasons.
>>
>> In fact, mtest command line can override the value.
>>
>> What the value you think I need set?
>
> My recommendation is to set a range that is as big as possible for
> the given system, so the default call of the mtest command will
> actually test all (well, most of) the present RAM.

As I said, I just want the user to do one quick test for the memory.
I don't think it need be set as big as possible.

Since there is no other rule I need follow for setting such value, So
I will keep as it's.

Jason

>
> Best regards,
>
> Wolfgang Denk
>
> --
> 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: w...@denx.de
> On our campus the UNIX system has proved to be not only an  effective
> software tool, but an agent of technical and social change within the
> University.                          - John Lions (U. of Toronto (?))
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V6 2/3] PMIC: Add dialog pmic support

2011-04-22 Thread Jason Liu
Hi, Stefano,

2011/4/22 Stefano Babic :
> On 04/22/2011 02:55 PM, Jason Liu wrote:
>> Add dialog pmic(DA9053) driver with I2C interface support
>>
>
> Hi Jason,
>
>> diff --git a/drivers/misc/dialog_pmic.c b/drivers/misc/dialog_pmic.c
>> new file mode 100644
>> index 000..95dc6ea
>> --- /dev/null
>> +++ b/drivers/misc/dialog_pmic.c
>> @@ -0,0 +1,123 @@
>> +/*
>> + * (C) Copyright 2011 Freescale Semiconductor, Inc.
>> + * Based on drivers/misc/fsl_pmic.c
>
> As I can see now, this driver is quite a copy of fsl_pmic.c, with
> slightly changes. Are you sure we cannot simply change the already
> provided driver, adding support for the new chip ?
>
> I have not read the DA9053 datasheet, but from your patch it seems to me
> that the relevant changes are:
>        - registers are 1 byte wide instead of 32 bit
>        - different size of register area
>
> Really not enough to justify a new driver. All functions are really
> copied from the old one. Please consider to adapt fsl_pmic.c instead of
> adding a slightly different new one.

fsl_pmic is about freescale mc13892 and fsl_pmic.c is dedicated for fsl pmic
as you write this file, right?

As I add the Dialog PMIC support, I do want to not add one new file, but I find
it's not easy to add it and it will make the file very mess, so, I
decide not to touch
the original file and add one new file. The head of this file tell it
clear that this patch is
Based on drivers/misc/fsl_pmic.c.

If you still want me to include the DA9053 support into fsl_pmic,
could you please
extend the fsl_pmic support to easily add another vender's pmic support first?

Jason

>
> Best regards,
> Stefano Babic
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V6 2/3] PMIC: Add dialog pmic support

2011-05-09 Thread Jason Liu
Hi, Stefano,

2011/4/27 Stefano Babic :
> On 04/27/2011 11:39 AM, Detlev Zundel wrote:
>
>> Then why not rename the driver to something else than "fsl_pmic"?  Maybe
>> this is what Jason really is asking?
>
> Yes, of course, no problem at all. Jason, if you meant to drop the fsl_
> to make the driver more general, I completely agree. Sorry, I have not
> got the point.

Sorry for the late response due to some reason. :(

Yes, We had better rename fsl_ to something else, I would like use generic_pmic
or something else, what's your idea?

Jason


>
> Best regards,
> Stefano
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 1/1] mx5: board: code clean up for checkboard code

2011-05-11 Thread Jason Liu
Hi, Stefano,

2011/4/22 Jason Liu :
> The boot cause code has been factor out to soc common
> code,we need drop the part from the board support code
>
> This patch also remove the redundant cpu version print
>
> Signed-off-by: Jason Liu 
> ---
> changes since v1
> -include more clean up by remove the redundant cpu version print
> ---
>  board/efikamx/efikamx.c           |   42 
> +
>  board/freescale/mx51evk/mx51evk.c |   36 +--
>  board/freescale/mx53evk/mx53evk.c |   21 +-
>  board/ttcontrol/vision2/vision2.c |   42 
> +
>  4 files changed, 4 insertions(+), 137 deletions(-)
>

Ping, any comments about this patch?

Jason

> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V7 3/3] MX53: support for freescale MX53LOCO board

2011-05-11 Thread Jason Liu
This patch add initial support for freescale MX53LOCO board.
Network(FEC),SD/MMC,UART have been supported by this patch

The patch also config CPU:1GHZ,DDR:400MHZ for better peformance

Signed-off-by: Jason Liu 
---
Changes since v5:
- merge the "Add power init support" patch
changes since v4:
- remove the boot reset cause from board support
changes since v3:
- include other two small patch into this commit,
mx53loco: set mmc env to MMC slot1
MX5: Enable flat-device-tree support on mx53 loco board
changes since V2:
-factor out the boot cause function to common code,
-fix gd->ram_size with full memory size
-remove the '1' from all #defines that just enable features
-correct memory test end address value
---
 MAINTAINERS   |1 +
 arch/arm/cpu/armv7/mx5/soc.c  |2 +-
 arch/arm/include/asm/arch-mx5/sys_proto.h |2 +
 board/freescale/mx53loco/Makefile |   47 
 board/freescale/mx53loco/imximage.cfg |   96 +++
 board/freescale/mx53loco/mx53loco.c   |  395 +
 boards.cfg|1 +
 include/configs/mx53loco.h|  199 +++
 8 files changed, 742 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index e2a4ba9..42c5048 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -574,6 +574,7 @@ Stefano Babic 
 Jason Liu 
 
mx53evk i.MX53
+   mx53locoi.MX53
 
 Enric Balletbo i Serra 
 
diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c
index 6f4e8db..9c03474 100644
--- a/arch/arm/cpu/armv7/mx5/soc.c
+++ b/arch/arm/cpu/armv7/mx5/soc.c
@@ -116,7 +116,7 @@ int print_cpuinfo(void)
(cpurev & 0x000F0) >> 4,
(cpurev & 0xF) >> 0,
mxc_get_clock(MXC_ARM_CLK) / 100);
-   printf("Reset cause: %s\n", get_reset_cause());
+   printf("Reset  cause: %s\n", get_reset_cause());
return 0;
 }
 #endif
diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h 
b/arch/arm/include/asm/arch-mx5/sys_proto.h
index f687503..2d7e9ed 100644
--- a/arch/arm/include/asm/arch-mx5/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
@@ -27,5 +27,7 @@
 u32 get_cpu_rev(void);
 #define is_soc_rev(rev)((get_cpu_rev() & 0xFF) - rev)
 void sdelay(unsigned long);
+void pmic_reg_write(u32 reg, u32 value);
+u32 pmic_reg_read(u32 reg);
 
 #endif
diff --git a/board/freescale/mx53loco/Makefile 
b/board/freescale/mx53loco/Makefile
new file mode 100644
index 000..2088a48
--- /dev/null
+++ b/board/freescale/mx53loco/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx53loco.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak .depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx53loco/imximage.cfg 
b/board/freescale/mx53loco/imximage.cfg
new file mode 100644
index 000..ce9c8fc
--- /dev/null
+++ b/board/freescale/mx53loco/imximage.cfg
@@ -0,0 +1,96 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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.
+#
+

[U-Boot] [PATCH V7 2/3] PMIC: Add dialog pmic support

2011-05-11 Thread Jason Liu
This patch add dialog pmic(DA9053) driver with I2C interface support
In order to not duplicate code and according to the discussion on the
mail-list, change fsl_pmic.c to spi_i2c_pmic.c.Actaully,spi_i2c_pmic.c
is just a wrapper for PMIC communication when SPI or I2C is used.

Signed-off-by: Jason Liu 
Cc: sba...@denx.de 
Cc: Detlev Zundel 
---
change since v1:
- use one file to support fsl pmic and dialog pmic
- rename fsl_pmic.c to spi_i2c_pmic.c
---
 drivers/misc/Makefile   |3 +-
 drivers/misc/{fsl_pmic.c => spi_i2c_pmic.c} |   72 +--
 include/da9053.h|  186 +++
 3 files changed, 248 insertions(+), 13 deletions(-)

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index b152486..b2e150e 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -26,9 +26,10 @@ include $(TOPDIR)/config.mk
 LIB:= $(obj)libmisc.o
 
 COBJS-$(CONFIG_ALI152X) += ali512x.o
+COBJS-$(CONFIG_DIALOG_PMIC) += spi_i2c_pmic.o
 COBJS-$(CONFIG_DS4510)  += ds4510.o
 COBJS-$(CONFIG_FSL_LAW) += fsl_law.o
-COBJS-$(CONFIG_FSL_PMIC) += fsl_pmic.o
+COBJS-$(CONFIG_FSL_PMIC) += spi_i2c_pmic.o
 COBJS-$(CONFIG_GPIO_LED) += gpio_led.o
 COBJS-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o
 COBJS-$(CONFIG_NS87308) += ns87308.o
diff --git a/drivers/misc/fsl_pmic.c b/drivers/misc/spi_i2c_pmic.c
similarity index 76%
rename from drivers/misc/fsl_pmic.c
rename to drivers/misc/spi_i2c_pmic.c
index ef80ad9..5fbfb40 100644
--- a/drivers/misc/fsl_pmic.c
+++ b/drivers/misc/spi_i2c_pmic.c
@@ -22,13 +22,16 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
+#if defined(CONFIG_FSL_PMIC)
 #include 
+#endif
 
-static int check_param(u32 reg, u32 write)
+static int check_param(u32 reg, u32 write, u32 max_reg)
 {
-   if (reg > 63 || write > 1) {
+   if (reg > max_reg || write > 1) {
printf(" = %d is invalid. Should be less then 63\n",
reg);
return -1;
@@ -37,15 +40,13 @@ static int check_param(u32 reg, u32 write)
return 0;
 }
 
-#ifdef CONFIG_FSL_PMIC_I2C
-#include 
-
-u32 pmic_reg(u32 reg, u32 val, u32 write)
+#if defined(CONFIG_FSL_PMIC_I2C)
+u32 fsl_pmic_reg(u32 reg, u32 val, u32 write)
 {
-   unsigned char buf[4] = { 0 };
u32 ret_val = 0;
+   unsigned char buf[4] = { 0 };
 
-   if (check_param(reg, write))
+   if (check_param(reg, write, 63))
return -1;
 
if (write) {
@@ -62,7 +63,44 @@ u32 pmic_reg(u32 reg, u32 val, u32 write)
 
return ret_val;
 }
-#else /* SPI interface */
+#endif
+
+#if defined(CONFIG_DIALOG_PMIC_I2C)
+u32 dlg_pmic_reg(u32 reg, u32 val, u32 write)
+{
+   u32 ret_val = 0;
+   unsigned char buf[1] = { 0 };
+
+   if (check_param(reg, write, 142))
+   return -1;
+
+   if (write) {
+   buf[0] = (val) & 0xff;
+   if (i2c_write(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR, reg, 1, buf, 1))
+   return -1;
+   } else {
+   if (i2c_read(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR, reg, 1, buf, 1))
+   return -1;
+   ret_val = buf[0];
+   }
+
+   return ret_val;
+}
+#endif
+
+#if defined(CONFIG_FSL_PMIC_I2C) || defined(CONFIG_DIALOG_PMIC_I2C)
+#include 
+u32 pmic_reg(u32 reg, u32 val, u32 write)
+{
+#if defined(CONFIG_FSL_PMIC_I2C)
+   return fsl_pmic_reg(reg, val, write);
+#endif
+
+#if defined(CONFIG_DIALOG_PMIC_I2C)
+   return dlg_pmic_reg(reg, val, write);
+#endif
+}
+#elif defined(CONFIG_FSL_PMIC) /* SPI interface */
 #include 
 static struct spi_slave *slave;
 
@@ -92,7 +130,7 @@ u32 pmic_reg(u32 reg, u32 val, u32 write)
return -1;
}
 
-   if (check_param(reg, write))
+   if (check_param(reg, write, 63))
return -1;
 
if (spi_claim_bus(slave))
@@ -135,6 +173,7 @@ u32 pmic_reg_read(u32 reg)
 
 void pmic_show_pmic_info(void)
 {
+#if defined(CONFIG_FSL_PMIC)
u32 rev_id;
 
rev_id = pmic_reg_read(REG_IDENTIFICATION);
@@ -178,6 +217,7 @@ void pmic_show_pmic_info(void)
break;
}
puts("]\n");
+#endif
 }
 
 static void pmic_dump(int numregs)
@@ -189,7 +229,7 @@ static void pmic_dump(int numregs)
for (i = 0; i < numregs; i++) {
val = pmic_reg_read(i);
if (!(i % 8))
-   printf ("\n0x%02x: ", i);
+   printf("\n0x%02x: ", i);
printf("%08x ", val);
}
puts("\n");
@@ -227,9 +267,17 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
return 1;
 }
 
+#if defined(CONFIG_FSL_PMIC)
+#define PMIC_NAME "Freescale PMIC (Atlas)"
+#elif defined(CONFIG_DIALOG_PMIC)
+#define PMIC_NAME "Dialog PMIC (DA905x)"
+#else
+#error "Unkown PMIC name"
+#endif
+
 U_BOOT_CMD(
pmic,   C

[U-Boot] [PATCH V7 1/3] MX5: clock: Add clock config interface

2011-05-11 Thread Jason Liu
Add clock config interface support, so that we
can configure CPU or DDR clock in the later init

Signed-off-by: Jason Liu 
---
 arch/arm/cpu/armv7/mx5/clock.c   |  551 +-
 arch/arm/include/asm/arch-mx5/clock.h|4 +
 arch/arm/include/asm/arch-mx5/crm_regs.h |6 +
 arch/arm/include/asm/arch-mx5/imx-regs.h |1 +
 4 files changed, 559 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
index 0b04a88..04d9f71 100644
--- a/arch/arm/cpu/armv7/mx5/clock.c
+++ b/arch/arm/cpu/armv7/mx5/clock.c
@@ -24,6 +24,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,7 @@ enum pll_clocks {
PLL1_CLOCK = 0,
PLL2_CLOCK,
PLL3_CLOCK,
+   PLL4_CLOCK,
PLL_CLOCKS,
 };
 
@@ -41,8 +43,42 @@ struct mxc_pll_reg *mxc_plls[PLL_CLOCKS] = {
[PLL1_CLOCK] = (struct mxc_pll_reg *)PLL1_BASE_ADDR,
[PLL2_CLOCK] = (struct mxc_pll_reg *)PLL2_BASE_ADDR,
[PLL3_CLOCK] = (struct mxc_pll_reg *)PLL3_BASE_ADDR,
+   [PLL4_CLOCK] = (struct mxc_pll_reg *)PLL4_BASE_ADDR,
 };
 
+#define AHB_CLK_ROOT1
+#define SZ_DEC_1M   100
+#define PLL_PD_MAX  16  /* Actual pd+1 */
+#define PLL_MFI_MAX 15
+#define PLL_MFI_MIN 5
+#define ARM_DIV_MAX 8
+#define IPG_DIV_MAX 4
+#define AHB_DIV_MAX 8
+#define EMI_DIV_MAX 8
+#define NFC_DIV_MAX 8
+
+struct fixed_pll_mfd {
+   u32 ref_clk_hz;
+   u32 mfd;
+};
+
+const struct fixed_pll_mfd fixed_mfd[] = {
+   {CONFIG_SYS_MX5_HCLK, 24 * 16},
+};
+
+struct pll_param {
+   u32 pd;
+   u32 mfi;
+   u32 mfn;
+   u32 mfd;
+};
+
+#define PLL_FREQ_MAX(ref_clk)  (4 * (ref_clk) * PLL_MFI_MAX)
+#define PLL_FREQ_MIN(ref_clk) \
+   ((2 * (ref_clk) * (PLL_MFI_MIN - 1)) / PLL_PD_MAX)
+#define MAX_DDR_CLK 42000
+#define NFC_CLK_MAX 3400
+
 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
 
 /*
@@ -175,7 +211,7 @@ static u32 get_uart_clk(void)
 /*
  * This function returns the low power audio clock.
  */
-u32 get_lp_apm(void)
+static u32 get_lp_apm(void)
 {
u32 ret_val = 0;
u32 ccsr = __raw_readl(&mxc_ccm->ccsr);
@@ -191,7 +227,7 @@ u32 get_lp_apm(void)
 /*
  * get cspi clock rate.
  */
-u32 imx_get_cspiclk(void)
+static u32 get_cspi_clk(void)
 {
u32 ret_val = 0, pdf, pre_pdf, clk_sel;
u32 cscmr1 = __raw_readl(&mxc_ccm->cscmr1);
@@ -228,6 +264,94 @@ u32 imx_get_cspiclk(void)
return ret_val;
 }
 
+static u32 get_axi_a_clk(void)
+{
+   u32 cbcdr =  __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_AXI_A_PODF_MASK) \
+   >> MXC_CCM_CBCDR_AXI_A_PODF_OFFSET;
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_axi_b_clk(void)
+{
+   u32 cbcdr =  __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_AXI_B_PODF_MASK) \
+   >> MXC_CCM_CBCDR_AXI_B_PODF_OFFSET;
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_ahb_clk(void)
+{
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_AHB_PODF_MASK) \
+   >> MXC_CCM_CBCDR_AHB_PODF_OFFSET;
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_emi_slow_clk(void)
+{
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   u32 emi_clk_sel = cbcdr & MXC_CCM_CBCDR_EMI_CLK_SEL;
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_EMI_PODF_MASK) \
+   >> MXC_CCM_CBCDR_EMI_PODF_OFFSET;
+
+   if (emi_clk_sel)
+   return  get_ahb_clk() / (pdf + 1);
+
+   return  get_periph_clk() / (pdf + 1);
+}
+
+static u32 get_nfc_clk(void)
+{
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   u32 pdf = (cbcdr & MXC_CCM_CBCDR_NFC_PODF_MASK) \
+   >> MXC_CCM_CBCDR_NFC_PODF_OFFSET;
+
+   return  get_emi_slow_clk() / (pdf + 1);
+}
+
+static u32 get_ddr_clk(void)
+{
+   u32 ret_val = 0;
+   u32 cbcmr = __raw_readl(&mxc_ccm->cbcmr);
+   u32 ddr_clk_sel = (cbcmr & MXC_CCM_CBCMR_DDR_CLK_SEL_MASK) \
+   >> MXC_CCM_CBCMR_DDR_CLK_SEL_OFFSET;
+#ifdef CONFIG_MX51
+   u32 cbcdr = __raw_readl(&mxc_ccm->cbcdr);
+   if (cbcdr & MXC_CCM_CBCDR_DDR_HIFREQ_SEL) {
+   u32 ddr_clk_podf = (cbcdr & MXC_CCM_CBCDR_DDR_PODF_MASK) >> \
+   MXC_CCM_CBCDR_DDR_PODF_OFFSET;
+
+   ret_val = decode_pll(mxc_plls[PLL1_CLOCK], CONFIG_SYS_MX5_HCLK);
+   ret_val /= ddr_clk_podf + 1;
+
+   return ret_val;
+   }
+#endif
+   switch (ddr_clk_sel) {
+   case 0:
+   ret_val = get_axi_a_clk();
+   break;
+   case 1:
+   ret_val = get_axi_b_clk();
+ 

Re: [U-Boot] [PATCH V7 3/3] MX53: support for freescale MX53LOCO board

2011-05-11 Thread Jason Liu
Hi, Stefano,

2011/5/11 Stefano Babic :
> On 05/11/2011 10:03 AM, Jason Liu wrote:
>> This patch add initial support for freescale MX53LOCO board.
>> Network(FEC),SD/MMC,UART have been supported by this patch
>>
>> The patch also config CPU:1GHZ,DDR:400MHZ for better peformance
>>
>> Signed-off-by: Jason Liu 
>
> Hi Jason,
>
...
>>  u32 get_cpu_rev(void);
>>  #define is_soc_rev(rev)      ((get_cpu_rev() & 0xFF) - rev)
>>  void sdelay(unsigned long);
>> +void pmic_reg_write(u32 reg, u32 value);
>> +u32 pmic_reg_read(u32 reg);
>
> The pmic_ prototypes have nothing to do with the Soc prototype, as they
> are specific for a driver. You should move them in the dialog header.
>

I think I need create one head file named: include/dlg_pmic.h to include the
pmic_reg_write/read declaration and not just put the declaration to
da9053.h file, what's your idea?

Jason

>
> Best regards,
> Stefano Babic
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V7 2/3] PMIC: Add dialog pmic support

2011-05-12 Thread Jason Liu
Hi, Stefano,

2011/5/12 Stefano Babic :
> On 05/11/2011 10:03 AM, Jason Liu wrote:
>> This patch add dialog pmic(DA9053) driver with I2C interface support
>> In order to not duplicate code and according to the discussion on the
>> mail-list, change fsl_pmic.c to spi_i2c_pmic.c.Actaully,spi_i2c_pmic.c
>> is just a wrapper for PMIC communication when SPI or I2C is used.
>>
>> Signed-off-by: Jason Liu 
>> Cc: sba...@denx.de 
>> Cc: Detlev Zundel 
>
> Hi Jason,
>
>> --- a/drivers/misc/fsl_pmic.c
>> +++ b/drivers/misc/spi_i2c_pmic.c
>> @@ -22,13 +22,16 @@
>>
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>> +#if defined(CONFIG_FSL_PMIC)
>>  #include 
>> +#endif
>>
>> -static int check_param(u32 reg, u32 write)
>> +static int check_param(u32 reg, u32 write, u32 max_reg)
>>  {
>> -     if (reg > 63 || write > 1) {
>> +     if (reg > max_reg || write > 1) {
>>               printf(" = %d is invalid. Should be less then 63\n",
>>                       reg);
>>               return -1;
>> @@ -37,15 +40,13 @@ static int check_param(u32 reg, u32 write)
>>       return 0;
>>  }
>>
>> -#ifdef CONFIG_FSL_PMIC_I2C
>> -#include 
>> -
>> -u32 pmic_reg(u32 reg, u32 val, u32 write)
>> +#if defined(CONFIG_FSL_PMIC_I2C)
>> +u32 fsl_pmic_reg(u32 reg, u32 val, u32 write)
>>  {
>> -     unsigned char buf[4] = { 0 };
>>       u32 ret_val = 0;
>> +     unsigned char buf[4] = { 0 };
>>
>> -     if (check_param(reg, write))
>> +     if (check_param(reg, write, 63))
>>               return -1;
>>
>>       if (write) {
>> @@ -62,7 +63,44 @@ u32 pmic_reg(u32 reg, u32 val, u32 write)
>>
>>       return ret_val;
>>  }
>> -#else /* SPI interface */
>> +#endif
>> +
>> +#if defined(CONFIG_DIALOG_PMIC_I2C)
>> +u32 dlg_pmic_reg(u32 reg, u32 val, u32 write)
>> +{
>> +     u32 ret_val = 0;
>> +     unsigned char buf[1] = { 0 };
>> +
>> +     if (check_param(reg, write, 142))
>> +             return -1;
>> +
>> +     if (write) {
>> +             buf[0] = (val) & 0xff;
>> +             if (i2c_write(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR, reg, 1, buf, 1))
>> +                     return -1;
>> +     } else {
>> +             if (i2c_read(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR, reg, 1, buf, 1))
>> +                     return -1;
>> +             ret_val = buf[0];
>> +     }
>> +
>> +     return ret_val;
>
> This is not what I meant. You have duplicated the code, instead of merge
> the two functions together. And I think the switch is wrong.
> This file provides a general access to PMIc using SPI/I2C. There should
> not be #ifdef related to a single PMIC. Instead of that, You need
> additional CONFIG_ to select how to access the PMIC (8 bit or 32 bit).

Then can we have the CONFIG_SYS_DIALOG_PMIC_I2C_ADDR or
CONFIG_SYS_FSL_PMIC_I2C_ADDR in this file?

Please tell clear about your mean, don't let me guess what you mean?

>
> IMHO we can rid of the check_param() function, as this is a constraint
> to have an implementation independent from a single PMIC.

If you think we don't need check_param, then It's ok. I can remove it.
Since this function is added by you before.

>
> I would prefer something like this:
>
> u32 pmic_reg(u32 reg, u32 val, u32 write) {
>
>        
> #ifdef CONFIG_SYS_PMIC_8BIT
>
>        
> #else
>
>        
> #endif

Then what you prefer is function pointer or something else?
Please tell clear, otherwise, it will cost another time to do it.

>
>
>> +#if defined(CONFIG_FSL_PMIC_I2C) || defined(CONFIG_DIALOG_PMIC_I2C)
>
> Same comments apply here. We should select only between I2C and SPI, not
> the chip.
>
>> +#if defined(CONFIG_FSL_PMIC)
>> +#define PMIC_NAME "Freescale PMIC (Atlas)"
>> +#elif defined(CONFIG_DIALOG_PMIC)
>> +#define PMIC_NAME "Dialog PMIC (DA905x)"
>> +#else
>> +#error "Unkown PMIC name"
>> +#endif
>
> Instead of that, we can set a general name or put the PMIC_NAME inside
> the specific PMIC header file.

Then what general name you think it's good?

I have seen the painful for restructure with the second time, another
is the make imximage.
Can we avoid it in the future?

And BTW, do you have any comments about the 1/3 clock patch? If you
have, please tell it
as early as possible and I don't want to let the patch version goes up
very bigger and the time endless.

Thanks,

Jason

>
> Best regards,
> Stefano
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V7 2/3] PMIC: Add dialog pmic support

2011-05-13 Thread Jason Liu
Hi, Stefano,

2011/5/13 Stefano Babic :
> On 05/13/2011 05:08 AM, Jason Liu wrote:
>> Hi, Stefano,
>
> Hi Jason,
>
[...]
>>
>> And BTW, do you have any comments about the 1/3 clock patch? If you
>> have, please tell it
>> as early as possible and I don't want to let the patch version goes up
>> very bigger and the time endless.
>
> The patch adds several functions that are strictly related to the
> processor and I am checking with the reference manuals to understand
> them. I need more time for it.

If that, can we consider that I just add the basic mx53loco support:
which exclude:

Dialog PMIC support, which is just useful to increase the CPU to 1GHZ,
by default voltage,
CPU can only run up to 800MHZ,

clock code(patch 1/3) , which is just useful to increase DDR run up to
400Mhz, by default it's 333Mhz.

I just don't want to break the basic mx53loco board support to
mainline for so-long time.

Please advise, thanks,

Jason

>
> Best regards,
> Stefano Babic
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v7 1/1] MX53: support for freescale MX53LOCO board

2011-05-13 Thread Jason Liu
This patch add initial support for freescale MX53LOCO board.
Network(FEC),SD/MMC,UART have been supported by this patch

Signed-off-by: Jason Liu 
---
Changes since v6:
- move the pmic support out from this patchset
Changes since v5:
- merge the "Add power init support" patch
changes since v4:
- remove the boot reset cause from board support
changes since v3:
- include other two small patch into this commit,
mx53loco: set mmc env to MMC slot1
MX5: Enable flat-device-tree support on mx53 loco board
changes since V2:
-factor out the boot cause function to common code,
-fix gd->ram_size with full memory size
-remove the '1' from all #defines that just enable features
-correct memory test end address value
---
 MAINTAINERS   |1 +
 board/freescale/mx53loco/Makefile |   47 +
 board/freescale/mx53loco/imximage.cfg |   96 +++
 board/freescale/mx53loco/mx53loco.c   |  302 +
 boards.cfg|1 +
 include/configs/mx53loco.h|  186 
 6 files changed, 633 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index e2a4ba9..42c5048 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -574,6 +574,7 @@ Stefano Babic 
 Jason Liu 
 
mx53evk i.MX53
+   mx53locoi.MX53
 
 Enric Balletbo i Serra 
 
diff --git a/board/freescale/mx53loco/Makefile 
b/board/freescale/mx53loco/Makefile
new file mode 100644
index 000..2088a48
--- /dev/null
+++ b/board/freescale/mx53loco/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx53loco.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak .depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx53loco/imximage.cfg 
b/board/freescale/mx53loco/imximage.cfg
new file mode 100644
index 000..ce9c8fc
--- /dev/null
+++ b/board/freescale/mx53loco/imximage.cfg
@@ -0,0 +1,96 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM  sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type   AddressValue
+#
+# where:
+#  Addr-type register length (1,2 or 4 bytes)
+#  Address   absolute address of the register
+#  value value to be stored in the register
+
+DATA 4 0x53fa8554 0x0030
+DATA 4 0x53fa8558 0x00300040
+DATA 4 0x53fa8560 0x0030
+DATA 4 0x53fa8564 0x00300040
+DATA 4 0x53fa8568 0x00300040
+DATA 4 0x53fa8570 0x0030
+DATA 4 0x53fa8574 0x0030
+DATA 4 0x53fa8578 0x0030
+DATA 4 0x53fa857c 0x00300040
+DATA 4 0x53fa

Re: [U-Boot] [PATCH 2/2] MX53: Add initial support for MX53ARD board

2011-05-15 Thread Jason Liu
Hi, Fabio,

[...]
> +static void setup_iomux_uart(void)
> +{
> +       /* UART1 RXD */
> +       mxc_request_iomux(MX53_PIN_ATA_DMACK, IOMUX_CONFIG_ALT3);
> +       mxc_iomux_set_pad(MX53_PIN_ATA_DMACK,
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
> +                               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU |
> +                               PAD_CTL_ODE_OPENDRAIN_ENABLE);
> +       mxc_iomux_set_input(MX53_UART1_IPP_UART_RXD_MUX_SELECT_INPUT, 0x3);
> +
> +       /* UART1 TXD */
> +       mxc_request_iomux(MX53_PIN_ATA_DIOW, IOMUX_CONFIG_ALT3);
> +       mxc_iomux_set_pad(MX53_PIN_ATA_DIOW,
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
> +                               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU |
> +                               PAD_CTL_ODE_OPENDRAIN_ENABLE);
> +}
> +
> +#ifdef CONFIG_FSL_ESDHC
> +struct fsl_esdhc_cfg esdhc_cfg[1] = {
> +       {MMC_SDHC1_BASE_ADDR, 1},
> +};

Why only support one mmc slot?

> +
> +int board_mmc_getcd(u8 *cd, struct mmc *mmc)
> +{
> +       *cd = mxc_gpio_get(1); /*GPIO1*/
> +
> +       return 0;
> +}

Dito, here  /*GPIO1*/ should be  /*GPIO0_1*/ ?

> +
> +int board_mmc_init(bd_t *bis)
> +{
> +       u32 index;
> +       s32 status = 0;
> +
> +       for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM; index++) {
> +               switch (index) {
> +               case 0:
> +                       mxc_request_iomux(MX53_PIN_SD1_CMD, 
> IOMUX_CONFIG_ALT0);
> +                       mxc_request_iomux(MX53_PIN_SD1_CLK, 
> IOMUX_CONFIG_ALT0);
> +                       mxc_request_iomux(MX53_PIN_SD1_DATA0,
> +                                               IOMUX_CONFIG_ALT0);
> +                       mxc_request_iomux(MX53_PIN_SD1_DATA1,
> +                                               IOMUX_CONFIG_ALT0);
> +                       mxc_request_iomux(MX53_PIN_SD1_DATA2,
> +                                               IOMUX_CONFIG_ALT0);
> +                       mxc_request_iomux(MX53_PIN_SD1_DATA3,
> +                                               IOMUX_CONFIG_ALT0);
> +                       mxc_request_iomux(MX53_PIN_EIM_DA13,
> +                                               IOMUX_CONFIG_ALT1);
> +
> +                       mxc_iomux_set_pad(MX53_PIN_SD1_CMD,
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
> +                               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU);
> +                       mxc_iomux_set_pad(MX53_PIN_SD1_CLK,
> +                               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
> +                               PAD_CTL_DRV_HIGH);
> +                       mxc_iomux_set_pad(MX53_PIN_SD1_DATA0,
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
> +                               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
> +                       mxc_iomux_set_pad(MX53_PIN_SD1_DATA1,
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
> +                               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
> +                       mxc_iomux_set_pad(MX53_PIN_SD1_DATA2,
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
> +                               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
> +                       mxc_iomux_set_pad(MX53_PIN_SD1_DATA3,
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
> +                               PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
> +                               PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
> +                       break;
> +
> +               default:
> +                       printf("Warning: you configured more ESDHC controller"
> +                               "(%d) as supported by the board(1)\n",
> +                               CONFIG_SYS_FSL_ESDHC_NUM);
> +                       return status;

Here is wrong, the board can support up  to 2 esdhc controller.

> +               }
> +               status |= fsl_esdhc_initialize(bis, &esdhc_cfg[index]);
> +       }
> +
> +       return status;
> +}
> +#endif
> +
[..]
> +void weim_cs1_settings()
> +{
> +       unsigned int reg;
> +
> +       writel(0x20001, (WEIM_BASE_ADDR + 0x18));
> +       writel(0x0, (WEIM_BASE_ADDR + 0x1C));
> +       writel(0x16000202, (WEIM_BASE_ADDR + 0x20));
> +       writel(0x0002, (WEIM_BASE_ADDR + 0x24));
> +       writel(0x16002082, (WEIM_BASE_ADDR + 0x28));
> +       writel(0x, (WEIM_BASE_ADDR + 0x

Re: [U-Boot] [PATCH V2 1/1] mx5: board: code clean up for checkboard code

2011-05-15 Thread Jason Liu
Hi,Stefano,

2011/5/11 Jason Liu :
> Hi, Stefano,
>
> 2011/4/22 Jason Liu :
>> The boot cause code has been factor out to soc common
>> code,we need drop the part from the board support code
>>
>> This patch also remove the redundant cpu version print
>>
>> Signed-off-by: Jason Liu 
>> ---
>> changes since v1
>> -include more clean up by remove the redundant cpu version print
>> ---
>>  board/efikamx/efikamx.c           |   42 
>> +
>>  board/freescale/mx51evk/mx51evk.c |   36 +--
>>  board/freescale/mx53evk/mx53evk.c |   21 +-
>>  board/ttcontrol/vision2/vision2.c |   42 
>> +
>>  4 files changed, 4 insertions(+), 137 deletions(-)
>>
>
> Ping, any comments about this patch?
>

Any comments, if not, please pull it, thanks.

> Jason
>
>> ___
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] MX5: clock: Add clock config interface

2011-05-15 Thread Jason Liu
Hi, Stefano,

2011/4/13 Jason Liu :
> Add clock config interface support, so that we
> can configure CPU or DDR clock in the later init
>
> Signed-off-by: Jason Liu 
> ---
>  arch/arm/cpu/armv7/mx5/clock.c           |  551 
> +-
>  arch/arm/include/asm/arch-mx5/clock.h    |    4 +
>  arch/arm/include/asm/arch-mx5/crm_regs.h |    6 +
>  arch/arm/include/asm/arch-mx5/imx-regs.h |    1 +
>  4 files changed, 559 insertions(+), 3 deletions(-)
>

The clock code has been submitted to mail-list for more than one
month, any comments for it?
Since you are the imx custodian, you need quick review the patch
related to imx, right?

Jason

> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] MX5: clock: Add clock config interface

2011-05-16 Thread Jason Liu
Hi, Stefano,

2011/5/16 Stefano Babic :
> On 05/16/2011 08:04 AM, Jason Liu wrote:
>> Hi, Stefano,
>>
>
> Hi Jason,
>
>> The clock code has been submitted to mail-list for more than one
>> month, any comments for it?
>> Since you are the imx custodian, you need quick review the patch
>> related to imx, right?
>
> Because the clock patch was part of a patchset where I have already sent
> comments to you asking for changing (due to dialog pmic), and the
> patchset is not merged as it is in mainline, the patch you mentioned is
> not very urgent, because it adds functions not used anymore in code. Of
> course, a review is needed and I have already asked to you  to give me
> more time a couple of days ago.

I think the normal process should be if you have comments, you need
give it as early as possible.
>
> Anyway, I will send today my comments on this patch.

Thanks,

Jason

>
> Best regards,
> Stefano Babic
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] MX53: Remove CONFIG_SYS_BOOTMAPSZ from mx53 config files.

2011-05-16 Thread Jason Liu
Hi, Stefano,

2011/5/16 Stefano Babic :
> On 05/16/2011 12:58 AM, Fabio Estevam wrote:
>> commit ed59e58 (Remove device tree booting dependency on 
>> CONFIG_SYS_BOOTMAPSZ) made the
>> definition of CONFIG_SYS_BOOTMAPSZ unnecessary.
>>
>> Signed-off-by: Fabio Estevam 
>>
>>  #define CONFIG_OF_LIBFDT
>> -#define CONFIG_SYS_BOOTMAPSZ   0x80
>
> We have already discussed about it, I think I can safely apply it as fix.

When I did mx53loco board and DT support for linaro, grant's patch is not there.
But now, we can remove it.

Acked-by: Jason Liu 

for mx53loco part.


Jason

>
> Best regards,
> Stefano Babic
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/3] MX53: Add initial support for MX53ARD board

2011-05-16 Thread Jason Liu
Hi, Fabio,

2011/5/17 Fabio Estevam :
> Signed-off-by: Fabio Estevam 
> ---
> Changes since v1:
> - Use io accessors to access weim and iomuxc
> - Initialize the 2 esdhc controllers
> - Configure the 2 banks of DDR memory
> - Fix typo on machine_id
> - Remove CONFIG_SYS_BOOTMAPSZ from config file
>
>  MAINTAINERS                          |    1 +
>  board/freescale/mx53ard/Makefile     |   48 +
>  board/freescale/mx53ard/imximage.cfg |   96 +++
>  board/freescale/mx53ard/mx53ard.c    |  314 
> ++
>  boards.cfg                           |    1 +
>  include/configs/mx53ard.h            |  193 +
>  6 files changed, 653 insertions(+), 0 deletions(-)
>  create mode 100644 board/freescale/mx53ard/Makefile
>  create mode 100644 board/freescale/mx53ard/imximage.cfg
>  create mode 100644 board/freescale/mx53ard/mx53ard.c
>  create mode 100644 include/configs/mx53ard.h
>

We have two version of ARD board, one is DDR3 board, Had better
specify which ARD board
this patch support?

Jason Liu

>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/3] MX5: Add iomux structure

2011-05-16 Thread Jason Liu
Hi, Fabio,

2011/5/17 Fabio Estevam :
> Signed-off-by: Fabio Estevam 
> ---
> Changes since v1:
> - iomuxc was accessed directly in v1, so create a iomux struct
> so that we can use io accessors
>
>  arch/arm/include/asm/arch-mx5/imx-regs.h |   11 +++
>  1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-mx5/imx-regs.h 
> b/arch/arm/include/asm/arch-mx5/imx-regs.h
> index d80e0c0..eb690ec 100644
> --- a/arch/arm/include/asm/arch-mx5/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx5/imx-regs.h
> @@ -273,6 +273,17 @@ struct weim {
>        u32     ear;
>  };
>
> +struct iomuxc {
> +       u32     gpr0;
> +       u32     gpr1;
> +       u32     gpr2;
> +       u32     omux0;
> +       u32     omux1;
> +       u32     omux2;
> +       u32     omux3;
> +       u32     omux4;
> +};

I think iomux register does not limited to the above registers and you
defined some unused register
such as IOMUXC_OBSERVE_MUX_0, if you only use gpr, you can just define
iomuxc_gpr etc.

And what's more, mx51 and mx53 has different layout, on i.mx51, the layout is:

IOMUXC_GPR0,
IOMUXC_GPR1,
IOMUXC_OBSERVE_MUX_0,
IOMUXC_OBSERVE_MUX_1,
IOMUXC_OBSERVE_MUX_2,
IOMUXC_OBSERVE_MUX_3,

so, you can't simply put it to the common head file for all the i.mx5 soc.

> +
>  /* GPIO Registers */
>  struct gpio_regs {
>        u32     gpio_dr;
> --
> 1.6.0.4
>
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] MX5: Make the weim structure complete

2011-05-16 Thread Jason Liu
Hi, Fabio,

2011/5/17 Fabio Estevam :
> Make the weim register set complete for MX51/MX53.
>
> While at it also add the weim chip select 1 address definition.
>

>From the code, you just add the cs for mx53 not for mx51, so,
Had better specify you add the cs1 address definition for mx53,
otherwise, it will make confusion.

> Signed-off-by: Fabio Estevam 
> ---
> Changes since v1:
> - Make the weim struct complete
>
>  arch/arm/include/asm/arch-mx5/imx-regs.h |   46 
> ++
>  1 files changed, 40 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-mx5/imx-regs.h 
> b/arch/arm/include/asm/arch-mx5/imx-regs.h
> index a1849f8..d80e0c0 100644
> --- a/arch/arm/include/asm/arch-mx5/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx5/imx-regs.h
> @@ -41,6 +41,7 @@
>  #define CSD1_BASE_ADDR          0xB000
>  #define NFC_BASE_ADDR_AXI       0xF7FF
>  #define IRAM_BASE_ADDR          0xF800
> +#define CS1_BASE_ADDR           0xF400
>  #else
>  #error "CPU_TYPE not defined"
>  #endif
> @@ -231,12 +232,45 @@ struct clkctl {
>


Jason Liu

> --
> 1.6.0.4
>
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2] MX31: Make get_reset_cause() static

2011-05-16 Thread Jason Liu
Hi, Stefano,

2011/5/16 Stefano Babic :
> Signed-off-by: Fabio Estevam 
> Signed-off-by: Stefano Babic 
> ---
>
> Changes since V1:
>        - as get_cpu_rev is exported, only get_reset_cause
>        is set to static.
>
>  arch/arm/cpu/arm1136/mx31/generic.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/cpu/arm1136/mx31/generic.c 
> b/arch/arm/cpu/arm1136/mx31/generic.c
> index fccd2cd..fb01013 100644
> --- a/arch/arm/cpu/arm1136/mx31/generic.c
> +++ b/arch/arm/cpu/arm1136/mx31/generic.c
> @@ -133,7 +133,7 @@ u32 get_cpu_rev(void)
>        return srev | 0x8000;
>  }
>
> -char *get_reset_cause(void)
> +static char *get_reset_cause(void)
>  {
>        /* read RCSR register from CCM module */
>        struct clock_control_regs *ccm =
> --

But looking at the code bellow, beside we need make the function static,
do we need to remove the break after the return statement? Otherwise,
some complier may warn un-reachable code, IMHO.

char *get_reset_cause(void)
{
/* read RCSR register from CCM module */
struct clock_control_regs *ccm =
(struct clock_control_regs *)CCM_BASE;

u32 cause = readl(&ccm->rcsr) & 0x07;

switch (cause) {
case 0x:
return "POR";
break;
case 0x0001:
return "RST";
break;
case 0x0002:
return "WDOG";
break;
case 0x0006:
        return "JTAG";
break;
default:
return "unknown reset";
}
}

Jason Liu


> 1.7.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V7 1/3] MX5: clock: Add clock config interface

2011-05-16 Thread Jason Liu
Hi, Stefano,

2011/5/16 Stefano Babic :
> On 05/11/2011 10:03 AM, Jason Liu wrote:
>
>> diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
>> index 0b04a88..04d9f71 100644
>> --- a/arch/arm/cpu/armv7/mx5/clock.c
>> +++ b/arch/arm/cpu/armv7/mx5/clock.c
>> @@ -24,6 +24,7 @@
>>   */
>
>>
>> +#define AHB_CLK_ROOT    1
>> +#define SZ_DEC_1M       100
>
> Is this define used only to get the value in Mhz from the PLL clock ? If
> it is the case, the name is quite confusing, as it refers to a size. If
> it is not the case, please explain.

I will get rid of the definition for AHB_CLK_ROOT and it's no need to
define here
since it only use once in the code.

I will rename the SZ_DEC_1M or get rid of it also.

>
>> +#define PLL_PD_MAX      16      /* Actual pd+1 */
>> +#define PLL_MFI_MAX     15
>> +#define PLL_MFI_MIN     5
>> +#define ARM_DIV_MAX     8
>> +#define IPG_DIV_MAX     4
>> +#define AHB_DIV_MAX     8
>> +#define EMI_DIV_MAX     8
>> +#define NFC_DIV_MAX     8
>
> Definitions for clock registers are in the crm_regs.h file. These are
> the maximum values for some fields in the registers. Should they not be
> put inside the crm_regs.h ?

Yes, make sense, I will put it to crm_regs.h file.

>
>> +
>> +struct fixed_pll_mfd {
>> +     u32 ref_clk_hz;
>> +     u32 mfd;
>> +};
>> +
>> +const struct fixed_pll_mfd fixed_mfd[] = {
>> +     {CONFIG_SYS_MX5_HCLK, 24 * 16},
>> +};
>
> Not understood the need of an array (I have not said it is wrong, simply
> I have not understood !). You use in the code (this is another issue)
> "ref" as parameter for your functions for the reference clock, but is
> seems to me that the only possible value is CONFIG_SYS_MX5_HCLK.
>

I use array here just for the case we will have another element in the array
(currently we only have one) in the future. Currently, we use 24MHz as ref.


> Are there other use case for this array, that makes sense to define and
> maybe to extend it ?

Just in case the PLL ref clock is not from 24MHZ.

>
> Can you add a reference to the manual explaining where these values are
> coming from ?

Do you mean the value 24 * 16? If yes, it's just for the simpler calculation.

>
>> +
>> +struct pll_param {
>> +     u32 pd;
>> +     u32 mfi;
>> +     u32 mfn;
>> +     u32 mfd;
>> +};
>> +
>> +#define PLL_FREQ_MAX(ref_clk)  (4 * (ref_clk) * PLL_MFI_MAX)
>> +#define PLL_FREQ_MIN(ref_clk) \
>> +             ((2 * (ref_clk) * (PLL_MFI_MIN - 1)) / PLL_PD_MAX)
>
> I understand what it is done here, but only after I have finally found
> where it is described in the manual. Can you add useful comments here
> and reference to the manual, too ? Such as describing these values are
> for the registers DP_OP, DP_MFN and DP-MFD, and a reference to the
> formula (Eqn. 22-1) helps to understand it.

OK,  I will add the comments here.

>
>> +#define MAX_DDR_CLK     42000
>> +#define NFC_CLK_MAX     3400
>
> Where do these values come from ? I understand they are computed values,
> depending on pll clock. It seems to me (at least for DDR clock) they are
> absolute maximum rates, but it could be that MAX_DDR_CLK could be set to
> a lower value depending on the PLL value. Is it correct ? In other words
> : should be possible to set a PLL (you provide an API for changing it)
> to a lower value, and then even the defines you set here do not
> correspond to the real maximum value ?

Yes, this is the absolute maximum rate. When you clk_api to config
clock, it should not
exceed the max value, for example,

if (emi_clk > MAX_DDR_CLK) {
printf("DDR clock should be less than"
"%d MHz, assuming max value \n",
...


>
>> +
>>  /*
>>   * The API of get mxc clockes.
>>   */
>> @@ -245,10 +369,12 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
>>       case MXC_UART_CLK:
>>               return get_uart_clk();
>>       case MXC_CSPI_CLK:
>> -             return imx_get_cspiclk();
>> +             return get_cspi_clk();
>>       case MXC_FEC_CLK:
>>               return decode_pll(mxc_plls[PLL1_CLOCK],
>>                                   CONFIG_SYS_MX5_HCLK);
>> +     case MXC_DDR_CLK:
>> +             return get_ddr_clk();
>
> You extended the enum for the clocks, as I see also MXC_NFC_CLK. You
> should add the MXC_NFC_CLK case, too.

OK,  I will add it.

>
> Is it worth to export the other getter functions, too (get_axi_a/b_clk,
> get_ahb_clk) ?

Yes, I think it's valuable to export it and print it, thu

[U-Boot] [PATCH] i.mx: i.mx6x: NO_MUX_I/NO_PAD_I not set correctly

2012-04-11 Thread Jason Liu
If one PAD does not have mux or pad config register, we need
set the NO_MUX_I/NO_PAD_I to 0, the old value is not correct

Signed-off-by: Jason Liu 
CC: Stefano Babic 
---
 arch/arm/include/asm/arch-mx6/mx6x_pins.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx6/mx6x_pins.h 
b/arch/arm/include/asm/arch-mx6/mx6x_pins.h
index afaa068..9979651 100644
--- a/arch/arm/include/asm/arch-mx6/mx6x_pins.h
+++ b/arch/arm/include/asm/arch-mx6/mx6x_pins.h
@@ -48,8 +48,8 @@
 #define PAD_CTL_SRE_FAST   (1 << 0)
 #define PAD_CTL_SRE_SLOW   (0 << 0)
 
-#define NO_MUX_I   0x3FF
-#define NO_PAD_I   0x7FF
+#define NO_MUX_I0
+#define NO_PAD_I0
 
 enum {
MX6Q_PAD_SD2_DAT1__USDHC2_DAT1  = IOMUX_PAD(0x0360, 0x004C, 0, 
0x, 0, 0),
-- 
1.7.5.4


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


Re: [U-Boot] [PATCH] i.MX6: Add ANATOP regulator init

2012-04-18 Thread Jason Liu
2012/4/13 Dirk Behme :
> Init the core regulator voltage to 1.2V. This is required for the correct
> functioning of the GPU and when the ARM LDO is set to 1.225V. This is a
> workaround to fix some memory clock jitter.
>
> Note: This should be but can't be done in the DCD. The bootloader
>      prevents access to the ANATOP registers.
>
> Signed-off-by: Dirk Behme 
> CC: Jason Chen 
> CC: Jason Liu 
> CC: Ranjani Vaidyanathan 
> CC: Stefano Babic 
> CC: Fabio Estevam 
> ---
>  arch/arm/cpu/armv7/mx6/soc.c |   16 
>  1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index 543b2cc..957ea34 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
> @@ -77,10 +77,26 @@ void init_aips(void)
>        writel(0x, &aips2->opacr4);
>  }
>
> +static void init_anatop_reg(void)
> +{
> +       struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
> +       int reg = readl(&anatop->reg_core);
> +
> +       /*
> +        * Increase the VDDSOC to 1.2V
> +        * Mask out the REG_CORE[22:18] bits (REG2_TRIG)
> +        * and set them to 1.2V (0.7V + 0x14 * 0.025V)
> +        */
> +       reg = (reg & ~(0x1F << 18)) | (0x14 << 18);
> +       writel(reg, &anatop->reg_core);
> +}
> +
>  int arch_cpu_init(void)
>  {
>        init_aips();
>
> +       init_anatop_reg();
> +
>        return 0;
>  }
>  #endif

Acked-by:Jason Liu 

> --
> 1.7.0.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx53evk: Add RTC support

2011-10-30 Thread Jason Liu
2011/10/25 Stefano Babic :
> On 10/25/2011 01:44 PM, Fabio Estevam wrote:
>> MX53EVK has an MC13892 PMIC. Add RTC support.
>>
>> Signed-off-by: Fabio Estevam 
>> ---
>>  include/configs/mx53evk.h |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
>> index c1941e3..6c4d34f 100644
>> --- a/include/configs/mx53evk.h
>> +++ b/include/configs/mx53evk.h
>> @@ -63,6 +63,7 @@
>>  #define CONFIG_PMIC_I2C
>>  #define CONFIG_PMIC_FSL
>>  #define CONFIG_SYS_FSL_PMIC_I2C_ADDR    8
>> +#define CONFIG_RTC_MC13XXX
>>
>>  /* MMC Configs */
>>  #define CONFIG_FSL_ESDHC
>> @@ -88,6 +89,7 @@
>>  #define CONFIG_CMD_DHCP
>>  #define CONFIG_CMD_MII
>>  #define CONFIG_CMD_NET
>> +#define CONFIG_CMD_DATE
>>
>>  /* allow to overwrite serial and ethaddr */
>>  #define CONFIG_ENV_OVERWRITE
>
> Jason is not sent in CC as board maintainer - I have added him now.

Thanks Stefano. :)

Acked-by: Jason Liu < jason@linaro.org>


BR,
Jason

>
> Stefano
>
> --
> =
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
> =
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/6] mx53evk: Remove unneeded '1' from mx53evk.h

2011-10-30 Thread Jason Liu
2011/10/27 Fabio Estevam :
> Remove unneeded '1' from mx53evk.h.
>
> Cc: Jason Liu 
> Signed-off-by: Fabio Estevam 
> ---
> Changes since v1:
> - Fix board name in Subject
>
>  include/configs/mx53evk.h |   16 
>  1 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
> index c1941e3..a5d403f 100644
> --- a/include/configs/mx53evk.h
> +++ b/include/configs/mx53evk.h
> @@ -33,12 +33,12 @@
>
>  #include 
>
> -#define CONFIG_CMDLINE_TAG             1       /* enable passing of ATAGs */
> -#define CONFIG_REVISION_TAG            1
> -#define CONFIG_SETUP_MEMORY_TAGS       1
> -#define CONFIG_INITRD_TAG              1
> +#define CONFIG_CMDLINE_TAG                     /* enable passing of ATAGs */
> +#define CONFIG_REVISION_TAG
> +#define CONFIG_SETUP_MEMORY_TAGS
> +#define CONFIG_INITRD_TAG
>
> -#define CONFIG_OF_LIBFDT               1
> +#define CONFIG_OF_LIBFDT
>
>  /* Size of malloc() pool */
>  #define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
> @@ -51,9 +51,9 @@
>  #define CONFIG_SYS_MX53_UART1
>
>  /* I2C Configs */
> -#define CONFIG_CMD_I2C          1
> -#define CONFIG_HARD_I2C         1
> -#define CONFIG_I2C_MXC          1
> +#define CONFIG_CMD_I2C
> +#define CONFIG_HARD_I2C
> +#define CONFIG_I2C_MXC
>  #define CONFIG_SYS_I2C_MX53_PORT2       1
>  #define CONFIG_SYS_I2C_SPEED            10
>  #define CONFIG_SYS_I2C_SLAVE            0xfe
> --
> 1.7.1


Acked-by: Jason Liu 

BR,
Jason

>
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/6] mx53loco: Remove unused get_board_rev function

2011-10-30 Thread Jason Liu
2011/10/27 Fabio Estevam :
> No board information is passed for MX53LOCO, so remove get_board_rev function.
>
> Cc: Jason Liu 
> Signed-off-by: Fabio Estevam 
> ---
>  board/freescale/mx53loco/mx53loco.c |    5 -
>  include/configs/mx53loco.h          |    1 -
>  2 files changed, 0 insertions(+), 6 deletions(-)
>
> diff --git a/board/freescale/mx53loco/mx53loco.c 
> b/board/freescale/mx53loco/mx53loco.c
> index 156f8b5..b4c7f33 100644
> --- a/board/freescale/mx53loco/mx53loco.c
> +++ b/board/freescale/mx53loco/mx53loco.c
> @@ -38,11 +38,6 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> -u32 get_board_rev(void)
> -{
> -       return get_cpu_rev();
> -}
> -
>  int dram_init(void)
>  {
>        u32 size1, size2;
> diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
> index f35bac1..d699010 100644
> --- a/include/configs/mx53loco.h
> +++ b/include/configs/mx53loco.h
> @@ -35,7 +35,6 @@
>  #include 
>
>  #define CONFIG_CMDLINE_TAG
> -#define CONFIG_REVISION_TAG
>  #define CONFIG_SETUP_MEMORY_TAGS
>  #define CONFIG_INITRD_TAG

Acked-by: Jason Liu 

BR,
Jason

>
> --
> 1.7.1
>
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/6] mx53evk: Remove unused get_board_rev function

2011-10-30 Thread Jason Liu
2011/10/27 Fabio Estevam :
> No board information is passed for MX53EVK, so remove get_board_rev function.
>
> Cc: Jason Liu 
> Signed-off-by: Fabio Estevam 
> ---
>  board/freescale/mx53evk/mx53evk.c |    5 -
>  include/configs/mx53evk.h         |    1 -
>  2 files changed, 0 insertions(+), 6 deletions(-)
>
> diff --git a/board/freescale/mx53evk/mx53evk.c 
> b/board/freescale/mx53evk/mx53evk.c
> index eab9c5f..335661f 100644
> --- a/board/freescale/mx53evk/mx53evk.c
> +++ b/board/freescale/mx53evk/mx53evk.c
> @@ -39,11 +39,6 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> -u32 get_board_rev(void)
> -{
> -       return get_cpu_rev();
> -}
> -
>  int dram_init(void)
>  {
>        /* dram_init must store complete ramsize in gd->ram_size */
> diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
> index a5d403f..f9fc149 100644
> --- a/include/configs/mx53evk.h
> +++ b/include/configs/mx53evk.h
> @@ -34,7 +34,6 @@
>  #include 
>
>  #define CONFIG_CMDLINE_TAG                     /* enable passing of ATAGs */
> -#define CONFIG_REVISION_TAG
>  #define CONFIG_SETUP_MEMORY_TAGS
>  #define CONFIG_INITRD_TAG
>

Acked-by: Jason Liu 

> --
> 1.7.1
>
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx31pdk: Enable D and I caches

2011-11-03 Thread Jason Liu
Fabio,

2011/11/3 Fabio Estevam :
> Hi Stefano,
>
> On Wed, Nov 2, 2011 at 6:41 AM, Stefano Babic  wrote:
>
>> Good. To be sure, do you have also tested NAND in u-boot ? I do not
>> expect problems, but...
>
> Yes, I confirmed that NAND works with the caches enabled by doing the
> following tests:
>
> 1. Save environment variables in NAND
> 2. Reprogram U-boot in NAND using "run prg_uboot" script.
>
> I would like to investigate the FEC issue when caches are enabled when
> I have a chance.
>
> Would you have any pointers as to where to start investigating why the
> FEC driver is buggy when caches are enabled?

you can search the tread: [U-Boot] i.MX51: FEC: Cache coherency problem?

Jason Liu

>
> Thanks,
>
> Fabio Estevam
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/6] i.mx: add the initial i.mx6q core/board support

2011-11-12 Thread Jason Liu
This patch-set add the initial support for freescale i.mx6q support.
freescale i.mx6q is a quad core built on arm cortex_a9 complex.

The patch-set has been tested ok on freescale i.mx6q Armadillo2 board and also
make sure it does not break i.mx5 support

Jason Liu (6):
  i.mx: i.mx5: Move some files to imx-common folder
  i.mx: Add the initial support for freescale i.MX6Q processor
  i.mx: mxc_gpio: add the i.mx6q support
  i.mx: serial_mxc: add the i.mx6q support
  i.mx: fsl_esdhc: add the i.mx6q support
  i.mx: i.mx6q: Add the initial support for i.mx6q ARM2 board

 MAINTAINERS|1 +
 Makefile   |7 +
 arch/arm/cpu/armv7/imx-common/Makefile |   47 +
 arch/arm/cpu/armv7/imx-common/cpu_info.c   |  108 ++
 arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c |0
 arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c |   17 +-
 arch/arm/cpu/armv7/mx5/Makefile|2 +-
 arch/arm/cpu/armv7/mx5/soc.c   |   77 -
 arch/arm/cpu/armv7/mx6/Makefile|   48 +
 arch/arm/cpu/armv7/mx6/clock.c |  388 +
 arch/arm/cpu/armv7/mx6/iomux-v3.c  |   76 +
 arch/arm/cpu/armv7/mx6/lowlevel_init.S |   60 +
 arch/arm/cpu/armv7/{mx5/speed.c => mx6/soc.c}  |   40 +-
 arch/arm/include/asm/arch-mx6/ccm_regs.h   |  894 +++
 .../mx5/speed.c => include/asm/arch-mx6/clock.h}   |   45 +-
 .../mx5/speed.c => include/asm/arch-mx6/gpio.h}|   28 +-
 arch/arm/include/asm/arch-mx6/imx-regs.h   |  233 +++
 arch/arm/include/asm/arch-mx6/iomux-v3.h   |  104 ++
 arch/arm/include/asm/arch-mx6/mx6x_pins.h  | 1683 
 .../speed.c => include/asm/arch-mx6/sys_proto.h}   |   31 +-
 board/freescale/mx6qarm2/Makefile  |   48 +
 board/freescale/mx6qarm2/imximage.cfg  |  167 ++
 board/freescale/mx6qarm2/mx6qarm2.c|  163 ++
 boards.cfg |1 +
 drivers/gpio/mxc_gpio.c|4 +-
 drivers/mmc/fsl_esdhc.c|   14 +-
 drivers/serial/serial_mxc.c|   10 +-
 include/configs/mx6qarm2.h |  163 ++
 28 files changed, 4303 insertions(+), 156 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/imx-common/Makefile
 create mode 100644 arch/arm/cpu/armv7/imx-common/cpu_info.c
 copy arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c (100%)
 rename arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c (84%)
 mode change 100644 => 100755
 create mode 100644 arch/arm/cpu/armv7/mx6/Makefile
 create mode 100644 arch/arm/cpu/armv7/mx6/clock.c
 create mode 100644 arch/arm/cpu/armv7/mx6/iomux-v3.c
 create mode 100644 arch/arm/cpu/armv7/mx6/lowlevel_init.S
 copy arch/arm/cpu/armv7/{mx5/speed.c => mx6/soc.c} (57%)
 create mode 100644 arch/arm/include/asm/arch-mx6/ccm_regs.h
 copy arch/arm/{cpu/armv7/mx5/speed.c => include/asm/arch-mx6/clock.h} (59%)
 copy arch/arm/{cpu/armv7/mx5/speed.c => include/asm/arch-mx6/gpio.h} (65%)
 create mode 100644 arch/arm/include/asm/arch-mx6/imx-regs.h
 create mode 100644 arch/arm/include/asm/arch-mx6/iomux-v3.h
 create mode 100644 arch/arm/include/asm/arch-mx6/mx6x_pins.h
 rename arch/arm/{cpu/armv7/mx5/speed.c => include/asm/arch-mx6/sys_proto.h} 
(65%)
 create mode 100644 board/freescale/mx6qarm2/Makefile
 create mode 100644 board/freescale/mx6qarm2/imximage.cfg
 create mode 100644 board/freescale/mx6qarm2/mx6qarm2.c
 create mode 100644 include/configs/mx6qarm2.h

-- 
1.7.4.1

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


[U-Boot] [PATCH 1/6] i.mx: i.mx5: Move some files to imx-common folder

2011-11-12 Thread Jason Liu
In order to support the coming MX6 platform and to reducde
the duplicated code, we had better move some common files
to the imx-common folder for sharing.

Signed-off-by: Jason Liu 
---
 Makefile   |7 ++
 arch/arm/cpu/armv7/imx-common/Makefile |   47 ++
 arch/arm/cpu/armv7/imx-common/cpu_info.c   |  108 
 arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c |0
 arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c |   17 ++--
 arch/arm/cpu/armv7/mx5/Makefile|2 +-
 arch/arm/cpu/armv7/mx5/soc.c   |   77 -
 7 files changed, 172 insertions(+), 86 deletions(-)

diff --git a/Makefile b/Makefile
index 294c762..9672a10 100644
--- a/Makefile
+++ b/Makefile
@@ -300,6 +300,13 @@ ifeq ($(SOC),omap4)
 LIBS += $(CPUDIR)/omap-common/libomap-common.o
 endif
 
+ifeq ($(SOC),mx5)
+LIBS += $(CPUDIR)/imx-common/libimx-common.o
+endif
+ifeq ($(SOC),mx6)
+LIBS += $(CPUDIR)/imx-common/libimx-common.o
+endif
+
 ifeq ($(SOC),s5pc1xx)
 LIBS += $(CPUDIR)/s5p-common/libs5p-common.o
 endif
diff --git a/arch/arm/cpu/armv7/imx-common/Makefile 
b/arch/arm/cpu/armv7/imx-common/Makefile
new file mode 100644
index 000..9fe8f02
--- /dev/null
+++ b/arch/arm/cpu/armv7/imx-common/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# 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)libimx-common.o
+
+COBJS  = timer.o cpu_info.o speed.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
+
+all:   $(obj).depend $(LIB)
+
+$(LIB):$(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/arch/arm/cpu/armv7/imx-common/cpu_info.c 
b/arch/arm/cpu/armv7/imx-common/cpu_info.c
new file mode 100644
index 000..1e30ae5
--- /dev/null
+++ b/arch/arm/cpu/armv7/imx-common/cpu_info.c
@@ -0,0 +1,108 @@
+/*
+ * (C) Copyright 2007
+ * Sascha Hauer, Pengutronix
+ *
+ * (C) Copyright 2009 Freescale Semiconductor, Inc.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_FSL_ESDHC
+#include 
+#endif
+
+static char *get_reset_cause(void)
+{
+   u32 cause;
+   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+
+   cause = readl(&src_regs->srsr);
+   writel(cause, &src_regs->srsr);
+
+   switch (cause) {
+   case 0x1:
+   return "POR";
+   case 0x4:
+   return "CSU";
+   case 0x8:
+   return "IPP USER";
+   case 0x00010:
+   return "WDOG";
+   case 0x00020:
+   return "JTAG HIGH-Z";
+   case 0x00040:
+   return "JTAG SW";
+   case 0x1:
+   return "WARM BOOT";
+   default:
+   return "unknown reset";
+   }
+}
+
+#if defined(CONFIG_DISPLAY_CPUINFO)
+int print_cpuinfo(void)
+{
+   u32 cpurev;
+
+   cpurev = get_cpu_rev();
+   pr

[U-Boot] [PATCH 3/6] i.mx: mxc_gpio: add the i.mx6q support

2011-11-12 Thread Jason Liu
Signed-off-by: Jason Liu 
---
 drivers/gpio/mxc_gpio.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index a7f36b2..908808d 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -40,10 +40,10 @@ static unsigned long gpio_ports[] = {
[0] = GPIO1_BASE_ADDR,
[1] = GPIO2_BASE_ADDR,
[2] = GPIO3_BASE_ADDR,
-#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
[3] = GPIO4_BASE_ADDR,
 #endif
-#if defined(CONFIG_MX53)
+#if defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
[4] = GPIO5_BASE_ADDR,
[5] = GPIO6_BASE_ADDR,
[6] = GPIO7_BASE_ADDR,
-- 
1.7.4.1

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


[U-Boot] [PATCH 4/6] i.mx: serial_mxc: add the i.mx6q support

2011-11-12 Thread Jason Liu
Signed-off-by: Jason Liu 
---
 drivers/serial/serial_mxc.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index dcb4bd1..7d0f288 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -47,14 +47,18 @@
 #elif defined(CONFIG_SYS_MX27_UART6)
 #define UART_PHYS 0x1001c000
 #elif defined(CONFIG_SYS_MX35_UART1) || defined(CONFIG_SYS_MX51_UART1) || \
-   defined(CONFIG_SYS_MX53_UART1)
+   defined(CONFIG_SYS_MX53_UART1) || defined(CONFIG_MX6Q_UART1)
 #define UART_PHYS UART1_BASE_ADDR
 #elif defined(CONFIG_SYS_MX35_UART2) || defined(CONFIG_SYS_MX51_UART2) || \
-   defined(CONFIG_SYS_MX53_UART2)
+   defined(CONFIG_SYS_MX53_UART2) || defined(CONFIG_MX6Q_UART2)
 #define UART_PHYS UART2_BASE_ADDR
 #elif defined(CONFIG_SYS_MX35_UART3) || defined(CONFIG_SYS_MX51_UART3) || \
-   defined(CONFIG_SYS_MX53_UART3)
+   defined(CONFIG_SYS_MX53_UART3) || defined(CONFIG_MX6Q_UART3)
 #define UART_PHYS UART3_BASE_ADDR
+#elif defined(CONFIG_MX6Q_UART4)
+#define UART_PHYS UART4_BASE_ADDR
+#elif defined(CONFIG_MX6Q_UART5)
+#define UART_PHYS UART5_BASE_ADDR
 #else
 #error "define CONFIG_SYS_MXxx_UARTx to use the MXC UART driver"
 #endif
-- 
1.7.4.1

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


[U-Boot] [PATCH 5/6] i.mx: fsl_esdhc: add the i.mx6q support

2011-11-12 Thread Jason Liu
The mmc host controller on the i.mx6q is called usdhc which
is redesigned based on the freescale esdhc controller.

The usdhc controller is almost compatible with esdhc except
it adds one misc control register from user using experience.

Signed-off-by: Jason Liu 
---
 drivers/mmc/fsl_esdhc.c |   14 +-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index ec953f0..cd17ef2 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -58,7 +58,12 @@ struct fsl_esdhc {
uintautoc12err;
uinthostcapblt;
uintwml;
-   charreserved1[8];
+#if defined(CONFIG_FSL_USDHC)
+   uintmixctrl;
+   charreserved1[4];
+#else
+   charreserved1[8];
+#endif
uintfevt;
charreserved2[168];
uinthostver;
@@ -298,6 +303,9 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct 
mmc_data *data)
 
/* Send the command */
esdhc_write32(®s->cmdarg, cmd->cmdarg);
+#if defined(CONFIG_FSL_USDHC)
+   esdhc_write32(®s->mixctrl, xfertyp & 0x);
+#endif
esdhc_write32(®s->xfertyp, xfertyp);
 
/* Wait for the command to complete */
@@ -482,7 +490,11 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg 
*cfg)
 
mmc = malloc(sizeof(struct mmc));
 
+#if defined(CONFIG_FSL_USDHC)
+   sprintf(mmc->name, "FSL_USDHC");
+#else
sprintf(mmc->name, "FSL_ESDHC");
+#endif
regs = (struct fsl_esdhc *)cfg->esdhc_base;
 
/* First reset the eSDHC controller */
-- 
1.7.4.1

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


[U-Boot] [PATCH 6/6] i.mx: i.mx6q: Add the initial support for i.mx6q ARM2 board

2011-11-12 Thread Jason Liu
Add the initial support for Freescale i.MX6Q Armadillo2 board
Support: MMC boot from slot 0/1, debug UART(UART4), usdhc.

Signed-off-by: Jason Liu 
---
 MAINTAINERS   |1 +
 board/freescale/mx6qarm2/Makefile |   48 ++
 board/freescale/mx6qarm2/imximage.cfg |  167 +
 board/freescale/mx6qarm2/mx6qarm2.c   |  163 
 boards.cfg|1 +
 include/configs/mx6qarm2.h|  163 
 6 files changed, 543 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 030fe4a..4eab903 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -572,6 +572,7 @@ Jason Liu 
 
mx53evk i.MX53
mx53locoi.MX53
+   mx6qarm2i.MX6Q
 
 Enric Balletbo i Serra 
 
diff --git a/board/freescale/mx6qarm2/Makefile 
b/board/freescale/mx6qarm2/Makefile
new file mode 100644
index 000..5ca7ec1
--- /dev/null
+++ b/board/freescale/mx6qarm2/Makefile
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2007, Guennadi Liakhovetski 
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx6qarm2.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak .depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx6qarm2/imximage.cfg 
b/board/freescale/mx6qarm2/imximage.cfg
new file mode 100644
index 000..8401264
--- /dev/null
+++ b/board/freescale/mx6qarm2/imximage.cfg
@@ -0,0 +1,167 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM  sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type   AddressValue
+#
+# where:
+#  Addr-type register length (1,2 or 4 bytes)
+#  Address   absolute address of the register
+#  value value to be stored in the register
+DATA 4 0x020e05a8 0x0030
+DATA 4 0x020e05b0 0x0030
+DATA 4 0x020e0524 0x0030
+DATA 4 0x020e051c 0x0030
+
+DATA 4 0x020e0518 0x0030
+DATA 4 0x020e050c 0x0030
+DATA 4 0x020e05b8 0x0030
+DATA 4 0x020e05c0 0x0030
+
+DATA 4 0x020e05ac 0x00020030
+DATA 4 0x020e05b4 0x00020030
+DATA 4 0x020e0528 0x00020030
+DATA 4 0x020e0520 0x00020030
+
+DATA 4 0x020e0514 0x00020030
+DATA 4 0x020e0510 0x00020030
+DATA 4 0x020e05bc 0x00020030
+DATA 4 0x020e05c4 0x00020030
+
+DATA 4 0x020e056c 0x00020030
+DATA 4 0x020e0578 0x00020030
+DATA 4 0x020e0588 0x00020030
+DATA 4 0x020e0594 0x00020030
+
+DATA 4 0x020e057c 0x00020030
+DATA 4 0x020e0590 0x3000
+DATA 4 0x020e0598 0x3000
+DATA 4 0x020e058c 0x
+
+DATA 4 0x020e059c 0x3030
+DATA 4 0x020e05a0 0x3030

Re: [U-Boot] [PATCH 1/5] mx53loco: Configure the pins as GPIOs prior to using gpio_get_value

2011-11-15 Thread Jason Liu
2011/11/15 Fabio Estevam :
> Configure the pins as GPIO prior to using gpio_get_value.
>
> Cc: Jason Liu 
> Signed-off-by: Fabio Estevam 

Acked-by: Jason Liu 

> ---
>  board/freescale/mx53loco/mx53loco.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/board/freescale/mx53loco/mx53loco.c 
> b/board/freescale/mx53loco/mx53loco.c
> index b4c7f33..5e5c38f 100644
> --- a/board/freescale/mx53loco/mx53loco.c
> +++ b/board/freescale/mx53loco/mx53loco.c
> @@ -139,6 +139,9 @@ struct fsl_esdhc_cfg esdhc_cfg[2] = {
>  int board_mmc_getcd(u8 *cd, struct mmc *mmc)
>  {
>        struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
> +
> +       mxc_request_iomux(MX53_PIN_EIM_DA11, IOMUX_CONFIG_ALT1);
> +       mxc_request_iomux(MX53_PIN_EIM_DA13, IOMUX_CONFIG_ALT1);
>
>        if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
>                *cd = gpio_get_value(77); /*GPIO3_13*/
> --
> 1.7.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/5] mx53evk: Configure the pins as GPIOs prior to using gpio_get_value

2011-11-15 Thread Jason Liu
2011/11/15 Fabio Estevam :
> Configure the pins as GPIO prior to using gpio_get_value.
>
> Cc: Jason Liu 
> Signed-off-by: Fabio Estevam 

Acked-by: Jason Liu 

> ---
>  board/freescale/mx53evk/mx53evk.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/board/freescale/mx53evk/mx53evk.c 
> b/board/freescale/mx53evk/mx53evk.c
> index 335661f..aa4a2c9 100644
> --- a/board/freescale/mx53evk/mx53evk.c
> +++ b/board/freescale/mx53evk/mx53evk.c
> @@ -212,6 +212,9 @@ int board_mmc_getcd(u8 *cd, struct mmc *mmc)
>  {
>        struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
>
> +       mxc_request_iomux(MX53_PIN_EIM_DA11, IOMUX_CONFIG_ALT1);
> +       mxc_request_iomux(MX53_PIN_EIM_DA13, IOMUX_CONFIG_ALT1);
> +
>        if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
>                *cd = gpio_get_value(77); /*GPIO3_13*/
>        else
> --
> 1.7.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/5] mx53loco: add end enable USB host support on port 1

2011-11-15 Thread Jason Liu
2011/11/11 Wolfgang Grandegger :
> Signed-off-by: Wolfgang Grandegger 
> CC: Jason Liu 
> ---
>  board/freescale/mx53loco/mx53loco.c |   10 ++
>  include/configs/mx53loco.h          |   13 +
>  2 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/board/freescale/mx53loco/mx53loco.c 
> b/board/freescale/mx53loco/mx53loco.c
> index b4c7f33..7bccfa9 100644
> --- a/board/freescale/mx53loco/mx53loco.c
> +++ b/board/freescale/mx53loco/mx53loco.c
> @@ -78,6 +78,16 @@ static void setup_iomux_uart(void)
>                                PAD_CTL_ODE_OPENDRAIN_ENABLE);
>  }
>
> +#ifdef CONFIG_USB_EHCI_MX5
> +void board_ehci_hcd_init(int port)
> +{
> +       /* request VBUS power enable pin, GPIO[8}, gpio7 */

   ^^
here: :%s/}/]

> +       mxc_request_iomux(MX53_PIN_ATA_DA_2, IOMUX_CONFIG_ALT1);
> +       gpio_direction_output(IMX_GPIO_NR(7, 8), 0);
> +       gpio_set_value(IMX_GPIO_NR(7, 8), 1);
> +}
> +#endif
> +
>  static void setup_iomux_fec(void)
>  {
>        /*FEC_MDIO*/
> diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
> index d699010..9ce43d7 100644
> --- a/include/configs/mx53loco.h
> +++ b/include/configs/mx53loco.h
> @@ -72,6 +72,19 @@
>  #define CONFIG_CMD_MII
>  #define CONFIG_CMD_NET
>
> +/* USB Configs */
> +#define CONFIG_CMD_USB
> +#define CONFIG_CMD_FAT
> +#define CONFIG_USB_EHCI
> +#define CONFIG_USB_EHCI_MX5
> +#define CONFIG_USB_STORAGE
> +#define CONFIG_USB_HOST_ETHER
> +#define CONFIG_USB_ETHER_ASIX
> +#define CONFIG_USB_ETHER_SMSC95XX
> +#define CONFIG_MXC_USB_PORT    1
> +#define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
> +#define CONFIG_MXC_USB_FLAGS   0
> +
>  /* allow to overwrite serial and ethaddr */
>  #define CONFIG_ENV_OVERWRITE
>  #define CONFIG_CONS_INDEX              1
> --
> 1.7.4.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V2 1/6] i.mx: introduce the armv7/imx-common folder

2011-11-17 Thread Jason Liu
In order to support the coming MX6 platform and to reducde
the duplicated code, we had better move some common files
or functions to the imx-common folder for sharing.

This patch does the following:
- move speed.c file from armv7/mx5/speed.c to armv7/imx-common/speed.c
- move armv7/mx5/timer.c to armv7/imx-common/timer.c, no any new feature
  added but just fix the checkpatch errors in the old file and remove
  the CONFIG_SYS_MX5_CLK32 reference in the file
- create one new file cpu.c file to store the common function with i.mx5/6

Signed-off-by: Jason Liu 
Cc:Stefano Babic 
---
V2:extend the commit message to reflect all the changes in the patch
   rename cpu_info.c to cpu.c file under imx-common as Stefano comments
---
 Makefile   |7 ++
 arch/arm/cpu/armv7/imx-common/Makefile |   47 ++
 arch/arm/cpu/armv7/imx-common/cpu.c|  108 
 arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c |0
 arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c |   17 ++--
 arch/arm/cpu/armv7/mx5/Makefile|2 +-
 arch/arm/cpu/armv7/mx5/soc.c   |   77 -
 7 files changed, 172 insertions(+), 86 deletions(-)

diff --git a/Makefile b/Makefile
index 294c762..9672a10 100644
--- a/Makefile
+++ b/Makefile
@@ -300,6 +300,13 @@ ifeq ($(SOC),omap4)
 LIBS += $(CPUDIR)/omap-common/libomap-common.o
 endif
 
+ifeq ($(SOC),mx5)
+LIBS += $(CPUDIR)/imx-common/libimx-common.o
+endif
+ifeq ($(SOC),mx6)
+LIBS += $(CPUDIR)/imx-common/libimx-common.o
+endif
+
 ifeq ($(SOC),s5pc1xx)
 LIBS += $(CPUDIR)/s5p-common/libs5p-common.o
 endif
diff --git a/arch/arm/cpu/armv7/imx-common/Makefile 
b/arch/arm/cpu/armv7/imx-common/Makefile
new file mode 100644
index 000..e5ff375
--- /dev/null
+++ b/arch/arm/cpu/armv7/imx-common/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# 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)libimx-common.o
+
+COBJS  = timer.o cpu.o speed.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
+
+all:   $(obj).depend $(LIB)
+
+$(LIB):$(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/arch/arm/cpu/armv7/imx-common/cpu.c 
b/arch/arm/cpu/armv7/imx-common/cpu.c
new file mode 100644
index 000..1e30ae5
--- /dev/null
+++ b/arch/arm/cpu/armv7/imx-common/cpu.c
@@ -0,0 +1,108 @@
+/*
+ * (C) Copyright 2007
+ * Sascha Hauer, Pengutronix
+ *
+ * (C) Copyright 2009 Freescale Semiconductor, Inc.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_FSL_ESDHC
+#include 
+#endif
+
+static char *get_reset_cause(void)
+{
+   u32 cause;
+   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+
+   cause = readl(&src_regs->srsr);
+   writel(cause, &src_regs->srsr);
+
+   switch (cause) {
+   case 0x1:
+   return "POR";
+   case 0x4:
+   return "CSU";
+   case 0x8:
+  

[U-Boot] [PATCH V2 3/6] i.mx: mxc_gpio: add the i.mx6q support

2011-11-17 Thread Jason Liu
Signed-off-by: Jason Liu 
Cc: Stefano Babic 
Acked-by: Stefano Babic 
---
V2: add Stefano's ack
---
 drivers/gpio/mxc_gpio.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index a7f36b2..908808d 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -40,10 +40,10 @@ static unsigned long gpio_ports[] = {
[0] = GPIO1_BASE_ADDR,
[1] = GPIO2_BASE_ADDR,
[2] = GPIO3_BASE_ADDR,
-#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
[3] = GPIO4_BASE_ADDR,
 #endif
-#if defined(CONFIG_MX53)
+#if defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
[4] = GPIO5_BASE_ADDR,
[5] = GPIO6_BASE_ADDR,
[6] = GPIO7_BASE_ADDR,
-- 
1.7.4.1


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


[U-Boot] [PATCH V2 0/6] i.mx: add the initial i.mx6q core/board support

2011-11-17 Thread Jason Liu
This patch-set add the initial support for freescale i.mx6q support.
freescale i.mx6q is a quad core built on arm cortex_a9 complex.

The patch-set has been tested ok on freescale i.mx6q Armadillo2 board and also
make sure it does not break i.mx5 support

The v1 patch-set has also been tested Ok by: Dirk Behme
Tested-by: Dirk Behme 

Jason Liu (6):
  i.mx: introduce the armv7/imx-common folder
  i.mx: add the initial support for freescale i.MX6Q processor
  i.mx: mxc_gpio: add the i.mx6q support
  i.mx: serial_mxc: add the i.mx6q support
  i.mx: fsl_esdhc: add the i.mx6q support
  i.mx: i.mx6q: add the initial support for i.mx6q ARM2 board
---
v2: see detailed change log in each commit

 MAINTAINERS|1 +
 Makefile   |7 +
 arch/arm/cpu/armv7/imx-common/Makefile |   47 +
 arch/arm/cpu/armv7/imx-common/cpu.c|  108 ++
 arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c |0
 arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c |   17 +-
 arch/arm/cpu/armv7/mx5/Makefile|2 +-
 arch/arm/cpu/armv7/mx5/soc.c   |   77 -
 arch/arm/cpu/armv7/mx6/Makefile|   48 +
 arch/arm/cpu/armv7/mx6/clock.c |  366 +
 arch/arm/cpu/armv7/mx6/iomux-v3.c  |   71 +
 .../cpu/armv7/{mx5/speed.c => mx6/lowlevel_init.S} |   27 +-
 arch/arm/cpu/armv7/mx6/soc.c   |   93 ++
 arch/arm/include/asm/arch-mx6/ccm_regs.h   |  894 +++
 .../mx5/speed.c => include/asm/arch-mx6/clock.h}   |   45 +-
 .../mx5/speed.c => include/asm/arch-mx6/gpio.h}|   30 +-
 arch/arm/include/asm/arch-mx6/imx-regs.h   |  234 +++
 arch/arm/include/asm/arch-mx6/iomux-v3.h   |  103 ++
 arch/arm/include/asm/arch-mx6/mx6x_pins.h  | 1683 
 .../speed.c => include/asm/arch-mx6/sys_proto.h}   |   31 +-
 board/freescale/mx6qarm2/Makefile  |   42 +
 board/freescale/mx6qarm2/imximage.cfg  |  167 ++
 board/freescale/mx6qarm2/mx6qarm2.c|  155 ++
 boards.cfg |1 +
 drivers/gpio/mxc_gpio.c|4 +-
 drivers/mmc/fsl_esdhc.c|   12 +-
 drivers/serial/serial_mxc.c|   10 +-
 include/configs/mx6qarm2.h |  162 ++
 28 files changed, 4268 insertions(+), 169 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/imx-common/Makefile
 create mode 100644 arch/arm/cpu/armv7/imx-common/cpu.c
 copy arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c (100%)
 rename arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c (84%)
 mode change 100644 => 100755
 create mode 100644 arch/arm/cpu/armv7/mx6/Makefile
 create mode 100644 arch/arm/cpu/armv7/mx6/clock.c
 create mode 100644 arch/arm/cpu/armv7/mx6/iomux-v3.c
 copy arch/arm/cpu/armv7/{mx5/speed.c => mx6/lowlevel_init.S} (58%)
 create mode 100644 arch/arm/cpu/armv7/mx6/soc.c
 create mode 100644 arch/arm/include/asm/arch-mx6/ccm_regs.h
 copy arch/arm/{cpu/armv7/mx5/speed.c => include/asm/arch-mx6/clock.h} (59%)
 copy arch/arm/{cpu/armv7/mx5/speed.c => include/asm/arch-mx6/gpio.h} (64%)
 create mode 100644 arch/arm/include/asm/arch-mx6/imx-regs.h
 create mode 100644 arch/arm/include/asm/arch-mx6/iomux-v3.h
 create mode 100644 arch/arm/include/asm/arch-mx6/mx6x_pins.h
 rename arch/arm/{cpu/armv7/mx5/speed.c => include/asm/arch-mx6/sys_proto.h} 
(65%)
 create mode 100644 board/freescale/mx6qarm2/Makefile
 create mode 100644 board/freescale/mx6qarm2/imximage.cfg
 create mode 100644 board/freescale/mx6qarm2/mx6qarm2.c
 create mode 100644 include/configs/mx6qarm2.h

-- 
1.7.4.1


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


[U-Boot] [PATCH V2 4/6] i.mx: serial_mxc: add the i.mx6q support

2011-11-17 Thread Jason Liu
Signed-off-by: Jason Liu 
Cc: Stefano Babic 
---
v2: Cc Stefano
---
 drivers/serial/serial_mxc.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index dcb4bd1..7d0f288 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -47,14 +47,18 @@
 #elif defined(CONFIG_SYS_MX27_UART6)
 #define UART_PHYS 0x1001c000
 #elif defined(CONFIG_SYS_MX35_UART1) || defined(CONFIG_SYS_MX51_UART1) || \
-   defined(CONFIG_SYS_MX53_UART1)
+   defined(CONFIG_SYS_MX53_UART1) || defined(CONFIG_MX6Q_UART1)
 #define UART_PHYS UART1_BASE_ADDR
 #elif defined(CONFIG_SYS_MX35_UART2) || defined(CONFIG_SYS_MX51_UART2) || \
-   defined(CONFIG_SYS_MX53_UART2)
+   defined(CONFIG_SYS_MX53_UART2) || defined(CONFIG_MX6Q_UART2)
 #define UART_PHYS UART2_BASE_ADDR
 #elif defined(CONFIG_SYS_MX35_UART3) || defined(CONFIG_SYS_MX51_UART3) || \
-   defined(CONFIG_SYS_MX53_UART3)
+   defined(CONFIG_SYS_MX53_UART3) || defined(CONFIG_MX6Q_UART3)
 #define UART_PHYS UART3_BASE_ADDR
+#elif defined(CONFIG_MX6Q_UART4)
+#define UART_PHYS UART4_BASE_ADDR
+#elif defined(CONFIG_MX6Q_UART5)
+#define UART_PHYS UART5_BASE_ADDR
 #else
 #error "define CONFIG_SYS_MXxx_UARTx to use the MXC UART driver"
 #endif
-- 
1.7.4.1


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


[U-Boot] [PATCH V2 6/6] i.mx: i.mx6q: add the initial support for i.mx6q ARM2 board

2011-11-17 Thread Jason Liu
Add the initial support for Freescale i.MX6Q Armadillo2 board
Support: MMC boot from slot 0/1, debug UART(UART4), usdhc.

There is two MMC slots on the boards:
mmc dev 0 -> connect USDHC3 -> the lower slot on the board,
mmc dev 1 -> connect USDHC4 -> the upper slot on the board,

Signed-off-by: Jason Liu 
Cc: Stefano Babic 
Tested-by: Dirk Behme 
---
v2:fix sd3 card detection GPIO
   remove unneeded parentheses such as (IRAM_SIZE)
   remove clean and distclean targets in Makefile
   remove CONFIG_MACH_TYPE setup since linux use DT
   some cleanup/improvement for the config file from Dirk
   remove imx_iomux_v3_init call since assign the base in iomux-v3.c
   improve the commit message to add the mmc slot description
---
 MAINTAINERS   |1 +
 board/freescale/mx6qarm2/Makefile |   42 
 board/freescale/mx6qarm2/imximage.cfg |  167 +
 board/freescale/mx6qarm2/mx6qarm2.c   |  155 ++
 boards.cfg|1 +
 include/configs/mx6qarm2.h|  162 
 6 files changed, 528 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 030fe4a..4eab903 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -572,6 +572,7 @@ Jason Liu 
 
mx53evk i.MX53
mx53locoi.MX53
+   mx6qarm2i.MX6Q
 
 Enric Balletbo i Serra 
 
diff --git a/board/freescale/mx6qarm2/Makefile 
b/board/freescale/mx6qarm2/Makefile
new file mode 100644
index 000..79bc315
--- /dev/null
+++ b/board/freescale/mx6qarm2/Makefile
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2007, Guennadi Liakhovetski 
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx6qarm2.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx6qarm2/imximage.cfg 
b/board/freescale/mx6qarm2/imximage.cfg
new file mode 100644
index 000..ffac1b4
--- /dev/null
+++ b/board/freescale/mx6qarm2/imximage.cfg
@@ -0,0 +1,167 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM  sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type   AddressValue
+#
+# where:
+#  Addr-type register length (1,2 or 4 bytes)
+#  Address   absolute address of the register
+#  value value to be stored in the register
+DATA 4 0x020e05a8 0x0030
+DATA 4 0x020e05b0 0x0030
+DATA 4 0x020e0524 0x0030
+DATA 4 0x020e051c 0x0030
+
+DATA 4 0x020e0518 0x0030
+DATA 4 0x020e050c 0x0030
+DATA 4 0x020e05b8 0x0030
+DATA 4 0x020e05c0 0x0030
+
+DATA 4 0x020e05ac 0x00020030
+DATA 4 0x020e05b4 0x00020030
+DATA 

[U-Boot] [PATCH V2 5/6] i.mx: fsl_esdhc: add the i.mx6q support

2011-11-17 Thread Jason Liu
The mmc host controller on the i.mx6q is called usdhc which
is redesigned based on the freescale esdhc controller.

The usdhc controller is almost compatible with esdhc except
it adds one mix register to support debug/SD3.0 and move
the low bit 0-6 of XFERTYP register to the mix control reg
low bit 0-6. Thus on i.mx6q, we have the following compared
with the previous soc: (can refer to RM of chapter 56.3.3)

i.mx6q:
mix control:
bit 31 - bit 7: Added for debug/SD3.0 support
bit 6  - bit 0: move in the XFERTYP register bit 6-0 on previous soc
XFERTYP register:
bit 31 - bit 7: the same as before,
bit 6  - bit 0: no-use

previous soc
mix control: no
XFERTYP register:
bit 31 - bit 0: xfertype information

Signed-off-by: Jason Liu 
CC:Stefano Babic 
Acked-by: Stefano Babic 
---
v2: extend the commit message by adding mix/xtertype register change
remove one #ifdef as Marek suggested
change the print of USDHC/ESDHC to SDHC
---
 drivers/mmc/fsl_esdhc.c |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index ec953f0..ddd1b4c 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -58,7 +58,8 @@ struct fsl_esdhc {
uintautoc12err;
uinthostcapblt;
uintwml;
-   charreserved1[8];
+   uintmixctrl;
+   charreserved1[4];
uintfevt;
charreserved2[168];
uinthostver;
@@ -298,8 +299,13 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, 
struct mmc_data *data)
 
/* Send the command */
esdhc_write32(®s->cmdarg, cmd->cmdarg);
+#if defined(CONFIG_FSL_USDHC)
+   esdhc_write32(®s->mixctrl,
+   (esdhc_read32(®s->mixctrl) & 0xFF80) | (xfertyp & 0x7F));
+   esdhc_write32(®s->xfertyp, xfertyp & 0x);
+#else
esdhc_write32(®s->xfertyp, xfertyp);
-
+#endif
/* Wait for the command to complete */
while (!(esdhc_read32(®s->irqstat) & IRQSTAT_CC))
;
@@ -482,7 +488,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg 
*cfg)
 
mmc = malloc(sizeof(struct mmc));
 
-   sprintf(mmc->name, "FSL_ESDHC");
+   sprintf(mmc->name, "FSL_SDHC");
regs = (struct fsl_esdhc *)cfg->esdhc_base;
 
/* First reset the eSDHC controller */
-- 
1.7.4.1


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


[U-Boot] [PATCH V3 3/5] i.mx: mxc_gpio: add the i.mx6q support

2011-11-25 Thread Jason Liu
Signed-off-by: Jason Liu 
Cc: Stefano Babic 
Acked-by: Stefano Babic 
---
V2: add Stefano's ack
---
 drivers/gpio/mxc_gpio.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index a7f36b2..908808d 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -40,10 +40,10 @@ static unsigned long gpio_ports[] = {
[0] = GPIO1_BASE_ADDR,
[1] = GPIO2_BASE_ADDR,
[2] = GPIO3_BASE_ADDR,
-#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
[3] = GPIO4_BASE_ADDR,
 #endif
-#if defined(CONFIG_MX53)
+#if defined(CONFIG_MX53) || defined(CONFIG_MX6Q)
[4] = GPIO5_BASE_ADDR,
[5] = GPIO6_BASE_ADDR,
[6] = GPIO7_BASE_ADDR,
-- 
1.7.4.1


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


[U-Boot] [PATCH V3 0/5] i.mx: add the initial i.mx6q core/board support

2011-11-25 Thread Jason Liu
This patch-set add the initial support for freescale i.mx6q support.
freescale i.mx6q is a quad core built on arm cortex_a9 complex.

The patch-set has been tested ok on freescale i.mx6q Armadillo2 board and also
make sure it does not break i.mx5 support

The v1 patch-set has also been tested Ok by: Dirk Behme
Tested-by: Dirk Behme 

The patch-set is based on Stefano's uart clean up patch:
http://patchwork.ozlabs.org/patch/127115/

Jason Liu (5):
  i.mx: introduce the armv7/imx-common folder
  i.mx: add the initial support for freescale i.MX6Q processor
  i.mx: mxc_gpio: add the i.mx6q support
  i.mx: fsl_esdhc: add the i.mx6q support
  i.mx: i.mx6q: add the initial support for i.mx6q ARM2 board

 MAINTAINERS|1 +
 Makefile   |8 +
 arch/arm/cpu/armv7/imx-common/Makefile |   47 +
 arch/arm/cpu/armv7/imx-common/cpu.c|  108 ++
 arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c |0
 arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c |   17 +-
 arch/arm/cpu/armv7/mx5/Makefile|2 +-
 arch/arm/cpu/armv7/mx5/soc.c   |   77 -
 arch/arm/cpu/armv7/mx6/Makefile|   48 +
 arch/arm/cpu/armv7/mx6/clock.c |  366 +
 arch/arm/cpu/armv7/mx6/iomux-v3.c  |   71 +
 .../cpu/armv7/{mx5/speed.c => mx6/lowlevel_init.S} |   27 +-
 arch/arm/cpu/armv7/mx6/soc.c   |   82 +
 arch/arm/include/asm/arch-mx6/ccm_regs.h   |  892 +++
 .../mx5/speed.c => include/asm/arch-mx6/clock.h}   |   45 +-
 .../mx5/speed.c => include/asm/arch-mx6/gpio.h}|   30 +-
 arch/arm/include/asm/arch-mx6/imx-regs.h   |  236 +++
 arch/arm/include/asm/arch-mx6/iomux-v3.h   |  103 ++
 arch/arm/include/asm/arch-mx6/mx6x_pins.h  | 1683 
 .../speed.c => include/asm/arch-mx6/sys_proto.h}   |   31 +-
 board/freescale/mx6qarm2/Makefile  |   42 +
 board/freescale/mx6qarm2/imximage.cfg  |  167 ++
 board/freescale/mx6qarm2/mx6qarm2.c|  155 ++
 boards.cfg |1 +
 drivers/gpio/mxc_gpio.c|4 +-
 drivers/mmc/fsl_esdhc.c|   12 +-
 include/configs/mx6qarm2.h |  162 ++
 27 files changed, 4251 insertions(+), 166 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/imx-common/Makefile
 create mode 100644 arch/arm/cpu/armv7/imx-common/cpu.c
 copy arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c (100%)
 rename arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c (84%)
 mode change 100644 => 100755
 create mode 100644 arch/arm/cpu/armv7/mx6/Makefile
 create mode 100644 arch/arm/cpu/armv7/mx6/clock.c
 create mode 100644 arch/arm/cpu/armv7/mx6/iomux-v3.c
 copy arch/arm/cpu/armv7/{mx5/speed.c => mx6/lowlevel_init.S} (58%)
 create mode 100644 arch/arm/cpu/armv7/mx6/soc.c
 create mode 100644 arch/arm/include/asm/arch-mx6/ccm_regs.h
 copy arch/arm/{cpu/armv7/mx5/speed.c => include/asm/arch-mx6/clock.h} (59%)
 copy arch/arm/{cpu/armv7/mx5/speed.c => include/asm/arch-mx6/gpio.h} (64%)
 create mode 100644 arch/arm/include/asm/arch-mx6/imx-regs.h
 create mode 100644 arch/arm/include/asm/arch-mx6/iomux-v3.h
 create mode 100644 arch/arm/include/asm/arch-mx6/mx6x_pins.h
 rename arch/arm/{cpu/armv7/mx5/speed.c => include/asm/arch-mx6/sys_proto.h} 
(65%)
 create mode 100644 board/freescale/mx6qarm2/Makefile
 create mode 100644 board/freescale/mx6qarm2/imximage.cfg
 create mode 100644 board/freescale/mx6qarm2/mx6qarm2.c
 create mode 100644 include/configs/mx6qarm2.h

-- 
1.7.4.1


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


[U-Boot] [PATCH V3 5/5] i.mx: i.mx6q: add the initial support for i.mx6q ARM2 board

2011-11-25 Thread Jason Liu
Add the initial support for Freescale i.MX6Q Armadillo2 board
Support: MMC boot from slot 0/1, debug UART(UART4), usdhc.

There is two MMC slots on the boards:
mmc dev 0 -> connect USDHC3 -> the lower slot on the board,
mmc dev 1 -> connect USDHC4 -> the upper slot on the board,

Signed-off-by: Jason Liu 
Cc: Stefano Babic 
Tested-by: Dirk Behme 
---
v3: based on the uart clean up patch:http://patchwork.ozlabs.org/patch/127115/
add CONFIG_MXC_UART_BASE,remove CONFIG_MX6Q_UART4 in board config file

v2:fix sd3 card detection GPIO
   remove unneeded parentheses such as (IRAM_SIZE)
   remove clean and distclean targets in Makefile
   remove CONFIG_MACH_TYPE setup since linux use DT
   some cleanup/improvement for the config file from Dirk
   remove imx_iomux_v3_init call since assign the base in iomux-v3.c
   improve the commit message to add the mmc slot description
---
 MAINTAINERS   |1 +
 board/freescale/mx6qarm2/Makefile |   42 
 board/freescale/mx6qarm2/imximage.cfg |  167 +
 board/freescale/mx6qarm2/mx6qarm2.c   |  155 ++
 boards.cfg|1 +
 include/configs/mx6qarm2.h|  162 
 6 files changed, 528 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f6f6b72..52d86bd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -568,6 +568,7 @@ Jason Liu 
 
mx53evk i.MX53
mx53locoi.MX53
+   mx6qarm2i.MX6Q
 
 Enric Balletbo i Serra 
 
diff --git a/board/freescale/mx6qarm2/Makefile 
b/board/freescale/mx6qarm2/Makefile
new file mode 100644
index 000..79bc315
--- /dev/null
+++ b/board/freescale/mx6qarm2/Makefile
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2007, Guennadi Liakhovetski 
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := mx6qarm2.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/mx6qarm2/imximage.cfg 
b/board/freescale/mx6qarm2/imximage.cfg
new file mode 100644
index 000..ffac1b4
--- /dev/null
+++ b/board/freescale/mx6qarm2/imximage.cfg
@@ -0,0 +1,167 @@
+# Copyright (C) 2011 Freescale Semiconductor, Inc.
+# Jason Liu 
+#
+# 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. 51 Franklin Street Fifth Floor Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# image version
+
+IMAGE_VERSION 2
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM  sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type   AddressValue
+#
+# where:
+#  Addr-type register length (1,2 or 4 bytes)
+#  Address   absolute address of the register
+#  value value to be stored in the register
+DATA 4 0x020e05a8 0x0030
+DATA 4 0x020e05b0 0x0030
+DATA 4 0x020e0524 0x0030
+DATA 4 0x020e051c 0x0030
+
+DATA 4 0x020e0518 0x0030
+DATA 

[U-Boot] [PATCH V3 1/5] i.mx: introduce the armv7/imx-common folder

2011-11-25 Thread Jason Liu
In order to support the coming MX6 platform and to reducde
the duplicated code, we had better move some common files
or functions to the imx-common folder for sharing.

This patch does the following:
- move speed.c file from armv7/mx5/speed.c to armv7/imx-common/speed.c
- move armv7/mx5/timer.c to armv7/imx-common/timer.c, no any new feature
  added but just fix the checkpatch errors in the old file and remove
  the CONFIG_SYS_MX5_CLK32 reference in the file
- create one new file cpu.c file to store the common function with i.mx5/6

Signed-off-by: Jason Liu 
Cc:Stefano Babic 
Acked-by: Stefano Babic 
---
V2:extend the commit message to reflect all the changes in the patch
   rename cpu_info.c to cpu.c file under imx-common as Stefano comments
---
 Makefile   |8 ++
 arch/arm/cpu/armv7/imx-common/Makefile |   47 ++
 arch/arm/cpu/armv7/imx-common/cpu.c|  108 
 arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c |0
 arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c |   17 ++--
 arch/arm/cpu/armv7/mx5/Makefile|2 +-
 arch/arm/cpu/armv7/mx5/soc.c   |   77 -
 7 files changed, 173 insertions(+), 86 deletions(-)

diff --git a/Makefile b/Makefile
index d84b350..977da65 100644
--- a/Makefile
+++ b/Makefile
@@ -293,6 +293,14 @@ LIBS += post/libpost.o
 ifneq ($(CONFIG_AM335X)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
 LIBS += $(CPUDIR)/omap-common/libomap-common.o
 endif
+
+ifeq ($(SOC),mx5)
+LIBS += $(CPUDIR)/imx-common/libimx-common.o
+endif
+ifeq ($(SOC),mx6)
+LIBS += $(CPUDIR)/imx-common/libimx-common.o
+endif
+
 ifeq ($(SOC),s5pc1xx)
 LIBS += $(CPUDIR)/s5p-common/libs5p-common.o
 endif
diff --git a/arch/arm/cpu/armv7/imx-common/Makefile 
b/arch/arm/cpu/armv7/imx-common/Makefile
new file mode 100644
index 000..e5ff375
--- /dev/null
+++ b/arch/arm/cpu/armv7/imx-common/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# 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)libimx-common.o
+
+COBJS  = timer.o cpu.o speed.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
+
+all:   $(obj).depend $(LIB)
+
+$(LIB):$(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/arch/arm/cpu/armv7/imx-common/cpu.c 
b/arch/arm/cpu/armv7/imx-common/cpu.c
new file mode 100644
index 000..1e30ae5
--- /dev/null
+++ b/arch/arm/cpu/armv7/imx-common/cpu.c
@@ -0,0 +1,108 @@
+/*
+ * (C) Copyright 2007
+ * Sascha Hauer, Pengutronix
+ *
+ * (C) Copyright 2009 Freescale Semiconductor, Inc.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_FSL_ESDHC
+#include 
+#endif
+
+static char *get_reset_cause(void)
+{
+   u32 cause;
+   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+
+   cause = readl(&src_regs->srsr);
+   writel(cause, &src_regs->srsr);
+
+   switch (cause) {
+   case 0x1:
+   return

  1   2   3   >