
Back to SPI1 solution....

PS:
Perhaps it would be easier to use SPI1 for the light control so no specific driver is needed.
Code: Select all
sudo apt-get update
sudo apt-get install device-tree-compiler
dtc [email protected] -I dts -O dtb -o miscap-overlay.dtb miscap-overlay.dts
sudo cp miscap-overlay.dtb /boot/overlays
Code: Select all
/*
Overlay for MisCap pHAT for the Microchip ENC28J60 Ethernet Controller
and 2-channel PWM Audio on GPIO 12,13
Enables SPI0 using spi-bcm2835 driver with additional CE3 on GPIO 5 and CE2 on GPIO 6
*/
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
/* SPI0 */
[email protected] {
target = <&gpio>;
__overlay__ {
spi0_pins: spi0_pins {
brcm,pins = <7 8 9 10 11>;
brcm,function = <4>; /* alt0 */
};
};
};
[email protected] {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
status = "okay";
cs-gpios = <0>, <0>, <&gpio 6 1>, <&gpio 5 1>;
/*The first two <0>s request that native CS's 0 and 1 are used
(even though the driver will convert them to GPIO CS's),
and GPIO's 6 and 5 are used as active-low chip selects 2 and 3. */
[email protected]{
compatible = "spidev";
reg = <0>; /* CE0 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <500000>;
};
[email protected]{
compatible = "spidev";
reg = <1>; /* CE1 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <500000>;
};
[email protected]{
compatible = "spidev";
reg = <2>; /* CE2 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <500000>;
};
[email protected]{
compatible = "spidev";
reg = <3>; /* CE3 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <500000>;
};
};
};
/*reserve the extra GPIO 5 and 6 so no other drivers can claim them + mark them as outputs */
[email protected] {
target = <&gpio>;
__overlay__ {
spi0_cs_pins: spi0_cs_pins {
brcm,pins = <5 6>;
brcm,function = <1>; /* out */
};
};
};
/* enc28j60 enthernet */
[email protected] {
target = <&spi0>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
[email protected]{
status = "disabled";
};
eth1: [email protected]{
compatible = "microchip,enc28j60";
reg = <0>; /* CE0 */
pinctrl-names = "default";
pinctrl-0 = <ð1_pins>;
interrupt-parent = <&gpio>;
interrupts = <25 0x2>; /* falling edge */
spi-max-frequency = <12000000>;
status = "okay";
};
};
};
[email protected] {
target = <&gpio>;
__overlay__ {
eth1_pins: eth1_pins {
brcm,pins = <25>;
brcm,function = <0>; /* in */
brcm,pull = <0>; /* none */
};
};
};
/* PWM */
[email protected] {
target = <&gpio>;
__overlay__ {
pwm_pins: pwm_pins {
brcm,pins = <12 13>;
brcm,function = <4 4>; /* Alt0 */
};
};
};
[email protected] {
target = <&pwm>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&pwm_pins>;
status = "okay";
};
};
};
Code: Select all
dtparam=i2c_vc=on
Code: Select all
dtparam=i2c_vc=on
Code: Select all
/* Audio */
[email protected] {
target = <&audio_pins>;
__overlay__ {
brcm,pins = <12 13>;
brcm,function = <4>; /* alt0 */
};
};