1. 21 7月, 2012 32 次提交
  2. 20 7月, 2012 8 次提交
    • I
      can: janz-ican3: add support for one shot mode · 3b5c6b9e
      Ira W. Snyder 提交于
      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: NIra W. Snyder <iws@ovro.caltech.edu>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      3b5c6b9e
    • I
      can: janz-ican3: avoid firmware lockup caused by infinite bus error quota · 30df5888
      Ira W. Snyder 提交于
      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: NIra W. Snyder <iws@ovro.caltech.edu>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      30df5888
    • I
      can: janz-ican3: fix support for CAN_RAW_RECV_OWN_MSGS · 83702f69
      Ira W. Snyder 提交于
      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: NIra W. Snyder <iws@ovro.caltech.edu>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      83702f69
    • I
      can: janz-ican3: fix error and byte counters · 88b58703
      Ira W. Snyder 提交于
      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: NIra W. Snyder <iws@ovro.caltech.edu>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      88b58703
    • M
      can: janz-ican3: cleanup of ican3_to_can_frame and can_frame_to_ican3 · 9e4d6909
      Marc Kleine-Budde 提交于
      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: NIra W. Snyder <iws@ovro.caltech.edu>
      Tested-by: NIra W. Snyder <iws@ovro.caltech.edu>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      9e4d6909
    • I
      can: janz-ican3: drop invalid skbs · 007890d7
      Ira W. Snyder 提交于
      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: NIra W. Snyder <iws@ovro.caltech.edu>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      007890d7
    • I
      can: janz-ican3: remove dead code · 8456a919
      Ira W. Snyder 提交于
      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: NIra W. Snyder <iws@ovro.caltech.edu>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      8456a919
    • S
      can: flexcan: add 2nd clock to support imx53 and newer · 3d42a379
      Steffen Trumtrar 提交于
      This patch adds support for a second clock to the flexcan driver. On
      modern freescale ARM cores like the imx53 and imx6q two clocks ("ipg"
      and "per") must be enabled in order to access the CAN core.
      
      In the original driver, the clock was requested without specifying the
      connection id, further all mainline ARM archs with flexcan support
      (imx28, imx25, imx35) register their flexcan clock without a
      connection id, too.
      
      This patch first renames the existing clk variable to clk_ipg and
      converts it to devm for easier error handling. The connection id "ipg"
      is added to the devm_clk_get() call. Then a second clock "per" is
      requested. As all archs don't specify a connection id, both clk_get
      return the same clock. This ensures compatibility to existing flexcan
      support and adds support for imx53 at the same time.
      
      After this patch hits mainline, the archs may give their existing
      flexcan clock the "ipg" connection id and implement a dummy "per"
      clock.
      
      This patch has been tested on imx28 (unmodified clk tree) and on imx53
      with a seperate "ipg" and "per" clock.
      
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Signed-off-by: NSteffen Trumtrar <s.trumtrar@pengutronix.de>
      Acked-by: NHui Wang <jason77.wang@gmail.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      3d42a379