All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: linux-mips@linux-mips.org, linux-ide@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	ralf@linux-mips.org
Subject: Re: [PATCH 2/2] TXx9: Add TX4939 ATA support
Date: Thu, 11 Sep 2008 13:35:14 +0400	[thread overview]
Message-ID: <48C8E652.5000800@ru.mvista.com> (raw)
In-Reply-To: <20080910.010830.51865999.anemo@mba.ocn.ne.jp>

Hello.

Atsushi Nemoto wrote:

> Add a helper routine to register tx4939ide driver and use it on
> RBTX4939 board.
>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
>   
[...]
> diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
> index f14a497..ee00bde 100644
> --- a/arch/mips/txx9/generic/setup_tx4939.c
> +++ b/arch/mips/txx9/generic/setup_tx4939.c
>   
[...]
> @@ -389,6 +390,34 @@ void __init tx4939_mtd_init(int ch)
>  	txx9_physmap_flash_init(ch, start, size, &pdata);
>  }
>  
> +void __init tx4939_ata_init(void)
> +{
> +	__u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg);
> +	if (pcfg & (TX4939_PCFG_ATA0MODE | TX4939_PCFG_ATA1MODE)) {
> +		struct resource res[2];
> +		int i;
> +		memset(res, 0, sizeof(res));
> +		for (i = 0; i < 2; i++) {
> +			if (i == 0 &&
> +			    !(pcfg & TX4939_PCFG_ATA0MODE))
> +				continue;
> +			if (i == 1 &&
> +			    (pcfg & (TX4939_PCFG_ATA1MODE |
> +				     TX4939_PCFG_ET1MODE |
> +				     TX4939_PCFG_ET0MODE)) !=
> +			    TX4939_PCFG_ATA1MODE)
> +				continue;
> +			res[0].start = TX4939_ATA_REG(i) & 0xfffffffffULL;
> +			res[0].end = res[0].start + 0x1000 - 1;
> +			res[0].flags = IORESOURCE_MEM;
> +			res[1].start = TXX9_IRQ_BASE + TX4939_IR_ATA(i);
> +			res[1].flags = IORESOURCE_IRQ;
> +			platform_device_register_simple("tx4939ide", i,
> +							res, ARRAY_SIZE(res));
>   

   Hm, why not declare both IDE platform devices statically an then 
register them depending on the TX4939_PCFG_ATA[01]MODE bits?
This loop doesn't look nice. You could at least have used an array to 
check TX4939_PCFG_ATA[01]MODE bitmasks but I think it's better to just 
declare devices statically...

MBR, Sergei



      reply	other threads:[~2008-09-11  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-09 16:08 [PATCH 2/2] TXx9: Add TX4939 ATA support Atsushi Nemoto
2008-09-11  9:35 ` Sergei Shtylyov [this message]

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=48C8E652.5000800@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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 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.