On 9/24/20 9:33 AM, Kurt Van Dijck wrote: >>>> DT: >>>> can0: can@0 { >>>> compatible = "microchip,mcp25xxfd"; >>>> reg = <0>; >>>> clocks = <&can3_osc>; >>>> spi-max-frequency = <85000000>; >> >>> I did not experience issues by using the real 20MHz upper limit here. >> >> Not quite... > > Well, the driver calculated things correctly, and it chose some 8.xx MHz > to use. I didn't need to limit the spi-max-frequency manually. ACK I wanted to point out that really using OSC/2 for SPI would be a problem, but the driver takes care of that now. >>>> interrupts-extended = <&gpio1 18 IRQ_TYPE_LEVEL_LOW>; >>>> status = "okay"; >>>> }; >>>> >>>> # dmesg | grep mcp >>>> [ 3.706085] mcp25xxfd spi1.0 can0: MCP2518FD rev0.0 (-RX_INT >>>> -MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:20.00MHz m:8.50MHz >>>> r:8.50MHz e:0.00MHz) successfully initialized. >>> >>> off-topic: >>> Variscite deploys a 20HHz oscillator, which brings the max spi frequency >>> down to +/- 8.5MHz. >>> After discussion with Thomas Kopp, I learned that microchip uses a 40MHz >>> oscillator, to arrive (close to) 20MHz spi freq. >>> Would you not use a 40MHz oscillator too? >> >> According to the debug output the can3_osc is 20 MHz. According to the datasheet >> this makes 10 MHz SPI clock, however it turns out, you can only use 85% of that >> to avoid stability problems. The driver takes care of the 85%, so you don't have >> to specify this in the DT. > > I would have liked if Variscite had better investigated how to provide > the best performance using the chip. Instead, someone read '20MHz max spi frequency', > and put a 20MHz oscillator on the board. ACK, I've seen several board that are doing that "mistake". > Since Matthias uses 'custom iMX6ULL based hardware', I assumed they made > the same mistake. probably.... > my point here was that they could supply a 40MHz clock, and the driver would then > derive the spi max frequency to 0.85*20MHz = 17MHz. Things goes twice as > fast then. Let's say the bits on the SPI bus are transferred twice as fast, the overall system load isn't. regards, 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: OpenPGP digital signature