The limit needs to be raised as soon as possible to prevent boot loops
on empty or removed battery. The default 450mA limit is crossed when
eMMC or SD card starts seeing reads in SPL after DRAM was already
enabled in TPL.
But this fix is good enough to prevent boot loops when the phone can still
get ~100mA from the battery to cover the difference between 450 mA current
limit and ~550 mA needed to load main U-Boot from eMMC while the DRAM
is already initialized by TPL.
Detect low battery voltage and prevent boot, set current limit to
something even USB 3.0 port can handle, and charge the battery
until at least 3.5V is reached. Typically the charging power will
be ~2W in this mode, which will reach the target voltage within 15
minutes or so and the phone will then boot.
If the USB power is not available, just blink the red led quickly
and power off. If USB power is available, indicate progress of charging:
- dead battery: 100ms green LED flash each second
- trickle charging: 200ms green LED flash each second
- cc-cv: duty cycle indicates charging current (5-95% of 2A)
with period of 2s
- various failures while USB power is connected, blink red LED
5 times quickly, wait 1s, and repeat until the failure clears
TODO:
- allow volume key input (raise / lower input current limit)
- power button, skip the algorithm and continue boot at user's
own risk
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Per dw_mmc databook, it's recommended to reset the host controller if
some data-related error occurred.
Implement a reset mechanism.
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Co-developed-by: Jason Zhu <jason.zhu@rock-chips.com>
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
[eugen.hristev@collabora.com: modified a bit the variables initialization]
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Shows a menu of items that can be controlled using touch panel.
This is useful for touch based devices like tablets to select
alternative boot options (multi-boot).
Signed-off-by: Ondrej Jirman <megous@megous.com>
Touchapnel devices are useful in u-boot for implementation of boot
menu user interfaces on tablets and other touch based devices.
This uclass implements start, stop and get_touches interface methods.
Signed-off-by: Ondrej Jirman <megous@megous.com>
This is used for video output using video bridge implementation of
MIPI-DSI, like with the recently added dw_mipi_dsi_rockchip.c
driver.
The original code path when the UCLASS_DISPLAY device is found is
untouched. The video bridge branch is taken only when the
UCLASS_VIDEO_BRIDGE device is found at the remote endpoint's parent.
This was tested to work on Pinephone Pro.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Chris Morgan <macromorgan@hotmail.com>
This just needs some extra clocks enabled, and different registers
configured. Copied from Linux, just like the original submitter
of this driver did for rk3568.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
The driver is for panels based on the Himax HX8394 controller, such as the
HannStar HSD060BHW4 720x1440 TFT LCD panel that uses a MIPI-DSI interface.
This panel is used in Pinephone Pro.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Cc: Anatolij Gustschin <agust@denx.de>
cpll in U-Boot runs at 384 MHz, set various VOP related clocks to produce
roughly 400 and 100 MHz just like in Linux.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Some callers expect to call this with NULL font name to select the
default font (eg. boot/scene.c). Without handling the NULL condition
U-Boot crashes instead of displaying a bootflow GUI menu.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Use proper register base and access method to access GRF registers.
GRF registers start at a completely different base, and need special
access method, that sets the change mask in the 16 MSBs.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
If phy is not defined in DT (eg. on rk3399), generic_phy_get_by_name
will return -ENODATA. Handle that case correctly.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
pllref_clk is unused after being retrieved. fin needs to be set
to dsi->ref clock's rate for the following calculation to work.
Otherwise fin is undefined, and calculation return bogus number
based on undefined variable.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
&priv->phy is always true. Compiler warns about this loudly.
Use a propper check for phy device allocation. Without this fix
using this driver with SoC that doesn't use external phy (eg. RK3399)
doesn't work.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
These must be read from timings->flags, like other DSI HOST drivers do.
And they must not be inverted either. Low means low.
Without this fix, panel drivers that set *SYNC_LOW produce corrupted
output on screen (shifted horizobnntally and vertivally by back porch
distance).
Signed-off-by: Ondrej Jirman <megi@xff.cz>
U-Boot has terrible support for SPL stage regulators setup needed for
sdmmc0 to work on Quartz64-A. We avoid all the regulator setup dance
by using pwren pinmux on sdmmc0 in U-Boot and we achieve the needed
polarity for the enable pin (active low) via a new
CONFIG_MMC_DW_PWREN_POLARITY config property.
Signed-off-by: Ondrej Jirman <megi@xff.cz>