Skip to content

Commit f1a78ab

Browse files
committed
overlays: sc16is75x: Add generic SPI overlay
Currently four nearly identical overlays (sc16is750-spi0 / -spi1 and sc16is752-spi0 / -spi1) are provided. Besides the redundant configuration all of them lack support for other SPI interfaces than spi0 and spi1. Thus refactor the common definitions into a generic sc16is75x-spi overlay which provides support for all known spi / cs combinations. Also choose the chip type via dtparam rather than different overlay. In order to keep existing setups keep the old overlays, but add a deprecation message via overlay map. Signed-off-by: Nicolai Buchwitz <n.buchwitz@kunbus.com>
1 parent f5726fb commit f1a78ab

4 files changed

Lines changed: 161 additions & 0 deletions

File tree

arch/arm/boot/dts/overlays/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
254254
sc16is752-i2c.dtbo \
255255
sc16is752-spi0.dtbo \
256256
sc16is752-spi1.dtbo \
257+
sc16is75x-spi.dtbo \
257258
sdhost.dtbo \
258259
sdio.dtbo \
259260
sdio-pi5.dtbo \

arch/arm/boot/dts/overlays/README

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4501,6 +4501,19 @@ Params: int_pin GPIO used for IRQ (default 24)
45014501
xtal On-board crystal frequency (default 14745600)
45024502

45034503

4504+
Name: sc16is75x-spi
4505+
Info: Overlay for the NXP SC16IS750/2 (Dual) UART with SPI Interface
4506+
Enables the chip on SPI.
4507+
4508+
Load: dtoverlay=sc16is75x-spi,<param>=<val>
4509+
Params: sc16is750 Device is a SC16IS750 UART (default on)
4510+
sc16is752 Device is a SC16IS752 Dual UART
4511+
spi<n>-<m> Configure device at spi<n>, cs<m>
4512+
(boolean, required)
4513+
interrupt GPIO used for IRQ (default 24)
4514+
oscillator On-board crystal frequency (default 14745600)
4515+
4516+
45044517
Name: sdhost
45054518
Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock.
45064519
N.B. This overlay is designed for situations where the mmc driver is

arch/arm/boot/dts/overlays/overlay_map.dts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,4 +530,20 @@
530530
bcm2835;
531531
bcm2711;
532532
};
533+
534+
sc16is750-spi0 {
535+
deprecated = "use sc16is75x,spi0-*";
536+
};
537+
538+
sc16is750-spi1 {
539+
deprecated = "use sc16is75x,spi1-*";
540+
};
541+
542+
sc16is752-spi0 {
543+
deprecated = "use sc16is75x,sc16is752,spi0-*";
544+
};
545+
546+
sc16is752-spi1 {
547+
deprecated = "use sc16is75x,sc16is752,spi1-*";
548+
};
533549
};
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2+
3+
/dts-v1/;
4+
/plugin/;
5+
6+
#include <dt-bindings/gpio/gpio.h>
7+
#include <dt-bindings/interrupt-controller/irq.h>
8+
#include <dt-bindings/pinctrl/bcm2835.h>
9+
10+
/ {
11+
compatible = "brcm,bcm2835";
12+
13+
spidev_frag: fragment@0 {
14+
target-path = "spi0/spidev@0";
15+
__overlay__ {
16+
status = "disabled";
17+
};
18+
};
19+
20+
sc16is75x_frag: fragment@1 {
21+
target = <&spi0>;
22+
__overlay__ {
23+
#address-cells = <1>;
24+
#size-cells = <0>;
25+
status = "okay";
26+
27+
sc16is75x: sc16is750@0 {
28+
compatible = "nxp,sc16is750";
29+
reg = <0>;
30+
clocks = <&sc16is75x_clk>;
31+
interrupt-parent = <&gpio>;
32+
interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
33+
pinctrl-0 = <&sc16is75x_pins>;
34+
pinctrl-names = "default";
35+
gpio-controller;
36+
#gpio-cells = <2>;
37+
spi-max-frequency = <4000000>;
38+
};
39+
};
40+
};
41+
42+
fragment@2 {
43+
target-path = "/";
44+
__overlay__ {
45+
sc16is75x_clk: sc16is75x_clk {
46+
compatible = "fixed-clock";
47+
#clock-cells = <0>;
48+
clock-frequency = <14745600>;
49+
};
50+
};
51+
};
52+
53+
fragment@3 {
54+
target = <&gpio>;
55+
__overlay__ {
56+
sc16is75x_pins: sc16is75x_pins@24 {
57+
brcm,pins = <24>;
58+
brcm,function = <BCM2835_FSEL_GPIO_IN>;
59+
brcm,pull = <BCM2835_PUD_OFF>;
60+
};
61+
};
62+
};
63+
64+
__overrides__ {
65+
sc16is750 = <&sc16is75x>,"compatible=nxp,sc16is750",
66+
<&sc16is75x>, "name=sc16is750@0";
67+
sc16is752 = <&sc16is75x>,"compatible=nxp,sc16is752",
68+
<&sc16is75x>, "name=sc16is752@0";
69+
interrupt = <&sc16is75x>,"interrupts:0",
70+
<&sc16is75x_pins>,"brcm,pins:0",
71+
<&sc16is75x_pins>,"reg:0";
72+
oscillator = <&sc16is75x_clk>,"clock-frequency:0";
73+
spi0-0 = <&spidev_frag>, "target-path=spi0/spidev@0",
74+
<&sc16is75x_frag>, "target:0=", <&spi0>,
75+
<&sc16is75x_pins>, "name=sc16is75x_spi0_0_pins";
76+
spi0-1 = <&spidev_frag>, "target-path=spi0/spidev@1",
77+
<&sc16is75x_frag>, "target:0=", <&spi0>,
78+
<&sc16is75x>, "reg:0=1",
79+
<&sc16is75x_pins>, "name=sc16is75x_spi0_1_pins";
80+
spi1-0 = <0>, "-0",
81+
<&sc16is75x_frag>, "target:0=", <&spi1>,
82+
<&sc16is75x_pins>, "name=sc16is75x_spi1_0_pins";
83+
spi1-1 = <0>, "-0",
84+
<&sc16is75x_frag>, "target:0=", <&spi1>,
85+
<&sc16is75x>, "reg:0=1",
86+
<&sc16is75x_pins>, "name=sc16is75x_spi1_1_pins";
87+
spi1-2 = <0>, "-0",
88+
<&sc16is75x_frag>, "target:0=", <&spi1>,
89+
<&sc16is75x>, "reg:0=2",
90+
<&sc16is75x_pins>, "name=sc16is75x_spi1_2_pins";
91+
spi2-0 = <0>, "-0",
92+
<&sc16is75x_frag>, "target:0=", <&spi2>,
93+
<&sc16is75x_pins>, "name=sc16is75x_spi2_0_pins";
94+
spi2-1 = <0>, "-0",
95+
<&sc16is75x_frag>, "target:0=", <&spi2>,
96+
<&sc16is75x>, "reg:0=1",
97+
<&sc16is75x_pins>, "name=sc16is75x_spi2_1_pins";
98+
spi2-2 = <0>, "-0",
99+
<&sc16is75x_frag>, "target:0=", <&spi2>,
100+
<&sc16is75x>, "reg:0=2",
101+
<&sc16is75x_pins>, "name=sc16is75x_spi2_2_pins";
102+
spi3-0 = <0>, "-0",
103+
<&sc16is75x_frag>, "target:0=", <&spi3>,
104+
<&sc16is75x_pins>, "name=sc16is75x_spi3_0_pins";
105+
spi3-1 = <0>, "-0",
106+
<&sc16is75x_frag>, "target:0=", <&spi3>,
107+
<&sc16is75x>, "reg:0=1",
108+
<&sc16is75x_pins>, "name=sc16is75x_spi3_1_pins";
109+
spi4-0 = <0>, "-0",
110+
<&sc16is75x_frag>, "target:0=", <&spi4>,
111+
<&sc16is75x_pins>, "name=sc16is75x_spi4_0_pins";
112+
spi4-1 = <0>, "-0",
113+
<&sc16is75x_frag>, "target:0=", <&spi4>,
114+
<&sc16is75x>, "reg:0=1",
115+
<&sc16is75x_pins>, "name=sc16is75x_spi4_1_pins";
116+
spi5-0 = <0>, "-0",
117+
<&sc16is75x_frag>, "target:0=", <&spi5>,
118+
<&sc16is75x_pins>, "name=sc16is75x_spi5_0_pins";
119+
spi5-1 = <0>, "-0",
120+
<&sc16is75x_frag>, "target:0=", <&spi5>,
121+
<&sc16is75x>, "reg:0=1",
122+
<&sc16is75x_pins>, "name=sc16is75x_spi5_1_pins";
123+
spi6-0 = <0>, "-0",
124+
<&sc16is75x_frag>, "target:0=", <&spi6>,
125+
<&sc16is75x_pins>, "name=sc16is75x_spi6_0_pins";
126+
spi6-1 = <0>, "-0",
127+
<&sc16is75x_frag>, "target:0=", <&spi6>,
128+
<&sc16is75x>, "reg:0=1",
129+
<&sc16is75x_pins>, "name=sc16is75x_spi6_1_pins";
130+
};
131+
};

0 commit comments

Comments
 (0)