Wolfgang Grandegger wrote:
>>> The ixxat pci driver uses a more sophisticated probing mechanism, which
>>> might fit here as well.
>>>
>>>
>> I'll review ixxat driver once again. But I don't understand why
>> sophisticated probing mechanism is be better?
>>
>
> The method above will work with any normal memory location. The method
> from the IXXAT driver will check if the device did come out of the reset
> properly (by taking into account the reset values of the SJA1000). It's
> the more reliable probing method, I believe.
>
It seems, I had found an incomprehensible code in IXXAT driver when I
studied it.
writeb(0x1, base_addr + CHANNEL_RESET_OFFSET);
writeb(0x1, base_addr + CHANNEL_OFFSET + CHANNEL_RESET_OFFSET);
udelay(100);
board->dev[0] = ixxat_pci_add_chan(pdev, base_addr);
if (IS_ERR(board->dev[0]))
goto failure_iounmap;
/* Check if second channel is available */
if ((readb(base_addr + CHANNEL_OFFSET + REG_MOD) & 0xa1) == 0x21 &&
readb(base_addr + CHANNEL_OFFSET + REG_SR) == 0x0c &&
readb(base_addr + CHANNEL_OFFSET + REG_IR) == 0xe0) {
board->dev[1] = ixxat_pci_add_chan(pdev,
base_addr + CHANNEL_OFFSET);
if (IS_ERR(board->dev[1]))
goto failure_unreg_dev0;
intcsr |= INTCSR_LINTI2;
}
As I understand, the IXXAT driver put the SJA1000 into Reset Mode and
after that checks states of some registers with the assumption that the
SJA1000 is in Basic Mode.
And then it register_sja1000dev by calling ixxat_pci_add_chan. But
registering sja1000dev cause switching the SJA1000 into PeliCAN Mode.
I think this check wouldn't work if we unload and then load the IXXAT
driver again because the SJA1000 is in PelicCAN Mode. Is it right?
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core