Angel Pons | 230e4f9d | 2020-04-05 15:47:14 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Lee Leahy | 16bc9ba | 2017-04-01 20:33:58 -0700 | [diff] [blame] | 2 | |
Lee Leahy | 48dbc66 | 2017-05-08 16:56:03 -0700 | [diff] [blame] | 3 | #include <commonlib/sdhci.h> |
| 4 | #include <commonlib/storage.h> |
Lee Leahy | 16bc9ba | 2017-04-01 20:33:58 -0700 | [diff] [blame] | 5 | #include <device/device.h> |
| 6 | #include <device/pci.h> |
| 7 | #include <device/pci_ids.h> |
Lee Leahy | 16bc9ba | 2017-04-01 20:33:58 -0700 | [diff] [blame] | 8 | #include <soc/storage_test.h> |
| 9 | |
| 10 | static void init(struct device *dev) |
| 11 | { |
| 12 | /* Run the SD test */ |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 13 | if (CONFIG(STORAGE_TEST)) { |
Lee Leahy | 16bc9ba | 2017-04-01 20:33:58 -0700 | [diff] [blame] | 14 | 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 | |
| 24 | static 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 | |
| 31 | static const struct pci_driver pmc __pci_driver = { |
| 32 | .ops = &device_ops, |
| 33 | .vendor = PCI_VENDOR_ID_INTEL, |
| 34 | .device = 0x08A7, |
| 35 | }; |