mksunxiboot: Fix loading of files with a size which is not a multiple of 4

We should not be aligning the amount of bytes which we try to read from the
disk, this leads to trying to read more bytes then there are which fails.

file_size is already aligned to BLOCK_SIZE before being stored in
img.header.length, so there is no need for load_size at all.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
mvtwsi: Fix clock programming

The TWSI_FREQUENCY macro was wrong in 2 ways:
1) It was casting the result of the calculations to an u8, while i2c clk
rates are often >= 100Khz which won't fit in a u8, drop the cast.
2) It had an extra factor of 2 in the divider which neither the datasheet nor
the Linux driver have.

The comment for the default value was wrongly saying that m lives in
bits 4-7, while in reality it is in bits 3-6, as can be seen from the correct
shift by 3 used in i2c_init().

While at it remove the unused twsi_actual_speed variable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
mvtwsi: Remove unnecessary twsi_baud_rate and twsi_slave_address globals

These are used only once, so their is no need to have them global.

This also stops mvtwsi from using any bss vars making it easier to use
before dram init (to talk to the pmic to set the dram voltage).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Use existing mvtwsi code for i2c master

Sunxi uses the same i2c controller, so re-use the existing code instead of
having our own duplicate code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sun4i: Stop setting up the non-existing mbus register

sun4i does not have a mbus ccmu register.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sun5i: Drop unused AHB_CLK_SRC_AXI define

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-mmc: Drop unused CONFIG_MMC1_PG code

And while at it make the comment for the mmc3 gpio mux the same as for the
other mmc controllers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-mmc: Dump debugging code

This syncs us with what is going upstream.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Makefile: Drop extra whitespace at end of file

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Revert "get_ram_size incorrectly returns long, should be unsigned long"

This reverts commit 7d8bc87e7e9b444a47715428df5c9a9792c92fd4.

This change has not been accepted upstream and 2G boards work fine without it,
so lets drop it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>