- Handle errors in Meson serial driver

- Enable HDMI, keyboard and ADC for Odroid-C2
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPVPGJshWBf4d9CyLd9zb2sjISdEFAl8e5tQACgkQd9zb2sjI
 SdEzhhAAi3y5bY1Dswyju5WsVSlewP49ev72BsUf01KdB/CcMNH7/8gGcJA0n9JB
 oqTOXKQEFJmmil5+jjcrlTze7F1oylRvZXoI3Pz2fgs80hyXRJGYghAGswDi0z7S
 z5lT36nRJP3KvVS3PJ00TmPXAbWBqR9CDyhlN8wNtJV6+dzleifglwtC4wYcP8yo
 7lrBd8vuEysJHcG5ynotNmf9IdiSyfS0YasnRS2rEsaD0zAJzc9aHl/TQnGZ+yPt
 chXJ1XZagexSbMEF1GNO9t4ic62KzlppfRNOxZmRDXxyrGzn2Hv+rQqv5h+41AyC
 X0DaBUvu80lgvtc81CTjlYq9fRNg1UAUknWJNBoPUkjuoWIBygE1k6D2vzIRfBJu
 haEJoYS3kpvGAn0Ebi+TK/u/aIAdcZVJJ+RZCs6CcwXsqOG35WBicxOMYJfn/PhX
 Tnmp56GKyZFYy1UsgJIm/ZyLLc0p8XHNgeEWzoxjzAF9nuBn4+D1jAxivsPE+gCb
 ICvu9GN+0TaM/+wg112QEXvv87RU/0KNLHiEAHL9kxr6pnqAR9I9HCqXgReW3JhV
 SncedVrjPKrMt9kITAO7JKR7ySXeVLhdMg8GyTM3tC2vtFlOkJo/SZGEDdHZAlL6
 pw9w28ZjnNIaRmJrfAP/8gNw5GHI0q0M3BjeivwzWOuUiaRlXc4=
 =AMiA
 -----END PGP SIGNATURE-----

Merge tag 'u-boot-amlogic-20200727' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic

- Handle errors in Meson serial driver
- Enable HDMI, keyboard and ADC for Odroid-C2
This commit is contained in:
Tom Rini 2020-07-27 21:40:26 -04:00
commit 6b7937821d
2 changed files with 50 additions and 4 deletions

View File

@ -15,6 +15,7 @@ CONFIG_MISC_INIT_R=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_CMD_BDI is not set
# CONFIG_CMD_IMI is not set
CONFIG_CMD_ADC=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
# CONFIG_CMD_LOADS is not set
@ -26,6 +27,7 @@ CONFIG_OF_CONTROL=y
CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2"
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SARADC_MESON=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_MESON=y
CONFIG_DM_MMC=y
@ -38,6 +40,8 @@ CONFIG_MESON_GXBB_USB_PHY=y
CONFIG_PINCTRL=y
CONFIG_PINCTRL_MESON_GXBB=y
CONFIG_DM_REGULATOR=y
CONFIG_POWER_DOMAIN=y
CONFIG_MESON_GX_VPU_POWER_DOMAIN=y
CONFIG_DM_REGULATOR_FIXED=y
CONFIG_DM_REGULATOR_GPIO=y
CONFIG_DM_RESET=y
@ -47,5 +51,12 @@ CONFIG_MESON_SERIAL=y
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_USB_DWC2=y
CONFIG_USB_KEYBOARD=y
CONFIG_DM_VIDEO=y
# CONFIG_VIDEO_BPP8 is not set
# CONFIG_VIDEO_BPP16 is not set
CONFIG_SYS_WHITE_ON_BLACK=y
CONFIG_VIDEO_MESON=y
CONFIG_VIDEO_DT_SIMPLEFB=y
CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_SMBIOS_MANUFACTURER="Hardkernel Co., Ltd."

View File

@ -65,14 +65,36 @@ static int meson_serial_probe(struct udevice *dev)
return 0;
}
static void meson_serial_rx_error(struct udevice *dev)
{
struct meson_serial_platdata *plat = dev->platdata;
struct meson_uart *const uart = plat->reg;
u32 val = readl(&uart->control);
/* Clear error */
val |= AML_UART_CLR_ERR;
writel(val, &uart->control);
val &= ~AML_UART_CLR_ERR;
writel(val, &uart->control);
/* Remove spurious byte from fifo */
readl(&uart->rfifo);
}
static int meson_serial_getc(struct udevice *dev)
{
struct meson_serial_platdata *plat = dev->platdata;
struct meson_uart *const uart = plat->reg;
uint32_t status = readl(&uart->status);
if (readl(&uart->status) & AML_UART_RX_EMPTY)
if (status & AML_UART_RX_EMPTY)
return -EAGAIN;
if (status & AML_UART_ERR) {
meson_serial_rx_error(dev);
return -EIO;
}
return readl(&uart->rfifo) & 0xff;
}
@ -95,10 +117,23 @@ static int meson_serial_pending(struct udevice *dev, bool input)
struct meson_uart *const uart = plat->reg;
uint32_t status = readl(&uart->status);
if (input)
return !(status & AML_UART_RX_EMPTY);
else
if (input) {
if (status & AML_UART_RX_EMPTY)
return false;
/*
* Handle and drop any RX error here to avoid
* returning true here when an error byte is in the FIFO
*/
if (status & AML_UART_ERR) {
meson_serial_rx_error(dev);
return false;
}
return true;
} else {
return !(status & AML_UART_TX_FULL);
}
}
static int meson_serial_ofdata_to_platdata(struct udevice *dev)