Skip to content

Commit

Permalink
serial/8250_fintek: Support for chip_ip 0x0501
Browse files Browse the repository at this point in the history
There are some chips with the same interface but different chip ip.

Reported-by: Peter Hong <[email protected]>
Reviewed-by: Alan Cox <[email protected]>
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
ribalda authored and gregkh committed Jul 23, 2015
1 parent 017bec3 commit dae77f7
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions drivers/tty/serial/8250/8250_fintek.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#define ENTRY_KEY 0x77
#define EXIT_KEY 0xAA
#define CHIP_ID1 0x20
#define CHIP_ID1_VAL 0x02
#define CHIP_ID2 0x21
#define CHIP_ID2_VAL 0x16
#define CHIP_ID_0 0x1602
#define CHIP_ID_1 0x0501
#define VENDOR_ID1 0x23
#define VENDOR_ID1_VAL 0x19
#define VENDOR_ID2 0x24
Expand Down Expand Up @@ -77,14 +77,7 @@ static int fintek_8250_get_index(resource_size_t base_addr)

static int fintek_8250_check_id(u16 base_port)
{

outb(CHIP_ID1, base_port + ADDR_PORT);
if (inb(base_port + DATA_PORT) != CHIP_ID1_VAL)
return -ENODEV;

outb(CHIP_ID2, base_port + ADDR_PORT);
if (inb(base_port + DATA_PORT) != CHIP_ID2_VAL)
return -ENODEV;
u16 chip;

outb(VENDOR_ID1, base_port + ADDR_PORT);
if (inb(base_port + DATA_PORT) != VENDOR_ID1_VAL)
Expand All @@ -94,6 +87,14 @@ static int fintek_8250_check_id(u16 base_port)
if (inb(base_port + DATA_PORT) != VENDOR_ID2_VAL)
return -ENODEV;

outb(CHIP_ID1, base_port + ADDR_PORT);
chip = inb(base_port + DATA_PORT);
outb(CHIP_ID2, base_port + ADDR_PORT);
chip |= inb(base_port + DATA_PORT) << 8;

if (chip != CHIP_ID_0 && chip != CHIP_ID_1)
return -ENODEV;

return 0;
}

Expand Down

0 comments on commit dae77f7

Please sign in to comment.