Skip to content

Commit c712b42

Browse files
Phil Elwellpopcornmix
Phil Elwell
authored andcommitted
BCM270x_DT: Configure UART using DT
See: raspberrypi/firmware#393
1 parent b5b5fa6 commit c712b42

File tree

6 files changed

+58
-8
lines changed

6 files changed

+58
-8
lines changed

arch/arm/boot/dts/bcm2708-rpi-b-plus.dts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
intc = &intc;
1717
leds = &leds;
1818
sound = &sound;
19+
uart0 = &uart0;
1920
};
2021

2122
sound: sound {
@@ -53,6 +54,10 @@
5354
status = "okay";
5455
};
5556

57+
&uart0 {
58+
status = "okay";
59+
};
60+
5661
&spi0 {
5762
pinctrl-names = "default";
5863
pinctrl-0 = <&spi0_pins>;
@@ -108,6 +113,8 @@
108113

109114
/ {
110115
__overrides__ {
116+
uart0 = <&uart0>,"status";
117+
uart0_clkrate = <&clk_uart0>,"clock-frequency:0";
111118
i2s = <&i2s>,"status";
112119
spi = <&spi0>,"status";
113120
i2c0 = <&i2c0>,"status";

arch/arm/boot/dts/bcm2708-rpi-b.dts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
intc = &intc;
1717
leds = &leds;
1818
sound = &sound;
19+
uart0 = &uart0;
1920
};
2021

2122
sound: sound {
@@ -53,6 +54,10 @@
5354
status = "okay";
5455
};
5556

57+
&uart0 {
58+
status = "okay";
59+
};
60+
5661
&spi0 {
5762
pinctrl-names = "default";
5863
pinctrl-0 = <&spi0_pins>;
@@ -102,6 +107,8 @@
102107

103108
/ {
104109
__overrides__ {
110+
uart0 = <&uart0>,"status";
111+
uart0_clkrate = <&clk_uart0>,"clock-frequency:0";
105112
i2s = <&i2s>,"status";
106113
spi = <&spi0>,"status";
107114
i2c0 = <&i2c0>,"status";

arch/arm/boot/dts/bcm2708_common.dtsi

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@
8484
status = "disabled";
8585
};
8686

87+
uart0: uart@7e201000 {
88+
compatible = "arm,pl011", "arm,primecell";
89+
reg = <0x7e201000 0x1000>;
90+
interrupts = <2 25>;
91+
clocks = <&clk_uart0 &clk_apb_p>;
92+
clock-names = "uartclk","apb_pclk";
93+
arm,primecell-periphid = <0x00241011>; // For an explanation, see
94+
// https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038
95+
status = "disabled";
96+
};
97+
8798
i2s: i2s@7e203000 {
8899
compatible = "brcm,bcm2708-i2s";
89100
reg = <0x7e203000 0x20>,
@@ -188,5 +199,21 @@
188199
clock-output-names = "spi";
189200
clock-frequency = <250000000>;
190201
};
202+
203+
clk_uart0: clock@3 {
204+
compatible = "fixed-clock";
205+
reg = <3>;
206+
#clock-cells = <0>;
207+
clock-output-names = "uart0_pclk";
208+
clock-frequency = <3000000>;
209+
};
210+
211+
clk_apb_p: clock@4 {
212+
compatible = "fixed-clock";
213+
reg = <4>;
214+
#clock-cells = <0>;
215+
clock-output-names = "apb_pclk";
216+
clock-frequency = <126000000>;
217+
};
191218
};
192219
};

arch/arm/boot/dts/bcm2709-rpi-2-b.dts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
intc = &intc;
1717
leds = &leds;
1818
sound = &sound;
19+
uart0 = &uart0;
1920
};
2021

2122
sound: sound {
@@ -53,6 +54,10 @@
5354
status = "okay";
5455
};
5556

57+
&uart0 {
58+
status = "okay";
59+
};
60+
5661
&spi0 {
5762
pinctrl-names = "default";
5863
pinctrl-0 = <&spi0_pins>;
@@ -108,6 +113,8 @@
108113

109114
/ {
110115
__overrides__ {
116+
uart0 = <&uart0>,"status";
117+
uart0_clkrate = <&clk_uart0>,"clock-frequency:0";
111118
i2s = <&i2s>,"status";
112119
spi = <&spi0>,"status";
113120
i2c0 = <&i2c0>,"status";

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,10 +1020,11 @@ void __init bcm2708_init(void)
10201020
i2c_register_board_info_dt(1, snd_pcm512x_i2c_devices, ARRAY_SIZE(snd_pcm512x_i2c_devices));
10211021
#endif
10221022

1023-
1024-
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
1025-
struct amba_device *d = amba_devs[i];
1026-
amba_device_register(d, &iomem_resource);
1023+
if (!use_dt) {
1024+
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
1025+
struct amba_device *d = amba_devs[i];
1026+
amba_device_register(d, &iomem_resource);
1027+
}
10271028
}
10281029
system_rev = boardrev;
10291030
system_serial_low = serial;

arch/arm/mach-bcm2709/bcm2709.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,11 @@ void __init bcm2709_init(void)
10431043
i2c_register_board_info_dt(1, snd_pcm512x_i2c_devices, ARRAY_SIZE(snd_pcm512x_i2c_devices));
10441044
#endif
10451045

1046-
1047-
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
1048-
struct amba_device *d = amba_devs[i];
1049-
amba_device_register(d, &iomem_resource);
1046+
if (!use_dt) {
1047+
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
1048+
struct amba_device *d = amba_devs[i];
1049+
amba_device_register(d, &iomem_resource);
1050+
}
10501051
}
10511052
system_rev = boardrev;
10521053
system_serial_low = serial;

0 commit comments

Comments
 (0)