All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3 v4] AT91: initialize Compact Flash on AT91SAM9263 cpu
@ 2009-02-18 10:07 Stanislaw Gruszka
  2009-03-01 19:11 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Stanislaw Gruszka @ 2009-02-18 10:07 UTC (permalink / raw)
  To: linux-ide, Andrew Victor; +Cc: linux-arm-kernel

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
---
 arch/arm/mach-at91/at91sam9263_devices.c |  105 ++++++++++++++++++++++++++++++
 1 files changed, 105 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index b753cb8..f048043 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -347,6 +347,111 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
 void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
 #endif
 
+/* --------------------------------------------------------------------
+ *  Compact Flash (PCMCIA or IDE)
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) || \
+    defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE)
+
+static struct at91_cf_data cf0_data;
+
+static struct resource cf0_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_4,
+		.end	= AT91_CHIPSELECT_4 + SZ_256M - 1,
+		.flags	= IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
+	}
+};
+
+static struct platform_device cf0_device = {
+	.id		= 0,
+	.dev		= {
+				.platform_data	= &cf0_data,
+	},
+	.resource	= cf0_resources,
+	.num_resources	= ARRAY_SIZE(cf0_resources),
+};
+
+static struct at91_cf_data cf1_data;
+
+static struct resource cf1_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_5,
+		.end	= AT91_CHIPSELECT_5 + SZ_256M - 1,
+		.flags	= IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
+	}
+};
+
+static struct platform_device cf1_device = {
+	.id		= 1,
+	.dev		= {
+				.platform_data	= &cf1_data,
+	},
+	.resource	= cf1_resources,
+	.num_resources	= ARRAY_SIZE(cf1_resources),
+};
+
+void __init at91_add_device_cf(struct at91_cf_data *data)
+{
+	unsigned long ebi0_csa;
+	struct platform_device *pdev;
+
+	if (!data)
+		return;
+
+	/*
+	 * assign CS4 or CS5 to SMC with Compact Flash logic support,
+	 * we assume SMC timings are configured by board code,
+	 * except True IDE where timings are controlled by driver
+	 */
+	ebi0_csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
+	switch (data->chipselect) {
+	case 4:
+		at91_set_A_periph(AT91_PIN_PD6, 0);  /* EBI0_NCS4/CFCS0 */
+		ebi0_csa |= AT91_MATRIX_EBI0_CS4A_SMC_CF1;
+		cf0_data = *data;
+		pdev = &cf0_device;
+		break;
+	case 5:
+		at91_set_A_periph(AT91_PIN_PD7, 0);  /* EBI0_NCS5/CFCS1 */
+		ebi0_csa |= AT91_MATRIX_EBI0_CS5A_SMC_CF2;
+		cf1_data = *data;
+		pdev = &cf1_device;
+		break;
+	default:
+		printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
+		       data->chipselect);
+		return;
+	}
+	at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa);
+
+	if (data->det_pin) {
+		at91_set_gpio_input(data->det_pin, 1);
+		at91_set_deglitch(data->det_pin, 1);
+	}
+
+	if (data->irq_pin) {
+		at91_set_gpio_input(data->irq_pin, 1);
+		at91_set_deglitch(data->irq_pin, 1);
+	}
+
+	if (data->vcc_pin)
+		/* initially off */
+		at91_set_gpio_output(data->vcc_pin, 0);
+
+	/* enable EBI controlled pins */
+	at91_set_A_periph(AT91_PIN_PD5, 1);  /* NWAIT */
+	at91_set_A_periph(AT91_PIN_PD8, 0);  /* CFCE1 */
+	at91_set_A_periph(AT91_PIN_PD9, 0);  /* CFCE2 */
+	at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */
+
+	pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "at91_ide" : "at91_cf";
+	platform_device_register(pdev);
+}
+#else
+void __init at91_add_device_cf(struct at91_cf_data *data) {}
+#endif
 
 /* --------------------------------------------------------------------
  *  NAND / SmartMedia
-- 
1.5.2.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3 v4] AT91: initialize Compact Flash on AT91SAM9263 cpu
  2009-02-18 10:07 [PATCH 3/3 v4] AT91: initialize Compact Flash on AT91SAM9263 cpu Stanislaw Gruszka
@ 2009-03-01 19:11 ` Sergei Shtylyov
  2009-03-02 16:33   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2009-03-01 19:11 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-ide, Andrew Victor, linux-arm-kernel

Hello.

Stanislaw Gruszka wrote:

> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
>   

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

> diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
> index b753cb8..f048043 100644
> --- a/arch/arm/mach-at91/at91sam9263_devices.c
> +++ b/arch/arm/mach-at91/at91sam9263_devices.c
> @@ -347,6 +347,111 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
>  void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
>  #endif
>  
> +/* --------------------------------------------------------------------
> + *  Compact Flash (PCMCIA or IDE)
> + * -------------------------------------------------------------------- */
> +
> +#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) || \
> +    defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE)
> +
> +static struct at91_cf_data cf0_data;
> +
> +static struct resource cf0_resources[] = {
> +	[0] = {
> +		.start	= AT91_CHIPSELECT_4,
> +		.end	= AT91_CHIPSELECT_4 + SZ_256M - 1,
> +		.flags	= IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
> +	}
> +};
> +
> +static struct platform_device cf0_device = {
> +	.id		= 0,
> +	.dev		= {
> +				.platform_data	= &cf0_data,
> +	},
> +	.resource	= cf0_resources,
> +	.num_resources	= ARRAY_SIZE(cf0_resources),
> +};
> +
> +static struct at91_cf_data cf1_data;
> +
> +static struct resource cf1_resources[] = {
> +	[0] = {
> +		.start	= AT91_CHIPSELECT_5,
> +		.end	= AT91_CHIPSELECT_5 + SZ_256M - 1,
> +		.flags	= IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
> +	}
> +};
> +
> +static struct platform_device cf1_device = {
> +	.id		= 1,
> +	.dev		= {
> +				.platform_data	= &cf1_data,
> +	},
> +	.resource	= cf1_resources,
> +	.num_resources	= ARRAY_SIZE(cf1_resources),
> +};
> +
> +void __init at91_add_device_cf(struct at91_cf_data *data)
> +{
> +	unsigned long ebi0_csa;
> +	struct platform_device *pdev;
> +
> +	if (!data)
> +		return;
> +
> +	/*
> +	 * assign CS4 or CS5 to SMC with Compact Flash logic support,
> +	 * we assume SMC timings are configured by board code,
> +	 * except True IDE where timings are controlled by driver
> +	 */
> +	ebi0_csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
> +	switch (data->chipselect) {
> +	case 4:
> +		at91_set_A_periph(AT91_PIN_PD6, 0);  /* EBI0_NCS4/CFCS0 */
> +		ebi0_csa |= AT91_MATRIX_EBI0_CS4A_SMC_CF1;
> +		cf0_data = *data;
> +		pdev = &cf0_device;
> +		break;
> +	case 5:
> +		at91_set_A_periph(AT91_PIN_PD7, 0);  /* EBI0_NCS5/CFCS1 */
> +		ebi0_csa |= AT91_MATRIX_EBI0_CS5A_SMC_CF2;
> +		cf1_data = *data;
> +		pdev = &cf1_device;
> +		break;
> +	default:
> +		printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
> +		       data->chipselect);
> +		return;
> +	}
> +	at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa);
> +
> +	if (data->det_pin) {
> +		at91_set_gpio_input(data->det_pin, 1);
> +		at91_set_deglitch(data->det_pin, 1);
> +	}
> +
> +	if (data->irq_pin) {
> +		at91_set_gpio_input(data->irq_pin, 1);
> +		at91_set_deglitch(data->irq_pin, 1);
> +	}
> +
> +	if (data->vcc_pin)
> +		/* initially off */
> +		at91_set_gpio_output(data->vcc_pin, 0);
> +
> +	/* enable EBI controlled pins */
> +	at91_set_A_periph(AT91_PIN_PD5, 1);  /* NWAIT */
> +	at91_set_A_periph(AT91_PIN_PD8, 0);  /* CFCE1 */
> +	at91_set_A_periph(AT91_PIN_PD9, 0);  /* CFCE2 */
> +	at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */
> +
> +	pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "at91_ide" : "at91_cf";
>   

  Could as well just passed the name to this function...

MBR, Sergei



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3 v4] AT91: initialize Compact Flash on AT91SAM9263 cpu
  2009-03-01 19:11 ` Sergei Shtylyov
@ 2009-03-02 16:33   ` Bartlomiej Zolnierkiewicz
  2009-03-02 19:54     ` Andrew Victor
  0 siblings, 1 reply; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-03-02 16:33 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Stanislaw Gruszka, linux-ide, Andrew Victor, linux-arm-kernel

On Sunday 01 March 2009, Sergei Shtylyov wrote:
> Hello.
> 
> Stanislaw Gruszka wrote:
> 
> > Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
> >   
> 
> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

Thanks guys.

Andrew, are you fine with me merging this patch together with IDE ones?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3 v4] AT91: initialize Compact Flash on AT91SAM9263 cpu
  2009-03-02 16:33   ` Bartlomiej Zolnierkiewicz
@ 2009-03-02 19:54     ` Andrew Victor
  2009-03-05 13:48       ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Victor @ 2009-03-02 19:54 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: Sergei Shtylyov, Stanislaw Gruszka, linux-ide, linux-arm-kernel

hi Bartlomiej

> Andrew, are you fine with me merging this patch together with IDE ones?

Patch is good.

Acked-by: Andrew Victor <linux@maxim.org.za>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3 v4] AT91: initialize Compact Flash on AT91SAM9263 cpu
  2009-03-02 19:54     ` Andrew Victor
@ 2009-03-05 13:48       ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-03-05 13:48 UTC (permalink / raw)
  To: Andrew Victor
  Cc: Sergei Shtylyov, Stanislaw Gruszka, linux-ide, linux-arm-kernel

On Monday 02 March 2009, Andrew Victor wrote:
> hi Bartlomiej
> 
> > Andrew, are you fine with me merging this patch together with IDE ones?
> 
> Patch is good.
> 
> Acked-by: Andrew Victor <linux@maxim.org.za>

Cool, I applied patches 1-3.

[ Stanislaw, I also updated pata-2.6 tree to accomodate for the new
  driver, it would be great if you could try it (or "next" linux-next)
  so we know that at91_ide still works... ]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-05 14:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-18 10:07 [PATCH 3/3 v4] AT91: initialize Compact Flash on AT91SAM9263 cpu Stanislaw Gruszka
2009-03-01 19:11 ` Sergei Shtylyov
2009-03-02 16:33   ` Bartlomiej Zolnierkiewicz
2009-03-02 19:54     ` Andrew Victor
2009-03-05 13:48       ` Bartlomiej Zolnierkiewicz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.