|
69 | 69 | #define PCI_ENDPOINT_TEST_FLAGS 0x2c
|
70 | 70 | #define FLAG_USE_DMA BIT(0)
|
71 | 71 |
|
| 72 | +#define PCI_ENDPOINT_TEST_CAPS 0x30 |
| 73 | +#define CAP_UNALIGNED_ACCESS BIT(0) |
| 74 | + |
72 | 75 | #define PCI_DEVICE_ID_TI_AM654 0xb00c
|
73 | 76 | #define PCI_DEVICE_ID_TI_J7200 0xb00f
|
74 | 77 | #define PCI_DEVICE_ID_TI_AM64 0xb010
|
@@ -805,6 +808,20 @@ static const struct file_operations pci_endpoint_test_fops = {
|
805 | 808 | .unlocked_ioctl = pci_endpoint_test_ioctl,
|
806 | 809 | };
|
807 | 810 |
|
| 811 | +static void pci_endpoint_test_get_capabilities(struct pci_endpoint_test *test) |
| 812 | +{ |
| 813 | + struct pci_dev *pdev = test->pdev; |
| 814 | + struct device *dev = &pdev->dev; |
| 815 | + u32 caps; |
| 816 | + |
| 817 | + caps = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_CAPS); |
| 818 | + dev_dbg(dev, "PCI_ENDPOINT_TEST_CAPS: %#x\n", caps); |
| 819 | + |
| 820 | + /* CAP_UNALIGNED_ACCESS is set if the EP can do unaligned access */ |
| 821 | + if (caps & CAP_UNALIGNED_ACCESS) |
| 822 | + test->alignment = 0; |
| 823 | +} |
| 824 | + |
808 | 825 | static int pci_endpoint_test_probe(struct pci_dev *pdev,
|
809 | 826 | const struct pci_device_id *ent)
|
810 | 827 | {
|
@@ -906,6 +923,8 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
|
906 | 923 | goto err_kfree_test_name;
|
907 | 924 | }
|
908 | 925 |
|
| 926 | + pci_endpoint_test_get_capabilities(test); |
| 927 | + |
909 | 928 | misc_device = &test->miscdev;
|
910 | 929 | misc_device->minor = MISC_DYNAMIC_MINOR;
|
911 | 930 | misc_device->name = kstrdup(name, GFP_KERNEL);
|
|
0 commit comments