linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: charu@ti.com (Varadarajan, Charulatha)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 07/12] omap: mcbsp: Get rid of remaining is_omap tests
Date: Fri, 1 Jul 2011 16:41:23 +0530	[thread overview]
Message-ID: <CA+HSevrUgP8pKNjSgkpDB6hUX=cvCUOU8mpU2Ca5qa75Rnp36w@mail.gmail.com> (raw)
In-Reply-To: <1309510356-27147-8-git-send-email-jhnikula@gmail.com>

Jarkko,

On Fri, Jul 1, 2011 at 14:22, Jarkko Nikula <jhnikula@gmail.com> wrote:
> We can get rid of remaining is_omap tests in the driver by using
> mcbsp_config_type that is set in omap hwmod data for 2430, 34xx and 44xx.
>
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
> ---
> ?arch/arm/plat-omap/mcbsp.c | ? 30 ++++++++++++++----------------
> ?1 files changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
> index 92d6d4f..47720b1 100644
> --- a/arch/arm/plat-omap/mcbsp.c
> +++ b/arch/arm/plat-omap/mcbsp.c
> @@ -193,7 +193,7 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
> ? ? ? ?MCBSP_WRITE(mcbsp, MCR2, config->mcr2);
> ? ? ? ?MCBSP_WRITE(mcbsp, MCR1, config->mcr1);
> ? ? ? ?MCBSP_WRITE(mcbsp, PCR0, config->pcr0);
> - ? ? ? if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
> + ? ? ? if (mcbsp->mcbsp_config_type >= MCBSP_CONFIG_TYPE2) {
> ? ? ? ? ? ? ? ?MCBSP_WRITE(mcbsp, XCCR, config->xccr);
> ? ? ? ? ? ? ? ?MCBSP_WRITE(mcbsp, RCCR, config->rccr);
> ? ? ? ?}
> @@ -531,14 +531,13 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
> ?{
> ? ? ? ?struct omap_mcbsp *mcbsp;
>
> - ? ? ? if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
> - ? ? ? ? ? ? ? return;
> -
> ? ? ? ?if (!omap_mcbsp_check_valid_id(id)) {
> ? ? ? ? ? ? ? ?printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> ? ? ? ?mcbsp = id_to_mcbsp_ptr(id);
> + ? ? ? if (mcbsp->mcbsp_config_type < MCBSP_CONFIG_TYPE3)
> + ? ? ? ? ? ? ? return;
>
> ? ? ? ?if (threshold && threshold <= mcbsp->max_tx_thres)
> ? ? ? ? ? ? ? ?MCBSP_WRITE(mcbsp, THRSH2, threshold - 1);
> @@ -554,14 +553,13 @@ void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
> ?{
> ? ? ? ?struct omap_mcbsp *mcbsp;
>
> - ? ? ? if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
> - ? ? ? ? ? ? ? return;
> -
> ? ? ? ?if (!omap_mcbsp_check_valid_id(id)) {
> ? ? ? ? ? ? ? ?printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> ? ? ? ?mcbsp = id_to_mcbsp_ptr(id);
> + ? ? ? if (mcbsp->mcbsp_config_type < MCBSP_CONFIG_TYPE3)
> + ? ? ? ? ? ? ? return;
>
> ? ? ? ?if (threshold && threshold <= mcbsp->max_rx_thres)
> ? ? ? ? ? ? ? ?MCBSP_WRITE(mcbsp, THRSH1, threshold - 1);
> @@ -698,7 +696,7 @@ static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
> ? ? ? ? * Enable wakup behavior, smart idle and all wakeups
> ? ? ? ? * REVISIT: some wakeups may be unnecessary
> ? ? ? ? */
> - ? ? ? if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
> + ? ? ? if (mcbsp->mcbsp_config_type >= MCBSP_CONFIG_TYPE3) {
> ? ? ? ? ? ? ? ?MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
> ? ? ? ?}
> ?}
> @@ -712,7 +710,7 @@ static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
> ? ? ? ?/*
> ? ? ? ? * Disable wakup behavior, smart idle and all wakeups
> ? ? ? ? */
> - ? ? ? if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
> + ? ? ? if (mcbsp->mcbsp_config_type >= MCBSP_CONFIG_TYPE3) {


I think that it would be a good idea to not use
MCBSP_CONFIG_TYPE* in plat-omap/* as it is the .rev info.
At later point of time, this might make the code look uglier
as it happened with GPIO_METHOD_* flags in OMAP GPIO driver.
Instead use this .rev info in mach-omap*/ to fill the pdata and pass it
to driver.

-V Charulatha

> ? ? ? ? ? ? ? ?/*
> ? ? ? ? ? ? ? ? * HW bug workaround - If no_idle mode is taken, we need to
> ? ? ? ? ? ? ? ? * go to smart_idle before going to always_idle, or the
> @@ -872,7 +870,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
> ? ? ? ?}
> ? ? ? ?mcbsp = id_to_mcbsp_ptr(id);
>
> - ? ? ? if (cpu_is_omap34xx())
> + ? ? ? if (mcbsp->mcbsp_config_type == MCBSP_CONFIG_TYPE3)
> ? ? ? ? ? ? ? ?omap_st_start(mcbsp);
>
> ? ? ? ?/* Only enable SRG, if McBSP is master */
> @@ -910,7 +908,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
> ? ? ? ? ? ? ? ?MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
> ? ? ? ?}
>
> - ? ? ? if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
> + ? ? ? if (mcbsp->mcbsp_config_type >= MCBSP_CONFIG_TYPE2) {
> ? ? ? ? ? ? ? ?/* Release the transmitter and receiver */
> ? ? ? ? ? ? ? ?w = MCBSP_READ_CACHE(mcbsp, XCCR);
> ? ? ? ? ? ? ? ?w &= ~(tx ? XDISABLE : 0);
> @@ -940,7 +938,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
>
> ? ? ? ?/* Reset transmitter */
> ? ? ? ?tx &= 1;
> - ? ? ? if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
> + ? ? ? if (mcbsp->mcbsp_config_type >= MCBSP_CONFIG_TYPE2) {
> ? ? ? ? ? ? ? ?w = MCBSP_READ_CACHE(mcbsp, XCCR);
> ? ? ? ? ? ? ? ?w |= (tx ? XDISABLE : 0);
> ? ? ? ? ? ? ? ?MCBSP_WRITE(mcbsp, XCCR, w);
> @@ -950,7 +948,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
>
> ? ? ? ?/* Reset receiver */
> ? ? ? ?rx &= 1;
> - ? ? ? if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
> + ? ? ? if (mcbsp->mcbsp_config_type >= MCBSP_CONFIG_TYPE2) {
> ? ? ? ? ? ? ? ?w = MCBSP_READ_CACHE(mcbsp, RCCR);
> ? ? ? ? ? ? ? ?w |= (rx ? RDISABLE : 0);
> ? ? ? ? ? ? ? ?MCBSP_WRITE(mcbsp, RCCR, w);
> @@ -967,7 +965,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
> ? ? ? ? ? ? ? ?MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6));
> ? ? ? ?}
>
> - ? ? ? if (cpu_is_omap34xx())
> + ? ? ? if (mcbsp->mcbsp_config_type == MCBSP_CONFIG_TYPE3)
> ? ? ? ? ? ? ? ?omap_st_stop(mcbsp);
> ?}
> ?EXPORT_SYMBOL(omap_mcbsp_stop);
> @@ -1230,7 +1228,7 @@ static void __devexit omap_st_remove(struct omap_mcbsp *mcbsp)
> ?static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
> ?{
> ? ? ? ?mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT;
> - ? ? ? if (cpu_is_omap34xx()) {
> + ? ? ? if (mcbsp->mcbsp_config_type == MCBSP_CONFIG_TYPE3) {
> ? ? ? ? ? ? ? ?/*
> ? ? ? ? ? ? ? ? * Initially configure the maximum thresholds to a safe value.
> ? ? ? ? ? ? ? ? * The McBSP FIFO usage with these values should not go under
> @@ -1262,7 +1260,7 @@ static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
>
> ?static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp)
> ?{
> - ? ? ? if (cpu_is_omap34xx()) {
> + ? ? ? if (mcbsp->mcbsp_config_type == MCBSP_CONFIG_TYPE3) {
> ? ? ? ? ? ? ? ?omap_additional_remove(mcbsp->dev);
>
> ? ? ? ? ? ? ? ?if (mcbsp->id == 2 || mcbsp->id == 3)
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

  parent reply	other threads:[~2011-07-01 11:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01  8:52 [RFC 0/12] McBSP cleanup and generalization Jarkko Nikula
     [not found] ` <1309510356-27147-11-git-send-email-jhnikula@gmail.com>
2011-07-01  9:23   ` [RFC 10/12] omap: mcbsp: Move sidetone clock management to mach-omap2/mcbsp.c Paul Walmsley
2011-07-01  9:26     ` Cousson, Benoit
2011-07-01  9:34       ` Paul Walmsley
2011-07-01 10:34         ` ABRAHAM, KISHON VIJAY
2011-07-01 13:36     ` Jarkko Nikula
     [not found] ` <1309510356-27147-12-git-send-email-jhnikula@gmail.com>
2011-07-01 11:00   ` [RFC 11/12] omap: mcbsp: Remove conditional compilation for OMAP3 Varadarajan, Charulatha
2011-07-01 13:47     ` Jarkko Nikula
     [not found] ` <1309510356-27147-8-git-send-email-jhnikula@gmail.com>
2011-07-01 11:11   ` Varadarajan, Charulatha [this message]
2011-07-01 14:05     ` [RFC 07/12] omap: mcbsp: Get rid of remaining is_omap tests Jarkko Nikula
     [not found] ` <1309510356-27147-5-git-send-email-jhnikula@gmail.com>
2011-07-03 23:08   ` [RFC 04/12] omap: mcbsp: Merge OMAP1 and OMAP2+ McBSP register definitions Janusz Krzysztofik
     [not found] ` <1309510356-27147-3-git-send-email-jhnikula@gmail.com>
2011-07-07 19:08   ` [RFC 02/12] omap: mcbsp: Remove rx_/tx_word_length variables Tony Lindgren

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='CA+HSevrUgP8pKNjSgkpDB6hUX=cvCUOU8mpU2Ca5qa75Rnp36w@mail.gmail.com' \
    --to=charu@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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).