mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Let's use the pci/platform-specialized functions for mapping a resource, and pass the mapped address to intel_spi_probe. Benefits are: - No separate call needed for getting the resource, and no access to struct pci_dev internals (pdev->resource[]). - More user-friendly output in /proc/iomem. In my case: before 80704000-80704fff : 0000:00:1f.5 80704000-80704fff : 0000:00:1f.5 0000:00:1f.5 after 80704000-80704fff : 0000:00:1f.5 80704000-80704fff : spi_intel_pci Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://patch.msgid.link/2585fa05-60c4-48c4-a838-e87014665ae2@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
43 lines
1 KiB
C
43 lines
1 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Intel PCH/PCU SPI flash platform driver.
|
|
*
|
|
* Copyright (C) 2016 - 2022, Intel Corporation
|
|
* Author: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
#include "spi-intel.h"
|
|
|
|
static int intel_spi_platform_probe(struct platform_device *pdev)
|
|
{
|
|
struct intel_spi_boardinfo *info;
|
|
void __iomem *base;
|
|
|
|
info = dev_get_platdata(&pdev->dev);
|
|
if (!info)
|
|
return -EINVAL;
|
|
|
|
base = devm_platform_ioremap_resource(pdev, 0);
|
|
if (IS_ERR(base))
|
|
return PTR_ERR(base);
|
|
|
|
return intel_spi_probe(&pdev->dev, base, info);
|
|
}
|
|
|
|
static struct platform_driver intel_spi_platform_driver = {
|
|
.probe = intel_spi_platform_probe,
|
|
.driver = {
|
|
.name = "intel-spi",
|
|
.dev_groups = intel_spi_groups,
|
|
},
|
|
};
|
|
|
|
module_platform_driver(intel_spi_platform_driver);
|
|
|
|
MODULE_DESCRIPTION("Intel PCH/PCU SPI flash platform driver");
|
|
MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_ALIAS("platform:intel-spi");
|