171 | | In order to support {{{spidev}}} a spidev child node needs to be present in the device-tree under the SPI host controller. For example, a GW54xx which brings out the ecspi2 host interface: |
| 171 | In order to support {{{spidev}}} a spidev child node needs to be present in the device-tree under the SPI host controller. |
| 172 | |
| 173 | Examples: |
| 174 | * Venice: |
| 175 | - GW71xx (imx8mm-venice-gw71xx.dtsi), GW72xx (imx8mm-venice-gw72xx.dtsi), and GW73xx (imx8mm-venice-gw73xx.dtsi) all provide ecspi2 to an off-board connector with GPIO5_IO13 as a chip select: |
| 176 | {{{#!c |
| 177 | /* off-board header */ |
| 178 | &ecspi2 { |
| 179 | pinctrl-names = "default"; |
| 180 | pinctrl-0 = <&pinctrl_spi2>; |
| 181 | cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>; |
| 182 | status = "okay"; |
| 183 | |
| 184 | /* |
| 185 | * SPI_CS0 goes to the off-board connector |
| 186 | * compatible must match a string from drivers/spi/spidev.c's compatible list |
| 187 | */ |
| 188 | spidev0: spidev0@0 { |
| 189 | compatible = "rohm,dh2228fv"; |
| 190 | reg = <0>; |
| 191 | spi-max-frequency = <10000000>; |
| 192 | }; |
| 193 | }; |
| 194 | }}} |
| 195 | * Newport: |
| 196 | - GW620x/GW630x/GW640x which has a single SPI controller with 2 chip selects, with CS0 going to an off-board connector and CS1 used for a CAN controller (loaded on GW6204/GW6304/GW6404 boards). Change dts/gw620x-linux.dtsi, dts/gw630x-linux.dtsi dts/gw640x-linux.dtsi to: |
| 197 | {{{#!c |
| 198 | &spi_7_0 { |
| 199 | /* |
| 200 | * SPI_CS0 goes to the off-board connector |
| 201 | * compatible must match a string from drivers/spi/spidev.c's compatible list |
| 202 | */ |
| 203 | spidev0: spidev0@0 { |
| 204 | compatible = "rohm,dh2228fv"; |
| 205 | reg = <0>; |
| 206 | spi-max-frequency = <10000000>; |
| 207 | }; |
| 208 | |
| 209 | /* |
| 210 | * SPI_CS1 goes to the Microchip MCP2515 CAN controller (GW6204/GW6304/GW6404) |
| 211 | */ |
| 212 | can0: can@1 { |
| 213 | compatible = "microchip,mcp2515","linux,spidev"; |
| 214 | reg = <1>; |
| 215 | clocks = <&can20m>; |
| 216 | oscillator-frequency = <20000000>; |
| 217 | interrupt-parent = <&gpio_6_0>; |
| 218 | interrupts = <5 0x8>; /* IRQ_TYPE_LEVEL_LOW */ |
| 219 | spi-max-frequency = <10000000>; |
| 220 | }; |
| 221 | }; |
| 222 | }}} |
| 223 | - GW610x which has a single SPI controller with 2 chip selects, with CS0 going to an off-board connector. Change dts/gw610x-linux.dtsi to add the following at the end: |
| 224 | {{{#!c |
| 225 | &spi_7_0 { |
| 226 | /* |
| 227 | * SPI_CS0 goes to the off-board connector |
| 228 | * compatible must match a string from drivers/spi/spidev.c's compatible list |
| 229 | */ |
| 230 | spidev0: spidev0@0 { |
| 231 | compatible = "rohm,dh2228fv"; |
| 232 | reg = <0>; |
| 233 | spi-max-frequency = <10000000>; |
| 234 | }; |
| 235 | }; |
| 236 | }}} |
| 237 | * Ventana: |
| 238 | - GW54xx (arch/arm/boot/dts/imx6qdl-gw52xx.dtsi) which brings out the ecspi2 host interface to an off-board connector with GPIO2_IO26 as a chip select: |
| 253 | - GW52xx (arch/arm/boot/dts/imx6qdl-gw53xx.dtsi) which brings out the ecspi3 host interface to an off-board connector with GPIO4_IO24 as a chip select: |
| 254 | {{{#!c |
| 255 | &ecspi3 { |
| 256 | cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>; |
| 257 | pinctrl-names = "default"; |
| 258 | pinctrl-0 = <&pinctrl_ecspi3>; |
| 259 | status = "okay"; |
| 260 | |
| 261 | spidev0: spidev@0 { |
| 262 | compatible = "rohm,dh2228fv"; |
| 263 | reg = <0>; |
| 264 | spi-max-frequency = <60000000>; |
| 265 | }; |
| 266 | }; |
| 267 | }}} |
| 268 | |
| 269 | In the above examples, adjust 'spi-max-frequency' according to the max frequency your slave device can support. |