ARM: sunxi: Basic Allwinner A10/A13/A10s (sun4i/sun5i) support

Basic support for Allwinner A10/A13/A10s family of SoC's and dev boards

This work is in part based on sun4i u-boot version published by Allwinner

Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Stefan Roese <sr@denx.de> (unverified)
Signed-off-by: Hans de Goede <hdegoede@redhat.com> (unverified)
Signed-off-by: Oliver Schinagl <oliver@schinagl.nl> (unverified)

Series-version: 3
Cover-letter:
This series of patches adds support for Allwinner A10/A13/A10s family of
SoCs commonly found in budget tablets & HDMI sticks.

The series is split in
* Common SoC support
* Drivers (I2C, MMC, GPIO, watchdog)
* SPL support
* SPL FEL support (boot via USB "FEL" protocol)
* Boards (mostly SPL DRAM parameters)
END

Series-changes: 3
- A10s support added
- CONS_INDEX defaults to 1 for sun5i (from A10s support)
- pull-up enabled on UART RX pin
- Cosmetic code cleanups
- Added boot suppot for a sinle ext* partition with files in /boot
  (in addition to fat/ext partition with files in /)
- enabled zImage and raw initrd support
sunxi: statusled support
ARM sunxi: Basic GPIO driver

GPIO driver for Allwinner sun4i/sun5i family of SoCs

GPIO Pins are named by their symbolic pin names P<g><#>
such as PH19 or H19.

Note: This do not perform any validation if the pin is in use
for some other I/O function. Use with care.

Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>

Overal codebase cleanup (gpio driver)

This patch tries to improve concistency and cleans up things to make
checkpatch happy. (Except while errors :S )

Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>
ARM: sunxi: MMC driver

This adds a basic MMC driver for Allwinner sun4i/sun5i family of SoC
this driver is limited to a single MMC channel.

This is based on earlier sun4i board support published by Allwinner

Signed-off-by: Henrik Nodstrom <henrik@henriknordstrom.net>
Signed-off-by: Stefan Roese <sr@denx.de> (unverified)
Signed-off-by: Oliver Schinagl <oliver@schinagl.nl> (unverified)

Series-changes: 3
- Dynamically allocate buffer descriptors. Was hardcoded to 0x50000000
- Correct debug output
- Cosmetic code cleanup
sunxi: Enable MMC0 controller

sunxi: Don't enable MMC0 if the UART is router to PF (SDC0 slot)
ARM sunxi: I2C driver

A basic driver for the I2C controller found in Allwinner sunXi
(A10 & A13) SoCs.

Note: This will be replaced by compatible mvtwsi.

Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>

Series-changes: 3
- cosmetic cleanup
ARM: sunxi: watchdog support

Support for the hardware watchdog in Allwinner sunxi SoC familiy.

From: Henrik Nordstrom <henrik@henriknordstrom.net>

Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Stefan Roese <sr@denx.de> (unverified)
Signed-off-by: Oliver Schinagl <oliver@schinagl.nl> (unverified)

Series-changes: 3
- fixed issue where reset hang on second reboot
- cosmetic code cleaups
- moved watchdog code to arch/.../sunxi/watchdog.c
- corrected timeouts
power: Add AXP209 Power Management controller (I2C)

Support for AXP209 Power Management controller,
used by most sunxi (Allwinner A10/A13) based boards.

From: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Stefan Roese <sr@denx.de>

axp209: Blindly assume it is an AXP209

It appears chip version detection is not so simple and different CHIP_ID
values are returned under some conditions.
axp152: Add axp152 pmu driver

Based on Henrik Nordstrom's axp209 code and Simon "theRat" 's modifications
to the axp209 code for axp152 support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>

Series-changes: 3
- added axp152 driver
net: Add sunxi (Allwinner) emac driver

Adds support for Allwinner EMAC, the ethernet controller included
in the Allwinner families of SoCs.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>

Series-changes: 3
- Initialize MII clock earlier so mii access to allow independent use
- Name change from WEMAC to EMAC to match mainline kernel & chip manual
- Cosmetic code cleanup
ARM: sunxi: Enable ethernet support (emac)

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>

Series-changes: 3
- name change from WEMAC to EMAC
- configuration generalized in sunxi-common.h
- now enabled per board from boards.cfg
- added more network commands and netconsole support
tools: mksunixboot adding a Allwinner boot header

This tool adds a boot header to the supplied file, for booting
code directly from the SoC embedded boot rom. Needed for making
the SPL loader bootable.

From: Tom Cubie <Mr.hipboi@gmail.com>
Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Stefan Roese <sr@denx.de>
ARM: sunxi: U-Boot SPL capable of booting directly from MMC

Allwinner sunxi family of SoCs boots from MMC0/NAND/NOR/MMC2 loading
boot code into an embedded 32KB SRAM.

This adds support for booting u-boot SPL from MMC0

We first initializes the console UART, then DRAM controller with board
specific DRAM configuration details, configure CPU core voltage and
clocks before loading the full u-boot image into DRAM.

Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>

Series-changes: 3
- Correct CONFIG_SPL_MAX_SIZE (24KB)
- sunxi: Replace __bss_end__ with __bss_end to match u-boot/master changes
- Cosmetic code cleanup
- NO_AXP to support boards without an AXP power management controller
- axp152 support
- Show SPL CPU frequency setting at boot
sunxi spl: Add minimal FEL SPL (CONFIG_SPL_FEL)

Allwinner CPUs supports an USB bootmode called FEL where the USB
host can upload code via a simple USB protocol. To execute anything
bigger than a few KB the board first needsto be initialized and
that is the job of the FEL SPL.

Series-changes: 3
- Added FEL SPL
sunxi: Add autoboot from ram to aid FEL booting

Series-changes: 3
- Added autoboot from ram for FEL booting
ARM sunxi: SPL support for Olimex A13-OLinuXino board

Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>

Series-changes: 3
- added status LED support
- FEL SPL support
ARM sunxi: SPL support for Mele A1000 board

Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com> (unverified)

Series-changes: 3
- added statusled support
ARM sunxi: SPL support for Cubieboard board

From: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Alejandro Mery <amery@geeks.cl>
Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Series-changes: 3
- added statusled support
ARM sunxi: SPL support for Hackberry 1GB board

From: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: J M <mtx512jm@gmail.com>
ARM sunxi: SPL support for a13_mid board

From: Jari Helaakoski <tekkuli@gmail.com>
Signed-off-by: Jari Helaakoski <tekkuli@gmail.com>
Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>