On 01.06.2021 09:21:07, Torin Cooper-Bennun wrote: > On Wed, May 26, 2021 at 05:20:45PM +0200, Marc Kleine-Budde wrote: > > On 26.05.2021 13:47:42, Torin Cooper-Bennun wrote: > > > TCAN4550 shutdown is attempted by setting the device into standby mode. > > > There is probably a better way, but I understand we are limited by being > > > in the ISR context. > > > > Not exactly. The tcan's ISR runs in a threaded context, so you can > > basically do normal SPI or regmap transactions, shut down clocks and > > regulators, etc... > > Got you. I keep forgetting that detail! > > Would it be sufficient to change the CAN state as follows? > > | if (handled == IRQ_HANDLED) { > | netdev_err(cdev->net, > | "Device is disabled by driver.\n"); > | > | cdev->can.state = CAN_STATE_STOPPED; > | > | err = regmap_update_bits(priv->regmap, TCAN4X5X_CONFIG, > | TCAN4X5X_MODE_SEL_MASK, > | TCAN4X5X_MODE_STANDBY); > | if (err) > | goto exit_regmap_failure; > | } I think there already is a function to stop the m-can core: | m_can_stop(struct net_device *dev) You have remove the static to use it from the tcan4x5x, though. If this function doesn't stop the tcan properly, you might have to add another callback. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Attachment:
signature.asc
Description: PGP signature