mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
mtd: spi-nor: intel-spi: Convert to SPI MEM
The preferred way to implement SPI-NOR controller drivers is through SPI subsubsystem utilizing the SPI MEM core functions. This converts the Intel SPI flash controller driver over the SPI MEM by moving the driver from SPI-NOR subsystem to SPI subsystem and in one go make it use the SPI MEM functions. The driver name will be changed from intel-spi to spi-intel to match the convention used in the SPI subsystem. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mauro Lima <mauro.lima@eclypsium.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com> Link: https://lore.kernel.org/r/20220209122706.42439-3-mika.westerberg@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
cd149eff8d
commit
e23e5a05d1
@ -26,39 +26,3 @@ config SPI_NXP_SPIFI
|
||||
SPIFI is a specialized controller for connecting serial SPI
|
||||
Flash. Enable this option if you have a device with a SPIFI
|
||||
controller and want to access the Flash as a mtd device.
|
||||
|
||||
config SPI_INTEL_SPI
|
||||
tristate
|
||||
|
||||
config SPI_INTEL_SPI_PCI
|
||||
tristate "Intel PCH/PCU SPI flash PCI driver (DANGEROUS)"
|
||||
depends on X86 && PCI
|
||||
select SPI_INTEL_SPI
|
||||
help
|
||||
This enables PCI support for the Intel PCH/PCU SPI controller in
|
||||
master mode. This controller is present in modern Intel hardware
|
||||
and is used to hold BIOS and other persistent settings. Using
|
||||
this driver it is possible to upgrade BIOS directly from Linux.
|
||||
|
||||
Say N here unless you know what you are doing. Overwriting the
|
||||
SPI flash may render the system unbootable.
|
||||
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called intel-spi-pci.
|
||||
|
||||
config SPI_INTEL_SPI_PLATFORM
|
||||
tristate "Intel PCH/PCU SPI flash platform driver (DANGEROUS)"
|
||||
depends on X86
|
||||
select SPI_INTEL_SPI
|
||||
help
|
||||
This enables platform support for the Intel PCH/PCU SPI
|
||||
controller in master mode. This controller is present in modern
|
||||
Intel hardware and is used to hold BIOS and other persistent
|
||||
settings. Using this driver it is possible to upgrade BIOS
|
||||
directly from Linux.
|
||||
|
||||
Say N here unless you know what you are doing. Overwriting the
|
||||
SPI flash may render the system unbootable.
|
||||
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called intel-spi-platform.
|
||||
|
@ -2,6 +2,3 @@
|
||||
obj-$(CONFIG_SPI_ASPEED_SMC) += aspeed-smc.o
|
||||
obj-$(CONFIG_SPI_HISI_SFC) += hisi-sfc.o
|
||||
obj-$(CONFIG_SPI_NXP_SPIFI) += nxp-spifi.o
|
||||
obj-$(CONFIG_SPI_INTEL_SPI) += intel-spi.o
|
||||
obj-$(CONFIG_SPI_INTEL_SPI_PCI) += intel-spi-pci.o
|
||||
obj-$(CONFIG_SPI_INTEL_SPI_PLATFORM) += intel-spi-platform.o
|
||||
|
@ -1,21 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Intel PCH/PCU SPI flash driver.
|
||||
*
|
||||
* Copyright (C) 2016, Intel Corporation
|
||||
* Author: Mika Westerberg <mika.westerberg@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef INTEL_SPI_H
|
||||
#define INTEL_SPI_H
|
||||
|
||||
#include <linux/platform_data/x86/intel-spi.h>
|
||||
|
||||
struct intel_spi;
|
||||
struct resource;
|
||||
|
||||
struct intel_spi *intel_spi_probe(struct device *dev,
|
||||
struct resource *mem, const struct intel_spi_boardinfo *info);
|
||||
int intel_spi_remove(struct intel_spi *ispi);
|
||||
|
||||
#endif /* INTEL_SPI_H */
|
@ -427,6 +427,45 @@ config SPI_INGENIC
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called spi-ingenic.
|
||||
|
||||
config SPI_INTEL
|
||||
tristate
|
||||
|
||||
config SPI_INTEL_PCI
|
||||
tristate "Intel PCH/PCU SPI flash PCI driver (DANGEROUS)"
|
||||
depends on PCI
|
||||
depends on X86 || COMPILE_TEST
|
||||
depends on SPI_MEM
|
||||
select SPI_INTEL
|
||||
help
|
||||
This enables PCI support for the Intel PCH/PCU SPI controller in
|
||||
master mode. This controller is present in modern Intel hardware
|
||||
and is used to hold BIOS and other persistent settings. Using
|
||||
this driver it is possible to upgrade BIOS directly from Linux.
|
||||
|
||||
Say N here unless you know what you are doing. Overwriting the
|
||||
SPI flash may render the system unbootable.
|
||||
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called spi-intel-pci.
|
||||
|
||||
config SPI_INTEL_PLATFORM
|
||||
tristate "Intel PCH/PCU SPI flash platform driver (DANGEROUS)"
|
||||
depends on X86 || COMPILE_TEST
|
||||
depends on SPI_MEM
|
||||
select SPI_INTEL
|
||||
help
|
||||
This enables platform support for the Intel PCH/PCU SPI
|
||||
controller in master mode. This controller is present in modern
|
||||
Intel hardware and is used to hold BIOS and other persistent
|
||||
settings. Using this driver it is possible to upgrade BIOS
|
||||
directly from Linux.
|
||||
|
||||
Say N here unless you know what you are doing. Overwriting the
|
||||
SPI flash may render the system unbootable.
|
||||
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called spi-intel-platform.
|
||||
|
||||
config SPI_JCORE
|
||||
tristate "J-Core SPI Master"
|
||||
depends on OF && (SUPERH || COMPILE_TEST)
|
||||
|
@ -61,6 +61,9 @@ obj-$(CONFIG_SPI_HISI_SFC_V3XX) += spi-hisi-sfc-v3xx.o
|
||||
obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o
|
||||
obj-$(CONFIG_SPI_IMX) += spi-imx.o
|
||||
obj-$(CONFIG_SPI_INGENIC) += spi-ingenic.o
|
||||
obj-$(CONFIG_SPI_INTEL) += spi-intel.o
|
||||
obj-$(CONFIG_SPI_INTEL_PCI) += spi-intel-pci.o
|
||||
obj-$(CONFIG_SPI_INTEL_PLATFORM) += spi-intel-platform.o
|
||||
obj-$(CONFIG_SPI_LANTIQ_SSC) += spi-lantiq-ssc.o
|
||||
obj-$(CONFIG_SPI_JCORE) += spi-jcore.o
|
||||
obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o
|
||||
|
@ -2,16 +2,14 @@
|
||||
/*
|
||||
* Intel PCH/PCU SPI flash PCI driver.
|
||||
*
|
||||
* Copyright (C) 2016, Intel Corporation
|
||||
* Copyright (C) 2016 - 2022, Intel Corporation
|
||||
* Author: Mika Westerberg <mika.westerberg@linux.intel.com>
|
||||
*/
|
||||
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include "intel-spi.h"
|
||||
#include "spi-intel.h"
|
||||
|
||||
#define BCR 0xdc
|
||||
#define BCR_WPD BIT(0)
|
||||
@ -46,7 +44,6 @@ static int intel_spi_pci_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *id)
|
||||
{
|
||||
struct intel_spi_boardinfo *info;
|
||||
struct intel_spi *ispi;
|
||||
int ret;
|
||||
|
||||
ret = pcim_enable_device(pdev);
|
||||
@ -59,17 +56,7 @@ static int intel_spi_pci_probe(struct pci_dev *pdev,
|
||||
return -ENOMEM;
|
||||
|
||||
info->data = pdev;
|
||||
ispi = intel_spi_probe(&pdev->dev, &pdev->resource[0], info);
|
||||
if (IS_ERR(ispi))
|
||||
return PTR_ERR(ispi);
|
||||
|
||||
pci_set_drvdata(pdev, ispi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void intel_spi_pci_remove(struct pci_dev *pdev)
|
||||
{
|
||||
intel_spi_remove(pci_get_drvdata(pdev));
|
||||
return intel_spi_probe(&pdev->dev, &pdev->resource[0], info);
|
||||
}
|
||||
|
||||
static const struct pci_device_id intel_spi_pci_ids[] = {
|
||||
@ -98,7 +85,6 @@ static struct pci_driver intel_spi_pci_driver = {
|
||||
.name = "intel-spi",
|
||||
.id_table = intel_spi_pci_ids,
|
||||
.probe = intel_spi_pci_probe,
|
||||
.remove = intel_spi_pci_remove,
|
||||
};
|
||||
|
||||
module_pci_driver(intel_spi_pci_driver);
|
@ -2,20 +2,18 @@
|
||||
/*
|
||||
* Intel PCH/PCU SPI flash platform driver.
|
||||
*
|
||||
* Copyright (C) 2016, Intel Corporation
|
||||
* Copyright (C) 2016 - 2022, Intel Corporation
|
||||
* Author: Mika Westerberg <mika.westerberg@linux.intel.com>
|
||||
*/
|
||||
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "intel-spi.h"
|
||||
#include "spi-intel.h"
|
||||
|
||||
static int intel_spi_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct intel_spi_boardinfo *info;
|
||||
struct intel_spi *ispi;
|
||||
struct resource *mem;
|
||||
|
||||
info = dev_get_platdata(&pdev->dev);
|
||||
@ -23,24 +21,11 @@ static int intel_spi_platform_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
|
||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
ispi = intel_spi_probe(&pdev->dev, mem, info);
|
||||
if (IS_ERR(ispi))
|
||||
return PTR_ERR(ispi);
|
||||
|
||||
platform_set_drvdata(pdev, ispi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int intel_spi_platform_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct intel_spi *ispi = platform_get_drvdata(pdev);
|
||||
|
||||
return intel_spi_remove(ispi);
|
||||
return intel_spi_probe(&pdev->dev, mem, info);
|
||||
}
|
||||
|
||||
static struct platform_driver intel_spi_platform_driver = {
|
||||
.probe = intel_spi_platform_probe,
|
||||
.remove = intel_spi_platform_remove,
|
||||
.driver = {
|
||||
.name = "intel-spi",
|
||||
},
|
File diff suppressed because it is too large
Load Diff
19
drivers/spi/spi-intel.h
Normal file
19
drivers/spi/spi-intel.h
Normal file
@ -0,0 +1,19 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Intel PCH/PCU SPI flash driver.
|
||||
*
|
||||
* Copyright (C) 2016 - 2022, Intel Corporation
|
||||
* Author: Mika Westerberg <mika.westerberg@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef SPI_INTEL_H
|
||||
#define SPI_INTEL_H
|
||||
|
||||
#include <linux/platform_data/x86/spi-intel.h>
|
||||
|
||||
struct resource;
|
||||
|
||||
int intel_spi_probe(struct device *dev, struct resource *mem,
|
||||
const struct intel_spi_boardinfo *info);
|
||||
|
||||
#endif /* SPI_INTEL_H */
|
@ -8,7 +8,7 @@
|
||||
#ifndef LPC_ICH_H
|
||||
#define LPC_ICH_H
|
||||
|
||||
#include <linux/platform_data/x86/intel-spi.h>
|
||||
#include <linux/platform_data/x86/spi-intel.h>
|
||||
|
||||
/* GPIO resources */
|
||||
#define ICH_RES_GPIO 0
|
||||
|
@ -6,8 +6,8 @@
|
||||
* Author: Mika Westerberg <mika.westerberg@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef INTEL_SPI_PDATA_H
|
||||
#define INTEL_SPI_PDATA_H
|
||||
#ifndef SPI_INTEL_PDATA_H
|
||||
#define SPI_INTEL_PDATA_H
|
||||
|
||||
enum intel_spi_type {
|
||||
INTEL_SPI_BYT = 1,
|
||||
@ -28,4 +28,4 @@ struct intel_spi_boardinfo {
|
||||
void *data;
|
||||
};
|
||||
|
||||
#endif /* INTEL_SPI_PDATA_H */
|
||||
#endif /* SPI_INTEL_PDATA_H */
|
Loading…
Reference in New Issue
Block a user