Re: [U-Boot] Broken ecc.size when switching between sw and hw ecc (beagleboard)

2012-03-02 Thread Orjan Friberg

On 03/01/2012 06:32 PM, Scott Wood wrote:

I'm saying that right now it's an OMAP-specific requirement and the
implementation of necessity involves the OMAP driver.  If another driver
grows this as a requirement, we can consider refactoring so the command
line frontend is common.

Different ECC modes for different parts of the flash is unfortunate, but
sometimes mandated by circumstance.  The NAND subsystem isn't really set
up to handle this, though changing it temporally is a hackish substitute.


Ok, thanks for clarifying.

--
Orjan Friberg
FlatFrog Laboratories AB
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Do we really need CONFIG_ARCH_CPU_INIT ?

2012-03-02 Thread Christian Riesch
Hi,

On Thu, Mar 1, 2012 at 9:48 PM, Albert ARIBAUD
 wrote:
> Le 01/03/2012 14:23, Fabio Estevam a écrit :
>
>> Hi,
>>
>> Currently CONFIG_ARCH_CPU_INIT is used to select arch_cpu_init() function.
>>
>> arch_cpu_init() does CPU level initialization, so why do we need to
>> include CONFIG_ARCH_CPU_INIT in the include/configs/boardXYZ files,
>> which are board related files ?
>>
>> For example:
>>
>> Let's say boards X, Y and Z are based on SoC S:
>>
>> 1. If processor S has a arch_cpu_init() defined, then it means that
>> X,Y,Z need the code from arch_cpu_init() and then we need to define
>> CONFIG_ARCH_CPU_INIT for each of these boards (actually all the boards
>> based on this processor would need CONFIG_ARCH_CPU_INIT)
>>
>> 2. If not all boards need the code inside arch_cpu_init() for
>> processor S, then it means that this code is not really CPU specific
>> and then it should be moved to board code.
>
>
> ... or some of these boards have a kind of preloader that does CPU level
> inits before U-Boot is loaded, but other have not.

Exactly. da850 based systems have several options to to lowlevel
configuration, either in the AIS (a script interpreted by the ROM
bootloader of the SoC), or by UBL (a user bootloader from Texas
Instruments that does low level init and then loads u-boot) or by
u-boot itself in arch_cpu_init(). Which way is used is board specific,
but if the initialization is done by u-boot, the code is the same for
all boards, it does not make sense to duplicate it.

Boards that use the low level initialization in u-boot define
CONFIG_ARCH_CPU_INIT, boards that rely on AIS or UBL do not define it.

So if CONFIG_ARCH_CPU_INIT is removed, what should be done with da850
based boards?

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


Re: [U-Boot] Do we really need CONFIG_ARCH_CPU_INIT ?

2012-03-02 Thread Christian Riesch
Hi again,

On Fri, Mar 2, 2012 at 9:46 AM, Christian Riesch
 wrote:
> Hi,
>
> On Thu, Mar 1, 2012 at 9:48 PM, Albert ARIBAUD
>  wrote:
>> Le 01/03/2012 14:23, Fabio Estevam a écrit :
>>
>>> Hi,
>>>
>>> Currently CONFIG_ARCH_CPU_INIT is used to select arch_cpu_init() function.
>>>
>>> arch_cpu_init() does CPU level initialization, so why do we need to
>>> include CONFIG_ARCH_CPU_INIT in the include/configs/boardXYZ files,
>>> which are board related files ?
>>>
>>> For example:
>>>
>>> Let's say boards X, Y and Z are based on SoC S:
>>>
>>> 1. If processor S has a arch_cpu_init() defined, then it means that
>>> X,Y,Z need the code from arch_cpu_init() and then we need to define
>>> CONFIG_ARCH_CPU_INIT for each of these boards (actually all the boards
>>> based on this processor would need CONFIG_ARCH_CPU_INIT)
>>>
>>> 2. If not all boards need the code inside arch_cpu_init() for
>>> processor S, then it means that this code is not really CPU specific
>>> and then it should be moved to board code.
>>
>>
>> ... or some of these boards have a kind of preloader that does CPU level
>> inits before U-Boot is loaded, but other have not.
>
> Exactly. da850 based systems have several options to to lowlevel
> configuration, either in the AIS (a script interpreted by the ROM
> bootloader of the SoC), or by UBL (a user bootloader from Texas
> Instruments that does low level init and then loads u-boot) or by
> u-boot itself in arch_cpu_init(). Which way is used is board specific,
> but if the initialization is done by u-boot, the code is the same for
> all boards, it does not make sense to duplicate it.
>
> Boards that use the low level initialization in u-boot define
> CONFIG_ARCH_CPU_INIT, boards that rely on AIS or UBL do not define it.
>
> So if CONFIG_ARCH_CPU_INIT is removed, what should be done with da850
> based boards?
>
> Christian

Sorry, please forget what I wrote above. We already have a
CONFIG_DA850_LOWLEVEL option that already solves the problem. So
removing CONFIG_ARCH_CPU_INIT is fine for me.
Christian
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [v3 2/3] USB: Armada100: EHCI Driver for Armada100 SOCs

2012-03-02 Thread Marek Vasut
> > -Original Message-
> > From: Ajay Bhargav [mailto:ajay.bhar...@einfochips.com]
> > Sent: 13 February 2012 18:58
> > To: li...@bohmer.net
> > Cc: Prafulla Wadaskar; marek.va...@gmail.com; u-boot@lists.denx.de;
> > Ajay Bhargav
> > Subject: [v3 2/3] USB: Armada100: EHCI Driver for Armada100 SOCs
> > 
> > This patch adds support for USB EHCI driver for Armada100 SOCs.
> > 
> > Signed-off-by: Ajay Bhargav 
> > ---
> > 
> > Changes for v2:
> > - Fix typo for SOC name
> > - change printf to debug
> > 
> > Changes for v3:
> > - Fix type in patch subject
> > - header file include updated
> > 
> >  arch/arm/include/asm/arch-armada100/armada100.h |1 +
> >  drivers/usb/host/Makefile   |1 +
> >  drivers/usb/host/ehci-armada100.c   |   64
> > 
> > +++
> > 
> >  3 files changed, 66 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/usb/host/ehci-armada100.c
> > 
> > diff --git a/arch/arm/include/asm/arch-armada100/armada100.h
> > b/arch/arm/include/asm/arch-armada100/armada100.h
> > index 70fba27..614de55 100644
> > --- a/arch/arm/include/asm/arch-armada100/armada100.h
> > +++ b/arch/arm/include/asm/arch-armada100/armada100.h
> > @@ -68,6 +68,7 @@
> > 
> >  #define ARMD1_SSP5_BASE0xD4021000
> >  #define ARMD1_UART3_BASE   0xD4026000
> >  #define ARMD1_MPMU_BASE0xD405
> > 
> > +#define ARMD1_USB_HOST_BASE0xD4209000
> > 
> >  #define ARMD1_APMU_BASE0xD4282800
> >  #define ARMD1_CPU_BASE 0xD4282C00
> > 
> > diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
> > index 7c4df53..5fdc97b 100644
> > --- a/drivers/usb/host/Makefile
> > +++ b/drivers/usb/host/Makefile
> > @@ -35,6 +35,7 @@ COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
> > 
> >  # echi
> >  COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
> > 
> > +COBJS-$(CONFIG_USB_EHCI_ARMADA100) += ehci-armada100.o utmi-
> > armada100.o
> > 
> >  ifdef CONFIG_MPC512X
> >  COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-mpc512x.o
> >  else
> > 
> > diff --git a/drivers/usb/host/ehci-armada100.c
> > b/drivers/usb/host/ehci-armada100.c
> > new file mode 100644
> > index 000..f3d8aef
> > --- /dev/null
> > +++ b/drivers/usb/host/ehci-armada100.c
> > @@ -0,0 +1,64 @@
> > +/*
> > + * (C) Copyright 2012
> > + * eInfochips Ltd. 
> > + * Written-by: Ajay Bhargav 
> > + *
> > + * This driver is based on Kirkwood echi driver
> > + * (C) Copyright 2009
> > + * Marvell Semiconductor 
> > + * Written-by: Prafulla Wadaskar 
> > + *
> > + * See file CREDITS for list of people who contributed to this
> > + * project.
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License as
> > + * published by the Free Software Foundation; either version 2 of
> > + * the License, or (at your option) any later version.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> > + * MA 02110-1301 USA
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include "ehci.h"
> > +#include "ehci-core.h"
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/*
> > + * EHCI host controller init
> > + */
> > +int ehci_hcd_init(void)
> > +{
> > +   if (utmi_init() < 0)
> > +   return -1;
> > +
> > +   hccr = (struct ehci_hccr *)(ARMD1_USB_HOST_BASE + 0x100);
> > +   hcor = (struct ehci_hcor *)((uint32_t) hccr
> > +   + HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
> > +
> > +   debug("armada100-ehci: init hccr %x and hcor %x hc_length %d\n",
> > +   (uint32_t)hccr, (uint32_t)hcor,
> > +   (uint32_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
> > +
> > +   return 0;
> > +}
> > +
> > +/*
> > + * EHCI host controller stop
> > + */
> > +int ehci_hcd_stop(void)
> > +{
> > +   return 0;
> > +}
> > --
> > 1.7.7.2

Oh dang, I picked them into -usb too. Shall I drop them ?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Armada100: gplugD: Add FAT & EXT2 command support

2012-03-02 Thread Marek Vasut
> > -Original Message-
> > From: Ajay Bhargav [mailto:ajay.bhar...@einfochips.com]
> > Sent: 13 February 2012 19:01
> > To: Prafulla Wadaskar
> > Cc: marek.va...@gmail.com; u-boot@lists.denx.de; Ajay Bhargav
> > Subject: [PATCH] Armada100: gplugD: Add FAT & EXT2 command support
> > 
> > This patch adds FAT and ext2 command support for marvell gplugD
> > 
> > Signed-off-by: Ajay Bhargav 
> > ---
> > 
> >  include/configs/gplugd.h |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/configs/gplugd.h b/include/configs/gplugd.h
> > index 061ebe6..462cc7e 100644
> > --- a/include/configs/gplugd.h
> > +++ b/include/configs/gplugd.h
> > @@ -73,6 +73,8 @@
> > 
> >  #define CONFIG_CMD_AUTOSCRIPT
> >  #undef CONFIG_CMD_FPGA
> >  #define CONFIG_CMD_USB
> > 
> > +#define CONFIG_CMD_EXT2
> > +#define CONFIG_CMD_FAT
> > 
> >  /* Disable DCACHE */
> >  #define CONFIG_SYS_DCACHE_OFF
> > 
> > --
> > 1.7.7.2
> 
> Applied to u-boot-marvell.git next branch
> 
> Regards..
> Prafulla . . .

Ok, dropping them as I see you picked them all. Thanks for picking them up, 
Prafulla.

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


[U-Boot] [PULL] U-Boot USB

2012-03-02 Thread Marek Vasut
Dear Wolfgang Denk,

in order to get all the rotting patches mainline ASAP, I'm submitting pull 
request via u-boot-pxa/usb branch:

The following changes since commit 54e96680cb96fb7a4b8f43fd949c62054004d3e5:

  Merge branch 'master' of git://git.denx.de/u-boot-microblaze (2012-02-26 
22:17:40 +0100)

are available in the git repository at:


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

for you to fetch changes up to 7e99b47667955d51f5fa88c4f64b331df0139e70:

  USB: relax usbcore reset timings (2012-03-02 11:37:55 +0100)


Marek Vasut (3):
  USB: Staticize internal functions
  USB: Separate out USB hub driver
  USB: Make struct devrequest setup_packet local

Shiraz Hashim (1):
  usbtty: adapt buffers for large packet support

Vincent Palatin (3):
  eth: remove usb-ethernet devices before re-enumerating them
  USB: fix USB keyboard polling parameter
  usb: add numeric keypad support to HID driver

Wolfgang Grandegger (1):
  USB: relax usbcore reset timings

amar...@nvidia.com (2):
  USB: reevaluate iomux stdin on USB kbd detect
  USB: move keyboard polling into kbd driver

 common/Makefile |2 +-
 common/usb.c|  448 +---
 common/usb_hub.c|  486 +++
 common/usb_kbd.c|   36 +++-
 drivers/serial/usbtty.c |2 +-
 drivers/usb/eth/usb_ether.c |7 +-
 drivers/usb/host/ehci-hcd.c |   30 ---
 drivers/usb/host/ohci-hcd.c |6 -
 drivers/usb/host/r8a66597-hcd.c |6 -
 drivers/usb/musb/musb_hcd.c |   28 ---
 include/net.h   |1 +
 include/usb.h   |9 +-
 include/usbdevice.h |4 +-
 net/eth.c   |   29 +++
 14 files changed, 579 insertions(+), 515 deletions(-)
 create mode 100644 common/usb_hub.c
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Enable high speed support for USB device framework and usbtty

2012-03-02 Thread Marek Vasut
> Hi Marek,
> 
>  +#if defined(CONFIG_USBD_HS)
>  +/**
>  + * usbd_device_qualifier_descriptor
>  + * @device: which device
>  + * @port: which port
>  + *
>  + * Return the specified qualifier descriptor for the specified
>  device. + */
>  +struct usb_qualifier_descriptor *usbd_device_qualifier_descriptor(
>  +struct usb_device_instance *device, int port)
> >>> 
> >>> Make this static, but do you really need this function at all?
> >> 
> >> Well... usbd_device_qualifier_descriptor can't be static as the function
> >> is called from another file (ep0.c). However, since it is used only for
> >> EP0, it can be omitted for the time being keeping in mind we might need
> >> to define it in future (if the need arises). What do you think?
> > 
> > What do you mean. If this is called from ep0.c, it has to be exported and
> > that's how it is. On the other hand, if ep0.c already has access to the
> > "device", it can directly access the device_descriptor field, which is I
> > believe expressive enough.
> 
> Yes, ep0.c has direct access to the "device" field. I'll omit the
> usbd_device_qualifier_descriptor function in V2.
> 

Thank you :-)

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


Re: [U-Boot] [PATCH v3 1/2] usb: align buffers at cacheline

2012-03-02 Thread Marek Vasut
> Hi,
> 
> On Friday 02 March 2012 12:08 AM, Marek Vasut wrote:
> >> On Thursday 01 March 2012 03:05 AM, Marek Vasut wrote:
>  As DMA expects the buffers to be equal and larger then
>  cache lines, This aligns buffers at cacheline.
>  
>  Signed-off-by: Puneet Saxena
>  ---
>  
>  Changes for V2:
>    - Use "ARCH_DMA_MINALIGN" directly
>    - Use "ALIGN" to align size as cacheline
>    - Removed headers from usb.h
>    - Send 8 bytes of device descriptor size to read
>    
>  Max packet size
>    
>    scsi.h header is needed to avoid extra memcpy from local buffer
>    to global buffer.
>  
>  Changes for V3:
>    - Removed local descriptor elements copy to global descriptor
>    elements - Removed "Signed-off-by: Jim Lin"
>    from commit
>  
>  message
>  
> common/cmd_usb.c|3 +-
> common/usb.c|   57
>  
>  ++--- common/usb_storage.c   
>  | 59 -- disk/part_dos.c
>  
>  |2 +-
> 
> drivers/usb/host/ehci-hcd.c |8 ++
> include/scsi.h  |4 ++-
> 6 files changed, 73 insertions(+), 60 deletions(-)
>  
>  diff --git a/common/cmd_usb.c b/common/cmd_usb.c
>  index 320667f..bca9d94 100644
>  --- a/common/cmd_usb.c
>  +++ b/common/cmd_usb.c
>  @@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass,
>  unsigned char subclass,
>  
> void usb_display_string(struct usb_device *dev, int index)
> {
>  
>  -char buffer[256];
>  +ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
>  +
>  
>   if (index != 0) {
>   
>   if (usb_string(dev, index,&buffer[0], 256)>   0)
>   
>   printf("String: \"%s\"", buffer);
>  
>  diff --git a/common/usb.c b/common/usb.c
>  index 63a11c8..191bc5b 100644
>  --- a/common/usb.c
>  +++ b/common/usb.c
>  @@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];
>  
> static int dev_index;
> static int running;
> static int asynch_allowed;
>  
>  -static struct devrequest setup_packet;
>  
> char usb_started; /* flag for the started/stopped USB status */
>  
>  @@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev,
>  unsigned int pipe, unsigned short value, unsigned short index,
>  
>   void *data, unsigned short size, int timeout)
> 
> {
>  
>  +ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
>  +sizeof(struct devrequest));
>  
>   if ((timeout == 0)&&   (!asynch_allowed)) {
>   
>   /* request for a asynch control pipe is not allowed */
>   return -1;
>   
>   }
>   
>   /* set setup command */
>  
>  -setup_packet.requesttype = requesttype;
>  -setup_packet.request = request;
>  -setup_packet.value = cpu_to_le16(value);
>  -setup_packet.index = cpu_to_le16(index);
>  -setup_packet.length = cpu_to_le16(size);
>  +setup_packet->requesttype = requesttype;
>  +setup_packet->request = request;
>  +setup_packet->value = cpu_to_le16(value);
>  +setup_packet->index = cpu_to_le16(index);
>  +setup_packet->length = cpu_to_le16(size);
>  
>   USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, 
>  " 
\
>   
>  "value 0x%X index 0x%X length 0x%X\n",
>  request, requesttype, value, index, size);
>   
>   dev->status = USB_ST_NOT_PROC; /*not yet processed */
>  
>  -submit_control_msg(dev, pipe, data, size,&setup_packet);
>  +submit_control_msg(dev, pipe, data, size, setup_packet);
>  
>   if (timeout == 0)
>   
>   return (int)size;
>  
>  @@ -694,7 +695,7 @@ static int usb_string_sub(struct usb_device *dev,
>  unsigned int langid, */
>  
> int usb_string(struct usb_device *dev, int index, char *buf, size_t
> size) {
>  
>  -unsigned char mybuf[USB_BUFSIZ];
>  +ALLOC_CACHE_ALIGN_BUFFER(unsigned char, mybuf, USB_BUFSIZ);
>  
>   unsigned char *tbuf;
>   int err;
>   unsigned int u, idx;
>  
>  @@ -794,7 +795,7 @@ int usb_new_device(struct usb_device *dev)
>  
> {
> 
>   int addr, err;
>   int tmp;
>  
> 

Re: [U-Boot] [PULL] u-boot-pxa / fix

2012-03-02 Thread Marek Vasut
> Hi Marek,
> 
> Le 29/02/2012 22:38, Marek Vasut a écrit :
> >> Hi Marek,
> >> 
> >> Le 27/02/2012 21:53, Marek Vasut a écrit :
>  Hi Marek,
>  
>  Le 27/02/2012 14:03, Marek Vasut a écrit :
> > The following changes since commit
> > 
> > 417c2c787e32784b5de975065a7d1dd5b3cc8ecd:
> >  at91: modified NAND flash timing on otc570 board (2012-02-20
> >  09:00:13 +0100)
> > 
> > are available in the git repository at:
> >  git://git.denx.de/u-boot-pxa.git fix
> > 
> > for you to fetch changes up to 2e85d5c10f01b21ac47f9b0dd4a9dcc022ac0be6:
> >  PXA: Fix missing get_tbclk() breaking vpac boards (2012-02-27
> >  13:59:47 +0100)
> > 
> > 
> > 
> > Marek Vasut (3):
> >  PXA: Remove PXA PCMCIA support
> >  PXA: Fix warning in zipitz2
> >  PXA: Fix missing get_tbclk() breaking vpac boards
> > 
> > Simon Glass (1):
> >  arm: Remove jornada link script
> > 
> > Vasily Khoruzhick (2):
> >  zipitz2: fix boot issue introduced by PXA low level init
> >  rework zipitz2: use pxa_mmc_gen as MMC driver
> > 
> > arch/arm/cpu/pxa/timer.c|5 ++
> > board/jornada/u-boot.lds|   58 ---
> > board/zipitz2/zipitz2.c |9 
> > doc/README.PXA_CF   |   56 --
> > drivers/pcmcia/Makefile |1 -
> > drivers/pcmcia/pxa_pcmcia.c |   93
> > ---
> > include/configs/zipitz2.h
> > 
> >  |   14 +-
> > 
> > include/pcmcia.h|3 +-
> > 8 files changed, 26 insertions(+), 213 deletions(-)
> > delete mode 100644 board/jornada/u-boot.lds
> > delete mode 100644 doc/README.PXA_CF
> > delete mode 100644 drivers/pcmcia/pxa_pcmcia.c
>  
>  Is there a reason why this pull request is on a "fix" branch, not
>  "master"?
>  
>  Amicalement,
> >>> 
> >>> Since those are mostly fixes.
> >> 
> >> My meaning was, if they are fixes, then why are they not on
> >> u-boot-pxa/master as they should be?
> > 
> > Because I'm an evil maintainer that is very happy if he can bring in
> > inconsistency ! I'll put it into master next time.
> 
> Please meet the evil arch-custodian that is very happy if he can impose
> order. :)

Hehe :)
> 
> More seriously though: do you mean you are going to move these commits
> to master and send an updated pull req, or should take this one as being
> master?

I'm actually planning (you know, planning, aka. sometimes in the distant future 
...) to reorganise u-boot-pxa.git, it's real mess now. Though this -fix idea is 
what I got from linux kernel, noone was opposed to have different branches like 
that there. Besides, right now, u-boot-pxa/master contains some bigger changes.

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


[U-Boot] [WIP, PATCH] initcall: An outline of the idea

2012-03-02 Thread Graeme Russ
This is a very rough (i.e. it is not even close to finished and maybe won't
even appply as it sits on top of some other dev patches I have) but it
should give you an idea of what the INIT_FUNC implementation will look like.

Ultimately, tools/mkinitseq.c will process the dependencies and generate
a C file containing the three init sequence arrays which have been deleted
from arch/x86/lib/board.c

---
 Makefile|   24 +++-
 arch/blackfin/cpu/initcode.c|1 +
 arch/blackfin/cpu/serial.c  |1 +
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c |1 +
 arch/mips/cpu/mips32/incaip/asc_serial.c|1 +
 arch/mips/cpu/xburst/jz_serial.c|1 +
 arch/powerpc/cpu/mpc512x/serial.c   |1 +
 arch/powerpc/cpu/mpc5xx/serial.c|1 +
 arch/sparc/cpu/leon2/serial.c   |1 +
 arch/sparc/cpu/leon3/serial.c   |1 +
 arch/x86/cpu/cpu.c  |4 +-
 arch/x86/cpu/interrupts.c   |1 +
 arch/x86/cpu/sc520/sc520.c  |1 +
 arch/x86/cpu/sc520/sc520_sdram.c|2 +
 arch/x86/cpu/sc520/sc520_timer.c|1 +
 arch/x86/cpu/u-boot.lds |1 +
 arch/x86/lib/board.c|  134 +-
 arch/x86/lib/init_helpers.c |   14 ++
 arch/x86/lib/init_wrappers.c|   11 +
 arch/x86/lib/relocate.c |3 +
 board/amirix/ap1000/serial.c|1 +
 board/bmw/serial.c  |1 +
 board/eNET/eNET.c   |3 +
 common/console.c|2 +
 common/env_dataflash.c  |1 +
 common/env_eeprom.c |1 +
 common/env_flash.c  |1 +
 common/env_mgdisk.c |1 +
 common/env_mmc.c|1 +
 common/env_nand.c   |1 +
 common/env_nowhere.c|1 +
 common/env_nvram.c  |1 +
 common/env_onenand.c|1 +
 common/env_sf.c |1 +
 common/serial.c |1 +
 common/stdio.c  |1 +
 config.mk   |2 +
 doc/README.INIT_FUNC|   31 +++
 include/initcall.h  |   19 ++
 tools/Makefile  |6 +
 tools/mkinitseq.c   |  278 +++
 u-boot-init.lds |   25 +++
 42 files changed, 449 insertions(+), 136 deletions(-)
 create mode 100644 doc/README.INIT_FUNC
 create mode 100644 include/initcall.h
 create mode 100644 tools/mkinitseq.c
 create mode 100644 u-boot-init.lds

diff --git a/Makefile b/Makefile
index f174996..d07f404 100644
--- a/Makefile
+++ b/Makefile
@@ -460,8 +460,30 @@ GEN_UBOOT = \
-Map u-boot.map -o u-boot
 endif
 
+GEN_UBOOT_INIT = \
+   UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
+   sed  -n -e 
's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
+   cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $$UNDEF_SYM 
$(__OBJS) \
+   --start-group $(__LIBS) --end-group \
+   -Map u-boot-init.map -o u-boot-init
+
+$(obj)u-boot-init: depend \
+   $(SUBDIR_TOOLS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
+   $(GEN_UBOOT_INIT)
+
+$(obj)u-boot-init.bin: $(obj)u-boot-init
+   $(OBJCOPY) -j .initfuncs -O binary $< $@
+
+$(obj)init_seq.c:  tools $(obj)u-boot-init.bin
+   $(obj)tools/mkinitseq $(obj)u-boot-init.bin
+
 $(obj)u-boot:  depend \
-   $(SUBDIR_TOOLS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) 
$(obj)u-boot.lds
+   $(SUBDIR_TOOLS) \
+   $(OBJS) $(LIBBOARD) \
+   $(LIBS) \
+   $(LDSCRIPT) \
+   $(obj)init_seq.c \
+   $(obj)u-boot.lds
$(GEN_UBOOT)
 ifeq ($(CONFIG_KALLSYMS),y)
smap=`$(call SYSTEM_MAP,u-boot) | \
diff --git a/arch/blackfin/cpu/initcode.c b/arch/blackfin/cpu/initcode.c
index fb3a101..2f4cae5 100644
--- a/arch/blackfin/cpu/initcode.c
+++ b/arch/blackfin/cpu/initcode.c
@@ -78,6 +78,7 @@ static inline void serial_init(void)
serial_early_set_baud(uart_base, CONFIG_BAUDRATE);
}
 }
+INIT_FUNC(serial_init, serial_f, *baudrate_f -SDRAM);
 
 __attribute__((always_inline))
 static inline void serial_deinit(void)
diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 6603dc0..89026f2 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -318,6 +318,7 @@ int serial_init(void)
uart_lsr_clear(UART_DLL);
return 0;
 }
+INIT_FUNC(

Re: [U-Boot] [PATCH 1/3] mtd/NAND: Add FSMC driver support

2012-03-02 Thread Amit Virdi

Hello Scott,

On 3/2/2012 2:57 AM, Scott Wood wrote:

On 02/27/2012 03:38 AM, Amit Virdi wrote:

+   /*
+* This is a temporary erase check. A newly erased page read
+* would result in an ecc error because the oob data is also
+* erased to FF and the calculated ecc for an FF data is not
+* FF..FF.
+* This is a workaround to skip performing correction in case
+* data is FF..FF
+*/
+   for (k = 0; k<  eccsize; k++) {
+   if (*(p + k) != 0xff)
+   break;
+   }


Shouldn't this apply over the whole page (including the ECC bytes
themselves), not just the ECC chunk?  The data could legitimately be all
0xff except for one bit, and that bit could have flipped...


So you're saying that such a page is wrongly interpreted as "erased 
page" and ecc check is skipped! Yes, you are very right. This check 
should be applied to the whole page and not only the chunk.




Will a freshly erased page show up as having correctable errors, or


A newly erased page contains 0xff in data as well as spare area. So most 
likely, it shows up as having uncorrectable errors.



uncorrectable?  If the latter, just hold off on declaring the page as an
ECC fail until you've read the whole thing, and then if you're about to
mark it failed, check wheter it's freshly erased.


So do you mean to say:

stat = chip->ecc.correct(mtd, p, &ecc_code[i],
&ecc_calc[i]);
if (stat < 0) {
  if (data as well as the oob is 0xff)
do nothing;
  else
mtd->ecc_stats.failed++;
} else
mtd->ecc_stats.corrected += stat;


Can we have a scenario like this:
A page has been erased - so it contains 0xff in data area as well as 
spare area. Somehow, a bit in either or say both areas are flipped, then 
the SW will not be able to distinguish if it's and erased page or a page 
with data and uncorrectable errors. How do we take care of such scenarios?





+   nand->options = 0;
+#if defined(CONFIG_SYS_FSMC_NAND_16BIT)
+   nand->options |= NAND_BUSWIDTH_16;
+#endif


No on-flash BBT?



No, not implemented yet.


+   /* Detect NAND chips */
+   if (nand_scan_ident(mtd, 1, NULL))
+   return -ENXIO;


You should #define CONFIG_SYS_NAND_SELF_INIT if you want to call this
yourself (see the documentation for what else you need to do).



Ok. I see this is the new philosophy that is encouraged even for the 
existing drivers.



+/*
+ * There are 13 bytes of ecc for every 512 byte block and it has to be read
+ * consecutively and immediately after the 512 byte data block for hardware to
+ * generate the error bit offsets
+ * Managing the ecc bytes in the following way is easier. This way is similar 
to
+ * oobfree structure maintained already in u-boot nand driver
+ */
+#define MAX_ECCPLACE_ENTRIES   32


No FSMC namespace... is/will this file included by anything but the FSMC
  driver?



Sorry, it didn't get you here. This file (fsmc_nand.h) shall be included 
by board files.


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


Re: [U-Boot] [PATCH 2/3] SPEAr: Configure FSMC driver for NAND interface

2012-03-02 Thread Amit Virdi

Hi Scott,



You also need the following define for this to work with the latest NAND
subsystem:

#define CONFIG_MTD_ECC_SOFT

Not sure about SPEAr3xx. Most likely this needs it as well.


This is going to be reverted for now -- I meant to leave it out of the
last patchset because of the need to update all boards (which the patch
did not do).



Sorry, I didn't get you. Could you please elaborate?


It was intended to reduce U-Boot code size in cases where soft ECC is
not needed.  However, the patch that introduced it did not update the
boards to select it when necessary, so it is being reverted for now.

It can be resubmitted with proper documentation and board config file
updates.



Ok. So I need not to define "CONFIG_MTD_ECC_SOFT" for now.

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


Re: [U-Boot] [PATCH 1/7] net/designware: Fix to restore hw mac address

2012-03-02 Thread Amit Virdi



On 3/1/2012 12:39 AM, Mike Frysinger wrote:

On Wednesday 29 February 2012 05:37:20 Amit Virdi wrote:

The network controller mac resets hardware address stored in MAC_HI and
MAC_LO registers if mac is resetted. So, hw mac address needs to be
restored in case mac is explicitly resetted from driver.


OK, but ...


--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c

+   dw_write_hwaddr(dev);


... please add a comment above this line explaining why you must explicitly
make this call


Ok, Mike. I'll send V2 with comment added.

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


Re: [U-Boot] [PATCH 5/7] net/designware: Try configuring phy on each dw_eth_init

2012-03-02 Thread Amit Virdi



On 3/1/2012 12:41 AM, Mike Frysinger wrote:

+   u32 phy_configured;
>  +#define FALSE(0)
>  +#define TRUE (!FALSE)

NAK: we already have "true" and "false" and the "bool" type.  use those
instead.


Are you sure Mike? I couldn't find in u-boot code "TRUE" and "FALSE" 
defined in any common header file.


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


Re: [U-Boot] usb ethernet working on panda?

2012-03-02 Thread Govindraj
On Thu, Mar 1, 2012 at 8:08 PM, Kumar Gala  wrote:
>
> On Feb 29, 2012, at 12:17 AM, Govindraj wrote:
>
>> On Wed, Feb 29, 2012 at 4:47 AM, Kumar Gala  
>> wrote:
>>> Does anyone have usb ethernet working on top of git tree on a panda board?
>>>
>> yes.
>>
>>> If so any gotcha's or details on how you have it working.
>>
>> I use following commands:
>>
>> setenv usbethaddr 0:0:1:2:3:4;usb start;
>>
>> After Ethernet enumerates, from u-boot I use following bootargs
>>
>> setenv ipaddr xxx.xxx.xxx.xxx;setenv serverip xxx.xxx.xxx.xxx;setenv
>> gatewayip xxx.xxx.xxx.xxx;setenv netmask xxx.xxx.xxx.xx;
>> setenv bootfile xx;setenv bootcmd 'tftp 8030;bootm 8030';
>> setenv bootargs console=ttyO2,115200n8 noinitrd root=/dev/nfs rw
>> nfsroot=,nolock,tcp, wsize=1024,rsize=1024 ip=dhcp
>> devfs=mount;
>> boot;
>
> I try and get:
>
> Panda # setenv usbethaddr 0:0:1:2:3:4;usb start;
> (Re)start USB...
> USB:   Register 1313 NbrPorts 3
> USB EHCI 1.00
> scanning bus for devices... 3 USB Device(s) found
>       scanning bus for storage devices... 0 Storage Device(s) found
>       scanning bus for ethernet devices... 1 Ethernet Device(s) found
> Panda # setenv ipaddr 192.168.1.100; setenv serverip 192.168.1.1
> Panda # setenv gatewayip 192.168.1.1
> Panda # setenv netmask 255.255.255.0
> Panda # ping 192.168.1.1
> Waiting for Ethernet connection... done.
> Using sms0 device
> EHCI timed out on TD - token=0x8008d80
> ping failed; host 192.168.1.1 is not alive
> Panda #
>

Pinging gateway-ip is yielding random behavior.
pinging server-ip is consistent.


[...]

U-Boot SPL 2011.12-00374-g54e9668 (Mar 02 2012 - 17:56:18)
OMAP4460 ES1.1
OMAP SD/MMC: 0
reading u-boot.img
reading u-boot.img


U-Boot 2011.12-00374-g54e9668 (Mar 02 2012 - 17:56:18)

CPU  : OMAP4460 ES1.1
Board: OMAP4 Panda
I2C:   ready
DRAM:  1 GiB
MMC:   OMAP SD/MMC: 0
Using default environment

In:serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0
Panda # setenv ipaddr 172.24.190.201;setenv serverip
172.24.190.221;setenv gatewayip 172.24.191.1;setenv netmask
255.255.252.0;
Panda # setenv usbethaddr 0:0:1:2:3:4;usb start;
(Re)start USB...
USB:   Register 1313 NbrPorts 3
USB EHCI 1.00
scanning bus for devices... 3 USB Device(s) found
   scanning bus for storage devices... 0 Storage Device(s) found
   scanning bus for ethernet devices... 1 Ethernet Device(s) found
Panda # ping 172.24.191.1
Waiting for Ethernet connection... done.
Using sms0 device
ping failed; host 172.24.191.1 is not alive
Panda # ping 172.24.190.221
Waiting for Ethernet connection... done.
Using sms0 device
host 172.24.190.221 is alive
Panda # ping 172.24.190.221
Waiting for Ethernet connection... done.
Using sms0 device
host 172.24.190.221 is alive
Panda # ping 172.24.191.1
Waiting for Ethernet connection... done.
Using sms0 device
host 172.24.191.1 is alive
Panda #
Panda # tftp 8030 govindraj/uImage
Waiting for Ethernet connection... done.
Using sms0 device
TFTP from server 172.24.190.221; our IP address is 172.24.190.201
Filename 'govindraj/uImage'.
Load address: 0x8030
Loading: T #
 #
 #
 #
 #
 #
 #
 #
 ##
done
Bytes transferred = 8533080 (823458 hex)
Panda #

[...]


> 
>
> Not sure if the 'EHCI timed out...' message is normal or expected.

strangely I don't get that error

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


Re: [U-Boot] [PATCH v3 1/2] usb: align buffers at cacheline

2012-03-02 Thread puneets

Hi,
On Friday 02 March 2012 04:13 PM, Marek Vasut wrote:

Hi,

On Friday 02 March 2012 12:08 AM, Marek Vasut wrote:

On Thursday 01 March 2012 03:05 AM, Marek Vasut wrote:

As DMA expects the buffers to be equal and larger then
cache lines, This aligns buffers at cacheline.

Signed-off-by: Puneet Saxena
---

Changes for V2:
   - Use "ARCH_DMA_MINALIGN" directly
   - Use "ALIGN" to align size as cacheline
   - Removed headers from usb.h
   - Send 8 bytes of device descriptor size to read

 Max packet size

   scsi.h header is needed to avoid extra memcpy from local buffer
   to global buffer.

Changes for V3:
   - Removed local descriptor elements copy to global descriptor
   elements - Removed "Signed-off-by: Jim Lin"
   from commit

message

common/cmd_usb.c|3 +-
common/usb.c|   57

++--- common/usb_storage.c
| 59 -- disk/part_dos.c

|2 +-

drivers/usb/host/ehci-hcd.c |8 ++
include/scsi.h  |4 ++-
6 files changed, 73 insertions(+), 60 deletions(-)

diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 320667f..bca9d94 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass,
unsigned char subclass,

void usb_display_string(struct usb_device *dev, int index)
{

-   char buffer[256];
+   ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
+

if (index != 0) {

if (usb_string(dev, index,&buffer[0], 256)>0)

printf("String: \"%s\"", buffer);

diff --git a/common/usb.c b/common/usb.c
index 63a11c8..191bc5b 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];

static int dev_index;
static int running;
static int asynch_allowed;

-static struct devrequest setup_packet;

char usb_started; /* flag for the started/stopped USB status */

@@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev,
unsigned int pipe, unsigned short value, unsigned short index,

void *data, unsigned short size, int timeout)

{

+   ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
+   sizeof(struct devrequest));

if ((timeout == 0)&&(!asynch_allowed)) {

/* request for a asynch control pipe is not allowed */
return -1;

}

/* set setup command */

-   setup_packet.requesttype = requesttype;
-   setup_packet.request = request;
-   setup_packet.value = cpu_to_le16(value);
-   setup_packet.index = cpu_to_le16(index);
-   setup_packet.length = cpu_to_le16(size);
+   setup_packet->requesttype = requesttype;
+   setup_packet->request = request;
+   setup_packet->value = cpu_to_le16(value);
+   setup_packet->index = cpu_to_le16(index);
+   setup_packet->length = cpu_to_le16(size);

USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, "

\


"value 0x%X index 0x%X length 0x%X\n",
   request, requesttype, value, index, size);

dev->status = USB_ST_NOT_PROC; /*not yet processed */

-   submit_control_msg(dev, pipe, data, size,&setup_packet);
+   submit_control_msg(dev, pipe, data, size, setup_packet);

if (timeout == 0)

return (int)size;

@@ -694,7 +695,7 @@ static int usb_string_sub(struct usb_device *dev,
unsigned int langid, */

int usb_string(struct usb_device *dev, int index, char *buf, size_t
size) {

-   unsigned char mybuf[USB_BUFSIZ];
+   ALLOC_CACHE_ALIGN_BUFFER(unsigned char, mybuf, USB_BUFSIZ);

unsigned char *tbuf;
int err;
unsigned int u, idx;

@@ -794,7 +795,7 @@ int usb_new_device(struct usb_device *dev)

{

int addr, err;
int tmp;

-   unsigned char tmpbuf[USB_BUFSIZ];
+   ALLOC_CACHE_ALIGN_BUFFER(unsigned char, tmpbuf, USB_BUFSIZ);

/* We still haven't set the Address yet */
addr = dev->devnum;

@@ -842,7 +843,10 @@ int usb_new_device(struct usb_device *dev)

dev->epmaxpacketin[0] = 64;
dev->epmaxpacketout[0] = 64;

-   err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, 64);
+   desc->bMaxPacketSize0 = 0;
+   /*8 bytes of the descriptor to read Max packet size*/
+   err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc,
+   8);

Did some unrelated addition/change creep in here?

No, This is the fix for the similar issue as is discussed for string
fetch().
When the device partially fills the passed buffer and we try to
invalidate the partial buffer
the cache alignment error crops up.

The code in "ehci_submit_async() " invalidates *partially* the passed
buffer though we pass aligned b

Re: [U-Boot] [PATCH v3 1/2] usb: align buffers at cacheline

2012-03-02 Thread Marek Vasut
> Hi,
> 
> On Friday 02 March 2012 04:13 PM, Marek Vasut wrote:
> >> Hi,
> >> 
> >> On Friday 02 March 2012 12:08 AM, Marek Vasut wrote:
>  On Thursday 01 March 2012 03:05 AM, Marek Vasut wrote:
> >> As DMA expects the buffers to be equal and larger then
> >> cache lines, This aligns buffers at cacheline.
> >> 
> >> Signed-off-by: Puneet Saxena
> >> ---
> >> 
> >> Changes for V2:
> >>- Use "ARCH_DMA_MINALIGN" directly
> >>- Use "ALIGN" to align size as cacheline
> >>- Removed headers from usb.h
> >>- Send 8 bytes of device descriptor size to read
> >>
> >>  Max packet size
> >>
> >>scsi.h header is needed to avoid extra memcpy from local
> >>buffer to global buffer.
> >> 
> >> Changes for V3:
> >>- Removed local descriptor elements copy to global descriptor
> >>elements - Removed "Signed-off-by: Jim Lin"
> >>from commit
> >> 
> >> message
> >> 
> >> common/cmd_usb.c|3 +-
> >> common/usb.c|   57
> >> 
> >> ++--- common/usb_storage.c
> >> 
> >> | 59 -- disk/part_dos.c
> >> | 
> >> |2 +-
> >> 
> >> drivers/usb/host/ehci-hcd.c |8 ++
> >> include/scsi.h  |4 ++-
> >> 6 files changed, 73 insertions(+), 60 deletions(-)
> >> 
> >> diff --git a/common/cmd_usb.c b/common/cmd_usb.c
> >> index 320667f..bca9d94 100644
> >> --- a/common/cmd_usb.c
> >> +++ b/common/cmd_usb.c
> >> @@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass,
> >> unsigned char subclass,
> >> 
> >> void usb_display_string(struct usb_device *dev, int index)
> >> {
> >> 
> >> -  char buffer[256];
> >> +  ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
> >> +
> >> 
> >>if (index != 0) {
> >>
> >>if (usb_string(dev, index,&buffer[0], 256)>0)
> >>
> >>printf("String: \"%s\"", buffer);
> >> 
> >> diff --git a/common/usb.c b/common/usb.c
> >> index 63a11c8..191bc5b 100644
> >> --- a/common/usb.c
> >> +++ b/common/usb.c
> >> @@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];
> >> 
> >> static int dev_index;
> >> static int running;
> >> static int asynch_allowed;
> >> 
> >> -static struct devrequest setup_packet;
> >> 
> >> char usb_started; /* flag for the started/stopped USB status */
> >> 
> >> @@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev,
> >> unsigned int pipe, unsigned short value, unsigned short index,
> >> 
> >>void *data, unsigned short size, int timeout)
> >> 
> >> {
> >> 
> >> +  ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
> >> +  sizeof(struct devrequest));
> >> 
> >>if ((timeout == 0)&&(!asynch_allowed)) {
> >>
> >>/* request for a asynch control pipe is not allowed */
> >>return -1;
> >>
> >>}
> >>
> >>/* set setup command */
> >> 
> >> -  setup_packet.requesttype = requesttype;
> >> -  setup_packet.request = request;
> >> -  setup_packet.value = cpu_to_le16(value);
> >> -  setup_packet.index = cpu_to_le16(index);
> >> -  setup_packet.length = cpu_to_le16(size);
> >> +  setup_packet->requesttype = requesttype;
> >> +  setup_packet->request = request;
> >> +  setup_packet->value = cpu_to_le16(value);
> >> +  setup_packet->index = cpu_to_le16(index);
> >> +  setup_packet->length = cpu_to_le16(size);
> >> 
> >>USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X,
> >>"
> > 
> > \
> > 
> >>"value 0x%X index 0x%X length 0x%X\n",
> >>
> >>   request, requesttype, value, index, size);
> >>
> >>dev->status = USB_ST_NOT_PROC; /*not yet processed */
> >> 
> >> -  submit_control_msg(dev, pipe, data, size,&setup_packet);
> >> +  submit_control_msg(dev, pipe, data, size, setup_packet);
> >> 
> >>if (timeout == 0)
> >>
> >>return (int)size;
> >> 
> >> @@ -694,7 +695,7 @@ static int usb_string_sub(struct usb_device
> >> *dev, unsigned int langid, */
> >> 
> >> int usb_string(struct usb_device *dev, int index, char *buf,
> >> size_t size) {
> >> 
> >> -  unsigned char mybuf[USB_BUFSIZ];
> >> +  ALLOC_CACHE_ALIGN_BUFFER(unsigned char, mybu

[U-Boot] [PATCH] EXYNOS: Add structure for Exynos4 DMC

2012-03-02 Thread Chander Kashyap
Add exynos4_dmc structure in dmc.h for exynos4 dram controllor(DMC).

Signed-off-by: Chander Kashyap 
---
 arch/arm/include/asm/arch-exynos/dmc.h |  109 
 1 files changed, 109 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/dmc.h 
b/arch/arm/include/asm/arch-exynos/dmc.h
index debbe50..bd52d16 100644
--- a/arch/arm/include/asm/arch-exynos/dmc.h
+++ b/arch/arm/include/asm/arch-exynos/dmc.h
@@ -2,6 +2,115 @@
 #define __DMC_H__
 
 #ifndef __ASSEMBLY__
+struct exynos4_dmc {
+   unsigned int concontrol;
+   unsigned int memcontrol;
+   unsigned int memconfig0;
+   unsigned int memconfig1;
+   unsigned int directcmd;
+   unsigned int prechconfig;
+   unsigned int phycontrol0;
+   unsigned int phycontrol1;
+   unsigned int phycontrol2;
+   unsigned int phycontrol3;
+   unsigned int pwrdnconfig;
+   unsigned char res1[0x4];
+   unsigned int timingref;
+   unsigned int timingrow;
+   unsigned int timingdata;
+   unsigned int timingpower;
+   unsigned int phystatus;
+   unsigned int phyzqcontrol;
+   unsigned int chip0status;
+   unsigned int chip1status;
+   unsigned int arefstatus;
+   unsigned int mrstatus;
+   unsigned int phytest0;
+   unsigned int phytest1;
+   unsigned int qoscontrol0;
+   unsigned int qosconfig0;
+   unsigned int qoscontrol1;
+   unsigned int qosconfig1;
+   unsigned int qoscontrol2;
+   unsigned int qosconfig2;
+   unsigned int qoscontrol3;
+   unsigned int qosconfig3;
+   unsigned int qoscontrol4;
+   unsigned int qosconfig4;
+   unsigned int qoscontrol5;
+   unsigned int qosconfig5;
+   unsigned int qoscontrol6;
+   unsigned int qosconfig6;
+   unsigned int qoscontrol7;
+   unsigned int qosconfig7;
+   unsigned int qoscontrol8;
+   unsigned int qosconfig8;
+   unsigned int qoscontrol9;
+   unsigned int qosconfig9;
+   unsigned int qoscontrol10;
+   unsigned int qosconfig10;
+   unsigned int qoscontrol11;
+   unsigned int qosconfig11;
+   unsigned int qoscontrol12;
+   unsigned int qosconfig12;
+   unsigned int qoscontrol13;
+   unsigned int qosconfig13;
+   unsigned int qoscontrol14;
+   unsigned int qosconfig14;
+   unsigned int qoscontrol15;
+   unsigned int qosconfig15;
+   unsigned int qostimeout0;
+   unsigned int qostimeout1;
+   unsigned char res2[0x8];
+   unsigned int ivcontrol;
+   unsigned char res3[0x8];
+   unsigned int perevconfig;
+   unsigned char res4[0xDF00];
+   unsigned int pmnc_ppc_a;
+   unsigned char res5[0xC];
+   unsigned int cntens_ppc_a;
+   unsigned char res6[0xC];
+   unsigned int cntenc_ppc_a;
+   unsigned char res7[0xC];
+   unsigned int intens_ppc_a;
+   unsigned char res8[0xC];
+   unsigned int intenc_ppc_a;
+   unsigned char res9[0xC];
+   unsigned int flag_ppc_a;
+   unsigned char res10[0xAC];
+   unsigned int ccnt_ppc_a;
+   unsigned char res11[0xC];
+   unsigned int pmcnt0_ppc_a;
+   unsigned char res12[0xC];
+   unsigned int pmcnt1_ppc_a;
+   unsigned char res13[0xC];
+   unsigned int pmcnt2_ppc_a;
+   unsigned char res14[0xC];
+   unsigned int pmcnt3_ppc_a;
+   unsigned char res15[0xEBC];
+   unsigned int pmnc_ppc_m;
+   unsigned char res16[0xC];
+   unsigned int cntens_ppc_m;
+   unsigned char res17[0xC];
+   unsigned int cntenc_ppc_m;
+   unsigned char res18[0xC];
+   unsigned int intens_ppc_m;
+   unsigned char res19[0xC];
+   unsigned int intenc_ppc_m;
+   unsigned char res20[0xC];
+   unsigned int flag_ppc_m;
+   unsigned char res21[0xAC];
+   unsigned int ccnt_ppc_m;
+   unsigned char res22[0xC];
+   unsigned int pmcnt0_ppc_m;
+   unsigned char res23[0xC];
+   unsigned int pmcnt1_ppc_m;
+   unsigned char res24[0xC];
+   unsigned int pmcnt2_ppc_m;
+   unsigned char res25[0xC];
+   unsigned int pmcnt3_ppc_m;
+};
+
 struct exynos5_dmc {
unsigned int concontrol;
unsigned int memcontrol;
-- 
1.7.5.4

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


[U-Boot] [PATCH 3/4] i.MX28: Add cache support into the APBH DMA driver

2012-03-02 Thread Marek Vasut
The desc_append() now flushes descriptors into RAM.

Signed-off-by: Marek Vasut 
Cc: Stefano Babic 
---
 drivers/dma/apbh_dma.c |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index e85f5fe..c086629 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -93,6 +93,21 @@ static int mxs_dma_read_semaphore(int channel)
return tmp;
 }
 
+#ifndefCONFIG_SYS_DCACHE_OFF
+void mxs_dma_flush_desc(struct mxs_dma_desc *desc)
+{
+   uint32_t addr;
+   uint32_t size;
+
+   addr = (uint32_t)desc;
+   size = roundup(sizeof(struct mxs_dma_desc), MXS_DMA_ALIGNMENT);
+
+   flush_dcache_range(addr, addr + size);
+}
+#else
+inline void mxs_dma_flush_desc(struct mxs_dma_desc *desc) {}
+#endif
+
 /*
  * Enable a DMA channel.
  *
@@ -329,8 +344,10 @@ static int mxs_dma_release(int channel)
 struct mxs_dma_desc *mxs_dma_desc_alloc(void)
 {
struct mxs_dma_desc *pdesc;
+   uint32_t size;
 
-   pdesc = memalign(MXS_DMA_ALIGNMENT, sizeof(struct mxs_dma_desc));
+   size = roundup(sizeof(struct mxs_dma_desc), MXS_DMA_ALIGNMENT);
+   pdesc = memalign(MXS_DMA_ALIGNMENT, size);
 
if (pdesc == NULL)
return NULL;
@@ -415,12 +432,16 @@ int mxs_dma_desc_append(int channel, struct mxs_dma_desc 
*pdesc)
 
last->cmd.next = mxs_dma_cmd_address(pdesc);
last->cmd.data |= MXS_DMA_DESC_CHAIN;
+
+   mxs_dma_flush_desc(last);
}
pdesc->flags |= MXS_DMA_DESC_READY;
if (pdesc->flags & MXS_DMA_DESC_FIRST)
pchan->pending_num++;
list_add_tail(&pdesc->node, &pchan->active);
 
+   mxs_dma_flush_desc(pdesc);
+
return ret;
 }
 
-- 
1.7.9

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


[U-Boot] [PATCH 2/4] i.MX28: Enable caches by default

2012-03-02 Thread Marek Vasut
Signed-off-by: Marek Vasut 
Cc: Stefano Babic 
---
 arch/arm/cpu/arm926ejs/mx28/mx28.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c 
b/arch/arm/cpu/arm926ejs/mx28/mx28.c
index 9bfd83b..cf6d4e9 100644
--- a/arch/arm/cpu/arm926ejs/mx28/mx28.c
+++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c
@@ -63,6 +63,16 @@ void reset_cpu(ulong ignored)
;
 }
 
+void enable_caches(void)
+{
+#ifndef CONFIG_SYS_ICACHE_OFF
+   icache_enable();
+#endif
+#ifndef CONFIG_SYS_DCACHE_OFF
+   dcache_enable();
+#endif
+}
+
 int mx28_wait_mask_set(struct mx28_register_32 *reg, uint32_t mask, int 
timeout)
 {
while (--timeout) {
-- 
1.7.9

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


[U-Boot] [PATCH 1/4] ARM926EJS: Implement cache operations

2012-03-02 Thread Marek Vasut
Signed-off-by: Marek Vasut 
Cc: Stefano Babic 
---
 arch/arm/cpu/arm926ejs/cache.c |   66 ---
 1 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/cache.c b/arch/arm/cpu/arm926ejs/cache.c
index 504f604..5b23e3a 100644
--- a/arch/arm/cpu/arm926ejs/cache.c
+++ b/arch/arm/cpu/arm926ejs/cache.c
@@ -23,29 +23,71 @@
 #include 
 
 #ifndef CONFIG_SYS_DCACHE_OFF
-static inline void dcache_noop(void)
+
+#ifndef CONFIG_SYS_CACHELINE_SIZE
+#define CONFIG_SYS_CACHELINE_SIZE  32
+#endif
+
+void invalidate_dcache_all(void)
 {
-   if (dcache_status()) {
-   puts("WARNING: cache operations are not implemented!\n"
-"WARNING: disabling D-Cache now, you can re-enable it"
-"later with 'dcache on' command\n");
-   dcache_disable();
-   }
+   asm volatile("mcr p15, 0, %0, c7, c6, 0\n"::"r"(0));
 }
 
-void invalidate_dcache_all(void)
+void flush_dcache_all(void)
 {
-   dcache_noop();
+   asm volatile(
+   "0:"
+   "mrc p15, 0, r15, c7, c14, 3\n"
+   "bne 0b\n"
+   "mcr p15, 0, %0, c7, c10, 4\n"
+   ::"r"(0):"memory"
+   );
+}
+
+static int check_cache_range(unsigned long start, unsigned long stop)
+{
+   int ok = 1;
+
+   if (start & (CONFIG_SYS_CACHELINE_SIZE - 1))
+   ok = 0;
+
+   if (stop & (CONFIG_SYS_CACHELINE_SIZE - 1))
+   ok = 0;
+
+   if (!ok)
+   printf("CACHE: Misaligned operation at range [%08lx, %08lx]\n",
+   start, stop);
+
+   return ok;
 }
 
 void invalidate_dcache_range(unsigned long start, unsigned long stop)
 {
-   dcache_noop();
+   if (!check_cache_range(start, stop))
+   return;
+
+   while (start < stop) {
+   asm volatile("mcr p15, 0, %0, c7, c6, 1\n"::"r"(start));
+   start += CONFIG_SYS_CACHELINE_SIZE;
+   }
 }
 
 void flush_dcache_range(unsigned long start, unsigned long stop)
 {
-   dcache_noop();
+   if (!check_cache_range(start, stop))
+   return;
+
+   while (start < stop) {
+   asm volatile("mcr p15, 0, %0, c7, c14, 1\n"::"r"(start));
+   start += CONFIG_SYS_CACHELINE_SIZE;
+   }
+
+   asm("mcr p15, 0, %0, c7, c10, 4\n"::"r"(0));
+}
+
+void flush_cache(unsigned long start, unsigned long size)
+{
+   flush_dcache_range(start, start + size);
 }
 #else /* #ifndef CONFIG_SYS_DCACHE_OFF */
 void invalidate_dcache_all(void)
@@ -64,7 +106,7 @@ void flush_dcache_range(unsigned long start, unsigned long 
stop)
 {
 }
 
-void  flush_cache(unsigned long start, unsigned long size)
+void flush_cache(unsigned long start, unsigned long size)
 {
 }
 #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
-- 
1.7.9

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


[U-Boot] [PATCH 4/4] i.MX28: Add cache support to MXS NAND driver

2012-03-02 Thread Marek Vasut
Signed-off-by: Marek Vasut 
Cc: Stefano Babic 
---
 drivers/mtd/nand/mxs_nand.c |   53 --
 1 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index ce2a326..4b1297a 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -50,6 +50,7 @@ struct mxs_nand_info {
int cur_chip;
 
uint32_tcmd_queue_len;
+   uint32_tdata_buf_size;
 
uint8_t *cmd_buf;
uint8_t *data_buf;
@@ -73,6 +74,36 @@ struct mxs_nand_info {
 
 struct nand_ecclayout fake_ecc_layout;
 
+/*
+ * Cache management functions
+ */
+#ifndefCONFIG_SYS_DCACHE_OFF
+static void mxs_nand_flush_data_buf(struct mxs_nand_info *info)
+{
+   uint32_t addr = (uint32_t)info->data_buf;
+
+   flush_dcache_range(addr, addr + info->data_buf_size);
+}
+
+static void mxs_nand_inval_data_buf(struct mxs_nand_info *info)
+{
+   uint32_t addr = (uint32_t)info->data_buf;
+
+   invalidate_dcache_range(addr, addr + info->data_buf_size);
+}
+
+static void mxs_nand_flush_cmd_buf(struct mxs_nand_info *info)
+{
+   uint32_t addr = (uint32_t)info->cmd_buf;
+
+   flush_dcache_range(addr, addr + MXS_NAND_COMMAND_BUFFER_SIZE);
+}
+#else
+static inline void mxs_nand_flush_data_buf(struct mxs_nand_info *info) {}
+static inline void mxs_nand_inval_data_buf(struct mxs_nand_info *info) {}
+static inline void mxs_nand_flush_cmd_buf(struct mxs_nand_info *info) {}
+#endif
+
 static struct mxs_dma_desc *mxs_nand_get_dma_desc(struct mxs_nand_info *info)
 {
struct mxs_dma_desc *desc;
@@ -286,6 +317,9 @@ static void mxs_nand_cmd_ctrl(struct mtd_info *mtd, int 
data, unsigned int ctrl)
 
mxs_dma_desc_append(channel, d);
 
+   /* Flush caches */
+   mxs_nand_flush_cmd_buf(nand_info);
+
/* Execute the DMA chain. */
ret = mxs_dma_go(channel);
if (ret)
@@ -435,6 +469,9 @@ static void mxs_nand_read_buf(struct mtd_info *mtd, uint8_t 
*buf, int length)
goto rtn;
}
 
+   /* Invalidate caches */
+   mxs_nand_inval_data_buf(nand_info);
+
memcpy(buf, nand_info->data_buf, length);
 
 rtn:
@@ -484,6 +521,9 @@ static void mxs_nand_write_buf(struct mtd_info *mtd, const 
uint8_t *buf,
 
mxs_dma_desc_append(channel, d);
 
+   /* Flush caches */
+   mxs_nand_flush_data_buf(nand_info);
+
/* Execute the DMA chain. */
ret = mxs_dma_go(channel);
if (ret)
@@ -600,6 +640,9 @@ static int mxs_nand_ecc_read_page(struct mtd_info *mtd, 
struct nand_chip *nand,
goto rtn;
}
 
+   /* Invalidate caches */
+   mxs_nand_inval_data_buf(nand_info);
+
/* Read DMA completed, now do the mark swapping. */
mxs_nand_swap_block_mark(mtd, nand_info->data_buf, nand_info->oob_buf);
 
@@ -687,6 +730,9 @@ static void mxs_nand_ecc_write_page(struct mtd_info *mtd,
 
mxs_dma_desc_append(channel, d);
 
+   /* Flush caches */
+   mxs_nand_flush_data_buf(nand_info);
+
/* Execute the DMA chain. */
ret = mxs_dma_go(channel);
if (ret) {
@@ -978,18 +1024,19 @@ int mxs_nand_alloc_buffers(struct mxs_nand_info 
*nand_info)
uint8_t *buf;
const int size = NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE;
 
+   nand_info->data_buf_size = roundup(size, MXS_DMA_ALIGNMENT);
+
/* DMA buffers */
-   buf = memalign(MXS_DMA_ALIGNMENT, size);
+   buf = memalign(MXS_DMA_ALIGNMENT, nand_info->data_buf_size);
if (!buf) {
printf("MXS NAND: Error allocating DMA buffers\n");
return -ENOMEM;
}
 
-   memset(buf, 0, size);
+   memset(buf, 0, nand_info->data_buf_size);
 
nand_info->data_buf = buf;
nand_info->oob_buf = buf + NAND_MAX_PAGESIZE;
-
/* Command buffers */
nand_info->cmd_buf = memalign(MXS_DMA_ALIGNMENT,
MXS_NAND_COMMAND_BUFFER_SIZE);
-- 
1.7.9

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


Re: [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF is not set

2012-03-02 Thread Stefan Roese
Hi Amit,

On Wednesday 29 February 2012 10:10:20 Amit Virdi wrote:
> > You could tune this udelay(100) down more or even remove it completely.
> > 
> > But such a change could be done in a addon cleanup patch, changing all
> > timeout loops this way. I suggest you take a look at my version, here
> > these loops are changes. In the designware networking driver as well,
> > iirc.
> 
> Thanks for pointing out. In a separate cleanup patch, I shall be
> changing all the timeout loops for smi driver. I'll check other ST
> drivers too and change the timer implementation there too.

Good.

Thanks,
Stefan

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


[U-Boot] [PATCH v4] usb: align buffers at cacheline

2012-03-02 Thread Puneet Saxena
As DMA expects the buffers to be equal and larger then
cache lines, This aligns buffers at cacheline.

Signed-off-by: Puneet Saxena 
---

Changes for V3:
- Removed local descriptor elements copy to global descriptor elements
- Removed "Signed-off-by: Jim Lin " from commit message

Changes for V4:
- Added memcpy to copy local descriptor to global descriptor.
  Without that, USB version, class, vendor, product Id...etc is not 
configured.
  This information is useful for loading correct device driver and possible 
  configuration.  


 common/cmd_usb.c|3 +-
 common/usb.c|   56 ++--
 common/usb_storage.c|   59 --
 disk/part_dos.c |2 +-
 drivers/usb/host/ehci-hcd.c |8 ++
 include/scsi.h  |4 ++-
 6 files changed, 73 insertions(+), 59 deletions(-)

diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 320667f..bca9d94 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass, unsigned 
char subclass,
 
 void usb_display_string(struct usb_device *dev, int index)
 {
-   char buffer[256];
+   ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
+
if (index != 0) {
if (usb_string(dev, index, &buffer[0], 256) > 0)
printf("String: \"%s\"", buffer);
diff --git a/common/usb.c b/common/usb.c
index 6e21ae2..42a44e2 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];
 static int dev_index;
 static int running;
 static int asynch_allowed;
-static struct devrequest setup_packet;
 
 char usb_started; /* flag for the started/stopped USB status */
 
@@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev, unsigned int 
pipe,
unsigned short value, unsigned short index,
void *data, unsigned short size, int timeout)
 {
+   ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
+   sizeof(struct devrequest));
if ((timeout == 0) && (!asynch_allowed)) {
/* request for a asynch control pipe is not allowed */
return -1;
}
 
/* set setup command */
-   setup_packet.requesttype = requesttype;
-   setup_packet.request = request;
-   setup_packet.value = cpu_to_le16(value);
-   setup_packet.index = cpu_to_le16(index);
-   setup_packet.length = cpu_to_le16(size);
+   setup_packet->requesttype = requesttype;
+   setup_packet->request = request;
+   setup_packet->value = cpu_to_le16(value);
+   setup_packet->index = cpu_to_le16(index);
+   setup_packet->length = cpu_to_le16(size);
USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, " \
   "value 0x%X index 0x%X length 0x%X\n",
   request, requesttype, value, index, size);
dev->status = USB_ST_NOT_PROC; /*not yet processed */
 
-   submit_control_msg(dev, pipe, data, size, &setup_packet);
+   submit_control_msg(dev, pipe, data, size, setup_packet);
if (timeout == 0)
return (int)size;
 
@@ -698,7 +699,7 @@ static int usb_string_sub(struct usb_device *dev, unsigned 
int langid,
  */
 int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
 {
-   unsigned char mybuf[USB_BUFSIZ];
+   ALLOC_CACHE_ALIGN_BUFFER(unsigned char, mybuf, USB_BUFSIZ);
unsigned char *tbuf;
int err;
unsigned int u, idx;
@@ -798,7 +799,7 @@ int usb_new_device(struct usb_device *dev)
 {
int addr, err;
int tmp;
-   unsigned char tmpbuf[USB_BUFSIZ];
+   ALLOC_CACHE_ALIGN_BUFFER(unsigned char, tmpbuf, USB_BUFSIZ);
 
/* We still haven't set the Address yet */
addr = dev->devnum;
@@ -909,7 +910,7 @@ int usb_new_device(struct usb_device *dev)
tmp = sizeof(dev->descriptor);
 
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
-&dev->descriptor, sizeof(dev->descriptor));
+desc, sizeof(dev->descriptor));
if (err < tmp) {
if (err < 0)
printf("unable to get device descriptor (error=%d)\n",
@@ -919,14 +920,18 @@ int usb_new_device(struct usb_device *dev)
"(expected %i, got %i)\n", tmp, err);
return 1;
}
+
+   /* Now copy the local device descriptor to global device descriptor*/
+   memcpy(&dev->descriptor, desc, sizeof(dev->descriptor));
+
/* correct le values */
le16_to_cpus(&dev->descriptor.bcdUSB);
le16_to_cpus(&dev->descriptor.idVendor);
le16_to_cpus(&dev->descriptor.idProduct);
le16_to_cpus(&dev->descriptor.bcdDevice);
/* only support for one config for now */
-   usb_get_configuration_no(dev, &tmpbuf[0],

Re: [U-Boot] [PATCH 2/3] SPEAr: Configure FSMC driver for NAND interface

2012-03-02 Thread Stefan Roese
Hi Scott,

On Wednesday 29 February 2012 19:03:20 Scott Wood wrote:
> >>> You also need the following define for this to work with the latest
> >>> NAND subsystem:
> >>> 
> >>> #define CONFIG_MTD_ECC_SOFT
> >>> 
> >>> Not sure about SPEAr3xx. Most likely this needs it as well.
> >> 
> >> This is going to be reverted for now -- I meant to leave it out of the
> >> last patchset because of the need to update all boards (which the patch
> >> did not do).
> > 
> > Sorry, I didn't get you. Could you please elaborate?
> 
> It was intended to reduce U-Boot code size in cases where soft ECC is
> not needed.  However, the patch that introduced it did not update the
> boards to select it when necessary, so it is being reverted for now.

Okay, but it does not "hurt" to add this define to platforms using soft ECC 
right now, when such NAND driver related config options are updated? Or would 
you advise to remove it for now?

Thanks,
Stefan

--
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 v4] usb: align buffers at cacheline

2012-03-02 Thread Marek Vasut
> As DMA expects the buffers to be equal and larger then
> cache lines, This aligns buffers at cacheline.
> 
> Signed-off-by: Puneet Saxena 
> ---
> 
> Changes for V3:
> - Removed local descriptor elements copy to global descriptor elements
> - Removed "Signed-off-by: Jim Lin " from commit
> message
> 
> Changes for V4:
> - Added memcpy to copy local descriptor to global descriptor.
>   Without that, USB version, class, vendor, product Id...etc is not
> configured. This information is useful for loading correct device driver
> and possible configuration.
> 
> 
>  common/cmd_usb.c|3 +-
>  common/usb.c|   56
> ++-- common/usb_storage.c|  
> 59 -- disk/part_dos.c
> |2 +-
>  drivers/usb/host/ehci-hcd.c |8 ++
>  include/scsi.h  |4 ++-
>  6 files changed, 73 insertions(+), 59 deletions(-)
> 
> diff --git a/common/cmd_usb.c b/common/cmd_usb.c
> index 320667f..bca9d94 100644
> --- a/common/cmd_usb.c
> +++ b/common/cmd_usb.c
> @@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass,
> unsigned char subclass,
> 
>  void usb_display_string(struct usb_device *dev, int index)
>  {
> - char buffer[256];
> + ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
> +
>   if (index != 0) {
>   if (usb_string(dev, index, &buffer[0], 256) > 0)
>   printf("String: \"%s\"", buffer);
> diff --git a/common/usb.c b/common/usb.c
> index 6e21ae2..42a44e2 100644
> --- a/common/usb.c
> +++ b/common/usb.c
> @@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];
>  static int dev_index;
>  static int running;
>  static int asynch_allowed;
> -static struct devrequest setup_packet;
> 
>  char usb_started; /* flag for the started/stopped USB status */
> 
> @@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev, unsigned
> int pipe, unsigned short value, unsigned short index,
>   void *data, unsigned short size, int timeout)
>  {
> + ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
> + sizeof(struct devrequest));
>   if ((timeout == 0) && (!asynch_allowed)) {
>   /* request for a asynch control pipe is not allowed */
>   return -1;
>   }
> 
>   /* set setup command */
> - setup_packet.requesttype = requesttype;
> - setup_packet.request = request;
> - setup_packet.value = cpu_to_le16(value);
> - setup_packet.index = cpu_to_le16(index);
> - setup_packet.length = cpu_to_le16(size);
> + setup_packet->requesttype = requesttype;
> + setup_packet->request = request;
> + setup_packet->value = cpu_to_le16(value);
> + setup_packet->index = cpu_to_le16(index);
> + setup_packet->length = cpu_to_le16(size);
>   USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, " \
>  "value 0x%X index 0x%X length 0x%X\n",
>  request, requesttype, value, index, size);
>   dev->status = USB_ST_NOT_PROC; /*not yet processed */
> 
> - submit_control_msg(dev, pipe, data, size, &setup_packet);
> + submit_control_msg(dev, pipe, data, size, setup_packet);
>   if (timeout == 0)
>   return (int)size;
> 
> @@ -698,7 +699,7 @@ static int usb_string_sub(struct usb_device *dev,
> unsigned int langid, */
>  int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
>  {
> - unsigned char mybuf[USB_BUFSIZ];
> + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, mybuf, USB_BUFSIZ);
>   unsigned char *tbuf;
>   int err;
>   unsigned int u, idx;
> @@ -798,7 +799,7 @@ int usb_new_device(struct usb_device *dev)
>  {
>   int addr, err;
>   int tmp;
> - unsigned char tmpbuf[USB_BUFSIZ];
> + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, tmpbuf, USB_BUFSIZ);
> 
>   /* We still haven't set the Address yet */
>   addr = dev->devnum;
> @@ -909,7 +910,7 @@ int usb_new_device(struct usb_device *dev)
>   tmp = sizeof(dev->descriptor);
> 
>   err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
> -  &dev->descriptor, sizeof(dev->descriptor));
> +  desc, sizeof(dev->descriptor));
>   if (err < tmp) {
>   if (err < 0)
>   printf("unable to get device descriptor (error=%d)\n",
> @@ -919,14 +920,18 @@ int usb_new_device(struct usb_device *dev)
>   "(expected %i, got %i)\n", tmp, err);
>   return 1;
>   }
> +
> + /* Now copy the local device descriptor to global device descriptor*/
> + memcpy(&dev->descriptor, desc, sizeof(dev->descriptor));

Hey, it's almost perfect!

Just one last question -- why do you need to copy this stuff? It's because dev-
>descriptor is unaligned?

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

Re: [U-Boot] [PATCH v4] usb: align buffers at cacheline

2012-03-02 Thread puneets

On Friday 02 March 2012 07:16 PM, Marek Vasut wrote:

As DMA expects the buffers to be equal and larger then
cache lines, This aligns buffers at cacheline.

Signed-off-by: Puneet Saxena
---

Changes for V3:
 - Removed local descriptor elements copy to global descriptor elements
 - Removed "Signed-off-by: Jim Lin" from commit
message

Changes for V4:
 - Added memcpy to copy local descriptor to global descriptor.
   Without that, USB version, class, vendor, product Id...etc is not
configured. This information is useful for loading correct device driver
and possible configuration.


  common/cmd_usb.c|3 +-
  common/usb.c|   56
++-- common/usb_storage.c|
59 -- disk/part_dos.c
|2 +-
  drivers/usb/host/ehci-hcd.c |8 ++
  include/scsi.h  |4 ++-
  6 files changed, 73 insertions(+), 59 deletions(-)

diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 320667f..bca9d94 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass,
unsigned char subclass,

  void usb_display_string(struct usb_device *dev, int index)
  {
-   char buffer[256];
+   ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
+
if (index != 0) {
if (usb_string(dev, index,&buffer[0], 256)>  0)
printf("String: \"%s\"", buffer);
diff --git a/common/usb.c b/common/usb.c
index 6e21ae2..42a44e2 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];
  static int dev_index;
  static int running;
  static int asynch_allowed;
-static struct devrequest setup_packet;

  char usb_started; /* flag for the started/stopped USB status */

@@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev, unsigned
int pipe, unsigned short value, unsigned short index,
void *data, unsigned short size, int timeout)
  {
+   ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
+   sizeof(struct devrequest));
if ((timeout == 0)&&  (!asynch_allowed)) {
/* request for a asynch control pipe is not allowed */
return -1;
}

/* set setup command */
-   setup_packet.requesttype = requesttype;
-   setup_packet.request = request;
-   setup_packet.value = cpu_to_le16(value);
-   setup_packet.index = cpu_to_le16(index);
-   setup_packet.length = cpu_to_le16(size);
+   setup_packet->requesttype = requesttype;
+   setup_packet->request = request;
+   setup_packet->value = cpu_to_le16(value);
+   setup_packet->index = cpu_to_le16(index);
+   setup_packet->length = cpu_to_le16(size);
USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, " \
   "value 0x%X index 0x%X length 0x%X\n",
   request, requesttype, value, index, size);
dev->status = USB_ST_NOT_PROC; /*not yet processed */

-   submit_control_msg(dev, pipe, data, size,&setup_packet);
+   submit_control_msg(dev, pipe, data, size, setup_packet);
if (timeout == 0)
return (int)size;

@@ -698,7 +699,7 @@ static int usb_string_sub(struct usb_device *dev,
unsigned int langid, */
  int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
  {
-   unsigned char mybuf[USB_BUFSIZ];
+   ALLOC_CACHE_ALIGN_BUFFER(unsigned char, mybuf, USB_BUFSIZ);
unsigned char *tbuf;
int err;
unsigned int u, idx;
@@ -798,7 +799,7 @@ int usb_new_device(struct usb_device *dev)
  {
int addr, err;
int tmp;
-   unsigned char tmpbuf[USB_BUFSIZ];
+   ALLOC_CACHE_ALIGN_BUFFER(unsigned char, tmpbuf, USB_BUFSIZ);

/* We still haven't set the Address yet */
addr = dev->devnum;
@@ -909,7 +910,7 @@ int usb_new_device(struct usb_device *dev)
tmp = sizeof(dev->descriptor);

err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
-   &dev->descriptor, sizeof(dev->descriptor));
+desc, sizeof(dev->descriptor));
if (err<  tmp) {
if (err<  0)
printf("unable to get device descriptor (error=%d)\n",
@@ -919,14 +920,18 @@ int usb_new_device(struct usb_device *dev)
"(expected %i, got %i)\n", tmp, err);
return 1;
}
+
+   /* Now copy the local device descriptor to global device descriptor*/
+   memcpy(&dev->descriptor, desc, sizeof(dev->descriptor));

Hey, it's almost perfect!

Just one last question -- why do you need to copy this stuff?

We need to copy this stuff as I spoke in previous reply  -
"memcpy" is needed to configure Usb version, vendor id, prod Id ..etc

 of the device. Its also useful to hook actual device driver and detect
 no. of configuration supported. The

Re: [U-Boot] [PATCH] Avoid using GNU basename

2012-03-02 Thread Keith Mok
Hi Wolfgang,

> Besides - I agree with Mike's comment how your MacOS issue should be
> fixed.
But will Mike's fix break Windows user which cross-compile u-boot ?
The path separator is '\' instead of '/'


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


Re: [U-Boot] [PATCH v4] usb: align buffers at cacheline

2012-03-02 Thread Marek Vasut
> On Friday 02 March 2012 07:16 PM, Marek Vasut wrote:
> >> As DMA expects the buffers to be equal and larger then
> >> cache lines, This aligns buffers at cacheline.
> >> 
> >> Signed-off-by: Puneet Saxena
> >> ---
> >> 
> >> Changes for V3:
> >>  - Removed local descriptor elements copy to global descriptor
> >>  elements - Removed "Signed-off-by: Jim Lin" from
> >>  commit
> >> 
> >> message
> >> 
> >> Changes for V4:
> >>  - Added memcpy to copy local descriptor to global descriptor.
> >>  
> >>Without that, USB version, class, vendor, product Id...etc is not
> >> 
> >> configured. This information is useful for loading correct device driver
> >> and possible configuration.
> >> 
> >>   common/cmd_usb.c|3 +-
> >>   common/usb.c|   56
> >> 
> >> ++-- common/usb_storage.c|
> >> 59 -- disk/part_dos.c
> >> 
> >> |2 +-
> >>   
> >>   drivers/usb/host/ehci-hcd.c |8 ++
> >>   include/scsi.h  |4 ++-
> >>   6 files changed, 73 insertions(+), 59 deletions(-)
> >> 
> >> diff --git a/common/cmd_usb.c b/common/cmd_usb.c
> >> index 320667f..bca9d94 100644
> >> --- a/common/cmd_usb.c
> >> +++ b/common/cmd_usb.c
> >> @@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass,
> >> unsigned char subclass,
> >> 
> >>   void usb_display_string(struct usb_device *dev, int index)
> >>   {
> >> 
> >> -  char buffer[256];
> >> +  ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
> >> +
> >> 
> >>if (index != 0) {
> >>
> >>if (usb_string(dev, index,&buffer[0], 256)>  0)
> >>
> >>printf("String: \"%s\"", buffer);
> >> 
> >> diff --git a/common/usb.c b/common/usb.c
> >> index 6e21ae2..42a44e2 100644
> >> --- a/common/usb.c
> >> +++ b/common/usb.c
> >> @@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];
> >> 
> >>   static int dev_index;
> >>   static int running;
> >>   static int asynch_allowed;
> >> 
> >> -static struct devrequest setup_packet;
> >> 
> >>   char usb_started; /* flag for the started/stopped USB status */
> >> 
> >> @@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev,
> >> unsigned int pipe, unsigned short value, unsigned short index,
> >> 
> >>void *data, unsigned short size, int timeout)
> >>   
> >>   {
> >> 
> >> +  ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
> >> +  sizeof(struct devrequest));
> >> 
> >>if ((timeout == 0)&&  (!asynch_allowed)) {
> >>
> >>/* request for a asynch control pipe is not allowed */
> >>return -1;
> >>
> >>}
> >>
> >>/* set setup command */
> >> 
> >> -  setup_packet.requesttype = requesttype;
> >> -  setup_packet.request = request;
> >> -  setup_packet.value = cpu_to_le16(value);
> >> -  setup_packet.index = cpu_to_le16(index);
> >> -  setup_packet.length = cpu_to_le16(size);
> >> +  setup_packet->requesttype = requesttype;
> >> +  setup_packet->request = request;
> >> +  setup_packet->value = cpu_to_le16(value);
> >> +  setup_packet->index = cpu_to_le16(index);
> >> +  setup_packet->length = cpu_to_le16(size);
> >> 
> >>USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, " \
> >>
> >>   "value 0x%X index 0x%X length 0x%X\n",
> >>   request, requesttype, value, index, size);
> >>
> >>dev->status = USB_ST_NOT_PROC; /*not yet processed */
> >> 
> >> -  submit_control_msg(dev, pipe, data, size,&setup_packet);
> >> +  submit_control_msg(dev, pipe, data, size, setup_packet);
> >> 
> >>if (timeout == 0)
> >>
> >>return (int)size;
> >> 
> >> @@ -698,7 +699,7 @@ static int usb_string_sub(struct usb_device *dev,
> >> unsigned int langid, */
> >> 
> >>   int usb_string(struct usb_device *dev, int index, char *buf, size_t
> >>   size) {
> >> 
> >> -  unsigned char mybuf[USB_BUFSIZ];
> >> +  ALLOC_CACHE_ALIGN_BUFFER(unsigned char, mybuf, USB_BUFSIZ);
> >> 
> >>unsigned char *tbuf;
> >>int err;
> >>unsigned int u, idx;
> >> 
> >> @@ -798,7 +799,7 @@ int usb_new_device(struct usb_device *dev)
> >> 
> >>   {
> >>   
> >>int addr, err;
> >>int tmp;
> >> 
> >> -  unsigned char tmpbuf[USB_BUFSIZ];
> >> +  ALLOC_CACHE_ALIGN_BUFFER(unsigned char, tmpbuf, USB_BUFSIZ);
> >> 
> >>/* We still haven't set the Address yet */
> >>addr = dev->devnum;
> >> 
> >> @@ -909,7 +910,7 @@ int usb_new_device(struct usb_device *dev)
> >> 
> >>tmp = sizeof(dev->descriptor);
> >>
> >>err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
> >> 
> >> -  &dev->descriptor, sizeof(dev->descriptor));
> >> +   desc, sizeof(dev->descriptor));
> >> 
> >>if (err<  tmp) {
> >>
> >>if (err<  0)
> >>
> >>printf("unable to get device descriptor (error=%d)\n",
> >> 
> >> @@ -919,14 +920,18 @@ 

[U-Boot] [PATCH v2] lsxl: add support for lschlv2 and lsxhl

2012-03-02 Thread Michael Walle
This patchset adds support for both the Linkstation Live (LS-CHLv2) and
Linkstation Pro (LS-XHL) by Buffalo.

Signed-off-by: Michael Walle 
Cc: Prafulla Wadaskar 
Cc: Wolfgang Denk 
---

v2:
 - add to buffalo vendor directory instead of Marvell
 - add both boards to MAINTAINERS
 - don't define values for feature macros
 - use tab for vertical alignment
 - remove static network configuration, instead introduce a rescue mode
 - add some convenience scripts
 - small cleanups

 MAINTAINERS   |5 +
 board/buffalo/lsxl/Makefile   |   50 ++
 board/buffalo/lsxl/config.mk  |1 +
 board/buffalo/lsxl/kwbimage-lschl.cfg |   66 
 board/buffalo/lsxl/kwbimage-lsxhl.cfg |   66 
 board/buffalo/lsxl/lsxl.c |  294 +
 board/buffalo/lsxl/lsxl.h |   75 +
 boards.cfg|3 +
 include/configs/lsxl.h|  171 +++
 9 files changed, 731 insertions(+), 0 deletions(-)
 create mode 100644 board/buffalo/lsxl/Makefile
 create mode 100644 board/buffalo/lsxl/config.mk
 create mode 100644 board/buffalo/lsxl/kwbimage-lschl.cfg
 create mode 100644 board/buffalo/lsxl/kwbimage-lsxhl.cfg
 create mode 100644 board/buffalo/lsxl/lsxl.c
 create mode 100644 board/buffalo/lsxl/lsxl.h
 create mode 100644 include/configs/lsxl.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 1e40af2..25a5a5d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -905,6 +905,11 @@ Prafulla Wadaskar 
rd6281a ARM926EJS (Kirkwood SoC)
sheevaplug  ARM926EJS (Kirkwood SoC)
 
+Michael Walle 
+
+   lschlv2 ARM926EJS (Kirkwood SoC)
+   lsxhl   ARM926EJS (Kirkwood SoC)
+
 Tom Warren 
 
harmony Tegra2 (ARM7 & A9 Dual Core)
diff --git a/board/buffalo/lsxl/Makefile b/board/buffalo/lsxl/Makefile
new file mode 100644
index 000..4c08079
--- /dev/null
+++ b/board/buffalo/lsxl/Makefile
@@ -0,0 +1,50 @@
+#
+# Copyright (c) 2011 Michael Walle
+# Michael Walle 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := lsxl.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak .depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/buffalo/lsxl/config.mk b/board/buffalo/lsxl/config.mk
new file mode 100644
index 000..062554b
--- /dev/null
+++ b/board/buffalo/lsxl/config.mk
@@ -0,0 +1 @@
+ALL-y += $(obj)u-boot.kwb
diff --git a/board/buffalo/lsxl/kwbimage-lschl.cfg 
b/board/buffalo/lsxl/kwbimage-lschl.cfg
new file mode 100644
index 000..4d96c3f
--- /dev/null
+++ b/board/buffalo/lsxl/kwbimage-lschl.cfg
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2011 Michael Walle
+# Michael Walle 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.kwimage for more details about how-to configure
+# and create kirkwood boot image
+#
+
+# Boot Media configurations
+BOOT_FROM  spi # Boot from SPI flash
+
+# SOC registers config

Re: [U-Boot] [PATCH v4] usb: align buffers at cacheline

2012-03-02 Thread puneets

On Friday 02 March 2012 08:11 PM, Marek Vasut wrote:

On Friday 02 March 2012 07:16 PM, Marek Vasut wrote:

As DMA expects the buffers to be equal and larger then
cache lines, This aligns buffers at cacheline.

Signed-off-by: Puneet Saxena
---

Changes for V3:
  - Removed local descriptor elements copy to global descriptor
  elements - Removed "Signed-off-by: Jim Lin" from
  commit

message

Changes for V4:
  - Added memcpy to copy local descriptor to global descriptor.

Without that, USB version, class, vendor, product Id...etc is not

configured. This information is useful for loading correct device driver
and possible configuration.

   common/cmd_usb.c|3 +-
   common/usb.c|   56

++-- common/usb_storage.c|
59 -- disk/part_dos.c

|2 +-

   drivers/usb/host/ehci-hcd.c |8 ++
   include/scsi.h  |4 ++-
   6 files changed, 73 insertions(+), 59 deletions(-)

diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 320667f..bca9d94 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass,
unsigned char subclass,

   void usb_display_string(struct usb_device *dev, int index)
   {

-   char buffer[256];
+   ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
+

if (index != 0) {

if (usb_string(dev, index,&buffer[0], 256)>   0)

printf("String: \"%s\"", buffer);

diff --git a/common/usb.c b/common/usb.c
index 6e21ae2..42a44e2 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];

   static int dev_index;
   static int running;
   static int asynch_allowed;

-static struct devrequest setup_packet;

   char usb_started; /* flag for the started/stopped USB status */

@@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev,
unsigned int pipe, unsigned short value, unsigned short index,

void *data, unsigned short size, int timeout)

   {

+   ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
+   sizeof(struct devrequest));

if ((timeout == 0)&&   (!asynch_allowed)) {

/* request for a asynch control pipe is not allowed */
return -1;

}

/* set setup command */

-   setup_packet.requesttype = requesttype;
-   setup_packet.request = request;
-   setup_packet.value = cpu_to_le16(value);
-   setup_packet.index = cpu_to_le16(index);
-   setup_packet.length = cpu_to_le16(size);
+   setup_packet->requesttype = requesttype;
+   setup_packet->request = request;
+   setup_packet->value = cpu_to_le16(value);
+   setup_packet->index = cpu_to_le16(index);
+   setup_packet->length = cpu_to_le16(size);

USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, " \

   "value 0x%X index 0x%X length 0x%X\n",
   request, requesttype, value, index, size);

dev->status = USB_ST_NOT_PROC; /*not yet processed */

-   submit_control_msg(dev, pipe, data, size,&setup_packet);
+   submit_control_msg(dev, pipe, data, size, setup_packet);

if (timeout == 0)

return (int)size;

@@ -698,7 +699,7 @@ static int usb_string_sub(struct usb_device *dev,
unsigned int langid, */

   int usb_string(struct usb_device *dev, int index, char *buf, size_t
   size) {

-   unsigned char mybuf[USB_BUFSIZ];
+   ALLOC_CACHE_ALIGN_BUFFER(unsigned char, mybuf, USB_BUFSIZ);

unsigned char *tbuf;
int err;
unsigned int u, idx;

@@ -798,7 +799,7 @@ int usb_new_device(struct usb_device *dev)

   {

int addr, err;
int tmp;

-   unsigned char tmpbuf[USB_BUFSIZ];
+   ALLOC_CACHE_ALIGN_BUFFER(unsigned char, tmpbuf, USB_BUFSIZ);

/* We still haven't set the Address yet */
addr = dev->devnum;

@@ -909,7 +910,7 @@ int usb_new_device(struct usb_device *dev)

tmp = sizeof(dev->descriptor);

err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,

-   &dev->descriptor, sizeof(dev->descriptor));
+desc, sizeof(dev->descriptor));

if (err<   tmp) {

if (err<   0)

printf("unable to get device descriptor (error=%d)\n",

@@ -919,14 +920,18 @@ int usb_new_device(struct usb_device *dev)

"(expected %i, got %i)\n", tmp, err);

return 1;

}

+
+   /* Now copy the local device descriptor to global device descriptor*/
+   memcpy(&dev->descriptor, desc, sizeof(dev->descriptor));

Hey, it's almost perfect!

Just one last question -- why do you need to cop

Re: [U-Boot] [PATCH v4] usb: align buffers at cacheline

2012-03-02 Thread Marek Vasut
> On Friday 02 March 2012 08:11 PM, Marek Vasut wrote:
> >> On Friday 02 March 2012 07:16 PM, Marek Vasut wrote:
>  As DMA expects the buffers to be equal and larger then
>  cache lines, This aligns buffers at cacheline.
>  
>  Signed-off-by: Puneet Saxena
>  ---
>  
>  Changes for V3:
>    - Removed local descriptor elements copy to global descriptor
>    elements - Removed "Signed-off-by: Jim Lin"
>    from commit
>  
>  message
>  
>  Changes for V4:
>    - Added memcpy to copy local descriptor to global descriptor.
>    
>  Without that, USB version, class, vendor, product Id...etc is
>  not
>  
>  configured. This information is useful for loading correct device
>  driver and possible configuration.
>  
> common/cmd_usb.c|3 +-
> common/usb.c|   56
>  
>  ++-- common/usb_storage.c|
>  59 -- disk/part_dos.c
>  
>  |2 +-
> 
> drivers/usb/host/ehci-hcd.c |8 ++
> include/scsi.h  |4 ++-
> 6 files changed, 73 insertions(+), 59 deletions(-)
>  
>  diff --git a/common/cmd_usb.c b/common/cmd_usb.c
>  index 320667f..bca9d94 100644
>  --- a/common/cmd_usb.c
>  +++ b/common/cmd_usb.c
>  @@ -150,7 +150,8 @@ void usb_display_class_sub(unsigned char dclass,
>  unsigned char subclass,
>  
> void usb_display_string(struct usb_device *dev, int index)
> {
>  
>  -char buffer[256];
>  +ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
>  +
>  
>   if (index != 0) {
>   
>   if (usb_string(dev, index,&buffer[0], 256)>   0)
>   
>   printf("String: \"%s\"", buffer);
>  
>  diff --git a/common/usb.c b/common/usb.c
>  index 6e21ae2..42a44e2 100644
>  --- a/common/usb.c
>  +++ b/common/usb.c
>  @@ -73,7 +73,6 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];
>  
> static int dev_index;
> static int running;
> static int asynch_allowed;
>  
>  -static struct devrequest setup_packet;
>  
> char usb_started; /* flag for the started/stopped USB status */
>  
>  @@ -185,23 +184,25 @@ int usb_control_msg(struct usb_device *dev,
>  unsigned int pipe, unsigned short value, unsigned short index,
>  
>   void *data, unsigned short size, int timeout)
> 
> {
>  
>  +ALLOC_CACHE_ALIGN_BUFFER(struct devrequest, setup_packet,
>  +sizeof(struct devrequest));
>  
>   if ((timeout == 0)&&   (!asynch_allowed)) {
>   
>   /* request for a asynch control pipe is not allowed */
>   return -1;
>   
>   }
>   
>   /* set setup command */
>  
>  -setup_packet.requesttype = requesttype;
>  -setup_packet.request = request;
>  -setup_packet.value = cpu_to_le16(value);
>  -setup_packet.index = cpu_to_le16(index);
>  -setup_packet.length = cpu_to_le16(size);
>  +setup_packet->requesttype = requesttype;
>  +setup_packet->request = request;
>  +setup_packet->value = cpu_to_le16(value);
>  +setup_packet->index = cpu_to_le16(index);
>  +setup_packet->length = cpu_to_le16(size);
>  
>   USB_PRINTF("usb_control_msg: request: 0x%X, requesttype: 0x%X, 
>  " 
\
>   
>  "value 0x%X index 0x%X length 0x%X\n",
>  request, requesttype, value, index, size);
>   
>   dev->status = USB_ST_NOT_PROC; /*not yet processed */
>  
>  -submit_control_msg(dev, pipe, data, size,&setup_packet);
>  +submit_control_msg(dev, pipe, data, size, setup_packet);
>  
>   if (timeout == 0)
>   
>   return (int)size;
>  
>  @@ -698,7 +699,7 @@ static int usb_string_sub(struct usb_device *dev,
>  unsigned int langid, */
>  
> int usb_string(struct usb_device *dev, int index, char *buf, size_t
> size) {
>  
>  -unsigned char mybuf[USB_BUFSIZ];
>  +ALLOC_CACHE_ALIGN_BUFFER(unsigned char, mybuf, USB_BUFSIZ);
>  
>   unsigned char *tbuf;
>   int err;
>   unsigned int u, idx;
>  
>  @@ -798,7 +799,7 @@ int usb_new_device(struct usb_device *dev)
>  
> {
> 
>   int addr, err;
>   int tmp;
>  
>  -unsigned char tmpbuf[USB_BUFSIZ];
>  +ALLOC_CACHE_A

Re: [U-Boot] [PATCH] Avoid using GNU basename

2012-03-02 Thread Wolfgang Denk
Dear Keith Mok,

In message  
you wrote:
> 
> > Besides - I agree with Mike's comment how your MacOS issue should be
> > fixed.
> But will Mike's fix break Windows user which cross-compile u-boot ?
> The path separator is '\' instead of '/'

I'm not a windows expert (actually I'm proud of never having worked
with Windows in my whole life), but I think it is only the command
line interface that insists of using '\\' (because DOS used '/' as
option switch).

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
Whom the gods would destroy, they first teach BASIC.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4] usb: align buffers at cacheline

2012-03-02 Thread Wolfgang Denk
In message <201203021659.21568.ma...@denx.de> you wrote:
>
...
> > That's what I did in original patch where I am aligning it by adding the
> > line
> > 
> > +/* Device Descriptor */
> > +#ifdef ARCH_DMA_MINALIGN
> > +   struct usb_device_descriptor descriptor
> > +   __attribute__((aligned(ARCH_DMA_MINALIGN)));
> > +#else
> > +   struct usb_device_descriptor descriptor;
> > +#endif
> > 
> > in usb.h Line:112
> > 
> > > M
> > 
> I see ...and I told you it's wrong? I must have misunderstood, I'm sorry 
> about 
> that. But if you actually do this, you can avoid memcpy, right?

And eventually wd can also avoid the #ifdef ?  I guess the
__attribute__((aligned...)) would not hurt anything?

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
Der Horizont vieler Menschen ist ein Kreis mit Radius Null --
und das nennen sie ihren Standpunkt.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] SPEAr: Configure FSMC driver for NAND interface

2012-03-02 Thread Scott Wood
On 03/02/2012 07:44 AM, Stefan Roese wrote:
> Hi Scott,
> 
> On Wednesday 29 February 2012 19:03:20 Scott Wood wrote:
> You also need the following define for this to work with the latest
> NAND subsystem:
>
> #define CONFIG_MTD_ECC_SOFT
>
> Not sure about SPEAr3xx. Most likely this needs it as well.

 This is going to be reverted for now -- I meant to leave it out of the
 last patchset because of the need to update all boards (which the patch
 did not do).
>>>
>>> Sorry, I didn't get you. Could you please elaborate?
>>
>> It was intended to reduce U-Boot code size in cases where soft ECC is
>> not needed.  However, the patch that introduced it did not update the
>> boards to select it when necessary, so it is being reverted for now.
> 
> Okay, but it does not "hurt" to add this define to platforms using soft ECC 
> right now, when such NAND driver related config options are updated? Or would 
> you advise to remove it for now?

It doesn't hurt, other than that you're defining an undocumented option,
assuming someone actually does put the effort into identifying the
affected boards soon (or implementing some sort of transition
mechanism), so that it doesn't just sit around forever without being used.

-Scott

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


Re: [U-Boot] [PATCH 3/3] ARM: Update mach-types

2012-03-02 Thread Stephen Warren
On 03/02/2012 12:00 AM, Wolfgang Denk wrote:
> Dear Troy Kisky,
> 
> In message <4f4ffd1f.4080...@boundarydevices.com> you wrote:
>>
>>> Not sure I understand why we have a "machine_ix_xxx()" here. Could you >
>>> explain?
>>>
>>> Amicalement,
>>
>> Because board/nvidia/seaboard/seaboard.c uses machine_is_ventana but >
>> that machine is no longer
>> in mach-types.
> 
> Then fix the seaboard.c code, please, instead of adding dead code.

I think that should actually be very easy. Can't the following:

if (machine_is_foo()) {
...
}

be converted to:

#if CONFIG_MACH_TYPE == MACH_TYPE_FOO
...
#endif

As a related note, I expect you'll see more and more boards that don't
exist in the kernel's mach-type.h since people won't register machine
IDs for boards that only support device tree.

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


Re: [U-Boot] [PATCH 5/7] net/designware: Try configuring phy on each dw_eth_init

2012-03-02 Thread Mike Frysinger
On Friday 02 March 2012 06:40:07 Amit Virdi wrote:
> On 3/1/2012 12:41 AM, Mike Frysinger wrote:
> >> +  u32 phy_configured;
> >> 
> >> >  +#define FALSE  (0)
> >> >  +#define TRUE   (!FALSE)
> > 
> > NAK: we already have "true" and "false" and the "bool" type.  use those
> > instead.
> 
> Are you sure Mike? I couldn't find in u-boot code "TRUE" and "FALSE"
> defined in any common header file.

i said "true" and "false", not "TRUE" and "FALSE"
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mkenvimage: fix usage message

2012-03-02 Thread Mike Frysinger
On Friday 02 March 2012 02:19:40 Wolfgang Denk wrote:
> Don;t use argv[0] for usage() because it may or may not be clobbered

Don't

> by the previous call to basename().  Use "prg" instead as it is done
> in the rest of the code.

Acked-by: Mike Frysinger 
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] ARM: Update mach-types

2012-03-02 Thread Troy Kisky

On 3/2/2012 10:45 AM, Stephen Warren wrote:

On 03/02/2012 12:00 AM, Wolfgang Denk wrote:

Dear Troy Kisky,

In message<4f4ffd1f.4080...@boundarydevices.com>  you wrote:

Not sure I understand why we have a "machine_ix_xxx()" here. Could you>
explain?

Amicalement,

Because board/nvidia/seaboard/seaboard.c uses machine_is_ventana but>
that machine is no longer
in mach-types.

Then fix the seaboard.c code, please, instead of adding dead code.

I think that should actually be very easy. Can't the following:

if (machine_is_foo()) {
 ...
}

be converted to:

#if CONFIG_MACH_TYPE == MACH_TYPE_FOO
 ...
#endif

As a related note, I expect you'll see more and more boards that don't
exist in the kernel's mach-type.h since people won't register machine
IDs for boards that only support device tree.


How about reversing the test


#if CONFIG_MACH_TYPE == MACH_TYPE_SEABORD

instead of

#if CONFIG_MACH_TYPE == MACH_TYPE_VENTANA

so that I don't care that ventana is no longer defined?


Thanks
Troy





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


Re: [U-Boot] [PATCH 3/3] ARM: Update mach-types

2012-03-02 Thread Stephen Warren
On 03/02/2012 12:37 PM, Troy Kisky wrote:
> On 3/2/2012 10:45 AM, Stephen Warren wrote:
>> On 03/02/2012 12:00 AM, Wolfgang Denk wrote:
>>> Dear Troy Kisky,
>>>
>>> In message<4f4ffd1f.4080...@boundarydevices.com>  you wrote:
> Not sure I understand why we have a "machine_ix_xxx()" here. Could you>
> explain?
>
> Amicalement,
 Because board/nvidia/seaboard/seaboard.c uses machine_is_ventana but>
 that machine is no longer
 in mach-types.
>>> Then fix the seaboard.c code, please, instead of adding dead code.
>> I think that should actually be very easy. Can't the following:
>>
>> if (machine_is_foo()) {
>>  ...
>> }
>>
>> be converted to:
>>
>> #if CONFIG_MACH_TYPE == MACH_TYPE_FOO
>>  ...
>> #endif
>>
>> As a related note, I expect you'll see more and more boards that don't
>> exist in the kernel's mach-type.h since people won't register machine
>> IDs for boards that only support device tree.
>>
> How about reversing the test
> 
> 
> #if CONFIG_MACH_TYPE == MACH_TYPE_SEABORD
> 
> instead of
> 
> #if CONFIG_MACH_TYPE == MACH_TYPE_VENTANA
> 
> so that I don't care that ventana is no longer defined?

That's probably fine.

A comment right above that states that Ventana is the other possibility
would be useful.

Of course, this isn't going to solve anything when we have 3 variants of
Seaboard, and only Seaboard is in mach-types.h but not the other 2, but
I suppose we can deal with that when it happens.

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


Re: [U-Boot] [PATCH 3/3] ARM: Update mach-types

2012-03-02 Thread Troy Kisky

On 3/1/2012 3:50 PM, Troy Kisky wrote:

On 3/1/2012 2:54 PM, Albert ARIBAUD wrote:

Hi Troy,

Le 01/03/2012 22:13, Troy Kisky a écrit :


diff --git a/include/configs/ea20.h b/include/configs/ea20.h
index b4610d9..da49ae8 100644
--- a/include/configs/ea20.h
+++ b/include/configs/ea20.h
@@ -24,6 +24,18 @@
  #define __CONFIG_H

  /*
+ * FIXME: This belongs in mach-types.h.  However, we only pull 
mach-types

+ * from Linus' kernel.org tree.
+ */
+#include
+#ifdef MACH_TYPE_EA20
+#error "MACH_TYPE_EA20 has been defined properly, please remove this."
+#else
+#define MACH_TYPE_EA203002
+#endif
+
+
+/*


Sorry if I am being pedantic here, but the "FIXME" comment actually 
belongs *below* the #include line, not above. Ditto for others.


I put it above because when it is moved to mach-types.h, the include 
should be deleted as well. That is part of the "FIXME."

Did I convince you, or do you still want it changed?


Thanks
Troy


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


[U-Boot] i.MX6: mx6qsabrelite: allow use with Freescale 2.6.38 kernels

2012-03-02 Thread Eric Nelson
This series of patches is needed to allow main-line U-Boot to be used
with Freescale's Linux 2.6.38 non-DT kernel releases.

These releases currently require at least the machine type and
revision atag entries and are configured to load boot scripts from
the ext3 filesystem.

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


[U-Boot] [PATCH 1/3] i.MX6: mx6qsabrelite: add CONFIG_REVISION_TAG

2012-03-02 Thread Eric Nelson
 Freescale 2.6.38 (Non-DT) kernels require the revision atag to
 enable the VPU.

Signed-off-by: Eric Nelson 
---
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |7 +++
 include/configs/mx6qsabrelite.h   |1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c 
b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
index db1bea9..590030b 100644
--- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
+++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
@@ -215,6 +215,13 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void)
+{
+   return 0x63000 ;
+}
+#endif
+
 #ifdef CONFIG_MXC_SPI
 iomux_v3_cfg_t ecspi1_pads[] = {
/* SS1 */
diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h
index 93000f0..85f6f7a 100644
--- a/include/configs/mx6qsabrelite.h
+++ b/include/configs/mx6qsabrelite.h
@@ -33,6 +33,7 @@
 #define CONFIG_CMDLINE_TAG
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
+#define CONFIG_REVISION_TAG
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
-- 
1.7.9

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


[U-Boot] [PATCH 2/3] i.MX6: mx6qsabrelite: add MACH_TYPE_MX6Q_SABRELITE

2012-03-02 Thread Eric Nelson
Allow non-dt kernels to boot

Signed-off-by: Troy Kisky 
---
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |6 --
 include/configs/mx6qsabrelite.h   |1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c 
b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
index 590030b..2786482 100644
--- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
+++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
@@ -282,8 +282,10 @@ int board_early_init_f(void)
 
 int board_init(void)
 {
-   /* address of boot parameters */
-   gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+   /* board id for linux */
+   gd->bd->bi_arch_number = MACH_TYPE_MX6Q_SABRELITE;
+   /* address of boot parameters */
+   gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
return 0;
 }
diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h
index 85f6f7a..53869a9 100644
--- a/include/configs/mx6qsabrelite.h
+++ b/include/configs/mx6qsabrelite.h
@@ -27,6 +27,7 @@
 #define CONFIG_SYS_MX6_CLK32   32768
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
+#define MACH_TYPE_MX6Q_SABRELITE   3769
 
 #include 
 
-- 
1.7.9

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


[U-Boot] [PATCH 3/3] i.MX6: mx6qsabrelite: add ext2 support

2012-03-02 Thread Eric Nelson
Current Ubuntu releases from Freescale contain a boot script in ext3 filesystem.

Signed-off-by: Eric Nelson 
---
 include/configs/mx6qsabrelite.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h
index 53869a9..51ed791 100644
--- a/include/configs/mx6qsabrelite.h
+++ b/include/configs/mx6qsabrelite.h
@@ -66,6 +66,7 @@
 #define CONFIG_MMC
 #define CONFIG_CMD_MMC
 #define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
 #define CONFIG_DOS_PARTITION
 
-- 
1.7.9

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


Re: [U-Boot] [PATCH 1/3] i.MX6: mx6qsabrelite: add CONFIG_REVISION_TAG

2012-03-02 Thread Marek Vasut
>  Freescale 2.6.38 (Non-DT) kernels require the revision atag to
>  enable the VPU.
> 
> Signed-off-by: Eric Nelson 
> ---
>  board/freescale/mx6qsabrelite/mx6qsabrelite.c |7 +++
>  include/configs/mx6qsabrelite.h   |1 +
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> b/board/freescale/mx6qsabrelite/mx6qsabrelite.c index db1bea9..590030b
> 100644
> --- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> +++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> @@ -215,6 +215,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
> 
> +#ifdef CONFIG_REVISION_TAG
> +u32 get_board_rev(void)
> +{
> + return 0x63000 ;
> +}
> +#endif
> +
>  #ifdef CONFIG_MXC_SPI
>  iomux_v3_cfg_t ecspi1_pads[] = {
>   /* SS1 */
> diff --git a/include/configs/mx6qsabrelite.h
> b/include/configs/mx6qsabrelite.h index 93000f0..85f6f7a 100644
> --- a/include/configs/mx6qsabrelite.h
> +++ b/include/configs/mx6qsabrelite.h
> @@ -33,6 +33,7 @@
>  #define CONFIG_CMDLINE_TAG
>  #define CONFIG_SETUP_MEMORY_TAGS
>  #define CONFIG_INITRD_TAG
> +#define CONFIG_REVISION_TAG

I think you can avoid this define altogether, you're using it anyway.

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


Re: [U-Boot] [PATCH 2/3] i.MX6: mx6qsabrelite: add MACH_TYPE_MX6Q_SABRELITE

2012-03-02 Thread Marek Vasut
> Allow non-dt kernels to boot
> 
> Signed-off-by: Troy Kisky 
> ---
>  board/freescale/mx6qsabrelite/mx6qsabrelite.c |6 --
>  include/configs/mx6qsabrelite.h   |1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> b/board/freescale/mx6qsabrelite/mx6qsabrelite.c index 590030b..2786482
> 100644
> --- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> +++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> @@ -282,8 +282,10 @@ int board_early_init_f(void)
> 
>  int board_init(void)
>  {
> -   /* address of boot parameters */
> -   gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
> + /* board id for linux */
> + gd->bd->bi_arch_number = MACH_TYPE_MX6Q_SABRELITE;
> + /* address of boot parameters */
> + gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
> 
> return 0;
>  }
> diff --git a/include/configs/mx6qsabrelite.h
> b/include/configs/mx6qsabrelite.h index 85f6f7a..53869a9 100644
> --- a/include/configs/mx6qsabrelite.h
> +++ b/include/configs/mx6qsabrelite.h
> @@ -27,6 +27,7 @@
>  #define CONFIG_SYS_MX6_CLK32   32768
>  #define CONFIG_DISPLAY_CPUINFO
>  #define CONFIG_DISPLAY_BOARDINFO
> +#define MACH_TYPE_MX6Q_SABRELITE   3769

Just use #define CONFIG_MACH_TYPE 3769

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


Re: [U-Boot] i.MX6: mx6qsabrelite: allow use with Freescale 2.6.38 kernels

2012-03-02 Thread Marek Vasut
> This series of patches is needed to allow main-line U-Boot to be used
> with Freescale's Linux 2.6.38 non-DT kernel releases.
> 
> These releases currently require at least the machine type and
> revision atag entries and are configured to load boot scripts from
> the ext3 filesystem.
> 

Almost looks good, just minor tweaks needed. Thanks for your good work so far, 
keep it up !

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


[U-Boot] [PATCH 0/4] Add preliminary cache support to i.MX6

2012-03-02 Thread Eric Nelson
This series of patches defines the prerequisites for cache support on i.MX6
to allow further driver development to occur.

It does not enable the use of the data cache by default. To enable
data cache, comment out this line in mx6qsabrelite.h or mx6qarm2.h:

#define CONFIG_SYS_DCACHE_OFF

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


[U-Boot] [PATCH 1/4] i.MX6: define CACHELINE_SIZE

2012-03-02 Thread Eric Nelson
---
 arch/arm/include/asm/arch-mx6/imx-regs.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 6a200bb..3e5c4c2 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -19,6 +19,8 @@
 #ifndef __ASM_ARCH_MX6_IMX_REGS_H__
 #define __ASM_ARCH_MX6_IMX_REGS_H__
 
+#define CONFIG_SYS_CACHELINE_SIZE  32
+
 #define ROMCP_ARB_BASE_ADDR 0x
 #define ROMCP_ARB_END_ADDR  0x000F
 #define CAAM_ARB_BASE_ADDR  0x0010
-- 
1.7.9

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


[U-Boot] [PATCH 3/4] i.MX6: implement enable_caches()

2012-03-02 Thread Eric Nelson
disabled by default until drivers are fixed

Signed-off-by: Eric Nelson 
---
 arch/arm/cpu/armv7/mx6/soc.c|8 
 include/configs/mx6qarm2.h  |2 ++
 include/configs/mx6qsabrelite.h |2 ++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 2ac74b5..eb418eb 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -79,6 +79,14 @@ int arch_cpu_init(void)
 }
 #endif
 
+#ifndef CONFIG_SYS_DCACHE_OFF
+void enable_caches(void)
+{
+   /* Enable D-cache. I-cache is already enabled in start.S */
+   dcache_enable();
+}
+#endif
+
 #if defined(CONFIG_FEC_MXC)
 void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 {
diff --git a/include/configs/mx6qarm2.h b/include/configs/mx6qarm2.h
index 0962d3c..e83aec6 100644
--- a/include/configs/mx6qarm2.h
+++ b/include/configs/mx6qarm2.h
@@ -169,4 +169,6 @@
 
 #define CONFIG_OF_LIBFDT
 
+#define CONFIG_SYS_DCACHE_OFF
+
 #endif /* __CONFIG_H */
diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h
index a1a2267..3bd9bdb 100644
--- a/include/configs/mx6qsabrelite.h
+++ b/include/configs/mx6qsabrelite.h
@@ -210,4 +210,6 @@
 
 #define CONFIG_OF_LIBFDT
 
+#define CONFIG_SYS_DCACHE_OFF
+
 #endif /* __CONFIG_H */
-- 
1.7.9

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


[U-Boot] [PATCH 4/4] i.MX6: mx6qsabrelite: add cache commands if cache is enabled

2012-03-02 Thread Eric Nelson
---
 include/configs/mx6qsabrelite.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h
index 3bd9bdb..a5dae73 100644
--- a/include/configs/mx6qsabrelite.h
+++ b/include/configs/mx6qsabrelite.h
@@ -212,4 +212,8 @@
 
 #define CONFIG_SYS_DCACHE_OFF
 
+#ifndef CONFIG_SYS_DCACHE_OFF
+#define CONFIG_CMD_CACHE
+#endif
+
 #endif /* __CONFIG_H */
-- 
1.7.9

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


[U-Boot] [PATCH 2/4] net: fec_mxc: allow use with cache enabled

2012-03-02 Thread Eric Nelson
ensure that transmit and receive buffers are cache-line aligned
invalidate cache after each packet received
flush cache before transmitting

Signed-off-by: Eric Nelson 
---
 drivers/net/fec_mxc.c |  248 -
 drivers/net/fec_mxc.h |   19 +
 2 files changed, 184 insertions(+), 83 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 1fdd071..f72304b 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -50,6 +50,33 @@ DECLARE_GLOBAL_DATA_PTR;
 #defineCONFIG_FEC_MXC_SWAP_PACKET
 #endif
 
+#ifndefCONFIG_FEC_DESC_ALIGNMENT
+#defineCONFIG_FEC_DESC_ALIGNMENT   ARCH_DMA_MINALIGN
+#endif
+
+#ifndefCONFIG_FEC_DATA_ALIGNMENT
+#defineCONFIG_FEC_DATA_ALIGNMENT   ARCH_DMA_MINALIGN
+#endif
+
+/* Check various alignment issues at compile time */
+#if ((CONFIG_FEC_DESC_ALIGNMENT < 16) || (CONFIG_FEC_DESC_ALIGNMENT % 16 != 0))
+#error "CONFIG_FEC_DESC_ALIGNMENT must be multiple of 16!"
+#endif
+
+#if ((CONFIG_FEC_DATA_ALIGNMENT < 16) || (CONFIG_FEC_DATA_ALIGNMENT % 16 != 0))
+#error "CONFIG_FEC_DATA_ALIGNMENT must be multiple of 16!"
+#endif
+
+#if ((PKTALIGN < CONFIG_FEC_DATA_ALIGNMENT) || \
+   (PKTALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
+#error "PKTALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
+#endif
+
+#if ((PKTSIZE_ALIGN < CONFIG_FEC_DATA_ALIGNMENT) || \
+   (PKTSIZE_ALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
+#error "PKTSIZE_ALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
+#endif
+
 #undef DEBUG
 
 struct nbuf {
@@ -259,43 +286,47 @@ static int fec_tx_task_disable(struct fec_priv *fec)
  * Initialize receive task's buffer descriptors
  * @param[in] fec all we know about the device yet
  * @param[in] count receive buffer count to be allocated
- * @param[in] size size of each receive buffer
+ * @param[in] dsize desired size of each receive buffer
  * @return 0 on success
  *
  * For this task we need additional memory for the data buffers. And each
  * data buffer requires some alignment. Thy must be aligned to a specific
- * boundary each (DB_DATA_ALIGNMENT).
+ * boundary each.
  */
-static int fec_rbd_init(struct fec_priv *fec, int count, int size)
+static int fec_rbd_init(struct fec_priv *fec, int count, int dsize)
 {
-   int ix;
-   uint32_t p = 0;
-
-   /* reserve data memory and consider alignment */
-   if (fec->rdb_ptr == NULL)
-   fec->rdb_ptr = malloc(size * count + DB_DATA_ALIGNMENT);
-   p = (uint32_t)fec->rdb_ptr;
-   if (!p) {
-   puts("fec_mxc: not enough malloc memory\n");
-   return -ENOMEM;
-   }
-   memset((void *)p, 0, size * count + DB_DATA_ALIGNMENT);
-   p += DB_DATA_ALIGNMENT-1;
-   p &= ~(DB_DATA_ALIGNMENT-1);
-
-   for (ix = 0; ix < count; ix++) {
-   writel(p, &fec->rbd_base[ix].data_pointer);
-   p += size;
-   writew(FEC_RBD_EMPTY, &fec->rbd_base[ix].status);
-   writew(0, &fec->rbd_base[ix].data_length);
-   }
+   uint32_t size;
+   int i;
+
/*
-* mark the last RBD to close the ring
+* Allocate memory for the buffers. This allocation respects the
+* alignment
 */
-   writew(FEC_RBD_WRAP | FEC_RBD_EMPTY, &fec->rbd_base[ix - 1].status);
+   size = roundup(dsize, CONFIG_FEC_DATA_ALIGNMENT);
+   for (i = 0; i < count; i++) {
+   if (0 == fec->rbd_base[i].data_pointer) {
+   uint8_t *data = memalign(CONFIG_FEC_DATA_ALIGNMENT, 
size);
+   if (!data) {
+   printf("%s: error allocating rxbuf %d\n", 
__func__, i);
+   goto err;
+   }
+   fec->rbd_base[i].data_pointer = (uint32_t)data;
+   } // needs allocation
+   fec->rbd_base[i].status = FEC_RBD_EMPTY;
+   fec->rbd_base[i].data_length = 0;
+   }
+
+   /* Mark the last RBD to close the ring. */
+   fec->rbd_base[i - 1].status = FEC_RBD_EMPTY | FEC_RBD_WRAP;
fec->rbd_index = 0;
 
return 0;
+
+err:
+   for (; i >= 0; i--)
+   free((uint8_t *)fec->rbd_base[i].data_pointer);
+
+   return -ENOMEM;
 }
 
 /**
@@ -312,8 +343,8 @@ static int fec_rbd_init(struct fec_priv *fec, int count, 
int size)
  */
 static void fec_tbd_init(struct fec_priv *fec)
 {
-   writew(0x, &fec->tbd_base[0].status);
-   writew(FEC_TBD_WRAP, &fec->tbd_base[1].status);
+   fec->tbd_base[0].status = 0;
+   fec->tbd_base[1].status = FEC_TBD_WRAP;
fec->tbd_index = 0;
 }
 
@@ -387,12 +418,25 @@ static int fec_open(struct eth_device *edev)
 {
struct fec_priv *fec = (struct fec_priv *)edev->priv;
int speed;
+   uint32_t addr, size;
+   int i;
 
debug("fec_open: fec_open(dev)\n");
/* full-duplex, heartbeat disabled */
wr

Re: [U-Boot] [PATCH 2/4] net: fec_mxc: allow use with cache enabled

2012-03-02 Thread Eric Nelson

Whoops.

Forgot to add the origin of this patch to the commit message:
http://lists.denx.de/pipermail/u-boot/2012-February/117695.html

Thanks Marek.

On 03/02/2012 04:06 PM, Eric Nelson wrote:

ensure that transmit and receive buffers are cache-line aligned
 invalidate cache after each packet received
 flush cache before transmitting

Signed-off-by: Eric Nelson
---
  drivers/net/fec_mxc.c |  248 -
  drivers/net/fec_mxc.h |   19 +
  2 files changed, 184 insertions(+), 83 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 1fdd071..f72304b 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -50,6 +50,33 @@ DECLARE_GLOBAL_DATA_PTR;
  #define   CONFIG_FEC_MXC_SWAP_PACKET
  #endif

+#ifndefCONFIG_FEC_DESC_ALIGNMENT
+#defineCONFIG_FEC_DESC_ALIGNMENT   ARCH_DMA_MINALIGN
+#endif
+
+#ifndefCONFIG_FEC_DATA_ALIGNMENT
+#defineCONFIG_FEC_DATA_ALIGNMENT   ARCH_DMA_MINALIGN
+#endif
+
+/* Check various alignment issues at compile time */
+#if ((CONFIG_FEC_DESC_ALIGNMENT<  16) || (CONFIG_FEC_DESC_ALIGNMENT % 16 != 0))
+#error "CONFIG_FEC_DESC_ALIGNMENT must be multiple of 16!"
+#endif
+
+#if ((CONFIG_FEC_DATA_ALIGNMENT<  16) || (CONFIG_FEC_DATA_ALIGNMENT % 16 != 0))
+#error "CONFIG_FEC_DATA_ALIGNMENT must be multiple of 16!"
+#endif
+
+#if ((PKTALIGN<  CONFIG_FEC_DATA_ALIGNMENT) || \
+   (PKTALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
+#error "PKTALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
+#endif
+
+#if ((PKTSIZE_ALIGN<  CONFIG_FEC_DATA_ALIGNMENT) || \
+   (PKTSIZE_ALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
+#error "PKTSIZE_ALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
+#endif
+
  #undef DEBUG

  struct nbuf {
@@ -259,43 +286,47 @@ static int fec_tx_task_disable(struct fec_priv *fec)
   * Initialize receive task's buffer descriptors
   * @param[in] fec all we know about the device yet
   * @param[in] count receive buffer count to be allocated
- * @param[in] size size of each receive buffer
+ * @param[in] dsize desired size of each receive buffer
   * @return 0 on success
   *
   * For this task we need additional memory for the data buffers. And each
   * data buffer requires some alignment. Thy must be aligned to a specific
- * boundary each (DB_DATA_ALIGNMENT).
+ * boundary each.
   */
-static int fec_rbd_init(struct fec_priv *fec, int count, int size)
+static int fec_rbd_init(struct fec_priv *fec, int count, int dsize)
  {
-   int ix;
-   uint32_t p = 0;
-
-   /* reserve data memory and consider alignment */
-   if (fec->rdb_ptr == NULL)
-   fec->rdb_ptr = malloc(size * count + DB_DATA_ALIGNMENT);
-   p = (uint32_t)fec->rdb_ptr;
-   if (!p) {
-   puts("fec_mxc: not enough malloc memory\n");
-   return -ENOMEM;
-   }
-   memset((void *)p, 0, size * count + DB_DATA_ALIGNMENT);
-   p += DB_DATA_ALIGNMENT-1;
-   p&= ~(DB_DATA_ALIGNMENT-1);
-
-   for (ix = 0; ix<  count; ix++) {
-   writel(p,&fec->rbd_base[ix].data_pointer);
-   p += size;
-   writew(FEC_RBD_EMPTY,&fec->rbd_base[ix].status);
-   writew(0,&fec->rbd_base[ix].data_length);
-   }
+   uint32_t size;
+   int i;
+
/*
-* mark the last RBD to close the ring
+* Allocate memory for the buffers. This allocation respects the
+* alignment
 */
-   writew(FEC_RBD_WRAP | FEC_RBD_EMPTY,&fec->rbd_base[ix - 1].status);
+   size = roundup(dsize, CONFIG_FEC_DATA_ALIGNMENT);
+   for (i = 0; i<  count; i++) {
+   if (0 == fec->rbd_base[i].data_pointer) {
+   uint8_t *data = memalign(CONFIG_FEC_DATA_ALIGNMENT, 
size);
+   if (!data) {
+   printf("%s: error allocating rxbuf %d\n", 
__func__, i);
+   goto err;
+   }
+   fec->rbd_base[i].data_pointer = (uint32_t)data;
+   } // needs allocation
+   fec->rbd_base[i].status = FEC_RBD_EMPTY;
+   fec->rbd_base[i].data_length = 0;
+   }
+
+   /* Mark the last RBD to close the ring. */
+   fec->rbd_base[i - 1].status = FEC_RBD_EMPTY | FEC_RBD_WRAP;
fec->rbd_index = 0;

return 0;
+
+err:
+   for (; i>= 0; i--)
+   free((uint8_t *)fec->rbd_base[i].data_pointer);
+
+   return -ENOMEM;
  }

  /**
@@ -312,8 +343,8 @@ static int fec_rbd_init(struct fec_priv *fec, int count, 
int size)
   */
  static void fec_tbd_init(struct fec_priv *fec)
  {
-   writew(0x,&fec->tbd_base[0].status);
-   writew(FEC_TBD_WRAP,&fec->tbd_base[1].status);
+   fec->tbd_base[0].status = 0;
+   fec->tbd_base[1].status = FEC_TBD_WRAP;
fec->tbd_index = 0;
  }

@@ -387,12 +418,25 @@ static int fec_open(struct eth_device *edev)
  {
struc

Re: [U-Boot] [PATCH 0/4] Add preliminary cache support to i.MX6

2012-03-02 Thread Eric Nelson

On 03/02/2012 04:06 PM, Eric Nelson wrote:

This series of patches defines the prerequisites for cache support on i.MX6
to allow further driver development to occur.

It does not enable the use of the data cache by default. To enable
data cache, comment out this line in mx6qsabrelite.h or mx6qarm2.h:

#define CONFIG_SYS_DCACHE_OFF



I meant to add a note to this commit message indicating the
drivers which are known to need work before cache is enabled:

- mmc
- usb host
- sata

Each of these is functional after issuing 'dcache off', but non-functional
with dcache enabled.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] i.MX6: mx6qsabrelite: allow use with Freescale 2.6.38 kernels

2012-03-02 Thread Wolfgang Denk
Dear Eric Nelson,

In message <1330728909-12203-1-git-send-email-eric.nel...@boundarydevices.com> 
you wrote:
> This series of patches is needed to allow main-line U-Boot to be used
> with Freescale's Linux 2.6.38 non-DT kernel releases.
> 
> These releases currently require at least the machine type and
> revision atag entries and are configured to load boot scripts from
> the ext3 filesystem.

Is this really needed?  I feel we should rather focus on current
mainline kernel code and support that well instead of adding backward
compatibility complexity for old, obsolete code.

People who want to run FSL kernels should be able run FSL's version
of U-Boot.

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
No journaling file system can recover your data if the disk dies.
 - Steve Rago in 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] "CONFIG_MTD_ECC_SOFT not enabled" breakage/change

2012-03-02 Thread David Purdy
While finishing some work on support for a new machine, a build based
on the latest git, I see this:
...
U-Boot 2011.12-00374-g54e9668-dirty (Mar 02 2012 - 14:48:48)
Pogoplug E02

SoC:   Kirkwood 88F6281_A0
DRAM:  256 MiB
WARNING: Caches not enabled
NAND:  CONFIG_MTD_ECC_SOFT not enabled
0 MiB
`

which is very reminiscent of what Thomas Weber mentions here:
http://lists.denx.de/pipermail/u-boot/2012-February/117926.html

Is it now considered standard and expected practice to enable
CONFIG_MTD_ECC_SOFT  in the machine config ?

Or is this a fluke/bug/commit error that is awaiting a fix?

thanks,

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


Re: [U-Boot] [PATCH 0/4] Add preliminary cache support to i.MX6

2012-03-02 Thread Marek Vasut
> On 03/02/2012 04:06 PM, Eric Nelson wrote:
> > This series of patches defines the prerequisites for cache support on
> > i.MX6 to allow further driver development to occur.
> > 
> > It does not enable the use of the data cache by default. To enable
> > data cache, comment out this line in mx6qsabrelite.h or mx6qarm2.h:
> > 
> > #define CONFIG_SYS_DCACHE_OFF
> 
> I meant to add a note to this commit message indicating the
> drivers which are known to need work before cache is enabled:
> 
>   - mmc
>   - usb host
>   - sata
> 
> Each of these is functional after issuing 'dcache off', but non-functional
> with dcache enabled.

USB is broken, but someone is working on that, search the mailing list:

[U-Boot] [PATCH] usb: align buffers at cache boundary
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] i.MX6: define CACHELINE_SIZE

2012-03-02 Thread Marek Vasut
> ---
>  arch/arm/include/asm/arch-mx6/imx-regs.h |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h
> b/arch/arm/include/asm/arch-mx6/imx-regs.h index 6a200bb..3e5c4c2 100644
> --- a/arch/arm/include/asm/arch-mx6/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
> @@ -19,6 +19,8 @@
>  #ifndef __ASM_ARCH_MX6_IMX_REGS_H__
>  #define __ASM_ARCH_MX6_IMX_REGS_H__
> 
> +#define CONFIG_SYS_CACHELINE_SIZE32
> +
>  #define ROMCP_ARB_BASE_ADDR 0x
>  #define ROMCP_ARB_END_ADDR  0x000F
>  #define CAAM_ARB_BASE_ADDR  0x0010

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


Re: [U-Boot] [PATCH 4/4] i.MX6: mx6qsabrelite: add cache commands if cache is enabled

2012-03-02 Thread Marek Vasut
> ---
>  include/configs/mx6qsabrelite.h |4 
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/include/configs/mx6qsabrelite.h
> b/include/configs/mx6qsabrelite.h index 3bd9bdb..a5dae73 100644
> --- a/include/configs/mx6qsabrelite.h
> +++ b/include/configs/mx6qsabrelite.h
> @@ -212,4 +212,8 @@
> 
>  #define CONFIG_SYS_DCACHE_OFF
> 
> +#ifndef CONFIG_SYS_DCACHE_OFF
> +#define CONFIG_CMD_CACHE
> +#endif
> +
>  #endif /* __CONFIG_H */

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


Re: [U-Boot] [PATCH 2/4] net: fec_mxc: allow use with cache enabled

2012-03-02 Thread Marek Vasut
>   ensure that transmit and receive buffers are cache-line aligned
> invalidate cache after each packet received
> flush cache before transmitting
> 
> Signed-off-by: Eric Nelson 
> ---
>  drivers/net/fec_mxc.c |  248
> - drivers/net/fec_mxc.h | 
>  19 +
>  2 files changed, 184 insertions(+), 83 deletions(-)
> 
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index 1fdd071..f72304b 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -50,6 +50,33 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define  CONFIG_FEC_MXC_SWAP_PACKET
>  #endif
> 
> +#ifndef  CONFIG_FEC_DESC_ALIGNMENT
> +#define  CONFIG_FEC_DESC_ALIGNMENT   ARCH_DMA_MINALIGN
> +#endif
> +
> +#ifndef  CONFIG_FEC_DATA_ALIGNMENT
> +#define  CONFIG_FEC_DATA_ALIGNMENT   ARCH_DMA_MINALIGN
> +#endif
> +
> +/* Check various alignment issues at compile time */
> +#if ((CONFIG_FEC_DESC_ALIGNMENT < 16) || (CONFIG_FEC_DESC_ALIGNMENT % 16
> != 0)) +#error"CONFIG_FEC_DESC_ALIGNMENT must be multiple of 16!"
> +#endif
> +
> +#if ((CONFIG_FEC_DATA_ALIGNMENT < 16) || (CONFIG_FEC_DATA_ALIGNMENT % 16
> != 0)) +#error"CONFIG_FEC_DATA_ALIGNMENT must be multiple of 16!"
> +#endif
> +
> +#if ((PKTALIGN < CONFIG_FEC_DATA_ALIGNMENT) || \
> + (PKTALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
> +#error   "PKTALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
> +#endif
> +
> +#if ((PKTSIZE_ALIGN < CONFIG_FEC_DATA_ALIGNMENT) || \
> + (PKTSIZE_ALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
> +#error   "PKTSIZE_ALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
> +#endif
> +
>  #undef DEBUG
> 
>  struct nbuf {
> @@ -259,43 +286,47 @@ static int fec_tx_task_disable(struct fec_priv *fec)
>   * Initialize receive task's buffer descriptors
>   * @param[in] fec all we know about the device yet
>   * @param[in] count receive buffer count to be allocated
> - * @param[in] size size of each receive buffer
> + * @param[in] dsize desired size of each receive buffer
>   * @return 0 on success
>   *
>   * For this task we need additional memory for the data buffers. And each
>   * data buffer requires some alignment. Thy must be aligned to a specific
> - * boundary each (DB_DATA_ALIGNMENT).
> + * boundary each.
>   */
> -static int fec_rbd_init(struct fec_priv *fec, int count, int size)
> +static int fec_rbd_init(struct fec_priv *fec, int count, int dsize)
>  {
> - int ix;
> - uint32_t p = 0;
> -
> - /* reserve data memory and consider alignment */
> - if (fec->rdb_ptr == NULL)
> - fec->rdb_ptr = malloc(size * count + DB_DATA_ALIGNMENT);
> - p = (uint32_t)fec->rdb_ptr;
> - if (!p) {
> - puts("fec_mxc: not enough malloc memory\n");
> - return -ENOMEM;
> - }
> - memset((void *)p, 0, size * count + DB_DATA_ALIGNMENT);
> - p += DB_DATA_ALIGNMENT-1;
> - p &= ~(DB_DATA_ALIGNMENT-1);
> -
> - for (ix = 0; ix < count; ix++) {
> - writel(p, &fec->rbd_base[ix].data_pointer);
> - p += size;
> - writew(FEC_RBD_EMPTY, &fec->rbd_base[ix].status);
> - writew(0, &fec->rbd_base[ix].data_length);
> - }
> + uint32_t size;
> + int i;
> +
>   /*
> -  * mark the last RBD to close the ring
> +  * Allocate memory for the buffers. This allocation respects the
> +  * alignment
>*/
> - writew(FEC_RBD_WRAP | FEC_RBD_EMPTY, &fec->rbd_base[ix - 1].status);
> + size = roundup(dsize, CONFIG_FEC_DATA_ALIGNMENT);
> + for (i = 0; i < count; i++) {
> + if (0 == fec->rbd_base[i].data_pointer) {
> + uint8_t *data = memalign(CONFIG_FEC_DATA_ALIGNMENT, 
size);
> + if (!data) {
> + printf("%s: error allocating rxbuf %d\n", 
__func__, i);
> + goto err;
> + }
> + fec->rbd_base[i].data_pointer = (uint32_t)data;
> + } // needs allocation

Wrong comment

> + fec->rbd_base[i].status = FEC_RBD_EMPTY;
> + fec->rbd_base[i].data_length = 0;
> + }
> +
> + /* Mark the last RBD to close the ring. */
> + fec->rbd_base[i - 1].status = FEC_RBD_EMPTY | FEC_RBD_WRAP;
>   fec->rbd_index = 0;
> 
>   return 0;
> +
> +err:
> + for (; i >= 0; i--)
> + free((uint8_t *)fec->rbd_base[i].data_pointer);
> +
> + return -ENOMEM;
>  }
> 
>  /**
> @@ -312,8 +343,8 @@ static int fec_rbd_init(struct fec_priv *fec, int
> count, int size) */
>  static void fec_tbd_init(struct fec_priv *fec)
>  {
> - writew(0x, &fec->tbd_base[0].status);
> - writew(FEC_TBD_WRAP, &fec->tbd_base[1].status);
> + fec->tbd_base[0].status = 0;
> + fec->tbd_base[1].status = FEC_TBD_WRAP;
>   fec->tbd_index = 0;
>  }
> 
> @@ -387,12 +418,25 @@ static int fec_open(struct eth_device *edev)
>  {
>   struct fec_priv *fec = (struct fec

Re: [U-Boot] [PATCH 3/4] i.MX6: implement enable_caches()

2012-03-02 Thread Marek Vasut
>   disabled by default until drivers are fixed
> 
> Signed-off-by: Eric Nelson 
> ---
>  arch/arm/cpu/armv7/mx6/soc.c|8 
>  include/configs/mx6qarm2.h  |2 ++
>  include/configs/mx6qsabrelite.h |2 ++
>  3 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index 2ac74b5..eb418eb 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
> @@ -79,6 +79,14 @@ int arch_cpu_init(void)
>  }
>  #endif
> 
> +#ifndef CONFIG_SYS_DCACHE_OFF
> +void enable_caches(void)
> +{
> + /* Enable D-cache. I-cache is already enabled in start.S */
> + dcache_enable();
> +}
> +#endif
> +
>  #if defined(CONFIG_FEC_MXC)
>  void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
>  {
> diff --git a/include/configs/mx6qarm2.h b/include/configs/mx6qarm2.h
> index 0962d3c..e83aec6 100644
> --- a/include/configs/mx6qarm2.h
> +++ b/include/configs/mx6qarm2.h
> @@ -169,4 +169,6 @@
> 
>  #define CONFIG_OF_LIBFDT
> 
> +#define CONFIG_SYS_DCACHE_OFF
> +
>  #endif   /* __CONFIG_H */
> diff --git a/include/configs/mx6qsabrelite.h
> b/include/configs/mx6qsabrelite.h index a1a2267..3bd9bdb 100644
> --- a/include/configs/mx6qsabrelite.h
> +++ b/include/configs/mx6qsabrelite.h
> @@ -210,4 +210,6 @@
> 
>  #define CONFIG_OF_LIBFDT
> 
> +#define CONFIG_SYS_DCACHE_OFF
> +
>  #endif /* __CONFIG_H */

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


Re: [U-Boot] [PATCH 2/4] net: fec_mxc: allow use with cache enabled

2012-03-02 Thread Marek Vasut
> Whoops.
> 
> Forgot to add the origin of this patch to the commit message:
>   http://lists.denx.de/pipermail/u-boot/2012-February/117695.html
> 
> Thanks Marek.

Eric, I hope you won't mind if we respin this patch a few times to make sure 
nothing gets broken by this.

M

> 
> On 03/02/2012 04:06 PM, Eric Nelson wrote:
> > ensure that transmit and receive buffers are cache-line aligned
> > 
> >  invalidate cache after each packet received
> >  flush cache before transmitting
> > 
> > Signed-off-by: Eric Nelson
> > ---
> > 
> >   drivers/net/fec_mxc.c |  248
> >   -
> >   drivers/net/fec_mxc.h |   19 +
> >   2 files changed, 184 insertions(+), 83 deletions(-)
> > 
> > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> > index 1fdd071..f72304b 100644
> > --- a/drivers/net/fec_mxc.c
> > +++ b/drivers/net/fec_mxc.c
> > @@ -50,6 +50,33 @@ DECLARE_GLOBAL_DATA_PTR;
> > 
> >   #define   CONFIG_FEC_MXC_SWAP_PACKET
> >   #endif
> > 
> > +#ifndefCONFIG_FEC_DESC_ALIGNMENT
> > +#defineCONFIG_FEC_DESC_ALIGNMENT   ARCH_DMA_MINALIGN
> > +#endif
> > +
> > +#ifndefCONFIG_FEC_DATA_ALIGNMENT
> > +#defineCONFIG_FEC_DATA_ALIGNMENT   ARCH_DMA_MINALIGN
> > +#endif
> > +
> > +/* Check various alignment issues at compile time */
> > +#if ((CONFIG_FEC_DESC_ALIGNMENT<  16) || (CONFIG_FEC_DESC_ALIGNMENT % 16
> > != 0)) +#error  "CONFIG_FEC_DESC_ALIGNMENT must be multiple of 16!"
> > +#endif
> > +
> > +#if ((CONFIG_FEC_DATA_ALIGNMENT<  16) || (CONFIG_FEC_DATA_ALIGNMENT % 16
> > != 0)) +#error  "CONFIG_FEC_DATA_ALIGNMENT must be multiple of 16!"
> > +#endif
> > +
> > +#if ((PKTALIGN<  CONFIG_FEC_DATA_ALIGNMENT) || \
> > +   (PKTALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
> > +#error "PKTALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
> > +#endif
> > +
> > +#if ((PKTSIZE_ALIGN<  CONFIG_FEC_DATA_ALIGNMENT) || \
> > +   (PKTSIZE_ALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
> > +#error "PKTSIZE_ALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
> > +#endif
> > +
> > 
> >   #undef DEBUG
> >   
> >   struct nbuf {
> > 
> > @@ -259,43 +286,47 @@ static int fec_tx_task_disable(struct fec_priv
> > *fec)
> > 
> >* Initialize receive task's buffer descriptors
> >* @param[in] fec all we know about the device yet
> >* @param[in] count receive buffer count to be allocated
> > 
> > - * @param[in] size size of each receive buffer
> > + * @param[in] dsize desired size of each receive buffer
> > 
> >* @return 0 on success
> >*
> >* For this task we need additional memory for the data buffers. And
> >each * data buffer requires some alignment. Thy must be aligned to a
> >specific
> > 
> > - * boundary each (DB_DATA_ALIGNMENT).
> > + * boundary each.
> > 
> >*/
> > 
> > -static int fec_rbd_init(struct fec_priv *fec, int count, int size)
> > +static int fec_rbd_init(struct fec_priv *fec, int count, int dsize)
> > 
> >   {
> > 
> > -   int ix;
> > -   uint32_t p = 0;
> > -
> > -   /* reserve data memory and consider alignment */
> > -   if (fec->rdb_ptr == NULL)
> > -   fec->rdb_ptr = malloc(size * count + DB_DATA_ALIGNMENT);
> > -   p = (uint32_t)fec->rdb_ptr;
> > -   if (!p) {
> > -   puts("fec_mxc: not enough malloc memory\n");
> > -   return -ENOMEM;
> > -   }
> > -   memset((void *)p, 0, size * count + DB_DATA_ALIGNMENT);
> > -   p += DB_DATA_ALIGNMENT-1;
> > -   p&= ~(DB_DATA_ALIGNMENT-1);
> > -
> > -   for (ix = 0; ix<  count; ix++) {
> > -   writel(p,&fec->rbd_base[ix].data_pointer);
> > -   p += size;
> > -   writew(FEC_RBD_EMPTY,&fec->rbd_base[ix].status);
> > -   writew(0,&fec->rbd_base[ix].data_length);
> > -   }
> > +   uint32_t size;
> > +   int i;
> > +
> > 
> > /*
> > 
> > -* mark the last RBD to close the ring
> > +* Allocate memory for the buffers. This allocation respects the
> > +* alignment
> > 
> >  */
> > 
> > -   writew(FEC_RBD_WRAP | FEC_RBD_EMPTY,&fec->rbd_base[ix - 1].status);
> > +   size = roundup(dsize, CONFIG_FEC_DATA_ALIGNMENT);
> > +   for (i = 0; i<  count; i++) {
> > +   if (0 == fec->rbd_base[i].data_pointer) {
> > +   uint8_t *data = memalign(CONFIG_FEC_DATA_ALIGNMENT, 
size);
> > +   if (!data) {
> > +   printf("%s: error allocating rxbuf %d\n", 
__func__, i);
> > +   goto err;
> > +   }
> > +   fec->rbd_base[i].data_pointer = (uint32_t)data;
> > +   } // needs allocation
> > +   fec->rbd_base[i].status = FEC_RBD_EMPTY;
> > +   fec->rbd_base[i].data_length = 0;
> > +   }
> > +
> > +   /* Mark the last RBD to close the ring. */
> > +   fec->rbd_base[i - 1].status = FEC_RBD_EMPTY | FEC_RBD_WRAP;
> > 
> > fec->rbd_index = 0;
> > 
> > return 0;
> > 
> > +
> > +err:
> > +   for (; i>= 0; i--)
> > +   free((uint8_t *)fec->r

Re: [U-Boot] i.MX6: mx6qsabrelite: allow use with Freescale 2.6.38 kernels

2012-03-02 Thread Eric Nelson

On 03/02/2012 04:25 PM, Wolfgang Denk wrote:

Dear Eric Nelson,

In message<1330728909-12203-1-git-send-email-eric.nel...@boundarydevices.com>  
you wrote:

This series of patches is needed to allow main-line U-Boot to be used
with Freescale's Linux 2.6.38 non-DT kernel releases.

These releases currently require at least the machine type and
revision atag entries and are configured to load boot scripts from
the ext3 filesystem.


Is this really needed?  I feel we should rather focus on current
mainline kernel code and support that well instead of adding backward
compatibility complexity for old, obsolete code.



I think new code is still being written for 2.6.38, so it may be obsolete,
but not necessarily old.


People who want to run FSL kernels should be able run FSL's version
of U-Boot.



They certainly can.

These small patches will be a big help to those of us who need to
support both though, and it's not yet clear how long the kernel
transition will take.


Best regards,

Wolfgang Denk


Regards,


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


Re: [U-Boot] [PATCH 2/4] net: fec_mxc: allow use with cache enabled

2012-03-02 Thread Eric Nelson

On 03/02/2012 04:06 PM, Eric Nelson wrote:

ensure that transmit and receive buffers are cache-line aligned
 invalidate cache after each packet received
 flush cache before transmitting

Signed-off-by: Eric Nelson
---
  drivers/net/fec_mxc.c |  248 -
  drivers/net/fec_mxc.h |   19 +
  2 files changed, 184 insertions(+), 83 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 1fdd071..f72304b 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -50,6 +50,33 @@ DECLARE_GLOBAL_DATA_PTR;
  #define   CONFIG_FEC_MXC_SWAP_PACKET
  #endif

+#ifndefCONFIG_FEC_DESC_ALIGNMENT
+#defineCONFIG_FEC_DESC_ALIGNMENT   ARCH_DMA_MINALIGN
+#endif
+
+#ifndefCONFIG_FEC_DATA_ALIGNMENT
+#defineCONFIG_FEC_DATA_ALIGNMENT   ARCH_DMA_MINALIGN
+#endif
+
+/* Check various alignment issues at compile time */
+#if ((CONFIG_FEC_DESC_ALIGNMENT<  16) || (CONFIG_FEC_DESC_ALIGNMENT % 16 != 0))
+#error "CONFIG_FEC_DESC_ALIGNMENT must be multiple of 16!"
+#endif
+
+#if ((CONFIG_FEC_DATA_ALIGNMENT<  16) || (CONFIG_FEC_DATA_ALIGNMENT % 16 != 0))
+#error "CONFIG_FEC_DATA_ALIGNMENT must be multiple of 16!"
+#endif
+
+#if ((PKTALIGN<  CONFIG_FEC_DATA_ALIGNMENT) || \
+   (PKTALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
+#error "PKTALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
+#endif
+
+#if ((PKTSIZE_ALIGN<  CONFIG_FEC_DATA_ALIGNMENT) || \
+   (PKTSIZE_ALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
+#error "PKTSIZE_ALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
+#endif
+
  #undef DEBUG

  struct nbuf {
@@ -259,43 +286,47 @@ static int fec_tx_task_disable(struct fec_priv *fec)
   * Initialize receive task's buffer descriptors
   * @param[in] fec all we know about the device yet
   * @param[in] count receive buffer count to be allocated
- * @param[in] size size of each receive buffer
+ * @param[in] dsize desired size of each receive buffer
   * @return 0 on success
   *
   * For this task we need additional memory for the data buffers. And each
   * data buffer requires some alignment. Thy must be aligned to a specific
- * boundary each (DB_DATA_ALIGNMENT).
+ * boundary each.
   */
-static int fec_rbd_init(struct fec_priv *fec, int count, int size)
+static int fec_rbd_init(struct fec_priv *fec, int count, int dsize)
  {
-   int ix;
-   uint32_t p = 0;
-
-   /* reserve data memory and consider alignment */
-   if (fec->rdb_ptr == NULL)
-   fec->rdb_ptr = malloc(size * count + DB_DATA_ALIGNMENT);
-   p = (uint32_t)fec->rdb_ptr;
-   if (!p) {
-   puts("fec_mxc: not enough malloc memory\n");
-   return -ENOMEM;
-   }
-   memset((void *)p, 0, size * count + DB_DATA_ALIGNMENT);
-   p += DB_DATA_ALIGNMENT-1;
-   p&= ~(DB_DATA_ALIGNMENT-1);
-
-   for (ix = 0; ix<  count; ix++) {
-   writel(p,&fec->rbd_base[ix].data_pointer);
-   p += size;
-   writew(FEC_RBD_EMPTY,&fec->rbd_base[ix].status);
-   writew(0,&fec->rbd_base[ix].data_length);
-   }
+   uint32_t size;
+   int i;
+
/*
-* mark the last RBD to close the ring
+* Allocate memory for the buffers. This allocation respects the
+* alignment
 */
-   writew(FEC_RBD_WRAP | FEC_RBD_EMPTY,&fec->rbd_base[ix - 1].status);
+   size = roundup(dsize, CONFIG_FEC_DATA_ALIGNMENT);
+   for (i = 0; i<  count; i++) {
+   if (0 == fec->rbd_base[i].data_pointer) {
+   uint8_t *data = memalign(CONFIG_FEC_DATA_ALIGNMENT, 
size);
+   if (!data) {
+   printf("%s: error allocating rxbuf %d\n", 
__func__, i);
+   goto err;
+   }
+   fec->rbd_base[i].data_pointer = (uint32_t)data;
+   } // needs allocation
+   fec->rbd_base[i].status = FEC_RBD_EMPTY;
+   fec->rbd_base[i].data_length = 0;
+   }
+
+   /* Mark the last RBD to close the ring. */
+   fec->rbd_base[i - 1].status = FEC_RBD_EMPTY | FEC_RBD_WRAP;
fec->rbd_index = 0;

return 0;
+
+err:
+   for (; i>= 0; i--)
+   free((uint8_t *)fec->rbd_base[i].data_pointer);
+
+   return -ENOMEM;
  }

  /**
@@ -312,8 +343,8 @@ static int fec_rbd_init(struct fec_priv *fec, int count, 
int size)
   */
  static void fec_tbd_init(struct fec_priv *fec)
  {
-   writew(0x,&fec->tbd_base[0].status);
-   writew(FEC_TBD_WRAP,&fec->tbd_base[1].status);
+   fec->tbd_base[0].status = 0;
+   fec->tbd_base[1].status = FEC_TBD_WRAP;


Troy just pointed out that these changes aren't necessary or helpful.
I'll address that in V2.


fec->tbd_index = 0;
  }

@@ -387,12 +418,25 @@ static int fec_open(struct eth_device *edev)
  {
struct fec_priv *fec = (struct fec_priv *)edev->priv;
int

Re: [U-Boot] [PATCH 2/4] net: fec_mxc: allow use with cache enabled

2012-03-02 Thread Eric Nelson

On 03/02/2012 04:40 PM, Marek Vasut wrote:

Whoops.

Forgot to add the origin of this patch to the commit message:
http://lists.denx.de/pipermail/u-boot/2012-February/117695.html

Thanks Marek.


Eric, I hope you won't mind if we respin this patch a few times to make sure
nothing gets broken by this.

M



Not at all. I just wanted to get it out there along with the dcache
patch so we have something to test each of the drivers against.



On 03/02/2012 04:06 PM, Eric Nelson wrote:

ensure that transmit and receive buffers are cache-line aligned

  invalidate cache after each packet received
  flush cache before transmitting

Signed-off-by: Eric Nelson
---

   drivers/net/fec_mxc.c |  248
   -
   drivers/net/fec_mxc.h |   19 +
   2 files changed, 184 insertions(+), 83 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 1fdd071..f72304b 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -50,6 +50,33 @@ DECLARE_GLOBAL_DATA_PTR;

   #define  CONFIG_FEC_MXC_SWAP_PACKET
   #endif

+#ifndefCONFIG_FEC_DESC_ALIGNMENT
+#defineCONFIG_FEC_DESC_ALIGNMENT   ARCH_DMA_MINALIGN
+#endif
+
+#ifndefCONFIG_FEC_DATA_ALIGNMENT
+#defineCONFIG_FEC_DATA_ALIGNMENT   ARCH_DMA_MINALIGN
+#endif
+
+/* Check various alignment issues at compile time */
+#if ((CONFIG_FEC_DESC_ALIGNMENT<   16) || (CONFIG_FEC_DESC_ALIGNMENT % 16
!= 0)) +#error  "CONFIG_FEC_DESC_ALIGNMENT must be multiple of 16!"
+#endif
+
+#if ((CONFIG_FEC_DATA_ALIGNMENT<   16) || (CONFIG_FEC_DATA_ALIGNMENT % 16
!= 0)) +#error  "CONFIG_FEC_DATA_ALIGNMENT must be multiple of 16!"
+#endif
+
+#if ((PKTALIGN<   CONFIG_FEC_DATA_ALIGNMENT) || \
+   (PKTALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
+#error "PKTALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
+#endif
+
+#if ((PKTSIZE_ALIGN<   CONFIG_FEC_DATA_ALIGNMENT) || \
+   (PKTSIZE_ALIGN % CONFIG_FEC_DATA_ALIGNMENT != 0))
+#error "PKTSIZE_ALIGN must be multiple of CONFIG_FEC_DATA_ALIGNMENT!"
+#endif
+

   #undef DEBUG

   struct nbuf {

@@ -259,43 +286,47 @@ static int fec_tx_task_disable(struct fec_priv
*fec)

* Initialize receive task's buffer descriptors
* @param[in] fec all we know about the device yet
* @param[in] count receive buffer count to be allocated

- * @param[in] size size of each receive buffer
+ * @param[in] dsize desired size of each receive buffer

* @return 0 on success
*
* For this task we need additional memory for the data buffers. And
each * data buffer requires some alignment. Thy must be aligned to a
specific

- * boundary each (DB_DATA_ALIGNMENT).
+ * boundary each.

*/

-static int fec_rbd_init(struct fec_priv *fec, int count, int size)
+static int fec_rbd_init(struct fec_priv *fec, int count, int dsize)

   {

-   int ix;
-   uint32_t p = 0;
-
-   /* reserve data memory and consider alignment */
-   if (fec->rdb_ptr == NULL)
-   fec->rdb_ptr = malloc(size * count + DB_DATA_ALIGNMENT);
-   p = (uint32_t)fec->rdb_ptr;
-   if (!p) {
-   puts("fec_mxc: not enough malloc memory\n");
-   return -ENOMEM;
-   }
-   memset((void *)p, 0, size * count + DB_DATA_ALIGNMENT);
-   p += DB_DATA_ALIGNMENT-1;
-   p&= ~(DB_DATA_ALIGNMENT-1);
-
-   for (ix = 0; ix<   count; ix++) {
-   writel(p,&fec->rbd_base[ix].data_pointer);
-   p += size;
-   writew(FEC_RBD_EMPTY,&fec->rbd_base[ix].status);
-   writew(0,&fec->rbd_base[ix].data_length);
-   }
+   uint32_t size;
+   int i;
+

/*

-* mark the last RBD to close the ring
+* Allocate memory for the buffers. This allocation respects the
+* alignment

 */

-   writew(FEC_RBD_WRAP | FEC_RBD_EMPTY,&fec->rbd_base[ix - 1].status);
+   size = roundup(dsize, CONFIG_FEC_DATA_ALIGNMENT);
+   for (i = 0; i<   count; i++) {
+   if (0 == fec->rbd_base[i].data_pointer) {
+   uint8_t *data = memalign(CONFIG_FEC_DATA_ALIGNMENT,

size);

+   if (!data) {
+   printf("%s: error allocating rxbuf %d\n",

__func__, i);

+   goto err;
+   }
+   fec->rbd_base[i].data_pointer = (uint32_t)data;
+   } // needs allocation
+   fec->rbd_base[i].status = FEC_RBD_EMPTY;
+   fec->rbd_base[i].data_length = 0;
+   }
+
+   /* Mark the last RBD to close the ring. */
+   fec->rbd_base[i - 1].status = FEC_RBD_EMPTY | FEC_RBD_WRAP;

fec->rbd_index = 0;

return 0;

+
+err:
+   for (; i>= 0; i--)
+   free((uint8_t *)fec->rbd_base[i].data_pointer);
+
+   return -ENOMEM;

   }

   /**

@@ -312,8 +343,8 @@ static int fec_rbd_init(struct fec_priv *fec, int
count, int size)


Re: [U-Boot] i.MX6: mx6qsabrelite: allow use with Freescale 2.6.38 kernels

2012-03-02 Thread Fabio Estevam
On Fri, Mar 2, 2012 at 8:46 PM, Eric Nelson
 wrote:

> These small patches will be a big help to those of us who need to
> support both though, and it's not yet clear how long the kernel
> transition will take.

Agree. It would be extremely helpful if we could run FSL kernel with
mainline U-boot.

Thanks,

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


[U-Boot] [PATCH] i.MX6: mx6qsabrelite: Add keypress support

2012-03-02 Thread Eric Nelson
This patch adds support for the GPIO keyboard used on MX6Q SabreLite.

This is generally used for invoking Android "recovery mode" in
response to a long press of volume key down during boot.

This can be tested by a boot script like so:
if keypress voldown && sleep 1 && keypress voldown ; then
  echo "do recovery thing" ;
fi

Key values can be seen by issuing keypress with no arguments:

MX6QSABRELITE U-Boot > keypress
keys: !menu !back   !search !home   !volup  !voldown
---
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |   76 +
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c 
b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
index e0ba6a4..0d45615 100644
--- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
+++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
@@ -50,6 +50,10 @@ DECLARE_GLOBAL_DATA_PTR;
PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \
PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
 
+#define BUTTON_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |   \
+   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   | \
+   PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+
 int dram_init(void)
 {
gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
@@ -122,6 +126,15 @@ iomux_v3_cfg_t enet_pads2[] = {
MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
 };
 
+static iomux_v3_cfg_t const button_pads[] = {
+   MX6Q_PAD_NANDF_D1__GPIO_2_1 | MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 
- Menu Button */
+   MX6Q_PAD_NANDF_D2__GPIO_2_2 | MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 
- Back Button */
+   MX6Q_PAD_NANDF_D3__GPIO_2_3 | MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 
- Search Button */
+   MX6Q_PAD_NANDF_D4__GPIO_2_4 | MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 
- Home Button */
+   MX6Q_PAD_GPIO_19__GPIO_4_5  | MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 
- Volume Down */
+   MX6Q_PAD_GPIO_18__GPIO_7_13 | MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 
- Volume Up */
+};
+
 static void setup_iomux_enet(void)
 {
gpio_direction_output(87, 0);  /* GPIO 3-23 */
@@ -323,10 +336,18 @@ int setup_sata(void)
 }
 #endif
 
+static void setup_buttons(void)
+{
+   imx_iomux_v3_setup_multiple_pads(button_pads,
+ARRAY_SIZE(button_pads));
+}
+
 int board_early_init_f(void)
 {
setup_iomux_uart();
 
+   setup_buttons();
+
 #ifdef CONFIG_CMD_SATA
setup_sata();
 #endif
@@ -350,3 +371,58 @@ int checkboard(void)
 
return 0;
 }
+
+struct button_key {
+   char const  *name;
+   unsignedgpnum;
+};
+
+static struct button_key const buttons[] = {
+   {"menu",GPIO_NUMBER(2, 1)},
+   {"back",GPIO_NUMBER(2, 2)},
+   {"search",  GPIO_NUMBER(2, 3)},
+   {"home",GPIO_NUMBER(2, 4)},
+   {"voldown", GPIO_NUMBER(4, 5)},
+   {"volup",   GPIO_NUMBER(7, 13)},
+};
+
+static int keypress(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   if (1 < argc) {
+   int arg;
+   int pressed = 1 ;
+   for (arg=1; arghttp://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] i.MX6: mx6qsabrelite: Add keypress support

2012-03-02 Thread Eric Nelson

On 03/02/2012 05:00 PM, Eric Nelson wrote:

This patch adds support for the GPIO keyboard used on MX6Q SabreLite.

This is generally used for invoking Android "recovery mode" in
response to a long press of volume key down during boot.

This can be tested by a boot script like so:
 if keypress voldown&&  sleep 1&&  keypress voldown ; then
   echo "do recovery thing" ;
 fi

Key values can be seen by issuing keypress with no arguments:

MX6QSABRELITE U-Boot>  keypress
keys: !menu !back   !search !home   !volup  !voldown
---
  board/freescale/mx6qsabrelite/mx6qsabrelite.c |   76 +
  1 files changed, 76 insertions(+), 0 deletions(-)


> 

I didn't want to litter the commit message with a lot of extraneous
discussion, but it appears that Android recovery mode can be invoked
either by Android itself or by a user pressing keys.

When Android wants to invoke recovery mode, it creates a special
"recovery" file and then re-boots.

The Freescale U-Boot release accomplishes this by having special
code to detect the keypress or the presence of the magic file.

http://opensource.freescale.com/git?p=imx/uboot-imx.git;a=blob;f=board/freescale/common/recovery.c;h=16e0be479ba543a8ceb865c3c2eee55379186bda;hb=imx_v2009.08_11.11.01

http://opensource.freescale.com/git?p=imx/uboot-imx.git;a=blob;f=board/freescale/mx53_loco/mx53_loco.c;h=fda52dc4abff6482d6cb102002529a3f2edd3bbb;hb=imx_v2009.08_11.11.01#l733

Since U-Boot can test files using the hush parser, it seems cleaner to just
enable keyboard detection and allow express the boot flow in boot commands.

I looked for, but didn't find precedent for testing keys.

Please advise if there's a more standard way to accomplish keypress
detection.

Regards,


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


[U-Boot] [PATCH] i.MX6: mx6q_sabrelite: add SATA bindings

2012-03-02 Thread Eric Nelson
This patch requires Stefano's driver for MX5/MX6.
http://lists.denx.de/pipermail/u-boot/2012-February/118530.html

Signed-off-by: Eric Nelson 
---
 arch/arm/include/asm/arch-mx6/imx-regs.h  |   11 +
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |   54 +
 include/configs/mx6qsabrelite.h   |   13 ++
 3 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 3e5c4c2..2441434 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -165,6 +165,17 @@
 #define IP2APB_USBPHY1_BASE_ADDR(AIPS2_OFF_BASE_ADDR + 0x78000)
 #define IP2APB_USBPHY2_BASE_ADDR(AIPS2_OFF_BASE_ADDR + 0x7C000)
 
+/*
+ * ANATOP register definitions
+ */
+#define ANATOP_PLL_LOCK 0x8000
+#define ANATOP_PLL_ENABLE_MASK  0x2000
+#define ANATOP_PLL_BYPASS_MASK  0x0001
+#define ANATOP_PLL_LOCK 0x8000
+#define ANATOP_PLL_PWDN_MASK0x1000
+#define ANATOP_PLL_HOLD_RING_OFF_MASK   0x0800
+#define ANATOP_SATA_CLK_ENABLE_MASK 0x0010
+
 #define CHIP_REV_1_0 0x10
 #define IRAM_SIZE0x0004
 #define IMX_IIM_BASE OCOTP_BASE_ADDR
diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c 
b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
index 2786482..e0ba6a4 100644
--- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
+++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
@@ -273,10 +273,64 @@ int board_eth_init(bd_t *bis)
return 0;
 }
 
+#ifdef CONFIG_CMD_SATA
+
+int setup_sata(void)
+{
+   u32 reg = 0;
+   s32 timeout = 10;
+
+   /* Enable sata clock */
+   reg = readl(CCM_BASE_ADDR + 0x7c); /* CCGR5 */
+   reg |= 0x30;
+   writel(reg, CCM_BASE_ADDR + 0x7c);
+
+   /* Enable PLLs */
+   reg = readl(ANATOP_BASE_ADDR + 0xe0); /* ENET PLL */
+   reg &= ~ANATOP_PLL_PWDN_MASK;
+   writel(reg, ANATOP_BASE_ADDR + 0xe0);
+   reg |= ANATOP_PLL_ENABLE_MASK;
+   while (timeout--) {
+   if (readl(ANATOP_BASE_ADDR + 0xe0) & ANATOP_PLL_LOCK)
+   break;
+   }
+   if (timeout <= 0)
+   return -1;
+   reg &= ~ANATOP_PLL_BYPASS_MASK;
+   writel(reg, ANATOP_BASE_ADDR + 0xe0);
+   reg |= ANATOP_SATA_CLK_ENABLE_MASK;
+   writel(reg, ANATOP_BASE_ADDR + 0xe0);
+
+   /* Enable sata phy */
+   reg = readl(IOMUXC_BASE_ADDR + 0x34); /* GPR13 */
+
+   reg &= ~0x07ff;
+   /*
+* rx_eq_val_0 = 5 [26:24] == 3.0 dB
+* los_lvl = 0x12 [23:19] == SATA2m
+* rx_dpll_mode_0 = 0x3 [18:16]
+* speed = 1 [15] == 3Gpbs
+* mpll_ss_en = 0x0 [14]
+* tx_atten_0 = 0x4 [13:11]
+* tx_boost_0 = 0x0 [10:7]
+* tx_lvl = 0x11 [6:2]  == 1.104 V
+* tx_edgerate_0 == 0x0 [0:1]
+* */
+   reg |= 0x0593a046;
+   writel(reg, IOMUXC_BASE_ADDR + 0x34);
+
+   return 0;
+}
+#endif
+
 int board_early_init_f(void)
 {
setup_iomux_uart();
 
+#ifdef CONFIG_CMD_SATA
+   setup_sata();
+#endif
+
return 0;
 }
 
diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h
index a5dae73..01c6887 100644
--- a/include/configs/mx6qsabrelite.h
+++ b/include/configs/mx6qsabrelite.h
@@ -69,6 +69,19 @@
 #define CONFIG_CMD_FAT
 #define CONFIG_DOS_PARTITION
 
+#define CONFIG_CMD_SATA
+/*
+ * SATA Configs
+ */
+#ifdef CONFIG_CMD_SATA
+#define CONFIG_DWC_AHSATA
+#define CONFIG_SYS_SATA_MAX_DEVICE 1
+#define CONFIG_DWC_AHSATA_PORT_ID  0
+#define CONFIG_DWC_AHSATA_BASE_ADDRSATA_ARB_BASE_ADDR
+#define CONFIG_LBA48
+#define CONFIG_LIBATA
+#endif
+
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_MII
-- 
1.7.9

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


Re: [U-Boot] [PATCH] i.MX6: mx6qsabrelite: Add keypress support

2012-03-02 Thread Marek Vasut
> This patch adds support for the GPIO keyboard used on MX6Q SabreLite.
> 
> This is generally used for invoking Android "recovery mode" in
> response to a long press of volume key down during boot.
> 
> This can be tested by a boot script like so:
> if keypress voldown && sleep 1 && keypress voldown ; then
>   echo "do recovery thing" ;
> fi
> 
> Key values can be seen by issuing keypress with no arguments:
> 
>   MX6QSABRELITE U-Boot > keypress
>   keys: !menu !back   !search !home   !volup  !voldown
> ---
>  board/freescale/mx6qsabrelite/mx6qsabrelite.c |   76
> + 1 files changed, 76 insertions(+), 0
> deletions(-)
> 
> diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> b/board/freescale/mx6qsabrelite/mx6qsabrelite.c index e0ba6a4..0d45615
> 100644
> --- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> +++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> @@ -50,6 +50,10 @@ DECLARE_GLOBAL_DATA_PTR;
>   PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \
>   PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
> 
> +#define BUTTON_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
> + PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   | \
> + PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
> +
>  int dram_init(void)
>  {
> gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
> @@ -122,6 +126,15 @@ iomux_v3_cfg_t enet_pads2[] = {
>   MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
>  };
> 
> +static iomux_v3_cfg_t const button_pads[] = {
> + MX6Q_PAD_NANDF_D1__GPIO_2_1 | MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 
-
> Menu Button */ +  MX6Q_PAD_NANDF_D2__GPIO_2_2 |
> MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 - Back Button */
> + MX6Q_PAD_NANDF_D3__GPIO_2_3 | MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 
-
> Search Button */ +MX6Q_PAD_NANDF_D4__GPIO_2_4 |
> MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 - Home Button */
> + MX6Q_PAD_GPIO_19__GPIO_4_5  | MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 
-
> Volume Down */ +  MX6Q_PAD_GPIO_18__GPIO_7_13 |
> MUX_PAD_CTRL(BUTTON_PAD_CTRL), /* J14 - Volume Up */ +};
> +
>  static void setup_iomux_enet(void)
>  {
>   gpio_direction_output(87, 0);  /* GPIO 3-23 */
> @@ -323,10 +336,18 @@ int setup_sata(void)
>  }
>  #endif
> 
> +static void setup_buttons(void)
> +{
> + imx_iomux_v3_setup_multiple_pads(button_pads,
> +  ARRAY_SIZE(button_pads));
> +}
> +
>  int board_early_init_f(void)
>  {
> setup_iomux_uart();
> 
> +   setup_buttons();
> +
>  #ifdef CONFIG_CMD_SATA
>   setup_sata();
>  #endif
> @@ -350,3 +371,58 @@ int checkboard(void)
> 
> return 0;
>  }
> +
> +struct button_key {
> + char const  *name;
> + unsignedgpnum;
> +};
> +
> +static struct button_key const buttons[] = {
> + {"menu",GPIO_NUMBER(2, 1)},
> + {"back",GPIO_NUMBER(2, 2)},
> + {"search",  GPIO_NUMBER(2, 3)},
> + {"home",GPIO_NUMBER(2, 4)},
> + {"voldown", GPIO_NUMBER(4, 5)},
> + {"volup",   GPIO_NUMBER(7, 13)},
> +};
> +
> +static int keypress(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> argv[]) +{
> + if (1 < argc) {
> + int arg;
> + int pressed = 1 ;
> + for (arg=1; arg + char const *keyname=argv[arg];
> + int i;
> + for (i=0; pressed && (i < ARRAY_SIZE(buttons)); i++) {
> + if (0 == strcmp(buttons[i].name,keyname)) {
> + pressed = pressed && (0 == 
gpio_get_value(buttons[i].gpnum));
> + break;
> + }
> + }
> + if (ARRAY_SIZE(buttons) == i) {
> + printf ("unrecognized key %s\n", keyname);
> + pressed = 0;
> + break;
> + }
> + }
> + return (0 == pressed);
> + } else {
> + int i;
> + printf ("keys: ");
> + for (i=0; i + if (0 != gpio_get_value(buttons[i].gpnum))
> + printf("!");
> + printf("%s\t",buttons[i].name);
> + }
> + printf("\n");
> + return 0 ;
> + }
> +}
> +
> +U_BOOT_CMD(
> + keypress, CONFIG_SYS_MAXARGS, 1, keypress,
> + "Display or test keypresses",
> + "keypress   - show key(s) pressed\n"
> + "keypress name  - test key name (return 0 if pressed)\n"
> +);

Why not make it an STDIN device as any other keyboard?

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


Re: [U-Boot] [v3 2/3] USB: Armada100: EHCI Driver for Armada100 SOCs

2012-03-02 Thread Prafulla Wadaskar


> -Original Message-
> From: Marek Vasut [mailto:ma...@denx.de]
> Sent: 02 March 2012 16:07
> To: Prafulla Wadaskar
> Cc: Ajay Bhargav; li...@bohmer.net; u-boot@lists.denx.de
> Subject: Re: [v3 2/3] USB: Armada100: EHCI Driver for Armada100 SOCs
> 
> > > -Original Message-
> > > From: Ajay Bhargav [mailto:ajay.bhar...@einfochips.com]
> > > Sent: 13 February 2012 18:58
> > > To: li...@bohmer.net
> > > Cc: Prafulla Wadaskar; marek.va...@gmail.com; u-
> b...@lists.denx.de;
> > > Ajay Bhargav
> > > Subject: [v3 2/3] USB: Armada100: EHCI Driver for Armada100 SOCs
> > >
> > > This patch adds support for USB EHCI driver for Armada100 SOCs.
> > >
> > > Signed-off-by: Ajay Bhargav 
> > > ---
> > >
> > > Changes for v2:
> > >   - Fix typo for SOC name
> > >   - change printf to debug
> > >
> > > Changes for v3:
> > >   - Fix type in patch subject
> > >   - header file include updated
> > >
> > >  arch/arm/include/asm/arch-armada100/armada100.h |1 +
> > >  drivers/usb/host/Makefile   |1 +
> > >  drivers/usb/host/ehci-armada100.c   |   64
> > >
> > > +++
> > >
> > >  3 files changed, 66 insertions(+), 0 deletions(-)
> > >  create mode 100644 drivers/usb/host/ehci-armada100.c
> > >
> > > diff --git a/arch/arm/include/asm/arch-armada100/armada100.h
> > > b/arch/arm/include/asm/arch-armada100/armada100.h
> > > index 70fba27..614de55 100644
> > > --- a/arch/arm/include/asm/arch-armada100/armada100.h
> > > +++ b/arch/arm/include/asm/arch-armada100/armada100.h
> > > @@ -68,6 +68,7 @@
> > >
> > >  #define ARMD1_SSP5_BASE  0xD4021000
> > >  #define ARMD1_UART3_BASE 0xD4026000
> > >  #define ARMD1_MPMU_BASE  0xD405
> > >
> > > +#define ARMD1_USB_HOST_BASE  0xD4209000
> > >
> > >  #define ARMD1_APMU_BASE  0xD4282800
> > >  #define ARMD1_CPU_BASE   0xD4282C00
> > >
> > > diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
> > > index 7c4df53..5fdc97b 100644
> > > --- a/drivers/usb/host/Makefile
> > > +++ b/drivers/usb/host/Makefile
> > > @@ -35,6 +35,7 @@ COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
> > >
> > >  # echi
> > >  COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
> > >
> > > +COBJS-$(CONFIG_USB_EHCI_ARMADA100) += ehci-armada100.o utmi-
> > > armada100.o
> > >
> > >  ifdef CONFIG_MPC512X
> > >  COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-mpc512x.o
> > >  else
> > >
> > > diff --git a/drivers/usb/host/ehci-armada100.c
> > > b/drivers/usb/host/ehci-armada100.c
> > > new file mode 100644
> > > index 000..f3d8aef
> > > --- /dev/null
> > > +++ b/drivers/usb/host/ehci-armada100.c
> > > @@ -0,0 +1,64 @@
> > > +/*
> > > + * (C) Copyright 2012
> > > + * eInfochips Ltd. 
> > > + * Written-by: Ajay Bhargav 
> > > + *
> > > + * This driver is based on Kirkwood echi driver
> > > + * (C) Copyright 2009
> > > + * Marvell Semiconductor 
> > > + * Written-by: Prafulla Wadaskar 
> > > + *
> > > + * See file CREDITS for list of people who contributed to this
> > > + * project.
> > > + *
> > > + * This program is free software; you can redistribute it and/or
> > > + * modify it under the terms of the GNU General Public License as
> > > + * published by the Free Software Foundation; either version 2 of
> > > + * the License, or (at your option) any later version.
> > > + *
> > > + * This program is distributed in the hope that it will be
> useful,
> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > > + * GNU General Public License for more details.
> > > + *
> > > + * You should have received a copy of the GNU General Public
> License
> > > + * along with this program; if not, write to the Free Software
> > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> > > + * MA 02110-1301 USA
> > > + */
> > > +
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include "ehci.h"
> > > +#include "ehci-core.h"
> > > +#include 
> > > +#include 
> > > +#include 
> > > +
> > > +/*
> > > + * EHCI host controller init
> > > + */
> > > +int ehci_hcd_init(void)
> > > +{
> > > + if (utmi_init() < 0)
> > > + return -1;
> > > +
> > > + hccr = (struct ehci_hccr *)(ARMD1_USB_HOST_BASE + 0x100);
> > > + hcor = (struct ehci_hcor *)((uint32_t) hccr
> > > + + HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
> > > +
> > > + debug("armada100-ehci: init hccr %x and hcor %x hc_length
> %d\n",
> > > + (uint32_t)hccr, (uint32_t)hcor,
> > > + (uint32_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +/*
> > > + * EHCI host controller stop
> > > + */
> > > +int ehci_hcd_stop(void)
> > > +{
> > > + return 0;
> > > +}
> > > --
> > > 1.7.7.2
> 
> Oh dang, I picked them into -usb too. Shall I drop them ?

Ideally USB-custodian should pick them up :-). I am sorry but I did it with 
pre-discussion with Wolfgang.

May be Wolfgang can suggest something on this.

Regards..
P

Re: [U-Boot] i.MX6: mx6qsabrelite: allow use with Freescale 2.6.38 kernels

2012-03-02 Thread Dirk Behme

Dear Wolfgang,

On 03.03.2012 00:25, Wolfgang Denk wrote:

Dear Eric Nelson,

In message<1330728909-12203-1-git-send-email-eric.nel...@boundarydevices.com>  
you wrote:

This series of patches is needed to allow main-line U-Boot to be used
with Freescale's Linux 2.6.38 non-DT kernel releases.

These releases currently require at least the machine type and
revision atag entries and are configured to load boot scripts from
the ext3 filesystem.


Is this really needed?  I feel we should rather focus on current
mainline kernel code and support that well instead of adding backward
compatibility complexity for old, obsolete code.

People who want to run FSL kernels should be able run FSL's version
of U-Boot.


Hmm, yes, some days ago, when this discussion started, I was under the 
same impression. But:


After thinking some days about it, I wonder if it would help to make 
the transition path to mainline easier. So maybe it's not mainly a 
technical issue, but more a political one ;)


Having Freescale working on these quite old and unclean U-Boot and 
Kernel versions is a pain. Kernel is an other topic, but with U-Boot, 
thanks to the very good work of everybody, we are in a good position 
to get rid of the old Freescale U-Boot, now. And get everybody to work 
with mainline and create patches against it.


So if it helps to apply some backward compatibility to make it easier 
for everybody, esp. Freescale, to switch to mainline U-Boot, I think 
we should try it.


Let's try to make the first step with U-Boot. Then try to make the 
next, harder, step with the kernel.


Best regards

Dirk



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


Re: [U-Boot] [PATCH] Revert "nand: make 1-bit software ECC configurable"

2012-03-02 Thread Thomas Weber

Hello Tom,

will you take this patch? Or should we add the CONFIG_MTD_ECC_SOFT to 
the boards?


Regards,
Thomas

On 02/13/2012 10:55 PM, Scott Wood wrote:

This reverts commit 4fee6c2f295f932b8febdc7ce8731ba045695fa5.

It breaks boards that currently rely on soft-ecc, as pointed out here:
http://patchwork.ozlabs.org/patch/140872/

The reverted patch should be resubmitted with documentation, and with the
CONFIG_MTD_ECC_SOFT selected from every board that needs it.  We could
start by looking at what NAND driver the board selects, and whether
that driver ever asks for soft ECC.

Signed-off-by: Scott Wood
---
  drivers/mtd/nand/Makefile|2 +-
  drivers/mtd/nand/nand_base.c |4 
  include/linux/mtd/nand_ecc.h |   25 -
  3 files changed, 1 insertions(+), 30 deletions(-)

diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 998fc73..1d1b628 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -39,7 +39,7 @@ COBJS-y += nand_bbt.o
  COBJS-y += nand_ids.o
  COBJS-y += nand_util.o
  endif
-COBJS-$(CONFIG_MTD_ECC_SOFT) += nand_ecc.o
+COBJS-y += nand_ecc.o
  COBJS-y += nand_base.o
  COBJS-$(CONFIG_NAND_ECC_BCH) += nand_bch.o

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 12b960f..8ab8303 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3028,10 +3028,6 @@ int nand_scan_tail(struct mtd_info *mtd)
chip->ecc.mode = NAND_ECC_SOFT;

case NAND_ECC_SOFT:
-   if (!mtd_nand_has_ecc_soft()) {
-   printk(KERN_WARNING "CONFIG_MTD_ECC_SOFT not 
enabled\n");
-   return -EINVAL;
-   }
chip->ecc.calculate = nand_calculate_ecc;
chip->ecc.correct = nand_correct_data;
chip->ecc.read_page = nand_read_page_swecc;
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 9715a53..090da50 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -15,10 +15,6 @@

  struct mtd_info;

-#if defined(CONFIG_MTD_ECC_SOFT)
-
-static inline int mtd_nand_has_ecc_soft(void) { return 1; }
-
  /*
   * Calculate 3 byte ECC code for 256 byte block
   */
@@ -29,25 +25,4 @@ int nand_calculate_ecc(struct mtd_info *mtd, const u_char 
*dat, u_char *ecc_code
   */
  int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, 
u_char *calc_ecc);

-#else
-
-static inline int mtd_nand_has_ecc_soft(void) { return 0; }
-
-static inline int
-nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
-{
-   return -1;
-}
-
-static inline int
-nand_correct_data(struct mtd_info *mtd,
-   u_char *dat,
-   u_char *read_ecc,
-   u_char *calc_ecc)
-{
-   return -1;
-}
-
-#endif
-
  #endif /* __MTD_NAND_ECC_H__ */


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


Re: [U-Boot] [v3 2/3] USB: Armada100: EHCI Driver for Armada100 SOCs

2012-03-02 Thread Marek Vasut
> > -Original Message-
> > From: Marek Vasut [mailto:ma...@denx.de]
> > Sent: 02 March 2012 16:07
> > To: Prafulla Wadaskar
> > Cc: Ajay Bhargav; li...@bohmer.net; u-boot@lists.denx.de
> > Subject: Re: [v3 2/3] USB: Armada100: EHCI Driver for Armada100 SOCs
> > 
> > > > -Original Message-
> > > > From: Ajay Bhargav [mailto:ajay.bhar...@einfochips.com]
> > > > Sent: 13 February 2012 18:58
> > > > To: li...@bohmer.net
> > > > Cc: Prafulla Wadaskar; marek.va...@gmail.com; u-
> > 
> > b...@lists.denx.de;
> > 
> > > > Ajay Bhargav
> > > > Subject: [v3 2/3] USB: Armada100: EHCI Driver for Armada100 SOCs
> > > > 
> > > > This patch adds support for USB EHCI driver for Armada100 SOCs.
> > > > 
> > > > Signed-off-by: Ajay Bhargav 
> > > > ---
> > > > 
> > > > Changes for v2:
> > > > - Fix typo for SOC name
> > > > - change printf to debug
> > > > 
> > > > Changes for v3:
> > > > - Fix type in patch subject
> > > > - header file include updated
> > > > 
> > > >  arch/arm/include/asm/arch-armada100/armada100.h |1 +
> > > >  drivers/usb/host/Makefile   |1 +
> > > >  drivers/usb/host/ehci-armada100.c   |   64
> > > > 
> > > > +++
> > > > 
> > > >  3 files changed, 66 insertions(+), 0 deletions(-)
> > > >  create mode 100644 drivers/usb/host/ehci-armada100.c
> > > > 
> > > > diff --git a/arch/arm/include/asm/arch-armada100/armada100.h
> > > > b/arch/arm/include/asm/arch-armada100/armada100.h
> > > > index 70fba27..614de55 100644
> > > > --- a/arch/arm/include/asm/arch-armada100/armada100.h
> > > > +++ b/arch/arm/include/asm/arch-armada100/armada100.h
> > > > @@ -68,6 +68,7 @@
> > > > 
> > > >  #define ARMD1_SSP5_BASE0xD4021000
> > > >  #define ARMD1_UART3_BASE   0xD4026000
> > > >  #define ARMD1_MPMU_BASE0xD405
> > > > 
> > > > +#define ARMD1_USB_HOST_BASE0xD4209000
> > > > 
> > > >  #define ARMD1_APMU_BASE0xD4282800
> > > >  #define ARMD1_CPU_BASE 0xD4282C00
> > > > 
> > > > diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
> > > > index 7c4df53..5fdc97b 100644
> > > > --- a/drivers/usb/host/Makefile
> > > > +++ b/drivers/usb/host/Makefile
> > > > @@ -35,6 +35,7 @@ COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
> > > > 
> > > >  # echi
> > > >  COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
> > > > 
> > > > +COBJS-$(CONFIG_USB_EHCI_ARMADA100) += ehci-armada100.o utmi-
> > > > armada100.o
> > > > 
> > > >  ifdef CONFIG_MPC512X
> > > >  COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-mpc512x.o
> > > >  else
> > > > 
> > > > diff --git a/drivers/usb/host/ehci-armada100.c
> > > > b/drivers/usb/host/ehci-armada100.c
> > > > new file mode 100644
> > > > index 000..f3d8aef
> > > > --- /dev/null
> > > > +++ b/drivers/usb/host/ehci-armada100.c
> > > > @@ -0,0 +1,64 @@
> > > > +/*
> > > > + * (C) Copyright 2012
> > > > + * eInfochips Ltd. 
> > > > + * Written-by: Ajay Bhargav 
> > > > + *
> > > > + * This driver is based on Kirkwood echi driver
> > > > + * (C) Copyright 2009
> > > > + * Marvell Semiconductor 
> > > > + * Written-by: Prafulla Wadaskar 
> > > > + *
> > > > + * See file CREDITS for list of people who contributed to this
> > > > + * project.
> > > > + *
> > > > + * This program is free software; you can redistribute it and/or
> > > > + * modify it under the terms of the GNU General Public License as
> > > > + * published by the Free Software Foundation; either version 2 of
> > > > + * the License, or (at your option) any later version.
> > > > + *
> > > > + * This program is distributed in the hope that it will be
> > 
> > useful,
> > 
> > > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > > > + * GNU General Public License for more details.
> > > > + *
> > > > + * You should have received a copy of the GNU General Public
> > 
> > License
> > 
> > > > + * along with this program; if not, write to the Free Software
> > > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> > > > + * MA 02110-1301 USA
> > > > + */
> > > > +
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include "ehci.h"
> > > > +#include "ehci-core.h"
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +
> > > > +/*
> > > > + * EHCI host controller init
> > > > + */
> > > > +int ehci_hcd_init(void)
> > > > +{
> > > > +   if (utmi_init() < 0)
> > > > +   return -1;
> > > > +
> > > > +   hccr = (struct ehci_hccr *)(ARMD1_USB_HOST_BASE + 0x100);
> > > > +   hcor = (struct ehci_hcor *)((uint32_t) hccr
> > > > +   + HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
> > > > +
> > > > +   debug("armada100-ehci: init hccr %x and hcor %x hc_length
> > 
> > %d\n",
> > 
> > > > +   (uint32_t)hccr, (uint32_t)hcor,
> > > > +   (uint32_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
>