Commit 5db15872 authored by David S. Miller's avatar David S. Miller

Merge tag 'linux-can-next-for-4.8-20160623' of...

Merge tag 'linux-can-next-for-4.8-20160623' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2016-06-17

this is a pull request of 4 patches for net-next/master.

Arnd Bergmann's patch fixes a regresseion in af_can introduced in
linux-can-next-for-4.8-20160617. There are two patches by Ramesh
Shanmugasundaram, which add CAN-2.0 support to the rcar_canfd driver.
And a patch by Ed Spiridonov that adds better error diagnoses messages
to the Ed Spiridonov driver.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 810bf110 b63f69d0
...@@ -32,6 +32,12 @@ below properties. ...@@ -32,6 +32,12 @@ below properties.
- assigned-clocks: phandle of canfd clock. - assigned-clocks: phandle of canfd clock.
- assigned-clock-rates: maximum frequency of this clock. - assigned-clock-rates: maximum frequency of this clock.
Optional property:
The controller can operate in either CAN FD only mode (default) or
Classical CAN only mode. The mode is global to both the channels. In order to
enable the later, define the following optional property.
- renesas,no-can-fd: puts the controller in Classical CAN only mode.
Example Example
------- -------
...@@ -63,12 +69,13 @@ SoC common .dtsi file: ...@@ -63,12 +69,13 @@ SoC common .dtsi file:
Board specific .dts file: Board specific .dts file:
E.g. below enables Channel 1 alone in the board. E.g. below enables Channel 1 alone in the board in Classical CAN only mode.
&canfd { &canfd {
pinctrl-0 = <&canfd1_pins>; pinctrl-0 = <&canfd1_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
status = "okay"; renesas,no-can-fd;
status = "okay";
channel1 { channel1 {
status = "okay"; status = "okay";
...@@ -79,9 +86,9 @@ E.g. below enables Channel 0 alone in the board using External clock ...@@ -79,9 +86,9 @@ E.g. below enables Channel 0 alone in the board using External clock
as fCAN clock. as fCAN clock.
&canfd { &canfd {
pinctrl-0 = <&canfd0_pins &can_clk_pins>; pinctrl-0 = <&canfd0_pins &can_clk_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
status = "okay"; status = "okay";
channel0 { channel0 {
status = "okay"; status = "okay";
......
This diff is collapsed.
...@@ -1145,8 +1145,11 @@ static int mcp251x_can_probe(struct spi_device *spi) ...@@ -1145,8 +1145,11 @@ static int mcp251x_can_probe(struct spi_device *spi)
/* Here is OK to not lock the MCP, no one knows about it yet */ /* Here is OK to not lock the MCP, no one knows about it yet */
ret = mcp251x_hw_probe(spi); ret = mcp251x_hw_probe(spi);
if (ret) if (ret) {
if (ret == -ENODEV)
dev_err(&spi->dev, "Cannot initialize MCP%x. Wrong wiring?\n", priv->model);
goto error_probe; goto error_probe;
}
mcp251x_hw_sleep(spi); mcp251x_hw_sleep(spi);
...@@ -1156,6 +1159,7 @@ static int mcp251x_can_probe(struct spi_device *spi) ...@@ -1156,6 +1159,7 @@ static int mcp251x_can_probe(struct spi_device *spi)
devm_can_led_init(net); devm_can_led_init(net);
netdev_info(net, "MCP%x successfully initialized.\n", priv->model);
return 0; return 0;
error_probe: error_probe:
...@@ -1168,6 +1172,7 @@ static int mcp251x_can_probe(struct spi_device *spi) ...@@ -1168,6 +1172,7 @@ static int mcp251x_can_probe(struct spi_device *spi)
out_free: out_free:
free_candev(net); free_candev(net);
dev_err(&spi->dev, "Probe failed, err=%d\n", -ret);
return ret; return ret;
} }
......
...@@ -911,14 +911,14 @@ static __init int can_init(void) ...@@ -911,14 +911,14 @@ static __init int can_init(void)
if (!rcv_cache) if (!rcv_cache)
return -ENOMEM; return -ENOMEM;
if (stats_timer) { if (IS_ENABLED(CONFIG_PROC_FS)) {
if (stats_timer) {
/* the statistics are updated every second (timer triggered) */ /* the statistics are updated every second (timer triggered) */
setup_timer(&can_stattimer, can_stat_update, 0); setup_timer(&can_stattimer, can_stat_update, 0);
mod_timer(&can_stattimer, round_jiffies(jiffies + HZ)); mod_timer(&can_stattimer, round_jiffies(jiffies + HZ));
} else }
can_stattimer.function = NULL; can_init_proc();
}
can_init_proc();
/* protocol register */ /* protocol register */
sock_register(&can_family_ops); sock_register(&can_family_ops);
...@@ -933,10 +933,12 @@ static __exit void can_exit(void) ...@@ -933,10 +933,12 @@ static __exit void can_exit(void)
{ {
struct net_device *dev; struct net_device *dev;
if (stats_timer) if (IS_ENABLED(CONFIG_PROC_FS)) {
del_timer_sync(&can_stattimer); if (stats_timer)
del_timer_sync(&can_stattimer);
can_remove_proc(); can_remove_proc();
}
/* protocol unregister */ /* protocol unregister */
dev_remove_pack(&canfd_packet); dev_remove_pack(&canfd_packet);
......
...@@ -113,19 +113,8 @@ struct s_pstats { ...@@ -113,19 +113,8 @@ struct s_pstats {
extern struct dev_rcv_lists can_rx_alldev_list; extern struct dev_rcv_lists can_rx_alldev_list;
/* function prototypes for the CAN networklayer procfs (proc.c) */ /* function prototypes for the CAN networklayer procfs (proc.c) */
#ifdef CONFIG_PROC_FS
void can_init_proc(void); void can_init_proc(void);
void can_remove_proc(void); void can_remove_proc(void);
#else
static inline void can_init_proc(void)
{
pr_info("can: Can't create /proc/net/can. CONFIG_PROC_FS missing!\n");
}
static inline void can_remove_proc(void)
{
}
#endif
void can_stat_update(unsigned long data); void can_stat_update(unsigned long data);
/* structures and variables from af_can.c needed in proc.c for reading */ /* structures and variables from af_can.c needed in proc.c for reading */
......
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