forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Mauro Lima <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Acked-by: Lee Jones <[email protected]> Acked-by: Pratyush Yadav <[email protected]> Reviewed-by: Tudor Ambarus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
- Loading branch information
Showing
11 changed files
with
628 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
*/ | ||
|
||
#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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,45 +2,30 @@ | |
/* | ||
* Intel PCH/PCU SPI flash platform driver. | ||
* | ||
* Copyright (C) 2016, Intel Corporation | ||
* Copyright (C) 2016 - 2022, Intel Corporation | ||
* Author: Mika Westerberg <[email protected]> | ||
*/ | ||
|
||
#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); | ||
if (!info) | ||
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", | ||
}, | ||
|
Oops, something went wrong.