Re: can: mcp25xxfd: Reset/Initialization of device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/29/19 11:49 AM, Thomas.Kopp@xxxxxxxxxxxxx wrote:
> When testing the driver and using up/down multiple times on the CAN
> interface I encountered errors with the TEF setup. I noticed that a
> device reset (spi command) is only performed when loading the module
> (in _mcp25xxfd_clock_probe during the initial clock setup.)

> Is there a preference whether or not using up on the interface should
> bring the device into a default state or is this only expected when
> loading the module?

I usually get all resources (clocks, regulators, ...), calculate all
internal stuff during probe. Do a basic check, if the device is
available, i.e. read a status register..., but not configure the device.

Then I do a complete re-initialization of the chip during .ndo_open.

> Are there any limits to how long up can/should take?

How long does it take? :)

> If a default state is desired after using up, I see two options to do this:

Yes, better if a ifdown; ifup fixes a strange problem, than a rmmod;
modprobe.

> 1) Perform the reset procedure the same way it is done during loading
> of the module including setting up the clock again.
> 2) Bring all Registers to their default state "manually" and preserve
> whatever clock was configured initially.

I'd prefer 1), as _all_ registers should be in the default state (unless
they are unaffected by the chip reset).

> If 1) is used, stop can be simplified to perform a reset as well, no

By "stop" you mean the .ndo_stop callback? Better not do a softreset,
but shut down the device properly (manually).

> need to care about resetting fifos etc. This is likely more time
> consuming though. Doing it this way is time consuming because we need
> to do the OSC setup again every time.
> 
> 2) will usually be faster (assuming decent SPI speeds). The downside
> is, that it's heavy on the SPI and we need to have default values for
> all the registers for each supported device.

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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux