@@ -327,7 +327,7 @@ config SPI_BOARD_INFO_CMDLINE
The syntax is:
spi_board_info=<devcfg>[,<devcfg>...]
with <devcfg> as
- <devname>[:<max_speed_hz>[:<bus_num>[:<chip_select>[:<irq>[:<opt>[:<opt>...]]]]]]
+ <devname>[:max_speed_hz=<int>][:bus_num=<int>][:chip_select=<int>][:irq=<int>][:cs_gpio=<int>][:<opt>][:<opt>]...
and <opt> as one of
cpha,cpol,mode0,mode1,mode2,mode3,cs,lsb,3wire,loop,no_cs,ready
@@ -65,57 +65,49 @@ static int __init spi_board_info_register_device(char *dev)
if (next)
*next++ = '\0';
- if (strlen(opt) > 0) {
- switch (num) {
- case 0:
- strncpy(info->modalias, opt, ARRAY_SIZE(info->modalias));
- info->modalias[ARRAY_SIZE(info->modalias)-1]=0;
- break;
- case 1:
- info->max_speed_hz = simple_strtoul(opt, NULL, 10);
- break;
- case 2:
- info->bus_num = simple_strtoul(opt, NULL, 10);
- break;
- case 3:
- info->chip_select = simple_strtoul(opt, NULL, 10);
- break;
- case 4:
+ if (!num) {
+ /* name of device */
+ strncpy(info->modalias, opt, ARRAY_SIZE(info->modalias));
+ info->modalias[ARRAY_SIZE(info->modalias)-1]=0;
+ } else {
+ if (!strcmp(opt, "cpha"))
+ info->mode |= SPI_CPHA;
+ else if (!strcmp(opt, "cpol"))
+ info->mode |= SPI_CPOL;
+ else if (!strcmp(opt, "mode0"))
+ info->mode |= SPI_MODE_0;
+ else if (!strcmp(opt, "mode1"))
+ info->mode |= SPI_MODE_1;
+ else if (!strcmp(opt, "mode2"))
+ info->mode |= SPI_MODE_2;
+ else if (!strcmp(opt, "mode3"))
+ info->mode |= SPI_MODE_3;
+ else if (!strcmp(opt, "cs_high"))
+ info->mode |= SPI_CS_HIGH;
+ else if (!strcmp(opt, "lsb"))
+ info->mode |= SPI_LSB_FIRST;
+ else if (!strcmp(opt, "3wire"))
+ info->mode |= SPI_3WIRE;
+ else if (!strcmp(opt, "loop"))
+ info->mode |= SPI_LOOP;
+ else if (!strcmp(opt, "no_cs"))
+ info->mode |= SPI_NO_CS;
+ else if (!strcmp(opt, "ready"))
+ info->mode |= SPI_READY;
+ else if (!strncmp(opt, "chip_select=", 12))
+ info->chip_select = simple_strtoul(&opt[12], NULL, 10);
+ else if (!strncmp(opt, "cs_gpio=", 8))
+ /* defines the GPIO to be used as chipselect for spi_gpio.c */
+ info->controller_data = (void*) simple_strtol(&opt[8], NULL, 10);
+ else if (!strncmp(opt, "bus_num=", 8))
+ info->bus_num = simple_strtoul(&opt[8], NULL, 10);
+ else if (!strncmp(opt, "max_speed_hz=", 13))
+ info->max_speed_hz = simple_strtoul(&opt[13], NULL, 10);
+ else if (!strncmp(opt, "irq=", 4))
info->irq = simple_strtoul(opt, NULL, 10);
- break;
- default:
- if (!strcmp(opt, "cpha"))
- info->mode |= SPI_CPHA;
- else if (!strcmp(opt, "cpol"))
- info->mode |= SPI_CPOL;
- else if (!strcmp(opt, "mode0"))
- info->mode |= SPI_MODE_0;
- else if (!strcmp(opt, "mode1"))
- info->mode |= SPI_MODE_1;
- else if (!strcmp(opt, "mode2"))
- info->mode |= SPI_MODE_2;
- else if (!strcmp(opt, "mode3"))
- info->mode |= SPI_MODE_3;
- else if (!strcmp(opt, "cs"))
- info->mode |= SPI_CS_HIGH;
- else if (!strcmp(opt, "lsb"))
- info->mode |= SPI_LSB_FIRST;
- else if (!strcmp(opt, "3wire"))
- info->mode |= SPI_3WIRE;
- else if (!strcmp(opt, "loop"))
- info->mode |= SPI_LOOP;
- else if (!strcmp(opt, "no_cs"))
- info->mode |= SPI_NO_CS;
- else if (!strcmp(opt, "ready"))
- info->mode |= SPI_READY;
- else {
- pr_err(DRIVER_NAME ": Don't know value %s\n", opt);
- kfree(info);
- return -1;
- }
-
- break;
- }
+ else
+ pr_err(DRIVER_NAME ": Unknown option %s, ignoring\n", opt);
+ break;
}
/* next option */