mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-05 13:25:20 +02:00
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>
This commit is contained in:
parent
88c2b56c26
commit
e58db3bcd9
|
@ -1346,6 +1346,7 @@ static int intel_spi_read_desc(struct intel_spi *ispi)
|
|||
static int intel_spi_populate_chip(struct intel_spi *ispi)
|
||||
{
|
||||
struct flash_platform_data *pdata;
|
||||
struct mtd_partition *parts;
|
||||
struct spi_board_info chip;
|
||||
int ret;
|
||||
|
||||
|
@ -1376,7 +1377,23 @@ static int intel_spi_populate_chip(struct intel_spi *ispi)
|
|||
if (ispi->host->num_chipselect < 2)
|
||||
return 0;
|
||||
|
||||
chip.platform_data = NULL;
|
||||
pdata = devm_kzalloc(ispi->dev, sizeof(*pdata), GFP_KERNEL);
|
||||
if (!pdata)
|
||||
return -ENOMEM;
|
||||
|
||||
pdata->name = devm_kasprintf(ispi->dev, GFP_KERNEL, "%s-chip1",
|
||||
dev_name(ispi->dev));
|
||||
pdata->nr_parts = 1;
|
||||
parts = devm_kcalloc(ispi->dev, pdata->nr_parts, sizeof(*parts),
|
||||
GFP_KERNEL);
|
||||
if (!parts)
|
||||
return -ENOMEM;
|
||||
|
||||
parts[0].size = MTDPART_SIZ_FULL;
|
||||
parts[0].name = "BIOS1";
|
||||
pdata->parts = parts;
|
||||
|
||||
chip.platform_data = pdata;
|
||||
chip.chip_select = 1;
|
||||
|
||||
if (!spi_new_device(ispi->host, &chip))
|
||||
|
|
Loading…
Reference in New Issue
Block a user