make "boot from USB" work with u-boot on RK3188

XXX THIS IS VERY DIRTY HACK! XXX

this only works with latest u-boot for RK3188 from
 https://github.com/linux-rockchip/u-boot-rockchip

e.g.)
 rkflashtool M 0x62000000 0x1000000 < ramdisk.img
 rkflashtool M 0x63000000 0x1000000 < kernel.img
 rkflashtool M 0x64000000 0x1000000 < parameter.img
 rkflashtool B 0x63000000 0x64000000

protocol may be incompatible with Rockchip. it may be changed in future.

you may omit rkcrc header from ramdisk and/or parameter.

if you omit rkcrc header from kernel, it will not be relocated to the
load address described in KERNEL_IMG: line in parameter. (i.e. kernel
needs to be coded to start at 0x63000000 in above case)
Fix warnings: ignoring return value of ‘write’, declared with attribute warn_unused_result
Check parameter size before reading partition

This check is needed when trying to read a missing parameter partition,
for example after a lower format...
Clean whitespaces
rkflashtool: add infocr() helper function

infocr() is used for printing to stderr using a carriage return character '\r'
Makefile: fix ld warning on OS X

option -s is obsolete and being ignored
rkflashtool: read chip version

Get the chip version from the bootrom.
cf. K_FW_GET_CHIP_VER and FW_GetChipVer() in U-Boot (rockusb)

    $ rkflashtool v

- Marsboard (RK3066)

    rkflashtool: info: rkflashtool v5.2
    rkflashtool: info: Detected RK3066...
    rkflashtool: info: interface claimed
    rkflashtool: info: chip version: 300A-2011.11.11-V101

- Radxa Rock (RK3188)

    rkflashtool: info: rkflashtool v5.2
    rkflashtool: info: Detected RK3188...
    rkflashtool: info: interface claimed
    rkflashtool: info: chip version: 310B-2012.11.30-V100

- Radxa Rock Pro (RK3188)

    rkflashtool: info: rkflashtool v5.2
    rkflashtool: info: Detected RK3188...
    rkflashtool: info: interface claimed
    rkflashtool: info: chip version: 310B-2013.01.31-V101
rkflashtool: define SDRAM_BASE_ADDRESS
rkflashtool: refactor / improve code readability
rkflashtool: Read NAND Flash ID / Info

cf. FW_ReadID() and FW_GetFlashInfo() in U-Boot (rockusb)

    $ rkflashtool n

    rkflashtool: info: rkflashtool v5.2
    rkflashtool: info: Detected RK3188...
    rkflashtool: info: interface claimed
    rkflashtool: info: Flash ID: 2c 64 44 4b a9
    rkflashtool: info: Flash Info:
            Manufacturer: Micron (value: 4)
            Flash Size: 8192MB
            Block Size: 2048KB
            Page Size: 8KB
            ECC Bits: 40
            Access Time: 32
            Flash CS: Flash<0>
rkflashtool: erase flash: use infocr() instead of info()
rkflashtool: write parameters

$ rkflashtool P < param
rkflashtool: fix read/write on linuxroot partition

Read size from NAND info when the partition extends up to the end of NAND
rkflashtool: support mask rom mode

add following commands for mask rom mode
 "rkflashtool l" for uploading (encrypted) DDR init code.
 "rkflashtool L" for uploading (encrypted) loader.

e.g.
 openssl rc4 -K 7c4e0304550509072d2c7b38170d1711 < 32_LPDDR2_300MHz_LPDDR3_300MHz_DDR3_300MHz_20140630.bin | rkflashtool l
 openssl rc4 -K 7c4e0304550509072d2c7b38170d1711 < u-boot.bin | rkflashtool L

for now, I confirmed that rk30usbplug.bin (on RK3188), rk32xxusbplug.bin
(on RK3288), and u-boot.bin for RK3288 can be run as loader.

XXX: rc4 encryption should be done in rkflashtool
rkcrc: use table-driven version by default
rkflashtool: use infocr() for reading IDB flash memory
rkflashtool: check CRC when retrieving parameter