Re: [U-Boot] [PATCH 1/4] spi_nor: add m25p32 spi nor driver

2012-08-15 Thread Lv Terry-R65388
Sorry for that I don't know m25p32 spi nor supported in stmicro.
I've thought that this might be a new driver for new chips.

That's ok. Then I'll summit mx53smd spi nor patches with stmicro.

-Original Message-
From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On 
Behalf Of Mike Frysinger
Sent: 2012?8?14? 23:53
To: u-boot@lists.denx.de; r65...@shlinux3.net
Subject: Re: [U-Boot] [PATCH 1/4] spi_nor: add m25p32 spi nor driver

On Tuesday 14 August 2012 06:58:31 Terry Lv wrote:
 This driver is ported from kernel and can handle a series of spi nor 
 flash including m25pxx, m45pxx, w25xxx, cat25xxx, sst25vf0xxx, 
 sst25wfxxx, s25xxx, mx25xxx, at25xxx, at26xxx, en25xxx, xxxs33b.

it doesn't make much sense to add a driver which duplicates all the existing 
ones.  long term, we should look at migrating to the linux driver i think (if 
we can make it work), but i don't think this port is exactly the way.
-mike

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


Re: [U-Boot] dwc_ahsata vs ahci

2012-07-30 Thread Lv Terry-R65388
Hi Pavel,

The ahci.c is a ahci driver using pci interface, while dwc_asata is not.

 u-boot don't have a pure ahci driver now, thus we have to reuse some 
ahci parts from ahci.c in dwc_asata.c.

Thanks~~ 

Yours
Terry

-Original Message-
From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On 
Behalf Of Stefano Babic
Sent: 2012?7?29? 14:56
To: Pavel Herrmann
Cc: u-boot@lists.denx.de; u-boot...@lists.denx.de
Subject: Re: [U-Boot] dwc_ahsata vs ahci

On 28/07/2012 15:44, Pavel Herrmann wrote:
 Hi,
 

Hi Pavel,

 While working on the DM project, I found out that there are two 
 implementations of AHCI drivers - one in block/ahci.c, one in 
 block/dwc_ahsata.c
 


ooopppss !

 what is the difference between them (apart from the obvious, ahci.c 
 exposes SCSI API, dwc_ahsata exposes SATA API)? are there any problems 
 that would prevent me from merging them?

No, there are not evident reasons !

dwc_asata was inserted to add SATA support for Freescale MX5 family, and I 
missed that a similar driver was already in u-boot. dwc_ahsata was ported from 
Freescale's u-boot, and linked only for MX5 / MX6 SOCs. I think it is a very 
good idea to merge the two drivers (dwc_ahsata seems an updated version of the 
original driver), thanks to note this !

Best regards,
Stefano Babic

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


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


[U-Boot] How to handle binary data file in u-boot

2010-07-28 Thread Lv Terry-R65388
Hi Experts,
 
We have implemented an display utilty in u-boot and this utlity
needs a waveform file.
 
We are planning to release this display utility, but we don't know
how to do with the waveform file. The file is as large as 800KB.
 
Now we just put the waveform file on mmc and read it out in boot.
 
Is there any better way to deliver this binary waveform file as part
of the bootloader?
How is this case  typically handled?
 
Thanks in advance.
 
Yours
Terry
 
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Enabling ARM DCache (and MMU setup) in U-Boot

2010-07-04 Thread Lv Terry-R65388
 Hi Rasha,

As I know, u-boot has a weak support on mmu and cache.

We have enabled mmu and dcache in our u-boot version.
But I don't know what your case is.

So I can just give you some suggestions.

1. mmu and dcache should be enabled very early, for example, in start.S 
or lowlevel_init.S.
2. Although functions in cache-cp15.c are inlined, they will be 
compiled as functions if you use them.
   So you may need to modify cache-cp15.c to cache-cp15.h and modify 
inline functions to macros.
3. Add flush_cache functions. This function is needed in funcion 
cleanup_before_linux() in cpu.c.

Thanks~~

Yours
Terry

 -Original Message-
 From: u-boot-boun...@lists.denx.de 
 [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Rasha Eqbal
 Sent: 2010年7月1日 23:35
 To: u-boot@lists.denx.de
 Subject: Re: [U-Boot] Enabling ARM DCache (and MMU setup) in U-Boot
 
 Hi,
 
 I am having exactly the same problem as described here by 
 Drasko. Once I enable MMU on ARM920T by setting the cp15 
 register 1, I get a data abort.
 Since the previous messages were posted a long time back, I 
 was hoping someone has been able to find a solution to the 
 problem. I am trying to setup MMU.
 
 Any help would be greatly appreciated.
 
 Thanks a lot in advance.
 Rasha
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-17 Thread Lv Terry-R65388
Hi,

I've just send v6 version for review which fixes the coding-style 
problems.

Thanks~~

Yours
Terry 

 -Original Message-
 From: Stefano Babic [mailto:sba...@denx.de] 
 Sent: 2010年5月14日 19:41
 To: Alagu Sankar
 Cc: Stefano Babic; Sudhakar Rajashekhara; 
 u-boot@lists.denx.de; Lv Terry-R65388
 Subject: Re: [U-Boot] [PATCH 4/4] Environment in MMC
 
 Alagu Sankar wrote:
 

  When I searched for the Environment support in MMC, I came across 
  Terry's earlier patches, but they were not cleanly getting 
 applied to 
  the current tree.
 
 I have tried to apply again last Terry's patch, I see only a 
 couple of coding-style problems, no errors at all:
 
 Applying: Save environment data to mmc.
 /home/stefano/Projects/imx/u-boot-imx/.git/rebase-apply/patch:21:
 trailing whitespace.
  * Thus It is required that operations like pin multiplexer
 /home/stefano/Projects/imx/u-boot-imx/.git/rebase-apply/patch:54:
 trailing whitespace.
  * Thus It is required that operations like pin multiplexer
 warning: 2 lines add whitespace errors.
 
   There is no value add here except fixing the patch errors and 
  generating a new patch for the current tree.
 
 Probably not needed. I have not seen the errors you reported. 
 Are you sure you have tested with Terry's last patch ? It 
 seems you submit an earlier version.
 
   So there is no
  question of adding any copyright here.
 
 Yes, Wolfgang has already answered. No need to add a 
 copyright for small patches.
 
 Best regards,
 Stefano Babic
 
 --
 =
 DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: 
 off...@denx.de 
 =
 
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Does anyone know how to use FIT uImage

2010-05-17 Thread Lv Terry-R65388
Hi, experts,
 
I've encountered an error in making FIT uImage.
 
I created an fsl_kernel.its file and run mkimage -f fsl_kernel.its
kernel.itb, the following error happened.
 
r65...@szx32-17:~/uboot-v2009.08/uboot-imx$ mkimage -f
fsl_kernel.its kernel.itb
FIT format handling
Trying to execute dtc -I dts -O dtb -p 500 fsl_kernel.its 
kernel.itb.tmp
DTC: dts-dtb  on file fsl_kernel.its
Error: fsl_kernel.its:4.1-2 syntax error
FATAL ERROR: Unable to parse input tree
mkimage: Can't read kernel.itb.tmp: Invalid argument
 
The fsl_kernel.its file is:
 
r65...@szx32-17:~/uboot-v2009.08/uboot-imx$ cat ./fsl_kernel.its
/*
 * Simple U-boot uImage source file containing a single kernel
 */
/ {
 description = Simple image with single Linux kernel;
 #address-cells = 1;
 
 images {
  ker...@1 {
   description = Freescale Linux kernel;
   data = /incbin/(./vmlinux);
   type = kernel;
   arch = arm;
   os = linux;
   compression = none;
   load = 70008000;
   entry = 70008000;
  };
 };
 
 configurations {
  default = con...@1;
  con...@1 {
   description = Boot Linux kernel;
   kernel = ker...@1;
  };
 };
};
 
Does anyone know what the problem is?
 
Thanks in advance.
 
Yours
Terry
 
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-13 Thread Lv Terry-R65388
Hi Alagu Sankar,

Pls use my latest v5 patch for saving environment data to mmc.

Thanks~~

Yours
Terry 

 -Original Message-
 From: u-boot-boun...@lists.denx.de 
 [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Alagu Sankar
 Sent: 2010年5月12日 17:38
 To: u-boot@lists.denx.de
 Subject: [U-Boot] [PATCH 4/4] Environment in MMC
 
 This patch is to save environment data to mmc card. It uses 
 interfaces defined in generic MMC framework.  This is enabled 
 with CONFIG_ENV_IS_IN_MMC option.
 Based on the earlier patch from Terry Lv at Freescale
 
 Signed-off-by: Alagu Sankar alagusan...@embwise.com
 ---
  arch/arm/lib/board.c |   10 ++--
  arch/powerpc/lib/board.c |   12 ++--
  common/Makefile  |1 +
  common/cmd_nvedit.c  |3 +-
  common/env_mmc.c |  168 
 ++
  include/environment.h|   18 +
  6 files changed, 200 insertions(+), 12 deletions(-)  create 
 mode 100644 common/env_mmc.c
 
 diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c 
 index f5660a9..5e7558e 100644
 --- a/arch/arm/lib/board.c
 +++ b/arch/arm/lib/board.c
 @@ -338,6 +338,11 @@ void start_armboot (void)
   nand_init();/* go init the NAND */
  #endif
  
 +#ifdef CONFIG_GENERIC_MMC
 + puts (MMC:   );
 + mmc_initialize (gd-bd);
 +#endif
 +
  #if defined(CONFIG_CMD_ONENAND)
   onenand_init();
  #endif
 @@ -419,11 +424,6 @@ extern void davinci_eth_set_mac_addr 
 (const u_int8_t *addr);
   board_late_init ();
  #endif
  
 -#ifdef CONFIG_GENERIC_MMC
 - puts (MMC:   );
 - mmc_initialize (gd-bd);
 -#endif
 -
  #ifdef CONFIG_BITBANGMII
   bb_miiphy_init();
  #endif
 diff --git a/arch/powerpc/lib/board.c 
 b/arch/powerpc/lib/board.c index 7b09fb5..1008635 100644
 --- a/arch/powerpc/lib/board.c
 +++ b/arch/powerpc/lib/board.c
 @@ -783,6 +783,12 @@ void board_init_r (gd_t *id, ulong dest_addr)
   nand_init();/* go init the NAND */
  #endif
  
 +#ifdef CONFIG_GENERIC_MMC
 + WATCHDOG_RESET ();
 + puts (MMC:  );
 + mmc_initialize (bd);
 +#endif
 +
   /* relocate environment function pointers etc. */
   env_relocate ();
  
 @@ -939,12 +945,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
   scsi_init ();
  #endif
  
 -#ifdef CONFIG_GENERIC_MMC
 - WATCHDOG_RESET ();
 - puts (MMC:  );
 - mmc_initialize (bd);
 -#endif
 -
  #if defined(CONFIG_CMD_DOC)
   WATCHDOG_RESET ();
   puts (DOC:   );
 diff --git a/common/Makefile b/common/Makefile index 
 dbf7a05..2c37073 100644
 --- a/common/Makefile
 +++ b/common/Makefile
 @@ -58,6 +58,7 @@ COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
  COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
  COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
  COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
 +COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
  COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
  COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
  COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o diff 
 --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 
 eb89e9e..27e46f7 100644
 --- a/common/cmd_nvedit.c
 +++ b/common/cmd_nvedit.c
 @@ -63,9 +63,10 @@ DECLARE_GLOBAL_DATA_PTR;
  !defined(CONFIG_ENV_IS_IN_NVRAM)  \
  !defined(CONFIG_ENV_IS_IN_ONENAND)\
  !defined(CONFIG_ENV_IS_IN_SPI_FLASH)  \
 +!defined(CONFIG_ENV_IS_IN_MMC)\
  !defined(CONFIG_ENV_IS_NOWHERE)
  # error Define one of 
 CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
 -SPI_FLASH|MG_DISK|NVRAM|NOWHERE}
 +SPI_FLASH|MG_DISK|NVRAM|MMC|NOWHERE}
  #endif
  
  #define XMK_STR(x)   #x
 diff --git a/common/env_mmc.c b/common/env_mmc.c new file 
 mode 100644 index 000..ef7e5fb
 --- /dev/null
 +++ b/common/env_mmc.c
 @@ -0,0 +1,168 @@
 +/*
 + * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
 + * (C) Copyright 2000-2006
 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
 + *
 + * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH 
 www.elinos.com
 + * Andreas Heppel ahep...@sysgo.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
 + */
 +
 +/* #define DEBUG */
 +
 +#include common.h
 +
 +#include command.h
 +#include environment.h
 

Re: [U-Boot] [PATCH 3/4] MMC Multi-block Support

2010-05-13 Thread Lv Terry-R65388
Hi,

Personally I think this patch can be used as common. CONFIG_MMC_MBLOCK 
is not needed.
It can improve performance a lot for generic mmc.

Thanks~~

Yours
Terry 

 -Original Message-
 From: u-boot-boun...@lists.denx.de 
 [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Alagu Sankar
 Sent: 2010年5月12日 17:43
 To: u-boot@lists.denx.de
 Subject: [U-Boot] [PATCH 3/4] MMC Multi-block Support
 
 Added Multi-Block Read support for Generic MMC. Modified 
 existing multi-block write to limit the maximum number of 
 blocks per transfer.  This feature is enabled with 
 CONFIG_MMC_MBLOCK option.  A new member is added in the mmc 
 structure for the host controller to specify the maximum 
 number of blocks it supports.
 
 Signed-off-by: Alagu Sankar alagusan...@embwise.com
 ---
  drivers/mmc/mmc.c |  156 
 +
  include/mmc.h |3 +
  2 files changed, 159 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 
 e7abf94..3f5a200 100644
 --- a/drivers/mmc/mmc.c
 +++ b/drivers/mmc/mmc.c
 @@ -77,6 +77,7 @@ struct mmc *find_mmc_device(int dev_num)
   return NULL;
  }
  
 +#ifndef CONFIG_MMC_MBLOCK
  static ulong
  mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const 
 void*src)  { @@ -238,6 +239,156 @@ static ulong mmc_bread(int 
 dev_num, ulong start, lbaint_t blkcnt, void *dst)
   return blkcnt;
  }
  
 +#else
 +
 +static int mmc_write_blocks(struct mmc *mmc, const char 
 *src, uint start,
 + uint blkcnt)
 +{
 + struct mmc_cmd cmd;
 + struct mmc_data data;
 + int err;
 + int blklen;
 +
 + blklen = mmc-write_bl_len;
 +
 + err = mmc_set_blocklen(mmc, mmc-write_bl_len);
 +
 + if (err) {
 + printf(set write bl len failed\n\r);
 + return err;
 + }
 +
 + if (blkcnt  1)
 + cmd.cmdidx = MMC_CMD_WRITE_MULTIPLE_BLOCK;
 + else
 + cmd.cmdidx = MMC_CMD_WRITE_SINGLE_BLOCK;
 +
 + if (mmc-high_capacity)
 + cmd.cmdarg = start;
 + else
 + cmd.cmdarg = start * blklen;
 +
 + cmd.resp_type = MMC_RSP_R1;
 + cmd.flags = 0;
 +
 + data.src = src;
 + data.blocks = blkcnt;
 + data.blocksize = blklen;
 + data.flags = MMC_DATA_WRITE;
 +
 + err = mmc_send_cmd(mmc, cmd, data);
 +
 + if (err) {
 + printf(mmc write failed\n\r);
 + return err;
 + }
 +
 + if (blkcnt  1) {
 + cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION;
 + cmd.cmdarg = 0;
 + cmd.resp_type = MMC_RSP_R1b;
 + cmd.flags = 0;
 + err = mmc_send_cmd(mmc, cmd, NULL);
 + }
 +
 + return err;
 +}
 +
 +static ulong
 +mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const 
 void *src) 
 +{
 + int err;
 + int i;
 + struct mmc *mmc = find_mmc_device(dev_num);
 + uint b_max = mmc-b_max;
 +
 + if (!mmc)
 + return 0;
 +
 + for (i = blkcnt; i  0; i -= b_max) {
 + uint blocks = (i  b_max) ? b_max : i;
 +
 + err = mmc_write_blocks(mmc, src, start, blocks);
 + if (err)
 + return blkcnt - i;
 + start += blocks;
 + src += (mmc-write_bl_len * blocks);
 + }
 +
 + return blkcnt;
 +}
 +
 +int mmc_read_blocks(struct mmc *mmc, void *dst, uint blocknum, uint 
 +blkcnt) {
 + int err;
 + struct mmc_cmd cmd;
 + struct mmc_data data;
 +
 + if (blkcnt  1)
 + cmd.cmdidx = MMC_CMD_READ_MULTIPLE_BLOCK;
 + else
 + cmd.cmdidx = MMC_CMD_READ_SINGLE_BLOCK;
 +
 + if (mmc-high_capacity)
 + cmd.cmdarg = blocknum;
 + else
 + cmd.cmdarg = blocknum * mmc-read_bl_len;
 +
 + cmd.resp_type = MMC_RSP_R1;
 + cmd.flags = 0;
 +
 + data.dest = dst;
 + data.blocks = blkcnt;
 + data.blocksize = mmc-read_bl_len;
 + data.flags = MMC_DATA_READ;
 +
 + err = mmc_send_cmd(mmc, cmd, data);
 + if (err)
 + return err;
 +
 + if (blkcnt  1) {
 + cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION;
 + cmd.cmdarg = 0;
 + cmd.resp_type = MMC_RSP_R1b;
 + cmd.flags = 0;
 + err = mmc_send_cmd(mmc, cmd, NULL);
 + }
 +
 + return err;
 +}
 +
 +static ulong mmc_bread(int dev_num, ulong start, lbaint_t 
 blkcnt, void 
 +*dst) {
 + int err;
 + int i;
 + struct mmc *mmc = find_mmc_device(dev_num);
 + uint b_max = mmc-b_max;
 +
 + if (!mmc)
 + return 0;
 +
 + /* We always do full block reads from the card */
 + err = mmc_set_blocklen(mmc, mmc-read_bl_len);
 + if (err)
 + return 0;
 +
 + for (i = blkcnt; i  0; i -= b_max) {
 + uint blocks = (i  b_max) ? b_max : i;
 +
 + err = mmc_read_blocks(mmc, dst, start, blocks);
 + if (err) {
 + printf(block read failed: 

Re: [U-Boot] [PATCH] [PATCH V4]Save environment data to mmc.

2010-05-06 Thread Lv Terry-R65388
Hi Wolfgang Denk,

Though a block offset macros is more suitable for a block device, block 
size can be changed.
Thus I think a size offset is better to describe the offset.

What do you think?

Thanks~~

Yours
Terry 

-Original Message-
From: Wolfgang Denk [mailto:w...@denx.de] 
Sent: 2010年5月7日 6:22
To: Lv Terry-R65388
Cc: u-boot@lists.denx.de
Subject: Re: [U-Boot] [PATCH] [PATCH V4]Save environment data to mmc.

Dear Terry Lv,

In message 12730401491046-git-send-email-r65...@freescale.com you wrote:
 This patch is to save environment data to mmc card.
 It uses interfaces defined in generic mmc.
 
 Signed-off-by: Terry Lv r65...@freescale.com
 ---
  arch/arm/lib/board.c |   14 +++--
  arch/powerpc/lib/board.c |   16 +++--
  common/Makefile  |1 +
  common/cmd_nvedit.c  |3 +-
  common/env_mmc.c |  154 
 ++
  5 files changed, 176 insertions(+), 12 deletions(-)  create mode 
 100644 common/env_mmc.c
 
 diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 
 f5660a9..b7174ea 100644
 --- a/arch/arm/lib/board.c
 +++ b/arch/arm/lib/board.c
 @@ -347,6 +347,15 @@ void start_armboot (void)
   dataflash_print_info();
  #endif
  
 +#ifdef CONFIG_GENERIC_MMC
 +/* MMC initialization is called before relocating env.
 +   Thus It is required that operations like pin multiplexer 
 +   be put in board_init.
 +*/

Incorrect multiline comment style. Please fix globally.


 diff --git a/common/env_mmc.c b/common/env_mmc.c new file mode 100644 
 index 000..c9a9415
 --- /dev/null
 +++ b/common/env_mmc.c

Hm... I see a tendency to add more and more such files that all deal
with one sort of a block oriented storage device or another.  Should
we not try to generalize this?

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
My play was a complete success.  The audience was a failure.

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


Re: [U-Boot] [PATCH] Save environment data to mmc.

2010-04-29 Thread Lv Terry-R65388
Hi Babic,

Pls check my comments with keyword [Ty].

Thanks for reviewing the patch.

Thanks~~

Yours
Terry

-Original Message-
From: Stefano Babic [mailto:sba...@denx.de] 
Sent: 2010年4月29日 22:34
To: Lv Terry-R65388
Cc: u-boot@lists.denx.de
Subject: Re: [U-Boot] [PATCH] Save environment data to mmc.

Terry Lv wrote:
 This patch is to save environment data to mmc card.
 It uses interfaces defined in generic mmc.

Hi Terry,

 
 Signed-off-by: Terry Lv r65...@freescale.com
 ---
  arch/arm/lib/board.c |   10 ++--
  arch/powerpc/lib/board.c |   12 ++--
  common/Makefile  |1 +
  common/cmd_nvedit.c  |1 +
  common/env_mmc.c |  154 
 ++
  5 files changed, 167 insertions(+), 11 deletions(-)  create mode 
 100644 common/env_mmc.c

Could you set a version of your patch (something like [PATCH V*] in the 
subject, so it is easier to track changes ? This is the third version, but it 
is difficult to get it without searching in archive.
[Ty]: OK, I will do that, thanks, :-)

 
 diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 
 f5660a9..f62e0eb 100644
 --- a/arch/arm/lib/board.c
 +++ b/arch/arm/lib/board.c
 @@ -347,6 +347,11 @@ void start_armboot (void)
   dataflash_print_info();
  #endif
  
 +#ifdef CONFIG_GENERIC_MMC
 + puts (MMC:   );
 + mmc_initialize (gd-bd);
 +#endif
 +
   /* initialize environment */
   env_relocate ();
  
 @@ -419,11 +424,6 @@ extern void davinci_eth_set_mac_addr (const u_int8_t 
 *addr);
   board_late_init ();
  #endif
  
 -#ifdef CONFIG_GENERIC_MMC
 - puts (MMC:   );
 - mmc_initialize (gd-bd);
 -#endif
 -
  #ifdef CONFIG_BITBANGMII
   bb_miiphy_init();
  #endif

Because it is required to move the initialization of the mmc before 
env_relocate(), we need probably to advise that there are some consequences. If 
someone implements the mmc support in board_late_init() (setting a pin 
multiplexer or something like that, for example), it does not work. I think we 
should at least write a comment to advise that the mmc/sd controller should 
work after board_init() is called.
However, after a quick check in the arm boards, I have not found a board that 
is initializing the mmc controller in board_late_init(). Not sure for powerpc.
[Ty]: I have moved mmc initialization in boards that uses generic mmc. I will 
add the comment, thanks.

 diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 
 eb89e9e..78f75fb 100644
 --- a/common/cmd_nvedit.c
 +++ b/common/cmd_nvedit.c
 @@ -59,6 +59,7 @@ DECLARE_GLOBAL_DATA_PTR;
  !defined(CONFIG_ENV_IS_IN_FLASH)  \
  !defined(CONFIG_ENV_IS_IN_DATAFLASH)  \
  !defined(CONFIG_ENV_IS_IN_MG_DISK)\
 +!defined(CONFIG_ENV_IS_IN_MMC)   \
  !defined(CONFIG_ENV_IS_IN_NAND)   \
  !defined(CONFIG_ENV_IS_IN_NVRAM)  \
  !defined(CONFIG_ENV_IS_IN_ONENAND)\

From the first version you remove the changes in the error string:

 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
-SPI_FLASH|MG_DISK|NVRAM|NOWHERE}
+SPI_FLASH|MG_DISK|NVRAM|MMC|NOWHERE}

I know it is only an error message, but the change seems correct. I have not 
found a comment against it ;)
[Ty]: I will add this.


 +#else /* ! ENV_IS_EMBEDDED */
 +env_t *env_ptr;
 +#endif /* ENV_IS_EMBEDDED */

You missed Andy's comment. You have to initialize env_ptr.
[Ty]: This is a global variable. I think that compiler will set it to zero for 
me. Correct me if I'm wrong. Anyway, I will set it to NULL.

 + if (read_env(mmc, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, env_ptr))
 + return use_default();

This is still broken, as found by Andy. I cannot find a line where env_ptr is 
initialized and then you pass the pointer to the mmc read function.
[Ty]: env_ptr is defined in env_mmc.c and the value is assigned in 
env_common.c. Correct me if I'm wrong.

Best regards,
Stefano

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

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


Re: [U-Boot] [PATCH] Save environment data to mmc.

2010-03-03 Thread Lv Terry-R65388
Hi Babic,

Thanks for reviewing the patch.

I will send out a new patch to fix the problems you point out.

For setting block numbers for MMC offset, I just don't want env mmc to 
be different. I want users to use it as similiar as other env devices.

For the initalization for ARM and PPC, It will be added for all 
architectures.

Thanks a lot ~~

Yours
Terry

-Original Message-
From: Stefano Babic [mailto:sba...@denx.de] 
Sent: 2010年3月3日 1:03
To: Lv Terry-R65388
Cc: u-boot@lists.denx.de
Subject: Re: [U-Boot] [PATCH] Save environment data to mmc.

Terry Lv wrote:

 diff --git a/common/env_mmc.c b/common/env_mmc.c

 +#include linux/stddef.h
 +#include malloc.h
 +#include mmc.h
 +
 +#if defined(CONFIG_CMD_ENV)  defined(CONFIG_CMD_MMC)

This seems not correct. If not explicitely set, we get a compiler error.
Assuming you has taken this check from env_nand.c, this should be:

#if defined(CONFIG_CMD_SAVEENV)  defined(CONFIG_CMD_MMC)

 +#define CMD_SAVEENV
 +#elif defined(CONFIG_ENV_OFFSET_REDUND) #error Cannot use 
 +CONFIG_ENV_OFFSET_REDUND without CONFIG_CMD_ENV  CONFIG_CMD_MMC

Line too long.

 +#endif
 +
 +#if defined(CONFIG_ENV_SIZE_REDUND)  (CONFIG_ENV_SIZE_REDUND  
 +CONFIG_ENV_SIZE)

Ditto.


 +
 +#ifdef CMD_SAVEENV
 +
 +inline int write_env(struct mmc *mmc, unsigned long size,
 + unsigned long offset, const 
 void *buffer)

Line too long.

 +{
 + uint blk_start = 0, blk_cnt = 0, n = 0;
 +
 + blk_start = (offset % 512) ? ((offset / 512) + 1) : (offset / 512);
 + blk_cnt = (size % 512) ? ((size / 512) + 1) : (size / 512);

The alignment to block size is repeated here and in the read function.
Should not better to set a macro (something like BLOCK_ALIGN) providing the 
required alignment ?

 +int saveenv(void)
 +{
 + struct mmc *mmc = find_mmc_device(0);

Why is the MMC device hard-coded ? At least should be configurable with a 
CONFIG_ option. There are boards with more than one MMC controller and you 
constraint to use always the first one.

 + blk_start = (offset % 512) ? ((offset / 512) + 1) : (offset / 512);

Already said, a macro is much more readable to perform alignment.

 diff --git a/include/environment.h b/include/environment.h

 +#if defined(CONFIG_ENV_IS_IN_MMC)
 +# ifndef CONFIG_ENV_OFFSET
 +#  error Need to define CONFIG_ENV_OFFSET when using CONFIG_ENV_IS_IN_MMC
 +# endif
 +# ifndef CONFIG_ENV_ADDR
 +#  define CONFIG_ENV_ADDR(CONFIG_ENV_OFFSET)
 +# endif
 +# ifndef CONFIG_ENV_OFFSET
 +#  define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR) # endif # ifdef 
 +CONFIG_ENV_OFFSET_REDUND #  define CONFIG_SYS_REDUNDAND_ENVIRONMENT # 
 +endif # ifdef CONFIG_ENV_IS_EMBEDDED
 +#  define ENV_IS_EMBEDDED1
 +# endif
 +#endif /* CONFIG_ENV_IS_IN_MMC */

You missed Wolfgang's comment. I think also that there is no reason to set 
offset for the MMC and block numbers makes more sense.

 +
  /* Embedded env is only supported for some flash types */  #ifdef 
 CONFIG_ENV_IS_EMBEDDED  # if !defined(CONFIG_ENV_IS_IN_FLASH)  \ 
 diff --git a/lib_arm/board.c b/lib_arm/board.c index 5e3d7f6..f846d0d 
 100644

 +#ifdef CONFIG_GENERIC_MMC
 + puts (MMC:   );
 + mmc_initialize (gd-bd);
 +#endif

 diff --git a/lib_ppc/board.c b/lib_ppc/board.c index 765f97a..9b3f84c 
 100644
 --- a/lib_ppc/board.c
 +++ b/lib_ppc/board.c
 @@ -776,6 +776,12 @@ void board_init_r (gd_t *id, ulong dest_addr)
   nand_init();/* go init the NAND */
  #endif
  
 +#ifdef CONFIG_GENERIC_MMC
 + WATCHDOG_RESET ();
 + puts (MMC:  );
 + mmc_initialize (bd);
 +#endif

I am quite confused. You add the initialization only for ARM and PPC.
What about the other architectures ?

I tested your patch on mx51evk, environment is correctly read/written on the SD 
situated on the back.

Regards,
Stefano

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

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


Re: [U-Boot] [PATCH V3 7/8] fec_mxc: add MX25 support

2010-03-02 Thread Lv Terry-R65388
Hi John,

I think it is better that you can add a new config, e.g. CONFIG_MIIGSK 
for MII gasket.
Then if other i.MX platforms uses MIIGSK, we can use the config for it.

Thanks~~

Yours
Terry

-Original Message-
From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On 
Behalf Of John Rigby
Sent: 2010年1月26日 14:13
To: u-boot@lists.denx.de
Cc: John Rigby; Ben Warren
Subject: [U-Boot] [PATCH V3 7/8] fec_mxc: add MX25 support

Use RMII for MX25
Add code to init gasket that enables RMII

Signed-off-by: John Rigby jcri...@gmail.com
CC: Ben Warren biggerbadder...@gmail.com
---
 drivers/net/fec_mxc.c |   31 ++-
 drivers/net/fec_mxc.h |   32 ++--
 include/asm-arm/arch-mx25/clock.h |1 +
 3 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 
b5619eb..f109485 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -347,6 +347,34 @@ static int fec_open(struct eth_device *edev)
 */
writel(readl(fec-eth-ecntrl) | FEC_ECNTRL_ETHER_EN,
fec-eth-ecntrl);
+#ifdef CONFIG_MX25
+   udelay(100);
+   /*
+* setup the MII gasket for RMII mode
+*/
+
+   /* disable the gasket */
+   writew(0, fec-eth-miigsk_enr);
+
+   /* wait for the gasket to be disabled */
+   while (readw(fec-eth-miigsk_enr)  MIIGSK_ENR_READY)
+   udelay(2);
+
+   /* configure gasket for RMII, 50 MHz, no loopback, and no echo */
+   writew(MIIGSK_CFGR_IF_MODE_RMII, fec-eth-miigsk_cfgr);
+
+   /* re-enable the gasket */
+   writew(MIIGSK_ENR_EN, fec-eth-miigsk_enr);
+
+   /* wait until MII gasket is ready */
+   int max_loops = 10;
+   while ((readw(fec-eth-miigsk_enr)  MIIGSK_ENR_READY) == 0) {
+   if (--max_loops = 0) {
+   printf(WAIT for MII Gasket ready timed out\n);
+   break;
+   }
+   }
+#endif
 
miiphy_wait_aneg(edev);
miiphy_speed(edev-name, CONFIG_FEC_MXC_PHYADDR); @@ -498,7 +526,8 @@ 
static void fec_halt(struct eth_device *dev)
 * Disable the Ethernet Controller
 * Note: this will also reset the BD index counter!
 */
-   writel(readl(fec-eth-ecntrl)  ~FEC_ECNTRL_ETHER_EN, 
fec-eth-ecntrl);
+   writel(readl(fec-eth-ecntrl)  ~FEC_ECNTRL_ETHER_EN,
+   fec-eth-ecntrl);
fec-rbd_index = 0;
fec-tbd_index = 0;
debug(eth_halt: done\n);
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h index 
6cb1bfc..5d0d69d 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -145,9 +145,17 @@ struct ethernet_regs {
uint32_t r_fdxfc;   /* MBAR_ETH + 0x2DC */
uint32_t ieee_r_octets_ok;  /* MBAR_ETH + 0x2E0 */
 
-   uint32_t res14[6];  /* MBAR_ETH + 0x2E4-2FC */
-
+   uint32_t res14[7];  /* MBAR_ETH + 0x2E4-2FC */
+
+#ifdef CONFIG_MX25
+   uint16_t miigsk_cfgr;   /* MBAR_ETH + 0x300 */
+   uint16_t res15[3];  /* MBAR_ETH + 0x302-306 */
+   uint16_t miigsk_enr;/* MBAR_ETH + 0x308 */
+   uint16_t res16[3];  /* MBAR_ETH + 0x30a-30e */
+   uint32_t res17[60]; /* MBAR_ETH + 0x300-3FF */
+#else
uint32_t res15[64]; /* MBAR_ETH + 0x300-3FF */
+#endif
 };
 
 #define FEC_IEVENT_HBERR   0x8000
@@ -196,6 +204,26 @@ struct ethernet_regs {
 #define FEC_ECNTRL_RESET   0x0001  /* reset the FEC */
 #define FEC_ECNTRL_ETHER_EN0x0002  /* enable the FEC */
 
+#ifdef CONFIG_MX25
+/* defines for MIIGSK */
+/* RMII frequency control: 0=50MHz, 1=5MHz */
+#define MIIGSK_CFGR_FRCONT (1  6)
+/* loopback mode */
+#define MIIGSK_CFGR_LBMODE (1  4)
+/* echo mode */
+#define MIIGSK_CFGR_EMODE  (1  3)
+/* MII gasket mode field */
+#define MIIGSK_CFGR_IF_MODE_MASK   (3  0)
+/* MMI/7-Wire mode */
+#define MIIGSK_CFGR_IF_MODE_MII(0  0)
+/* RMII mode */
+#define MIIGSK_CFGR_IF_MODE_RMII   (1  0)
+/* reflects MIIGSK Enable bit (RO) */
+#define MIIGSK_ENR_READY   (1  2)
+/* enable MIGSK (set by default) */
+#define MIIGSK_ENR_EN  (1  1)
+#endif
+
 /**
  * @brief Descriptor buffer alignment
  *
diff --git a/include/asm-arm/arch-mx25/clock.h 
b/include/asm-arm/arch-mx25/clock.h
index b0752e7..c59f588 100644
--- a/include/asm-arm/arch-mx25/clock.h
+++ b/include/asm-arm/arch-mx25/clock.h
@@ -30,6 +30,7 @@ ulong imx_get_perclk(int clk);  ulong imx_get_ahbclk(void);
 
 #define imx_get_uartclk() imx_get_perclk(15)
+#define imx_get_fecclk() (imx_get_ahbclk()/2)
 
 
 #endif /* __ASM_ARCH_CLOCK_H */
--
1.6.4.2.236.gf324c

___
U-Boot mailing list
U-Boot@lists.denx.de

Re: [U-Boot] Where can I find the git repostory for mx51evk

2010-02-28 Thread Lv Terry-R65388
Hi Denk,

It seems that git am doesn't work for me.

The steps are:

1. Save the patch as txt file in outlook and copy to u-boot directory.
2. Use git am to apply the patch.

r65...@szx32-17[/home/r65388/uboot-imx]686% git am -i -u 
--whitespace=strip ./U-Boot PATCH V4  Add initial support for Freescale 
mx51evkboard.txt
Commit Body is:
--
[sba...@denx.de]
Sent: 2010年2月5日星期五 22:14
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V4 11/11] Add initial support for Freescale
mx51evkboard

The patch adds initial support for the Freescale mx51evk board.
Network (FEC) and SD controller (fsl_esdhc) are supported.

Signed-off-by: Stefano Babic sba...@denx.de
Signed-off-by: Fred Fan fanyef...@gmail.com
--
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y
Applying: [sba...@denx.de]
/home/r65388/uboot-imx/.git/rebase-apply/patch:69: trailing whitespace.
# Copyright (C) 2007, Guennadi Liakhovetski l...@denx.de # # (C) 
/home/r65388/uboot-imx/.git/rebase-apply/patch:72: trailing whitespace.
# This program is free software; you can redistribute it and/or # 
/home/r65388/uboot-imx/.git/rebase-apply/patch:73: trailing whitespace.
modify it under the terms of the GNU General Public License as # 
/home/r65388/uboot-imx/.git/rebase-apply/patch:74: trailing whitespace.
published by the Free Software Foundation; either version 2 of # the 
/home/r65388/uboot-imx/.git/rebase-apply/patch:77: trailing whitespace.
# This program is distributed in the hope that it will be useful, # but 
fatal: corrupt patch at line 145
Patch failed at 0001.
When you have resolved this problem run git am -i --resolved.
If you would prefer to skip this patch, instead run git am -i --skip.
To restore the original branch and stop patching run git am -i --abort.

What's your git version?
We're using 1.6.0.4.
I don't know if it is the git version that cause the problem.

Thanks~~

Yours
Terry
 

-Original Message-
From: Wolfgang Denk [mailto:w...@denx.de] 
Sent: 2010年2月26日 20:33
To: Lv Terry-R65388
Cc: u-boot@lists.denx.de
Subject: Re: [U-Boot] Where can I find the git repostory for mx51evk

Dear Lv Terry-R65388,

In message 
1ae74f652ecb1440b73dd7c2c20842d1ac6...@zch01exm27.fsl.freescale.net you wrote:
 
   I have tried to apply the patch on mainline.

You must be doing something wrong, then.

I re-tested it, it applies cleanly:


- git-am -3 -i -u --whitespace=strip ~/Mail/U-Boot/7647
Commit Body is:
--
Add initial support for Freescale mx51evk board

The patch adds initial support for the Freescale mx51evk board.
Network (FEC) and SD controller (fsl_esdhc) are supported.

Signed-off-by: Stefano Babic sba...@denx.de
Signed-off-by: Fred Fan fanyef...@gmail.com
--
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y
Applying: Add initial support for Freescale mx51evk board
- 


   The steps are:

   1. Copy patch from  
 http://article.gmane.org/gmane.comp.boot-loaders.u-boot/74754.
   2. Paste it to local text file patch.

Eventually the patch gets mangled (white space corrupted) this way.

   3. Clone a new u-boot.
   4. Try git apply patch.

   I encountered errors:

   r65...@szx32-17[/home/r65388/uboot-imx]602% git apply patch
   error: patch failed: MAINTAINERS:152
   error: MAINTAINERS: patch does not apply

Try using git am, and avoid the copy  paste - save the page as text file 
instead.

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 It was 
the Law of the Sea, they said. Civilization ends at  the  wa- terline.  Beyond  
that,  we  all enter the food chain, and not always
right at the top.   - Hunter S. Thompson

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


Re: [U-Boot] [PATCH V4 10/11] fsl_esdhc: add support for mx51 processor

2010-02-28 Thread Lv Terry-R65388
Hi Stefano,

Have you tested mmc on mx51 board?

The original esdhc uses PIO mode in function esdhc_send_cmd(), while 
fsl_esdhc uses DMA mode.

I hasn't tested DMA mode before.

BTW: have you considered add the feature to save environment data to 
mmc?

Thanks~~

Yours
Terry 

-Original Message-
From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On 
Behalf Of Stefano Babic
Sent: 2010年2月5日 22:11
To: u-boot@lists.denx.de
Cc: aflem...@gmail.com; Phillips Kim-R1AAHA
Subject: [U-Boot] [PATCH V4 10/11] fsl_esdhc: add support for mx51 processor

The esdhc controller in the mx51 processor is quite the same as the one in some 
powerpc processors (MPC83xx, MPC85xx). This patches adapts the driver to 
support the arm mx51.

Signed-off-by: Stefano Babic sba...@denx.de
---
 cpu/arm_cortexa8/mx51/Makefile |2 +-
 cpu/arm_cortexa8/mx51/speed.c  |   38 ++
 drivers/mmc/fsl_esdhc.c|  149 +++-
 include/asm-arm/global_data.h  |3 +
 include/fsl_esdhc.h|   27 +++
 lib_arm/board.c|3 +
 6 files changed, 173 insertions(+), 49 deletions(-)  create mode 100644 
cpu/arm_cortexa8/mx51/speed.c

diff --git a/cpu/arm_cortexa8/mx51/Makefile b/cpu/arm_cortexa8/mx51/Makefile 
index 4d82293..7cfaa2c 100644
--- a/cpu/arm_cortexa8/mx51/Makefile
+++ b/cpu/arm_cortexa8/mx51/Makefile
@@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(SOC).a
 
-COBJS  = soc.o clock.o iomux.o timer.o
+COBJS  = soc.o clock.o iomux.o timer.o speed.o
 SOBJS = lowlevel_init.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/cpu/arm_cortexa8/mx51/speed.c b/cpu/arm_cortexa8/mx51/speed.c new 
file mode 100644 index 000..10acbbf
--- /dev/null
+++ b/cpu/arm_cortexa8/mx51/speed.c
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2000-2003
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
+ * TsiChung Liew (tsi-chung.l...@freescale.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include asm/arch/imx-regs.h
+
+int get_clocks(void)
+{
+   DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_FSL_ESDHC
+   gd-sdhc_clk = mxc_get_clock(MXC_IPG_PERCLK); #endif
+   return 0;
+}
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 
c6e9e6e..e665b5e 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -37,7 +37,6 @@
 #include fdt_support.h
 #include asm/io.h
 
-
 DECLARE_GLOBAL_DATA_PTR;
 
 struct fsl_esdhc {
@@ -102,7 +101,8 @@ static int esdhc_setup_data(struct mmc *mmc, struct 
mmc_data *data)  {
uint wml_value;
int timeout;
-   struct fsl_esdhc *regs = mmc-priv;
+   struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc-priv;
+   struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg-esdhc_base;
 
wml_value = data-blocksize/4;
 
@@ -112,24 +112,24 @@ static int esdhc_setup_data(struct mmc *mmc, struct 
mmc_data *data)
 
wml_value = 0x10 | wml_value;
 
-   out_be32(regs-dsaddr, (u32)data-dest);
+   esdhc_write32(regs-dsaddr, (u32)data-dest);
} else {
if (wml_value  0x80)
wml_value = 0x80;
-   if ((in_be32(regs-prsstat)  PRSSTAT_WPSPL) == 0) {
+   if ((esdhc_read32(regs-prsstat)  PRSSTAT_WPSPL) == 0) {
printf(\nThe SD card is locked. Can not write to a 
locked card.\n\n);
return TIMEOUT;
}
wml_value = wml_value  16 | 0x10;
-   out_be32(regs-dsaddr, (u32)data-src);
+   esdhc_write32(regs-dsaddr, (u32)data-src);
}
 
-   out_be32(regs-wml, wml_value);
+   esdhc_write32(regs-wml, wml_value);
 
-   out_be32(regs-blkattr, data-blocks  16 | data-blocksize);
+   esdhc_write32(regs-blkattr, data-blocks  16 | data-blocksize);
 
/* Calculate the timeout period for data transactions */
-   timeout = __ilog2(mmc-tran_speed/10);
+   timeout = fls(mmc-tran_speed/10) - 1;
timeout -= 13;
 
if (timeout  14)
@@ -138,7 +138,7 @@ 

Re: [U-Boot] Where can I find the git repostory for mx51evk

2010-02-26 Thread Lv Terry-R65388
Hi Denk,

I have tried to apply the patch on mainline.

The steps are:

1. Copy patch from 
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/74754.
2. Paste it to local text file patch.
3. Clone a new u-boot.
4. Try git apply patch.

I encountered errors:

r65...@szx32-17[/home/r65388/uboot-imx]602% git apply patch
error: patch failed: MAINTAINERS:152
error: MAINTAINERS: patch does not apply 

Thanks~~

Yours
Terry

-Original Message-
From: Wolfgang Denk [mailto:w...@denx.de] 
Sent: 2010年2月26日 18:09
To: Lv Terry-R65388
Cc: u-boot@lists.denx.de
Subject: Re: [U-Boot] Where can I find the git repostory for mx51evk

Dear Lv Terry-R65388,

In message 
1ae74f652ecb1440b73dd7c2c20842d1ac6...@zch01exm27.fsl.freescale.net you wrote:
 
 I have cloned u-boot-imx and want to apply the patch [U-Boot]

Why did you do that? u-boot-imx is currently in a pretty poor state, as the new 
custodian has nor picked up work yet, so this repository is very old.

 [PATCH V4 11/11] Add initial support for Freescale mx51evk board for 
 a test.
 
 But the patch can't be appled.

Patches submitted on the mailing list are supposed to be applied against 
mainline (master branch). Did you try that?

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
Ordnung ist die Lust der Vernunft,
aber Unordnung die Wonne der Phantasie - Paul Claudel

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


[U-Boot] Where can I find the git repostory for mx51evk

2010-02-26 Thread Lv Terry-R65388
Hi Denx,
 
I have cloned u-boot-imx and want to apply the patch [U-Boot]
[PATCH V4 11/11] Add initial support for Freescale mx51evk board for a
test.
 
But the patch can't be appled.
 
error: patch failed: MAINTAINERS:152
error: MAINTAINERS: patch does not apply
 
How can I get the repostory for mx51evk?
 
Thanks~~
 
Yours
Terry
 
 
 General Business Information
 Freescale Internal Use Only
 Freescale Confidential Proprietary
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V3 7/8] fec_mxc: add MX25 support

2010-01-27 Thread Lv Terry-R65388
Hi John,

Why don't you use mxc_fec?

Actually, we use mxc_fec in mx25 u-boot.

Thanks~~

Yours
Terry 

-Original Message-
From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On 
Behalf Of John Rigby
Sent: 2010年1月26日 14:13
To: u-boot@lists.denx.de
Cc: John Rigby; Ben Warren
Subject: [U-Boot] [PATCH V3 7/8] fec_mxc: add MX25 support

Use RMII for MX25
Add code to init gasket that enables RMII

Signed-off-by: John Rigby jcri...@gmail.com
CC: Ben Warren biggerbadder...@gmail.com
---
 drivers/net/fec_mxc.c |   31 ++-
 drivers/net/fec_mxc.h |   32 ++--
 include/asm-arm/arch-mx25/clock.h |1 +
 3 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 
b5619eb..f109485 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -347,6 +347,34 @@ static int fec_open(struct eth_device *edev)
 */
writel(readl(fec-eth-ecntrl) | FEC_ECNTRL_ETHER_EN,
fec-eth-ecntrl);
+#ifdef CONFIG_MX25
+   udelay(100);
+   /*
+* setup the MII gasket for RMII mode
+*/
+
+   /* disable the gasket */
+   writew(0, fec-eth-miigsk_enr);
+
+   /* wait for the gasket to be disabled */
+   while (readw(fec-eth-miigsk_enr)  MIIGSK_ENR_READY)
+   udelay(2);
+
+   /* configure gasket for RMII, 50 MHz, no loopback, and no echo */
+   writew(MIIGSK_CFGR_IF_MODE_RMII, fec-eth-miigsk_cfgr);
+
+   /* re-enable the gasket */
+   writew(MIIGSK_ENR_EN, fec-eth-miigsk_enr);
+
+   /* wait until MII gasket is ready */
+   int max_loops = 10;
+   while ((readw(fec-eth-miigsk_enr)  MIIGSK_ENR_READY) == 0) {
+   if (--max_loops = 0) {
+   printf(WAIT for MII Gasket ready timed out\n);
+   break;
+   }
+   }
+#endif
 
miiphy_wait_aneg(edev);
miiphy_speed(edev-name, CONFIG_FEC_MXC_PHYADDR); @@ -498,7 +526,8 @@ 
static void fec_halt(struct eth_device *dev)
 * Disable the Ethernet Controller
 * Note: this will also reset the BD index counter!
 */
-   writel(readl(fec-eth-ecntrl)  ~FEC_ECNTRL_ETHER_EN, 
fec-eth-ecntrl);
+   writel(readl(fec-eth-ecntrl)  ~FEC_ECNTRL_ETHER_EN,
+   fec-eth-ecntrl);
fec-rbd_index = 0;
fec-tbd_index = 0;
debug(eth_halt: done\n);
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h index 
6cb1bfc..5d0d69d 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -145,9 +145,17 @@ struct ethernet_regs {
uint32_t r_fdxfc;   /* MBAR_ETH + 0x2DC */
uint32_t ieee_r_octets_ok;  /* MBAR_ETH + 0x2E0 */
 
-   uint32_t res14[6];  /* MBAR_ETH + 0x2E4-2FC */
-
+   uint32_t res14[7];  /* MBAR_ETH + 0x2E4-2FC */
+
+#ifdef CONFIG_MX25
+   uint16_t miigsk_cfgr;   /* MBAR_ETH + 0x300 */
+   uint16_t res15[3];  /* MBAR_ETH + 0x302-306 */
+   uint16_t miigsk_enr;/* MBAR_ETH + 0x308 */
+   uint16_t res16[3];  /* MBAR_ETH + 0x30a-30e */
+   uint32_t res17[60]; /* MBAR_ETH + 0x300-3FF */
+#else
uint32_t res15[64]; /* MBAR_ETH + 0x300-3FF */
+#endif
 };
 
 #define FEC_IEVENT_HBERR   0x8000
@@ -196,6 +204,26 @@ struct ethernet_regs {
 #define FEC_ECNTRL_RESET   0x0001  /* reset the FEC */
 #define FEC_ECNTRL_ETHER_EN0x0002  /* enable the FEC */
 
+#ifdef CONFIG_MX25
+/* defines for MIIGSK */
+/* RMII frequency control: 0=50MHz, 1=5MHz */
+#define MIIGSK_CFGR_FRCONT (1  6)
+/* loopback mode */
+#define MIIGSK_CFGR_LBMODE (1  4)
+/* echo mode */
+#define MIIGSK_CFGR_EMODE  (1  3)
+/* MII gasket mode field */
+#define MIIGSK_CFGR_IF_MODE_MASK   (3  0)
+/* MMI/7-Wire mode */
+#define MIIGSK_CFGR_IF_MODE_MII(0  0)
+/* RMII mode */
+#define MIIGSK_CFGR_IF_MODE_RMII   (1  0)
+/* reflects MIIGSK Enable bit (RO) */
+#define MIIGSK_ENR_READY   (1  2)
+/* enable MIGSK (set by default) */
+#define MIIGSK_ENR_EN  (1  1)
+#endif
+
 /**
  * @brief Descriptor buffer alignment
  *
diff --git a/include/asm-arm/arch-mx25/clock.h 
b/include/asm-arm/arch-mx25/clock.h
index b0752e7..c59f588 100644
--- a/include/asm-arm/arch-mx25/clock.h
+++ b/include/asm-arm/arch-mx25/clock.h
@@ -30,6 +30,7 @@ ulong imx_get_perclk(int clk);  ulong imx_get_ahbclk(void);
 
 #define imx_get_uartclk() imx_get_perclk(15)
+#define imx_get_fecclk() (imx_get_ahbclk()/2)
 
 
 #endif /* __ASM_ARCH_CLOCK_H */
--
1.6.4.2.236.gf324c

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

___
U-Boot mailing list

[U-Boot] Is it a bug in super.c in ubifs

2009-12-10 Thread Lv Terry-R65388
Hi,
 
I found that in super.c, ubifs_fs_type is defined, 
 
static struct file_system_type ubifs_fs_type = {
 .name= ubifs,
 .owner   = THIS_MODULE,
 .get_sb  = ubifs_get_sb,
};
 
but the struct fs_supers  which is list_head type is not
initialized.
 
This may cause a memory abort in calling function sget( ) in
ubifs_get_sb( ).
 
fs_supers is not initialized in the latest u-boot version.
 
Do you have some suggestions?
 
Thanks~~
 
Yours
Terry
 
 
 General Business Information
 Freescale Internal Use Only
 Freescale Confidential Proprietary
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] A question about driver/mmc/mmc.c

2009-11-24 Thread Lv Terry-R65388
Hi All,
 
I use implement the esdhc driver and use driver/mmc/mmc.c and I
think there might be a bug.
 
I have a 4G mmc plus card in hand.
 
The mmc_send_op_cond( ) function in mmc_init( ) will set
mmc-high_capacity to 0. It's not a high capacity card.
 
And in mmc_change_freq( ), due to SEC_CNT in ext_csd[ ] is not zero,
mmc-high_capacity will be set to 1. It will be addressed by sector.
 
But this card is not a high capacity card. Sector address will make
it access wrong data.
 
When I comment the line:
 
if (ext_csd[212] || ext_csd[213] || ext_csd[214] || ext_csd[215])
  mmc-high_capacity = 1;
 
The data in mmc can be read and write correctly.
 
  Is this need to be changed?
 
  Thanks~~
 
Yours
Terry
 
 General Business Information
 Freescale Internal Use Only
 Freescale Confidential Proprietary
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] help on a compiler error in include/asm/system.h

2009-11-18 Thread Lv Terry-R65388
Hi u-boot experts,
 
Now our arm board is based on u-boot v2009.08 and I need to use
ubifs.
 
So I replace some files from u-boot's latest version.
 
They are:
 
fs/ubifs/ubifs.c
fs/ubifs/ubifs.h
include/asm-arm/bitops.h
include/linux/bitops.h
 
and define the following configs in config file:
 
#define CONFIG_CMD_UBI
#define CONFIG_CMD_UBIFS
#define CONFIG_RBTREE
#define CONFIG_LZO
 
When compiling, I encountered an error:
 
 
/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnuea
bi/bin/arm-none-linux-gnueabi-gcc  -g  -O0  -fno-strict-aliasing
-fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x9780
-I/home/r65388/uboot-v2009.08/uboot-imx/include -fno-builtin
-ffreestanding -nostdinc -isystem
/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnuea
bi/lib/gcc/arm-none-linux-gnueabi/4.1.2/include -pipe  -DCONFIG_ARM
-D__ARM__ -marm  -mabi=aapcs-linux -mno-thumb-interwork -march=armv5
-Wall -Wstrict-prototypes -fno-stack-protector   -o cpu.o cpu.c -c
In file included from cpu.c:36:
/home/r65388/uboot-v2009.08/uboot-imx/include/asm/system.h:71: error:
expected identifier or '(' before 'asm'
make[1]: *** [cpu.o] Error 1
make[1]: Leaving directory
`/home/r65388/uboot-v2009.08/uboot-imx/cpu/arm_cortexa8'
make: *** [cpu/arm_cortexa8/libarm_cortexa8.a] Error 2
 
Is there any other files I need to merge to resolve this error?
 
Thanks~~
 
Yours
Terry
 
 General Business Information
 Freescale Internal Use Only
 Freescale Confidential Proprietary
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Does ubifs in u-boot is only for ppc

2009-11-11 Thread Lv Terry-R65388
Hi,
 
I'm trying to build a u-boot image for our arm board with ubifs
support.
 
I have defined 
 
#define CONFIG_CMD_UBI
#define CONFIG_CMD_UBIFS
#define CONFIG_RBTREE
#define CONFIG_LZO
 
When building fs/ubifs/lpt.c, I encountered undefined reference
errors.
 
/home/r65388/uboot-v2009.08/uboot-imx/fs/ubifs/lpt.c:81: undefined
reference to `fls'
/home/r65388/uboot-v2009.08/uboot-imx/fs/ubifs/lpt.c:82: undefined
reference to `fls'
/home/r65388/uboot-v2009.08/uboot-imx/fs/ubifs/lpt.c:83: undefined
reference to `fls'
/home/r65388/uboot-v2009.08/uboot-imx/fs/ubifs/lpt.c:84: undefined
reference to `fls'
 
fs/ubifs/libubifs.a(lpt.o):/home/r65388/uboot-v2009.08/uboot-imx/fs/ubif
s/lpt.c:87: more undefined references to `fls' follow
 
The function fls is defined in include/asm-ppc and there's no such
functions in include/asm-arm.
 
Is ubifs a common code or specified for ppc?
 
Thanks~~
 
Yours
Terry
 
 
 General Business Information
 Freescale Internal Use Only
 Freescale Confidential Proprietary
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Build error found when using CONFIG_CMD_UBIFS

2009-11-09 Thread Lv Terry-R65388
Hi All,
 
I have encountered a build error when trying to build ubifs on
u-boot v2009.08.
 
Have anyone met this error before and how to fix it?
 
In file included from ubifs.c:26:
ubifs.h:469: error: conflicting types for '__set_bit'
/home/r65388/uboot-v2009.08/uboot-imx/include/asm/bitops.h:29: error:
previous definition of '__set_bit' was here
ubifs.h:477: error: conflicting types for '__clear_bit'
/home/r65388/uboot-v2009.08/uboot-imx/include/asm/bitops.h:36: error:
previous definition of '__clear_bit' was here
ubifs.c:30:2: warning: #warning Please define CONFIG_SYS_64BIT_VSPRINTF
for correct output!
make[1]: *** [ubifs.o] Error 1
make[1]: Leaving directory
`/home/r65388/uboot-v2009.08/uboot-imx/fs/ubifs'
make: *** [fs/ubifs/libubifs.a] Error 2
 
Thanks~~
 
Yours
Terry
 
 
 General Business Information
 Freescale Internal Use Only
 Freescale Confidential Proprietary
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Save environment data to mmc.

2009-11-05 Thread Lv Terry-R65388
 Hi Mike,

I will fix the two issues you pointed. Thanks a lot.

Actually, env_mmc.c is written based on env_nand.c in u-boot 1.3.3.

I have modified it according to the latest changes in environment code. 
But seems there's still a lot of issue. Sorry for that.

It works well in our project. So I want to add it to u-boot mainline.

Thanks~~

Yours
Terry

-Original Message-
From: Mike Frysinger [mailto:vap...@gentoo.org] 
Sent: 2009年11月5日 20:10
To: u-boot@lists.denx.de
Cc: Lv Terry-R65388
Subject: Re: [U-Boot] [PATCH] Save environment data to mmc.

On Thursday 05 November 2009 02:43:33 Terry Lv wrote:
 --- a/common/Makefile
 +++ b/common/Makefile
 @@ -58,6 +58,7 @@ COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
  COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
  COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
  COBJS-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
 +COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o

this list is attempting to stay in order according to the CONFIG name, so you 
should add this above the NAND ENV entry

 --- /dev/null
 +++ b/common/env_mmc.c
 @@ -0,0 +1,359 @@
 +#if defined(CONFIG_ENV_IS_IN_MMC) /* Environment is in MMC Flash */

you dont need this line anymore as it's in the Makefile

 +#ifdef CONFIG_INFERNO
 +#error CONFIG_INFERNO not supported yet #endif

is this really needed ?

 +extern int default_environment_size;

this looks like another useless line copy  pasted from whatever file you based 
this on -mike
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Save environment data to mmc.

2009-11-04 Thread Lv Terry-R65388
Sorry, this patch has something wrong.

I'll send out a new one for review.

Yours
Terry

-Original Message-
From: Lv Terry-R65388 
Sent: 2009年11月4日 17:52
To: u-boot@lists.denx.de
Cc: Lv Terry-R65388
Subject: [PATCH] Save environment data to mmc.

This patch is to save environment data to mmc card.

Signed-off-by: Terry Lv r65...@freescale.com
---
 common/cmd_nvedit.c   |3 +-
 common/env_mmc.c  |  376 +
 include/environment.h |   18 +++
 3 files changed, 396 insertions(+), 1 deletions(-)  create mode 100644 
common/env_mmc.c

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 9f8d531..9168241 
100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -60,9 +60,10 @@ DECLARE_GLOBAL_DATA_PTR;
 !defined(CONFIG_ENV_IS_IN_NVRAM)\
 !defined(CONFIG_ENV_IS_IN_ONENAND)  \
 !defined(CONFIG_ENV_IS_IN_SPI_FLASH)\
+!defined(CONFIG_ENV_IS_IN_MMC)  \
 !defined(CONFIG_ENV_IS_NOWHERE)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
-SPI_FLASH|MG_DISK|NVRAM|NOWHERE}
+SPI_FLASH|MG_DISK|NVRAM|MMC|NOWHERE}
 #endif
 
 #define XMK_STR(x) #x
diff --git a/common/env_mmc.c b/common/env_mmc.c new file mode 100644 index 
000..a24d281
--- /dev/null
+++ b/common/env_mmc.c
@@ -0,0 +1,376 @@
+/*
+ * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+
+ * (C) Copyright 2000-2006
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH www.elinos.com
+ * Andreas Heppel ahep...@sysgo.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
+ */
+
+/* #define DEBUG */
+
+#include common.h
+
+#if defined(CONFIG_ENV_IS_IN_MMC) /* Environment is in MMC Flash */
+
+#include command.h
+#include environment.h
+#include linux/stddef.h
+#include malloc.h
+#include mmc.h
+
+#if defined(CONFIG_CMD_ENV)  defined(CONFIG_CMD_MMC) #define 
+CMD_SAVEENV #elif defined(CONFIG_ENV_OFFSET_REDUND) #error Cannot use 
+CONFIG_ENV_OFFSET_REDUND without CONFIG_CMD_ENV  CONFIG_CMD_MMC #endif
+
+#if defined(CONFIG_ENV_SIZE_REDUND)  (CONFIG_ENV_SIZE_REDUND  
+CONFIG_ENV_SIZE) #error CONFIG_ENV_SIZE_REDUND should not be less then 
+CONFIG_ENV_SIZE #endif
+
+#ifdef CONFIG_INFERNO
+#error CONFIG_INFERNO not supported yet #endif
+
+/* references to names in env_common.c */ extern uchar 
+default_environment[]; extern int default_environment_size;
+
+char *env_name_spec = MMC;
+
+#ifdef ENV_IS_EMBEDDED
+extern uchar environment[];
+env_t *env_ptr = (env_t *)(environment[0]); #else /* ! ENV_IS_EMBEDDED 
+*/ env_t *env_ptr; #endif /* ENV_IS_EMBEDDED */
+
+/* local functions */
+#if !defined(ENV_IS_EMBEDDED)
+static void use_default(void);
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+uchar env_get_char_spec(int index)
+{
+   return *((uchar *)(gd-env_addr + index)); }
+
+
+/* this is called before nand_init()
+ * so we can't read Nand to validate env data.
+ * Mark it OK for now. env_relocate() in env_common.c
+ * will call our relocate function which will does
+ * the real validation.
+ *
+ * When using a NAND boot image (like sequoia_nand), the environment
+ * can be embedded or attached to the U-Boot image in NAND flash. This 
+way
+ * the SPL loads not only the U-Boot image from NAND but also the
+ * environment.
+ */
+int env_init(void)
+{
+#if defined(CONFIG_IS_EMBEDDED)
+   size_t total;
+   int crc1_ok = 0, crc2_ok = 0;
+   env_t *tmp_env1, *tmp_env2;
+
+   total = CONFIG_ENV_SIZE;
+
+   tmp_env1 = env_ptr;
+   tmp_env2 = (env_t *)((ulong)env_ptr + CONFIG_ENV_SIZE);
+
+   crc1_ok = (crc32(0, tmp_env1-data, ENV_SIZE) == tmp_env1-crc);
+   crc2_ok = (crc32(0, tmp_env2-data, ENV_SIZE) == tmp_env2-crc);
+
+   if (!crc1_ok  !crc2_ok)
+   gd-env_valid = 0;
+   else if (crc1_ok  !crc2_ok)
+   gd-env_valid = 1;
+   else if (!crc1_ok  crc2_ok)
+   gd-env_valid = 2;
+   else {
+   /* both ok - check serial */
+   if (tmp_env1-flags == 255  tmp_env2-flags == 0)
+   gd-env_valid = 2;
+   else if (tmp_env2-flags == 255  tmp_env1-flags == 0)
+   gd-env_valid

Re: [U-Boot] [PATCH] Improve read performance of gerenic mmc.

2009-11-03 Thread Lv Terry-R65388
Hi Mike,

Thanks~~

I will send another patch.

Yours
Terry 

-Original Message-
From: Mike Frysinger [mailto:vap...@gentoo.org] 
Sent: 2009年11月4日 10:56
To: u-boot@lists.denx.de
Cc: Lv Terry-R65388
Subject: Re: [U-Boot] [PATCH] Improve read performance of gerenic mmc.

On Tuesday 03 November 2009 21:36:58 Terry Lv wrote:
 Signed-off-by: Terry Lv r65...@freescale.com

your subject has a spelling typo, and generally you should avoid using complete 
sentences in it (i.e. drop the period).

 --- a/drivers/mmc/mmc.c
 +++ b/drivers/mmc/mmc.c
 @@ -88,7 +88,7 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t 
 blkcnt,  const void*src) err = mmc_set_blocklen(mmc, 
 mmc-write_bl_len);
 
   if (err) {
 - printf(set write bl len failed\n\r);
 + puts(set write bl len failed\n\r);
   return err;
   }
 
 @@ -113,7 +113,7 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t 
 blkcnt,  const void*src) err = mmc_send_cmd(mmc, cmd, data);
 
   if (err) {
 - printf(mmc write failed\n\r);
 + puts(mmc write failed\n\r);
   return err;
   }
 
 @@ -164,7 +164,7 @@ int mmc_read(struct mmc *mmc, u64 src, uchar *dst, 
 int
  size) buffer = malloc(blklen);
 
   if (!buffer) {
 - printf(Could not allocate buffer for MMC read!\n);
 + puts(Could not allocate buffer for MMC read!\n);
   return -1;
   }

these changes dont look related to your changelog at all

unrelated, but dont know why the code is doing \n\r ... it should only be doing 
\n ...

 @@ -205,27 +205,56 @@ free_buffer:
 
  static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, 
 void
  *dst) {
 + struct mmc_cmd cmd;
 + struct mmc_data data;
   int err;
 - int i;
 + int stoperr = 0;
   struct mmc *mmc = find_mmc_device(dev_num);
 + int blklen;
 
   if (!mmc)
 - return 0;
 + return -1;
 
 - /* We always do full block reads from the card */
 - err = mmc_set_blocklen(mmc, mmc-read_bl_len);
 + blklen = mmc-read_bl_len;
 +
 + err = mmc_set_blocklen(mmc, blklen);
 
   if (err) {
 - return 0;
 + puts(set read bl len failed\n\r);
 + return err;
   }
 
 - for (i = start; i  start + blkcnt; i++, dst += mmc-read_bl_len) {
 - err = mmc_read_block(mmc, dst, i);
 + if (blkcnt  1)
 + cmd.cmdidx = MMC_CMD_READ_MULTIPLE_BLOCK;
 + else
 + cmd.cmdidx = MMC_CMD_READ_SINGLE_BLOCK;
 
 - if (err) {
 - printf(block read failed: %d\n, err);
 - return i - start;
 - }
 + if (mmc-high_capacity)
 + cmd.cmdarg = start;
 + else
 + cmd.cmdarg = start * blklen;
 +
 + cmd.resp_type = MMC_RSP_R1;
 + cmd.flags = 0;
 +
 + data.dest = dst;
 + data.blocks = blkcnt;
 + data.blocksize = blklen;
 + data.flags = MMC_DATA_READ;
 +
 + err = mmc_send_cmd(mmc, cmd, data);
 +
 + if (err) {
 + puts(mmc read failed\n\r);
 + return err;
 + }
 +
 + if (blkcnt  1) {
 + cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION;
 + cmd.cmdarg = 0;
 + cmd.resp_type = MMC_RSP_R1b;
 + cmd.flags = 0;
 + stoperr = mmc_send_cmd(mmc, cmd, NULL);
   }
 
   return blkcnt;

i imagine the changes do wat you say, but you really should explain in your 
changelog how/why your changes work -mike
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] pata support in u-boot

2009-10-21 Thread Lv Terry-R65388
Hi,
 
I'm trying to add our ATA driver to u-boot.
 
But it seems that now u-boot only supports SATA.
 
ATA is mixed with ide in cmd_ide.c.
 
There is no ata common interface in include.
 
Is this suitable?
 
Yours
Terry
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] pata support in u-boot

2009-10-21 Thread Lv Terry-R65388
Hi Denk,

 drivers/block/pata_bfin.c uses sata.h and can use commands in 
cmd_sata.c.
 drivers/block/mg_disk.c uses mg_disk.h and can use commands in 
cmd_mgdisk.c.
 drivers/block/sil680.c, hm.., I don't know what cmd it uses.

There's also ATAPI in cmd_ide.c,  which uses code in Pcs440ep.c.

They are all ATAPI, But use different interface.

There is no ata common function definitions.

I just wonder if I should create a new interface, like cmd_pata.c and 
mxc_pata.h for my ata.

Actually, sata interface is ok for use in my ata. But it may make 
customer confused.

I don't want to add redundant code for ata, so I just ask if there is a 
better implementation for ata.

Thanks~~

Yours
Terry


-Original Message-
From: Wolfgang Denk [mailto:w...@denx.de] 
Sent: 2009年10月21日 17:37
To: Lv Terry-R65388
Cc: u-boot@lists.denx.de
Subject: Re: [U-Boot] pata support in u-boot

Dear Lv Terry-R65388,

In message 
1ae74f652ecb1440b73dd7c2c20842d19a6...@zch01exm27.fsl.freescale.net you wrote:
 
 I'm trying to add our ATA driver to u-boot.

Fine.

 But it seems that now u-boot only supports SATA.

This is not correct. U-Boot also supports ATA/ATAPI, SCSI, USB, PCMCIA, 
Systemace, ...

 ATA is mixed with ide in cmd_ide.c.

Indeed.

 There is no ata common interface in include.

Hm... so include/ata.h is not what you are looking for

 Is this suitable?

I'm afraid I don't understand what exactly your problem is.

drivers/block/mg_disk.c, drivers/block/pata_bfin.c or drivers/block/sil680.c 
seem to show that the current code actually can be used with ATA interfaces.

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 The 
following statement is not true.  The previous statement is true.

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


Re: [U-Boot] how to add mmc/sd support in 6410 u-boot?

2009-07-30 Thread Lv Terry-R65388
Hi Michael,

In the latest version, mmc is implemented in driver/mmc.

If 6410 is not supported in current uboot, then what you need to do is:

1). Add hardware init code, like iomux and clock in your board init 
files.
2). Add host operation code. Maybe you can refer to fsl_esdhc.c.
3). Test and debug.

Thanks~~

Yours
Terry

-Original Message-
From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On 
Behalf Of Michael Lin
Sent: 2009年7月30日 12:33
To: u-boot
Subject: [U-Boot] how to add mmc/sd support in 6410 u-boot?

hello, everyone.
Has somebody ported U-boot to s3c6410? I want add mmc/sd reading and 
writing in 6410 u-boot. Can somebody give me some hints? 
Thanks in advance. 

--
Michael L.
Jul 30, 2009


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


[U-Boot] Is it an error in function ehci_submit_root() in ehci-hcd.c

2009-07-29 Thread Lv Terry-R65388
Hi All,
 
I'm trying to enable ehci usb in our board and I found that there
maybe two issues in funcion ehci_submit_root() in ehci-hcd.c.
 
1)
In ehci_submit_root(), the function will do the following operation.
 
From line 553 in ehci-hcd.c:

typeReq = req-request  8 | req-requesttype;
 
 switch (le16_to_cpu(typeReq)) {
 case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
...
...
case USB_REQ_GET_DESCRIPTOR | ((USB_DIR_IN | USB_RT_HUB)  8):
...
...
}
 
As in function usb_get_descriptor() in usb.c,
 
res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
   USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
   (type  8) + index, 0,
   buf, size, USB_CNTL_TIMEOUT);
 
req-request will be assigned USB_REQ_GET_DESCRIPTOR,
req-requesttype will be assigned USB_DIR_IN.
The value of typeReq will be 0x680 which can't match any value in
switch (le16_to_cpu(typeReq)) .
 
Do I miss any config here?
 
2)
In funcion usb_get_descriptor() in usb.c, it will pass index 0 to
usb_control_msg. setup_packet.index will be assigned 0.
 
res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
   USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
   (type  8) + index, 0,
   buf, size, USB_CNTL_TIMEOUT); /* The sixty parameter
is index */
 
Then in funcion ehci_submit_root() in ehci-hcd.c, 
 
status_reg = (uint32_t *)hcor-or_portsc[le16_to_cpu(req-index) -
1];
 
(le16_to_cpu(req-index) - 1) will be -1 here.
 
Is it correct?
 
Pls correct me.
 
Thanks a lot in advance.
 
Yours
Terry
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Is it an error in function ehci_submit_root() in ehci-hcd.c

2009-07-29 Thread Lv Terry-R65388
Hi Prafulla,

I'm using a little-endian machine.
My board is freescale i.mx51, the core is arm12.

I will try to correct these two places and test it in my board.

Hope it can work.

Thanks~~

Yours
Terry 

-Original Message-
From: Prafulla Wadaskar [mailto:prafu...@marvell.com] 
Sent: 2009年7月30日 1:30
To: Michael Trimarchi; Remy Bohmer
Cc: Lv Terry-R65388; u-boot@lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: RE: [U-Boot] Is it an error in function ehci_submit_root() in 
ehci-hcd.c

 

 -Original Message-
 From: Michael Trimarchi [mailto:trimar...@gandalf.sssup.it]
 Sent: Wednesday, July 29, 2009 8:41 PM
 To: Remy Bohmer
 Cc: Lv Terry-R65388; Prafulla Wadaskar; u-boot@lists.denx.de
 Subject: Re: [U-Boot] Is it an error in function
 ehci_submit_root() in ehci-hcd.c
 
 Remy Bohmer wrote:
  Hi,
 
  2009/7/29 Lv Terry-R65388 rui...@freescale.com:

  Hi All,
 
 I'm trying to enable ehci usb in our board and I found
 that there
  maybe two issues in funcion ehci_submit_root() in ehci-hcd.c.
 
  1)
 In ehci_submit_root(), the function will do the
 following operation.
 
  From line 553 in ehci-hcd.c:
 
 typeReq = req-request  8 | req-requesttype;
 
  switch (le16_to_cpu(typeReq)) {
  case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
 ...
 ...
 case USB_REQ_GET_DESCRIPTOR | ((USB_DIR_IN | USB_RT_HUB)  8):
 ...
 ...
 }
 
 As in function usb_get_descriptor() in usb.c,
 
 res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
(type  8) + index, 0,
buf, size, USB_CNTL_TIMEOUT);
 
 req-request will be assigned USB_REQ_GET_DESCRIPTOR,
  req-requesttype will be assigned USB_DIR_IN.
 The value of typeReq will be 0x680 which can't match
 any value in
  switch (le16_to_cpu(typeReq)) .
  
 
  In current mainline this le16_to_cpu() macro has been removed.
  Does that change anything?
 

 Do I miss any config here?
  
 
  I guess not.
 

  2)
 In funcion usb_get_descriptor() in usb.c, it will pass
 index 0 to
  usb_control_msg. setup_packet.index will be assigned 0.
 
 res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
(type  8) + index, 0,
buf, size, USB_CNTL_TIMEOUT); /* The sixty 
  parameter is index */
 
 Then in funcion ehci_submit_root() in ehci-hcd.c,
 
 status_reg = (uint32_t
 *)hcor-or_portsc[le16_to_cpu(req-index)
  - 1];
 
 (le16_to_cpu(req-index) - 1) will be -1 here.
 
 Is it correct?
  
 
  Nice catch!
  Prafulla/Michael, what do you think?
Hi Terry
BTW: Which is your board?
Is it big endian machine? I am curious about it :)

Regards..
Prafulla . . .


 That we need a patch here urgent :).
 
 Terry, Can you provide the proper fix?
 
 Michael
  Kind Regards,
 
  Remy
 

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