Commit 9133e394 authored by Gustavo Pimentel's avatar Gustavo Pimentel Committed by Lorenzo Pieralisi

pci-epf-test/pci_endpoint_test: Use irq_type module parameter

Add new driver parameter to allow interruption type selection.
Signed-off-by: default avatarGustavo Pimentel <gustavo.pimentel@synopsys.com>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent e8817de7
...@@ -82,6 +82,10 @@ static bool no_msi; ...@@ -82,6 +82,10 @@ static bool no_msi;
module_param(no_msi, bool, 0444); module_param(no_msi, bool, 0444);
MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test"); MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test");
static int irq_type = IRQ_TYPE_MSI;
module_param(irq_type, int, 0444);
MODULE_PARM_DESC(irq_type, "IRQ mode selection in pci_endpoint_test (0 - Legacy, 1 - MSI)");
enum pci_barno { enum pci_barno {
BAR_0, BAR_0,
BAR_1, BAR_1,
...@@ -108,7 +112,7 @@ struct pci_endpoint_test { ...@@ -108,7 +112,7 @@ struct pci_endpoint_test {
struct pci_endpoint_test_data { struct pci_endpoint_test_data {
enum pci_barno test_reg_bar; enum pci_barno test_reg_bar;
size_t alignment; size_t alignment;
bool no_msi; int irq_type;
}; };
static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test,
...@@ -291,8 +295,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size) ...@@ -291,8 +295,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size)
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE,
size); size);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type);
no_msi ? IRQ_TYPE_LEGACY : IRQ_TYPE_MSI);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
COMMAND_COPY); COMMAND_COPY);
...@@ -361,8 +364,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size) ...@@ -361,8 +364,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size)
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type);
no_msi ? IRQ_TYPE_LEGACY : IRQ_TYPE_MSI);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
COMMAND_READ); COMMAND_READ);
...@@ -419,8 +421,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size) ...@@ -419,8 +421,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size)
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type);
no_msi ? IRQ_TYPE_LEGACY : IRQ_TYPE_MSI);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
COMMAND_WRITE); COMMAND_WRITE);
...@@ -505,11 +506,14 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, ...@@ -505,11 +506,14 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
test->alignment = 0; test->alignment = 0;
test->pdev = pdev; test->pdev = pdev;
if (no_msi)
irq_type = IRQ_TYPE_LEGACY;
data = (struct pci_endpoint_test_data *)ent->driver_data; data = (struct pci_endpoint_test_data *)ent->driver_data;
if (data) { if (data) {
test_reg_bar = data->test_reg_bar; test_reg_bar = data->test_reg_bar;
test->alignment = data->alignment; test->alignment = data->alignment;
no_msi = data->no_msi; irq_type = data->irq_type;
} }
init_completion(&test->irq_raised); init_completion(&test->irq_raised);
...@@ -529,11 +533,17 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, ...@@ -529,11 +533,17 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
pci_set_master(pdev); pci_set_master(pdev);
if (!no_msi) { switch (irq_type) {
case IRQ_TYPE_LEGACY:
break;
case IRQ_TYPE_MSI:
irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI); irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI);
if (irq < 0) if (irq < 0)
dev_err(dev, "Failed to get MSI interrupts\n"); dev_err(dev, "Failed to get MSI interrupts\n");
test->num_irqs = irq; test->num_irqs = irq;
break;
default:
dev_err(dev, "Invalid IRQ type selected\n");
} }
err = devm_request_irq(dev, pdev->irq, pci_endpoint_test_irqhandler, err = devm_request_irq(dev, pdev->irq, pci_endpoint_test_irqhandler,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment