OSDN Git Service

can: c_can: Fix hardware raminit function
authorThomas Gleixner <tglx@linutronix.de>
Tue, 18 Mar 2014 17:19:08 +0000 (17:19 +0000)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 1 Apr 2014 09:54:57 +0000 (11:54 +0200)
commit5bb9cbaa622a2bbde8e307d4e0528dd2c8212a6a
treeafab304c5344009f73aa931cd1f4ec19382105d4
parent9fac1d1ab8e66816c40a235a238357b1f1fc4dee
can: c_can: Fix hardware raminit function

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 <tglx@linutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/c_can/c_can_platform.c