serial: 8250: do not compile codes that are not used by dw 8250

To save memory space for ROCKCHIP_MINI_KERNEL

Changes to vmlinux size:
Before:
   text	   data	    bss	    dec	    hex	filename
4249223	1766500	 134616	6150339	 5dd8c3	vmlinux

After:
   text	   data	    bss	    dec	    hex	filename
4248379	1763012	 134616	6146007	 5dc7d7	vmlinux

delta: 4332 (dec)

Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Change-Id: Ib1cefe62cf968489cffe37043b29c341d4c60788
This commit is contained in:
Huibin Hong 2022-03-26 06:54:17 +00:00 committed by Tao Huang
parent 0fa3507e0d
commit b7d5398aee
2 changed files with 17 additions and 0 deletions

View File

@ -446,6 +446,10 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
id = of_alias_get_id(np, "serial");
if (id >= 0)
p->line = id;
if (IS_ENABLED(CONFIG_ROCKCHIP_MINI_KERNEL))
return;
#ifdef CONFIG_64BIT
if (of_device_is_compatible(np, "cavium,octeon-3860-uart")) {
p->serial_in = dw8250_serial_inq;
@ -471,6 +475,9 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
data->uart_16550_compatible = true;
}
if (IS_ENABLED(CONFIG_ROCKCHIP_MINI_KERNEL))
return;
/* Platforms with iDMA 64-bit */
if (platform_get_resource_byname(to_platform_device(p->dev),
IORESOURCE_MEM, "lpss_priv")) {
@ -775,9 +782,11 @@ static const struct dev_pm_ops dw8250_pm_ops = {
static const struct of_device_id dw8250_of_match[] = {
{ .compatible = "snps,dw-apb-uart" },
#ifndef CONFIG_ROCKCHIP_MINI_KERNEL
{ .compatible = "cavium,octeon-3860-uart" },
{ .compatible = "marvell,armada-38x-uart" },
{ .compatible = "renesas,rzn1-uart" },
#endif
{ /* Sentinel */ }
};
MODULE_DEVICE_TABLE(of, dw8250_of_match);

View File

@ -56,6 +56,7 @@
* Here we define the default xmit fifo size used for each type of UART.
*/
static const struct serial8250_config uart_config[] = {
#ifndef CONFIG_ROCKCHIP_MINI_KERNEL
[PORT_UNKNOWN] = {
.name = "unknown",
.fifo_size = 1,
@ -76,6 +77,7 @@ static const struct serial8250_config uart_config[] = {
.fifo_size = 1,
.tx_loadsz = 1,
},
#endif
[PORT_16550A] = {
.name = "16550A",
.fifo_size = 16,
@ -84,6 +86,7 @@ static const struct serial8250_config uart_config[] = {
.rxtrig_bytes = {1, 4, 8, 14},
.flags = UART_CAP_FIFO,
},
#ifndef CONFIG_ROCKCHIP_MINI_KERNEL
[PORT_CIRRUS] = {
.name = "Cirrus",
.fifo_size = 1,
@ -306,6 +309,7 @@ static const struct serial8250_config uart_config[] = {
.rxtrig_bytes = {1, 32, 64, 112},
.flags = UART_CAP_FIFO | UART_CAP_SLEEP,
},
#endif
};
/* Uart divisor latch read */
@ -383,6 +387,7 @@ static void au_serial_dl_write(struct uart_8250_port *up, int value)
#endif
#ifndef CONFIG_ROCKCHIP_MINI_KERNEL
static unsigned int hub6_serial_in(struct uart_port *p, int offset)
{
offset = offset << p->regshift;
@ -456,6 +461,7 @@ static void io_serial_out(struct uart_port *p, int offset, int value)
offset = offset << p->regshift;
outb(value, p->iobase + offset);
}
#endif
static int serial8250_default_handle_irq(struct uart_port *port);
@ -466,6 +472,7 @@ static void set_io_from_upio(struct uart_port *p)
up->dl_read = default_serial_dl_read;
up->dl_write = default_serial_dl_write;
#ifndef CONFIG_ROCKCHIP_MINI_KERNEL
switch (p->iotype) {
case UPIO_HUB6:
p->serial_in = hub6_serial_in;
@ -506,6 +513,7 @@ static void set_io_from_upio(struct uart_port *p)
p->serial_out = io_serial_out;
break;
}
#endif
/* Remember loaded iotype */
up->cur_iotype = p->iotype;
p->handle_irq = serial8250_default_handle_irq;