From: "Eric Miao" <eric.y.miao@gmail.com>
To: "Marc Zyngier" <maz@misterjones.org>
Cc: linux-kernel@vger.kernel.org,
"Amit Walambe" <amit.walambe@eurotech-ltd.co.uk>,
"Dominik Brodowski" <linux@dominikbrodowski.net>,
"Marc Zyngier" <marc.zyngier@altran.com>
Subject: Re: [PATCH 3/5] [PCMCIA] Add support for platform dependant quirks
Date: Thu, 7 Aug 2008 11:53:43 +0800 [thread overview]
Message-ID: <f17812d70808062053v76d93925l716749f5347ec972@mail.gmail.com> (raw)
In-Reply-To: <b6f70421a31e59e19a0aaa79d068fa34876e60b7.1218018637.git.marc.zyngier@altran.com>
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
next prev parent reply other threads:[~2008-08-07 3:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 13:19 [PATCH 0/5] Support for Arcom/Eurotech Viper SBC Marc Zyngier
2008-08-06 13:19 ` [PATCH 1/5] Basic support for the " Marc Zyngier
2008-08-06 13:19 ` [PATCH 2/5] Add support for the Arcom/Eurotech Viper SBC onboard ethernet Marc Zyngier
2008-08-06 13:19 ` [PATCH 3/5] [PCMCIA] Add support for platform dependant quirks Marc Zyngier
2008-08-06 13:19 ` [PATCH 4/5] Add support for the Arcom/Eurotech Viper SBC CompactFlash card slot Marc Zyngier
2008-08-07 3:53 ` Eric Miao [this message]
2008-08-07 3:52 ` [PATCH 2/5] Add support for the Arcom/Eurotech Viper SBC onboard ethernet Eric Miao
2008-08-07 3:50 ` [PATCH 1/5] Basic support for the Arcom/Eurotech Viper SBC Eric Miao
2008-08-07 9:07 ` Marc Zyngier
2008-08-07 9:12 ` Eric Miao
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=f17812d70808062053v76d93925l716749f5347ec972@mail.gmail.com \
--to=eric.y.miao@gmail.com \
--cc=amit.walambe@eurotech-ltd.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=marc.zyngier@altran.com \
--cc=maz@misterjones.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
all inboxes | Powered by JetHome®