Commit Graph

46191 Commits

Author SHA1 Message Date
Alex Deymo 170e9eb9d1 android: Fix off-by-one error when joining strings
When concatenating the strings to form a new command line in the
android bootloader flow, the null-terminator was placed one byte after
the end of the allocated string.

Bug: None
Test: booted a rpi3.
Change-Id: I120e09a77bb1c27980e7ce2b5f9b8961424ed0c3
2017-11-14 10:55:47 +08:00
Alex Deymo 180cc7c601 android: Implement A/B slot select.
The android_bootloader_control struct defined in bootloader_message.h
stored the A/B metadata used to decide which slot should we use to boot
the device. This patch implements the bootloader side of the slot
selection in a new "android_ab_select" command which decides the
current slot and updates the metadata as needed.

Bug: 32707546
Test: Booted a rpi3, updated to the other slot.
Change-Id: I9344ff5b76194160d2b466a50e84f4f423b1a98a
2017-11-14 10:55:46 +08:00
Alex Deymo df7cce4361 boot_android: Drop the "mmc" restriction on the partition name.
part_get_info_by_name() was extended to support more than just mmc/efi
partitions. This patch remove this restriction from the
part_get_info_by_dev_and_name() function.

Bug: 32707546
Test: Booted rpi3.
Change-Id: If6399f7d24e99911b3b14a125a6bc1f472b7eecf
2017-11-14 10:55:46 +08:00
Alex Deymo 8062224026 boot_android: Pass the slot from the command.
In order to support booting from either slot, this patch passes the
slot name from the command line.

Bug: 32707546
Test: Booted rpi3.
Change-Id: I30582bd8b1b95dc0f25b0c6624e7909ee4118bd0
2017-11-14 10:55:46 +08:00
Alex Deymo 06f4a8746e Add "boot_android" command.
The new "boot_android" command simply executes the Android Bootloader
flow. This receives the location (interface, dev, partition) of the
Android "misc" partition which is then used to lookup and infer the
kernel and system images that should be booted.

Bug: 32707546
Test: Booted a rpi3 build with Android Things.
Signed-off-by: Alex Deymo <deymo@google.com>

Change-Id: Ibf3f31e38b159d42db7a0835b99ad7ec260fc2a7
2017-11-14 10:55:46 +08:00
Alex Deymo 67dac67453 Initial support for the Android Bootloader flow
An Android Bootloader must comply with certain boot modes and change
the kernel command line accordingly. This patch introduces the Android
boot mode concept which determines whether the device should boot to
one of the following:
 * recovery: which should boot to the recovery image,
 * bootloader: which should boot to the "bootloader" (fastboot) and
 * normal: which should boot to the system image.

The boot mode is determined in part by the Boot Control Block (BCB)
which is stored at the beginning of the "misc" partition. The BCB
is defined in the "bootloader_message.h" file in AOSP, now copied
here as android_bootloader_message.h with minor modifications.

This patch implements the basic boot flow that loads and boots an
Android kernel image assuming an A/B device which implies that it uses
boot as recovery (BOARD_USES_RECOVERY_AS_BOOT in the BoardConfig.mk).
This means that the recovery image shares the same kernel with the
normal boot system image, but stores the recovery image as a ramdisk
which is not used in normal mode.

Among the limitations, this patch doesn't implement the A/B slot
selection, it only boots from the slot "a".

Bug: 31887729
Test: Booted a rpi3 with this flow.

Signed-off-by: Alex Deymo <deymo@google.com>
Change-Id: Ia2932c6f398f1ae713f0cd9670828f84103dca38
update setenv/getenv to env_set/env_get.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-14 10:55:46 +08:00
Alex Deymo 76e2a5a6c6 Move Android Image loading logic to image-android.c
This patch moves the Android Image loading logic from the load_android
command to a new android_load_image() function in image-android.c so it
can be re-used from other commands.

Bug: 32707546
Test: Booted the rpi3 with this patch.
Signed-off-by: Alex Deymo <deymo@google.com>
Change-Id: I12d206141ead1b94ebbcc90ee05512a276c7595a
2017-11-14 10:55:46 +08:00
Alex Deymo 95916cf3d6 Add PREUPLOAD.cfg.
Add a PREUPLOAD.cfg file to check the patches before uploading them.

Bug: None
Test: repo upload
Change-Id: I6266360503f5360f968fd0d83bbf209b6f72e43c
2017-11-14 10:55:45 +08:00
Jocelyn Bohr 9ec8daff33 Handle all commands and variables for "fastboot flashall"
Implement the rest of the variables and fastboot commands for flashall.
For A/B related commands, slot A is always selected.

Bug: 31887729
Test: "fastboot flashall" does not result in any unknown commands or
      variables

Change-Id: Iec794a0a0805aeb744157ab25b417443a3fc7f5a
2017-11-14 10:55:45 +08:00
Jocelyn Bohr aba554cc34 Handle slow MMC writes
Flashing a 400Mb sparse system image takes ~10 minutes. The fastboot UDP
protocol expects a response within 1 minute, so during long flash
operations, the device must send fastboot "INFO" packets.

This patch does the following:
  - Separate large writes into writes of size FASTBOOT_MAX_BLK_WRITE.
    This parameter was tuned by hand to result in a ~10 second write.
  - Keep a timer and send an INFO packet every 30 seconds.
  - Adjust the sequence number in the header of the fastboot OKAY packet
    to account for any INFO packets sent during flashing.
  - Reduce busywaiting in the bcm2835 MMC driver. This change is based on
    what the kernel does, and doesn't seem to corrupt the MMC. Without
    this change, "flashall" takes 25 minutes.

Bug: 31887729
Test: "fastboot -s udp:$RPI_IP flashall" works, rpi3 boots
      - Compute CRC checksum over every write to verify written data
        was not corrupted.

Change-Id: Ib17ef6a85715705a8b5f722a8b7d3e5fd1a6625d
2017-11-14 10:55:45 +08:00
Jocelyn Bohr 0eda6822d0 Implement fastboot continue, reboot, reboot-bootloader, boot.
Add functions to respond to fastboot continue, reboot, and
reboot-bootloader. Continue continues the normal android boot process.
Reboot-bootloader writes a message to the start of the fastboot
buffer, to be parsed at the start of the android boot process. Boot
boots the previously downloaded image from memory.

Bug: 31887729
Test: - Sending "continue" boots into android.
      - Sending "reboot" reboots the device.
      - Sending "reboot-bootloader" reboots the device, and the
        message persists in memory.
      - Sending "boot boot.img" boots into kernel.

Change-Id: I8b14724de4612450ccc382bb7532edb993e6e8a4
2017-11-14 10:55:45 +08:00
Jocelyn Bohr 8b464fa913 Implement fastboot flash and erase.
Add function to respond to fastboot flash and erase. Flash writes the
previously downloaded image to indicated partition. Erase clears the
indicated partition. fb_flash and fb_erase are essentially wrappers
for fb_mmc_flash_write and fb_mmc_erase, which are implemented in
common/fb_mmc.c.

Added common/fb_common.c, where fastboot_okay/fail are implemented.
common/fb_mmc.c assumes fasboot_okay() and fastboot_fail() are
implemented, but they were tied to the fastboot USB implementation.
This refactor adds the response string as a parameter to
fastboot_okay/fail, instead of modifying a global.

Bug: 31887729
Test: FLASH:
      - Create file "foo" containing 2048 chars = "-"
      - Start "fastboot udp" on device and run
        "fastboot -s udp:$RPI_IP flash misc foo" from host
      - From U-boot console, read into memory the first 4 blocks from
        misc partition, observe each byte is "-".

      ERASE
      - Start "fastboot udp" on device and run
        "fastboot -s udp:$RPI_IP erase misc" from host
	  - From U-boot console, read into memory many blocks from misc
        partition, observe each byte is 0x00

	  Configs that use fastboot USB implementation still build.

Change-Id: I5bd54868990bd9d5736d0969b3db240c2926eeec
2017-11-14 10:55:45 +08:00
Jocelyn Bohr 45930fc17b Implement fastboot download.
Adds function to respond to fastboot download, and copy downloaded
image to buffer in RAM.

Bug: 31887729
Test: - Create file "foo" containing 2048 chars = "-"
      - Start "fastboot udp" on device and run
        "fastboot -s udp:$RPI_IP flash boot foo" from host
      - Observe that rpi received 2048 bytes of data, and
        CONFIG_FASTBOOT_BUF_ADDR contains "-"*2048

Change-Id: Ib42378448627b48c629af89f39a0394db93c3824
2017-11-14 10:55:44 +08:00
Jocelyn Bohr 02ad78925c Handle Fastboot packet types, implement getvar.
This patch adds functionality to parse Fastboot packet types, and send
a response to getvar commands.

Bug: 31887729
Test: Responds to getvar commands with correct values for variables
      version, bootloader-version, downloadsize, serialno.

Change-Id: I752a6119d3019745f20defbb1f0c13dba1f24221
2017-11-14 10:55:44 +08:00
Jocelyn Bohr 965eda410b Add support for fastboot command over UDP
The Raspberry Pi does not support USB device mode, so fastboot over
USB does not work. This patch adds support for and partially
implements the device side fastboot UDP protocol as a U-boot command.
It requires an ip address set and ethernet initialized.

- Modify U-boot fastboot command to do fastboot over UDP
- Add net/fastboot.c, which implements fastboot server functions
- Handle QUERY and INIT fastboot packets
- Add CONFIG_UDP_FUNCION_FASTBOOT to enable fastboot over UDP

Bug: 31887729
Test: Tested with fastboot, responds correctly to query and init
      packets.

Change-Id: I4045abaf7a4455d756b7c1c00215afaa90c70a6e
2017-11-14 10:55:44 +08:00
Alex Deymo 83a51ebaaa Add 'load_android' command to load Android images.
Android kernel images include a header that specifies addresses and
kernel size. This patch adds a command to load these images from
storage without specifying the size or address of them, and parsing
them from the header instead.

Bug: 31636643
Change-Id: I84a9cf82cff78ce2299b1981c4f6f9a5720e4d0d
2017-11-14 10:55:44 +08:00
Alex Deymo dd3908179b rpi: Capture the device tree passed from the bootloader.
The Raspberry Pi bootloader (bootcode.bin and start.elf) will load
the device tree from the same FAT partition and combine it with
device tree overlays specified in config.txt. This device tree is then
passed to the kernel (in this case U-Boot) in the r2 register.

This patch retrieves the machine id (r1 register) and the device tree
(r2 register) passed to U-Boot and store those in environment variables
on boot so boot scripts can refer to those and pass them to the kernel.

When CONFIG_OF_BOARD is defined, the same device tree passed to U-Boot
will be used in lieu of bundling one with the U-Boot image at build
time.

Bug: 31636643
Test: Booted a Raspberry Pi3 passing the DT from the bootloader.
Change-Id: Ibf9c754719b3e0f41d20382833abf853ba7613e2
2017-11-14 10:55:44 +08:00
Joseph Chen 8f9ff70555 power: charge animation: exit charge if not boot normal mode
exactly for exit charge when detect boot recovery mode now.

Change-Id: I72cdc6cab58d1a825f6a9f036abc0cf13dbcc443
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-13 09:52:47 +08:00
Joseph Chen 145fcb5cde rockchip: add rockchip_get_boot_mode function
Change-Id: Ie1cc9353f05456ad3965260cb0f72bfb2d8a775b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-13 09:52:16 +08:00
Andy Yan dd9a11eaf4 rockchip: rk3128: check bootmode from pmu_sys_reg0
To keep synchronization with other paltforms, RK312x
will also check all bootmode information from one
register--PMU_SYS_REG0(0x0x100a0038).

This change should based on rk3126_ddr_300MHz_v2.09.bin

Change-Id: Ia09c87a2d55337b4d6f3ddc58f1a8dfcef8bb4a2
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-13 09:51:02 +08:00
David Wu bab2d2c360 clk: rockchip: Use common interface for pclk_peri
The peripherals pclk rate is the same, use a common interface
for peripherals like i2c, pwm and etc.

Change-Id: Id9668400f2bb24be397adee312da5365e09c9237
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-11-13 09:49:26 +08:00
David Wu e630a69b2d rockchip: test: Add ethernet test cases
1. Add phy loopback test
2. Add delayline array scaned
3. Add delayline setting
4. Add dhcp boot from network

Change-Id: I00abc1c7acb4659b78e29bffc12f0964e5d02937
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-11-13 09:48:59 +08:00
David Wu 1eb9d0643a net: gmac_rockchip: export set_rgmii delayline function
We will use the common interface to set gamc rgmii sometimes,
but the set_rgmii is a private ops. So abstract an exposed
interface out for use.

Change-Id: Ie1cd15033465ff324b77de389e57d32b28c3d389
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-11-13 09:48:50 +08:00
Joseph Chen 885d92d430 rockchip: boot_mode: add 'reboot charge' support
Change-Id: Id64bedc1d0c0774d809a2aa54947aebe7fb8eebe
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-10 18:38:37 +08:00
Joseph Chen f21199c15e include: rk3128_common: enable preboot command
Change-Id: Iedf21914fd85ba8d817b7c6fe4cf0920453407fc
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-10 18:38:34 +08:00
Joseph Chen 55aee569aa rockchip: parameter: mtdpart address uses cmdline directly
1. rename RK_BLK_OFFSET to RK_PARAM_OFFSET;
2. parameter.txt should promise partition address is physical.

Change-Id: Ibadc0589c14f6e48475e4db8526535b8a986d944
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-10 17:21:28 +08:00
Joseph Chen 4853871c4f rockchip: boot mode: use rockusb download mode as first selection
If failed, we fall back to bootrom download mode.

Change-Id: I003a496d1162e56c459ed54b7d69930a48d91210
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-10 17:16:31 +08:00
Joseph Chen a8b9d02646 power: charge animation: exit charge if detect preboot command.
charge animation will call fuel gauge to set charge current according
to adapter before exit, it promises lower power battery has enough power
supply during some long time preboot command execution.

Change-Id: I7fe5b19a0a48422528956310d5ee272ef556b840
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-10 17:16:31 +08:00
Joseph Chen 80d1262bce rk3128: fix typo of CONFIG_DM_CHARGE_DISPLAY
Change-Id: I67b5f5d75fab2d97310b8ff81ee3dd906a160449
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-10 17:16:31 +08:00
Joseph Chen 0130bb7851 fuel gauge: rk816: initialize charge current at probe
Change-Id: Ia2d9a22b39eecaf5a965971caef5bed953f2bf1b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-10 17:16:31 +08:00
Joseph Chen 462e467ddf fuel gauge: rk816: first power on must do rsoc initialization
clean up conditons that allow do rsoc initialization:
1. PMIC is first power on;
2. dsoc or voltage is under threshold value.

Change-Id: Icd5fb5eb72653a38f901b95a3d5e07cfac8c8a7b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-10 17:16:31 +08:00
Kever Yang 7a4d1b5406 rockchip: update boot0 hook
armv7 SPL: TAG(overwrite 'b 1f')+'b reset' + ARM_VECTORS
armv7 U-Boot: ARM_VECTORS
armv8 SPL: TAG(overwrite 'b 1f')+'b reset' + Reserved_iram(rk3399)
armv8 U-Boot: 'b reset'

Change-Id: I0ebb3e57d138c02e8781e50dbe775925cd0d71e0
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-10 15:29:36 +08:00
Kever Yang f4fc5f8dd3 arm: irq: do not enable irq in SPL/TPL
Change-Id: I6a9b8b883ede2e45e2c5760c633f04bd9ab4fe4e
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-09 19:34:04 -08:00
Kever Yang cd5a540c8a rockchip: clk: update configure_cpu code order for rk3399
The definition of function configure_cpu() need before rkclk_init().

Change-Id: I791fe6d670af6f36e755978c144c47aaabd8e1b6
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-09 15:43:03 +08:00
Kever Yang 564ceadd6f rockchip: clk: continue work if there is no pmu reset driver
Change-Id: I8011a932df63f82ded8d5713fef103153e751d5d
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-09 15:42:59 +08:00
Kever Yang f90455d7ba rockchip: inno-phy: Fix a compile warning
In file included from drivers/phy/phy-rockchip-inno-usb2.c:8:0:

./arch/arm/include/asm/arch/clock.h:93:29: warning: 'struct udevice'
declared inside parameter list [enabled by default]

./arch/arm/include/asm/arch/clock.h:93:29: warning: its scope is only
this definition or declaration, which is probably not what you want
[enabled by default]

Change-Id: I2a17d469c70897b2a2024c71054b72c76b409f4e
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-09 15:18:27 +08:00
Shawn Lin de2f83b25a rockchip: test: Make start LBA mandatory for emmc test
Support reading start LBA from test command and so that
the developer could understand which area is cleared by
the emmc write test, and he/she recovery the image respectively
from the flashing tool by looking into the parameter file.

Change-Id: Ie050c44bb7ef5c4f0edd5f80370da12420500f08
Suggested-by:  Joseph Chen <chenjh@rock-chips.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2017-11-09 12:41:57 +08:00
Frank Wang a52e8dd4da usb: gadget: dwc2: avoid reset core before devices connected
Theoretically, the UDC register need not reconfig when GINTSTS.USBRst
is set, and only do core reset if the devices was connected before.
This change adds _connected_ flag to check the devices was really
connected or not. As an optimization, reset device address to zero
while GINTSTS.USBRst is set.

This patch fix usb connect failed when continuously perform the
'fastboot reboot-bootloader' command.

Change-Id: I6a78228e147d2274329d922ac3f3ffef19492e7e
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2017-11-09 12:32:26 +08:00
Joseph Chen d007e7964b arm: armv8: introduce cpu suspend and resume support
Just like linux, it supports cpu save and restore context
during enter and exit low power mode. With this patch, cpu
is able to suspend with core power off.

Workflow for trap into ATF for system suspend:
	cpu_suspend
	   -> cpu_do_suspend
	      -> arch specific fn: int (*fn)(unsigned long)
		  -> psci_system_suspend(deliver 'cpu_resume()' address to ATF)
		     -> ATF system suspend
		     <- ATF system resume
	      <- cpu_resume
	   <- cpu_do_resume
	next instruction

Notice: If needed, you should remember to save and restore GIC by yourself.

Change-Id: I7a7c4989ba0845f5b6880c55a6ea6c47724c99df
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-09 09:57:59 +08:00
Joseph Chen 5492555290 arm: armv7: introduce cpu suspend and resume support
Just like linux, it supports cpu save and restore context
during enter and exit low power mode. With this patch, cpu
is able to suspend with core power off.

Workflow for trap into ATF for system suspend:
	cpu_suspend
	   -> cpu_do_suspend
	      -> arch specific fn: int (*fn)(unsigned long)
		  -> psci_system_suspend(deliver 'cpu_resume()' address to ATF)
		     -> ATF system suspend
		     <- ATF system resume
	      <- cpu_resume
	   <- cpu_do_resume
	next instruction

Notice: If needed, you should remember to save and restore GIC by yourself.

Change-Id: I5cb6fb6ac5b6a7f4ec4a975b0fc38250b000b28e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-11-09 09:57:50 +08:00
Andy Yan 6f00aaa207 rockchip: blk: remove cache operation
The underlying drivers should be responsible
for the cache operation.

Change-Id: Iff19807fc5f72295e721511081846e34291d7770
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-08 20:42:53 +08:00
Andy Yan 2b0c24e04f rockchip: configs: enable ROCKCHIP_PARTITION_BOOT
This enable bootrkp command to boot a system from
rockchip format partition.

Change-Id: Ia7a1bdaccafc85393cc5156e41d8f44d500af7b8
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-08 17:35:03 +08:00
Andy Yan efe731c26f rockchip: boot mode: parse adc channel from dts
Most the current rockchip based boards use adc channel
1 detect the download key, but there ares also some
boards like rk312x base plaform use adc channel2.
So we parse the adc channel from dts if we can get
it, otherwise we use the channel 1 as default.

Change-Id: I2fccb7bf73db67100d7e800f87ac34ac651bba34
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-08 15:20:54 +08:00
Andy Yan 692bb812fb FROMLIST: rockchip: check download key before bootup
Enter download mode if the download key pressed.

Change-Id: I4827884e1b974bf42d5a38c138c827d079d5983f
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-08 15:20:54 +08:00
Andy Yan 47a9f8fc78 FROMLIST: rockchip: add support for enter to bootrom download mode
Rockchip bootrom will enter download mode if it returns from
spl/tpl with a non-zero value and couldn't find a valid image
in the backup partition.
This patch provide a method to instruct the system to back to
bootrom download mode by checking the BROM_DOWNLOAD_FLAG register.
As the bootrom download function relys on some modules such as
interrupts, so we need to back to bootrom as early as possbile
before the tpl/spl code override the interrupt configurations.

Change-Id: Ib07315127573f1cc38e158f69679ba4e27857cf2
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-08 15:20:54 +08:00
Andy Yan be55ced34e FROMLIST: rockchip: make boot_mode related codes reused across all platforms
setup_boot_mode function use the same logic but different
mode register address across all the rockchip platforms,
so it's better to make this function reused across all the
platforms, and let the mode register address setting from
the config file.

Also add support for rk312x soc which is a little
special: the bootrom download flag is stored in
a grf register but the other boot mode flags are
stored in anohter pmugrf register.

Change-Id: I2e6a0ba870626adb837975c08094250d47767dac
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-11-08 15:20:53 +08:00
Philipp Tomsich 6053e13978 UPSTREAM: rockchip: mkimage: remove unused code-paths (spl_boot0 is now implied)
With all targets converted to generate prepadded images, this removes
the spl_boot0 field from our config structure and removes the unused
code-path (for images that are not prepadded): i.e. spl_boot0 is now
implied as 'true' and the code is specialised by removing the other
case.

Change-Id: Ib3d90539acb72e01c31a9da819ba8b46134bcb5e
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-08 15:20:53 +08:00
Philipp Tomsich 397403c7e4 UPSTREAM: rockchip: rk3188: move CONFIG_SPL_* entries from rk3188_common.h to Kconfig
There still are a few CONFIG_SPL_* options selected using defines from
rk3188_common.h instead of via Kconfig.  This migrates those over to
Kconfig.

Change-Id: Ib5190f8478a38613879a0182503ad1c720640384
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-08 15:20:53 +08:00
Philipp Tomsich 50b28820e7 UPSTREAM: rockchip: back-to-bootrom: allow passing a cmd to the bootrom
The BROM supports forcing it to enter download-mode, if an appropriate
result/cmd-word is returned to it.  There already is a series to
support this in review, so this prepares the (newly C-version) of the
back-to-bootrom code to accept a cmd to passed on to the BROM.

All the existing call-sites are adjusted to match the changed function
signature.

Also sync the support to rk3036 / rk3228

Change-Id: I1ea9bc12d6d84a75c043754b0eba7b8959e81d69
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-08 15:20:08 +08:00
Philipp Tomsich 3513fb1ea5 UPSTREAM: rockchip: back-to-bootrom: replace assembly-implementation with C-code
The back-to-bootrom implementation for Rockchip has always relied on
the stack-pointer being valid on entry, so there was little reason to
have this as an assembly implementation.

This provides a new C-only implementation of save_boot_params and
back_to_bootrom (relying on setjmp/longjmp) and removes the older
assembly-only implementation.

Change-Id: Ic20320dbbb71744386107686120475943442cdd7
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2017-11-08 15:12:52 +08:00