diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2019-03-25 05:39:46 -0400 |
---|---|---|
committer | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2019-05-01 10:50:13 -0400 |
commit | 5bb04b19230c02cc1b450b029856cbe093e09908 (patch) | |
tree | 0bc6058c786892ee08e1e6f55eb82b7687709634 /drivers/misc | |
parent | 6b7330303a8186fb211357e6d379237fe9d2ece1 (diff) |
misc: pci_endpoint_test: Add support to test PCI EP in AM654x
TI's AM654x PCIe EP has a restriction that BAR_0 is mapped to
application registers. "PCIe Inbound Address Translation" section in
AM65x Sitara Processors TRM (SPRUID7 – April 2018) describes BAR0 as
reserved.
Configure pci_endpoint_test to use BAR_2 instead.
Also set alignment to 64K since "PCIe Subsystem Address Translation"
section in TRM indicates minimum ATU window size is 64K.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/pci_endpoint_test.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 29582fe57151..e015e8fa9bd3 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c | |||
@@ -75,6 +75,11 @@ | |||
75 | #define PCI_ENDPOINT_TEST_IRQ_TYPE 0x24 | 75 | #define PCI_ENDPOINT_TEST_IRQ_TYPE 0x24 |
76 | #define PCI_ENDPOINT_TEST_IRQ_NUMBER 0x28 | 76 | #define PCI_ENDPOINT_TEST_IRQ_NUMBER 0x28 |
77 | 77 | ||
78 | #define PCI_DEVICE_ID_TI_AM654 0xb00c | ||
79 | |||
80 | #define is_am654_pci_dev(pdev) \ | ||
81 | ((pdev)->device == PCI_DEVICE_ID_TI_AM654) | ||
82 | |||
78 | static DEFINE_IDA(pci_endpoint_test_ida); | 83 | static DEFINE_IDA(pci_endpoint_test_ida); |
79 | 84 | ||
80 | #define to_endpoint_test(priv) container_of((priv), struct pci_endpoint_test, \ | 85 | #define to_endpoint_test(priv) container_of((priv), struct pci_endpoint_test, \ |
@@ -588,6 +593,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, | |||
588 | int ret = -EINVAL; | 593 | int ret = -EINVAL; |
589 | enum pci_barno bar; | 594 | enum pci_barno bar; |
590 | struct pci_endpoint_test *test = to_endpoint_test(file->private_data); | 595 | struct pci_endpoint_test *test = to_endpoint_test(file->private_data); |
596 | struct pci_dev *pdev = test->pdev; | ||
591 | 597 | ||
592 | mutex_lock(&test->mutex); | 598 | mutex_lock(&test->mutex); |
593 | switch (cmd) { | 599 | switch (cmd) { |
@@ -595,6 +601,8 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, | |||
595 | bar = arg; | 601 | bar = arg; |
596 | if (bar < 0 || bar > 5) | 602 | if (bar < 0 || bar > 5) |
597 | goto ret; | 603 | goto ret; |
604 | if (is_am654_pci_dev(pdev) && bar == BAR_0) | ||
605 | goto ret; | ||
598 | ret = pci_endpoint_test_bar(test, bar); | 606 | ret = pci_endpoint_test_bar(test, bar); |
599 | break; | 607 | break; |
600 | case PCITEST_LEGACY_IRQ: | 608 | case PCITEST_LEGACY_IRQ: |
@@ -785,11 +793,20 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev) | |||
785 | pci_disable_device(pdev); | 793 | pci_disable_device(pdev); |
786 | } | 794 | } |
787 | 795 | ||
796 | static const struct pci_endpoint_test_data am654_data = { | ||
797 | .test_reg_bar = BAR_2, | ||
798 | .alignment = SZ_64K, | ||
799 | .irq_type = IRQ_TYPE_MSI, | ||
800 | }; | ||
801 | |||
788 | static const struct pci_device_id pci_endpoint_test_tbl[] = { | 802 | static const struct pci_device_id pci_endpoint_test_tbl[] = { |
789 | { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_DRA74x) }, | 803 | { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_DRA74x) }, |
790 | { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_DRA72x) }, | 804 | { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_DRA72x) }, |
791 | { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, 0x81c0) }, | 805 | { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, 0x81c0) }, |
792 | { PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, 0xedda) }, | 806 | { PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, 0xedda) }, |
807 | { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_AM654), | ||
808 | .driver_data = (kernel_ulong_t)&am654_data | ||
809 | }, | ||
793 | { } | 810 | { } |
794 | }; | 811 | }; |
795 | MODULE_DEVICE_TABLE(pci, pci_endpoint_test_tbl); | 812 | MODULE_DEVICE_TABLE(pci, pci_endpoint_test_tbl); |