blob: 2a52ff3da01d2c8052f917660e7c4ee58f90558f [file] [log] [blame]
Angel Pons230e4f9d2020-04-05 15:47:14 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Lee Leahy16bc9ba2017-04-01 20:33:58 -07002
Lee Leahy48dbc662017-05-08 16:56:03 -07003#include <commonlib/sdhci.h>
4#include <commonlib/storage.h>
Lee Leahy16bc9ba2017-04-01 20:33:58 -07005#include <device/device.h>
6#include <device/pci.h>
7#include <device/pci_ids.h>
Lee Leahy16bc9ba2017-04-01 20:33:58 -07008#include <soc/storage_test.h>
9
10static void init(struct device *dev)
11{
12 /* Run the SD test */
Julius Wernercd49cce2019-03-05 16:53:33 -080013 if (CONFIG(STORAGE_TEST)) {
Lee Leahy16bc9ba2017-04-01 20:33:58 -070014 uint32_t bar;
15 uint32_t previous_bar;
16 uint16_t previous_command;
17
18 bar = storage_test_init(dev, &previous_bar, &previous_command);
19 storage_test(bar, 0);
20 storage_test_complete(dev, previous_bar, previous_command);
21 }
22}
23
24static const struct device_operations device_ops = {
25 .read_resources = pci_dev_read_resources,
26 .set_resources = pci_dev_set_resources,
27 .enable_resources = pci_dev_enable_resources,
28 .init = init,
29};
30
31static const struct pci_driver pmc __pci_driver = {
32 .ops = &device_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010033 .vendor = PCI_VID_INTEL,
Lee Leahy16bc9ba2017-04-01 20:33:58 -070034 .device = 0x08A7,
35};