aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/can
AgeCommit message (Collapse)AuthorFilesLines
2014-04-24can: c_can: Cleanup c_can_inval_msg_object()Thomas Gleixner1-5/+5
Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Cleanup setup of receive buffersThomas Gleixner1-21/+17
Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Cleanup c_can_read_msg_object()Thomas Gleixner1-17/+15
Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Cleanup irq enable/disableThomas Gleixner1-25/+12
Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Work around C_CAN RX wreckageThomas Gleixner2-3/+11
Alexander reported that the new optimized handling of the RX fifo causes random packet loss on Intel PCH C_CAN hardware. After a few fruitless debugging sessions I got hold of a PCH (eg20t) afflicted system. That machine does not have the CAN interface wired up, but it was possible to reproduce the issue with the HW loopback mode. As Alexander observed correctly, clearing the NewDat flag along with reading out the message buffer causes that issue on C_CAN, while D_CAN handles that correctly. Instead of restoring the original message buffer handling horror the following workaround solves the issue: transfer buffer to IF without clearing the NewDat handle the message clear NewDat bit That's similar to the original code but conditional for C_CAN. I really wonder why all user manuals (C_CAN, Intel PCH and some more) recommend to clear the NewDat bit right away. The knows it all Oracle operated by Gurgle does not unearth any useful information either. I simply cannot believe that we are the first to uncover that HW issue. Reported-and-tested-by: Alexander Stein <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Disable rx split as workaroundThomas Gleixner2-14/+55
The RX buffer split causes packet loss in the hardware: What happens is: RX Packet 1 --> message buffer 1 (newdat bit is not cleared) RX Packet 2 --> message buffer 2 (newdat bit is not cleared) RX Packet 3 --> message buffer 3 (newdat bit is not cleared) RX Packet 4 --> message buffer 4 (newdat bit is not cleared) RX Packet 5 --> message buffer 5 (newdat bit is not cleared) RX Packet 6 --> message buffer 6 (newdat bit is not cleared) RX Packet 7 --> message buffer 7 (newdat bit is not cleared) RX Packet 8 --> message buffer 8 (newdat bit is not cleared) Clear newdat bit in message buffer 1 Clear newdat bit in message buffer 2 Clear newdat bit in message buffer 3 Clear newdat bit in message buffer 4 Clear newdat bit in message buffer 5 Clear newdat bit in message buffer 6 Clear newdat bit in message buffer 7 Clear newdat bit in message buffer 8 Now if during that clearing of newdat bits, a new message comes in, the HW gets confused and drops it. It does not matter how many of them you clear. I put a delay between clear of buffer 1 and buffer 2 which was long enough that the message should have been queued either in buffer 1 or buffer 9. But it did not show up anywhere. The next message ended up in buffer 1. So the hardware lost a packet of course without telling it via one of the error handlers. That does not happen on all clear newdat bit events. I see one of 10k packets dropped in the scenario which allows us to reproduce. But the trace looks always the same. Not splitting the RX Buffer avoids the packet loss but can cause reordering. It's hard to trigger, but it CAN happen. With that mode we use the HW as it was probably designed for. We read from the buffer 1 upwards and clear the buffer as we get the message. That's how all microcontrollers use it. So I assume that the way we handle the buffers was never really tested. According to the public documentation it should just work :) Let the user decide which evil is the lesser one. [ Oliver Hartkopp: Provided a sane config option and help text and made me switch to favour potential and unlikely reordering over packet loss ] Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Get rid of pointless interruptsThomas Gleixner2-77/+48
The driver handles pointlessly TWO interrupts per packet. The reason is that it enables the status interrupt which fires for each rx and tx packet and it enables the per message object interrupts as well. The status interrupt merily acks or in case of D_CAN ignores the TX/RX state and then the message object interrupt fires. The message objects interrupts are only useful if all message objects have hardware filters activated. But we don't have that and its not simple to implement in that driver without rewriting it completely. So we can ditch the message object interrupts and handle the RX/TX right away from the status interrupt. Instead of TWO we handle ONE. Note: We must keep the TXIE/RXIE bits in the message buffers because the status interrupt alone is not reliable enough in corner cases. If we ever have the need for HW filtering, then this code needs a complete overhaul and we can think about it then. For now we prefer a lower interrupt load. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Avoid status register update for D_CANThomas Gleixner1-3/+6
On D_CAN the RXOK, TXOK and LEC bits are cleared/set on read of the status register. No need to update them. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Simplify buffer reenablingThomas Gleixner1-10/+6
Instead of writing to the message object we can simply clear the NewDat bit with the get method. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Always update error statsThomas Gleixner1-6/+7
If the allocation of the error skb fails, we still want to see the error statistics. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Fix berr reportingThomas Gleixner1-10/+6
Reading the LEC type with return (mode & ENABLED) && (status & LEC_MASK); is not guaranteed to return (status & LEC_MASK) if the enabled bit in mode is set. It's guaranteed to return 0 or !=0. Remove the inline function and call unconditionally into the berr_handling code and return early when the reporting is disabled. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Handle state change correctlyThomas Gleixner1-5/+20
If the allocation of an error skb fails, the state change handling returns w/o doing any work. That leaves the interface in a wreckaged state as the internal status is wrong. Split the interface handling and the skb handling. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Do not access skb after net_receive_skb()Thomas Gleixner1-5/+4
There is no guarantee that the skb is in the same state after calling net_receive_skb(). It might be freed or reused. Not really harmful as its a read access, except you turn on the proper debugging options which catch a use after free. The whole can subsystem is full of this. Copy and paste .... Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Make bus off interrupt disable logic workThomas Gleixner1-7/+4
The state change handler is called with device interrupts disabled already. So no point in disabling them again when we enter bus off state. But what's worse is that we reenable the interrupts at the end of NAPI poll unconditionally. So c_can_start() which is called from the restart timer can trigger interrupts which confuse the hell out of the half reinitialized driver/hw. Remove the pointless device interrupt disable in the BUS_OFF handler and prevent reenabling the device interrupts at the end of the poll routine when the current state is BUS_OFF. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can: Fix startup logicThomas Gleixner1-18/+17
c_can_start() enables interrupts way too early. The first enabling happens when setting the control mode in c_can_chip_config() and then again at the end of the function. But that happens before napi_enable() and that means that an interrupt which comes in will disable interrupts again and call napi_schedule, which ignores the request and the later napi_enable() is not making thinks work either. So the interface is up with all device interrupts disabled. Move the device interrupt after napi_enable() and add it to the other callsites of c_can_start() in c_can_set_mode() and c_can_power_up() Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-24can: c_can_pci: Set the type of the IP coreThomas Gleixner1-0/+2
All type checks in c_can.c are != BOSCH_D_CAN so nobody noticed so far that the pci code does not update the type information. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-07Kconfig: rename HAS_IOPORT to HAS_IOPORT_MAPUwe Kleine-König1-1/+1
If the renamed symbol is defined lib/iomap.c implements ioport_map and ioport_unmap and currently (nearly) all platforms define the port accessor functions outb/inb and friend unconditionally. So HAS_IOPORT_MAP is the better name for this. Consequently NO_IOPORT is renamed to NO_IOPORT_MAP. The motivation for this change is to reintroduce a symbol HAS_IOPORT that signals if outb/int et al are available. I will address that at least one merge window later though to keep surprises to a minimum and catch new introductions of (HAS|NO)_IOPORT. The changes in this commit were done using: $ git grep -l -E '(NO|HAS)_IOPORT' | xargs perl -p -i -e 's/\b((?:CONFIG_)?(?:NO|HAS)_IOPORT)\b/$1_MAP/' Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-04-01Merge tag 'linux-can-fixes-for-3.15-20140401' of ↵David S. Miller4-161/+265
git://gitorious.org/linux-can/linux-can linux-can-fixes-for-3.15-20140401 Marc Kleine-Budde says: ==================== this is a pull request of 16 patches for the 3.15 release cycle. Bjorn Van Tilt contributes a patch which fixes a memory leak in usb_8dev's usb_8dev_start_xmit()s error path. A patch by Robert Schwebel fixes a typo in the can documentation. The remaining patches all target the c_can driver. Two of them are by me; they add a missing netif_napi_del() and return value checking. Thomas Gleixner contributes 12 patches, which address several shortcomings in the driver like hardware initialisation, concurrency, message ordering and poor performance. ==================== Signed-off-by: David S. Miller <[email protected]>
2014-04-01can: c_can: Avoid led toggling for every packet.Thomas Gleixner1-3/+4
There is no point to toggle the RX led for every packet. Especially if we have a full FIFO we want to avoid everything we can. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Simplify TX interrupt cleanupThomas Gleixner1-20/+17
The function loads the message object from the hardware to get the payload length. The previous patch stores that information in an array, so we can avoid the hardware access. Remove the hardware access and move the led toggle outside of the spinlocked region. Toggle the led only once when at least one packet has been received. Binary size shrinks along with the code Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Store dlc privateThomas Gleixner2-27/+29
We can avoid the HW access in TX cleanup path for retrieving the DLC of the sent package if we store the DLC in a private array. Ideally this should be handled in the can_echo_skb functions, but I leave that exercise to the CAN folks. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Reduce register accessThomas Gleixner1-34/+15
commit 4ce78a838c (can: c_can: Speed up rx_poll function) hyped a performance improvement by reducing the access to the interrupt pending register from a dual 16 bit to a single 16 bit access. Wow! Thereby it crippled the driver to cast the 16 msg objects in stone, which is completly braindead as contemporary hardware has up to 128 message objects. Supporting larger object buffers is a major surgery, but it'd be definitely worth it especially as the driver does not support HW message filtering .... The logic of the "FIFO" implementation is to split the FIFO in half. For the lower half we read the buffers and clear the interrupt pending bit, but keep the newdat bit set, so the HW will queue above those buffers. When we read out the last low buffer then we reenable all the low half buffers by clearing the newdat bit. The upper half buffers clear the newdat and the interrupt pending bit right away as we know that the lower half bits are clear and give us a headstart against the hardware. Now the implementation is: transfer_message_object() read_object_and_put_into_skb(); if (obj < END_OF_LOW_BUF) clear_intpending(obj) else if (obj > END_OF_LOW_BUF) clear_intpending_and_newdat(obj) else if (obj == END_OF_LOW_BUF) clear_newdat_of_all_low_objects() The hardware allows to avoid most of the mess simply because we can tell the transfer_message_object() function to clear bits right away. So we can be clever and do: if (obj <= END_OF_LOW_BUF) ctrl = TRANSFER_MSG | CLEAR_INTPND; else ctrl = TRANSFER_MSG | CLEAR_INTPND | CLEAR_NEWDAT; transfer_message_object(ctrl) read_object_and_put_into_skb(); if (obj == END_OF_LOW_BUF) clear_newdat_of_all_low_objects() So we save a complete control operation on all message objects except the one which is the end of the low buffer. That's a few micro seconds per object. I'm not adding a boasting profile to that, simply because it's self explaining. Signed-off-by: Thomas Gleixner <[email protected]> [mkl: adjusted subject and commit message] Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Make the code readableThomas Gleixner1-51/+56
If every other line contains line breaks, that's a clear sign for indentation level madness. Split out the inner loop and move the code to a separate function. gcc creates slightly worse code for that, but we'll fix that in the next step. Signed-off-by: Thomas Gleixner <[email protected]> [mkl: adjusted subject] Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Provide protection in the xmit pathThomas Gleixner2-1/+9
The network core does not serialize the access to the hardware. The xmit related code lets the following happen: CPU0 CPU1 interrupt() do_poll() c_can_do_tx() Fiddle with HW and xmit() internal data Fiddle with HW and internal data due the complete lack of serialization. Add proper locking. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Remove EOB exitThomas Gleixner1-3/+0
The rx_poll code has the following gem: if (msg_ctrl_save & IF_MCONT_EOB) return num_rx_pkts; The EOB bit is the indicator for the hardware that this is the last configured FIFO object. But this object can contain valid data, if we manage to free up objects before the overrun case hits. Now if the code exits due to the EOB bit set, then this buffer is stale and the interrupt bit and NewDat bit of the buffer are still set. Results in a nice interrupt storm unless we come into an overrun situation where the MSGLST bit gets set. ksoftirqd/0-3 [000] ..s. 79.124101: c_can_poll: rx_poll: val: 00008001 pend 00008001 ksoftirqd/0-3 [000] ..s. 79.124176: c_can_poll: rx_poll: val: 00008000 pend 00008000 ksoftirqd/0-3 [000] ..s. 79.124187: c_can_poll: rx_poll: val: 00008002 pend 00008002 ksoftirqd/0-3 [000] ..s. 79.124256: c_can_poll: rx_poll: val: 00008000 pend 00008000 ksoftirqd/0-3 [000] ..s. 79.124267: c_can_poll: rx_poll: val: 00008000 pend 00008000 The amazing thing is that the check of the MSGLST (aka overrun bit) used to be after the check of the EOB bit. That was "fixed" in commit 5d0f801a2c(can: c_can: Fix RX message handling, handle lost message before EOB). But the author of this "fix" did not even understand that the EOB check is broken as well. Again a simple solution: Remove Signed-off-by: Thomas Gleixner <[email protected]> [mkl: adjusted subject and commit message] Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Fix the lost message handlingThomas Gleixner1-16/+15
The lost message handling is broken in several ways. 1) Clearing the message lost flag is done by writing 0 to the message control register of the object. #define IF_MCONT_CLR_MSGLST (0 << 14) That clears the object buffer configuration in the worst case, which results in a loss of the EOB flag. That leaves the FIFO chain without a limit and causes a complete lockup of the HW 2) In case that the error skb allocation fails, the code happily claims that it handed down a packet. Just an accounting bug, but .... 3) The code adds a lot of pointless overhead to that error case, where we need to get stuff done as fast as possible to avoid more packet loss. - printk an annoying error message - reread the object buffer for nothing Fix is simple again: - Use the already known MSGCTRL content and only clear the MSGLST bit - Fix the buffer accounting by adding a proper return code - Remove the pointless operations Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Fix buffer orderingThomas Gleixner1-2/+50
The buffer handling of c_can has been broken forever. That leads to message reordering: ksoftirqd/0-3 [000] ..s. 79.123776: c_can_poll: rx_poll: val: 00007fff ksoftirqd/0-3 [000] ..s. 79.124101: c_can_poll: rx_poll: val: 00008001 What happens is: CPU HW queue new packet into obj 16 (0-15 are busy) read obj 1-15 return because pending is 0 set pending obj 16 -> pending reg 8000 queue new packet into obj 1 set pending obj 1 -> pending reg 8001 So the current algorithmus reads the newest message first, which violates the ordering rules of CAN. Add proper handling of that situation by analyzing the contents of the pending register for gaps. This does NOT fix the message object corruption which can lead to interrupt storms. Thats addressed in the next patches. Signed-off-by: Thomas Gleixner <[email protected]> [mkl: adjusted subject] Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Make it SMP safeThomas Gleixner1-15/+21
The hardware has two message control interfaces, but the code only uses the first one. So on SMP the following can be observed: CPU0 CPU1 rx_poll() write IF1 xmit() write IF1 write IF1 That results in corrupted message object configurations. The TX/RX is not globally serialized it's only serialized on a core. Simple solution: Let RX use IF1 and TX use IF2 and all is good. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Fix hardware raminit functionThomas Gleixner1-10/+37
The function is broken in several ways: - The function does not wait for the init to complete. That can take quite some microseconds. - No protection against being called for two chips at the same time. SMP is such a new thing, right? Clear the start and the init done bit unconditionally and wait for both bits to be clear. In the enable path set the init bit and wait for the init done bit. Add proper locking. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: Wait for CONTROL_INIT to be clearedThomas Gleixner1-3/+23
According to the documentation the CPU must wait for CONTROL_INIT to be cleared before writing to the baudrate registers. Signed-off-by: Benedikt Spranger <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: check return value to users of c_can_set_bittiming()Marc Kleine-Budde1-12/+22
This patch adds return value checking to all direct and indirect users of c_can_set_bittiming(). Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: c_can: free_c_can_dev(): add missing netif_napi_del()Marc Kleine-Budde1-0/+3
This patch adds the missing netif_napi_del() to the free_c_can_dev() function. Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-04-01can: usb_8dev: Fix memory leak in usb_8dev_start_xmitBjorn Van Tilt1-1/+1
Fixed a memory leak when an error occurred in the transmit function. In the error handling the urb wasn't freed before returning. There was also a call to the usb_unanchor_urb() function but the urb wasn't anchored. Signed-off-by: Bjorn Van Tilt <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-17can: mcp251x: Fix regulators operation without CONFIG_REGULATORAlexander Shiyan1-2/+2
If CONFIG_REGULATOR is not set, devm_regulator_get() returns NULL, so use IS_ERR_OR_NULL() macro for checks. Signed-off-by: Alexander Shiyan <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-17can: populate netdev::dev_id for udev discriminationChristopher R. Baker10-0/+10
My objective is to be able to totally discriminate CAN ports on multi-port cards via udev so as to rename them to semantically interesting/unique names for my system (e.g., "ecuCAN" and "auxCAN" instead of "can0" and "can1"). The following patch assigns the dev_id field to match the channel number on all multi-channel devices. I can only test my two-port Peak PCI card, but it works as expected: ATTRS{dev_id} now expresses the port number and my udev rules now unambiguously pick out and rename my individual CAN ports. Signed-off-by: Christopher R. Baker <[email protected]> Tested-by: Oliver Hartkopp <[email protected]> [PEAK PCAN-USB pro and EMS PCMCIA] Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-17can: Unify MTU settings for CAN interfacesOliver Hartkopp19-6/+30
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 <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: add bittiming check at interface open for CAN FDOliver Hartkopp1-0/+8
Additionally to have the second (data) bitrate available the data bitrate has to be greater or equal to the arbitration bitrate in CAN FD. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: allow to change the device mtu for CAN FD capable devicesOliver Hartkopp1-0/+39
The configuration for CAN FD depends on CAN_CTRLMODE_FD enabled in the driver specific ctrlmode_supported capabilities. The configuration can be done either with the 'fd { on | off }' option in the 'ip' tool from iproute2 or by setting the CAN netdevice MTU to CAN_MTU (16) or to CANFD_MTU (72). Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: introduce the data bitrate configuration for CAN FDOliver Hartkopp1-1/+44
As CAN FD offers a second bitrate for the data section of the CAN frame the infrastructure for storing and configuring this second bitrate is introduced. Improved the readability of the if-statement by inserting some newlines. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: provide a separate bittiming_const parameter to bittiming functionsOliver Hartkopp1-18/+13
As the bittiming calculation functions are to be used with different bittiming_const structures for CAN and CAN FD the direct reference to priv->bittiming_const inside these functions has to be removed. Also moved the check for existing bittiming const to one place. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: move sanity check for bitrate and tq into can_get_bittimingOliver Hartkopp1-14/+15
This patch moves a sanity check in order to have a second user for CAN FD. Also simplify the return value generation in can_get_bittiming() as only correct return values of can_[calc|fixup]_bittiming() lead to a return value of zero. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: only send bitrate data via netlink when availableOliver Hartkopp1-4/+6
When setting the bitrate both can_calc_bittiming() and can_fixup_bittiming() lead to the bitrate variable to be set, when a proper bit timing is available. Only then the bitrate configuration is stored for the device, so checking for priv->bittiming.bitrate is always sufficient. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: preserve skbuff protocol in can_put_echo_skbOliver Hartkopp1-2/+3
The skbuff protocol value was formerly fixed/sanitized to ETH_P_CAN in can_put_echo_skb(). With CAN FD this value has to be preserved. This patch changes the hard assignment of the protocol value to a check of valid protocol values for CAN and CAN FD. Signed-off-by: Oliver Hartkopp <[email protected]> Acked-by: Stephane Grosjean <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-07can: janz-ican3: convert dev_<level> printing to netdev_<level>Marc Kleine-Budde1-34/+30
This patch converts the dev_<level> printing to netdev_<level>, this makes it possible to remove the "struct device *dev" pointer from the "struct ican3_dev". Cc: Ira W. Snyder <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-06can: flexcan: make use of platform_get_device_id()Marc Kleine-Budde1-2/+2
This patch replaces an open coded pdev->id_entry by platform_get_device_id(). Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-06can: flexcan: Remove #ifdef CONFIG_PM_SLEEPMarc Kleine-Budde1-4/+2
This patch removes #ifdef CONFIG_PM_SLEEP to improve compile coverage. Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-06can: mcp251x: Remove #ifdef CONFIG_PM_SLEEPAlexander Shiyan1-5/+2
This patch removes #ifdef CONFIG_PM_SLEEP to improve compile coverage. Signed-off-by: Alexander Shiyan <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-06can: mcp251x: Make driver more quietAlexander Shiyan1-6/+4
This patch moves one diagnostic message used for debugging purposes to dev_dbg() and removes one useless message. Signed-off-by: Alexander Shiyan <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
2014-03-05Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-41/+131
Conflicts: drivers/net/wireless/ath/ath9k/recv.c drivers/net/wireless/mwifiex/pcie.c net/ipv6/sit.c The SIT driver conflict consists of a bug fix being done by hand in 'net' (missing u64_stats_init()) whilst in 'net-next' a helper was created (netdev_alloc_pcpu_stats()) which takes care of this. The two wireless conflicts were overlapping changes. Signed-off-by: David S. Miller <[email protected]>
2014-03-03can: flexcan: factor out soft reset into seperate funtionMarc Kleine-Budde1-9/+17
This patch moves the soft reset into a seperate function. Signed-off-by: Marc Kleine-Budde <[email protected]>