lkml.org 
[lkml]   [2008]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 3/5] [PCMCIA] Add support for platform dependant quirks
You may want to use

if (machine_is_viper())
do_some_quirks();

instead of modifying the generic ops structure.

On Wed, Aug 6, 2008 at 9:19 PM, Marc Zyngier <maz@misterjones.org> wrote:
> Some platforms, namely the Arcom/Eurotech Viper, need some extra care
> to run (on this board, the PC104 connector is actually wired to the
> second PCMCIA slot, and needs to be powered on despite not being managed
> by the PCMCIA code...).
>
> Add a quirks field to the pcmcia_low_level structure that the SOC
> dependant code can inspect.
>
> Introduce a PXA2XX_QUIRK_NEEDS_MECR_NOS that can be used by the offending
> board.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@altran.com>
> ---
> drivers/pcmcia/pxa2xx_base.c | 20 ++++++++++++++++++--
> drivers/pcmcia/pxa2xx_base.h | 7 +++++++
> drivers/pcmcia/soc_common.h | 2 ++
> 3 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
> index ccfdf19..9e61f21 100644
> --- a/drivers/pcmcia/pxa2xx_base.c
> +++ b/drivers/pcmcia/pxa2xx_base.c
> @@ -195,7 +195,7 @@ int __pxa2xx_drv_pcmcia_probe(struct device *dev)
> MECR |= MECR_CIT;
>
> /* Set MECR:NOS (Number Of Sockets) */
> - if (nr > 1)
> + if (nr > 1 || (ops->quirks & PXA2XX_QUIRK_NEEDS_MECR_NOS))
> MECR |= MECR_NOS;
> else
> MECR &= ~MECR_NOS;
> @@ -226,7 +226,23 @@ static int pxa2xx_drv_pcmcia_resume(struct platform_device *dev)
> struct pcmcia_low_level *ops = dev->dev.platform_data;
> int nr = ops ? ops->nr : 0;
>
> - MECR = nr > 1 ? MECR_CIT | MECR_NOS : (nr > 0 ? MECR_CIT : 0);
> + if (nr > 0) {
> + u32 quirks = ops ? ops->quirks : 0;
> + int v;
> +
> + /*
> + * We have at least one socket, so set MECR:CIT
> + * (Card Is There)
> + */
> + v = MECR_CIT;
> +
> + /* Set MECR:NOS (Number Of Sockets) */
> + if (nr > 1 || (quirks & PXA2XX_QUIRK_NEEDS_MECR_NOS))
> + v |= MECR_NOS;
> +
> + MECR = v;
> + } else
> + MECR = 0;
>
> return pcmcia_socket_dev_resume(&dev->dev);
> }
> diff --git a/drivers/pcmcia/pxa2xx_base.h b/drivers/pcmcia/pxa2xx_base.h
> index 235d681..956ee9d 100644
> --- a/drivers/pcmcia/pxa2xx_base.h
> +++ b/drivers/pcmcia/pxa2xx_base.h
> @@ -1,3 +1,10 @@
> +#ifndef PXA2XX_BASE
> +#define PXA2XX_BASE
> +
> +#define PXA2XX_QUIRK_NEEDS_MECR_NOS (1 << 0)
> +
> /* temporary measure */
> extern int __pxa2xx_drv_pcmcia_probe(struct device *);
>
> +#endif
> +
> diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h
> index 91ef6a0..9e288fc 100644
> --- a/drivers/pcmcia/soc_common.h
> +++ b/drivers/pcmcia/soc_common.h
> @@ -76,6 +76,8 @@ struct pcmcia_low_level {
> int first;
> /* nr of sockets */
> int nr;
> + /* Quirks required by this system, SOC dependant */
> + u32 quirks;
>
> int (*hw_init)(struct soc_pcmcia_socket *);
> void (*hw_shutdown)(struct soc_pcmcia_socket *);
> --
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>



--
Cheers
- eric

\
 
 \ /
  Last update: 2008-08-07 05:57    [W:0.100 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site