-
Notifications
You must be signed in to change notification settings - Fork 50
feat: add spi1 to rock2 #374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nascs
wants to merge
12
commits into
radxa-pkg:main
Choose a base branch
from
nascs:rock2_spi1_cs-gpio
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
956b38a
feat: add spi1 to rock2
nascs 812b0d1
Apply suggestions from code review
nascs 01a912b
fix: fix the file name
nascs e56e737
fix: delete num-cs property
nascs bdd0106
feat: add enc28j60 common file
nascs b1cf9c3
feat: port enc28j60 to rk3528
nascs 5bdb9b3
feat: add mcp2515 common file
nascs a3dfe7e
feat: port mcp2515 to rk3528
nascs fe6d841
fix: fix enc28j60 of rk3528
nascs 5b993c2
feat: add w5500 common file
nascs d03187b
feat: port w5500 to rk3528
nascs 1f5c26e
fix: fix spi compilation error
nascs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #ifndef __ENC28J60_DTSI__ | ||
| #define __ENC28J60_DTSI__ | ||
|
|
||
| #include <dt-bindings/gpio/gpio.h> | ||
| #include <dt-bindings/pinctrl/rockchip.h> | ||
| #include <dt-bindings/interrupt-controller/irq.h> | ||
|
|
||
| /dts-v1/; | ||
| /plugin/; | ||
|
|
||
| #if !defined(ENC28J60_SPI) && !defined(SPIDEV_NUM) | ||
| #error "Required macros are undefined: ENC28J60_SPI and SPIDEV_NUM." | ||
| #endif | ||
|
|
||
| &ENC28J60_SPI { | ||
| status = "okay"; | ||
| max-freq = <10000000>; | ||
| #address-cells = <1>; | ||
| #size-cells = <0>; | ||
|
|
||
| ethernet: enc28j60@SPIDEV_NUM { | ||
| compatible = "microchip,enc28j60"; | ||
| reg = <SPIDEV_NUM>; | ||
| spi-max-frequency = <20000000>; | ||
| }; | ||
| }; | ||
|
|
||
| #endif // __ENC28J60_DTSI__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #ifndef __MCP2515_DTSI__ | ||
| #define __MCP2515_DTSI__ | ||
|
|
||
| #include <dt-bindings/gpio/gpio.h> | ||
| #include <dt-bindings/pinctrl/rockchip.h> | ||
| #include <dt-bindings/interrupt-controller/irq.h> | ||
|
|
||
| /dts-v1/; | ||
| /plugin/; | ||
|
|
||
| &{/} { | ||
| can_mcp2515_osc: can-mcp2515-osc { | ||
| compatible = "fixed-clock"; | ||
| clock-frequency = <12000000>; | ||
| #clock-cells = <0>; | ||
| }; | ||
| }; | ||
|
|
||
| #if !defined(MCP2515_SPI) && !defined(SPIDEV_NUM) | ||
| #error "Required macros are undefined: MCP2515_SPI and SPIDEV_NUM." | ||
| #endif | ||
|
|
||
| &MCP2515_SPI { | ||
| status = "okay"; | ||
| max-freq = <10000000>; | ||
| #address-cells = <1>; | ||
| #size-cells = <0>; | ||
|
|
||
| can_mcp2515: can-mcp2515@SPIDEV_NUM { | ||
| status = "okay"; | ||
| compatible = "microchip,mcp2515"; | ||
| reg = <SPIDEV_NUM>; | ||
| clocks = <&can_mcp2515_osc>; | ||
| vdd-supply = <&vcc_3v3_s3>; | ||
| xceiver-supply = <&vcc_3v3_s3>; | ||
| spi-max-frequency = <10000000>; | ||
| }; | ||
| }; | ||
|
|
||
| #endif // __MCP2515_DTSI__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
arch/arm64/boot/dts/rockchip/overlays/rk3528-spi0-cs1-w5500.dts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #define W5500_SPI spi0 | ||
| #define SPIDEV_NUM 1 | ||
| #include "w5500.dtsi" | ||
|
|
||
| / { | ||
| metadata { | ||
| title = "Enable W5500 on SPI0 CS1"; | ||
| compatible = "radxa,rock-2a", "radxa,rock-2f", "radxa,medge-rk3528a-io"; | ||
| category = "misc"; | ||
| exclusive = "GPIO4_B2", "GPIO4_B3", "GPIO4_B4", "GPIO4_C1", "GPIO4_C6"; | ||
| description = "Enable Microchip W5500 SPI Ethernet controller on SPI0 CS1. | ||
| INT=15"; | ||
| }; | ||
| }; | ||
|
|
||
| &pinctrl { | ||
| w5500 { | ||
| w5500_int_pins: w5500-int-pins { | ||
| rockchip,pins = <4 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| ð_w5500 { | ||
| pinctrl-names = "default"; | ||
| pinctrl-0 = <&W5500_int_pins>; | ||
| interrupt-parent = <&gpio4>; | ||
| interrupts = <RK_PC6 IRQ_TYPE_EDGE_FALLING>; | ||
| }; |
34 changes: 34 additions & 0 deletions
34
arch/arm64/boot/dts/rockchip/overlays/rk3528-spi1-cs-gpio-enc28j60.dts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #define ENC28J60_SPI spi1 | ||
| #define SPIDEV_NUM 0 | ||
| #include "enc28j60.dtsi" | ||
|
|
||
| / { | ||
| metadata { | ||
| title = "Enable ENC28J60 on SPI1"; | ||
| compatible = "radxa,rock-2a", "radxa,rock-2f", "radxa,medge-rk3528a-io"; | ||
| category = "misc"; | ||
| exclusive = "GPIO1_B4", "GPIO1_B6", "GPIO1_B7", "GPIO1_C0", "GPIO4_B6"; | ||
| description = "Enable Microchip ENC28J60 SPI Ethernet controller on SPI1. | ||
| INT=36"; | ||
| }; | ||
| }; | ||
|
|
||
| &pinctrl { | ||
| enc28j60 { | ||
| enc28j60_int_pins: enc28j60-int-pins { | ||
| rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| &ENC28J60_SPI { | ||
| cs-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_LOW>; | ||
| pinctrl-0 = <&spi1_pins>; | ||
| }; | ||
|
|
||
| ðernet { | ||
| pinctrl-names = "default"; | ||
| pinctrl-0 = <&enc28j60_int_pins>; | ||
| interrupt-parent = <&gpio1>; | ||
| interrupts = <RK_PB4 IRQ_TYPE_EDGE_FALLING>; | ||
| }; |
35 changes: 35 additions & 0 deletions
35
arch/arm64/boot/dts/rockchip/overlays/rk3528-spi1-cs-gpio-mcp2515.dts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #define MCP2515_SPI spi1 | ||
| #define SPIDEV_NUM 0 | ||
| #include "mcp2515.dtsi" | ||
|
|
||
| / { | ||
| metadata { | ||
| title = "Enable MCP2515 on SPI1"; | ||
| compatible = "radxa,rock-2a", "radxa,rock-2f", "radxa,medge-rk3528a-io"; | ||
| category = "misc"; | ||
| exclusive = "GPIO1_B4", "GPIO1_B6", "GPIO1_B7", "GPIO1_C0", "GPIO4_B6"; | ||
| description = "Enable MCP2515 on SPI1 Over pin 36 with 12 MHz Crystal Oscillator. | ||
| INT=36"; | ||
| }; | ||
| }; | ||
|
|
||
| &pinctrl { | ||
| mcp2515_int_pin { | ||
| mcp2515_int_pin: mcp2515_int_pin { | ||
| rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| &MCP2515_SPI { | ||
| pinctrl-names = "default"; | ||
| pinctrl-0 = <&spi1_pins>; | ||
| cs-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_LOW>; | ||
| }; | ||
|
|
||
| &can_mcp2515 { | ||
| interrupt-parent = <&gpio1>; | ||
| interrupts = <RK_PB4 IRQ_TYPE_EDGE_FALLING>; | ||
| pinctrl-names = "default"; | ||
| pinctrl-0 = <&mcp2515_int_pin>; | ||
| }; | ||
31 changes: 31 additions & 0 deletions
31
arch/arm64/boot/dts/rockchip/overlays/rk3528-spi1-cs-gpio-spidev.dts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /dts-v1/; | ||
| /plugin/; | ||
| #include <dt-bindings/gpio/gpio.h> | ||
| #include <dt-bindings/pinctrl/rockchip.h> | ||
|
|
||
| / { | ||
| metadata { | ||
| title = "Enable spidev on SPI1"; | ||
| compatible = "radxa,rock-2a", "radxa,rock-2f", "radxa,medge-rk3528a-io"; | ||
| category = "misc"; | ||
| exclusive = "GPIO1_B6", "GPIO1_B7", "GPIO1_C0", "GPIO4_B6"; | ||
| description = "Enable spidev on SPI1. | ||
| CS pin is located on pin 24."; | ||
| }; | ||
| }; | ||
|
|
||
| &spi1 { | ||
| status = "okay"; | ||
| #address-cells = <1>; | ||
| #size-cells = <0>; | ||
| max-freq = <50000000>; | ||
| cs-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_LOW>; | ||
| pinctrl-0 = <&spi1_pins>; | ||
|
|
||
| spidev@0 { | ||
| compatible = "rockchip,spidev"; | ||
| status = "okay"; | ||
| reg = <0>; | ||
| spi-max-frequency = <50000000>; | ||
| }; | ||
| }; |
34 changes: 34 additions & 0 deletions
34
arch/arm64/boot/dts/rockchip/overlays/rk3528-spi1-cs-gpio-w5500.dts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #define W5500_SPI spi0 | ||
| #define SPIDEV_NUM 1 | ||
| #include "w5500.dtsi" | ||
|
|
||
| / { | ||
| metadata { | ||
| title = "Enable W5500 on SPI1"; | ||
| compatible = "radxa,rock-2a", "radxa,rock-2f", "radxa,medge-rk3528a-io"; | ||
| category = "misc"; | ||
| exclusive = "GPIO1_B4", "GPIO1_B6", "GPIO1_B7", "GPIO1_C0", "GPIO4_B6"; | ||
| description = "Enable Microchip W5500 SPI Ethernet controller on SPI1. | ||
| INT=15"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 怎么其他的是36? |
||
| }; | ||
| }; | ||
|
|
||
| &pinctrl { | ||
| w5500 { | ||
| w5500_int_pins: w5500-int-pins { | ||
| rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| &W5500_SPI { | ||
| cs-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_LOW>; | ||
| pinctrl-0 = <&spi1_pins>; | ||
| }; | ||
|
|
||
| ð_w5500 { | ||
| pinctrl-names = "default"; | ||
| pinctrl-0 = <&w5500_int_pins>; | ||
| interrupt-parent = <&gpio1>; | ||
| interrupts = <RK_PB4 IRQ_TYPE_EDGE_FALLING>; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #ifndef __W5500_DTSI__ | ||
| #define __W5500_DTSI__ | ||
|
|
||
| #include <dt-bindings/gpio/gpio.h> | ||
| #include <dt-bindings/pinctrl/rockchip.h> | ||
| #include <dt-bindings/interrupt-controller/irq.h> | ||
|
|
||
| /dts-v1/; | ||
| /plugin/; | ||
|
|
||
| #if !defined(W5500_SPI) && !defined(SPIDEV_NUM) | ||
| #error "Required macros are undefined: W5500_SPI and SPIDEV_NUM." | ||
| #endif | ||
|
|
||
| &W5500_SPI{ | ||
| status = "okay"; | ||
| #address-cells = <1>; | ||
| #size-cells = <0>; | ||
|
|
||
| eth_w5500: eth-w5500@0 { | ||
| status = "okay"; | ||
| compatible = "wiznet,w5500"; | ||
| reg = <0>; | ||
| spi-max-frequency = <30000000>; | ||
| }; | ||
| }; | ||
|
|
||
| #endif // __W5500_DTSI__ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
怎么其他的没有这个属性?