Skip to content
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

BCM270x: Make uart1 work with Device Tree #1008

Merged
merged 1 commit into from
Jun 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
audio = &audio;
sound = &sound;
uart0 = &uart0;
uart1 = &uart1;
clocks = &clocks;
};

Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/bcm2708-rpi-b.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
audio = &audio;
sound = &sound;
uart0 = &uart0;
uart1 = &uart1;
clocks = &clocks;
};

Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/bcm2708-rpi-cm.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
audio = &audio;
sound = &sound;
uart0 = &uart0;
uart1 = &uart1;
clocks = &clocks;
};

Expand Down
10 changes: 10 additions & 0 deletions arch/arm/boot/dts/bcm2708_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@
status = "disabled";
};

uart1: uart@7e215040 {
compatible = "brcm,bcm2835-aux-uart", "ns16550";
reg = <0x7e215040 0x40>;
interrupts = <1 29>;
clock-frequency = <500000000>;
reg-shift = <2>;
no-loopback-test;
status = "disabled";
};

i2c1: i2c@7e804000 {
compatible = "brcm,bcm2708-i2c";
reg = <0x7e804000 0x1000>;
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/bcm2709-rpi-2-b.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
audio = &audio;
sound = &sound;
uart0 = &uart0;
uart1 = &uart1;
clocks = &clocks;
};

Expand Down
35 changes: 12 additions & 23 deletions arch/arm/mach-bcm2708/bcm2708.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,28 +353,6 @@ static struct platform_device bcm2708_fb_device = {
},
};

static struct plat_serial8250_port bcm2708_uart1_platform_data[] = {
{
.mapbase = UART1_BASE + 0x40,
.irq = IRQ_AUX,
.uartclk = 500000000,
.regshift = 2,
.iotype = UPIO_MEM,
.flags = UPF_SHARE_IRQ | UPF_FIXED_TYPE | UPF_FIXED_PORT |
UPF_IOREMAP | UPF_SKIP_TEST,
.type = PORT_16550,
},
{},
};

static struct platform_device bcm2708_uart1_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = bcm2708_uart1_platform_data,
},
};

static struct resource bcm2708_usb_resources[] = {
[0] = {
.start = USB_BASE,
Expand Down Expand Up @@ -901,6 +879,17 @@ static void bcm2708_power_off(void)
}
}

static void __init bcm2708_init_uart1(void)
{
struct device_node *np;

np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart");
if (of_device_is_available(np)) {
pr_info("bcm2708: Mini UART enabled\n");
writel(1, __io_address(UART1_BASE + 0x4));
}
}

#ifdef CONFIG_OF
static void __init bcm2708_dt_init(void)
{
Expand Down Expand Up @@ -956,13 +945,13 @@ void __init bcm2708_init(void)
bcm_register_device(&bcm2708_systemtimer_device);
bcm_register_device_dt(&bcm2708_fb_device);
bcm_register_device_dt(&bcm2708_usb_device);
bcm_register_device(&bcm2708_uart1_device);
bcm_register_device(&bcm2708_powerman_device);

#ifdef CONFIG_MMC_BCM2835
bcm_register_device_dt(&bcm2835_emmc_device);
#endif
bcm2708_init_led();
bcm2708_init_uart1();

/* Only create the platform devices for the ALSA driver in the
absence of an enabled "audio" DT node */
Expand Down
34 changes: 12 additions & 22 deletions arch/arm/mach-bcm2709/bcm2709.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,27 +363,6 @@ static struct platform_device bcm2708_fb_device = {
},
};

static struct plat_serial8250_port bcm2708_uart1_platform_data[] = {
{
.mapbase = UART1_BASE + 0x40,
.irq = IRQ_AUX,
.uartclk = 125000000,
.regshift = 2,
.iotype = UPIO_MEM,
.flags = UPF_FIXED_TYPE | UPF_IOREMAP | UPF_SKIP_TEST,
.type = PORT_8250,
},
{},
};

static struct platform_device bcm2708_uart1_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = bcm2708_uart1_platform_data,
},
};

static struct resource bcm2708_usb_resources[] = {
[0] = {
.start = USB_BASE,
Expand Down Expand Up @@ -922,6 +901,17 @@ static void bcm2709_power_off(void)
}
}

static void __init bcm2709_init_uart1(void)
{
struct device_node *np;

np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart");
if (of_device_is_available(np)) {
pr_info("bcm2709: Mini UART enabled\n");
writel(1, __io_address(UART1_BASE + 0x4));
}
}

#ifdef CONFIG_OF
static void __init bcm2709_dt_init(void)
{
Expand Down Expand Up @@ -979,13 +969,13 @@ void __init bcm2709_init(void)
#endif
bcm_register_device_dt(&bcm2708_fb_device);
bcm_register_device_dt(&bcm2708_usb_device);
bcm_register_device(&bcm2708_uart1_device);
bcm_register_device(&bcm2708_powerman_device);

#ifdef CONFIG_MMC_BCM2835
bcm_register_device_dt(&bcm2835_emmc_device);
#endif
bcm2709_init_led();
bcm2709_init_uart1();

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