Skip to content

Commit 5302a84

Browse files
committed
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: David S. Miller <[email protected]>
2 parents c9ce1fa + 8ebd83b commit 5302a84

File tree

4 files changed

+321
-113
lines changed

4 files changed

+321
-113
lines changed

drivers/net/can/m_can/m_can.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,12 @@ static int m_can_clk_start(struct m_can_priv *priv)
634634
int err;
635635

636636
err = pm_runtime_get_sync(priv->device);
637-
if (err)
637+
if (err < 0) {
638638
pm_runtime_put_noidle(priv->device);
639+
return err;
640+
}
639641

640-
return err;
642+
return 0;
641643
}
642644

643645
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)
11091111

11101112
} else {
11111113
/* Version 3.1.x or 3.2.x */
1112-
cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE);
1114+
cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE |
1115+
CCCR_NISO);
11131116

11141117
/* Only 3.2.x has NISO Bit implemented */
11151118
if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)
@@ -1642,8 +1645,6 @@ static int m_can_plat_probe(struct platform_device *pdev)
16421645
priv->can.clock.freq = clk_get_rate(cclk);
16431646
priv->mram_base = mram_addr;
16441647

1645-
m_can_of_parse_mram(priv, mram_config_vals);
1646-
16471648
platform_set_drvdata(pdev, dev);
16481649
SET_NETDEV_DEV(dev, &pdev->dev);
16491650

@@ -1666,6 +1667,8 @@ static int m_can_plat_probe(struct platform_device *pdev)
16661667
goto clk_disable;
16671668
}
16681669

1670+
m_can_of_parse_mram(priv, mram_config_vals);
1671+
16691672
devm_can_led_init(dev);
16701673

16711674
of_can_transceiver(dev);
@@ -1687,8 +1690,6 @@ static int m_can_plat_probe(struct platform_device *pdev)
16871690
return ret;
16881691
}
16891692

1690-
/* TODO: runtime PM with power down or sleep mode */
1691-
16921693
static __maybe_unused int m_can_suspend(struct device *dev)
16931694
{
16941695
struct net_device *ndev = dev_get_drvdata(dev);
@@ -1715,8 +1716,6 @@ static __maybe_unused int m_can_resume(struct device *dev)
17151716

17161717
pinctrl_pm_select_default_state(dev);
17171718

1718-
m_can_init_ram(priv);
1719-
17201719
priv->can.state = CAN_STATE_ERROR_ACTIVE;
17211720

17221721
if (netif_running(ndev)) {
@@ -1726,6 +1725,7 @@ static __maybe_unused int m_can_resume(struct device *dev)
17261725
if (ret)
17271726
return ret;
17281727

1728+
m_can_init_ram(priv);
17291729
m_can_start(ndev);
17301730
netif_device_attach(ndev);
17311731
netif_start_queue(ndev);

drivers/net/can/mscan/mpc5xxx_can.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ static u32 mpc52xx_can_get_clock(struct platform_device *ofdev,
8686
return 0;
8787
}
8888
cdm = of_iomap(np_cdm, 0);
89+
if (!cdm) {
90+
of_node_put(np_cdm);
91+
dev_err(&ofdev->dev, "can't map clock node!\n");
92+
return 0;
93+
}
8994

9095
if (in_8(&cdm->ipb_clk_sel) & 0x1)
9196
freq *= 2;

drivers/net/can/peak_canfd/peak_pciefd_main.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ MODULE_LICENSE("GPL v2");
5858
#define PCIEFD_REG_SYS_VER1 0x0040 /* version reg #1 */
5959
#define PCIEFD_REG_SYS_VER2 0x0044 /* version reg #2 */
6060

61+
#define PCIEFD_FW_VERSION(x, y, z) (((u32)(x) << 24) | \
62+
((u32)(y) << 16) | \
63+
((u32)(z) << 8))
64+
6165
/* System Control Registers Bits */
6266
#define PCIEFD_SYS_CTL_TS_RST 0x00000001 /* timestamp clock */
6367
#define PCIEFD_SYS_CTL_CLK_EN 0x00000002 /* system clock */
@@ -782,6 +786,21 @@ static int peak_pciefd_probe(struct pci_dev *pdev,
782786
"%ux CAN-FD PCAN-PCIe FPGA v%u.%u.%u:\n", can_count,
783787
hw_ver_major, hw_ver_minor, hw_ver_sub);
784788

789+
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
790+
/* FW < v3.3.0 DMA logic doesn't handle correctly the mix of 32-bit and
791+
* 64-bit logical addresses: this workaround forces usage of 32-bit
792+
* DMA addresses only when such a fw is detected.
793+
*/
794+
if (PCIEFD_FW_VERSION(hw_ver_major, hw_ver_minor, hw_ver_sub) <
795+
PCIEFD_FW_VERSION(3, 3, 0)) {
796+
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
797+
if (err)
798+
dev_warn(&pdev->dev,
799+
"warning: can't set DMA mask %llxh (err %d)\n",
800+
DMA_BIT_MASK(32), err);
801+
}
802+
#endif
803+
785804
/* stop system clock */
786805
pciefd_sys_writereg(pciefd, PCIEFD_SYS_CTL_CLK_EN,
787806
PCIEFD_REG_SYS_CTL_CLR);

0 commit comments

Comments
 (0)