* [PATCH v1] can: c_can: Enable interrupts only when initialization has been completed
@ 2014-04-02 17:28 Oleksandr Tyshchenko
2014-04-24 22:07 ` Marc Kleine-Budde
0 siblings, 1 reply; 2+ messages in thread
From: Oleksandr Tyshchenko @ 2014-04-02 17:28 UTC (permalink / raw)
To: linux-can; +Cc: wg, mkl
In current driver realization we enable interrupts twice from c_can_start().
First time in c_can_start()->c_can_chip_config() during set operating mode.
Second time in the end of c_can_start() after finish basic controller
configuration.
Enabling interrupts in first place (while initialization is ongoing)
may cause to interrupts when the CAN chip is not completely initialized.
Also if basic controller configuration failed with error,
we will leave initialization sequence with interrupts enabled.
We have to enable interrupts only when initialization has been completed.
So, don't enable interrupts while initialization is ongoing.
Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
---
drivers/net/can/c_can/c_can.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 6883938..3ce776e8 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -642,24 +642,18 @@ static int c_can_chip_config(struct net_device *dev)
if ((priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) &&
(priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)) {
/* loopback + silent mode : useful for hot self-test */
- priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_EIE |
- CONTROL_SIE | CONTROL_IE | CONTROL_TEST);
+ priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_TEST);
priv->write_reg(priv, C_CAN_TEST_REG,
TEST_LBACK | TEST_SILENT);
} else if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK) {
/* loopback mode : useful for self-test function */
- priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_EIE |
- CONTROL_SIE | CONTROL_IE | CONTROL_TEST);
+ priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_TEST);
priv->write_reg(priv, C_CAN_TEST_REG, TEST_LBACK);
} else if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) {
/* silent mode : bus-monitoring mode */
- priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_EIE |
- CONTROL_SIE | CONTROL_IE | CONTROL_TEST);
+ priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_TEST);
priv->write_reg(priv, C_CAN_TEST_REG, TEST_SILENT);
- } else
- /* normal mode*/
- priv->write_reg(priv, C_CAN_CTRL_REG,
- CONTROL_EIE | CONTROL_SIE | CONTROL_IE);
+ }
/* configure message objects */
c_can_configure_msg_objects(dev);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] can: c_can: Enable interrupts only when initialization has been completed
2014-04-02 17:28 [PATCH v1] can: c_can: Enable interrupts only when initialization has been completed Oleksandr Tyshchenko
@ 2014-04-24 22:07 ` Marc Kleine-Budde
0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2014-04-24 22:07 UTC (permalink / raw)
To: Oleksandr Tyshchenko, linux-can; +Cc: wg
[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]
On 04/02/2014 07:28 PM, Oleksandr Tyshchenko wrote:
> In current driver realization we enable interrupts twice from c_can_start().
> First time in c_can_start()->c_can_chip_config() during set operating mode.
> Second time in the end of c_can_start() after finish basic controller
> configuration.
>
> Enabling interrupts in first place (while initialization is ongoing)
> may cause to interrupts when the CAN chip is not completely initialized.
> Also if basic controller configuration failed with error,
> we will leave initialization sequence with interrupts enabled.
>
> We have to enable interrupts only when initialization has been completed.
> So, don't enable interrupts while initialization is ongoing.
>
> Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
Can you please rebase this to
git://gitorious.org/linux-can/linux-can.git
tags/linux-can-fixes-for-3.15-20140424
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-24 22:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-02 17:28 [PATCH v1] can: c_can: Enable interrupts only when initialization has been completed Oleksandr Tyshchenko
2014-04-24 22:07 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).