Commit 5302a84e authored by David S. Miller's avatar David S. Miller

Merge tag 'linux-can-fixes-for-4.18-20180723' of...

Merge tag 'linux-can-fixes-for-4.18-20180723' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2018-07-23

this is a pull request of 12 patches for net/master.

The patch by Stephane Grosjean for the peak_canfd CAN driver fixes a problem
with older firmware. The next patch is by Roman Fietze and fixes the setup of
the CCCR register in the m_can driver. Nicholas Mc Guire's patch for the
mpc5xxx_can driver adds missing error checking. The two patches by Faiz Abbas
fix the runtime resume and clean up the probe function in the m_can driver. The
last 7 patches by Anssi Hannula fix several problem in the xilinx_can driver.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c9ce1fa1 8ebd83bd
...@@ -634,10 +634,12 @@ static int m_can_clk_start(struct m_can_priv *priv) ...@@ -634,10 +634,12 @@ static int m_can_clk_start(struct m_can_priv *priv)
int err; int err;
err = pm_runtime_get_sync(priv->device); err = pm_runtime_get_sync(priv->device);
if (err) if (err < 0) {
pm_runtime_put_noidle(priv->device); pm_runtime_put_noidle(priv->device);
return err;
}
return err; return 0;
} }
static void m_can_clk_stop(struct m_can_priv *priv) static void m_can_clk_stop(struct m_can_priv *priv)
...@@ -1109,7 +1111,8 @@ static void m_can_chip_config(struct net_device *dev) ...@@ -1109,7 +1111,8 @@ static void m_can_chip_config(struct net_device *dev)
} else { } else {
/* Version 3.1.x or 3.2.x */ /* Version 3.1.x or 3.2.x */
cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE); cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE |
CCCR_NISO);
/* Only 3.2.x has NISO Bit implemented */ /* Only 3.2.x has NISO Bit implemented */
if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO) if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)
...@@ -1642,8 +1645,6 @@ static int m_can_plat_probe(struct platform_device *pdev) ...@@ -1642,8 +1645,6 @@ static int m_can_plat_probe(struct platform_device *pdev)
priv->can.clock.freq = clk_get_rate(cclk); priv->can.clock.freq = clk_get_rate(cclk);
priv->mram_base = mram_addr; priv->mram_base = mram_addr;
m_can_of_parse_mram(priv, mram_config_vals);
platform_set_drvdata(pdev, dev); platform_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
...@@ -1666,6 +1667,8 @@ static int m_can_plat_probe(struct platform_device *pdev) ...@@ -1666,6 +1667,8 @@ static int m_can_plat_probe(struct platform_device *pdev)
goto clk_disable; goto clk_disable;
} }
m_can_of_parse_mram(priv, mram_config_vals);
devm_can_led_init(dev); devm_can_led_init(dev);
of_can_transceiver(dev); of_can_transceiver(dev);
...@@ -1687,8 +1690,6 @@ static int m_can_plat_probe(struct platform_device *pdev) ...@@ -1687,8 +1690,6 @@ static int m_can_plat_probe(struct platform_device *pdev)
return ret; return ret;
} }
/* TODO: runtime PM with power down or sleep mode */
static __maybe_unused int m_can_suspend(struct device *dev) static __maybe_unused int m_can_suspend(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
...@@ -1715,8 +1716,6 @@ static __maybe_unused int m_can_resume(struct device *dev) ...@@ -1715,8 +1716,6 @@ static __maybe_unused int m_can_resume(struct device *dev)
pinctrl_pm_select_default_state(dev); pinctrl_pm_select_default_state(dev);
m_can_init_ram(priv);
priv->can.state = CAN_STATE_ERROR_ACTIVE; priv->can.state = CAN_STATE_ERROR_ACTIVE;
if (netif_running(ndev)) { if (netif_running(ndev)) {
...@@ -1726,6 +1725,7 @@ static __maybe_unused int m_can_resume(struct device *dev) ...@@ -1726,6 +1725,7 @@ static __maybe_unused int m_can_resume(struct device *dev)
if (ret) if (ret)
return ret; return ret;
m_can_init_ram(priv);
m_can_start(ndev); m_can_start(ndev);
netif_device_attach(ndev); netif_device_attach(ndev);
netif_start_queue(ndev); netif_start_queue(ndev);
......
...@@ -86,6 +86,11 @@ static u32 mpc52xx_can_get_clock(struct platform_device *ofdev, ...@@ -86,6 +86,11 @@ static u32 mpc52xx_can_get_clock(struct platform_device *ofdev,
return 0; return 0;
} }
cdm = of_iomap(np_cdm, 0); cdm = of_iomap(np_cdm, 0);
if (!cdm) {
of_node_put(np_cdm);
dev_err(&ofdev->dev, "can't map clock node!\n");
return 0;
}
if (in_8(&cdm->ipb_clk_sel) & 0x1) if (in_8(&cdm->ipb_clk_sel) & 0x1)
freq *= 2; freq *= 2;
......
...@@ -58,6 +58,10 @@ MODULE_LICENSE("GPL v2"); ...@@ -58,6 +58,10 @@ MODULE_LICENSE("GPL v2");
#define PCIEFD_REG_SYS_VER1 0x0040 /* version reg #1 */ #define PCIEFD_REG_SYS_VER1 0x0040 /* version reg #1 */
#define PCIEFD_REG_SYS_VER2 0x0044 /* version reg #2 */ #define PCIEFD_REG_SYS_VER2 0x0044 /* version reg #2 */
#define PCIEFD_FW_VERSION(x, y, z) (((u32)(x) << 24) | \
((u32)(y) << 16) | \
((u32)(z) << 8))
/* System Control Registers Bits */ /* System Control Registers Bits */
#define PCIEFD_SYS_CTL_TS_RST 0x00000001 /* timestamp clock */ #define PCIEFD_SYS_CTL_TS_RST 0x00000001 /* timestamp clock */
#define PCIEFD_SYS_CTL_CLK_EN 0x00000002 /* system clock */ #define PCIEFD_SYS_CTL_CLK_EN 0x00000002 /* system clock */
...@@ -782,6 +786,21 @@ static int peak_pciefd_probe(struct pci_dev *pdev, ...@@ -782,6 +786,21 @@ static int peak_pciefd_probe(struct pci_dev *pdev,
"%ux CAN-FD PCAN-PCIe FPGA v%u.%u.%u:\n", can_count, "%ux CAN-FD PCAN-PCIe FPGA v%u.%u.%u:\n", can_count,
hw_ver_major, hw_ver_minor, hw_ver_sub); hw_ver_major, hw_ver_minor, hw_ver_sub);
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
/* FW < v3.3.0 DMA logic doesn't handle correctly the mix of 32-bit and
* 64-bit logical addresses: this workaround forces usage of 32-bit
* DMA addresses only when such a fw is detected.
*/
if (PCIEFD_FW_VERSION(hw_ver_major, hw_ver_minor, hw_ver_sub) <
PCIEFD_FW_VERSION(3, 3, 0)) {
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err)
dev_warn(&pdev->dev,
"warning: can't set DMA mask %llxh (err %d)\n",
DMA_BIT_MASK(32), err);
}
#endif
/* stop system clock */ /* stop system clock */
pciefd_sys_writereg(pciefd, PCIEFD_SYS_CTL_CLK_EN, pciefd_sys_writereg(pciefd, PCIEFD_SYS_CTL_CLK_EN,
PCIEFD_REG_SYS_CTL_CLR); PCIEFD_REG_SYS_CTL_CLR);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment