Skip to content

Commit

Permalink
serial: 8250_fintek: Add using BIOS IRQ default setting
Browse files Browse the repository at this point in the history
In 8250_fintek.c probe_setup_port(), we'll detect the IRQ trigger mode by
irq_get_irq_data() and pass it to fintek_8250_set_irq_mode(). If detected
Edge mode, we'll set the UART with Edge/High mode, otherwise Level/Low.

But in some motherboard, The APIC maybe setting to Level/High. In this case
the driver will setting wrong configuration into UART. So we add a option
to kernel parameter to control the driver as following:

	fintek_uart_irq_mode_override= [SERIAL]
		{default, bios}
		If the parameter is "default", the driver will using
		former IRQ override methed(By IRQ trigger type).
		otherwise, we'll don't change the UART IRQ setting.

Signed-off-by: Ji-Ze Hong (Peter Hong) <hpeter+linux_kernel@gmail.com>
  • Loading branch information
hpeter authored and intel-lab-lkp committed Feb 17, 2023
1 parent 72206cc commit fd786fb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions drivers/tty/serial/8250/8250_fintek.c
Expand Up @@ -92,13 +92,34 @@
#define F81866_UART_CLK_18_432MHZ BIT(0)
#define F81866_UART_CLK_24MHZ BIT(1)

#define FINTEK_IRQ_MODE_BY_DETECT 0
#define FINTEK_IRQ_MODE_BY_BIOS 1

struct fintek_8250 {
u16 pid;
u16 base_port;
u8 index;
u8 key;
};

static int not_override_irq_mode = FINTEK_IRQ_MODE_BY_DETECT;

static int __init parse_uart_irq_mode_override(char *arg)
{
if (!arg)
return -EINVAL;

if (strcmp(arg, "bios") == 0)
not_override_irq_mode = FINTEK_IRQ_MODE_BY_BIOS;
else if (strcmp(arg, "default") == 0)
not_override_irq_mode = FINTEK_IRQ_MODE_BY_DETECT;
else
return -EINVAL;

return 0;
}
early_param("fintek_uart_irq_mode_override", parse_uart_irq_mode_override);

static u8 sio_read_reg(struct fintek_8250 *pdata, u8 reg)
{
outb(reg, pdata->base_port + ADDR_PORT);
Expand Down Expand Up @@ -234,6 +255,12 @@ static int fintek_8250_rs485_config(struct uart_port *port, struct ktermios *ter

static void fintek_8250_set_irq_mode(struct fintek_8250 *pdata, bool is_level)
{
if (not_override_irq_mode == FINTEK_IRQ_MODE_BY_BIOS) {
pr_info("Fintek UART(%04x) irq mode is using BIOS default",
pdata->pid);
return;
}

sio_write_reg(pdata, LDN, pdata->index);

switch (pdata->pid) {
Expand Down

0 comments on commit fd786fb

Please sign in to comment.