sf: inline data constants

I imagine much of these constants are due to copy & pasting previous
drivers rather than an actual reflection of the hardware layout.  At
any rate, inline the info that we don't care about externally as it
shrinks things nicely.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sf: unify erase commands

Analysis of the flash drivers shows that they all use 0x20 if the erase
size is 4KiB, or 0xd8 if it's larger.  So with this info in hand, we can
unify all the erase functionality in one place.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sf: eon: drop duplicate id

Looks like Shaohui Xie's patch got merged twice.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sf: sst: inline duplicate write enable helper funcs

The local sst enable/disable write funcs don't really add anything
over the common API, so just inline the common calls directly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sf: unify status register writing (and thus block unlocking)

The only two drivers to write the status register do it in the same
way, so unify the implementations.  This also makes the block unlock
logic the same.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
cmd_sf: add size checking to spi flash commands

SPI flash operations inadvertently stretching beyond the flash size will
result in a wraparound. This may be particularly dangerous when burning
u-boot, because the flash contents will be corrupted rendering the board
unusable, without any warning being issued.
So add a consistency checking so not to overflow past the flash size.

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sf: stmicro: add geometrical info for N25Q256 from Micron

Note: because 4-byte addressing is not supported yet,
at the moment only the first 16MiB of the device are available.

Signed-off-by: Jérôme Carretero <cJ@zougloub.eu>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
microblaze: Remove wrong define CONFIG_SYS_FLASH_PROTECTION

CONFIG_SYS_FLASH_PROTECTION is defined twice. The second one
is outside the flash configuration context and we can remove
it safely.

Signed-off-by: Stephan Linz <linz@li-pro.net>
Signed-off-by: Michal Simek <monstr@monstr.eu>
microblaze: Avoid compile error on systems without cfi flash

Use XILINX_FLASH_START to set/unset FLASH and RAMENV.

Error:
board.c: In function 'board_init':
board.c:134: error: 'XILINX_FLASH_START' undeclared (first use in this function)
board.c:134: error: (Each undeclared identifier is reported only once
board.c:134: error: for each function it appears in.)

Signed-off-by: Stephan Linz <linz@li-pro.net>
Signed-off-by: Michal Simek <monstr@monstr.eu>
microblaze: Enable ubi support

Increase malloc area for UBI to >= 512k -- foreseeing of UBIFS
set to 768k. To save memory in flash (CONFIG_SYS_MONITOR_LEN)
the UBIFS is disabled by default.

Signed-off-by: Stephan Linz <linz@li-pro.net>
Signed-off-by: Michal Simek <monstr@monstr.eu>
microblaze: Expand and correct configuration comments

  - fix CONFIG_SYS_MALLOC_BASE from 0x11FB_F000 to 0x13EF_F000
  - add new size calculation for CONFIG_SYS_MONITOR_LEN
    and CONFIG_SYS_MALLOC_LEN derived from SIZE
  - change CONFIG_SYS_MONITOR_BASE and CONFIG_SYS_MALLOC_BASE
    calculation to a symbolic equation with the corresponding
    _LEN definitions
  - add a "CFI flash memory layout - Example" comment

Signed-off-by: Stephan Linz <linz@li-pro.net>
microblaze: Add missing undefs for UBI and UBIFS

In the case of missing flash usage disaple (undef)
all the UBI support in the same way as for JFFS2.

Signed-off-by: Stephan Linz <linz@li-pro.net>
microblaze: Add gpio.h

Gpio support is not implemented yet. Adding it because of fdtdec.

Signed-off-by: Michal Simek <monstr@monstr.eu>
microblaze: Move individual board linker scripts to common script in cpu tree.

Unification for all microblaze boards.

Signed-off-by: Michal Simek <monstr@monstr.eu>
fdt: Add board specific dts inclusion

Some architectures, for example Microblaze, doesn't need a
splitted device tree because every Microblaze hw design is
different. The individuell Microblaze device tree will be
auto generated by FPGA design tools and could be used directly
with dtc.

The auto generated dts for Microblaze can not processed by CPP.
Unfortunately that is the default procedure in U-Boot to merge
a splitted device tree (substitution of ARCH_CPU_DTS).

Microblaze will never use the ARCH_CPU_DTS substitution and we
introduce the new board specific substitution variable BOARD_DTS
that points into vendor/board/dts subdir with the file name
of CONFIG_DEFAULT_DEVICE_TREE. The common dts file in vendor/dts
subdir (defined by CONFIG_DEFAULT_DEVICE_TREE) contain a single
include line that can processed by CPP:

    /include/ BOARD_DTS

Signed-off-by: Stephan Linz <linz@li-pro.net>
Tested-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>
microblaze: Wire up dts configuration

    - enable OF control and embedded OF
    - set default device tree file name to 'microblaze'
    - add CPP to dtc proxy: board/xilinx/dts/microblaze.dts
    - add an empty but processable dts for microblaze-generic

Signed-off-by: Stephan Linz <linz@li-pro.net>
microblaze: Remove extern from board.c

eth_init() is defined at include/net.h.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>
microblaze: Move __udelay implementation

Move __udelay to the timer code because of unification.
And clean coding style because of checkpatch.pl.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>
microblaze: Call serial multi initialization

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>
microblaze: intc: Clear interrupt code

Clear and prepare for device-tree driven configuration.
Remove CONFIG_SYS_INTC_0 definition
Use dynamic allocation instead of static.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>