提交 e7cded27 编写于 作者: Q Quentin Schulz 提交者: Kishon Vijay Abraham I

phy: allwinner: phy-sun4i-usb: Add log when probing

When phy-sun4i-usb's probing fails, it does not print the reason in
kernel log, forcing the developer to edit this driver to add info logs.
This commit makes the kernel print the reason of phy-sun4i-usb's probing
failure or a success message.
Signed-off-by: NQuentin Schulz <quentin.schulz@free-electrons.com>
Tested-by: NMylène Josserand <mylene.josserand@free-electrons.com>
Acked-by: NMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: NKishon Vijay Abraham I <kishon@ti.com>
上级 5771a8c0
...@@ -653,19 +653,25 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -653,19 +653,25 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det", data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det",
GPIOD_IN); GPIOD_IN);
if (IS_ERR(data->id_det_gpio)) if (IS_ERR(data->id_det_gpio)) {
dev_err(dev, "Couldn't request ID GPIO\n");
return PTR_ERR(data->id_det_gpio); return PTR_ERR(data->id_det_gpio);
}
data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det", data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det",
GPIOD_IN); GPIOD_IN);
if (IS_ERR(data->vbus_det_gpio)) if (IS_ERR(data->vbus_det_gpio)) {
dev_err(dev, "Couldn't request VBUS detect GPIO\n");
return PTR_ERR(data->vbus_det_gpio); return PTR_ERR(data->vbus_det_gpio);
}
if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { if (of_find_property(np, "usb0_vbus_power-supply", NULL)) {
data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, data->vbus_power_supply = devm_power_supply_get_by_phandle(dev,
"usb0_vbus_power-supply"); "usb0_vbus_power-supply");
if (IS_ERR(data->vbus_power_supply)) if (IS_ERR(data->vbus_power_supply)) {
dev_err(dev, "Couldn't get the VBUS power supply\n");
return PTR_ERR(data->vbus_power_supply); return PTR_ERR(data->vbus_power_supply);
}
if (!data->vbus_power_supply) if (!data->vbus_power_supply)
return -EPROBE_DEFER; return -EPROBE_DEFER;
...@@ -674,8 +680,10 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -674,8 +680,10 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
data->dr_mode = of_usb_get_dr_mode_by_phy(np, 0); data->dr_mode = of_usb_get_dr_mode_by_phy(np, 0);
data->extcon = devm_extcon_dev_allocate(dev, sun4i_usb_phy0_cable); data->extcon = devm_extcon_dev_allocate(dev, sun4i_usb_phy0_cable);
if (IS_ERR(data->extcon)) if (IS_ERR(data->extcon)) {
dev_err(dev, "Couldn't allocate our extcon device\n");
return PTR_ERR(data->extcon); return PTR_ERR(data->extcon);
}
ret = devm_extcon_dev_register(dev, data->extcon); ret = devm_extcon_dev_register(dev, data->extcon);
if (ret) { if (ret) {
...@@ -690,8 +698,13 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -690,8 +698,13 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
snprintf(name, sizeof(name), "usb%d_vbus", i); snprintf(name, sizeof(name), "usb%d_vbus", i);
phy->vbus = devm_regulator_get_optional(dev, name); phy->vbus = devm_regulator_get_optional(dev, name);
if (IS_ERR(phy->vbus)) { if (IS_ERR(phy->vbus)) {
if (PTR_ERR(phy->vbus) == -EPROBE_DEFER) if (PTR_ERR(phy->vbus) == -EPROBE_DEFER) {
dev_err(dev,
"Couldn't get regulator %s... Deferring probe\n",
name);
return -EPROBE_DEFER; return -EPROBE_DEFER;
}
phy->vbus = NULL; phy->vbus = NULL;
} }
...@@ -775,6 +788,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -775,6 +788,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
return PTR_ERR(phy_provider); return PTR_ERR(phy_provider);
} }
dev_dbg(dev, "successfully loaded\n");
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册