[PATCH v3 3/7] board: rock5b-rk3588: add USB-C controller support

Kever Yang kever.yang at rock-chips.com
Fri Aug 9 11:20:40 CEST 2024


On 2024/8/3 01:59, Sebastian Reichel wrote:
> Enable support for the fusb302 USB Type-C controller.
>
> This will do early USB PD (power deliver) negotiation, which must happen
> within 5 seconds after the USB-C connector has plugged in according to
> the specification. It takes almost 5 seconds to go through the bootchain
> on Rock 5B and jump to the operating system. When the Linux initializes
> the fusb302 usually 20-30 seconds have gone since the device has been
> plugged, which is far too late. The USB PD power source reacts with a
> hard reset, which disables VBUS for some time. This is not a problem for
> a battery driven device, but Rock 5B will loose its power-supply and
> reset. By initializing PD in U-Boot, this can be avoided.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel at collabora.com>
Reviewed-by: Kever Yang <kever.yang at rock-chips.com>

Thanks,
- Kever
> ---
>   board/radxa/rock5b-rk3588/Makefile        |  6 ++++
>   board/radxa/rock5b-rk3588/rock5b-rk3588.c | 35 +++++++++++++++++++++++
>   2 files changed, 41 insertions(+)
>   create mode 100644 board/radxa/rock5b-rk3588/Makefile
>   create mode 100644 board/radxa/rock5b-rk3588/rock5b-rk3588.c
>
> diff --git a/board/radxa/rock5b-rk3588/Makefile b/board/radxa/rock5b-rk3588/Makefile
> new file mode 100644
> index 000000000000..95d813596da4
> --- /dev/null
> +++ b/board/radxa/rock5b-rk3588/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier:     GPL-2.0+
> +#
> +# Copyright (c) 2022 Collabora Ltd.
> +#
> +
> +obj-y += rock5b-rk3588.o
> diff --git a/board/radxa/rock5b-rk3588/rock5b-rk3588.c b/board/radxa/rock5b-rk3588/rock5b-rk3588.c
> new file mode 100644
> index 000000000000..1c17ae93c76c
> --- /dev/null
> +++ b/board/radxa/rock5b-rk3588/rock5b-rk3588.c
> @@ -0,0 +1,35 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (c) 2023-2024 Collabora Ltd.
> + */
> +
> +#include <usb/tcpm.h>
> +
> +#ifdef CONFIG_MISC_INIT_R
> +int misc_init_r(void)
> +{
> +	struct udevice *dev;
> +	int ret;
> +
> +	/*
> +	 * This will do early USB PD (power deliver) negotiation, which must
> +	 * happen within 5 seconds after the USB-C connector has plugged in
> +	 * according to the specification. It takes almost 5 seconds to go
> +	 * through the bootchain on Rock 5B and jump to the operating system.
> +	 * When the Linux initializes the fusb302 usually 20-30 seconds have
> +	 * gone since the device has been plugged, which is far too late.
> +	 *
> +	 * The USB PD power source reacts with a hard reset, which disables
> +	 * VBUS for some time. This is not a problem for a battery driven
> +	 * device, but Rock 5B will loose its power-supply and reset. By
> +	 * initializing PD in U-Boot, this can be avoided.
> +	 */
> +	ret = tcpm_get("usb-typec at 22", &dev);
> +	if (ret) {
> +		printf("Failed to probe Type-C controller\n");
> +		return 0;
> +	}
> +
> +	return 0;
> +}
> +#endif


More information about the U-Boot mailing list