blob: 769b853af2570b2b7623eaf24951dd8d510f8dcc [file] [log] [blame]
John Zhaob1dd0192022-03-09 17:19:33 -08001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#define __SIMPLE_DEVICE__
4
John Zhaob1dd0192022-03-09 17:19:33 -08005#include <device/pci.h>
6#include <device/pci_ids.h>
7#include <intelblocks/p2sb.h>
8#include <intelblocks/p2sblib.h>
9#include <intelblocks/pcr.h>
10#include <soc/iomap.h>
11#include <soc/pci_devs.h>
12
13uint32_t ioe_p2sb_sbi_read(uint8_t pid, uint16_t reg)
14{
15 return p2sb_dev_sbi_read(PCI_DEV_IOE_P2SB, pid, reg);
16}
17
18void ioe_p2sb_sbi_write(uint8_t pid, uint16_t reg, uint32_t val)
19{
20 p2sb_dev_sbi_write(PCI_DEV_IOE_P2SB, pid, reg, val);
21}
22
23void ioe_p2sb_enable_bar(void)
24{
25 p2sb_dev_enable_bar(PCI_DEV_IOE_P2SB, IOE_P2SB_BAR);
26}
27
28static void read_resources(struct device *dev)
29{
Arthur Heymansd5e70b22023-07-05 11:58:20 +020030 mmio_range(dev, 0, IOE_P2SB_BAR, IOE_P2SB_SIZE);
John Zhaob1dd0192022-03-09 17:19:33 -080031}
32
33struct device_operations device_ops = {
34 .read_resources = read_resources,
35 .set_resources = noop_set_resources,
36 .ops_pci = &pci_dev_ops_pci,
37};
38
39static const unsigned short pci_device_ids[] = {
40 PCI_DID_INTEL_MTL_IOE_M_P2SB,
41 PCI_DID_INTEL_MTL_IOE_P_P2SB,
42 0,
43};
44
45static const struct pci_driver ioe_p2sb __pci_driver = {
46 .ops = &device_ops,
47 .vendor = PCI_VID_INTEL,
48 .devices = pci_device_ids,
49};