Skip to content

Commit 51fe8aa

Browse files
committed
Merge pull request #1008 from notro/uart1
BCM270x: Make uart1 work with Device Tree
2 parents 049f569 + b3b5b3d commit 51fe8aa

File tree

7 files changed

+38
-45
lines changed

7 files changed

+38
-45
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
audio = &audio;
1919
sound = &sound;
2020
uart0 = &uart0;
21+
uart1 = &uart1;
2122
clocks = &clocks;
2223
};
2324

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
audio = &audio;
1919
sound = &sound;
2020
uart0 = &uart0;
21+
uart1 = &uart1;
2122
clocks = &clocks;
2223
};
2324

arch/arm/boot/dts/bcm2708-rpi-cm.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
audio = &audio;
1414
sound = &sound;
1515
uart0 = &uart0;
16+
uart1 = &uart1;
1617
clocks = &clocks;
1718
};
1819

arch/arm/boot/dts/bcm2708_common.dtsi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@
134134
status = "disabled";
135135
};
136136

137+
uart1: uart@7e215040 {
138+
compatible = "brcm,bcm2835-aux-uart", "ns16550";
139+
reg = <0x7e215040 0x40>;
140+
interrupts = <1 29>;
141+
clock-frequency = <500000000>;
142+
reg-shift = <2>;
143+
no-loopback-test;
144+
status = "disabled";
145+
};
146+
137147
i2c1: i2c@7e804000 {
138148
compatible = "brcm,bcm2708-i2c";
139149
reg = <0x7e804000 0x1000>;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
audio = &audio;
1919
sound = &sound;
2020
uart0 = &uart0;
21+
uart1 = &uart1;
2122
clocks = &clocks;
2223
};
2324

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -353,28 +353,6 @@ static struct platform_device bcm2708_fb_device = {
353353
},
354354
};
355355

356-
static struct plat_serial8250_port bcm2708_uart1_platform_data[] = {
357-
{
358-
.mapbase = UART1_BASE + 0x40,
359-
.irq = IRQ_AUX,
360-
.uartclk = 500000000,
361-
.regshift = 2,
362-
.iotype = UPIO_MEM,
363-
.flags = UPF_SHARE_IRQ | UPF_FIXED_TYPE | UPF_FIXED_PORT |
364-
UPF_IOREMAP | UPF_SKIP_TEST,
365-
.type = PORT_16550,
366-
},
367-
{},
368-
};
369-
370-
static struct platform_device bcm2708_uart1_device = {
371-
.name = "serial8250",
372-
.id = PLAT8250_DEV_PLATFORM,
373-
.dev = {
374-
.platform_data = bcm2708_uart1_platform_data,
375-
},
376-
};
377-
378356
static struct resource bcm2708_usb_resources[] = {
379357
[0] = {
380358
.start = USB_BASE,
@@ -897,6 +875,17 @@ static void bcm2708_power_off(void)
897875
}
898876
}
899877

878+
static void __init bcm2708_init_uart1(void)
879+
{
880+
struct device_node *np;
881+
882+
np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart");
883+
if (of_device_is_available(np)) {
884+
pr_info("bcm2708: Mini UART enabled\n");
885+
writel(1, __io_address(UART1_BASE + 0x4));
886+
}
887+
}
888+
900889
#ifdef CONFIG_OF
901890
static void __init bcm2708_dt_init(void)
902891
{
@@ -952,13 +941,13 @@ void __init bcm2708_init(void)
952941
bcm_register_device(&bcm2708_systemtimer_device);
953942
bcm_register_device_dt(&bcm2708_fb_device);
954943
bcm_register_device_dt(&bcm2708_usb_device);
955-
bcm_register_device(&bcm2708_uart1_device);
956944
bcm_register_device(&bcm2708_powerman_device);
957945

958946
#ifdef CONFIG_MMC_BCM2835
959947
bcm_register_device_dt(&bcm2835_emmc_device);
960948
#endif
961949
bcm2708_init_led();
950+
bcm2708_init_uart1();
962951

963952
/* Only create the platform devices for the ALSA driver in the
964953
absence of an enabled "audio" DT node */

arch/arm/mach-bcm2709/bcm2709.c

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -363,27 +363,6 @@ static struct platform_device bcm2708_fb_device = {
363363
},
364364
};
365365

366-
static struct plat_serial8250_port bcm2708_uart1_platform_data[] = {
367-
{
368-
.mapbase = UART1_BASE + 0x40,
369-
.irq = IRQ_AUX,
370-
.uartclk = 125000000,
371-
.regshift = 2,
372-
.iotype = UPIO_MEM,
373-
.flags = UPF_FIXED_TYPE | UPF_IOREMAP | UPF_SKIP_TEST,
374-
.type = PORT_8250,
375-
},
376-
{},
377-
};
378-
379-
static struct platform_device bcm2708_uart1_device = {
380-
.name = "serial8250",
381-
.id = PLAT8250_DEV_PLATFORM,
382-
.dev = {
383-
.platform_data = bcm2708_uart1_platform_data,
384-
},
385-
};
386-
387366
static struct resource bcm2708_usb_resources[] = {
388367
[0] = {
389368
.start = USB_BASE,
@@ -918,6 +897,17 @@ static void bcm2709_power_off(void)
918897
}
919898
}
920899

900+
static void __init bcm2709_init_uart1(void)
901+
{
902+
struct device_node *np;
903+
904+
np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart");
905+
if (of_device_is_available(np)) {
906+
pr_info("bcm2709: Mini UART enabled\n");
907+
writel(1, __io_address(UART1_BASE + 0x4));
908+
}
909+
}
910+
921911
#ifdef CONFIG_OF
922912
static void __init bcm2709_dt_init(void)
923913
{
@@ -975,13 +965,13 @@ void __init bcm2709_init(void)
975965
#endif
976966
bcm_register_device_dt(&bcm2708_fb_device);
977967
bcm_register_device_dt(&bcm2708_usb_device);
978-
bcm_register_device(&bcm2708_uart1_device);
979968
bcm_register_device(&bcm2708_powerman_device);
980969

981970
#ifdef CONFIG_MMC_BCM2835
982971
bcm_register_device_dt(&bcm2835_emmc_device);
983972
#endif
984973
bcm2709_init_led();
974+
bcm2709_init_uart1();
985975

986976
/* Only create the platform devices for the ALSA driver in the
987977
absence of an enabled "audio" DT node */

0 commit comments

Comments
 (0)