[PATCH 13/17] staging: ipack: Add support for IPACK_MEM16_SPACE.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jens Taprogge <jens.taprogge@xxxxxxxxxxxx>

Signed-off-by: Jens Taprogge <jens.taprogge@xxxxxxxxxxxx>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@xxxxxxxxxx>
---
 drivers/staging/ipack/bridges/tpci200.c |   19 +++++++++++++++++++
 drivers/staging/ipack/ipack.h           |    1 +
 2 files changed, 20 insertions(+)

diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c
index 7127a3b..376e794 100644
--- a/drivers/staging/ipack/bridges/tpci200.c
+++ b/drivers/staging/ipack/bridges/tpci200.c
@@ -33,6 +33,7 @@ static const size_t tpci200_space_size[IPACK_SPACE_COUNT] = {
 	[IPACK_ID_SPACE]    = TPCI200_ID_SPACE_SIZE,
 	[IPACK_INT_SPACE]   = TPCI200_INT_SPACE_SIZE,
 	[IPACK_MEM8_SPACE]  = TPCI200_MEM8_SPACE_SIZE,
+	[IPACK_MEM16_SPACE] = TPCI200_MEM16_SPACE_SIZE,
 };
 
 static const size_t tpci200_space_interval[IPACK_SPACE_COUNT] = {
@@ -40,6 +41,7 @@ static const size_t tpci200_space_interval[IPACK_SPACE_COUNT] = {
 	[IPACK_ID_SPACE]    = TPCI200_ID_SPACE_INTERVAL,
 	[IPACK_INT_SPACE]   = TPCI200_INT_SPACE_INTERVAL,
 	[IPACK_MEM8_SPACE]  = TPCI200_MEM8_SPACE_INTERVAL,
+	[IPACK_MEM16_SPACE] = TPCI200_MEM16_SPACE_INTERVAL,
 };
 
 static struct tpci200_board *check_slot(struct ipack_device *dev)
@@ -94,6 +96,7 @@ static void tpci200_unregister(struct tpci200_board *tpci200)
 
 	pci_release_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR);
 	pci_release_region(tpci200->info->pdev, TPCI200_IO_ID_INT_SPACES_BAR);
+	pci_release_region(tpci200->info->pdev, TPCI200_MEM16_SPACE_BAR);
 	pci_release_region(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR);
 	pci_release_region(tpci200->info->pdev, TPCI200_CFG_MEM_BAR);
 
@@ -282,6 +285,17 @@ static int tpci200_register(struct tpci200_board *tpci200)
 		goto out_release_ioid_int_space;
 	}
 
+	/* Request MEM16 space (Bar 4) */
+	res = pci_request_region(tpci200->info->pdev, TPCI200_MEM16_SPACE_BAR,
+				 "Carrier MEM16 space");
+	if (res) {
+		dev_err(&tpci200->info->pdev->dev,
+			"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!",
+			tpci200->info->pdev->bus->number,
+			tpci200->info->pdev->devfn);
+		goto out_release_mem8_space;
+	}
+
 	/* Map internal tpci200 driver user space */
 	tpci200->info->interface_regs =
 		ioremap_nocache(pci_resource_start(tpci200->info->pdev,
@@ -300,6 +314,9 @@ static int tpci200_register(struct tpci200_board *tpci200)
 	tpci200->mod_mem[IPACK_MEM8_SPACE] =
 		pci_resource_start(tpci200->info->pdev,
 				   TPCI200_MEM8_SPACE_BAR);
+	tpci200->mod_mem[IPACK_MEM16_SPACE] =
+		pci_resource_start(tpci200->info->pdev,
+				   TPCI200_MEM16_SPACE_BAR);
 
 	/* Set the default parameters of the slot
 	 * INT0 disabled, level sensitive
@@ -326,6 +343,8 @@ static int tpci200_register(struct tpci200_board *tpci200)
 
 	return 0;
 
+out_release_mem8_space:
+	pci_release_region(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR);
 out_release_ioid_int_space:
 	pci_release_region(tpci200->info->pdev, TPCI200_IO_ID_INT_SPACES_BAR);
 out_release_ip_space:
diff --git a/drivers/staging/ipack/ipack.h b/drivers/staging/ipack/ipack.h
index e35fe54..689af92 100644
--- a/drivers/staging/ipack/ipack.h
+++ b/drivers/staging/ipack/ipack.h
@@ -36,6 +36,7 @@ enum ipack_space {
 	IPACK_ID_SPACE,
 	IPACK_INT_SPACE,
 	IPACK_MEM8_SPACE,
+	IPACK_MEM16_SPACE,
 	/* Dummy for counting the number of entries.  Must remain the last
 	 * entry */
 	IPACK_SPACE_COUNT,
-- 
1.7.10.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux