[ARM] 4429/2: iop13xx: expose the 'iop' attribute versions of the tpmi control registers
authorDan Williams <dan.j.williams@intel.com>
Wed, 6 Jun 2007 16:51:21 +0000 (17:51 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 12 Jul 2007 10:11:55 +0000 (11:11 +0100)
The tpmi control registers can be accessed on the internal bus via an
address with PCI attributes or IOP attributes (i.e. read-only,
read-write... etc).  The sas driver needs access to the iop-attribute
registers for initialization.

Changelog:
* use ARRAY_SIZE for num_resources, Russell King

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-iop13xx/tpmi.c

index d3dc278213da10892934032db9f75c241182a918..2476347ea62f13b5119a28e1fd6f185d76a8ad8f 100644 (file)
 #define IOP13XX_TPMI_MMR(dev)  IOP13XX_REG_ADDR32_PHYS(0x48000 + (dev << 12))
 #define IOP13XX_TPMI_MEM(dev)  IOP13XX_REG_ADDR32_PHYS(0x60000 + (dev << 13))
 #define IOP13XX_TPMI_CTRL(dev) IOP13XX_REG_ADDR32_PHYS(0x50000 + (dev << 10))
+#define IOP13XX_TPMI_IOP_CTRL(dev) (IOP13XX_TPMI_CTRL(dev) + 0x2000)
 #define IOP13XX_TPMI_MMR_SIZE      (SZ_4K - 1)
 #define IOP13XX_TPMI_MEM_SIZE      (255)
 #define IOP13XX_TPMI_MEM_CTRL      (SZ_1K - 1)
 #define IOP13XX_TPMI_RESOURCE_MMR  0
 #define IOP13XX_TPMI_RESOURCE_MEM  1
 #define IOP13XX_TPMI_RESOURCE_CTRL 2
-#define IOP13XX_TPMI_RESOURCE_IRQ  3
+#define IOP13XX_TPMI_RESOURCE_IOP_CTRL 3
+#define IOP13XX_TPMI_RESOURCE_IRQ  4
 
 static struct resource iop13xx_tpmi_0_resources[] = {
        [IOP13XX_TPMI_RESOURCE_MMR] = {
@@ -53,6 +55,11 @@ static struct resource iop13xx_tpmi_0_resources[] = {
                .end = IOP13XX_TPMI_CTRL(0) + IOP13XX_TPMI_MEM_CTRL,
                .flags = IORESOURCE_MEM,
        },
+       [IOP13XX_TPMI_RESOURCE_IOP_CTRL] = {
+               .start = IOP13XX_TPMI_IOP_CTRL(0),
+               .end = IOP13XX_TPMI_IOP_CTRL(0) + IOP13XX_TPMI_MEM_CTRL,
+               .flags = IORESOURCE_MEM,
+       },
        [IOP13XX_TPMI_RESOURCE_IRQ] = {
                .start = IRQ_IOP13XX_TPMI0_OUT,
                .end = IRQ_IOP13XX_TPMI0_OUT,
@@ -76,6 +83,11 @@ static struct resource iop13xx_tpmi_1_resources[] = {
                .end = IOP13XX_TPMI_CTRL(1) + IOP13XX_TPMI_MEM_CTRL,
                .flags = IORESOURCE_MEM,
        },
+       [IOP13XX_TPMI_RESOURCE_IOP_CTRL] = {
+               .start = IOP13XX_TPMI_IOP_CTRL(1),
+               .end = IOP13XX_TPMI_IOP_CTRL(1) + IOP13XX_TPMI_MEM_CTRL,
+               .flags = IORESOURCE_MEM,
+       },
        [IOP13XX_TPMI_RESOURCE_IRQ] = {
                .start = IRQ_IOP13XX_TPMI1_OUT,
                .end = IRQ_IOP13XX_TPMI1_OUT,
@@ -99,6 +111,11 @@ static struct resource iop13xx_tpmi_2_resources[] = {
                .end = IOP13XX_TPMI_CTRL(2) + IOP13XX_TPMI_MEM_CTRL,
                .flags = IORESOURCE_MEM,
        },
+       [IOP13XX_TPMI_RESOURCE_IOP_CTRL] = {
+               .start = IOP13XX_TPMI_IOP_CTRL(2),
+               .end = IOP13XX_TPMI_IOP_CTRL(2) + IOP13XX_TPMI_MEM_CTRL,
+               .flags = IORESOURCE_MEM,
+       },
        [IOP13XX_TPMI_RESOURCE_IRQ] = {
                .start = IRQ_IOP13XX_TPMI2_OUT,
                .end = IRQ_IOP13XX_TPMI2_OUT,
@@ -122,6 +139,11 @@ static struct resource iop13xx_tpmi_3_resources[] = {
                .end = IOP13XX_TPMI_CTRL(3) + IOP13XX_TPMI_MEM_CTRL,
                .flags = IORESOURCE_MEM,
        },
+       [IOP13XX_TPMI_RESOURCE_IOP_CTRL] = {
+               .start = IOP13XX_TPMI_IOP_CTRL(3),
+               .end = IOP13XX_TPMI_IOP_CTRL(3) + IOP13XX_TPMI_MEM_CTRL,
+               .flags = IORESOURCE_MEM,
+       },
        [IOP13XX_TPMI_RESOURCE_IRQ] = {
                .start = IRQ_IOP13XX_TPMI3_OUT,
                .end = IRQ_IOP13XX_TPMI3_OUT,
@@ -133,7 +155,7 @@ u64 iop13xx_tpmi_mask = DMA_64BIT_MASK;
 static struct platform_device iop13xx_tpmi_0_device = {
        .name = "iop-tpmi",
        .id = 0,
-       .num_resources = 4,
+       .num_resources = ARRAY_SIZE(iop13xx_tpmi_0_resources),
        .resource = iop13xx_tpmi_0_resources,
        .dev = {
                .dma_mask          = &iop13xx_tpmi_mask,
@@ -144,7 +166,7 @@ static struct platform_device iop13xx_tpmi_0_device = {
 static struct platform_device iop13xx_tpmi_1_device = {
        .name = "iop-tpmi",
        .id = 1,
-       .num_resources = 4,
+       .num_resources = ARRAY_SIZE(iop13xx_tpmi_1_resources),
        .resource = iop13xx_tpmi_1_resources,
        .dev = {
                .dma_mask          = &iop13xx_tpmi_mask,
@@ -155,7 +177,7 @@ static struct platform_device iop13xx_tpmi_1_device = {
 static struct platform_device iop13xx_tpmi_2_device = {
        .name = "iop-tpmi",
        .id = 2,
-       .num_resources = 4,
+       .num_resources = ARRAY_SIZE(iop13xx_tpmi_2_resources),
        .resource = iop13xx_tpmi_2_resources,
        .dev = {
                .dma_mask          = &iop13xx_tpmi_mask,
@@ -166,7 +188,7 @@ static struct platform_device iop13xx_tpmi_2_device = {
 static struct platform_device iop13xx_tpmi_3_device = {
        .name = "iop-tpmi",
        .id = 3,
-       .num_resources = 4,
+       .num_resources = ARRAY_SIZE(iop13xx_tpmi_3_resources),
        .resource = iop13xx_tpmi_3_resources,
        .dev = {
                .dma_mask          = &iop13xx_tpmi_mask,