From: Hamish Moffatt <hamish@cloud.net.au>
To: linux-ide@vger.kernel.org
Subject: [PATCH] pata_ixp4xx_cf: support single chip-select operation
Date: Thu, 6 Mar 2008 16:19:15 +1100 [thread overview]
Message-ID: <20080306051915.GA18841@cloud.net.au> (raw)
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 <hamish@cloud.net.au>
Index: 2.6.24/drivers/ata/pata_ixp4xx_cf.c
===================================================================
--- 2.6.24/drivers/ata/pata_ixp4xx_cf.c (revision 3791)
+++ 2.6.24/drivers/ata/pata_ixp4xx_cf.c (working copy)
@@ -178,11 +178,13 @@ static __devinit int ixp4xx_pata_probe(s
struct 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");
Index: 2.6.24/include/asm-arm/arch-ixp4xx/platform.h
===================================================================
--- 2.6.24/include/asm-arm/arch-ixp4xx/platform.h (revision 3791)
+++ 2.6.24/include/asm-arm/arch-ixp4xx/platform.h (working copy)
@@ -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 {
--
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>
next reply other threads:[~2008-03-06 6:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-06 5:19 Hamish Moffatt [this message]
2008-03-11 0:51 ` [PATCH] pata_ixp4xx_cf: support single chip-select operation Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080306051915.GA18841@cloud.net.au \
--to=hamish@cloud.net.au \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).