From dc7bf7e3f9913ada738af40ac9695700622e85e7 Mon Sep 17 00:00:00 2001 From: Kapil Porwal Date: Fri, 13 Mar 2026 23:31:20 +0530 Subject: [PATCH] mb/google/bluey: Enable source mode on debug access port The current implementation only supports sink mode on the debug access port, which is used for charging. To enhance debugging capabilities, expand the support to include source mode. Refactor the Kconfig option to HAVE_DEBUG_ACCESS_PORT_SOURCE_SINK and update the initialization logic to configure both SRC and SNK modes via the PMIC's SCHG_TYPE_C_DEBUG_ACCESS registers. This allows the debug port to serve as a power source or sink as required by the attached debug hardware. BUG=none TEST=Verify debug port modes on Google/Quartz. Change-Id: I3ec45d9cdc0ec6e723d10792f4e347462cecd2ed Signed-off-by: Kapil Porwal Reviewed-on: https://review.coreboot.org/c/coreboot/+/91670 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Jayvik Desai --- src/mainboard/google/bluey/Kconfig | 6 +++--- src/mainboard/google/bluey/board.h | 2 +- src/mainboard/google/bluey/charging.c | 13 +++++++++---- src/mainboard/google/bluey/mainboard.c | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/mainboard/google/bluey/Kconfig b/src/mainboard/google/bluey/Kconfig index 727e1e8f7a..ddb033d939 100644 --- a/src/mainboard/google/bluey/Kconfig +++ b/src/mainboard/google/bluey/Kconfig @@ -58,7 +58,7 @@ config BOARD_GOOGLE_QUENBIH config BOARD_GOOGLE_QUARTZ select BOARD_GOOGLE_MODEL_QUARTZ - select HAVE_CHARGING_DEBUG_ACCESS_PORT + select HAVE_DEBUG_ACCESS_PORT_SOURCE_SINK select SOC_QUALCOMM_HAMOA select MAINBOARD_HAS_PS8820_RETIMER select MAINBOARD_NO_USB_A_PORT @@ -131,11 +131,11 @@ config MAINBOARD_SUPPORTS_PARALLEL_CHARGING help Enable this option if your mainboard supports parallel charging. -config HAVE_CHARGING_DEBUG_ACCESS_PORT +config HAVE_DEBUG_ACCESS_PORT_SOURCE_SINK bool default n help - Enable this option to allow charging on the debug access port. + Enable this option to allow source and sink modes on the debug access port. config MAINBOARD_HAS_GOOGLE_TPM bool diff --git a/src/mainboard/google/bluey/board.h b/src/mainboard/google/bluey/board.h index 361aa6587c..04ef0ca3c1 100644 --- a/src/mainboard/google/bluey/board.h +++ b/src/mainboard/google/bluey/board.h @@ -61,7 +61,7 @@ void setup_chromeos_gpios(void); bool is_off_mode(void); void configure_parallel_charging(void); void configure_parallel_charging_late(void); -void configure_charging_debug_access(void); +void configure_debug_access_port(void); void enable_slow_battery_charging(void); void disable_slow_battery_charging(void); void launch_charger_applet(void); diff --git a/src/mainboard/google/bluey/charging.c b/src/mainboard/google/bluey/charging.c index c99bf020a1..2e0fcb2baf 100644 --- a/src/mainboard/google/bluey/charging.c +++ b/src/mainboard/google/bluey/charging.c @@ -21,6 +21,9 @@ #define SMB2_CHGR_CHRG_EN_CMD ((SMB2_SLAVE_ID << 16) | SCHG_CHGR_CHARGING_ENABLE_CMD) #define SMB1_SCHG_TYPE_C_TYPE_C_DEBUG_ACCESS_SNK_CFG \ ((SMB1_SLAVE_ID << 16) | SCHG_TYPE_C_TYPE_C_DEBUG_ACCESS_SNK_CFG) +#define SCHG_TYPE_C_TYPE_C_DEBUG_ACCESS_SRC_CFG 0x2B4C +#define SMB1_SCHG_TYPE_C_TYPE_C_DEBUG_ACCESS_SRC_CFG \ +((SMB1_SLAVE_ID << 16) | SCHG_TYPE_C_TYPE_C_DEBUG_ACCESS_SRC_CFG) #define SCHG_CHGR_CHARGING_FCC 0x260A #define SMB1_CHGR_CHARGING_FCC ((SMB1_SLAVE_ID << 16) | SCHG_CHGR_CHARGING_FCC) #define SMB2_CHGR_CHARGING_FCC ((SMB2_SLAVE_ID << 16) | SCHG_CHGR_CHARGING_FCC) @@ -28,6 +31,7 @@ #define FCC_1A_STEP_50MA 0x14 #define FCC_DISABLE 0x8c #define EN_DEBUG_ACCESS_SNK 0x1B +#define EN_DEBUG_ACCESS_SRC 0x01 #define PMC8380F_SLAVE_ID 0x05 #define GPIO07_MODE_CTL 0x8E40 @@ -205,14 +209,15 @@ void configure_parallel_charging(void) } /* - * Enable SMB1 charging debug access port. + * Configure debug access port to support source and sink modes. */ -void configure_charging_debug_access(void) +void configure_debug_access_port(void) { - if (!CONFIG(HAVE_CHARGING_DEBUG_ACCESS_PORT)) + if (!CONFIG(HAVE_DEBUG_ACCESS_PORT_SOURCE_SINK)) return; - printk(BIOS_INFO, "Enable charging debug access port support\n"); + printk(BIOS_INFO, "Enable support of source and sink modes for debug access port\n"); + spmi_write8(SMB1_SCHG_TYPE_C_TYPE_C_DEBUG_ACCESS_SRC_CFG, EN_DEBUG_ACCESS_SRC); spmi_write8(SMB1_SCHG_TYPE_C_TYPE_C_DEBUG_ACCESS_SNK_CFG, EN_DEBUG_ACCESS_SNK); } diff --git a/src/mainboard/google/bluey/mainboard.c b/src/mainboard/google/bluey/mainboard.c index 93a3681d5d..891967f3e3 100644 --- a/src/mainboard/google/bluey/mainboard.c +++ b/src/mainboard/google/bluey/mainboard.c @@ -204,7 +204,7 @@ static void handle_low_power_charging_boot(void) static void mainboard_init(struct device *dev) { configure_parallel_charging(); - configure_charging_debug_access(); + configure_debug_access_port(); display_startup();