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

Register a new driver(spi_amd_pci) for the HID2 SPI controller using the PCI ID of the LPC bridge device. Add a new common probe function in spi_amd driver to encapsulate the code required for registering the controller driver. This function will be utilized by both the existing ACPI driver and the newly introduced PCI-based driver for the HID2 SPI controller. The MMIO register base address of the HID2 SPI controller can be obtained from the PCI LPC bridge registers. By implementing these changes, the DMA buffer will be correctly associated with the LPC bridge device, preventing IO_PAGE_FAULT caused by IOMMU when the LPC bridge attempts DMA operations on addresses owned by the HID2 SPI controller. Co-developed-by: Krishnamoorthi M <krishnamoorthi.m@amd.com> Signed-off-by: Krishnamoorthi M <krishnamoorthi.m@amd.com> Co-developed-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com> Link: https://patch.msgid.link/20250402121514.2941334-1-Raju.Rangoju@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* AMD SPI controller driver common stuff
|
|
*
|
|
* Copyright (c) 2025, Advanced Micro Devices, Inc.
|
|
* All Rights Reserved.
|
|
*
|
|
* Author: Krishnamoorthi M <krishnamoorthi.m@amd.com>
|
|
*/
|
|
|
|
#ifndef SPI_AMD_H
|
|
#define SPI_AMD_H
|
|
|
|
/**
|
|
* enum amd_spi_versions - SPI controller versions
|
|
* @AMD_SPI_V1: AMDI0061 hardware version
|
|
* @AMD_SPI_V2: AMDI0062 hardware version
|
|
* @AMD_HID2_SPI: AMDI0063 hardware version
|
|
*/
|
|
enum amd_spi_versions {
|
|
AMD_SPI_V1 = 1,
|
|
AMD_SPI_V2,
|
|
AMD_HID2_SPI,
|
|
};
|
|
|
|
/**
|
|
* struct amd_spi - SPI driver instance
|
|
* @io_remap_addr: Start address of the SPI controller registers
|
|
* @phy_dma_buf: Physical address of DMA buffer
|
|
* @dma_virt_addr: Virtual address of DMA buffer
|
|
* @version: SPI controller hardware version
|
|
* @speed_hz: Device frequency
|
|
*/
|
|
struct amd_spi {
|
|
void __iomem *io_remap_addr;
|
|
dma_addr_t phy_dma_buf;
|
|
void *dma_virt_addr;
|
|
enum amd_spi_versions version;
|
|
unsigned int speed_hz;
|
|
};
|
|
|
|
int amd_spi_probe_common(struct device *dev, struct spi_controller *host);
|
|
|
|
#endif /* SPI_AMD_H */
|