This patch adds documentation for the MSCAN OF device bindings for
the MPC512x and moves the one for the MPC5200 to the new common file
"Documentation/powerpc/dts-bindings/fsl/can.txt".
Signed-off-by: Wolfgang Grandegger <wg@denx.de> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1106 030b6a49-0b11-0410-94ab-b0dab22257f2
The main differences compared to the MSCAN on the MPC5200 are:
- More flexibility in choosing the CAN source clock and frequency:
Three different clock sources can be selected: "ip", "ref" or "sys".
For the latter two, a clock divider can be defined as well. If the
clock source is not specified by the device tree, we first try to
find an optimal CAN source clock based on the system clock. If that
is not possible, the reference clock will be used.
- The behavior of bus-off recovery is configurable:
To comply with the usual handling of Socket-CAN bus-off recovery,
"recovery on request" is selected (instead of automatic recovery).
Note that only MPC5121 Rev. 2 and later is supported.
Signed-off-by: Wolfgang Grandegger <wg@denx.de> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1105 030b6a49-0b11-0410-94ab-b0dab22257f2
The start_xmit function of the MSCAN Driver did return improperly if
the CAN dlc check failed (skb not freed and invalid return code). This
patch adds a proper check of the frame lenght and data size and returns
now correctly. The invalid skb packets are dropped silently as suggested
by David Miller in the thread "[RFC] ndo_validate_skb: Let the netdev
check a valid skb content" on the netdev mailing list.
Furthermore, a typo has been fixed.
Signed-off-by: Wolfgang Grandegger <wg@denx.de> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1104 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Wed, 6 Jan 2010 19:39:24 +0000 (19:39 +0000)]
This patch adds the flag CAN_CTRLMODE_ONE_SHOT. It is used as mask
or flag in the "struct can_ctrlmode".
It allows userspace via netlink to set a CAN controller into the special
"one-shot" mode. In this mode, if supported by the CAN controller, it
tries only once to deliver a CAN frame and aborts it if an error
(e.g.: arbitration lost) happens.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream commit:
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commitdiff;h=c1c5523dd1517250cac8b15a4acbc237c24a67d4
hartkopp [Fri, 4 Dec 2009 07:31:11 +0000 (07:31 +0000)]
Updated slcan to 2.6.32 including:
net: use NETDEV_TX_OK instead of 0 in ndo_start_xmit() functions
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=6ed106549d17474ca17a16057f4c0ed4eba5a7ca
headers: remove sched.h from interrupt.h
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=d43c36dc6b357fa1806800f18aa30123c747a6d1
The network layer now has a destructor we can hook to clean up the slip
devices array. That needs us to initiate unregister events in the right
places which with the current tty layer we can do, and with network
refcounting is safe to do.
Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1095 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Thu, 3 Dec 2009 18:29:17 +0000 (18:29 +0000)]
Introduced new GET_CAN_DLC() macro, that casts the data length code information to __u8 and ensures the dlc not to be > 8.
Make use of this new macro in all drivers and clean-up/fix current dlc handling in the receive path.
hartkopp [Wed, 25 Nov 2009 16:43:17 +0000 (16:43 +0000)]
Remove feature to quit the isotptun by keypress (from stdin) as it was not possible to run it from a start-script.
Added a signal handler to gracefully leave the isotptun.
wolf [Wed, 25 Nov 2009 11:18:22 +0000 (11:18 +0000)]
can-utils: canfdtest, a full duplex test to find out-of-order messages
This patch is a pepped up version of Valdislav's canecho_gen and
canecho_dut test programs, which have prooved to be useful for
detecting out-of-order message transmisson and reception. Here
is a list of the changes and improvements:
- Both programs have been merged into on test program named
canfdtest. Message generation can be selected via the command
line option '-g'.
- The test loop count can be specified.
- A low and high verbosity level has been added.
- send/recv is used instead of write/read.
- The return code of send/recv is checked properly.
- Use Linux coding style.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1088 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Sat, 21 Nov 2009 20:28:17 +0000 (20:28 +0000)]
net: Support specifying the network namespace upon device creation.
There is no good reason to not support userspace specifying the
network namespace during device creation, and it makes it easier
to create a network device and pass it to a child network namespace
with a well known name.
We have to be careful to ensure that the target network namespace
for the new device exists through the life of the call. To keep
that logic clear I have factored out the network namespace grabbing
logic into rtnl_link_get_net.
In addtion we need to continue to pass the source network namespace
to the rtnl_link_ops.newlink method so that we can find the base
device source network namespace.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1085 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Sat, 21 Nov 2009 20:20:17 +0000 (20:20 +0000)]
can: Fix driver Kconfig structure
In 2.6.32-rc the new EMS USB CAN driver was contributed and added the Kconfig
entry right behind an entry of the same *vendor*. This teared the SJA1000
based driver selection into pieces.
This fix cleans up the 2.6.32-rc Kconfig files for the CAN drivers and moves
the SJA1000 and USB Kconfig portions into the belonging directories.
As there are many new CAN drivers in the queue getting this cleanup into
2.6.32-rc would massively reduce the problems for the upcoming drivers.
wolf [Mon, 16 Nov 2009 22:09:58 +0000 (22:09 +0000)]
can: add the missing netlink get_xstats_size callback
This patch adds the missing "get_xstats_size" callback for the
netlink interface, which is required if "fill_xstats" is used,
as pointed out by Patrick McHardy.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: David S. Miller <davem@davemloft.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1082 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Wed, 11 Nov 2009 06:38:03 +0000 (06:38 +0000)]
Add MODULE_FIRMWARE definitions.
These definitions should IMO live next to the card descriptions, which should
in turn live in the modules that actually drive the cards.
Therefore, this patch moves all PCMCIA card descriptions
& MODULE_FIRMWARE statements into softing_cs.
Before this patch, the card description was looked up twice.
The pc104 descriptions (which have not yet been tested) have no seperate
module to go into, and live still in softing_fw.c
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@skynet.be> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1080 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Sun, 8 Nov 2009 17:29:22 +0000 (17:29 +0000)]
bcm_proc_getifname() is called with RTNL and dev_base_lock
not held. It calls __dev_get_by_index() without locks, and
this is illegal (might crash)
Close the race by holding dev_base_lock and copying dev->name
in the protected section.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=6755aebaaf9fc5416acfd4578ab7a1e122ecbc74
wolf [Sun, 8 Nov 2009 13:48:06 +0000 (13:48 +0000)]
can: fix WARN_ON dump in net/core/rtnetlink.c:rtmsg_ifinfo()
On older kernels, e.g. 2.6.27, a WARN_ON dump in rtmsg_ifinfo()
is thrown when the CAN device is registered due to insufficient
skb space, as reported by various users. This patch adds the
rtnl_link_ops "get_size" to fix the problem. I think it's
required for more recent kernels as well, even if no WARN_ON
dumps are triggered. Maybe we also need it for the CAN xstats.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1078 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Fri, 6 Nov 2009 16:54:18 +0000 (16:54 +0000)]
In 2.6.32+ the setsockopt function provides an unsigned optlen.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b7058842c940ad2c08dd829b21e5c92ebe3b8758
hartkopp [Fri, 6 Nov 2009 15:46:21 +0000 (15:46 +0000)]
Added channel information in sysfs.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1076 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Fri, 6 Nov 2009 15:32:27 +0000 (15:32 +0000)]
- Fix 64bit division for 32bit systems.
- Fix compile warning in dev_dbg() output
- Added include of <linux/sched.h> needed in 2.6.32
- Reordered timestamp functions to prevent a forward declaration.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1075 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Thu, 5 Nov 2009 16:33:04 +0000 (16:33 +0000)]
mscan: do not set err value on slprq timeout
If the RXACT flag is not cleared on the mscan, the slprq will eventually
fail. This could be the situation when some opposite is keeping resending
frames because of some communication errors. This way we will the initrq or
cswai will also not be set and the mscan controller will got stuck till
the bus is restarted. To avoid this we kick out setting the err value beyong a
slprq failure to let the controller proceed. This is hacky since calling e.g.
initrq while the mscan is really doing stuffs might disturb the bus
communication. For now we however don't have other possiblities to work around
the behaviour of mscan mentioned above.
Chanages to V1: turn dev_warn to dev_dbg. put part of the warning messages into
the comment
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1073 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Mon, 26 Oct 2009 10:54:44 +0000 (10:54 +0000)]
sja1000: fix improper library functions for skb allocation usage
The commit 1068 "can: provide library functions for skb allocation" did
forget to remove two line of the SJA1000 driver resulting in a
'skb_over_panic' when calling skb_put.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1071 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Thu, 15 Oct 2009 08:36:11 +0000 (08:36 +0000)]
Wrap the CAN include/linux header files to include/socketcan
To avoid conflicts with the *almost* similar kernel include files we
use a separate set of header files in include/socketcan (instead of
include/linux). But the include/linux header files are still needed
for the user space applications, e.g. the can-utils. To simplify
maintanance, wrappers to the corresponding files in include/socketcan
are used. Kernel-only header files are removed from include/linux.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1070 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Thu, 8 Oct 2009 10:41:01 +0000 (10:41 +0000)]
Rework of can_if start script:
- make use of 'ip' tool from iproute2 package
- support Debian depency start scripts
- support setting of bitrates and restart-ms
- remove created vcan devices at shutdown
wolf [Wed, 7 Oct 2009 17:37:57 +0000 (17:37 +0000)]
can: provide library functions for skb allocation
This patch makes the private functions alloc_can_skb() and
alloc_can_err_skb() of the at91_can driver public and adapts all
drivers to use these. While making the patch I realized, that
the skb's are *not* setup consistently. The skb's are now setup
as shown:
wolf [Tue, 22 Sep 2009 08:08:15 +0000 (08:08 +0000)]
can: make the number of echo skb's configurable
This patch allows the CAN controller driver to define the number
of echo skb's used for the local loopback (echo), as suggested by
Kurt, via:
struct net_device *alloc_candev(int sizeof_priv,
unsigned int echo_skb_max);
The drivers have been adapted accordingly. Please check if the
value of echo_skb_max is OK for your driver.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1061 030b6a49-0b11-0410-94ab-b0dab22257f2
An out-of-order TX message problem has been reported and demonstrated
by Vladislav. The TX message buffers were not handled properly if
just one message was pending. This patch remembers the id of the buffer
used previously and increase the buffer priority if the next one has a
lower id number. This allows up to approx. 3*256 messages to be sent
until the lowest buffer priority of 255 is reached.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1059 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Tue, 15 Sep 2009 18:42:01 +0000 (18:42 +0000)]
sja1000: fix network statistics update
The member "tx_bytes" of "struct net_device_stats" should be
incremented when the interrupt is done and an "arbitration
lost error" is a TX error and the statistics should be updated
accordingly.
wolf [Tue, 15 Sep 2009 18:25:47 +0000 (18:25 +0000)]
at91_can: add NAPI support fix error and bus off handling
This patch updates the at91_can driver it features:
- NAPI for rx and error packages
(tx and state changes stay in irq handler)
- implemented bus off and errror handling conforming to the
Linux CAN API
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1056 030b6a49-0b11-0410-94ab-b0dab22257f2
When using nanosleep() in an userspace application we get a ratelimit warning
NOHZ: local_softirq_pending 08
for 10 times.
The echo of CAN frames is done from process context and softirq context only.
Therefore the usage of netif_rx() was wrong (for years).
This patch replaces netif_rx() with netif_rx_ni() which has to be used from
process/softirq context. It also adds a missing comment that can_send() must
no be used from hardirq context.
Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
Also in mainline.
hartkopp [Mon, 31 Aug 2009 12:16:26 +0000 (12:16 +0000)]
Update minor changes from mainline, e.g.
can: switch carrier on if device was stopped while in bus-off state
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commitdiff;h=1b0d92244ff2434a98272f6d2525da32fc230f19
And reorder of can_update_spt() in can_calc_bittiming().
To ensure a proper handling of CAN frames transported in skbuffs some checks
need to be performed at receive time.
As stated by Michael Olbrich and Luotao Fu BUG_ON() might be to restrictive.
This is right as we can just drop the non conform skbuff and the Kernel can
continue working.
This patch replaces the BUG_ON() with a WARN_ONCE() so that the system remains
healthy but we made the problem visible (once).
Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: Urs Thuermann <urs@isnogud.escape.de> CC: Michael Olbrich <m.olbrich@pengutronix.de> CC: Luotao Fu <l.fu@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1039 030b6a49-0b11-0410-94ab-b0dab22257f2
Signed-off-by: Lothar Wassmann <LW@KARO-electronics.de> Acked-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1033 030b6a49-0b11-0410-94ab-b0dab22257f2
Signed-off-by: Lothar Wassmann <LW@KARO-electronics.de> Acked-by: Oliver Hartkopp <oliver@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1032 030b6a49-0b11-0410-94ab-b0dab22257f2
wolf [Tue, 2 Jun 2009 11:55:06 +0000 (11:55 +0000)]
dev: Use minimal set of SYSFS flies for intelligent CAN controllers
Active or intelligent CAN controllers do the setting of the bit-timing
internally rendering most of the standard bit-timing parameters for
the passive CAN controllers unnecessary. Usually just an index to a
fixed bit-time setting can be selected. For this purpose, just the
SYSFS file "can_bittiming/bitrate" will be created, if the CAN
bit-timing constants are not provided for the device.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@984 030b6a49-0b11-0410-94ab-b0dab22257f2
hartkopp [Tue, 5 May 2009 09:00:33 +0000 (09:00 +0000)]
As the original code was already under GPL the additional license information was removed.
Also moved the dual license BSD/GPL to only GPL.
Added some information about N_SLCAN in precompiled Kernels provided by Lionel Saugrain.
For the Network Drop Monitor introduced in 2.6.30 by Neil Horman the
end-of-line points for skbs that are not dropped due to errors should
use consume_skb() instead of kfree_skb() to not be monitored as a 'drop'.
wolf [Mon, 6 Apr 2009 10:59:05 +0000 (10:59 +0000)]
AT91SAM9263 CAN driver taken from Marc's GIT repository
(http://pasiphae.extern.pengutronix.de/?p=mkl/linux-can;a=summary)
commit id 95742fd12484176ecaa7c54a1d08e744fac487e3
and adapted to work with the latest SVN version 963 of SocketCAN
according to SJA1000 driver. Changes:
- change register_netdev() to register_candev()
- fix bittiming constants to enable bitrates up to 1000000 bps
- some cosmetic changes and spelling errors fixes
wolf [Wed, 18 Feb 2009 18:38:12 +0000 (18:38 +0000)]
SJA1000: generic OF platform bus driver
This patch adds a generic driver for SJA1000 chips on the OpenFirmware
platform bus found on embedded PowerPC systems. You need a SJA1000 node
definition in your flattened device tree source (DTS) file similar to:
wolf [Tue, 17 Feb 2009 11:02:09 +0000 (11:02 +0000)]
Use EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL for drivers
As suggested by Sam, the safer approach is to be more restrictive.
If we later decide we want to support non-gpl we can be less restrictive.
Therefore let's go for the GPL version of the exports for now.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@953 030b6a49-0b11-0410-94ab-b0dab22257f2