Skip to content

Commit

Permalink
max3110 sanity check a register
Browse files Browse the repository at this point in the history
MAX3111 is the SPI/UART IC installed on the MRST SPI Port Card as a serial
debug goal, and the SPI Port Card will be frequently mounted and unmounted
from the main board by developers depending whether debug serial is
required or not.

As the MAX3111 has no subvendor or product id registers available, the patch
will try to access one register to decide if this IC is present or not.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
jianwei.yang authored and Greg Kroah-Hartman committed Aug 10, 2010
1 parent 2251099 commit 99dd3f6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions drivers/serial/mrst_max3110.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ static int serial_m3110_probe(struct spi_device *spi)
struct uart_max3110 *max;
int ret;
unsigned char *buffer;

u16 res;
max = kzalloc(sizeof(*max), GFP_KERNEL);
if (!max)
return -ENOMEM;
Expand Down Expand Up @@ -753,7 +753,16 @@ static int serial_m3110_probe(struct spi_device *spi)

max->cur_conf = 0;
atomic_set(&max->irq_pending, 0);

/* Check if reading configuration register returns something sane */

res = RC_TAG;
ret = max3110_write_then_read(max, (u8 *)&res, (u8 *)&res, 2, 0);
if (ret < 0 || res == 0 || res == 0xffff) {
printk(KERN_ERR "MAX3111 deemed not present (conf reg %04x)",
res);
ret = -ENODEV;
goto err_get_page;
}
buffer = (unsigned char *)__get_free_page(GFP_KERNEL);
if (!buffer) {
ret = -ENOMEM;
Expand Down

0 comments on commit 99dd3f6

Please sign in to comment.