Skip to content

Commit e22a220

Browse files
committed
Merge tag 'phy-fixes-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy into char-misc-linus
Vinod writes: phy: fixes for 5.9 *) platform_no_drv_owner.cocci and return value check qcom ipq806x-usb driver *) correcting register programming for ipq8074 phy *) disable PHY charger detect for omap-usb2-phy * tag 'phy-fixes-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: phy: omap-usb2-phy: disable PHY charger detect phy: qcom-qmp: Use correct values for ipq8074 PCIe Gen2 PHY init phy: qualcomm: fix return value check in qcom_ipq806x_usb_phy_probe() phy: qualcomm: fix platform_no_drv_owner.cocci warnings
2 parents 51fc07d + ad7a7ac commit e22a220

File tree

4 files changed

+53
-17
lines changed

4 files changed

+53
-17
lines changed

drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,9 @@ static int qcom_ipq806x_usb_phy_probe(struct platform_device *pdev)
505505
size = resource_size(res);
506506
phy_dwc3->base = devm_ioremap(phy_dwc3->dev, res->start, size);
507507

508-
if (IS_ERR(phy_dwc3->base)) {
508+
if (!phy_dwc3->base) {
509509
dev_err(phy_dwc3->dev, "failed to map reg\n");
510-
return PTR_ERR(phy_dwc3->base);
510+
return -ENOMEM;
511511
}
512512

513513
phy_dwc3->ref_clk = devm_clk_get(phy_dwc3->dev, "ref");
@@ -557,7 +557,6 @@ static struct platform_driver qcom_ipq806x_usb_phy_driver = {
557557
.probe = qcom_ipq806x_usb_phy_probe,
558558
.driver = {
559559
.name = "qcom-ipq806x-usb-phy",
560-
.owner = THIS_MODULE,
561560
.of_match_table = qcom_ipq806x_usb_phy_table,
562561
},
563562
};

drivers/phy/qualcomm/phy-qcom-qmp.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
604604
QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf),
605605
QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1),
606606
QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0),
607-
QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0x1f),
608-
QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x3f),
607+
QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff),
608+
QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f),
609609
QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6),
610610
QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf),
611611
QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0),
@@ -631,7 +631,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
631631
QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0),
632632
QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80),
633633
QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1),
634-
QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_CTRL, 0xa),
635634
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1),
636635
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31),
637636
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1),
@@ -640,14 +639,15 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
640639
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f),
641640
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19),
642641
QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19),
643-
QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_CNTRL, 0x7),
644642
};
645643

646644
static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = {
647645
QMP_PHY_INIT_CFG(QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN, 0x45),
648646
QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6),
649647
QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2),
650648
QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12),
649+
QMP_PHY_INIT_CFG(QSERDES_TX_EMP_POST1_LVL, 0x36),
650+
QMP_PHY_INIT_CFG(QSERDES_TX_SLEW_CNTL, 0x0a),
651651
};
652652

653653
static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = {
@@ -658,7 +658,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = {
658658
QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb),
659659
QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b),
660660
QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4),
661-
QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN_HALF, 0x4),
662661
};
663662

664663
static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = {
@@ -2046,6 +2045,9 @@ static const struct qmp_phy_cfg msm8996_usb3phy_cfg = {
20462045
.pwrdn_ctrl = SW_PWRDN,
20472046
};
20482047

2048+
static const char * const ipq8074_pciephy_clk_l[] = {
2049+
"aux", "cfg_ahb",
2050+
};
20492051
/* list of resets */
20502052
static const char * const ipq8074_pciephy_reset_l[] = {
20512053
"phy", "common",
@@ -2063,8 +2065,8 @@ static const struct qmp_phy_cfg ipq8074_pciephy_cfg = {
20632065
.rx_tbl_num = ARRAY_SIZE(ipq8074_pcie_rx_tbl),
20642066
.pcs_tbl = ipq8074_pcie_pcs_tbl,
20652067
.pcs_tbl_num = ARRAY_SIZE(ipq8074_pcie_pcs_tbl),
2066-
.clk_list = NULL,
2067-
.num_clks = 0,
2068+
.clk_list = ipq8074_pciephy_clk_l,
2069+
.num_clks = ARRAY_SIZE(ipq8074_pciephy_clk_l),
20682070
.reset_list = ipq8074_pciephy_reset_l,
20692071
.num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l),
20702072
.vreg_list = NULL,

drivers/phy/qualcomm/phy-qcom-qmp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
#define QSERDES_COM_CORECLK_DIV_MODE1 0x1bc
7878

7979
/* Only for QMP V2 PHY - TX registers */
80+
#define QSERDES_TX_EMP_POST1_LVL 0x018
81+
#define QSERDES_TX_SLEW_CNTL 0x040
8082
#define QSERDES_TX_RES_CODE_LANE_OFFSET 0x054
8183
#define QSERDES_TX_DEBUG_BUS_SEL 0x064
8284
#define QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN 0x068

drivers/phy/ti/phy-omap-usb2.c

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222
#include <linux/mfd/syscon.h>
2323
#include <linux/regmap.h>
2424
#include <linux/of_platform.h>
25+
#include <linux/sys_soc.h>
2526

2627
#define USB2PHY_ANA_CONFIG1 0x4c
2728
#define USB2PHY_DISCON_BYP_LATCH BIT(31)
2829

30+
#define USB2PHY_CHRG_DET 0x14
31+
#define USB2PHY_CHRG_DET_USE_CHG_DET_REG BIT(29)
32+
#define USB2PHY_CHRG_DET_DIS_CHG_DET BIT(28)
33+
2934
/* SoC Specific USB2_OTG register definitions */
3035
#define AM654_USB2_OTG_PD BIT(8)
3136
#define AM654_USB2_VBUS_DET_EN BIT(5)
@@ -43,6 +48,7 @@
4348
#define OMAP_USB2_HAS_START_SRP BIT(0)
4449
#define OMAP_USB2_HAS_SET_VBUS BIT(1)
4550
#define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(2)
51+
#define OMAP_USB2_DISABLE_CHRG_DET BIT(3)
4652

4753
struct omap_usb {
4854
struct usb_phy phy;
@@ -236,6 +242,13 @@ static int omap_usb_init(struct phy *x)
236242
omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val);
237243
}
238244

245+
if (phy->flags & OMAP_USB2_DISABLE_CHRG_DET) {
246+
val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET);
247+
val |= USB2PHY_CHRG_DET_USE_CHG_DET_REG |
248+
USB2PHY_CHRG_DET_DIS_CHG_DET;
249+
omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val);
250+
}
251+
239252
return 0;
240253
}
241254

@@ -329,6 +342,26 @@ static const struct of_device_id omap_usb2_id_table[] = {
329342
};
330343
MODULE_DEVICE_TABLE(of, omap_usb2_id_table);
331344

345+
static void omap_usb2_init_errata(struct omap_usb *phy)
346+
{
347+
static const struct soc_device_attribute am65x_sr10_soc_devices[] = {
348+
{ .family = "AM65X", .revision = "SR1.0" },
349+
{ /* sentinel */ }
350+
};
351+
352+
/*
353+
* Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by
354+
* Default Without VBUS Presence.
355+
*
356+
* AM654x SR1.0 has a silicon bug due to which D+ is pulled high after
357+
* POR, which could cause enumeration failure with some USB hubs.
358+
* Disabling the USB2_PHY Charger Detect function will put D+
359+
* into the normal state.
360+
*/
361+
if (soc_device_match(am65x_sr10_soc_devices))
362+
phy->flags |= OMAP_USB2_DISABLE_CHRG_DET;
363+
}
364+
332365
static int omap_usb2_probe(struct platform_device *pdev)
333366
{
334367
struct omap_usb *phy;
@@ -366,14 +399,14 @@ static int omap_usb2_probe(struct platform_device *pdev)
366399
phy->mask = phy_data->mask;
367400
phy->power_on = phy_data->power_on;
368401
phy->power_off = phy_data->power_off;
402+
phy->flags = phy_data->flags;
369403

370-
if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {
371-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
372-
phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
373-
if (IS_ERR(phy->phy_base))
374-
return PTR_ERR(phy->phy_base);
375-
phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
376-
}
404+
omap_usb2_init_errata(phy);
405+
406+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
407+
phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
408+
if (IS_ERR(phy->phy_base))
409+
return PTR_ERR(phy->phy_base);
377410

378411
phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
379412
"syscon-phy-power");

0 commit comments

Comments
 (0)