Skip to content

Commit 5a196c2

Browse files
mszyprowchanwoochoi
authored andcommitted
extcon: max14577: Avoid forcing UART path on drive probe
Driver unconditionally forces UART path during probe, probably to ensure that one can get kernel serial log as soon as possible. This approach causes some issues, especially when board is booted with non-UART cable connected to micro-USB port. For example, when USB cable is connected, UART TX/RX lines are unconditionally short-circuited to USB D+/D- lines. This is in turn recognized by a series of serial BREAK signals and some random characters when USB host tries to perform enumeration procedure. To solve the above issue and keep UART console operational as early as possible, set UART path only when USB ID reports UART capable cable. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
1 parent 6865f2e commit 5a196c2

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎drivers/extcon/extcon-max14577.c‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,8 @@ static int max14577_muic_probe(struct platform_device *pdev)
657657
struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent);
658658
struct max14577_muic_info *info;
659659
int delay_jiffies;
660+
int cable_type;
661+
bool attached;
660662
int ret;
661663
int i;
662664
u8 id;
@@ -725,8 +727,17 @@ static int max14577_muic_probe(struct platform_device *pdev)
725727
info->path_uart = CTRL1_SW_UART;
726728
delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
727729

728-
/* Set initial path for UART */
729-
max14577_muic_set_path(info, info->path_uart, true);
730+
/* Set initial path for UART when JIG is connected to get serial logs */
731+
ret = max14577_bulk_read(info->max14577->regmap,
732+
MAX14577_MUIC_REG_STATUS1, info->status, 2);
733+
if (ret) {
734+
dev_err(info->dev, "Cannot read STATUS registers\n");
735+
return ret;
736+
}
737+
cable_type = max14577_muic_get_cable_type(info, MAX14577_CABLE_GROUP_ADC,
738+
&attached);
739+
if (attached && cable_type == MAX14577_MUIC_ADC_FACTORY_MODE_UART_OFF)
740+
max14577_muic_set_path(info, info->path_uart, true);
730741

731742
/* Check revision number of MUIC device*/
732743
ret = max14577_read_reg(info->max14577->regmap,

0 commit comments

Comments
 (0)