diff options
author | Gustavo Pimentel <gustavo.pimentel@synopsys.com> | 2018-07-19 04:32:18 -0400 |
---|---|---|
committer | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2018-07-19 06:46:33 -0400 |
commit | 9133e394d5ed1c81c1141d611915e09e9f32330d (patch) | |
tree | fd499633e420088b14be480550c79591781cc006 /drivers/misc/pci_endpoint_test.c | |
parent | e8817de7fbfca407f4f47da050d12b10fece5706 (diff) |
pci-epf-test/pci_endpoint_test: Use irq_type module parameter
Add new driver parameter to allow interruption type selection.
Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/misc/pci_endpoint_test.c')
-rw-r--r-- | drivers/misc/pci_endpoint_test.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 35fbfbd73a6d..349794cbe1f3 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c | |||
@@ -82,6 +82,10 @@ static bool no_msi; | |||
82 | module_param(no_msi, bool, 0444); | 82 | module_param(no_msi, bool, 0444); |
83 | MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test"); | 83 | MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test"); |
84 | 84 | ||
85 | static int irq_type = IRQ_TYPE_MSI; | ||
86 | module_param(irq_type, int, 0444); | ||
87 | MODULE_PARM_DESC(irq_type, "IRQ mode selection in pci_endpoint_test (0 - Legacy, 1 - MSI)"); | ||
88 | |||
85 | enum pci_barno { | 89 | enum pci_barno { |
86 | BAR_0, | 90 | BAR_0, |
87 | BAR_1, | 91 | BAR_1, |
@@ -108,7 +112,7 @@ struct pci_endpoint_test { | |||
108 | struct pci_endpoint_test_data { | 112 | struct pci_endpoint_test_data { |
109 | enum pci_barno test_reg_bar; | 113 | enum pci_barno test_reg_bar; |
110 | size_t alignment; | 114 | size_t alignment; |
111 | bool no_msi; | 115 | int irq_type; |
112 | }; | 116 | }; |
113 | 117 | ||
114 | static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, | 118 | 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 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, | 295 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, |
292 | size); | 296 | size); |
293 | 297 | ||
294 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, | 298 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type); |
295 | no_msi ? IRQ_TYPE_LEGACY : IRQ_TYPE_MSI); | ||
296 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); | 299 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); |
297 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, | 300 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, |
298 | COMMAND_COPY); | 301 | COMMAND_COPY); |
@@ -361,8 +364,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size) | |||
361 | 364 | ||
362 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size); | 365 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size); |
363 | 366 | ||
364 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, | 367 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type); |
365 | no_msi ? IRQ_TYPE_LEGACY : IRQ_TYPE_MSI); | ||
366 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); | 368 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); |
367 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, | 369 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, |
368 | COMMAND_READ); | 370 | COMMAND_READ); |
@@ -419,8 +421,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size) | |||
419 | 421 | ||
420 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size); | 422 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size); |
421 | 423 | ||
422 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, | 424 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type); |
423 | no_msi ? IRQ_TYPE_LEGACY : IRQ_TYPE_MSI); | ||
424 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); | 425 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); |
425 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, | 426 | pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, |
426 | COMMAND_WRITE); | 427 | COMMAND_WRITE); |
@@ -505,11 +506,14 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, | |||
505 | test->alignment = 0; | 506 | test->alignment = 0; |
506 | test->pdev = pdev; | 507 | test->pdev = pdev; |
507 | 508 | ||
509 | if (no_msi) | ||
510 | irq_type = IRQ_TYPE_LEGACY; | ||
511 | |||
508 | data = (struct pci_endpoint_test_data *)ent->driver_data; | 512 | data = (struct pci_endpoint_test_data *)ent->driver_data; |
509 | if (data) { | 513 | if (data) { |
510 | test_reg_bar = data->test_reg_bar; | 514 | test_reg_bar = data->test_reg_bar; |
511 | test->alignment = data->alignment; | 515 | test->alignment = data->alignment; |
512 | no_msi = data->no_msi; | 516 | irq_type = data->irq_type; |
513 | } | 517 | } |
514 | 518 | ||
515 | init_completion(&test->irq_raised); | 519 | init_completion(&test->irq_raised); |
@@ -529,11 +533,17 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, | |||
529 | 533 | ||
530 | pci_set_master(pdev); | 534 | pci_set_master(pdev); |
531 | 535 | ||
532 | if (!no_msi) { | 536 | switch (irq_type) { |
537 | case IRQ_TYPE_LEGACY: | ||
538 | break; | ||
539 | case IRQ_TYPE_MSI: | ||
533 | irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI); | 540 | irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI); |
534 | if (irq < 0) | 541 | if (irq < 0) |
535 | dev_err(dev, "Failed to get MSI interrupts\n"); | 542 | dev_err(dev, "Failed to get MSI interrupts\n"); |
536 | test->num_irqs = irq; | 543 | test->num_irqs = irq; |
544 | break; | ||
545 | default: | ||
546 | dev_err(dev, "Invalid IRQ type selected\n"); | ||
537 | } | 547 | } |
538 | 548 | ||
539 | err = devm_request_irq(dev, pdev->irq, pci_endpoint_test_irqhandler, | 549 | err = devm_request_irq(dev, pdev->irq, pci_endpoint_test_irqhandler, |