All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Bordug <vitb@kernel.crashing.org>
To: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: linux-ide@vger.kernel.org, linuxppc-dev@ozlabs.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] [POWERPC] MPC8349E-mITX: use platform IDE driver for CF	interface
Date: Thu, 26 Jul 2007 21:12:18 +0400	[thread overview]
Message-ID: <20070726211218.38b85db1@localhost.localdomain> (raw)
In-Reply-To: <46A78322.3080607@ru.mvista.com>

On Wed, 25 Jul 2007 21:06:42 +0400
Sergei Shtylyov wrote:

> Hello.
> 
> Vitaly Bordug wrote:
> 
> > This updates relevant platform code (freescale mpc8349itx target) 
> > to make the CompactFlash work in TrueIDE mode. 
> 
>    Erm, I'm not sure it's worth submitting the platform device driver
> for PowerPC at this point, but well...
> 
As Ben already confirmed, it is OK to have "constructor" insert platform device if such is
required by design.

> > Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> > Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> 
> >  arch/powerpc/boot/dts/mpc8349emitx.dts    |    9 ++++
> >  arch/powerpc/platforms/83xx/mpc834x_itx.c |   70
> > +++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 0
> > deletions(-)
> 
> > diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts
> > b/arch/powerpc/boot/dts/mpc8349emitx.dts index db0d003..f8f0e8a
> > 100644 --- a/arch/powerpc/boot/dts/mpc8349emitx.dts
> > +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
> > @@ -37,6 +37,15 @@
> >  		reg = <00000000 10000000>;
> >  	};
> >  
> > +	ide@f0000000 {
> > +		compatible = "mmio-ide";
> > +		device_type = "ide";
> 
>     Why not "ata"?
> 

we already argued around this iirc. I have no preferences and will put whatever agreed appropriate finally in here.

> > +		reg = <f0000000 10 f000020c 4>;
> > +		ioport_shift = <1>;
> 
>     Please use hyphen, not underscore in the property names
> ("device_type" seems an only exception from this rule).
>     And since using shift instead of size buys you nothing is this
> case, I'd prefer this property to be called reg-size or reg-stride.
> 
> [...]
> > diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c
> > b/arch/powerpc/platforms/83xx/mpc834x_itx.c index 40a0194..d63a104
> > 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
> > +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
> [...]
> > @@ -43,6 +44,75 @@ unsigned long isa_io_base = 0;
> >  unsigned long isa_mem_base = 0;
> >  #endif
> >  
> > +static int __init mmio_ide_of_init(void)
> > +{
> > +	struct device_node *np;
> > +	unsigned int i;
> > +
> > +	for (np = NULL, i = 0;
> > +	     (np = of_find_compatible_node(np, "ide",
> > "mmio-ide")) != NULL;
> > +	     i++) {
> > +		int ret = 0;
> 
>     Unneeded initialization.
> 
> > +		struct resource res[3];
> > +		struct platform_device *pdev = NULL;
> 
>     Another one.
> 

ok
> > +		static struct pata_platform_info pdata;
> > +
> > +		memset(res, 0, sizeof(res));
> > +
> > +		ret = of_address_to_resource(np, 0, &res[0]);
> > +		if (ret) {
> > +			printk(KERN_ERR "mmio-ide.%d: unable to
> > get "
> > +			       "resource from OF\n", i);
> > +			goto err0;
> > +		}
> > +
> > +		ret = of_address_to_resource(np, 1, &res[1]);
> > +		if (ret) {
> > +			printk(KERN_ERR "mmio-ide.%d: unable to
> > get "
> > +			       "resource from OF\n", i);
> > +			goto err0;
> 
>     Erm, these printk's are repetitive, isn't it better to put them
> under err0 label?
> 
> > +		}
> > +
> > +		res[2].start = res[2].end =
> > irq_of_parse_and_map(np, 0);
> > +		if (res[2].start == NO_IRQ) {
> > +			printk(KERN_ERR "mmio-ide.%d: no IRQ\n",
> > i);
> > +			goto err0;
> > +		}
> > +		res[2].name = "pata_platform";
> > +		res[2].flags = IORESOURCE_IRQ;
> > +
> > +		pdata.ioport_shift = *((u32 *)of_get_property(np,
> > +					"ioport_shift", NULL));
> > +
> > +		pdev = platform_device_alloc("pata_platform", i);
> > +		if (!pdev)
> > +			goto err1;
> 
>     Hm, not err0?
> 
agreed.

> > +
> > +		ret = platform_device_add_data(pdev, &pdata,
> > sizeof(pdata));
> > +		if (ret)
> > +			goto err1;
> > +
> > +		ret = platform_device_add_resources(pdev, res,
> > ARRAY_SIZE(res));
> > +		if (ret)
> > +			goto err1;
> > +
> > +		ret = platform_device_register(pdev);
> > +		if (ret)
> > +			goto err1;
> > +
> > +		continue;
> > +err1:
> > +		printk(KERN_ERR "mmio-ide.%d: registration
> > failed\n", i);
> > +		platform_device_del(pdev); /* it will free
> > everything */ +err0:
> > +		/* Even if some device failed, try others */
> > +		continue;
> > +	}
> > +
> > +	return 0;
> > +}
> > +device_initcall(mmio_ide_of_init);
> > +
> >  /*
> > ************************************************************************
> > *
> >   * Setup the architecture
> 
> MBR, Sergei


-- 
Sincerely, Vitaly

WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Bordug <vitb@kernel.crashing.org>
To: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 2/2] [POWERPC] MPC8349E-mITX: use platform IDE driver for CF	interface
Date: Thu, 26 Jul 2007 21:12:18 +0400	[thread overview]
Message-ID: <20070726211218.38b85db1@localhost.localdomain> (raw)
In-Reply-To: <46A78322.3080607@ru.mvista.com>

On Wed, 25 Jul 2007 21:06:42 +0400
Sergei Shtylyov wrote:

> Hello.
> 
> Vitaly Bordug wrote:
> 
> > This updates relevant platform code (freescale mpc8349itx target) 
> > to make the CompactFlash work in TrueIDE mode. 
> 
>    Erm, I'm not sure it's worth submitting the platform device driver
> for PowerPC at this point, but well...
> 
As Ben already confirmed, it is OK to have "constructor" insert platform device if such is
required by design.

> > Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> > Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> 
> >  arch/powerpc/boot/dts/mpc8349emitx.dts    |    9 ++++
> >  arch/powerpc/platforms/83xx/mpc834x_itx.c |   70
> > +++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 0
> > deletions(-)
> 
> > diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts
> > b/arch/powerpc/boot/dts/mpc8349emitx.dts index db0d003..f8f0e8a
> > 100644 --- a/arch/powerpc/boot/dts/mpc8349emitx.dts
> > +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
> > @@ -37,6 +37,15 @@
> >  		reg = <00000000 10000000>;
> >  	};
> >  
> > +	ide@f0000000 {
> > +		compatible = "mmio-ide";
> > +		device_type = "ide";
> 
>     Why not "ata"?
> 

we already argued around this iirc. I have no preferences and will put whatever agreed appropriate finally in here.

> > +		reg = <f0000000 10 f000020c 4>;
> > +		ioport_shift = <1>;
> 
>     Please use hyphen, not underscore in the property names
> ("device_type" seems an only exception from this rule).
>     And since using shift instead of size buys you nothing is this
> case, I'd prefer this property to be called reg-size or reg-stride.
> 
> [...]
> > diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c
> > b/arch/powerpc/platforms/83xx/mpc834x_itx.c index 40a0194..d63a104
> > 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
> > +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
> [...]
> > @@ -43,6 +44,75 @@ unsigned long isa_io_base = 0;
> >  unsigned long isa_mem_base = 0;
> >  #endif
> >  
> > +static int __init mmio_ide_of_init(void)
> > +{
> > +	struct device_node *np;
> > +	unsigned int i;
> > +
> > +	for (np = NULL, i = 0;
> > +	     (np = of_find_compatible_node(np, "ide",
> > "mmio-ide")) != NULL;
> > +	     i++) {
> > +		int ret = 0;
> 
>     Unneeded initialization.
> 
> > +		struct resource res[3];
> > +		struct platform_device *pdev = NULL;
> 
>     Another one.
> 

ok
> > +		static struct pata_platform_info pdata;
> > +
> > +		memset(res, 0, sizeof(res));
> > +
> > +		ret = of_address_to_resource(np, 0, &res[0]);
> > +		if (ret) {
> > +			printk(KERN_ERR "mmio-ide.%d: unable to
> > get "
> > +			       "resource from OF\n", i);
> > +			goto err0;
> > +		}
> > +
> > +		ret = of_address_to_resource(np, 1, &res[1]);
> > +		if (ret) {
> > +			printk(KERN_ERR "mmio-ide.%d: unable to
> > get "
> > +			       "resource from OF\n", i);
> > +			goto err0;
> 
>     Erm, these printk's are repetitive, isn't it better to put them
> under err0 label?
> 
> > +		}
> > +
> > +		res[2].start = res[2].end =
> > irq_of_parse_and_map(np, 0);
> > +		if (res[2].start == NO_IRQ) {
> > +			printk(KERN_ERR "mmio-ide.%d: no IRQ\n",
> > i);
> > +			goto err0;
> > +		}
> > +		res[2].name = "pata_platform";
> > +		res[2].flags = IORESOURCE_IRQ;
> > +
> > +		pdata.ioport_shift = *((u32 *)of_get_property(np,
> > +					"ioport_shift", NULL));
> > +
> > +		pdev = platform_device_alloc("pata_platform", i);
> > +		if (!pdev)
> > +			goto err1;
> 
>     Hm, not err0?
> 
agreed.

> > +
> > +		ret = platform_device_add_data(pdev, &pdata,
> > sizeof(pdata));
> > +		if (ret)
> > +			goto err1;
> > +
> > +		ret = platform_device_add_resources(pdev, res,
> > ARRAY_SIZE(res));
> > +		if (ret)
> > +			goto err1;
> > +
> > +		ret = platform_device_register(pdev);
> > +		if (ret)
> > +			goto err1;
> > +
> > +		continue;
> > +err1:
> > +		printk(KERN_ERR "mmio-ide.%d: registration
> > failed\n", i);
> > +		platform_device_del(pdev); /* it will free
> > everything */ +err0:
> > +		/* Even if some device failed, try others */
> > +		continue;
> > +	}
> > +
> > +	return 0;
> > +}
> > +device_initcall(mmio_ide_of_init);
> > +
> >  /*
> > ************************************************************************
> > *
> >   * Setup the architecture
> 
> MBR, Sergei


-- 
Sincerely, Vitaly

  parent reply	other threads:[~2007-07-26 17:31 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 16:53 [PATCH 1/2] [IDE] Platform IDE driver (was: MMIO IDE driver) Vitaly Bordug
2007-07-25 16:53 ` Vitaly Bordug
2007-07-25 16:53 ` Vitaly Bordug
2007-07-25 16:53 ` [PATCH 2/2] [POWERPC] MPC8349E-mITX: use platform IDE driver for CF interface Vitaly Bordug
2007-07-25 16:53   ` Vitaly Bordug
2007-07-25 16:53   ` Vitaly Bordug
2007-07-25 17:06   ` Sergei Shtylyov
2007-07-25 17:06     ` Sergei Shtylyov
2007-07-25 17:54     ` Sergei Shtylyov
2007-07-25 18:01       ` Scott Wood
2007-07-25 18:01         ` Scott Wood
2007-07-25 18:19         ` Sergei Shtylyov
2007-07-25 18:19           ` Sergei Shtylyov
2007-07-25 18:39           ` Scott Wood
2007-07-25 18:39             ` Scott Wood
2007-07-25 19:30             ` Sergei Shtylyov
2007-07-25 19:30               ` Sergei Shtylyov
2007-07-26 16:24               ` Sergei Shtylyov
2007-07-26 16:24                 ` Sergei Shtylyov
2007-07-31 22:47             ` Segher Boessenkool
2007-07-31 22:47               ` Segher Boessenkool
2007-07-25 18:29         ` Sergei Shtylyov
2007-07-25 18:29           ` Sergei Shtylyov
2007-07-25 18:46           ` Scott Wood
2007-07-25 18:46             ` Scott Wood
2007-07-26 17:21             ` Vitaly Bordug
2007-07-26 17:21               ` Vitaly Bordug
2007-07-26 17:45               ` Sergei Shtylyov
2007-07-26 17:45                 ` Sergei Shtylyov
2007-07-31 22:36       ` Segher Boessenkool
2007-07-31 22:36         ` Segher Boessenkool
2007-07-31 23:56         ` Alan Cox
2007-07-31 23:56           ` Alan Cox
2007-08-06 17:19           ` Segher Boessenkool
2007-08-06 17:19             ` Segher Boessenkool
2007-08-01 13:11         ` Sergei Shtylyov
2007-08-01 13:11           ` Sergei Shtylyov
2007-07-26 17:12     ` Vitaly Bordug [this message]
2007-07-26 17:12       ` Vitaly Bordug
2007-07-25 17:29   ` Scott Wood
2007-07-25 17:29     ` Scott Wood
2007-07-25 17:43 ` [PATCH 1/2] [IDE] Platform IDE driver (was: MMIO IDE driver) Alan Cox
2007-07-25 17:43   ` Alan Cox
2007-07-26 19:28   ` Bartlomiej Zolnierkiewicz
2007-07-26 19:28     ` Bartlomiej Zolnierkiewicz
2007-07-25 17:59 ` Kumar Gala
2007-07-25 17:59   ` Kumar Gala
2007-07-25 19:00 ` Sergei Shtylyov
2007-07-25 19:00   ` Sergei Shtylyov
2007-07-25 19:05   ` Scott Wood
2007-07-25 19:05     ` Scott Wood
2007-07-25 19:16     ` Sergei Shtylyov
2007-07-25 19:16       ` Sergei Shtylyov
2007-07-25 19:17       ` [PATCH 1/2] [IDE] Platform IDE driver Scott Wood
2007-07-25 19:17         ` Scott Wood
2007-07-25 19:35         ` Sergei Shtylyov
2007-07-25 19:35           ` Sergei Shtylyov
2007-07-31 22:31           ` Segher Boessenkool
2007-07-31 22:31             ` Segher Boessenkool
2007-08-01 12:39             ` Sergei Shtylyov
2007-08-01 12:39               ` Sergei Shtylyov
2007-08-06 17:16               ` Segher Boessenkool
2007-08-06 17:16                 ` Segher Boessenkool
2007-07-25 19:37 ` [PATCH 1/2] [IDE] Platform IDE driver (was: MMIO IDE driver) Guennadi Liakhovetski
2007-07-25 19:37   ` Guennadi Liakhovetski
2007-07-25 19:48   ` Sergei Shtylyov
2007-07-25 19:48     ` Sergei Shtylyov
2007-07-25 19:54     ` Guennadi Liakhovetski
2007-07-25 19:54       ` Guennadi Liakhovetski
2007-07-25 20:01       ` Sergei Shtylyov
2007-07-25 20:01         ` Sergei Shtylyov
2007-07-25 20:09         ` Guennadi Liakhovetski
2007-07-25 20:09           ` Guennadi Liakhovetski
2007-07-25 20:39   ` Alan Cox
2007-07-25 20:39     ` Alan Cox
2007-07-26 19:41     ` Guennadi Liakhovetski
2007-07-26 19:41       ` Guennadi Liakhovetski
2007-07-26 19:52       ` Sergei Shtylyov
2007-07-26 19:52         ` Sergei Shtylyov
2007-07-26 20:13         ` Guennadi Liakhovetski
2007-07-26 20:11       ` Bartlomiej Zolnierkiewicz
2007-07-26 20:11         ` Bartlomiej Zolnierkiewicz
2007-07-26 19:28 ` Bartlomiej Zolnierkiewicz
2007-07-26 19:28   ` Bartlomiej Zolnierkiewicz

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=20070726211218.38b85db1@localhost.localdomain \
    --to=vitb@kernel.crashing.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=sshtylyov@ru.mvista.com \
    /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.