openwrtv3/target/linux/brcm63xx/patches-4.4/391-MIPS-BCM63XX-do-not-register-uart.patch
Jonas Gorski aba4e29ead brcm63xx: register serial through device tree
Register serial consoles through device tree instead of through board
data.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
2017-12-16 12:57:05 +01:00

257 lines
6.4 KiB
Diff

--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,6 +1,6 @@
obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
- dev-pcmcia.o dev-rng.o dev-uart.o \
+ dev-pcmcia.o dev-rng.o \
dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \
usb-common.o sprom.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
--- a/arch/mips/bcm63xx/dev-uart.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <bcm63xx_cpu.h>
-
-static struct resource uart0_resources[] = {
- {
- /* start & end filled at runtime */
- .flags = IORESOURCE_MEM,
- },
- {
- /* start filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct resource uart1_resources[] = {
- {
- /* start & end filled at runtime */
- .flags = IORESOURCE_MEM,
- },
- {
- /* start filled at runtime */
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct platform_device bcm63xx_uart_devices[] = {
- {
- .name = "bcm63xx_uart",
- .id = 0,
- .num_resources = ARRAY_SIZE(uart0_resources),
- .resource = uart0_resources,
- },
-
- {
- .name = "bcm63xx_uart",
- .id = 1,
- .num_resources = ARRAY_SIZE(uart1_resources),
- .resource = uart1_resources,
- }
-};
-
-int __init bcm63xx_uart_register(unsigned int id)
-{
- if (id >= ARRAY_SIZE(bcm63xx_uart_devices))
- return -ENODEV;
-
- if (id == 1 && (!BCMCPU_IS_3368() && !BCMCPU_IS_6358() &&
- !BCMCPU_IS_6368()))
- return -ENODEV;
-
- if (id == 0) {
- uart0_resources[0].start = bcm63xx_regset_address(RSET_UART0);
- uart0_resources[0].end = uart0_resources[0].start +
- RSET_UART_SIZE - 1;
- uart0_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0);
- }
-
- if (id == 1) {
- uart1_resources[0].start = bcm63xx_regset_address(RSET_UART1);
- uart1_resources[0].end = uart1_resources[0].start +
- RSET_UART_SIZE - 1;
- uart1_resources[1].start = bcm63xx_get_irq_number(IRQ_UART1);
- }
-
- return platform_device_register(&bcm63xx_uart_devices[id]);
-}
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef BCM63XX_DEV_UART_H_
-#define BCM63XX_DEV_UART_H_
-
-int bcm63xx_uart_register(unsigned int id);
-
-#endif /* BCM63XX_DEV_UART_H_ */
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
@@ -33,8 +33,6 @@ struct board_info {
unsigned int has_ehci0:1;
unsigned int has_usbd:1;
unsigned int has_dsp:1;
- unsigned int has_uart0:1;
- unsigned int has_uart1:1;
unsigned int use_fallback_sprom:1;
/* ethernet config */
--- a/arch/mips/bcm63xx/boards/board_common.c
+++ b/arch/mips/bcm63xx/boards/board_common.c
@@ -20,7 +20,6 @@
#include <asm/prom.h>
#include <bcm63xx_board.h>
#include <bcm63xx_cpu.h>
-#include <bcm63xx_dev_uart.h>
#include <bcm63xx_regs.h>
#include <bcm63xx_io.h>
#include <bcm63xx_gpio.h>
@@ -189,12 +188,6 @@ int __init board_register_devices(void)
bcm63xx_gpio_init();
- if (board.has_uart0)
- bcm63xx_uart_register(0);
-
- if (board.has_uart1)
- bcm63xx_uart_register(1);
-
if (board.has_pccard)
bcm63xx_pcmcia_register();
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -35,9 +35,6 @@ static struct board_info __initdata boar
.name = "CVG834G_E15R3921",
.expected_cpu_id = 0x3368,
- .has_uart0 = 1,
- .has_uart1 = 1,
-
.has_enet0 = 1,
.has_pci = 1,
@@ -67,7 +64,6 @@ static struct board_info __initdata boar
.name = "96328avng",
.expected_cpu_id = 0x6328,
- .has_uart0 = 1,
.has_pci = 1,
.has_usbd = 0,
.use_fallback_sprom = 1,
@@ -116,7 +112,6 @@ static struct board_info __initdata boar
.name = "96338GW",
.expected_cpu_id = 0x6338,
- .has_uart0 = 1,
.has_enet0 = 1,
.enet0 = {
.force_speed_100 = 1,
@@ -159,7 +154,6 @@ static struct board_info __initdata boar
.name = "96338W",
.expected_cpu_id = 0x6338,
- .has_uart0 = 1,
.has_enet0 = 1,
.enet0 = {
.force_speed_100 = 1,
@@ -204,8 +198,6 @@ static struct board_info __initdata boar
static struct board_info __initdata board_96345gw2 = {
.name = "96345GW2",
.expected_cpu_id = 0x6345,
-
- .has_uart0 = 1,
};
#endif
@@ -217,7 +209,6 @@ static struct board_info __initdata boar
.name = "96348R",
.expected_cpu_id = 0x6348,
- .has_uart0 = 1,
.has_enet0 = 1,
.has_pci = 1,
.use_fallback_sprom = 1,
@@ -262,7 +253,6 @@ static struct board_info __initdata boar
.name = "96348GW-10",
.expected_cpu_id = 0x6348,
- .has_uart0 = 1,
.has_enet0 = 1,
.has_enet1 = 1,
.has_pci = 1,
@@ -323,7 +313,6 @@ static struct board_info __initdata boar
.name = "96348GW-11",
.expected_cpu_id = 0x6348,
- .has_uart0 = 1,
.has_enet0 = 1,
.has_enet1 = 1,
.has_pci = 1,
@@ -378,7 +367,6 @@ static struct board_info __initdata boar
.name = "96348GW",
.expected_cpu_id = 0x6348,
- .has_uart0 = 1,
.has_enet0 = 1,
.has_enet1 = 1,
.has_pci = 1,
@@ -437,7 +425,6 @@ static struct board_info __initdata boar
.name = "F@ST2404",
.expected_cpu_id = 0x6348,
- .has_uart0 = 1,
.has_enet0 = 1,
.has_enet1 = 1,
.has_pci = 1,
@@ -482,7 +469,6 @@ static struct board_info __initdata boar
.name = "DV201AMR",
.expected_cpu_id = 0x6348,
- .has_uart0 = 1,
.has_pci = 1,
.use_fallback_sprom = 1,
.has_ohci0 = 1,
@@ -503,7 +489,6 @@ static struct board_info __initdata boar
.name = "96348GW-A",
.expected_cpu_id = 0x6348,
- .has_uart0 = 1,
.has_enet0 = 1,
.has_enet1 = 1,
.has_pci = 1,
@@ -530,7 +515,6 @@ static struct board_info __initdata boar
.name = "96358VW",
.expected_cpu_id = 0x6358,
- .has_uart0 = 1,
.has_enet0 = 1,
.has_enet1 = 1,
.has_pci = 1,
@@ -583,7 +567,6 @@ static struct board_info __initdata boar
.name = "96358VW2",
.expected_cpu_id = 0x6358,
- .has_uart0 = 1,
.has_enet0 = 1,
.has_enet1 = 1,
.has_pci = 1,
@@ -633,7 +616,6 @@ static struct board_info __initdata boar
.name = "AGPF-S0",
.expected_cpu_id = 0x6358,
- .has_uart0 = 1,
.has_enet0 = 1,
.has_enet1 = 1,
.has_pci = 1,