summaryrefslogtreecommitdiffstats
path: root/drivers/net/wan
diff options
context:
space:
mode:
authorHolger Brunck <holger.brunck@keymile.com>2017-05-17 17:24:36 +0200
committerDavid S. Miller <davem@davemloft.net>2017-05-18 16:28:38 +0200
commit54e9e0874938ba5b112b9352e280b4962590a57d (patch)
treedf9184caa74d75439290e69e1778f56f3ff2e7de /drivers/net/wan
parentnet/wan/fsl_ucc_hdlc: fix incorrect memory allocation (diff)
downloadlinux-54e9e0874938ba5b112b9352e280b4962590a57d.tar.xz
linux-54e9e0874938ba5b112b9352e280b4962590a57d.zip
net/wan/fsl_ucc_hdlc: call qe_setbrg only for loopback mode
We can't assume that we are always in loopback mode if rx and tx clock have the same clock source. If we want to use HDLC busmode we also have the same clock source but we are not in loopback mode. So move the setting of the baudrate generator after the check for property for the loopback mode. Signed-off-by: Holger Brunck <holger.brunck@keymile.com> Cc: Zhao Qiang <qiang.zhao@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r--drivers/net/wan/fsl_ucc_hdlc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
index 49b91b2c113c..4c93d561b18a 100644
--- a/drivers/net/wan/fsl_ucc_hdlc.c
+++ b/drivers/net/wan/fsl_ucc_hdlc.c
@@ -113,6 +113,9 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
/* Loopback mode */
if (priv->loopback) {
dev_info(priv->dev, "Loopback Mode\n");
+ /* use the same clock when work in loopback */
+ qe_setbrg(ut_info->uf_info.rx_clock, 20000000, 1);
+
gumr = ioread32be(&priv->uf_regs->gumr);
gumr |= (UCC_FAST_GUMR_LOOPBACK | UCC_FAST_GUMR_CDS |
UCC_FAST_GUMR_TCI);
@@ -1021,10 +1024,6 @@ static int ucc_hdlc_probe(struct platform_device *pdev)
return -EINVAL;
}
- /* use the same clock when work in loopback */
- if (ut_info->uf_info.rx_clock == ut_info->uf_info.tx_clock)
- qe_setbrg(ut_info->uf_info.rx_clock, 20000000, 1);
-
ret = of_address_to_resource(np, 0, &res);
if (ret)
return -EINVAL;