Skip to content

Commit e58db3b

Browse files
westeribroonie
authored andcommitted
spi: intel: Add default partition and name to the second chip
This should make it easier to identify the second chip and also allows using "mtdparts=" and the like with this chip too. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Link: https://lore.kernel.org/r/20240201121638.207632-1-mika.westerberg@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 88c2b56 commit e58db3b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

drivers/spi/spi-intel.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,7 @@ static int intel_spi_read_desc(struct intel_spi *ispi)
13461346
static int intel_spi_populate_chip(struct intel_spi *ispi)
13471347
{
13481348
struct flash_platform_data *pdata;
1349+
struct mtd_partition *parts;
13491350
struct spi_board_info chip;
13501351
int ret;
13511352

@@ -1376,7 +1377,23 @@ static int intel_spi_populate_chip(struct intel_spi *ispi)
13761377
if (ispi->host->num_chipselect < 2)
13771378
return 0;
13781379

1379-
chip.platform_data = NULL;
1380+
pdata = devm_kzalloc(ispi->dev, sizeof(*pdata), GFP_KERNEL);
1381+
if (!pdata)
1382+
return -ENOMEM;
1383+
1384+
pdata->name = devm_kasprintf(ispi->dev, GFP_KERNEL, "%s-chip1",
1385+
dev_name(ispi->dev));
1386+
pdata->nr_parts = 1;
1387+
parts = devm_kcalloc(ispi->dev, pdata->nr_parts, sizeof(*parts),
1388+
GFP_KERNEL);
1389+
if (!parts)
1390+
return -ENOMEM;
1391+
1392+
parts[0].size = MTDPART_SIZ_FULL;
1393+
parts[0].name = "BIOS1";
1394+
pdata->parts = parts;
1395+
1396+
chip.platform_data = pdata;
13801397
chip.chip_select = 1;
13811398

13821399
if (!spi_new_device(ispi->host, &chip))

0 commit comments

Comments
 (0)