History log of /drivers/net/can/ti_hecc.c
Revision Date Author Comments
c971fa2ae42e73e9ccc2f5e93f268c8742da4c5d 07-Mar-2014 Oliver Hartkopp <socketcan@hartkopp.net> can: Unify MTU settings for CAN interfaces

CAN interfaces only support MTU values of 16 (CAN 2.0) and 72 (CAN FD).
Setting the MTU to other values is pointless but it does not really hurt.
With the introduction of the CAN FD support in drivers/net/can a new
function to switch the MTU for CAN FD has been introduced.

This patch makes use of this can_change_mtu() function to check for correct
MTU settings also in legacy CAN (2.0) devices.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
a81ab36bf52d0ca3a32251a923be1dbced726141 08-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com> drivers/net: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

This covers everything under drivers/net except for wireless, which
has been submitted separately.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ea79c1c18520c3a60a2fc8193e2fb58710812d4e 11-Jan-2014 Marc Kleine-Budde <mkl@pengutronix.de> can: ti_hecc: fix endianness related sparse warning

This patch fixes the following sparse warning, which occurs in casts when
accessing the data in the CAN frames (struct can_frame) in the RX and TX
routines:

drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32
drivers/net/can/ti_hecc.c:572:28: warning: incorrect type in assignment (different base types)
drivers/net/can/ti_hecc.c:572:28: expected unsigned int [unsigned] [usertype] <noident>
drivers/net/can/ti_hecc.c:572:28: got restricted __be32 [usertype] <noident>
drivers/net/can/ti_hecc.c:575:40: warning: incorrect type in assignment (different base types)
drivers/net/can/ti_hecc.c:575:40: expected unsigned int [unsigned] [usertype] <noident>
drivers/net/can/ti_hecc.c:575:40: got restricted __be32 [usertype] <noident>

As the data is indeed big endian, use "__be32" instead of "u32", when casting
it.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
26896fd98130cdda73b19c75849a0d25cb850cb8 04-Oct-2013 Marc Kleine-Budde <mkl@pengutronix.de> can: ti_hecc: remove priv->can.do_get_state() callback

This patch removes the priv->can.do_get_state() callback, as it just returns
priv->can.state. The callback's only user can_fill_info() has direct access to
priv->can.state.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
fc218471c69edd43c34d304cd737f0958d8ce195 10-Sep-2013 Jingoo Han <jg1.han@samsung.com> can: ti_hecc: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
5727dc6bf5b70dd278e58e26137e2df729b9c107 07-May-2013 Jingoo Han <jg1.han@samsung.com> net: can: ti_hecc: remove unnecessary platform_set_drvdata()

The driver core clears the driver data to NULL after device_release
or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d
(device-core: Ensure drvdata = NULL when no driver is bound).
Thus, it is not needed to manually clear the device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
71088c4bd9b8f8cbffb0e66f2abc14297e4b2ca8 18-Jan-2013 Olivier Sobrie <olivier@sobrie.be> can: ti_hecc: fix invalid error codes

Errors in CAN protocol (location) are reported in data[3] of the can
frame instead of data[2].

Cc: linux-stable <stable@vger.kernel.org>
Cc: Anant Gole <anantgole@ti.com>
Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
d7ff5aae6ce3670afc1e000c08ea238712d70fae 18-Dec-2012 Fabio Baltieri <fabio.baltieri@gmail.com> can: ti_hecc: add LED trigger support

Add support for canbus activity led indicators on ti_hecc devices by
calling appropriate can_led functions.

These are only enabled when CONFIG_CAN_LEDS is Y, becomes no-op
otherwise.

Cc: Anant Gole <anantgole@ti.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3c8ac0f2ad53a96ac58efe7c98fac2986d081dfc 03-Dec-2012 Bill Pemberton <wfp5p@virginia.edu> can: remove __dev* attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
64116c148ce7c34b0bc00a04a8437ec922ea53c5 29-Oct-2012 Marc Kleine-Budde <mkl@pengutronix.de> can: ti_hecc: add MODULE_ALIAS

This patch adds a MODULE_ALIAS for the platform bindings, so that
the module can be loaded automatically udev.

Tested-by: Jan Lübbe <jlu@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
ab04c8bd423edb03e2148350a091836c196107fc 19-Sep-2012 Marc Kleine-Budde <mkl@pengutronix.de> can: ti_hecc: fix oops during rmmod

This patch fixes an oops which occurs when unloading the driver, while the
network interface is still up. The problem is that first the io mapping is
teared own, then the CAN device is unregistered, resulting in accessing the
hardware's iomem:

[ 172.744232] Unable to handle kernel paging request at virtual address c88b0040
[ 172.752441] pgd = c7be4000
[ 172.755645] [c88b0040] *pgd=87821811, *pte=00000000, *ppte=00000000
[ 172.762207] Internal error: Oops: 807 [#1] PREEMPT ARM
[ 172.767517] Modules linked in: ti_hecc(-) can_dev
[ 172.772430] CPU: 0 Not tainted (3.5.0alpha-00037-g3554cc0 #126)
[ 172.778961] PC is at ti_hecc_close+0xb0/0x100 [ti_hecc]
[ 172.784423] LR is at __dev_close_many+0x90/0xc0
[ 172.789123] pc : [<bf00c768>] lr : [<c033be58>] psr: 60000013
[ 172.789123] sp : c5c1de68 ip : 00040081 fp : 00000000
[ 172.801025] r10: 00000001 r9 : c5c1c000 r8 : 00100100
[ 172.806457] r7 : c5d0a48c r6 : c5d0a400 r5 : 00000000 r4 : c5d0a000
[ 172.813232] r3 : c88b0000 r2 : 00000001 r1 : c5d0a000 r0 : c5d0a000
[ 172.820037] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 172.827423] Control: 10c5387d Table: 87be4019 DAC: 00000015
[ 172.833404] Process rmmod (pid: 600, stack limit = 0xc5c1c2f0)
[ 172.839447] Stack: (0xc5c1de68 to 0xc5c1e000)
[ 172.843994] de60: bf00c6b8 c5c1dec8 c5d0a000 c5d0a000 00200200 c033be58
[ 172.852478] de80: c5c1de44 c5c1dec8 c5c1dec8 c033bf2c c5c1de90 c5c1de90 c5d0a084 c5c1de44
[ 172.860992] dea0: c5c1dec8 c033c098 c061d3dc c5d0a000 00000000 c05edf28 c05edb34 c000d724
[ 172.869476] dec0: 00000000 c033c2f8 c5d0a084 c5d0a084 00000000 c033c370 00000000 c5d0a000
[ 172.877990] dee0: c05edb00 c033c3b8 c5d0a000 bf00d3ac c05edb00 bf00d7c8 bf00d7c8 c02842dc
[ 172.886474] df00: c02842c8 c0282f90 c5c1c000 c05edb00 bf00d7c8 c0283668 bf00d7c8 00000000
[ 172.894989] df20: c0611f98 befe2f80 c000d724 c0282d10 bf00d804 00000000 00000013 c0068a8c
[ 172.903472] df40: c5c538e8 685f6974 00636365 c61571a8 c5cb9980 c61571a8 c6158a20 c00c9bc4
[ 172.911987] df60: 00000000 00000000 c5cb9980 00000000 c5cb9980 00000000 c7823680 00000006
[ 172.920471] df80: bf00d804 00000880 c5c1df8c 00000000 000d4267 befe2f80 00000001 b6d90068
[ 172.928985] dfa0: 00000081 c000d5a0 befe2f80 00000001 befe2f80 00000880 b6d90008 00000008
[ 172.937469] dfc0: befe2f80 00000001 b6d90068 00000081 00000001 00000000 befe2eac 00000000
[ 172.945983] dfe0: 00000000 befe2b18 00023ba4 b6e6addc 60000010 befe2f80 a8e00190 86d2d344
[ 172.954498] [<bf00c768>] (ti_hecc_close+0xb0/0x100 [ti_hecc]) from [<c033be58>] (__dev__registered_many+0xc0/0x2a0)
[ 172.984161] [<c033c098>] (rollback_registered_many+0xc0/0x2a0) from [<c033c2f8>] (rollback_registered+0x20/0x30)
[ 172.994750] [<c033c2f8>] (rollback_registered+0x20/0x30) from [<c033c370>] (unregister_netdevice_queue+0x68/0x98)
[ 173.005401] [<c033c370>] (unregister_netdevice_queue+0x68/0x98) from [<c033c3b8>] (unregister_netdev+0x18/0x20)
[ 173.015899] [<c033c3b8>] (unregister_netdev+0x18/0x20) from [<bf00d3ac>] (ti_hecc_remove+0x60/0x80 [ti_hecc])
[ 173.026245] [<bf00d3ac>] (ti_hecc_remove+0x60/0x80 [ti_hecc]) from [<c02842dc>] (platform_drv_remove+0x14/0x18)
[ 173.036712] [<c02842dc>] (platform_drv_remove+0x14/0x18) from [<c0282f90>] (__device_release_driver+0x7c/0xbc)

Cc: stable <stable@vger.kernel.org>
Cc: Anant Gole <anantgole@ti.com>
Tested-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
194b9a4cb91713ddb60c9f98f7212f6d8cb8e05f 16-Jul-2012 Marc Kleine-Budde <mkl@pengutronix.de> can: mark bittiming_const pointer in struct can_priv as const

This patch marks the bittiming_const pointer as in the struct can_pric as
"const". This allows us to mark the struct can_bittiming_const in the CAN
drivers as "const", too.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
aabdfd6adb804d0aaba0188ade0f1afe42a52e31 01-Feb-2012 Wolfgang Grandegger <wg@grandegger.com> can: replace the dev_dbg/info/err/... with the new netdev_xxx macros

Cc: uclinux-dist-devel@blackfin.uclinux.org
Cc: Anant Gole <anantgole@ti.com>
Cc: Chris Elston <celston@katalix.com>
Cc: Sebastian Haas <haas@ems-wuensche.com>
Cc: Matthias Fuchs <matthias.fuchs@esd.eu>
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Sebastian Haas <dev@sebastianhaas.info>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
79d0d8a7d5edca459f544c2ad75088e99307795e 01-Feb-2012 Wolfgang Grandegger <wg@grandegger.com> can: bfin_can/ti_hecc/mscan: add missing do_get_berr_counter callback

Cc: Anant Gole <anantgole@ti.com>
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
e3f240f460a36b158217944b52a85f304914c1a6 01-Feb-2012 Wolfgang Grandegger <wg@grandegger.com> can: ti_hecc: use netif_rx in the interrupt

This patch fixes locking problems by using netif_rx() instead of
netif_receive_skb() in ti_hecc_error() called from the interrupt
context.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
871d33725545ca2e402b4526f38f89d041ba930f 27-Nov-2011 Axel Lin <axel.lin@gmail.com> net/can: convert drivers/net/can/* to use module_platform_driver()

This patch converts the drivers in drivers/net/can/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.

Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Bhupesh Sharma <bhupesh.sharma@st.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Paul Bolle <pebolle@tiscali.nl>
Cc: Kurt Van Dijck <kurt.van.dijck@eia.be>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
34b8686d278f00fb16234e74be44c253d6d6b676 16-Sep-2011 Daniel Mack <zonque@gmail.com> can: ti_hecc: include linux/io.h

This fixes a build breakage for OMAP3 boards.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: netdev@vger.kernel.org
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
86ad47fff97a9e416aadedfe68909b2d9143dc42 23-Aug-2011 Abhilash K V <abhilash.kv@ti.com> can: ti_hecc: Fix uninitialized spinlock in probe

In ti_hecc_probe(), the spinlock priv->mbx_lock is not
inited, causing a spinlock lockup BUG.

Acked-by: Anant Gole <anantgole@ti.com>
Signed-off-by: Abhilash K V <abhilash.kv@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6f288cc52f478e6f58d96158e7cd857fedb6d111 23-Aug-2011 Abhilash K V <abhilash.kv@ti.com> can: ti_hecc: Fix unintialized variable

In ti_hecc_xmit(), local variable "data" is not initialized before
being used.
This initialization got inadvertently removed in the following patch:

can: Unify droping of invalid tx skbs and netdev stats

Acked-by: Anant Gole <anantgole@ti.com>
Signed-off-by: Abhilash K V <abhilash.kv@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
829e0015431537176e38812f88fffe1d3250083e 13-Apr-2010 Hans J. Koch <hjk@linutronix.de> Fix some #includes in CAN drivers (rebased for net-next-2.6)

In the current implementation, CAN drivers need to #include <linux/can.h>
_before_ they #include <linux/can/dev.h>, which is both ugly and
unnecessary.

Fix this by including <linux/can.h> in <linux/can/dev.h> and remove the
#include <linux/can.h> lines from drivers.

Signed-off-by: Hans J. Koch <hjk@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
773c3e75d1fc7ea5058bfeab5d82bac5b85f8cd8 26-Feb-2010 Sriramakrishnan <srk@ti.com> can: ti hecc module : add platform specific initialization callback.

CAN module on AM3517 requires programming of IO expander as part
of init sequence - to enable CAN PHY. Added platform specific
callback to handle phy control(switch on /off).

Signed-off-by: Sriramakrishnan <srk@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
35e2da46d25a53e0e19956f533cc29272a6cceb2 22-Feb-2010 Sriram <srk@ti.com> can:ti_hecc: Add pm hook-up

Added the suspend and resume implementation in the HECC (CAN)
driver.

Signed-off-by: K R Baalaaji <krbaalaaji@ti.com>
Signed-off-by: Sriramakrishnan <srk@ti.com>
Acked-by: Anant Gole <anantgole@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ad72c347e56bf3a0231b9d686e17764157d2961c 14-Jan-2010 Christian Pellegrin <chripell@fsfe.org> can: Proper ctrlmode handling for CAN devices

This patch adds error checking of ctrlmode values for CAN devices. As
an example all availabe bits are implemented in the mcp251x driver.

Signed-off-by: Christian Pellegrin <chripell@fsfe.org>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3ccd4c6167d3b39d52631767ebbf8b5677c5855d 12-Jan-2010 Oliver Hartkopp <oliver@hartkopp.net> can: Unify droping of invalid tx skbs and netdev stats

To prevent the CAN drivers to operate on invalid socketbuffers the skbs are
now checked and silently dropped at the xmit-function consistently.

Also the netdev stats are consistently using the CAN data length code (dlc)
for [rx|tx]_bytes now.

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c7cd606f60e7679c7f9eee7010f02a6f000209c1 12-Dec-2009 Oliver Hartkopp <oliver@hartkopp.net> can: Fix data length code handling in rx path

A valid CAN dataframe can have a data length code (DLC) of 0 .. 8 data bytes.

When reading the CAN controllers register the 4-bit value may contain values
from 0 .. 15 which may exceed the reserved space in the socket buffer!

The ISO 11898-1 Chapter 8.4.2.3 (DLC field) says that register values > 8
should be reduced to 8 without any error reporting or frame drop.

This patch introduces a new helper macro to cast a given 4-bit data length
code (dlc) to __u8 and ensure the DLC value to be max. 8 bytes.

The different handlings in the rx path of the CAN netdevice drivers are fixed.

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7b6856a0296a8f187bb88ba31fa83a08abba7966 20-Oct-2009 Wolfgang Grandegger <wg@grandegger.com> 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. It's now done as shown
below:

skb->protocol = htons(ETH_P_CAN);
skb->pkt_type = PACKET_BROADCAST;
skb->ip_summed = CHECKSUM_UNNECESSARY;
*cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
memset(*cf, 0, sizeof(struct can_frame));

The frame is zeroed out to avoid uninitialized data to be passed to
user space. Some drivers or library code did not set "pkt_type" or
"ip_summed". Also, "__constant_htons()" should not be used for
runtime invocations, as pointed out by David Miller.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a6e4bc5304033e434fabccabb230b8e9ff55d76f 09-Oct-2009 Wolfgang Grandegger <wg@grandegger.com> 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 Van
Dijck, with the function:

struct net_device *alloc_candev(int sizeof_priv,
unsigned int echo_skb_max);

The CAN drivers have been adapted accordingly. For the ems_usb driver,
as suggested by Sebastian Haas, the number of echo skb's has been
increased to 10, which improves the transmission performance a lot.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
3758bf25db8caeec667e4e56e030da0ec3060529 07-Oct-2009 Anant Gole <anantgole@ti.com> can: add TI CAN (HECC) driver

TI HECC (High End CAN Controller) module is found on many TI devices. It
has 32 hardware mailboxes with full implementation of CAN protocol 2.0B
with bus speeds up to 1Mbps. Specifications of the module are available
on TI web <http://www.ti.com>

Signed-off-by: Anant Gole <anantgole@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>