[U-Boot] [PATCH v3] tegra: add Colibri T20 board support

2012-10-07 Thread Lucas Stach
This adds board support for the Toradex Colibri T20 module.

Working functions:
- SD card boot
- USB boot
- Network
- NAND environment

Signed-off-by: Lucas Stach 
---
v2:
- rename .dts file to match board name
v3:
- make comments more meaningful
- split into module and carrier board specific part to ease porting
  to other carrier boards
---
 MAINTAINERS|  4 ++
 .../colibri_t20-common/colibri_t20-common.c| 44 
 .../colibri_t20-common/colibri_t20-common.h| 16 +
 board/toradex/colibri_t20_iris/Makefile| 40 +++
 board/toradex/colibri_t20_iris/colibri_t20_iris.c  | 46 
 board/toradex/dts/tegra20-colibri_t20_iris.dts | 38 ++
 boards.cfg |  1 +
 include/configs/colibri_t20_iris.h | 83 ++
 8 Dateien geändert, 272 Zeilen hinzugefügt(+)
 create mode 100644 board/toradex/colibri_t20-common/colibri_t20-common.c
 create mode 100644 board/toradex/colibri_t20-common/colibri_t20-common.h
 create mode 100644 board/toradex/colibri_t20_iris/Makefile
 create mode 100644 board/toradex/colibri_t20_iris/colibri_t20_iris.c
 create mode 100644 board/toradex/dts/tegra20-colibri_t20_iris.dts
 create mode 100644 include/configs/colibri_t20_iris.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 1f03d8d..aa5e1ba 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -904,6 +904,10 @@ Michal Simek 
 
zynqARM ARMV7 (Zynq SoC)
 
+Lucas Stach 
+
+   colibri_t20_irisTegra20 (ARM7 & A9 Dual Core)
+
 Nick Thompson 
 
da830evmARM926EJS (DA830/OMAP-L137)
diff --git a/board/toradex/colibri_t20-common/colibri_t20-common.c 
b/board/toradex/colibri_t20-common/colibri_t20-common.c
new file mode 100644
index 000..6d5e47d
--- /dev/null
+++ b/board/toradex/colibri_t20-common/colibri_t20-common.c
@@ -0,0 +1,44 @@
+/*
+ *  Copyright (C) 2012 Lucas Stach
+ *
+ * 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.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "colibri_t20-common.h"
+
+#ifdef CONFIG_USB_EHCI_TEGRA
+void colibri_t20_common_pin_mux_usb(void)
+{
+   /* module internal USB bus to connect ethernet chipset */
+   funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI);
+   /* ULPI reference clock output */
+   pinmux_set_func(PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4);
+   pinmux_tristate_disable(PINGRP_CDEV2);
+   /* PHY reset GPIO */
+   pinmux_tristate_disable(PINGRP_UAC);
+   /* VBus GPIO */
+   pinmux_tristate_disable(PINGRP_DTE);
+}
+#endif
+
+#ifdef CONFIG_TEGRA_NAND
+void pin_mux_nand(void)
+{
+   funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_NDFLASH_KBC_8_BIT);
+}
+#endif
diff --git a/board/toradex/colibri_t20-common/colibri_t20-common.h 
b/board/toradex/colibri_t20-common/colibri_t20-common.h
new file mode 100644
index 000..76dc860
--- /dev/null
+++ b/board/toradex/colibri_t20-common/colibri_t20-common.h
@@ -0,0 +1,16 @@
+/*
+ *  Copyright (C) 2012 Lucas Stach
+ *
+ * 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.
+ *
+ */
+
+void colibri_t20_common_pin_mux_usb(void);
diff --git a/board/toradex/colibri_t20_iris/Makefile 
b/board/toradex/colibri_t20_iris/Makefile
new file mode 100644
index 000..c138729
--- /dev/null
+++ b/board/toradex/colibri_t20_iris/Makefile
@@ -0,0 +1,40 @@
+#
+#  (C) Copyright 2012 Lucas Stach
+#
+#  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.
+#
+#
+
+include $(TOPDIR)/config.mk
+
+$(shell mkdir -p $(obj)../../nvidia/common)
+$(shell mkdir -p $(obj)../colibri_t20-common)
+
+LI

[U-Boot] [PATCH v2] tegra: nand: make ONFI detection work

2012-10-07 Thread Lucas Stach
Add the missing bits to the Tegra NAND driver to make ONFI detection work
properly.

Also add it to the Tegra default config, as it seems to be a reasonable thing
to have it available on all boards that use any kind of NAND.

Signed-off-by: Lucas Stach 
---
v2: use puts instead of printf
---
 drivers/mtd/nand/tegra_nand.c| 36 
 include/configs/tegra20-common.h |  1 +
 2 Dateien geändert, 37 Zeilen hinzugefügt(+)

diff --git a/drivers/mtd/nand/tegra_nand.c b/drivers/mtd/nand/tegra_nand.c
index 5408c51..4d94cc6 100644
--- a/drivers/mtd/nand/tegra_nand.c
+++ b/drivers/mtd/nand/tegra_nand.c
@@ -219,6 +219,34 @@ static uint8_t read_byte(struct mtd_info *mtd)
 }
 
 /**
+ * Read len bytes from the chip into a buffer
+ *
+ * @param mtd  MTD device structure
+ * @param buf  buffer to store data to
+ * @param len  number of bytes to read
+ *
+ * Read function for 8bit bus-width
+ */
+static void read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
+{
+   int i, s;
+   unsigned int reg;
+   struct nand_chip *chip = mtd->priv;
+   struct nand_drv *info = (struct nand_drv *)chip->priv;
+
+   for (i = 0; i < len; i += 4) {
+   s = (len - i) > 4 ? 4 : len - i;
+   writel(CMD_PIO | CMD_RX | CMD_A_VALID | CMD_CE0 |
+   ((s - 1) << CMD_TRANS_SIZE_SHIFT) | CMD_GO,
+   &info->reg->command);
+   if (!nand_waitfor_cmd_completion(info->reg))
+   puts("Command timeout during read_buf\n");
+   reg = readl(&info->reg->resp);
+   memcpy(buf + i, ®, s);
+   }
+}
+
+/**
  * Check NAND status to see if it is ready or not
  *
  * @param mtd  MTD device structure
@@ -317,6 +345,7 @@ static void nand_command(struct mtd_info *mtd, unsigned int 
command,
switch (command) {
case NAND_CMD_READID:
writel(NAND_CMD_READID, &info->reg->cmd_reg1);
+   writel(column & 0xFF, &info->reg->addr_reg1);
writel(CMD_GO | CMD_CLE | CMD_ALE | CMD_PIO
| CMD_RX |
((4 - 1) << CMD_TRANS_SIZE_SHIFT)
@@ -324,6 +353,12 @@ static void nand_command(struct mtd_info *mtd, unsigned 
int command,
&info->reg->command);
info->pio_byte_index = 0;
break;
+   case NAND_CMD_PARAM:
+   writel(NAND_CMD_PARAM, &info->reg->cmd_reg1);
+   writel(column & 0xFF, &info->reg->addr_reg1);
+   writel(CMD_GO | CMD_CLE | CMD_ALE | CMD_CE0,
+   &info->reg->command);
+   break;
case NAND_CMD_READ0:
writel(NAND_CMD_READ0, &info->reg->cmd_reg1);
writel(NAND_CMD_READSTART, &info->reg->cmd_reg2);
@@ -976,6 +1011,7 @@ int tegra_nand_init(struct nand_chip *nand, int devnum)
nand->options = LP_OPTIONS;
nand->cmdfunc = nand_command;
nand->read_byte = read_byte;
+   nand->read_buf = read_buf;
nand->ecc.read_page = nand_read_page_hwecc;
nand->ecc.write_page = nand_write_page_hwecc;
nand->ecc.read_page_raw = nand_read_page_raw;
diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h
index 744dc59..9e60020 100644
--- a/include/configs/tegra20-common.h
+++ b/include/configs/tegra20-common.h
@@ -204,5 +204,6 @@
 #define CONFIG_SPL_LDSCRIPT"$(CPUDIR)/tegra20/u-boot-spl.lds"
 
 #define CONFIG_SYS_NAND_SELF_INIT
+#define CONFIG_SYS_NAND_ONFI_DETECTION
 
 #endif /* __TEGRA20_COMMON_H */
-- 
1.7.11.4

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


Re: [U-Boot] sram overflowed

2012-10-07 Thread Wolfgang Denk
Dear Grant,

In message  
you wrote:
> When I try to boot the 3.6 kernel on my Beaglebone it hangs at
> "Starting kernel".  I read that I should try the latest version of
> u-boot:
> 
> git clone git://arago-project.org/git/projects/u-boot-am33x.git

This is definitely NOT what you want to use when somebody mentions
"latest version".  This term always refers to top of tree in mainline
U-Boot, see http://git.denx.de/?p=u-boot.git;a=summary  resp.
git://git.denx.de/u-boot.git

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
Genitiv ins Wasser, weil's Dativ ist!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V3 21/32] mx6q_4x_mt41j128.cfg: skip initiailizing non-existent memory

2012-10-07 Thread Eric Nelson

Hi Troy,

On 10/03/2012 06:47 PM, Troy Kisky wrote:

Sabrelite does not have memory associated with CS1

Signed-off-by: Troy Kisky
---
  board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg |5 -
  1 file changed, 5 deletions(-)

diff --git a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg 
b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
index 9c622c8..2d03ff7 100644
--- a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
+++ b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
@@ -155,20 +155,15 @@ WRITE_ENTRY1(MMDC_P0_MDCTL, 0x831A)

  /* MDSCR, con_req, LOAD MR2, CS0, A3,A10 set (CAS Write=6), RZQ/2 */
  WRITE_ENTRY1(MMDC_P0_MDSCR, 0x04088032)
-WRITE_ENTRY1(MMDC_P0_MDSCR, 0x0408803A)
  /* LOAD MR3, CS0 */
  WRITE_ENTRY1(MMDC_P0_MDSCR, 0x8033)
-WRITE_ENTRY1(MMDC_P0_MDSCR, 0x803B)
  /* LOAD MR1, CS0, A1,A6 set Rtt=RZQ/2, ODI=RZQ/7 */
  WRITE_ENTRY1(MMDC_P0_MDSCR, 0x00428031)
-WRITE_ENTRY1(MMDC_P0_MDSCR, 0x00428039)
  /* LOAD MR0, CS0, A6,A8,A11 set CAS=8, WR=8, DLL reset */
  WRITE_ENTRY1(MMDC_P0_MDSCR, 0x09408030)
-WRITE_ENTRY1(MMDC_P0_MDSCR, 0x09408038)

  /* ZQ calibrate, CS0 */
  WRITE_ENTRY1(MMDC_P0_MDSCR, 0x04008040)
-WRITE_ENTRY1(MMDC_P0_MDSCR, 0x04008048)
  WRITE_ENTRY1(MMDC_P0_MPZQHWCTRL, 0xA1380003)
  WRITE_ENTRY1(MMDC_P1_MPZQHWCTRL, 0xA1380003)



Note that mx6qsabreauto and mx6qsabresd also use this config file.
That said, none of these boards have pad DRAM_CS1 connected.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2] arm: armv7: omap3: Fix restore sequence in lowlevel_init

2012-10-07 Thread Jeroen Hofstee

On 10/07/2012 09:24 PM, Albert ARIBAUD wrote:

The restore sequence in lowlevel_init was in the wrong order,
causing lr to lose its original value and be set equal to ip
instead. Also, its use of the stack clashes with that of
s_init, so move the s_init call after the restore and turn
it  into a tail-optimized branch.

Signed-off-by: Albert ARIBAUD 
---
V2: move s_init call after restore and tail-optimize it into a branch
V1: fix order of restores

  arch/arm/cpu/armv7/omap3/lowlevel_init.S |9 -
  1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S 
b/arch/arm/cpu/armv7/omap3/lowlevel_init.S
index ebf69fa..eacfef8 100644
--- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S
@@ -214,7 +214,7 @@ pll_div_val5:
  
  ENTRY(lowlevel_init)

ldr sp, SRAM_STACK
-   str ip, [sp]/* stash old link register */
+   str ip, [sp]/* stash ip register */
mov ip, lr  /* save link reg across call */
  #if !defined(CONFIG_SYS_NAND_BOOT) && !defined(CONFIG_SYS_ONENAND_BOOT)
  /*
@@ -224,12 +224,11 @@ ENTRY(lowlevel_init)
ldr r1, =SRAM_CLK_CODE
bl  cpy_clk_code
  #endif /* NAND Boot */
-   bl  s_init  /* go setup pll, mux, memory */
-   ldr ip, [sp]/* restore save ip */
mov lr, ip  /* restore link reg */
+   ldr ip, [sp]/* restore save ip */
+   /* tail-call s_init to setup pll, mux, memory */
+   b   s_init
  
-	/* back to arch calling code */

-   mov pc, lr
  ENDPROC(lowlevel_init)
  
  	/* the literal pools origin */

Tested-by: Jeroen Hofstee 

on a tam3517 SOM (am3517 mcu) derived board.

Regards,
Jeroen

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


[U-Boot] sram overflowed

2012-10-07 Thread Grant
When I try to boot the 3.6 kernel on my Beaglebone it hangs at
"Starting kernel".  I read that I should try the latest version of
u-boot:

git clone git://arago-project.org/git/projects/u-boot-am33x.git

But I get this when I try to make:

ld: u-boot-spl section `.data' will not fit in region `.sram'
ld: region `.sram' overflowed by 163 bytes
make[1]: *** [/root/u-boot-am33x/spl/u-boot-spl] Error 1
make[1]: Leaving directory `/root/u-boot-am33x/spl'
make: *** [spl/u-boot-spl.bin] Error 2

I read here that I should try removing config options like
CONFIG_SPL_YMODEM_SUPPORT:

https://github.com/kientzle/freebsd-beaglebone/issues/1#issuecomment-5953658

Can anyone tell me how to do that?

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


[U-Boot] [PATCH V2] arm: armv7: omap3: Fix restore sequence in lowlevel_init

2012-10-07 Thread Albert ARIBAUD
The restore sequence in lowlevel_init was in the wrong order,
causing lr to lose its original value and be set equal to ip
instead. Also, its use of the stack clashes with that of
s_init, so move the s_init call after the restore and turn
it  into a tail-optimized branch.

Signed-off-by: Albert ARIBAUD 
---
V2: move s_init call after restore and tail-optimize it into a branch
V1: fix order of restores

 arch/arm/cpu/armv7/omap3/lowlevel_init.S |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S 
b/arch/arm/cpu/armv7/omap3/lowlevel_init.S
index ebf69fa..eacfef8 100644
--- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S
@@ -214,7 +214,7 @@ pll_div_val5:
 
 ENTRY(lowlevel_init)
ldr sp, SRAM_STACK
-   str ip, [sp]/* stash old link register */
+   str ip, [sp]/* stash ip register */
mov ip, lr  /* save link reg across call */
 #if !defined(CONFIG_SYS_NAND_BOOT) && !defined(CONFIG_SYS_ONENAND_BOOT)
 /*
@@ -224,12 +224,11 @@ ENTRY(lowlevel_init)
ldr r1, =SRAM_CLK_CODE
bl  cpy_clk_code
 #endif /* NAND Boot */
-   bl  s_init  /* go setup pll, mux, memory */
-   ldr ip, [sp]/* restore save ip */
mov lr, ip  /* restore link reg */
+   ldr ip, [sp]/* restore save ip */
+   /* tail-call s_init to setup pll, mux, memory */
+   b   s_init
 
-   /* back to arch calling code */
-   mov pc, lr
 ENDPROC(lowlevel_init)
 
/* the literal pools origin */
-- 
1.7.9.5

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


[U-Boot] [PULL] u-boot-usb/next

2012-10-07 Thread Marek Vasut
NOTE: I get a few more size issues with ELDK 4.2 on IXP (that big-endian ARM) 
after this patchset is applied. I wonder if we shouldn't just throw these away, 
since they're dead code mostly.

The following changes since commit c7ee66a8222660b565e9240775efa4c82cb348c2:

  Merge branch 'next' of git://www.denx.de/git/u-boot-ppc4xx into next 
(2012-10-02 10:16:40 -0700)

are available in the git repository at:


  git://git.denx.de/u-boot-usb.git next

for you to fetch changes up to f0ede0e8305bc3c959862446bce40cb028b36293:

  usb.h: Add udc_disconnect prototype to usb.h (2012-10-07 02:08:48 +0200)


Lucas Stach (7):
  usb: lowlevel interface change to support multiple controllers
  usb: ehci: rework to take advantage of new lowlevel interface
  usb: add support for multiple usb controllers
  tegra20: port to new ehci interface
  usb: ehci: don't print debug output
  usb: ulpi: add indicator configuration function
  tegra20: add USB ULPI init code

Lukasz Dalek (5):
  usbether: Fixed bug when using with PXA25X chips
  usbether: Define CONFIG_USB_ETH_{CDC,SUBSET}
  usbether: Removed DEV_CONFIG_{CDC,SUBSET}
  pxa25x: Add support for USB ethernet gadget
  usb.h: Add udc_disconnect prototype to usb.h

 README|3 +
 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c   |4 +-
 arch/arm/cpu/armv7/tegra20/usb.c  |  168 --
 arch/arm/include/asm/arch-tegra20/usb.h   |   33 +-
 arch/arm/include/asm/ehci-omap.h  |   10 +-
 arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c |4 +-
 arch/powerpc/cpu/mpc5xxx/usb_ohci.c   |4 +-
 arch/powerpc/cpu/ppc4xx/usb_ohci.c|4 +-
 arch/sparc/cpu/leon3/usb_uhci.c   |4 +-
 arch/sparc/lib/bootm.c|2 +-
 board/htkw/mcx/mcx.c  |6 +-
 board/mpl/common/usb_uhci.c   |4 +-
 board/technexion/twister/twister.c|6 +-
 board/teejet/mt_ventoux/mt_ventoux.c  |6 +-
 board/ti/beagle/beagle.c  |6 +-
 board/ti/panda/panda.c|6 +-
 common/cmd_usb.c  |   16 +-
 common/usb.c  |  108 ++--
 common/usb_hub.c  |2 +-
 common/usb_storage.c  |2 +-
 drivers/usb/eth/usb_ether.c   |2 +-
 drivers/usb/gadget/Makefile   |1 +
 drivers/usb/gadget/ether.c|   69 +--
 drivers/usb/gadget/pxa25x_udc.c   | 2059 
++
 drivers/usb/gadget/pxa25x_udc.h   |  162 ++
 drivers/usb/host/ehci-armada100.c |   15 +-
 drivers/usb/host/ehci-atmel.c |   11 +-
 drivers/usb/host/ehci-core.h  |   29 --
 drivers/usb/host/ehci-exynos.c|   15 +-
 drivers/usb/host/ehci-fsl.c   |   15 +-
 drivers/usb/host/ehci-hcd.c   |  126 ++---
 drivers/usb/host/ehci-ixp4xx.c|   15 +-
 drivers/usb/host/ehci-marvell.c   |   15 +-
 drivers/usb/host/ehci-mpc512x.c   |   25 +-
 drivers/usb/host/ehci-mx5.c   |   11 +-
 drivers/usb/host/ehci-mx6.c   |   11 +-
 drivers/usb/host/ehci-mxc.c   |   11 +-
 drivers/usb/host/ehci-mxs.c   |   20 +-
 drivers/usb/host/ehci-omap.c  |   10 +-
 drivers/usb/host/ehci-pci.c   |   15 +-
 drivers/usb/host/ehci-ppc4xx.c|   11 +-
 drivers/usb/host/ehci-tegra.c |   14 +-
 drivers/usb/host/ehci-vct.c   |9 +-
 drivers/usb/host/ehci.h   |4 +-
 drivers/usb/host/isp116x-hcd.c|4 +-
 drivers/usb/host/ohci-hcd.c   |4 +-
 drivers/usb/host/r8a66597-hcd.c   |4 +-
 drivers/usb/host/sl811-hcd.c  |4 +-
 drivers/usb/musb/musb_hcd.c   |4 +-
 drivers/usb/ulpi/ulpi.c   |   32 +-
 include/usb.h |   21 +-
 include/usb/mv_udc.h  |2 +-
 include/usb/ulpi.h|   13 +-
 53 files changed, 2779 insertions(+), 382 deletions(-)
 create mode 100644 drivers/usb/gadget/pxa25x_udc.c
 create mode 100644 drivers/usb/gadget/pxa25x_udc.h
 delete mode 100644 drivers/usb/host/ehci-core.h
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] arm: armv7: omap3: Fix restore sequence in lowlevel_init

2012-10-07 Thread Albert ARIBAUD
The restore sequence in lowlevel_init was in the wrong order,
causing lr to lose its original value and be set equal to ip
instead.

Signed-off-by: Albert ARIBAUD 
---
 arch/arm/cpu/armv7/omap3/lowlevel_init.S |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S 
b/arch/arm/cpu/armv7/omap3/lowlevel_init.S
index ebf69fa..7dde7c3 100644
--- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S
@@ -225,8 +225,8 @@ ENTRY(lowlevel_init)
bl  cpy_clk_code
 #endif /* NAND Boot */
bl  s_init  /* go setup pll, mux, memory */
-   ldr ip, [sp]/* restore save ip */
mov lr, ip  /* restore link reg */
+   ldr ip, [sp]/* restore save ip */
 
/* back to arch calling code */
mov pc, lr
-- 
1.7.9.5

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


Re: [U-Boot] [PATCH 00/10] IDE code cleanup

2012-10-07 Thread Marek Vasut
Dear Pavel Herrmann,

> This series tries to remove all SoC-specific and board-specific code from
> cmd_ide. Whenever an existing hook is present, it is used instead, when no
> appropriate hook is present, one is created (either as a hook call or by
> using the weak alias technique). The aim of this series is to prepare for
> DM conversion, where most of the cmd_ide code will create a new universal
> IDE driver, and all hooks and overrides will be provided in its platform
> data.
> 
> note: this series has not been tested on the actual hardware
[...]

All in all, it looks mostly good

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ELDK4.2 build failures for highbank, omap4_panda and omap4_sdp4430 (was: [PATCH] yaffs2: Fix GCC 4.6 compile warnings)

2012-10-07 Thread Tom Rini
On Sat, Oct 06, 2012 at 01:02:49PM +0200, Albert ARIBAUD wrote:

> Hi All,
> 
> With Anatolij's fix in, ELDK4.2 still fails to build three boards:
> highbank, omap4_panda and omap4_sdp4430 (maintainers CCed).
> 
> Build logs are weird for the two omap boards:
> 
> Configuring for omap4_panda board...
> arm-linux-gnueabi-size: './u-boot': No such file
> make: *** [checkthumb] Erreur 1
> make: INTERNAL: Exiting with 10 jobserver tokens available; should be 9!
> Configuring for omap4_sdp4430 board...
> arm-linux-gnueabi-size: './u-boot': No such file
> make: *** [checkthumb] Erreur 1
> make: INTERNAL: Exiting with 10 jobserver tokens available; should be 9!

The problem is that omap4/5 use CONFIG_SYS_THUMB_BUILD and ELDK-4.2
doesn't produce working binaries in this case so we have the
checkthumb rule in the top-level Makefile.  Some of the tegra boards
will also be hitting this soon I believe, as they are also building in
thumb mode.

-- 
Tom


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


Re: [U-Boot] [PATCH 07/10] move CPC45 ide_led to the same file as other IDE hooks

2012-10-07 Thread Marek Vasut
Dear Pavel Herrmann,

> Keep all IDE-related hooks and overrides in a single file, to avoid
> confusion.
> 
> Signed-off-by: Pavel Herrmann 
> ---
[...]

> +
> +void ide_led(uchar led, uchar status)
> +{
> + u_char  val;
> + /* We have one PCMCIA slot and use LED H4 for the IDE Interface */
> + val = readb(BCSR_BASE + 0x04);
> + if (status) {   /* led on */
> + val |= B_CTRL_LED0;
> + } else {
> + val &= ~B_CTRL_LED0;
> + }

Remove these {} for conditions with single line expression

> + writeb(val, BCSR_BASE + 0x04);
> +}
> +

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 05/10] split CPC45 board-specific IDE functions from cmd_ide.c

2012-10-07 Thread Marek Vasut
Dear Pavel Herrmann,

> Move input_data() and friends to board/cpc45/ide.c, as overrides for weak
> aliases in cmd_ide.c
> 
> note: checkpatch emits warnings about using volatile
> 
> Signed-off-by: Pavel Herrmann 
> ---
>  board/cpc45/Makefile |   2 +-
>  board/cpc45/ide.c| 130
> +++ common/cmd_ide.c |
>  91 
>  3 files changed, 131 insertions(+), 92 deletions(-)
>  create mode 100644 board/cpc45/ide.c
> 
> diff --git a/board/cpc45/Makefile b/board/cpc45/Makefile
> index 5c6b78f..ac1d174 100644
> --- a/board/cpc45/Makefile
> +++ b/board/cpc45/Makefile
> @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
> 
>  LIB  = $(obj)lib$(BOARD).o
> 
> -COBJS= $(BOARD).o flash.o plx9030.o pd67290.o
> +COBJS= $(BOARD).o flash.o plx9030.o pd67290.o ide.o
> 
>  SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
>  OBJS := $(addprefix $(obj),$(COBJS))
> diff --git a/board/cpc45/ide.c b/board/cpc45/ide.c
> new file mode 100644
> index 000..7b7237b
> --- /dev/null
> +++ b/board/cpc45/ide.c
> @@ -0,0 +1,130 @@
> +/*
> + * (C) Copyright 2001
> + * Rob Taylor, Flying Pig Systems. r...@flyingpig.com.
> + *
> + * (C) Copyright 2000-2011
> + * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#define EIEIO__asm__ volatile ("eieio")
> +#define SYNC __asm__ volatile ("sync")

Make it asm, not __asm__

> +
> +void ide_input_swap_data(int dev, ulong *sect_buf, int words)
> +{
> + uchar i;
> + volatile uchar *pbuf_even =
> + (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
> + volatile uchar *pbuf_odd =
> + (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
> + ushort *dbuf = (ushort *) sect_buf;

What's this, some kind of __swab16() ?

> + while (words--) {
> + for (i = 0; i < 2; i++) {
> + *(((uchar *) (dbuf)) + 1) = *pbuf_even;
> + *(uchar *) dbuf = *pbuf_odd;
> + dbuf += 1;
> + }
> + }
> +}
[...]

I'm not reviewing this any further ... this is some ancient code, right?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V3 17/32] imximage.cfg: run files through C preprocessor

2012-10-07 Thread Eric Nelson

Hi Troy,

On 10/03/2012 06:47 PM, Troy Kisky wrote:

The '#' used as comments in the files cause the preprocessor
trouble, so change to /* */.

Signed-off-by: Troy Kisky
---
  Makefile |3 +-
  board/esg/ima3-mx53/imximage.cfg |  120 ++-
  board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg |   90 
  board/freescale/mx25pdk/imximage.cfg |   77 +++
  board/freescale/mx51evk/imximage.cfg |  114 +-
  board/freescale/mx53ard/imximage_dd3.cfg |   83 
  board/freescale/mx53evk/imximage.cfg |   86 
  board/freescale/mx53loco/imximage.cfg|   83 
  board/freescale/mx53smd/imximage.cfg |   83 
  board/freescale/mx6qarm2/imximage.cfg|   88 
  board/genesi/mx51_efikamx/imximage_mx.cfg|  132 ++--
  board/genesi/mx51_efikamx/imximage_sb.cfg|  126 +--
  board/ttcontrol/vision2/imximage_hynix.cfg   |  295 ++
  13 files changed, 727 insertions(+), 653 deletions(-)

diff --git a/Makefile b/Makefile
index a40d4cc..64ff1b8 100644
--- a/Makefile
+++ b/Makefile
@@ -431,7 +431,8 @@ $(obj)u-boot.img:   $(obj)u-boot.bin
-d $<  $@

  $(obj)u-boot.imx:   $(obj)u-boot.bin
-   $(obj)tools/mkimage -n  $(CONFIG_IMX_CONFIG) -T imximage \
+   $(CC) -E -x c $(CONFIG_IMX_CONFIG) -I./include -o 
$(obj)imxcfg.imx
+   $(obj)tools/mkimage -n  $(obj)imxcfg.imx -T imximage \
-e $(CONFIG_SYS_TEXT_BASE) -d $<  $@


This bit creates imxcfg.imx.

If built in-tree, the file will be reported as a new file in 'git status'.
Is there a reason it can't be deleted after the build?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 04/10] change all versions of input_data() and output_data() to global weak aliases

2012-10-07 Thread Marek Vasut
Dear Pavel Herrmann,

> This changes input_data() and friends from static function to global
> symbols under weak alias, to enable board specific overrides (and
> therefore get rid of board-specific code in cmd_ide.c)
> Also declare ide_bus_offset in the header file, so other files can use
> ATA_CURR_BASE as well.
> 
> Signed-off-by: Pavel Herrmann 
> ---
[...]


> +void ide_input_swap_data(int dev, ulong *sect_buf, int words)
> + __attribute__ ((weak, alias("__ide_input_swap_data")));

#include 

__weak void ide_input_swap_data(int dev, ulong *sect_buf, int words)
{
   ... body ...
}

Works just fine ;-)

[...]

> +/*
> + * I/O function overrides
> + */
> +void ide_input_swap_data(int dev, ulong *sect_buf, int words);
> +void ide_input_data(int dev, ulong *sect_buf, int words);
> +void ide_output_data(int dev, const ulong *sect_buf, int words);
> +void ide_input_data_shorts(int dev, ushort *sect_buf, int words);
> +void ide_output_data_shorts(int dev, ushort *sect_buf, int words);

Shorts ... you mean like pants ? :-p

I'd say it's supposed to be "short", like u16 ;-)

> +
>  #endif /* _IDE_H */
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/10] split mpc8xx hooks from cmd_ide.c

2012-10-07 Thread Marek Vasut
Dear Pavel Herrmann,

> move most of mpc8xx hooks from cmd_ide.c into ide_preinit() and newly
> created ide_init_postreset() (invoked after calling ide_reset after
> ide_preinit), some cleanup to make checkpatch happy, enable IDE init hooks
> in configs of affected boards.
> Confusingly, these hooks are used by more than just mpc8xx-based boards,
> and therefore are placed in arch/ppc/lib/
> 
> note: checkpatch still emits warnings about using volatile
> 
> Signed-off-by: Pavel Herrmann 
> ---

[...]

> --- a/include/ide.h
> +++ b/include/ide.h
> @@ -54,6 +54,14 @@ void ide_init(void);
>  ulong ide_read(int device, lbaint_t blknr, ulong blkcnt, void *buffer);
>  ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, const void
> *buffer);
> 
> +#ifdef CONFIG_IDE_PREINIT

Is there some documentation for these new config variables?

> +int ide_preinit(void);
> +#endif
> +
> +#ifdef CONFIG_IDE_INIT_POSTRESET
> +int ide_init_postreset(void);
> +#endif
> +
>  #if defined(CONFIG_OF_IDE_FIXUP)
>  int ide_device_present(int dev);
>  #endif
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/10] split mpc8xx hooks from cmd_ide.c

2012-10-07 Thread Marek Vasut
Dear Pavel Herrmann,

> move most of mpc8xx hooks from cmd_ide.c into ide_preinit() and newly
> created ide_init_postreset() (invoked after calling ide_reset after
> ide_preinit), some cleanup to make checkpatch happy, enable IDE init hooks
> in configs of affected boards.
> Confusingly, these hooks are used by more than just mpc8xx-based boards,
> and therefore are placed in arch/ppc/lib/
> 
> note: checkpatch still emits warnings about using volatile
[...]

> +
> +

Too many spaces -- one space too much.

> +int ide_preinit(void)
> +{
> + int i;
> + /* Initialize PIO timing tables */
> + for (i = 0; i <= IDE_MAX_PIO_MODE; ++i) {
> + pio_config_clk[i].t_setup =
> + PCMCIA_MK_CLKS(pio_config_ns[i].t_setup, gd->bus_clk);
> + pio_config_clk[i].t_length =
> + PCMCIA_MK_CLKS(pio_config_ns[i].t_length, gd->bus_clk);
> + pio_config_clk[i].t_hold =
> + PCMCIA_MK_CLKS(pio_config_ns[i].t_hold, gd->bus_clk);
> + debug("PIO Mode %d: setup=%2d ns/%d clk" "  len=%3d ns/%d clk"
> + "  hold=%2d ns/%d clk\n", i, pio_config_ns[i].t_setup,
> + pio_config_clk[i].t_setup, pio_config_ns[i].t_length,
> + pio_config_clk[i].t_length, pio_config_ns[i].t_hold,
> + pio_config_clk[i].t_hold);
> + }
> +
> + return 0;
> +}
> +
> +int ide_init_postreset(void)
> +{
> + volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
> + volatile pcmconf8xx_t *pcmp = &(immr->im_pcmcia);
> +
> + /* PCMCIA / IDE initialization for common mem space */
> + pcmp->pcmc_pgcrb = 0;
> +
> + /* start in PIO mode 0 - most relaxed timings */
> + pio_mode = 0;
> + set_pcmcia_timing(pio_mode);
> + return 0;
> +}
> +#endif /* CONFIG_IDE_8xx_DIRECT */
> +
> +
> +

DTTO

> +#ifdef CONFIG_IDE_8xx_PCCARD
> +
> +int ide_preinit(void)
> +{
> + ide_devices_found = 0;
> + /* initialize the PCMCIA IDE adapter card */
> + pcmcia_on();
> + if (!ide_devices_found)
> + return 1;
> + udelay(100);/* 1 s */
> + return 0;
> +}
> +#endif
> +
> +

Trailing newlines

> diff --git a/arch/powerpc/lib/ide.h b/arch/powerpc/lib/ide.h
> new file mode 100644
> index 000..9e80702
> --- /dev/null
> +++ b/arch/powerpc/lib/ide.h
> @@ -0,0 +1,31 @@
> +/*
> + * (C) Copyright 2012
> + * Pavel Herrmann 
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#ifndef _MPC8XX_IDE_H_
> +#define _MPC8XX_IDE_H_ 1
> +
> +#ifdef CONFIG_IDE_8xx_PCCARD
> +int pcmcia_on(void);
> +extern int ide_devices_found;

Why is this needed? Where was this before ? Is include/pcmcia.h not good?

> +#endif
> +#endif

[...]

> diff --git a/include/configs/ICU862.h b/include/configs/ICU862.h
> index 81f219c..b58b6f6 100644
> --- a/include/configs/ICU862.h
> +++ b/include/configs/ICU862.h
> @@ -349,6 +349,7 @@
>   *---
>   */
> 
> +#define CONFIG_IDE_PREINIT   1   /* Use preinit IDE hook */

Do you need this defined to a particular value or is having this defined enough?

>  #define  CONFIG_IDE_8xx_PCCARD   1   /* Use IDE with PC Card Adapter 

[...]

> diff --git a/include/ide.h b/include/ide.h
> index 8ecc9dd..3bae40d 100644
> --- a/include/ide.h
> +++ b/include/ide.h
> @@ -54,6 +54,14 @@ void ide_init(void);
>  ulong ide_read(int device, lbaint_t blknr, ulong blkcnt, void *buffer);
>  ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, const void
> *buffer);
> 
> +#ifdef CONFIG_IDE_PREINIT
> +int ide_preinit(void);
> +#endif
> +
> +#ifdef CONFIG_IDE_INIT_POSTRESET
> +int ide_init_postreset(void);
> +#endif
> +
>  #if defined(CONFIG_OF_IDE_FIXUP)
>  int ide_device_present(int dev);
>  #endif
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: rmobile: bugfix: wrong register saving in lowlevel_init

2012-10-07 Thread Albert ARIBAUD
Hi Albert,

On Sun, 7 Oct 2012 19:21:27 +0200, Albert ARIBAUD
 wrote:

> Hi Albert,
> 
> On Sun, 7 Oct 2012 19:19:37 +0200, Albert ARIBAUD
>  wrote:
> 
> > Hi Jeroen,
> > 
> > On Sun, 07 Oct 2012 17:18:27 +0200, Jeroen Hofstee
> >  wrote:
> > 
> > > Hello All,
> > > 
> > > On 10/07/2012 01:34 PM, Enric Balletbò i Serra wrote:
> > > > Hi Albert,
> > > >
> > > > 2012/10/5 Albert ARIBAUD :
> > > >> Hi Tetsuyuki,
> > > >>
> > > >> On Fri,  5 Oct 2012 13:39:22 +0900, Tetsuyuki Kobayashi
> > > >>  wrote:
> > > >>
> > > >>> lowlevel_init() of rmobile badly assumed that ip register holds 
> > > >>> return address.
> > > >>> The commit "63ee53a7 armv7 cpu_init_crit: Simplify code" breaks this 
> > > >>> assumption.
> > > >>> This patch removes this bad assumption and simplify code.
> > > >>>
> > > >>> Signed-off-by: Tetsuyuki Kobayashi 
> > > >>> ---
> > > >>>
> > > >> ...
> > > > Note that the patch that Tetsuyuki says also breaks SPL support for
> > > > OMAP3 boards, at least my IGEP boards doesn't boot and hangs at SPL
> > > > level.
> > > >
> > > >U-Boot SPL 2012.10-rc1-00244-g28e5ac2 (Oct 07 2012 - 13:11:29)
> > > >
> > > > Bisecting the problem I encountered the problem is the commit
> > > > "63ee53a7 armv7 cpu_init_crit: Simplify code".
> > > >
> > > > Cheers,
> > > >  Enric
> > > >
> > > I can confirm above. Also the tam3517 som (omap3) fails to boot due to
> > > mentioned commit. The patch from Tetsuyuki is arch specific (rmobile) so
> > > that won't fix the omap case. Reverting the patch, 63ee53a, does help.
> > > 
> > > Is there anything against reverting the patch (at least for the 
> > > release...)?
> > 
> > Here is my opinion:
> > 
> > 1) I think patch 63ee53a7 is right in considering there is no need for
> > cpu_init_crit to save lr in ip before calling lowlevel_init especially
> > considering this is a tail call.
> > 
> > Only lowlevel_init can tell if it uses ip or lr for its own purposes,
> > thus any saving of ip and/or lr due to the workings of lowlevel_init
> > should be performed in lowlevel_init.
> > 
> > 2) I am not sure that the patch in this discussion depends on 63ee53a7,
> > because IIUC, the patch simply saves ip "on a stack" then lr into ip,
> > and after running s_init, restores from ip and ip from the stack; it
> > never assumes ip contains a return address.
> > 
> > I know we're that close to the release, but I want to be sure we
> > understand what needs fixing. Kobayashi, Jeroen, can you indicate
> > precisely how the issues you encounter are related to 63ee53a7?
> 
> (adding back Tetsuyuki's mail in the Cc: list -- why had it
> disappeared?)
> 
> > > Regards,
> > > Jeroen
> > 
> > Amicalement,
> 
> Amicalement,

Hmm... I notice only now that I had mentally 'fixed' the order of the
restoring lines removed by the patch. Had they been in the right order
(mov lr, ip then ldr ip, [sp]) the original code would have worked,
albeit probably useless.

I suspect that the bad ordering was actually a mistake unseen, and
that the dependence on ip being a return address is only due to this
mistake.

In any case, this makes me *more* determined that 63ee53a7 is right,as
well as this patch.

Jeroen, I suspect that your problem comes from the fact that the same
bug that this patch uncovers and fixes exists also in

arch/arm/cpu/armv7/omap3/lowlevel_init.S (lines 216-218 and 228-229)

... and would be better fixed there than by reverting 63ee53a7.

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


Re: [U-Boot] [PATCH] arm: rmobile: bugfix: wrong register saving in lowlevel_init

2012-10-07 Thread Albert ARIBAUD
Hi Albert,

On Sun, 7 Oct 2012 19:19:37 +0200, Albert ARIBAUD
 wrote:

> Hi Jeroen,
> 
> On Sun, 07 Oct 2012 17:18:27 +0200, Jeroen Hofstee
>  wrote:
> 
> > Hello All,
> > 
> > On 10/07/2012 01:34 PM, Enric Balletbò i Serra wrote:
> > > Hi Albert,
> > >
> > > 2012/10/5 Albert ARIBAUD :
> > >> Hi Tetsuyuki,
> > >>
> > >> On Fri,  5 Oct 2012 13:39:22 +0900, Tetsuyuki Kobayashi
> > >>  wrote:
> > >>
> > >>> lowlevel_init() of rmobile badly assumed that ip register holds return 
> > >>> address.
> > >>> The commit "63ee53a7 armv7 cpu_init_crit: Simplify code" breaks this 
> > >>> assumption.
> > >>> This patch removes this bad assumption and simplify code.
> > >>>
> > >>> Signed-off-by: Tetsuyuki Kobayashi 
> > >>> ---
> > >>>
> > >> ...
> > > Note that the patch that Tetsuyuki says also breaks SPL support for
> > > OMAP3 boards, at least my IGEP boards doesn't boot and hangs at SPL
> > > level.
> > >
> > >U-Boot SPL 2012.10-rc1-00244-g28e5ac2 (Oct 07 2012 - 13:11:29)
> > >
> > > Bisecting the problem I encountered the problem is the commit
> > > "63ee53a7 armv7 cpu_init_crit: Simplify code".
> > >
> > > Cheers,
> > >  Enric
> > >
> > I can confirm above. Also the tam3517 som (omap3) fails to boot due to
> > mentioned commit. The patch from Tetsuyuki is arch specific (rmobile) so
> > that won't fix the omap case. Reverting the patch, 63ee53a, does help.
> > 
> > Is there anything against reverting the patch (at least for the release...)?
> 
> Here is my opinion:
> 
> 1) I think patch 63ee53a7 is right in considering there is no need for
> cpu_init_crit to save lr in ip before calling lowlevel_init especially
> considering this is a tail call.
> 
> Only lowlevel_init can tell if it uses ip or lr for its own purposes,
> thus any saving of ip and/or lr due to the workings of lowlevel_init
> should be performed in lowlevel_init.
> 
> 2) I am not sure that the patch in this discussion depends on 63ee53a7,
> because IIUC, the patch simply saves ip "on a stack" then lr into ip,
> and after running s_init, restores from ip and ip from the stack; it
> never assumes ip contains a return address.
> 
> I know we're that close to the release, but I want to be sure we
> understand what needs fixing. Kobayashi, Jeroen, can you indicate
> precisely how the issues you encounter are related to 63ee53a7?

(adding back Tetsuyuki's mail in the Cc: list -- why had it
disappeared?)

> > Regards,
> > Jeroen
> 
> Amicalement,

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


Re: [U-Boot] [PATCH] arm: rmobile: bugfix: wrong register saving in lowlevel_init

2012-10-07 Thread Albert ARIBAUD
Hi Jeroen,

On Sun, 07 Oct 2012 17:18:27 +0200, Jeroen Hofstee
 wrote:

> Hello All,
> 
> On 10/07/2012 01:34 PM, Enric Balletbò i Serra wrote:
> > Hi Albert,
> >
> > 2012/10/5 Albert ARIBAUD :
> >> Hi Tetsuyuki,
> >>
> >> On Fri,  5 Oct 2012 13:39:22 +0900, Tetsuyuki Kobayashi
> >>  wrote:
> >>
> >>> lowlevel_init() of rmobile badly assumed that ip register holds return 
> >>> address.
> >>> The commit "63ee53a7 armv7 cpu_init_crit: Simplify code" breaks this 
> >>> assumption.
> >>> This patch removes this bad assumption and simplify code.
> >>>
> >>> Signed-off-by: Tetsuyuki Kobayashi 
> >>> ---
> >>>
> >> ...
> > Note that the patch that Tetsuyuki says also breaks SPL support for
> > OMAP3 boards, at least my IGEP boards doesn't boot and hangs at SPL
> > level.
> >
> >U-Boot SPL 2012.10-rc1-00244-g28e5ac2 (Oct 07 2012 - 13:11:29)
> >
> > Bisecting the problem I encountered the problem is the commit
> > "63ee53a7 armv7 cpu_init_crit: Simplify code".
> >
> > Cheers,
> >  Enric
> >
> I can confirm above. Also the tam3517 som (omap3) fails to boot due to
> mentioned commit. The patch from Tetsuyuki is arch specific (rmobile) so
> that won't fix the omap case. Reverting the patch, 63ee53a, does help.
> 
> Is there anything against reverting the patch (at least for the release...)?

Here is my opinion:

1) I think patch 63ee53a7 is right in considering there is no need for
cpu_init_crit to save lr in ip before calling lowlevel_init especially
considering this is a tail call.

Only lowlevel_init can tell if it uses ip or lr for its own purposes,
thus any saving of ip and/or lr due to the workings of lowlevel_init
should be performed in lowlevel_init.

2) I am not sure that the patch in this discussion depends on 63ee53a7,
because IIUC, the patch simply saves ip "on a stack" then lr into ip,
and after running s_init, restores from ip and ip from the stack; it
never assumes ip contains a return address.

I know we're that close to the release, but I want to be sure we
understand what needs fixing. Kobayashi, Jeroen, can you indicate
precisely how the issues you encounter are related to 63ee53a7?

> Regards,
> Jeroen

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


[U-Boot] [PATCH 10/10] remove unnecessary includes from cmd_ide.c

2012-10-07 Thread Pavel Herrmann
mpc8xx and mpc5xxx specific includes in cmd_ide.c are not required, remove them.

Signed-off-by: Pavel Herrmann 
---
 common/cmd_ide.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 4f3ff54..891ce21 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -38,14 +38,6 @@
 # include 
 #endif
 
-#ifdef CONFIG_8xx
-# include 
-#endif
-
-#ifdef CONFIG_MPC5xxx
-#include 
-#endif
-
 #include 
 #include 
 
-- 
1.7.12

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


[U-Boot] [PATCH 09/10] split PCS440EP specific code from cmd_ide.c

2012-10-07 Thread Pavel Herrmann
Move specific ide_input_data and friends to board-specific file.

Signed-off-by: Pavel Herrmann 
---
 board/pcs440ep/pcs440ep.c | 56 +++
 common/cmd_ide.c  | 18 ---
 2 files changed, 56 insertions(+), 18 deletions(-)

diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 52da053..f8345dd 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -713,3 +714,58 @@ void ide_set_reset (int idereset)
udelay (1);
 }
 #endif /* defined (CONFIG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
+
+
+/* this is motly the same as it should, causing a little code duplication */
+#if defined(CONFIG_CMD_IDE)
+#define EIEIO  __asm__ volatile ("eieio")
+
+void ide_input_swap_data(int dev, ulong *sect_buf, int words)
+{
+   volatile ushort *pbuf =
+   (ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG);
+   ushort *dbuf = (ushort *) sect_buf;
+
+   debug("in input swap data base for read is %lx\n",
+   (unsigned long) pbuf);
+
+   while (words--) {
+   *dbuf++ = *pbuf;
+   *dbuf++ = *pbuf;
+   }
+}
+
+void ide_output_data(int dev, const ulong *sect_buf, int words)
+{
+   ushort *dbuf;
+   volatile ushort *pbuf;
+
+   pbuf = (ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG);
+   dbuf = (ushort *) sect_buf;
+   while (words--) {
+   EIEIO;
+   *pbuf = ld_le16(dbuf++);
+   EIEIO;
+   *pbuf = ld_le16(dbuf++);
+   }
+}
+
+void ide_input_data(int dev, ulong *sect_buf, int words)
+{
+   ushort *dbuf;
+   volatile ushort *pbuf;
+
+   pbuf = (ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG);
+   dbuf = (ushort *) sect_buf;
+
+   debug("in input data base for read is %lx\n", (unsigned long) pbuf);
+
+   while (words--) {
+   EIEIO;
+   *dbuf++ = ld_le16(pbuf);
+   EIEIO;
+   *dbuf++ = ld_le16(pbuf);
+   }
+}
+
+#endif
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 7c8f866..4f3ff54 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -522,9 +522,6 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int 
words)
 #ifdef __MIPS__
*dbuf++ = swab16p((u16 *) pbuf);
*dbuf++ = swab16p((u16 *) pbuf);
-#elif defined(CONFIG_PCS440EP)
-   *dbuf++ = *pbuf;
-   *dbuf++ = *pbuf;
 #else
*dbuf++ = ld_le16(pbuf);
*dbuf++ = ld_le16(pbuf);
@@ -543,18 +540,10 @@ void __ide_output_data(int dev, const ulong *sect_buf, 
int words)
pbuf = (ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG);
dbuf = (ushort *) sect_buf;
while (words--) {
-#if defined(CONFIG_PCS440EP)
-   /* not tested, because CF was write protected */
-   EIEIO;
-   *pbuf = ld_le16(dbuf++);
-   EIEIO;
-   *pbuf = ld_le16(dbuf++);
-#else
EIEIO;
*pbuf = *dbuf++;
EIEIO;
*pbuf = *dbuf++;
-#endif
}
 }
 #else  /* ! CONFIG_IDE_SWAP_IO */
@@ -580,17 +569,10 @@ void __ide_input_data(int dev, ulong *sect_buf, int words)
debug("in input data base for read is %lx\n", (unsigned long) pbuf);
 
while (words--) {
-#if defined(CONFIG_PCS440EP)
-   EIEIO;
-   *dbuf++ = ld_le16(pbuf);
-   EIEIO;
-   *dbuf++ = ld_le16(pbuf);
-#else
EIEIO;
*dbuf++ = *pbuf;
EIEIO;
*dbuf++ = *pbuf;
-#endif
}
 }
 #else  /* ! CONFIG_IDE_SWAP_IO */
-- 
1.7.12

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


[U-Boot] [PATCH 08/10] split AU1X00 specific code from cmd_ide.c

2012-10-07 Thread Pavel Herrmann
Move special case of ide_swap_read() for AU1X00 SoC into SoC-specific directory.

Signed-off-by: Pavel Herrmann 
---
 arch/mips/cpu/mips32/au1x00/Makefile |  2 +-
 arch/mips/cpu/mips32/au1x00/au1x00_ide.c | 33 
 common/cmd_ide.c |  6 ++
 3 files changed, 36 insertions(+), 5 deletions(-)
 create mode 100644 arch/mips/cpu/mips32/au1x00/au1x00_ide.c

diff --git a/arch/mips/cpu/mips32/au1x00/Makefile 
b/arch/mips/cpu/mips32/au1x00/Makefile
index dc58475..b9f895d 100644
--- a/arch/mips/cpu/mips32/au1x00/Makefile
+++ b/arch/mips/cpu/mips32/au1x00/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(SOC).o
 
-COBJS  = au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o
+COBJS  = au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o au1x00_ide.o
 
 SRCS   := $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_ide.c 
b/arch/mips/cpu/mips32/au1x00/au1x00_ide.c
new file mode 100644
index 000..337dd45
--- /dev/null
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_ide.c
@@ -0,0 +1,33 @@
+/*
+ * (C) Copyright 2000-2011
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#include 
+
+/* AU1X00 swaps data in big-endian mode, enforce little-endian function */
+#ifndef CONFIG_GTH2 /* GTH2 board behaves as it should */
+void ide_input_swap_data(int dev, ulong *sect_buf, int words)
+{
+   ide_input_data(dev, sect_buf, words);
+}
+
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 2f3b077..7c8f866 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -503,9 +503,7 @@ void ide_output_data(int dev, const ulong *sect_buf, int 
words)
__attribute__ ((weak, alias("__ide_output_data")));
 
 /* We only need to swap data if we are running on a big endian cpu. */
-/* But Au1x00 cpu:s already swaps data in big endian mode! */
-#if defined(__LITTLE_ENDIAN) || \
-   (defined(CONFIG_SOC_AU1X00) && !defined(CONFIG_GTH2))
+#if defined(__LITTLE_ENDIAN)
 void __ide_input_swap_data(int dev, ulong *sect_buf, int words)
 {
ide_input_data(dev, sect_buf, words);
@@ -533,7 +531,7 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int 
words)
 #endif /* !MIPS */
}
 }
-#endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */
+#endif /* __LITTLE_ENDIAN */
 
 
 #if defined(CONFIG_IDE_SWAP_IO)
-- 
1.7.12

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


[U-Boot] [PATCH 07/10] move CPC45 ide_led to the same file as other IDE hooks

2012-10-07 Thread Pavel Herrmann
Keep all IDE-related hooks and overrides in a single file, to avoid confusion.

Signed-off-by: Pavel Herrmann 
---
 board/cpc45/cpc45.c | 15 ---
 board/cpc45/ide.c   | 15 +++
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/board/cpc45/cpc45.c b/board/cpc45/cpc45.c
index 1178822..2200806 100644
--- a/board/cpc45/cpc45.c
+++ b/board/cpc45/cpc45.c
@@ -260,21 +260,6 @@ int pcmcia_init(void)
 
 #endif
 
-# ifdef CONFIG_IDE_LED
-void ide_led (uchar led, uchar status)
-{
-   u_char  val;
-   /* We have one PCMCIA slot and use LED H4 for the IDE Interface */
-   val = readb(BCSR_BASE + 0x04);
-   if (status) {   /* led on */
-   val |= B_CTRL_LED0;
-   } else {
-   val &= ~B_CTRL_LED0;
-   }
-   writeb(val, BCSR_BASE + 0x04);
-}
-# endif
-
 int board_eth_init(bd_t *bis)
 {
return pci_eth_init(bis);
diff --git a/board/cpc45/ide.c b/board/cpc45/ide.c
index 7b7237b..aafe127 100644
--- a/board/cpc45/ide.c
+++ b/board/cpc45/ide.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define EIEIO  __asm__ volatile ("eieio")
 #define SYNC   __asm__ volatile ("sync")
@@ -128,3 +129,17 @@ void ide_output_data_shorts(int dev, ushort *sect_buf, int 
shorts)
*pbuf_odd = *dbuf++;
}
 }
+
+void ide_led(uchar led, uchar status)
+{
+   u_char  val;
+   /* We have one PCMCIA slot and use LED H4 for the IDE Interface */
+   val = readb(BCSR_BASE + 0x04);
+   if (status) {   /* led on */
+   val |= B_CTRL_LED0;
+   } else {
+   val &= ~B_CTRL_LED0;
+   }
+   writeb(val, BCSR_BASE + 0x04);
+}
+
-- 
1.7.12

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


[U-Boot] [PATCH 06/10] make ide_led() a weak alias

2012-10-07 Thread Pavel Herrmann
Make ide_led() a weak alias instead of global/local function/empty macro
based on CONFIG_IDE_LED value and/or board-specific CONFIGs, to get rid of
board-specific code in cmd_ide.c
Define dummy values to get rid of compoler errors in case where ide_led()
used to be an empty macro

Signed-off-by: Pavel Herrmann 
---
 common/cmd_ide.c | 63 
 1 file changed, 27 insertions(+), 36 deletions(-)

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 89849d5..2f3b077 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -81,19 +81,6 @@ static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS];
 block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
 /* - */
 
-#ifdef CONFIG_IDE_LED
-# if !defined(CONFIG_BMS2003)  && \
- !defined(CONFIG_CPC45)&& \
- !defined(CONFIG_KUP4K) && \
- !defined(CONFIG_KUP4X)
-static void  ide_led   (uchar led, uchar status);
-#else
-extern void  ide_led   (uchar led, uchar status);
-#endif
-#else
-#define ide_led(a,b)   /* dummy */
-#endif
-
 #ifdef CONFIG_IDE_RESET
 static void  ide_reset (void);
 #else
@@ -290,6 +277,33 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 
 /* - */
 
+void __ide_led(uchar led, uchar status)
+{
+#if defined(CONFIG_IDE_LED) && defined(PER8_BASE) /* required by LED_PORT */
+   static uchar led_buffer;/* Buffer for current LED status */
+
+   uchar *led_port = LED_PORT;
+
+   if (status) /* switch LED on*/
+   led_buffer |= led;
+   else/* switch LED off   */
+   led_buffer &= ~led;
+
+   *led_port = led_buffer;
+#endif
+}
+
+void ide_led(uchar led, uchar status)
+   __attribute__ ((weak, alias("__ide_led")));
+
+#ifndef CONFIG_IDE_LED /* define LED macros, they are not used anyways */
+# define DEVICE_LED(x) 0
+# define LED_IDE1 1
+# define LED_IDE2 2
+#endif
+
+/* - */
+
 inline void __ide_outb(int dev, int port, unsigned char val)
 {
debug("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
@@ -442,9 +456,7 @@ void ide_init(void)
 
curr_device = -1;
for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; ++i) {
-#ifdef CONFIG_IDE_LED
int led = (IDE_BUS(i) == 0) ? LED_IDE1 : LED_IDE2;
-#endif
ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
ide_dev_desc[i].if_type = IF_TYPE_IDE;
ide_dev_desc[i].dev = i;
@@ -1146,27 +1158,6 @@ static void ide_reset(void)
 
 /* - */
 
-#if defined(CONFIG_IDE_LED)&& \
-   !defined(CONFIG_CPC45)  && \
-   !defined(CONFIG_KUP4K)  && \
-   !defined(CONFIG_KUP4X)
-
-static uchar led_buffer;   /* Buffer for current LED status*/
-
-static void ide_led(uchar led, uchar status)
-{
-   uchar *led_port = LED_PORT;
-
-   if (status) /* switch LED on*/
-   led_buffer |= led;
-   else/* switch LED off   */
-   led_buffer &= ~led;
-
-   *led_port = led_buffer;
-}
-
-#endif /* CONFIG_IDE_LED */
-
 #if defined(CONFIG_OF_IDE_FIXUP)
 int ide_device_present(int dev)
 {
-- 
1.7.12

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


[U-Boot] [PATCH 05/10] split CPC45 board-specific IDE functions from cmd_ide.c

2012-10-07 Thread Pavel Herrmann
Move input_data() and friends to board/cpc45/ide.c, as overrides for weak
aliases in cmd_ide.c

note: checkpatch emits warnings about using volatile

Signed-off-by: Pavel Herrmann 
---
 board/cpc45/Makefile |   2 +-
 board/cpc45/ide.c| 130 +++
 common/cmd_ide.c |  91 
 3 files changed, 131 insertions(+), 92 deletions(-)
 create mode 100644 board/cpc45/ide.c

diff --git a/board/cpc45/Makefile b/board/cpc45/Makefile
index 5c6b78f..ac1d174 100644
--- a/board/cpc45/Makefile
+++ b/board/cpc45/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
 
-COBJS  = $(BOARD).o flash.o plx9030.o pd67290.o
+COBJS  = $(BOARD).o flash.o plx9030.o pd67290.o ide.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/cpc45/ide.c b/board/cpc45/ide.c
new file mode 100644
index 000..7b7237b
--- /dev/null
+++ b/board/cpc45/ide.c
@@ -0,0 +1,130 @@
+/*
+ * (C) Copyright 2001
+ * Rob Taylor, Flying Pig Systems. r...@flyingpig.com.
+ *
+ * (C) Copyright 2000-2011
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+
+#define EIEIO  __asm__ volatile ("eieio")
+#define SYNC   __asm__ volatile ("sync")
+
+void ide_input_swap_data(int dev, ulong *sect_buf, int words)
+{
+   uchar i;
+   volatile uchar *pbuf_even =
+   (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
+   volatile uchar *pbuf_odd =
+   (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
+   ushort *dbuf = (ushort *) sect_buf;
+
+   while (words--) {
+   for (i = 0; i < 2; i++) {
+   *(((uchar *) (dbuf)) + 1) = *pbuf_even;
+   *(uchar *) dbuf = *pbuf_odd;
+   dbuf += 1;
+   }
+   }
+}
+
+void ide_input_data(int dev, ulong *sect_buf, int words)
+{
+   uchar *dbuf;
+   volatile uchar *pbuf_even;
+   volatile uchar *pbuf_odd;
+
+   pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
+   pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
+   dbuf = (uchar *) sect_buf;
+   while (words--) {
+   *dbuf++ = *pbuf_even;
+   EIEIO;
+   SYNC;
+   *dbuf++ = *pbuf_odd;
+   EIEIO;
+   SYNC;
+   *dbuf++ = *pbuf_even;
+   EIEIO;
+   SYNC;
+   *dbuf++ = *pbuf_odd;
+   EIEIO;
+   SYNC;
+   }
+}
+
+void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts)
+{
+   uchar *dbuf;
+   volatile uchar *pbuf_even;
+   volatile uchar *pbuf_odd;
+
+   pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
+   pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
+   dbuf = (uchar *) sect_buf;
+   while (shorts--) {
+   EIEIO;
+   *dbuf++ = *pbuf_even;
+   EIEIO;
+   *dbuf++ = *pbuf_odd;
+   }
+}
+
+void ide_output_data(int dev, const ulong *sect_buf, int words)
+{
+   uchar *dbuf;
+   volatile uchar *pbuf_even;
+   volatile uchar *pbuf_odd;
+
+   pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
+   pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
+   dbuf = (uchar *) sect_buf;
+   while (words--) {
+   EIEIO;
+   *pbuf_even = *dbuf++;
+   EIEIO;
+   *pbuf_odd = *dbuf++;
+   EIEIO;
+   *pbuf_even = *dbuf++;
+   EIEIO;
+   *pbuf_odd = *dbuf++;
+   }
+}
+
+void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
+{
+   uchar *dbuf;
+   volatile uchar *pbuf_even;
+   volatile uchar *pbuf_odd;
+
+   pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
+   pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
+   dbuf = (uchar *) sect_buf;
+   while (shorts--) {
+   EIEIO;
+   *pbuf_even = *dbuf++;
+   EIEIO;
+   *pbuf_odd = *dbu

[U-Boot] [PATCH 02/10] split mpc8xx hooks from cmd_ide.c

2012-10-07 Thread Pavel Herrmann
move most of mpc8xx hooks from cmd_ide.c into ide_preinit() and newly created
ide_init_postreset() (invoked after calling ide_reset after ide_preinit),
some cleanup to make checkpatch happy, enable IDE init hooks in configs of
affected boards.
Confusingly, these hooks are used by more than just mpc8xx-based boards, and
therefore are placed in arch/ppc/lib/

note: checkpatch still emits warnings about using volatile

Signed-off-by: Pavel Herrmann 
---
 arch/powerpc/lib/Makefile|   1 +
 arch/powerpc/lib/ide.c   | 207 +++
 arch/powerpc/lib/ide.h   |  31 +++
 common/cmd_ide.c | 190 ++-
 include/configs/CPC45.h  |   1 +
 include/configs/ICU862.h |   1 +
 include/configs/IVML24.h |   2 +
 include/configs/IVMS8.h  |   2 +
 include/configs/KUP4K.h  |   1 +
 include/configs/KUP4X.h  |   1 +
 include/configs/MBX.h|   1 +
 include/configs/NETTA.h  |   1 +
 include/configs/NSCU.h   |   1 +
 include/configs/R360MPI.h|   1 +
 include/configs/RPXClassic.h |   1 +
 include/configs/RPXlite.h|   1 +
 include/configs/RPXlite_DW.h |   1 +
 include/configs/RRvision.h   |   1 +
 include/configs/SPD823TS.h   |   2 +
 include/configs/TK885D.h |   1 +
 include/configs/TQM823L.h|   1 +
 include/configs/TQM823M.h|   1 +
 include/configs/TQM850L.h|   1 +
 include/configs/TQM850M.h|   1 +
 include/configs/TQM855L.h|   1 +
 include/configs/TQM855M.h|   1 +
 include/configs/TQM860L.h|   1 +
 include/configs/TQM860M.h|   1 +
 include/configs/TQM862L.h|   1 +
 include/configs/TQM862M.h|   1 +
 include/configs/TQM866M.h|   1 +
 include/configs/TQM885D.h|   1 +
 include/configs/atc.h|   1 +
 include/configs/c2mon.h  |   1 +
 include/configs/lwmon.h  |   1 +
 include/configs/quantum.h|   1 +
 include/configs/svm_sc8xx.h  |   2 +
 include/configs/uc100.h  |   1 +
 include/configs/virtlab2.h   |   1 +
 include/ide.h|   8 ++
 40 files changed, 293 insertions(+), 183 deletions(-)
 create mode 100644 arch/powerpc/lib/ide.c
 create mode 100644 arch/powerpc/lib/ide.h

diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 965f9ea..808021c 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -50,6 +50,7 @@ COBJS-y   += cache.o
 COBJS-y+= extable.o
 COBJS-y+= interrupts.o
 COBJS-$(CONFIG_CMD_KGDB) += kgdb.o
+COBJS-${CONFIG_CMD_IDE} += ide.o
 COBJS-y+= time.o
 
 # Workaround for local bus unaligned access problems
diff --git a/arch/powerpc/lib/ide.c b/arch/powerpc/lib/ide.c
new file mode 100644
index 000..5319eb1
--- /dev/null
+++ b/arch/powerpc/lib/ide.c
@@ -0,0 +1,207 @@
+/*
+ * (C) Copyright 2000-2011
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+/* Code taken from cmd_ide.c */
+#include 
+#include 
+#include "ide.h"
+
+#ifdef CONFIG_IDE_8xx_DIRECT
+#include 
+#include 
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Timings for IDE Interface
+ *
+ * SETUP / LENGTH / HOLD - cycles valid for 50 MHz clk
+ * 70 165  30 PIO-Mode 0, [ns]
+ *  4   9   2 [Cycles]
+ * 50 125  20 PIO-Mode 1, [ns]
+ *  3   7   2 [Cycles]
+ * 30 100  15 PIO-Mode 2, [ns]
+ *  2   6   1 [Cycles]
+ * 30  80  10 PIO-Mode 3, [ns]
+ *  2   5   1 [Cycles]
+ * 25  70  10 PIO-Mode 4, [ns]
+ *  2   4   1 [Cycles]
+ */
+
+static const pio_config_t pio_config_ns[IDE_MAX_PIO_MODE+1] = {
+/*  Setup  Length  Hold  */
+   { 70,   165,30 },   /* PIO-Mode 0, [ns] */
+   { 50,   125,20 },   /* PIO-Mode 1, [ns] */
+   { 30,   101,15 },   /* PIO-Mode 2, [ns] */
+   { 30,80,10 },   /* PIO-Mode 3, [ns] */
+   { 25,70,10 },   /* PIO-Mode 4, [ns] */
+};
+
+static pio_config_t pio_config_clk[IDE_MAX_PIO_MODE+1];
+
+#ifndef CONFIG_SYS_PIO_MODE
+#define CONFIG_SYS_PIO_MODE0   /* use a relaxed 

[U-Boot] [PATCH 03/10] split IVM power hooks from cmd_ide.c

2012-10-07 Thread Pavel Herrmann
Move power control code from ide_reset() into IVM-specific IDE reset code.

Signed-off-by: Pavel Herrmann 
---
 board/ivm/ivm.c  | 46 ++
 common/cmd_ide.c | 48 
 2 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/board/ivm/ivm.c b/board/ivm/ivm.c
index 71d64d4..ab29479 100644
--- a/board/ivm/ivm.c
+++ b/board/ivm/ivm.c
@@ -333,13 +333,59 @@ void show_boot_progress (int status)
 void ide_set_reset (int on)
 {
volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
+   int i;
 
/*
 * Configure PC for IDE Reset Pin
 */
if (on) {   /* assert RESET */
immr->im_ioport.iop_pcdat &= ~(CONFIG_SYS_PC_IDE_RESET);
+
+#ifdef CONFIG_SYS_PB_12V_ENABLE
+   /* 12V Enable output OFF */
+   immr->im_cpm.cp_pbdat &= ~(CONFIG_SYS_PB_12V_ENABLE);
+
+   immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_12V_ENABLE);
+   immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_12V_ENABLE);
+   immr->im_cpm.cp_pbdir |= CONFIG_SYS_PB_12V_ENABLE;
+
+   /* wait 500 ms for the voltage to stabilize */
+   for (i = 0; i < 500; ++i)
+   udelay(1000);
+#endif /* CONFIG_SYS_PB_12V_ENABLE */
} else {/* release RESET */
+#ifdef CONFIG_SYS_PB_12V_ENABLE
+   /* 12V Enable output ON */
+   immr->im_cpm.cp_pbdat |= CONFIG_SYS_PB_12V_ENABLE;
+#endif /* CONFIG_SYS_PB_12V_ENABLE */
+
+#ifdef CONFIG_SYS_PB_IDE_MOTOR
+   /* configure IDE Motor voltage monitor pin as input */
+   immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_IDE_MOTOR);
+   immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_IDE_MOTOR);
+   immr->im_cpm.cp_pbdir &= ~(CONFIG_SYS_PB_IDE_MOTOR);
+
+/* wait up to 1 s for the motor voltage to stabilize */
+   for (i = 0; i < 1000; ++i) {
+   if ((immr->im_cpm.cp_pbdat
+   & CONFIG_SYS_PB_IDE_MOTOR) != 0)
+   break;
+   udelay(1000);
+   }
+
+   if (i == 1000) {/* Timeout */
+   printf("\nWarning: 5V for IDE Motor missing\n");
+#ifdef CONFIG_STATUS_LED
+#ifdef STATUS_LED_YELLOW
+   status_led_set(STATUS_LED_YELLOW, STATUS_LED_ON);
+#endif
+#ifdef STATUS_LED_GREEN
+   status_led_set(STATUS_LED_GREEN, STATUS_LED_OFF);
+#endif
+#endif /* CONFIG_STATUS_LED */
+   }
+#endif /* CONFIG_SYS_PB_IDE_MOTOR */
+
immr->im_ioport.iop_pcdat |= CONFIG_SYS_PC_IDE_RESET;
}
 
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 93a328c..2604809 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -1170,9 +1170,6 @@ extern void ide_set_reset(int idereset);
 
 static void ide_reset(void)
 {
-#if defined(CONFIG_SYS_PB_12V_ENABLE) || defined(CONFIG_SYS_PB_IDE_MOTOR)
-   volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
-#endif
int i;
 
curr_device = -1;
@@ -1188,51 +1185,6 @@ static void ide_reset(void)
 
WATCHDOG_RESET();
 
-#ifdef CONFIG_SYS_PB_12V_ENABLE
-   /* 12V Enable output OFF */
-   immr->im_cpm.cp_pbdat &= ~(CONFIG_SYS_PB_12V_ENABLE);
-
-   immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_12V_ENABLE);
-   immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_12V_ENABLE);
-   immr->im_cpm.cp_pbdir |= CONFIG_SYS_PB_12V_ENABLE;
-
-   /* wait 500 ms for the voltage to stabilize */
-   for (i = 0; i < 500; ++i)
-   udelay(1000);
-
-   /* 12V Enable output ON */
-   immr->im_cpm.cp_pbdat |= CONFIG_SYS_PB_12V_ENABLE;
-#endif /* CONFIG_SYS_PB_12V_ENABLE */
-
-#ifdef CONFIG_SYS_PB_IDE_MOTOR
-   /* configure IDE Motor voltage monitor pin as input */
-   immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_IDE_MOTOR);
-   immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_IDE_MOTOR);
-   immr->im_cpm.cp_pbdir &= ~(CONFIG_SYS_PB_IDE_MOTOR);
-
-   /* wait up to 1 s for the motor voltage to stabilize */
-   for (i = 0; i < 1000; ++i) {
-   if ((immr->im_cpm.cp_pbdat & CONFIG_SYS_PB_IDE_MOTOR) != 0) {
-   break;
-   }
-   udelay(1000);
-   }
-
-   if (i == 1000) {/* Timeout */
-   printf("\nWarning: 5V for IDE Motor missing\n");
-#ifdef CONFIG_STATUS_LED
-#ifdef STATUS_LED_YELLOW
-   status_led_set(STATUS_LED_YELLOW, STATUS_LED_ON);
-#endif
-#ifdef STATUS_LED_GREEN
-   status_led_set(STATUS_LED_GREEN, STATUS_LED_OFF);
-#endif
-#endif /* CONFIG_STATUS_LED */
-   }
-#endif /* CONFIG_SYS_PB_IDE_MOTOR */
-
-   WATCHDOG_RESET();
-
/* de-assert RESET signal */
ide_set_reset(0);
 
-- 
1.7.12

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

[U-Boot] [PATCH 04/10] change all versions of input_data() and output_data() to global weak aliases

2012-10-07 Thread Pavel Herrmann
This changes input_data() and friends from static function to global symbols
under weak alias, to enable board specific overrides (and therefore get rid of
board-specific code in cmd_ide.c)
Also declare ide_bus_offset in the header file, so other files can use
ATA_CURR_BASE as well.

Signed-off-by: Pavel Herrmann 
---
 board/esd/cpci750/ide.c   |  1 -
 board/linkstation/ide.c   |  1 -
 board/pcs440ep/pcs440ep.c |  1 -
 common/cmd_ide.c  | 57 ++-
 include/ide.h | 11 +
 5 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/board/esd/cpci750/ide.c b/board/esd/cpci750/ide.c
index aa001df..4ef10e7 100644
--- a/board/esd/cpci750/ide.c
+++ b/board/esd/cpci750/ide.c
@@ -30,7 +30,6 @@
 #include 
 #include 
 
-extern ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS];
 int cpci_hd_type;
 
 int ata_device(int dev)
diff --git a/board/linkstation/ide.c b/board/linkstation/ide.c
index f3e3fce..541c958 100644
--- a/board/linkstation/ide.c
+++ b/board/linkstation/ide.c
@@ -37,7 +37,6 @@
 #define IT8212_PCI_IdeBusSkewCONTROL   0x4c
 #define IT8212_PCI_IdeDrivingCURRENT   0x42
 
-extern ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS];
 extern struct pci_controller hose;
 
 int ide_preinit (void)
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 746a54c..52da053 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -672,7 +672,6 @@ U_BOOT_CMD(
  * ( bus per_addr 20 -30 is connectsd on CF bus A10-A0)
  * These values are shifted
  */
-extern ulong *ide_bus_offset;
 void inline ide_outb(int dev, int port, unsigned char val)
 {
debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 2604809..93371fd 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -109,8 +109,6 @@ static uchar ide_wait  (int dev, ulong t);
 
 #define IDE_SPIN_UP_TIME_OUT 5000 /* 5 sec spin-up timeout */
 
-static void input_data(int dev, ulong *sect_buf, int words);
-static void output_data(int dev, const ulong *sect_buf, int words);
 static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int 
len);
 
 #ifndef CONFIG_SYS_ATA_PORT_ADDR
@@ -483,13 +481,25 @@ block_dev_desc_t *ide_get_dev(int dev)
 
 /* - */
 
+void ide_input_swap_data(int dev, ulong *sect_buf, int words)
+   __attribute__ ((weak, alias("__ide_input_swap_data")));
+
+void ide_input_data(int dev, ulong *sect_buf, int words)
+   __attribute__ ((weak, alias("__ide_input_data")));
+
+void ide_output_data(int dev, const ulong *sect_buf, int words)
+   __attribute__ ((weak, alias("__ide_output_data")));
+
 /* We only need to swap data if we are running on a big endian cpu. */
 /* But Au1x00 cpu:s already swaps data in big endian mode! */
 #if defined(__LITTLE_ENDIAN) || \
(defined(CONFIG_SOC_AU1X00) && !defined(CONFIG_GTH2))
-#define input_swap_data(x,y,z) input_data(x,y,z)
+void __ide_input_swap_data(int dev, ulong *sect_buf, int words)
+{
+   ide_input_data(dev, sect_buf, words);
+}
 #else
-static void input_swap_data(int dev, ulong *sect_buf, int words)
+void __ide_input_swap_data(int dev, ulong *sect_buf, int words)
 {
 #if defined(CONFIG_CPC45)
uchar i;
@@ -532,7 +542,7 @@ static void input_swap_data(int dev, ulong *sect_buf, int 
words)
 
 
 #if defined(CONFIG_IDE_SWAP_IO)
-static void output_data(int dev, const ulong *sect_buf, int words)
+void __ide_output_data(int dev, const ulong *sect_buf, int words)
 {
 #if defined(CONFIG_CPC45)
uchar *dbuf;
@@ -575,7 +585,7 @@ static void output_data(int dev, const ulong *sect_buf, int 
words)
 #endif
 }
 #else  /* ! CONFIG_IDE_SWAP_IO */
-static void output_data(int dev, const ulong *sect_buf, int words)
+void __ide_output_data(int dev, const ulong *sect_buf, int words)
 {
 #if defined(CONFIG_IDE_AHB)
ide_write_data(dev, sect_buf, words);
@@ -586,7 +596,7 @@ static void output_data(int dev, const ulong *sect_buf, int 
words)
 #endif /* CONFIG_IDE_SWAP_IO */
 
 #if defined(CONFIG_IDE_SWAP_IO)
-static void input_data(int dev, ulong *sect_buf, int words)
+void __ide_input_data(int dev, ulong *sect_buf, int words)
 {
 #if defined(CONFIG_CPC45)
uchar *dbuf;
@@ -635,7 +645,7 @@ static void input_data(int dev, ulong *sect_buf, int words)
 #endif
 }
 #else  /* ! CONFIG_IDE_SWAP_IO */
-static void input_data(int dev, ulong *sect_buf, int words)
+void __ide_input_data(int dev, ulong *sect_buf, int words)
 {
 #if defined(CONFIG_IDE_AHB)
ide_read_data(dev, sect_buf, words);
@@ -745,7 +755,7 @@ static void ide_ident(block_dev_desc_t *dev_desc)
return;
 #endif
 
-   input_swap_data(device, (ulong *)&iop, ATA_SECTORWORDS);
+   ide_input_swap_data(device, (ulong *)&iop, ATA_SECTORWORDS);
 
ident_cpy((unsigned char *) dev_desc->revision, iop.fw_rev,
  sizeof(dev_desc->revision));
@@ -1

[U-Boot] [PATCH 01/10] remove CONFIG_SC3 from cmd_ide.c

2012-10-07 Thread Pavel Herrmann
There is no difference in codepath with CONFIG_SC3 enabled, so just remove it

Signed-off-by: Pavel Herrmann 
---
 common/cmd_ide.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 6e1e568..4b94e23 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -400,9 +400,6 @@ void ide_init(void)
unsigned char c;
int i, bus;
 
-#if defined(CONFIG_SC3)
-   unsigned int ata_reset_time = ATA_RESET_TIME;
-#endif
 #ifdef CONFIG_IDE_8xx_PCCARD
extern int pcmcia_on(void);
extern int ide_devices_found;   /* Initialized in check_ide_device() */
@@ -502,11 +499,7 @@ void ide_init(void)
 
c = ide_inb(dev, ATA_STATUS);
i++;
-#if defined(CONFIG_SC3)
-   if (i > (ata_reset_time * 100)) {
-#else
if (i > (ATA_RESET_TIME * 100)) {
-#endif
puts("** Timeout **\n");
/* LED's off */
ide_led((LED_IDE1 | LED_IDE2), 0);
-- 
1.7.12

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


[U-Boot] [PATCH 00/10] IDE code cleanup

2012-10-07 Thread Pavel Herrmann
This series tries to remove all SoC-specific and board-specific code from
cmd_ide. Whenever an existing hook is present, it is used instead, when no
appropriate hook is present, one is created (either as a hook call or by
using the weak alias technique). The aim of this series is to prepare for
DM conversion, where most of the cmd_ide code will create a new universal
IDE driver, and all hooks and overrides will be provided in its platform data.

note: this series has not been tested on the actual hardware


Pavel Herrmann (10):
  remove CONFIG_SC3 from cmd_ide.c
  split mpc8xx hooks from cmd_ide.c
  split IVM power hooks from cmd_ide.c
  change all versions of input_data() and output_data() to global weak
aliases
  split CPC45 board-specific IDE functions from cmd_ide.c
  make ide_led() a weak alias
  move CPC45 ide_led to the same file as other IDE hooks
  split AU1X00 specific code from cmd_ide.c
  split PCS440EP specific code from cmd_ide.c
  remove unnecessary includes from cmd_ide.c

 arch/mips/cpu/mips32/au1x00/Makefile |   2 +-
 arch/mips/cpu/mips32/au1x00/au1x00_ide.c |  33 +++
 arch/powerpc/lib/Makefile|   1 +
 arch/powerpc/lib/ide.c   | 207 +
 arch/powerpc/lib/ide.h   |  31 ++
 board/cpc45/Makefile |   2 +-
 board/cpc45/cpc45.c  |  15 -
 board/cpc45/ide.c| 145 +
 board/esd/cpci750/ide.c  |   1 -
 board/ivm/ivm.c  |  46 +++
 board/linkstation/ide.c  |   1 -
 board/pcs440ep/pcs440ep.c|  57 +++-
 common/cmd_ide.c | 484 +--
 include/configs/CPC45.h  |   1 +
 include/configs/ICU862.h |   1 +
 include/configs/IVML24.h |   2 +
 include/configs/IVMS8.h  |   2 +
 include/configs/KUP4K.h  |   1 +
 include/configs/KUP4X.h  |   1 +
 include/configs/MBX.h|   1 +
 include/configs/NETTA.h  |   1 +
 include/configs/NSCU.h   |   1 +
 include/configs/R360MPI.h|   1 +
 include/configs/RPXClassic.h |   1 +
 include/configs/RPXlite.h|   1 +
 include/configs/RPXlite_DW.h |   1 +
 include/configs/RRvision.h   |   1 +
 include/configs/SPD823TS.h   |   2 +
 include/configs/TK885D.h |   1 +
 include/configs/TQM823L.h|   1 +
 include/configs/TQM823M.h|   1 +
 include/configs/TQM850L.h|   1 +
 include/configs/TQM850M.h|   1 +
 include/configs/TQM855L.h|   1 +
 include/configs/TQM855M.h|   1 +
 include/configs/TQM860L.h|   1 +
 include/configs/TQM860M.h|   1 +
 include/configs/TQM862L.h|   1 +
 include/configs/TQM862M.h|   1 +
 include/configs/TQM866M.h|   1 +
 include/configs/TQM885D.h|   1 +
 include/configs/atc.h|   1 +
 include/configs/c2mon.h  |   1 +
 include/configs/lwmon.h  |   1 +
 include/configs/quantum.h|   1 +
 include/configs/svm_sc8xx.h  |   2 +
 include/configs/uc100.h  |   1 +
 include/configs/virtlab2.h   |   1 +
 include/ide.h|  19 ++
 49 files changed, 650 insertions(+), 433 deletions(-)
 create mode 100644 arch/mips/cpu/mips32/au1x00/au1x00_ide.c
 create mode 100644 arch/powerpc/lib/ide.c
 create mode 100644 arch/powerpc/lib/ide.h
 create mode 100644 board/cpc45/ide.c

-- 
1.7.12

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


Re: [U-Boot] [PATCH] arm: rmobile: bugfix: wrong register saving in lowlevel_init

2012-10-07 Thread Jeroen Hofstee

Hello All,

On 10/07/2012 01:34 PM, Enric Balletbò i Serra wrote:

Hi Albert,

2012/10/5 Albert ARIBAUD :

Hi Tetsuyuki,

On Fri,  5 Oct 2012 13:39:22 +0900, Tetsuyuki Kobayashi
 wrote:


lowlevel_init() of rmobile badly assumed that ip register holds return address.
The commit "63ee53a7 armv7 cpu_init_crit: Simplify code" breaks this assumption.
This patch removes this bad assumption and simplify code.

Signed-off-by: Tetsuyuki Kobayashi 
---


...

Note that the patch that Tetsuyuki says also breaks SPL support for
OMAP3 boards, at least my IGEP boards doesn't boot and hangs at SPL
level.

   U-Boot SPL 2012.10-rc1-00244-g28e5ac2 (Oct 07 2012 - 13:11:29)

Bisecting the problem I encountered the problem is the commit
"63ee53a7 armv7 cpu_init_crit: Simplify code".

Cheers,
 Enric


I can confirm above. Also the tam3517 som (omap3) fails to boot due to
mentioned commit. The patch from Tetsuyuki is arch specific (rmobile) so
that won't fix the omap case. Reverting the patch, 63ee53a, does help.

Is there anything against reverting the patch (at least for the release...)?

Regards,
Jeroen

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


Re: [U-Boot] [PATCH] fix IDE_BUS(dev) macro

2012-10-07 Thread Tom Rini
On Sun, Oct 7, 2012 at 2:28 AM, Albert ARIBAUD
 wrote:
> Hi ub...@lukaperkov.net,
>
> On Sun, 7 Oct 2012 09:15:52 +0200, ub...@lukaperkov.net wrote:
>
>> Hi Tom, Albert, Prafulla and others,
>>
>> On Tue, Apr 17, 2012 at 09:06:49PM +0200, Luka Perkov wrote:
>> > IDE_BUS assumes that each bus has two devices and thus returns the first
>> > bus even when the second one should be probed.
>> >
>> > Signed-off-by: Simon Baatz 
>> > Tested-by: Luka Perkov 
>> > ---
>> >
>> > Simon discovered this while adding support for new board IB NAS6210.
>> >
>> > More info can be found here:
>> >
>> > http://lists.denx.de/pipermail/u-boot/2012-April/122525.html
>> >
>> > When this is commited I will do a coding style cleanup. There are tabs
>> > after few "#define" parts in include/ide.h.
>> >
>> >  include/ide.h |2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/include/ide.h b/include/ide.h
>> > index 8ecc9dd..385e909 100644
>> > --- a/include/ide.h
>> > +++ b/include/ide.h
>> > @@ -24,7 +24,7 @@
>> >  #ifndef_IDE_H
>> >  #define _IDE_H
>> >
>> > -#defineIDE_BUS(dev)(dev >> 1)
>> > +#define IDE_BUS(dev)   (dev / (CONFIG_SYS_IDE_MAXDEVICE / 
>> > CONFIG_SYS_IDE_MAXBUS))
>> >
>> >  #defineATA_CURR_BASE(dev)  
>> > (CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)])
>> >
>>
>> I have assigned this patch to Tom in patchwork here:
>>
>> http://patchwork.ozlabs.org/patch/159129/
>>
>> From when it was submitted we have got confirmations that this patch
>> does the job for kirkwood boards on the u-boot mailing list:
>>
>> http://lists.denx.de/pipermail/u-boot/2012-April/122684.html
>> http://lists.denx.de/pipermail/u-boot/2012-June/125658.html
>>
>> It would be nice if this patch would enter v2012.10 release. At least
>> someone could pull it into his repo so it can find it's way into master
>> eventually.
>
> As discussed on IRC, there are tests that actually cover the plaforms I
> should have tested myself, so I personally think this can go in 2012.10.

OK, I'll pick this up Monday, thanks.

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


[U-Boot] [PATCH] EXYNOS: EXYNOS4X12: extract Exynos4x12 IPs clock frequency

2012-10-07 Thread Chander Kashyap
Adds functions to extract clock frequency of Exynos4x12 IPs.

Signed-off-by: Chander Kashyap 
---
 arch/arm/cpu/armv7/exynos/clock.c |  163 +++--
 1 file changed, 158 insertions(+), 5 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/clock.c 
b/arch/arm/cpu/armv7/exynos/clock.c
index a042423..012beab 100644
--- a/arch/arm/cpu/armv7/exynos/clock.c
+++ b/arch/arm/cpu/armv7/exynos/clock.c
@@ -100,6 +100,36 @@ static unsigned long exynos4_get_pll_clk(int pllreg)
return exynos_get_pll_clk(pllreg, r, k);
 }
 
+/* exynos4x12: return pll clock frequency */
+static unsigned long exynos4x12_get_pll_clk(int pllreg)
+{
+   struct exynos4x12_clock *clk =
+   (struct exynos4x12_clock *)samsung_get_base_clock();
+   unsigned long r, k = 0;
+
+   switch (pllreg) {
+   case APLL:
+   r = readl(&clk->apll_con0);
+   break;
+   case MPLL:
+   r = readl(&clk->mpll_con0);
+   break;
+   case EPLL:
+   r = readl(&clk->epll_con0);
+   k = readl(&clk->epll_con1);
+   break;
+   case VPLL:
+   r = readl(&clk->vpll_con0);
+   k = readl(&clk->vpll_con1);
+   break;
+   default:
+   printf("Unsupported PLL (%d)\n", pllreg);
+   return 0;
+   }
+
+   return exynos_get_pll_clk(pllreg, r, k);
+}
+
 /* exynos5: return pll clock frequency */
 static unsigned long exynos5_get_pll_clk(int pllreg)
 {
@@ -181,6 +211,28 @@ static unsigned long exynos4_get_arm_clk(void)
return armclk;
 }
 
+/* exynos4x12: return ARM clock frequency */
+static unsigned long exynos4x12_get_arm_clk(void)
+{
+   struct exynos4x12_clock *clk =
+   (struct exynos4x12_clock *)samsung_get_base_clock();
+   unsigned long div;
+   unsigned long armclk;
+   unsigned int core_ratio;
+   unsigned int core2_ratio;
+
+   div = readl(&clk->div_cpu0);
+
+   /* CORE_RATIO: [2:0], CORE2_RATIO: [30:28] */
+   core_ratio = (div >> 0) & 0x7;
+   core2_ratio = (div >> 28) & 0x7;
+
+   armclk = get_pll_clk(APLL) / (core_ratio + 1);
+   armclk /= (core2_ratio + 1);
+
+   return armclk;
+}
+
 /* exynos5: return ARM clock frequency */
 static unsigned long exynos5_get_arm_clk(void)
 {
@@ -246,6 +298,20 @@ static unsigned long exynos4_get_pwm_clk(void)
return pclk;
 }
 
+/* exynos4x12: return pwm clock frequency */
+static unsigned long exynos4x12_get_pwm_clk(void)
+{
+   unsigned long pclk, sclk;
+   unsigned int ratio;
+
+   sclk = get_pll_clk(MPLL);
+   ratio = 8;
+
+   pclk = sclk / (ratio + 1);
+
+   return pclk;
+}
+
 /* exynos5: return pwm clock frequency */
 static unsigned long exynos5_get_pwm_clk(void)
 {
@@ -314,6 +380,51 @@ static unsigned long exynos4_get_uart_clk(int dev_index)
return uclk;
 }
 
+/* exynos4x12: return uart clock frequency */
+static unsigned long exynos4x12_get_uart_clk(int dev_index)
+{
+   struct exynos4x12_clock *clk =
+   (struct exynos4x12_clock *)samsung_get_base_clock();
+   unsigned long uclk, sclk;
+   unsigned int sel;
+   unsigned int ratio;
+
+   /*
+* CLK_SRC_PERIL0
+* UART0_SEL [3:0]
+* UART1_SEL [7:4]
+* UART2_SEL [8:11]
+* UART3_SEL [12:15]
+* UART4_SEL [16:19]
+*/
+   sel = readl(&clk->src_peril0);
+   sel = (sel >> (dev_index << 2)) & 0xf;
+
+   if (sel == 0x6)
+   sclk = get_pll_clk(MPLL);
+   else if (sel == 0x7)
+   sclk = get_pll_clk(EPLL);
+   else if (sel == 0x8)
+   sclk = get_pll_clk(VPLL);
+   else
+   return 0;
+
+   /*
+* CLK_DIV_PERIL0
+* UART0_RATIO [3:0]
+* UART1_RATIO [7:4]
+* UART2_RATIO [8:11]
+* UART3_RATIO [12:15]
+* UART4_RATIO [16:19]
+*/
+   ratio = readl(&clk->div_peril0);
+   ratio = (ratio >> (dev_index << 2)) & 0xf;
+
+   uclk = sclk / (ratio + 1);
+
+   return uclk;
+}
+
 /* exynos5: return uart clock frequency */
 static unsigned long exynos5_get_uart_clk(int dev_index)
 {
@@ -388,6 +499,33 @@ static void exynos4_set_mmc_clk(int dev_index, unsigned 
int div)
writel(val, addr);
 }
 
+/* exynos4x12: set the mmc clock */
+static void exynos4x12_set_mmc_clk(int dev_index, unsigned int div)
+{
+   struct exynos4x12_clock *clk =
+   (struct exynos4x12_clock *)samsung_get_base_clock();
+   unsigned int addr;
+   unsigned int val;
+
+   /*
+* CLK_DIV_FSYS1
+* MMC0_PRE_RATIO [15:8], MMC1_PRE_RATIO [31:24]
+* CLK_DIV_FSYS2
+* MMC2_PRE_RATIO [15:8], MMC3_PRE_RATIO [31:24]
+*/
+   if (dev_index < 2) {
+   addr = (unsigned int)&clk->div_fsys1;
+   } else {
+   addr = (unsigned int)&clk->div_fsys2;
+   dev_index -= 2;
+   }
+
+  

Re: [U-Boot] [PATCH] arm: rmobile: bugfix: wrong register saving in lowlevel_init

2012-10-07 Thread Enric Balletbò i Serra
Hi Albert,

2012/10/5 Albert ARIBAUD :
> Hi Tetsuyuki,
>
> On Fri,  5 Oct 2012 13:39:22 +0900, Tetsuyuki Kobayashi
>  wrote:
>
>> lowlevel_init() of rmobile badly assumed that ip register holds return 
>> address.
>> The commit "63ee53a7 armv7 cpu_init_crit: Simplify code" breaks this 
>> assumption.
>> This patch removes this bad assumption and simplify code.
>>
>> Signed-off-by: Tetsuyuki Kobayashi 
>> ---
>> Hello, Albert
>> Hello, Tom
>> Thank you for merging my patches.
>>
>> I checked current u-boot-master and found kzm9g board fails to boot because 
>> bug.
>> This bugfix patch solves it.
>> I think 2012.10 release should have this bugfix.
>>
>> Iwamatsu-san, could you double check this patch?
>>
>>
>>  arch/arm/cpu/armv7/rmobile/lowlevel_init.S |   12 +---
>>  1 file changed, 1 insertion(+), 11 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv7/rmobile/lowlevel_init.S 
>> b/arch/arm/cpu/armv7/rmobile/lowlevel_init.S
>> index 1bd391e..4fdca06 100644
>> --- a/arch/arm/cpu/armv7/rmobile/lowlevel_init.S
>> +++ b/arch/arm/cpu/armv7/rmobile/lowlevel_init.S
>> @@ -76,17 +76,7 @@ loop0:
>>   bne  loop0
>>
>>   ldr sp, MERAM_STACK
>
> Is this load of sp still needed?
>
>> - str ip, [sp]/* stash old link register */
>> - mov ip, lr  /* save link reg across call */
>> -
>> - bl  s_init
>> -
>> - ldr ip, [sp]/* restore save ip */
>> - mov lr, ip  /* restore link reg */
>> -
>> - /* back to arch calling code */
>> - mov pc, lr
>> + b s_init
>>
>>   .pool
>>   .align 4
>
> Amicalement,
> --
> Albert.
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

Note that the patch that Tetsuyuki says also breaks SPL support for
OMAP3 boards, at least my IGEP boards doesn't boot and hangs at SPL
level.

  U-Boot SPL 2012.10-rc1-00244-g28e5ac2 (Oct 07 2012 - 13:11:29)

Bisecting the problem I encountered the problem is the commit
"63ee53a7 armv7 cpu_init_crit: Simplify code".

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


[U-Boot] [PATCH 1/2] cm-t35: clean unused defines from config

2012-10-07 Thread Igor Grinberg
Neither cm-t35, nor cm-t3730 is using OneNAND or flash.
Remove the related defines from config file.

Signed-off-by: Igor Grinberg 
---
 include/configs/cm_t35.h |   12 +---
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index 46c556d..8e28fbc 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -289,25 +289,15 @@
  */
 
 /*  PISMO SUPPORT *** */
-
 /* Configure the PISMO */
 #define PISMO1_NAND_SIZE   GPMC_SIZE_128M
-#define PISMO1_ONEN_SIZE   GPMC_SIZE_128M
-
-#define CONFIG_SYS_MONITOR_LEN (256 << 10) /* Reserve 2 sectors */
-
-#if defined(CONFIG_CMD_NAND)
-#define CONFIG_SYS_FLASH_BASE  PISMO1_NAND_BASE
-#endif
 
 /* Monitor at start of flash */
 #define CONFIG_SYS_MONITOR_BASECONFIG_SYS_FLASH_BASE
-#define CONFIG_SYS_ONENAND_BASEONENAND_MAP
+#define CONFIG_SYS_MONITOR_LEN (256 << 10) /* Reserve 2 sectors */
 
 #define CONFIG_ENV_IS_IN_NAND
-#define ONENAND_ENV_OFFSET 0x26 /* environment starts here */
 #define SMNAND_ENV_OFFSET  0x26 /* environment starts here */
-
 #define CONFIG_ENV_OFFSET  SMNAND_ENV_OFFSET
 #define CONFIG_ENV_ADDRSMNAND_ENV_OFFSET
 
-- 
1.7.3.4

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


[U-Boot] [PATCH 2/2] cm-t35: increase the MAXARGS

2012-10-07 Thread Igor Grinberg
Increase the MAXARGS to support more than 16 arguments.

Signed-off-by: Igor Grinberg 
---
 include/configs/cm_t35.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index 8e28fbc..e18fb5a 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -256,7 +256,7 @@
 /* Print Buffer Size */
 #define CONFIG_SYS_PBSIZE  (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
-#define CONFIG_SYS_MAXARGS 16  /* max number of command args */
+#define CONFIG_SYS_MAXARGS 32  /* max number of command args */
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZE(CONFIG_SYS_CBSIZE)
 
-- 
1.7.3.4

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


[U-Boot] [PATCH 0/2] cm-t3x: minor config updates and cleanups

2012-10-07 Thread Igor Grinberg
Remove OneNAND and flash related defines.
Increase the MAXARGS value.

Igor Grinberg (2):
  cm-t35: clean unused defines from config
  cm-t35: increase the MAXARGS

 include/configs/cm_t35.h |   14 ++
 1 files changed, 2 insertions(+), 12 deletions(-)

-- 
1.7.3.4

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


Re: [U-Boot] [PATCH] fix IDE_BUS(dev) macro

2012-10-07 Thread Albert ARIBAUD
Hi ub...@lukaperkov.net,

On Sun, 7 Oct 2012 09:15:52 +0200, ub...@lukaperkov.net wrote:

> Hi Tom, Albert, Prafulla and others,
> 
> On Tue, Apr 17, 2012 at 09:06:49PM +0200, Luka Perkov wrote:
> > IDE_BUS assumes that each bus has two devices and thus returns the first
> > bus even when the second one should be probed.
> > 
> > Signed-off-by: Simon Baatz 
> > Tested-by: Luka Perkov 
> > ---
> > 
> > Simon discovered this while adding support for new board IB NAS6210.
> > 
> > More info can be found here:
> > 
> > http://lists.denx.de/pipermail/u-boot/2012-April/122525.html
> > 
> > When this is commited I will do a coding style cleanup. There are tabs
> > after few "#define" parts in include/ide.h.
> > 
> >  include/ide.h |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/ide.h b/include/ide.h
> > index 8ecc9dd..385e909 100644
> > --- a/include/ide.h
> > +++ b/include/ide.h
> > @@ -24,7 +24,7 @@
> >  #ifndef_IDE_H
> >  #define _IDE_H
> >  
> > -#defineIDE_BUS(dev)(dev >> 1)
> > +#define IDE_BUS(dev)   (dev / (CONFIG_SYS_IDE_MAXDEVICE / 
> > CONFIG_SYS_IDE_MAXBUS))
> >  
> >  #defineATA_CURR_BASE(dev)  
> > (CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)])
> >  
> 
> I have assigned this patch to Tom in patchwork here:
> 
> http://patchwork.ozlabs.org/patch/159129/
> 
> From when it was submitted we have got confirmations that this patch
> does the job for kirkwood boards on the u-boot mailing list:
> 
> http://lists.denx.de/pipermail/u-boot/2012-April/122684.html
> http://lists.denx.de/pipermail/u-boot/2012-June/125658.html
> 
> It would be nice if this patch would enter v2012.10 release. At least
> someone could pull it into his repo so it can find it's way into master
> eventually.

As discussed on IRC, there are tests that actually cover the plaforms I
should have tested myself, so I personally think this can go in 2012.10.

> Regards,
> Luka

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


Re: [U-Boot] [PATCH] fix IDE_BUS(dev) macro

2012-10-07 Thread uboot
Hi Tom, Albert, Prafulla and others,

On Tue, Apr 17, 2012 at 09:06:49PM +0200, Luka Perkov wrote:
> IDE_BUS assumes that each bus has two devices and thus returns the first
> bus even when the second one should be probed.
> 
> Signed-off-by: Simon Baatz 
> Tested-by: Luka Perkov 
> ---
> 
> Simon discovered this while adding support for new board IB NAS6210.
> 
> More info can be found here:
> 
> http://lists.denx.de/pipermail/u-boot/2012-April/122525.html
> 
> When this is commited I will do a coding style cleanup. There are tabs
> after few "#define" parts in include/ide.h.
> 
>  include/ide.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/ide.h b/include/ide.h
> index 8ecc9dd..385e909 100644
> --- a/include/ide.h
> +++ b/include/ide.h
> @@ -24,7 +24,7 @@
>  #ifndef  _IDE_H
>  #define _IDE_H
>  
> -#define  IDE_BUS(dev)(dev >> 1)
> +#define IDE_BUS(dev) (dev / (CONFIG_SYS_IDE_MAXDEVICE / 
> CONFIG_SYS_IDE_MAXBUS))
>  
>  #define  ATA_CURR_BASE(dev)  
> (CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)])
>  

I have assigned this patch to Tom in patchwork here:

http://patchwork.ozlabs.org/patch/159129/

>From when it was submitted we have got confirmations that this patch
does the job for kirkwood boards on the u-boot mailing list:

http://lists.denx.de/pipermail/u-boot/2012-April/122684.html
http://lists.denx.de/pipermail/u-boot/2012-June/125658.html

It would be nice if this patch would enter v2012.10 release. At least
someone could pull it into his repo so it can find it's way into master
eventually.

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