aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2018-11-08 08:45:47 -0500
committerChanwoo Choi <cw00.choi@samsung.com>2018-11-11 19:17:13 -0500
commit5a196c29bb27d606c4bd82f6893462a39766ff7a (patch)
treec467f89cb401fb05177b890196bb92e26b275ba4 /drivers/extcon
parent6865f2ef9d6576508498fe6127d252b22a70ab39 (diff)
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>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-max14577.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 22d2feb1f8bc..32f663436e6e 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -657,6 +657,8 @@ static int max14577_muic_probe(struct platform_device *pdev)
657 struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent); 657 struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent);
658 struct max14577_muic_info *info; 658 struct max14577_muic_info *info;
659 int delay_jiffies; 659 int delay_jiffies;
660 int cable_type;
661 bool attached;
660 int ret; 662 int ret;
661 int i; 663 int i;
662 u8 id; 664 u8 id;
@@ -725,8 +727,17 @@ static int max14577_muic_probe(struct platform_device *pdev)
725 info->path_uart = CTRL1_SW_UART; 727 info->path_uart = CTRL1_SW_UART;
726 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); 728 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
727 729
728 /* Set initial path for UART */ 730 /* Set initial path for UART when JIG is connected to get serial logs */
729 max14577_muic_set_path(info, info->path_uart, true); 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);
730 741
731 /* Check revision number of MUIC device*/ 742 /* Check revision number of MUIC device*/
732 ret = max14577_read_reg(info->max14577->regmap, 743 ret = max14577_read_reg(info->max14577->regmap,