summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/janz-ican3.c
Commit message (Collapse)AuthorAgeFilesLines
* can: janz-ican3: add support for one shot modeIra W. Snyder2012-07-201-1/+7
| | | | | | | | | | | | | The Janz VMOD-ICAN3 hardware has support for one shot packet transmission. This means that a packet will be attempted to be sent once, with no automatic retries. The SocketCAN core has a controller-wide setting for this mode: CAN_CTRLMODE_ONE_SHOT. The Janz VMOD-ICAN3 hardware supports this flag on a per-packet level, but the SocketCAN core does not. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
* can: janz-ican3: avoid firmware lockup caused by infinite bus error quotaIra W. Snyder2012-07-201-1/+11
| | | | | | | | | | | | | | | | | | | If the bus error quota is set to infinite and the host CPU cannot keep up, the Janz VMOD-ICAN3 firmware will stop responding to control messages until the controller is reset. The firmware will automatically stop sending bus error messages when the quota is reached, and will only resume sending bus error messages when the quota is re-set to a positive value. This limitation is worked around by setting the bus error quota to one message, and then re-setting the quota to one message every time a bus error message is received. By doing this, the firmware never stops responding to control messages. The CAN bus can be reset without a hard-reset of the controller card. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
* can: janz-ican3: fix support for CAN_RAW_RECV_OWN_MSGSIra W. Snyder2012-07-201-46/+157
| | | | | | | | | | | | | | | | | | | | | | The Janz VMOD-ICAN3 firmware does not support any sort of TX-done notification or interrupt. The driver previously used the hardware loopback to attempt to work around this deficiency, but this caused all sockets to receive all messages, even if CAN_RAW_RECV_OWN_MSGS is off. Using the new function ican3_cmp_echo_skb(), we can drop the loopback messages and return the original skbs. This fixes the issues with CAN_RAW_RECV_OWN_MSGS. A private skb queue is used to store the echo skbs. This avoids the need for any index management. Due to a lack of TX-error interrupts, bus errors are permanently enabled, and are used as a TX-error notification. This is used to drop an echo skb when transmission fails. Bus error packets are not generated if the user has not enabled bus error reporting. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
* can: janz-ican3: fix error and byte countersIra W. Snyder2012-07-201-5/+6
| | | | | | | | | | | | | | | | | The error and byte counter statistics were being incremented incorrectly. For example, a TX error would be counted both in tx_errors and rx_errors. This corrects the problem so that tx_errors and rx_errors are only incremented for errors caused by packets sent to the bus. Error packets generated by the driver are not counted. The byte counters are only increased for packets which are actually transmitted or received from the bus. Error packets generated by the driver are not counted. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
* can: janz-ican3: cleanup of ican3_to_can_frame and can_frame_to_ican3Marc Kleine-Budde2012-07-201-5/+5
| | | | | | | | | | | | | This patch cleans up the ICAN3 to Linux CAN frame and vice versa conversion functions: - RX: Use get_can_dlc() to limit the dlc value. - RX+TX: Don't copy the whole frame, only copy the amount of bytes specified in cf->can_dlc. Acked-by: Ira W. Snyder <iws@ovro.caltech.edu> Tested-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
* can: janz-ican3: drop invalid skbsIra W. Snyder2012-07-201-0/+3
| | | | | | | | | | | | The commit which added the janz-ican3 driver and commit 3ccd4c61 "can: Unify droping of invalid tx skbs and netdev stats" were committed into mainline Linux during the same merge window. Therefore, the addition of this code to the janz-ican3 driver was forgotten. This patch adds the expected code. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
* can: janz-ican3: remove dead codeIra W. Snyder2012-07-201-2/+0Star
| | | | | | | | | The code which used this variable was removed during review, before the driver was added to mainline Linux. It is now dead code, and can be removed. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
* can: mark bittiming_const pointer in struct can_priv as constMarc Kleine-Budde2012-07-201-1/+1
| | | | | | | | 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>
* net/can: convert drivers/net/can/* to use module_platform_driver()Axel Lin2011-11-291-12/+1Star
| | | | | | | | | | | | | | | | | | | 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>
* net: remove mm.h inclusion from netdevice.hAlexey Dobriyan2011-06-221-0/+1
| | | | | | | | | | | | | | | | | Remove linux/mm.h inclusion from netdevice.h -- it's unused (I've checked manually). To prevent mm.h inclusion via other channels also extract "enum dma_data_direction" definition into separate header. This tiny piece is what gluing netdevice.h with mm.h via "netdevice.h => dmaengine.h => dma-mapping.h => scatterlist.h => mm.h". Removal of mm.h from scatterlist.h was tried and was found not feasible on most archs, so the link was cutoff earlier. Hope people are OK with tiny include file. Note, that mm_types.h is still dragged in, but it is a separate story. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* mfd: Use mfd cell platform_data for janz cells platform bitsSamuel Ortiz2011-05-261-2/+1Star
| | | | | | | | | | | | | With the addition of a platform device mfd_cell pointer, MFD drivers can go back to passing platform data back to their sub drivers. This allows for an mfd_cell->mfd_data removal and thus keep the sub drivers MFD agnostic. This is mostly needed for non MFD aware sub drivers. Cc: Ira W. Snyder <iws@ovro.caltech.edu> Cc: Wolfgang Grandegger <wg@grandegger.com> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* Fix common misspellingsLucas De Marchi2011-03-311-4/+4
| | | | | | Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
* mfd: mfd_cell is now implicitly available to janz driversAndres Salomon2011-03-231-1/+2
| | | | | | | | The cell's platform_data is now accessed with a helper function; change clients to use that, and remove the now-unused data_size. Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* net: can: janz-ican3: world-writable sysfs termination fileVasiliy Kulikov2011-02-041-1/+1
| | | | | | | Don't allow everybody to set terminator via sysfs. Signed-off-by: Vasiliy Kulikov <segoon@openwall.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* drivers/net: remove unnecessary flush_scheduled_work() callsTejun Heo2010-12-121-9/+0Star
| | | | | | | | | | | | | | | | janz-ican3, sh_eth, skge and vxge don't use workqueue at all and there is no reason to flush the system_wq. Drop flush_scheduled_work() calls and references to workqueue. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Wolfgang Grandegger <wg@grandegger.com> Cc: Stephen Hemminger <shemminger@linux-foundation.org> Cc: Ramkrishna Vepa <ramkrishna.vepa@exar.com> Cc: Sivakumar Subramani <sivakumar.subramani@exar.com> Cc: Sreenivasa Honnur <sreenivasa.honnur@exar.com> Cc: Jon Mason <jon.mason@exar.com> Cc: netdev@vger.kernel.org
* can: Add support for Janz VMOD-ICAN3 Intelligent CAN moduleIra W. Snyder2010-05-281-0/+1830
The Janz VMOD-ICAN3 is a MODULbus daughterboard which fits onto any MODULbus carrier board. It is an intelligent CAN controller with a microcontroller and associated firmware. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Acked-by: Wolfgang Grandegger <wg@grandegger.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>