#define PCI_ENDPOINT_TEST_FLAGS                        0x2c
 #define FLAG_USE_DMA                           BIT(0)
 
+#define PCI_ENDPOINT_TEST_CAPS                 0x30
+#define CAP_UNALIGNED_ACCESS                   BIT(0)
+
 #define PCI_DEVICE_ID_TI_AM654                 0xb00c
 #define PCI_DEVICE_ID_TI_J7200                 0xb00f
 #define PCI_DEVICE_ID_TI_AM64                  0xb010
        .unlocked_ioctl = pci_endpoint_test_ioctl,
 };
 
+static void pci_endpoint_test_get_capabilities(struct pci_endpoint_test *test)
+{
+       struct pci_dev *pdev = test->pdev;
+       struct device *dev = &pdev->dev;
+       u32 caps;
+
+       caps = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_CAPS);
+       dev_dbg(dev, "PCI_ENDPOINT_TEST_CAPS: %#x\n", caps);
+
+       /* CAP_UNALIGNED_ACCESS is set if the EP can do unaligned access */
+       if (caps & CAP_UNALIGNED_ACCESS)
+               test->alignment = 0;
+}
+
 static int pci_endpoint_test_probe(struct pci_dev *pdev,
                                   const struct pci_device_id *ent)
 {
                goto err_kfree_test_name;
        }
 
+       pci_endpoint_test_get_capabilities(test);
+
        misc_device = &test->miscdev;
        misc_device->minor = MISC_DYNAMIC_MINOR;
        misc_device->name = kstrdup(name, GFP_KERNEL);