pata_ixp4xx_cf: support single chip-select operation
PATCH 1/1 pata_ixp4xx_cf: support single chip-select operation
Compact flash cards require two chip selects, and pata_ixp4xx_cf currently maps these to two IXP4XX chip selects. On our board we use a single IXP4XX CS line and decode an address line to split it into two.
This patch allows this by allowing you to specify the second CS region as an offset from the first.
Signed-off-by Hamish Moffatt <[email protected]>
drivers/ata/pata_ixp4xx_cf.c +18 -7
@@ -178,11 +178,13 @@ static __devinit int ixp4xx_pata_probe(sstruct ata_host *host;struct ata_port *ap;struct ixp4xx_pata_data *data = pdev->dev.platform_data; +unsigned long raw_cs1, cs1_offset; cs0 =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); cs1 =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); + cs1_offset = data->cs1_offset; -if (!cs0 || !cs1) +if (!cs0 || (!cs1 && !cs1_offset))return -EINVAL ;/* allocate host */
@@ -193,19 +195,28 @@ static __devinit int ixp4xx_pata_probe(s/* acquire resources and fill host */ pdev->dev.coherent_dma_mask =DMA_32BIT_MASK ; - data->cs0 =devm_ioremap (&pdev->dev, cs0->start,0x1000 ); - data->cs1 =devm_ioremap (&pdev->dev, cs1->start,0x1000 ); - -if (!data->cs0 || !data->cs1) + data->cs0 =devm_ioremap (&pdev->dev, cs0->start, (cs1_offset +0x8 +PAGE_SIZE -1 ) &PAGE_MASK ); +if (!data->cs0)return -ENOMEM ; +if (cs1) { + data->cs1 =devm_ioremap (&pdev->dev, cs1->start,PAGE_SIZE ); +if (!data->cs1) +return -ENOMEM ; + raw_cs1 = cs1->start; + }else { + data->cs1 = data->cs0 + cs1_offset; + raw_cs1 = cs0->start + cs1_offset; + } + irq =platform_get_irq (pdev,0 );if (irq)set_irq_type (irq,IRQT_RISING );/* Setup expansion bus chip selects */ *data->cs0_cfg = data->cs0_bits; - *data->cs1_cfg = data->cs1_bits; +if (data->cs1_bits &IXP4XX_EXP_BUS_CS_EN ) + *data->cs1_cfg = data->cs1_bits; ap = host->ports[0 ];
@@ -213,7 +224,7 @@ static __devinit int ixp4xx_pata_probe(s ap->pio_mask =0x1f ;/* PIO4 */ ap->flags |=ATA_FLAG_MMIO |ATA_FLAG_NO_LEGACY |ATA_FLAG_NO_ATAPI ; -ixp4xx_setup_port (ap, data, cs0->start, cs1->start); +ixp4xx_setup_port (ap, data, cs0->start, raw_cs1);dev_printk (KERN_INFO , &pdev->dev,"version " DRV_VERSION "\n" );
include/asm-arm/arch-ixp4xx/platform.h +1 -0
@@ -98,6 +98,7 @@ struct ixp4xx_pata_data {unsigned long cs1_bits;void __iomem *cs0;void __iomem *cs1; +unsigned long cs1_offset; };struct ixp4xx_ide_port {
Signature · 1 line
Hamish Moffatt VK3SB <[email protected]> <[email protected]>
Jeff Garzik
AppliedQuoted 8 lines · Hamish Moffatt
Compact flash cards require two chip selects, and
pata_ixp4xx_cfcurrently maps these to two IXP4XX chip selects. On our board we use a single IXP4XX CS line and decode an address line to split it into two.This patch allows this by allowing you to specify the second CS region as an offset from the first.
Signed-off-by Hamish Moffatt <[email protected]>
applied