diff options
Diffstat (limited to 'drivers/mtd/devices/m25p80.c')
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 8845ec3a3e..f4db8c402a 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * MTD SPI driver for ST M25Pxx (and similar) serial flash chips * @@ -7,11 +8,6 @@ * Some parts are based on lart.c by Abraham Van Der Merwe * * Cleaned up and generalized based on mtd_dataflash.c - * - * This code is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * */ #include <common.h> @@ -19,7 +15,6 @@ #include <driver.h> #include <of.h> #include <spi/spi.h> -#include <spi/flash.h> #include <xfuncs.h> #include <malloc.h> #include <errno.h> @@ -205,11 +200,10 @@ static const struct platform_device_id m25p_ids[] = { * matches what the READ command supports, at least until this driver * understands FAST_READ (for clocks over 25 MHz). */ -static int m25p_probe(struct device_d *dev) +static int m25p_probe(struct device *dev) { struct spi_device *spi = (struct spi_device *)dev->type_data; struct spi_mem *spimem = spi->mem; - struct flash_platform_data *data; struct m25p *flash; struct spi_nor *nor; struct spi_nor_hwcaps hwcaps = { @@ -222,8 +216,6 @@ static int m25p_probe(struct device_d *dev) bool use_large_blocks; int ret; - data = dev->platform_data; - flash = xzalloc(sizeof *flash); nor = &flash->spi_nor; @@ -249,30 +241,21 @@ static int m25p_probe(struct device_d *dev) dev->priv = (void *)flash; - if (data && data->name) - flash->mtd.name = data->name; - - if (data && data->type) - flash_name = data->type; - else if (data && data->name) - flash_name = data->name; - else if (dev->id_entry) + if (dev->id_entry) flash_name = dev->id_entry->name; else flash_name = NULL; /* auto-detect */ - use_large_blocks = of_property_read_bool(dev->device_node, - "use-large-blocks"); + use_large_blocks = of_property_read_bool(dev->of_node, + "use-large-blocks"); ret = spi_nor_scan(nor, flash_name, &hwcaps, use_large_blocks); if (ret) return ret; device_id = DEVICE_ID_SINGLE; - if (dev->device_node) - flash_name = of_alias_get(dev->device_node); - else if (data && data->name) - flash_name = data->name; + if (dev->of_node) + flash_name = of_alias_get(dev->of_node); if (!flash_name) { device_id = DEVICE_ID_DYNAMIC; @@ -291,8 +274,9 @@ static __maybe_unused struct of_device_id m25p80_dt_ids[] = { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, m25p80_dt_ids); -static struct driver_d m25p80_driver = { +static struct driver m25p80_driver = { .name = "m25p80", .probe = m25p_probe, .of_compatible = DRV_OF_COMPAT(m25p80_dt_ids), |