Jelajahi Sumber

serial: 8250_dw: only setup the port from one place

This adds a flag "skip_autocfg" that the platforms that do
not have the ADDITIONAL_FEATURES implemented can use to skip
the port setup. It's then enough to call dw8250_setup_port
just from dw8250_probe based on that flag.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Heikki Krogerus 10 tahun lalu
induk
melakukan
4f042054fa
1 mengubah file dengan 6 tambahan dan 8 penghapusan
  1. 6 8
      drivers/tty/serial/8250/8250_dw.c

+ 6 - 8
drivers/tty/serial/8250/8250_dw.c

@@ -63,6 +63,8 @@ struct dw8250_data {
 	struct clk		*pclk;
 	struct clk		*pclk;
 	struct reset_control	*rst;
 	struct reset_control	*rst;
 	struct uart_8250_dma	dma;
 	struct uart_8250_dma	dma;
+
+	unsigned int		skip_autocfg:1;
 };
 };
 
 
 #define BYT_PRV_CLK			0x800
 #define BYT_PRV_CLK			0x800
@@ -285,8 +287,6 @@ static int dw8250_probe_of(struct uart_port *p,
 			   struct dw8250_data *data)
 			   struct dw8250_data *data)
 {
 {
 	struct device_node	*np = p->dev->of_node;
 	struct device_node	*np = p->dev->of_node;
-	struct uart_8250_port *up = up_to_u8250p(p);
-	bool has_ucv = true;
 	int id;
 	int id;
 
 
 #ifdef CONFIG_64BIT
 #ifdef CONFIG_64BIT
@@ -296,12 +296,9 @@ static int dw8250_probe_of(struct uart_port *p,
 		p->flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
 		p->flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
 		p->type = PORT_OCTEON;
 		p->type = PORT_OCTEON;
 		data->usr_reg = 0x27;
 		data->usr_reg = 0x27;
-		has_ucv = false;
+		data->skip_autocfg = true;
 	}
 	}
 #endif
 #endif
-	if (has_ucv)
-		dw8250_setup_port(up);
-
 	/* get index of serial line, if found in DT aliases */
 	/* get index of serial line, if found in DT aliases */
 	id = of_alias_get_id(np, "serial");
 	id = of_alias_get_id(np, "serial");
 	if (id >= 0)
 	if (id >= 0)
@@ -325,8 +322,6 @@ static int dw8250_probe_acpi(struct uart_8250_port *up,
 {
 {
 	struct uart_port *p = &up->port;
 	struct uart_port *p = &up->port;
 
 
-	dw8250_setup_port(up);
-
 	p->iotype = UPIO_MEM32;
 	p->iotype = UPIO_MEM32;
 	p->serial_in = dw8250_serial_in32;
 	p->serial_in = dw8250_serial_in32;
 	p->serial_out = dw8250_serial_out32;
 	p->serial_out = dw8250_serial_out32;
@@ -486,6 +481,9 @@ static int dw8250_probe(struct platform_device *pdev)
 		goto err_reset;
 		goto err_reset;
 	}
 	}
 
 
+	if (!data->skip_autocfg)
+		dw8250_setup_port(&uart);
+
 	/* If we have a valid fifosize, try hooking up DMA */
 	/* If we have a valid fifosize, try hooking up DMA */
 	if (p->fifosize) {
 	if (p->fifosize) {
 		data->dma.rxconf.src_maxburst = p->fifosize / 4;
 		data->dma.rxconf.src_maxburst = p->fifosize / 4;