linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Grant Likely" <grant.likely@secretlab.ca>
To: "Jochen Friedrich" <jochen@scram.de>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [RFC/PATCH] powerpc: Move CPM command handling into the cpm drivers
Date: Thu, 22 Nov 2007 11:36:29 -0700	[thread overview]
Message-ID: <fa686aa40711221036n6438c252lde71cffdaff97ea9@mail.gmail.com> (raw)
In-Reply-To: <4745BB5F.6060002@scram.de>

On 11/22/07, Jochen Friedrich <jochen@scram.de> wrote:
> This patch moves the CPM command handling into commproc.c
> for CPM1 and cpm2_common.c. This is yet another preparation
> to get rid of drivers accessing the CPM via the global cpmp.
>
> Signed-off-by: Jochen Friedrich <jochen@scram.de>
> ---
>  arch/powerpc/sysdev/commproc.c          |   20 ++++++++++++++++++++
>  arch/powerpc/sysdev/cpm2_common.c       |   17 +++++++++++++++++
>  drivers/net/fs_enet/mac-fcc.c           |   10 +---------
>  drivers/net/fs_enet/mac-scc.c           |   11 +----------
>  drivers/serial/cpm_uart/cpm_uart_cpm1.c |    6 +-----
>  drivers/serial/cpm_uart/cpm_uart_cpm2.c |    8 +-------
>  include/asm-powerpc/cpm.h               |    1 +
>  7 files changed, 42 insertions(+), 31 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
> index f6a6378..2bddbde 100644
> --- a/arch/powerpc/sysdev/commproc.c
> +++ b/arch/powerpc/sysdev/commproc.c
> @@ -240,6 +240,26 @@ void __init cpm_reset(void)
>  #endif
>  }
>
> +#define MAX_CR_CMD_LOOPS        10000
> +
> +int cpm_command(u32 command, u8 opcode)
> +{
> +       int i;
> +
> +       if (command & 0xffffff0f)
> +               return -EINVAL;
> +
> +       out_be16(&cpmp->cp_cpcr, command | CPM_CR_FLG | (opcode << 8));
> +       for (i = 0; i < MAX_CR_CMD_LOOPS; i++)
> +               if ((in_be16(&cpmp->cp_cpcr) & CPM_CR_FLG) == 0)
> +                       return 0;
> +
> +       printk(KERN_ERR "%s(): Not able to issue CPM command\n",
> +               __FUNCTION__);
> +       return -EIO;

Do these need to be protected with a spin lock?

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

  reply	other threads:[~2007-11-22 18:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-22 17:24 [RFC/PATCH] powerpc: Move CPM command handling into the cpm drivers Jochen Friedrich
2007-11-22 18:36 ` Grant Likely [this message]
2007-11-22 21:51   ` Vitaly Bordug
2007-11-24 17:53     ` Jochen Friedrich
2007-11-24 21:47       ` Vitaly Bordug
2007-11-26 16:24     ` Scott Wood
2007-11-26 21:22       ` Vitaly Bordug
2007-11-26 21:41         ` Scott Wood
2007-11-27  8:08           ` Vitaly Bordug

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=fa686aa40711221036n6438c252lde71cffdaff97ea9@mail.gmail.com \
    --to=grant.likely@secretlab.ca \
    --cc=jochen@scram.de \
    --cc=linuxppc-dev@ozlabs.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).