Work around bug in Numonyx P33/P30 256-Mbit 65nm flash chips.
I have "ported" U-boot to a in house made board with Numonyx Axcell P33/P30
256-Mbit 65nm flash chips.
After some time :( searching for bugs in our board or soft, we have
discovered that those chips have a small but annoying bug, documented in
"Numonyx Axcell P33/P30 256-Mbit Specification Update"
It states :
When customer uses [...] block unlock, the block lock status might be
altered inadvertently. Lock status might be set to either 01h or 03h
unexpectedly (00h as expected data), which leads to program/erase failure
on certain blocks.
A working workaround is given, which I have applied and tested with success :
Workaround: If the interval between 60h and its subsequent command
can be guaranteed within 20us, Option I is recommended,
otherwise Option II (involves hardware) should be selected.
Option I: The table below lists the detail command sequences:
Command
Data bus Address bus Remarks
Sequence
1 90h Block Address
Read Lock Status
2 Read Block Address + 02h
(2)(3) (1)
3 60h Block Address
(2)(3) (1) Lock/Unlock/RCR Configuration
4 D0h/01h/03h Block Address
Notes:
(1) Block Address refers to RCR configuration data only when the 60h
command sequence is used to set RCR register combined with 03h
subsequent command.
(2) For the third and fourth command sequences, the Block Address must
be the same.
(3) The interval between 60h command and its subsequent D0h/01h/2Fh/03h
commands should be less than 20us.
And here is a log comparison of a simple (destructive) flash test without
and with the workaround.
Stefan Roese [Fri, 13 Aug 2010 07:36:36 +0000 (09:36 +0200)]
cfi_flash: Cleanup flash_print_info()
This patch does the following:
- Extract code to detect if sector is erased into function
sector_erased().
- Because of this, we don't have variable declarations inside the
sector loop in flash_print_info()
- Change "return" to "break" in the "if (ctrlc()) statement:
This fixes a problem with the resulting output. Before this
patch the output was:
Fix printing & reading of 16-bit CFI device identifiers
Fix reading and printing of CFI flashes 16-bit devices identifiers
Nowadays CFI flashes have a 16-bit device identifier. U-boot still
print them and read them as if they were only 8-bit wide. Fix that.
Before:
Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x1B
After:
Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x881B
Signed-off-by: Philippe De Muyter <phdm@macqel.be> Signed-off-by: Stefan Roese <sr@denx.de>
Minkyu Kang [Fri, 13 Aug 2010 07:07:35 +0000 (16:07 +0900)]
S5P: Use accessor functions instead of SoC specific defines to access the base address
This patch is intended to prepare the other S5P SoC. (s5pc210)
If use SoC specific defines then can't share with other SoC.
So, make the accessor functions for access the base address by common way.
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Mike Frysinger [Thu, 12 Aug 2010 03:42:26 +0000 (23:42 -0400)]
env_nand: return error when no device is found
Currently, if there is an error probing the NAND chip and the env is based
in NAND, the readenv() function will use a NULL function pointer and thus
jump to address 0.
Here I just check for a non-zero value of blocksize as that shouldn't be
zero when a valid device is found, but perhaps there is a better way for
someone familiar with the NAND internals to suggest.
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
The OMAP3 block read function is not following API and always returning
1 instead of read block count, fix it. Also to simplify code, merge it
with with a helper function, which was only called from the block read
function.
After this patch ext2 filesystem can be used properly.
The "usb help" doesn't format the output correctly:
=> help usb
usb - USB sub-system
Usage:
usb reset - reset (rescan) USB controller
usb stop [f] - stop USB [f]=force stop
usb tree - show USB device tree
usb info [dev] - show available USB devices
usb storage - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'
to memory address `addr'usb write addr blk# cnt - write `cnt'
blocks starting at block `blk#' from memory address `addr'
=>
With fix below applied, the output is correct:
=> help usb
usb - USB sub-system
Usage:
usb reset - reset (rescan) USB controller
usb stop [f] - stop USB [f]=force stop
usb tree - show USB device tree
usb info [dev] - show available USB devices
usb storage - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'
to memory address `addr'
usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'
from memory address `addr'
=>
Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com>
Adding general register structure of system control module (SCM)
of AM35x. This would be required to access devconf2 and ip_sw_reset
register in musb module.
In case there is no frame buffer driver present in Linux to hand over the
PPI LCD DMA upon boot, the DMA initiated by u-boot to display the splash
screen runs unattended. Therefore always stop the video driver in u-boot
before starting Linux. If people don't want this behavior, then they can
simply stub out the video_stop() function in their board video driver.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Albert Aribaud [Tue, 13 Jul 2010 07:04:26 +0000 (09:04 +0200)]
orion5x: allow overriding default mappings windows
Turn all ORION5X_DEF{ADR,SZ}_xxx macros into ORION5X_{ADR,SZ}_xxx
and allow defining them from board code to override defaults. This
is particularly useful for defining board-specific FLASH address
and size in board header file rather than having to tweak orion5x
code.
Signed-off-by: Albert Aribaud <albert.aribaud@free.fr>
Ben Warren [Thu, 29 Jul 2010 19:56:11 +0000 (12:56 -0700)]
Fix compile warnings for const correctness
Commit 6e37b1a3a25004d3df5867de49fff6b3fc9c4f04 modifies several net calls
to take a (const char *) parameter instead of (char *), but in some cases
the modified functions call other functions taking (char *). The end result
is warnings about discarding the const qualifier.
This patch fixes these other function signatures.
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Mike Frysinger [Tue, 27 Jul 2010 22:35:10 +0000 (18:35 -0400)]
miiphy: leverage current_mii cache more
For code that uses miiphy_{read,write}, every call invokes a full look up
of the mii list. There is already a "current_mii" cache that is used by
some code, but have the miiphy_{read,write} function use it as well. This
does increase the code size slightly, but I think it's worth it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Mike Frysinger [Tue, 27 Jul 2010 22:35:09 +0000 (18:35 -0400)]
miiphy: unify device list lookup
Rather than have every func re-implement the list walking code, do it one
local function. This shrinks the resulting object code a little while
making the source much more manageable.
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Kim Phillips [Mon, 26 Jul 2010 23:34:57 +0000 (18:34 -0500)]
net: rename "FSL UECx" net interfaces "UECx"
continuation of commit 2ecc2262d66a286e3aac79005bcb5f461312dea8
"net ppc: fix ethernet device names with spaces" (currently in
u-boot-net.git) for QE based parts.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Acked-by: Dave Liu <daveliu@freescale.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
- "FEC ETHERNET" devices found on
mpc512x, mpc5xxx, mpc8xx and mpc8220 boards.
renamed to "FEC".
- "SCC ETHERNET" devices found on
mpc8xx, mpc82xx based boards. Renamed to "SCC".
- "HDLC ETHERNET" devices found on mpc8xx boards
Renamed to "HDLC"
- "FCC ETHERNET" devices found on mpc8260 and mpc85xx based
boards. Renamed to "FCC"
Tested on the kup4k board.
Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
net,fec: Shorten device name as done for other drivers
After discussion on the ML it is suggested to drop unrequired
and not useful characters from the device name.
This patch changes the name for the fec_mxc driver from
"FEC_MXC" to "FEC".
Signed-off-by: Stefano Babic <sbabic@denx.de> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Stefan Roese [Tue, 3 Aug 2010 08:29:50 +0000 (10:29 +0200)]
ppc4xx: Fix/Update katmai board header
This patch has the following fixes/changes:
- Set 'kernel_addr' and 'ramdisk_addr' to correct values and add
'fdt_addr' environment variable
- Remove 'kozio' environment variable
- Remove environmant variables to boot ancient arch/ppc Linux kernels
- Remove CONFIG_SYS_BOOTMAPSZ definition. It's already defined to
the same value in amcc-common.h
Wolfgang Denk [Fri, 23 Jul 2010 19:16:26 +0000 (21:16 +0200)]
ppc4xx: cleanup default environment for AMCC boards
None of the AMCC boards uses an embedded environment, so there is no
need to run "saveenv" after updating U-Boot. Drop the redundant
commands from the default environment.
Signed-off-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
Mike Frysinger [Tue, 3 Aug 2010 23:17:38 +0000 (19:17 -0400)]
config.mk: avoid -traditional-cpp on OS X 10.5
Simply trying to include a basic header file like stdlib.h on OS X 10.5
and then building with -traditional-cpp fails with lots of errors like:
In file included from /usr/include/stdlib.h:63,
from test.c:3:
/usr/include/available.h:85: error: stray '#' in program
/usr/include/available.h:85: error: syntax error before numeric constant
/usr/include/available.h:86: error: stray '#' in program
In the past, I hadn't noticed because the old logic for these flags were
restricted to Darwin running on PowerPC systems while I'm running on an
Intel system. But after some recent clean ups and changes, the flag was
being applied to all Darwin systems and my host tools broke.
Feng Wang [Tue, 3 Aug 2010 14:22:43 +0000 (16:22 +0200)]
fdt: Fix bug in size calculation in fdt_resize() with initrd use
Original bug description from Feng (fdt_resize() bug caused "WARNING:
could not set linux, initrd-start FDT_ERR_NOSPACE."):
What I got is an error: "WARNING: could not set linux,initrd-start
FDT_ERR_NOSPACE." after loading Device Tree blob. This in turn caused
linux to miss init part.
After some digging, I found out the reason for this error, it is caused
by fdt_resize().
FDT blob got resized after filling in all board specific information of
PowerPC. (in boot_body_linux()). It reduced blob size with only extra
space for two fdt_reserve_entry, one for fdt itself, and one for initrd.
Then it's aligned to a 0x1000 page boundary. However, later in
fdt_initrd(), it could add two more properties, initrd-start AND
initrd-end, each one needs at least two fdt_reserve_entry sizes done by
_fdt_add_property() (name and value). Thus, the two fdt_reserve_entry
extra space is not sufficient.
So for some specific fdt size which is just under the page boundary
after resizing, this will cause an error of FDT_ERR_NOSPACE in
fdt_initrd() when setting those two properties, and failed to pass
initrd information to linux.
My fix is in fdt_resize(), leave at least 4 fdt_reserve_entry for
initrd. So instead of 2*sizeof(struct fdt_reserve_entry) for
actual_totalsize, use 5*sizeof(struc fdt_reserve_entry).
Stefan: I got this same error on katmai, when trying to boot with
initrd (run flash_self). This patch fixes this issue.
Signed-off-by: Feng Wang <fwang02@harris.com> Tested-by: Stefan Roese <sr@denx.de> Cc: Jerry Van Baren <gvb.uboot@gmail.com> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
Mike Frysinger [Thu, 29 Jul 2010 03:45:03 +0000 (23:45 -0400)]
flash_protect: check for NULL flash info
If a flash is unable to be detected, and then someone calls flash_protect
on it (like the common code does in flash_init), the flash_protect logic
will dereference a NULL pointer.
Since flash_protect already does sanity checking on the info structs, add
a NULL pointer check in there.
Wolfgang Denk [Sat, 24 Jul 2010 20:16:20 +0000 (22:16 +0200)]
getenv_f(): fix handling of too short buffers
Fix error handling in getenv_f() when the user provided buffer is too
short to hold the variable name; make sure to truncate and
NUL-terminate without overwriting the buffer limits.
Mike Frysinger [Fri, 23 Jul 2010 10:17:30 +0000 (06:17 -0400)]
print_buffer: optimize & shrink
Applying a little creative format string allows us to shrink the initial
data read & display loop by only calling printf once. Re-using the local
data buffer to generate the string we want to display then allows us to
output everything with just one printf call instead of multiple calls to
the putc function.
The local stack buffer needs increasing by 1 byte, but the resulting code
shrink and speed up is worth it I think.
Mike Frysinger [Fri, 23 Jul 2010 09:28:15 +0000 (05:28 -0400)]
cmd editing: optimize/shrink output blanking
No need to output spaces 1 char at a time in a loop when the printf code
can do the same thing with the right format string. This shrinks things
and gives a nice speed up when killing off lines more than a byte or two
as printf will send out the buffer in one big chunk.
Stephan Linz [Fri, 25 Jun 2010 16:04:59 +0000 (18:04 +0200)]
fdt relocate: have more attention to use a bootmap or not
Platforms with flat device tree support can use a bootmap to relocate
the fdt_blob. This is not a must. That's why the relocation function
boot_relocate_fdt() should be use only if CONFIG_OF_LIBFDT was defined
together with CONFIG_SYS_BOOTMAPSZ (see common/cmd_bootm.c).
On MicroBlaze platforms there is no need to use a bootmap to relocate
a fdt blob. So we need a more precise focus on the compilation and usage
of boot_relocate_fdt().
In general it is valid to exclude the function boot_relocate_fdt() if
the bootmap size CONFIG_SYS_BOOTMAPSZ is not defined.
This patch enables mvsata driver and related filesystem support.
The patch is tested for ide reset and ext2ls operation for a disk drive connected on SATA port0.
This patch depends upon the patche-series http://lists.denx.de/pipermail/u-boot/2010-August/074908.html
Aaron Pace [Mon, 26 Jul 2010 20:24:44 +0000 (14:24 -0600)]
ext2fs: Fix optimization bug for doubly-indirect block pointers
Doubly-indirect block numbers are compared against the first-level
indirect block when checking for a cached copy. This is causing the
doubly-indirect block to be re-read each time it is accessed.
Repairing this reduces load time for a 70M file from 72 seconds
to 38 seconds.
Signed-off-by: Aaron Pace <Aaron.Pace@alcatel-lucent.com>
Fix condition where bootm_size not set and wrong memory size reported
If the user sets bootm_low and does not set bootm_size, u-boot will
report the memory node in the flat device tree incorrectly. Instead
of reporting the remaining size of memory, it will report the total
available memory which is incorrect.
Specifically this fixes the situation when booting a relocatable
kernel and the memory is reported as an offset and size in the
device tree, and the size needs to be adjusted accordingly.
Signed-off-by: Matthew McClintock <msm@freescale.com> Acked-by: Kumar Gala <galak@kernel.crashing.org>
Wolfgang Denk [Thu, 5 Aug 2010 19:31:54 +0000 (21:31 +0200)]
net 52xx: fix ethernet device names with spaces
Some commands (like 'mii') use this name to select devices, but they
break when those names contain spaces. So drop the space from
Ethernet driver names (cf. commit 1384f3bb).
Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
Steve Sakoman [Tue, 20 Jul 2010 03:31:55 +0000 (20:31 -0700)]
ARMV7: Modify i2c driver for more reliable operation on OMAP4
This patch modifies the init routine to follow the TRM
recommendations. It also modifies the i2c_read_byte function
to reflect subtle differences between the i2c controller in
OMAP3 and OMAP4.
Steve Sakoman [Tue, 20 Jul 2010 21:56:07 +0000 (14:56 -0700)]
ARMV7: Fix udelay for OMAP4
The OMAP4 x-load code sets gptimer1 clock source to 32Khz. This isn't
acceptable for udelay. This patch changes from gptimer1 to gptimer2,
which uses sys_clk at 38.4 Mhz.
Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Wolfgang Denk [Sat, 24 Jul 2010 19:55:43 +0000 (21:55 +0200)]
Rename getenv_r() into getenv_f()
While running from flash, i. e. before relocation, we have only a
limited C runtime environment without writable data segment. In this
phase, some configurations (for example with environment in EEPROM)
must not use the normal getenv(), but a special function. This
function had been called getenv_r(), with the idea that the "_r"
suffix would mean the same as in the _r_eentrant versions of some of
the C library functions (for example getdate vs. getdate_r, getgrent
vs. getgrent_r, etc.).
Unfortunately this was a misleading name, as in U-Boot the "_r"
generally means "running from RAM", i. e. _after_ relocation.
To avoid confusion, rename into getenv_f() [as "running from flash"]
Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
Mike Frysinger [Sun, 25 Jul 2010 19:54:17 +0000 (15:54 -0400)]
bootm: fix pointer warning with lzma
Avoid warning:
cmd_bootm.c: In function 'bootm_load_os':
cmd_bootm.c:394: warning: passing argument 2 of
'lzmaBuffToBuffDecompress' from incompatible pointer type
For 32 bit systems, this change shouldn't make a difference to code size
since sizeof(size_t) and sizeof(unsigned int) are equal. But it does fix
the warning.
Kim Phillips [Thu, 15 Jul 2010 00:47:29 +0000 (19:47 -0500)]
powerpc/8xxx: query feature reporting register for num cores on unknown cpus
doing so helps avant garde users, such as those using simulators that
allow users to configure the number of cores, so as to not have to
manually adjust u-boot sources. h/w should also be reliably setting
FRR NCPU in the future.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Kumar Gala [Thu, 15 Jul 2010 21:49:03 +0000 (16:49 -0500)]
powerpc/p4080: Add support for the P4080DS board
Add support for the P4080DS board, with the following features:
* 36-bit only
* Boots from NOR flash
* FMAN drivers NOT supported
* SPD DDR initialization
Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com> Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org> Signed-off-by: Ashish Kalra <Ashish.Kalra@freescale.com> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com> Signed-off-by: Dave Liu <daveliu@freescale.com> Signed-off-by: Lan Chunhe-B25806 <b25806@freescale.com> Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com> Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: York Sun <yorksun@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>