]> git.karo-electronics.de Git - karo-tx-linux.git/commit
can: ifi: Fix clock generator configuration
authorMarek Vasut <marex@denx.de>
Thu, 3 Mar 2016 19:45:55 +0000 (20:45 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 10 Mar 2016 09:19:09 +0000 (10:19 +0100)
commit99312c377f82f91e7754aefe42f64b619b295fd6
tree09fc91851a47c2c230c9b02401d8aeba5837545b
parent3b8377dca1fd1974d245b2a04a708fc434761c65
can: ifi: Fix clock generator configuration

The clock generation does not match reality when using the CAN IP
core outside of the FPGA design. This patch fixes the computation
of values which are programmed into the clock generator registers.

First, there are some off-by-one errors which manifest themselves
only when communicating with different controller, so those are
fixed.

Second, the bits in the clock generator registers have different
meaning depending on whether the core is in ISO CANFD mode or any
of the other modes (BOSCH CANFD or CAN2.0). Detect the ISO CANFD
mode and fix handling of this special case of clock configuration.

Finally, the CAN clock speed is in CANCLOCK register, not SYSCLOCK
register, so fix this as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/ifi_canfd/ifi_canfd.c