[PATCH] Fix some minor errors in mpc5200 psc i2s driver

2008-10-19 Thread Jon Smirl
Fix missing unsigned for irqsave flags in psc i2s driver
Make attribute visiblity static
Collect all sysfs errors before checking status

Signed-off-by: Jon Smirl <[EMAIL PROTECTED]>
---
 sound/soc/fsl/mpc5200_psc_i2s.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 8692329..809c5c4 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -277,7 +277,7 @@ static int psc_i2s_trigger(struct snd_pcm_substream 
*substream, int cmd)
struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs;
u16 imr;
u8 psc_cmd;
-   long flags;
+   unsigned long flags;
 
if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
s = &psc_i2s->capture;
@@ -699,9 +699,9 @@ static ssize_t psc_i2s_stat_store(struct device *dev,
return count;
 }
 
-DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL);
-DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store);
-DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store);
+static DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL);
+static DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show, 
psc_i2s_stat_store);
+static DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show, 
psc_i2s_stat_store);
 
 /* -
  * OF platform bus binding code:
@@ -819,8 +819,8 @@ static int __devinit psc_i2s_of_probe(struct of_device *op,
 
/* Register the SYSFS files */
rc = device_create_file(psc_i2s->dev, &dev_attr_status);
-   rc = device_create_file(psc_i2s->dev, &dev_attr_capture_overrun);
-   rc = device_create_file(psc_i2s->dev, &dev_attr_playback_underrun);
+   rc |= device_create_file(psc_i2s->dev, &dev_attr_capture_overrun);
+   rc |= device_create_file(psc_i2s->dev, &dev_attr_playback_underrun);
if (rc)
dev_info(psc_i2s->dev, "error creating sysfs files\n");
 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] Add the of_find_i2c_device_by_node function

2008-10-19 Thread Jon Smirl
Add the of_find_i2c_device_by_node function. This allows you to follow
a reference in the device tree to an i2c device node and then locate
the linux device instantiated by the device tree. Example use, an i2s
codec controlled by i2c. Depends on patch exporting i2c root bus symbol.

Signed-off-by: Jon Smirl <[EMAIL PROTECTED]>
---
 drivers/of/of_i2c.c |   28 
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index 6a98dc8..ba7b394 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -19,7 +19,7 @@
 void of_register_i2c_devices(struct i2c_adapter *adap,
 struct device_node *adap_node)
 {
-   void *result;
+   struct i2c_client *i2c_dev;
struct device_node *node;
 
for_each_child_of_node(adap_node, node) {
@@ -41,18 +41,38 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
 
info.addr = *addr;
 
-   request_module(info.type);
+   request_module("%s", info.type);
 
-   result = i2c_new_device(adap, &info);
-   if (result == NULL) {
+   i2c_dev = i2c_new_device(adap, &info);
+   if (i2c_dev == NULL) {
printk(KERN_ERR
   "of-i2c: Failed to load driver for %s\n",
   info.type);
irq_dispose_mapping(info.irq);
continue;
}
+   
+   i2c_dev->dev.archdata.of_node = of_node_get(node);
}
 }
 EXPORT_SYMBOL(of_register_i2c_devices);
 
+static int of_dev_node_match(struct device *dev, void *data)
+{
+return dev->archdata.of_node == data;
+}
+
+struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
+{
+   struct device *dev;
+   
+   dev = bus_find_device(&i2c_bus_type, NULL, node, 
+of_dev_node_match);
+   if (!dev)
+   return NULL;
+   
+   return to_i2c_client(dev);
+}
+EXPORT_SYMBOL(of_find_i2c_device_by_node);
+
 MODULE_LICENSE("GPL");
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index bd2a870..17d5897 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -16,5 +16,7 @@
 
 void of_register_i2c_devices(struct i2c_adapter *adap,
 struct device_node *adap_node);
+struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
+
 
 #endif /* __LINUX_OF_I2C_H */

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Fix some minor errors in mpc5200 psc i2s driver

2008-10-19 Thread Grant Likely
On Sun, Oct 19, 2008 at 09:49:11AM -0400, Jon Smirl wrote:
> Fix missing unsigned for irqsave flags in psc i2s driver
> Make attribute visiblity static
> Collect all sysfs errors before checking status
> 
> Signed-off-by: Jon Smirl <[EMAIL PROTECTED]>
Acked-by: Grant Likely <[EMAIL PROTECTED]>

> ---
>  sound/soc/fsl/mpc5200_psc_i2s.c |   12 ++--
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
> index 8692329..809c5c4 100644
> --- a/sound/soc/fsl/mpc5200_psc_i2s.c
> +++ b/sound/soc/fsl/mpc5200_psc_i2s.c
> @@ -277,7 +277,7 @@ static int psc_i2s_trigger(struct snd_pcm_substream 
> *substream, int cmd)
>   struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs;
>   u16 imr;
>   u8 psc_cmd;
> - long flags;
> + unsigned long flags;
>  
>   if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
>   s = &psc_i2s->capture;
> @@ -699,9 +699,9 @@ static ssize_t psc_i2s_stat_store(struct device *dev,
>   return count;
>  }
>  
> -DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL);
> -DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store);
> -DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store);
> +static DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL);
> +static DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show, 
> psc_i2s_stat_store);
> +static DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show, 
> psc_i2s_stat_store);
>  
>  /* -
>   * OF platform bus binding code:
> @@ -819,8 +819,8 @@ static int __devinit psc_i2s_of_probe(struct of_device 
> *op,
>  
>   /* Register the SYSFS files */
>   rc = device_create_file(psc_i2s->dev, &dev_attr_status);
> - rc = device_create_file(psc_i2s->dev, &dev_attr_capture_overrun);
> - rc = device_create_file(psc_i2s->dev, &dev_attr_playback_underrun);
> + rc |= device_create_file(psc_i2s->dev, &dev_attr_capture_overrun);
> + rc |= device_create_file(psc_i2s->dev, &dev_attr_playback_underrun);
>   if (rc)
>   dev_info(psc_i2s->dev, "error creating sysfs files\n");
>  
> 
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: enable heap randomization for linkstations

2008-10-19 Thread Guennadi Liakhovetski
(modified the cc-list somewhat)

On Sat, 18 Oct 2008, Rogério Brito wrote:

> systems. Here is something that I get with a vanilla linkstation_defconfig:
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> 
> This gets me (with bootlogd enabled):
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Wed Dec 31 21:00:15 1969: Cannot access the Hardware Clock via any known 
> method.
> Wed Dec 31 21:00:15 1969: Use the --debug option to see the details of our 
> search for an access method.
> Wed Dec 31 21:00:15 1969: Unable to set System Clock to: Thu Jan 1 00:00:15 
> UTC 1970 ^[[33m(warning).^[[39;49m
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Yes, there seems to be a problem here now. The i2c adapter does not get 
probed, i.e., of-matching doesn't work. A quick look through other 
device-trees, using the same i2c driver, through git-logs of the i2c 
driver and the dts didn't bring me to a solution. Can anyone spot what's 
wrong with kuroboxHG.dts? lsprop output looks reasonable. Last working 
kernel was 2.6.25-rc6-ish.

> I just saw that in the default config:
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # CONFIG_PPC_CLOCK is not set
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

No, kurobox uses generic RTC class.

Thanks for the report
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Add the of_find_i2c_device_by_node function

2008-10-19 Thread Anton Vorontsov
Hi Jon,

On Sun, Oct 19, 2008 at 10:00:40AM -0400, Jon Smirl wrote:
> Add the of_find_i2c_device_by_node function. This allows you to follow
> a reference in the device tree to an i2c device node and then locate
> the linux device instantiated by the device tree. Example use, an i2s
> codec controlled by i2c. Depends on patch exporting i2c root bus symbol.
> 
> Signed-off-by: Jon Smirl <[EMAIL PROTECTED]>

Few comments are below.

> ---
>  drivers/of/of_i2c.c |   28 
>  1 files changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
> index 6a98dc8..ba7b394 100644
> --- a/drivers/of/of_i2c.c
> +++ b/drivers/of/of_i2c.c
> @@ -19,7 +19,7 @@
>  void of_register_i2c_devices(struct i2c_adapter *adap,
>struct device_node *adap_node)
>  {
> - void *result;
> + struct i2c_client *i2c_dev;
>   struct device_node *node;
>  
>   for_each_child_of_node(adap_node, node) {
> @@ -41,18 +41,38 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
>  
>   info.addr = *addr;
>  
> - request_module(info.type);
> + request_module("%s", info.type);

Patch description doesn't mention this change.

>  
> - result = i2c_new_device(adap, &info);
> - if (result == NULL) {
> + i2c_dev = i2c_new_device(adap, &info);
> + if (i2c_dev == NULL) {
>   printk(KERN_ERR
>  "of-i2c: Failed to load driver for %s\n",
>  info.type);
>   irq_dispose_mapping(info.irq);
>   continue;
>   }
> + 
> + i2c_dev->dev.archdata.of_node = of_node_get(node);

Would break sparc build. Plus setting this after i2c_new_device() isn't
right... Recently I sent few patches to deal with the archdata, could
you please rebase your patch against these three patches?

http://lkml.org/lkml/2008/10/16/250
http://lkml.org/lkml/2008/10/16/251
http://lkml.org/lkml/2008/10/16/252

>   }
>  }
>  EXPORT_SYMBOL(of_register_i2c_devices);
>  
> +static int of_dev_node_match(struct device *dev, void *data)
> +{
> +return dev->archdata.of_node == data;
> +}
> +
> +struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)

This should be documented. Especially the fact that every time you
call this function, you must call device_put() when you're done with
the returned i2c_client.

> +{
> + struct device *dev;
> + 
> + dev = bus_find_device(&i2c_bus_type, NULL, node, 
> +  of_dev_node_match);
> + if (!dev)
> + return NULL;
> + 
> + return to_i2c_client(dev);
> +}
> +EXPORT_SYMBOL(of_find_i2c_device_by_node);
> +
>  MODULE_LICENSE("GPL");
> diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
> index bd2a870..17d5897 100644
> --- a/include/linux/of_i2c.h
> +++ b/include/linux/of_i2c.h
> @@ -16,5 +16,7 @@
>  
>  void of_register_i2c_devices(struct i2c_adapter *adap,
>struct device_node *adap_node);
> +struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
> +  
>  
>  #endif /* __LINUX_OF_I2C_H */

Thanks,

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: enable heap randomization for linkstations

2008-10-19 Thread Jon Smirl
On Sun, Oct 19, 2008 at 4:59 PM, Guennadi Liakhovetski
<[EMAIL PROTECTED]> wrote:
> (modified the cc-list somewhat)
>
> On Sat, 18 Oct 2008, Rogério Brito wrote:
>
>> systems. Here is something that I get with a vanilla linkstation_defconfig:
>>
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>
>> This gets me (with bootlogd enabled):
>>
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> Wed Dec 31 21:00:15 1969: Cannot access the Hardware Clock via any known 
>> method.
>> Wed Dec 31 21:00:15 1969: Use the --debug option to see the details of our 
>> search for an access method.
>> Wed Dec 31 21:00:15 1969: Unable to set System Clock to: Thu Jan 1 00:00:15 
>> UTC 1970 ^[[33m(warning).^[[39;49m
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> Yes, there seems to be a problem here now. The i2c adapter does not get
> probed, i.e., of-matching doesn't work. A quick look through other
> device-trees, using the same i2c driver, through git-logs of the i2c
> driver and the dts didn't bring me to a solution. Can anyone spot what's
> wrong with kuroboxHG.dts? lsprop output looks reasonable. Last working
> kernel was 2.6.25-rc6-ish.
>
>> I just saw that in the default config:
>>
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> # CONFIG_PPC_CLOCK is not set
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> No, kurobox uses generic RTC class.

I don't see anything obviously wrong.

Is rtc-rs5c372 built into your kernel?

You may need to add some debug statements in drivers/of/of_i2c.c to
figure out what is wrong.
It could be something like a _ not matching a -.


>
> Thanks for the report
> Guennadi
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
>



-- 
Jon Smirl
[EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: enable heap randomization for linkstations

2008-10-19 Thread Guennadi Liakhovetski
On Sun, 19 Oct 2008, Jon Smirl wrote:

> On Sun, Oct 19, 2008 at 4:59 PM, Guennadi Liakhovetski
> <[EMAIL PROTECTED]> wrote:
> >
> > Yes, there seems to be a problem here now. The i2c adapter does not get
> > probed, i.e., of-matching doesn't work. A quick look through other
> > device-trees, using the same i2c driver, through git-logs of the i2c
> > driver and the dts didn't bring me to a solution. Can anyone spot what's
> > wrong with kuroboxHG.dts? lsprop output looks reasonable. Last working
> > kernel was 2.6.25-rc6-ish.
> >
> >> I just saw that in the default config:
> >>
> >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> >> # CONFIG_PPC_CLOCK is not set
> >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> >
> > No, kurobox uses generic RTC class.
> 
> I don't see anything obviously wrong.
> 
> Is rtc-rs5c372 built into your kernel?
> 
> You may need to add some debug statements in drivers/of/of_i2c.c to
> figure out what is wrong.
> It could be something like a _ not matching a -.

Above I said:

> > Yes, there seems to be a problem here now. The i2c adapter does not get
> > probed, i.e., of-matching doesn't work. A quick look through other

i.e., i2c-mpc is not matched against its fdt-node, not the rtc.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Add the of_find_i2c_device_by_node function

2008-10-19 Thread Jon Smirl
On Sun, Oct 19, 2008 at 5:20 PM, Anton Vorontsov
<[EMAIL PROTECTED]> wrote:
> Hi Jon,
>
> On Sun, Oct 19, 2008 at 10:00:40AM -0400, Jon Smirl wrote:
>> Add the of_find_i2c_device_by_node function. This allows you to follow
>> a reference in the device tree to an i2c device node and then locate
>> the linux device instantiated by the device tree. Example use, an i2s
>> codec controlled by i2c. Depends on patch exporting i2c root bus symbol.
>>
>> Signed-off-by: Jon Smirl <[EMAIL PROTECTED]>
>
> Few comments are below.
>
>> ---
>>  drivers/of/of_i2c.c |   28 
>>  1 files changed, 24 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
>> index 6a98dc8..ba7b394 100644
>> --- a/drivers/of/of_i2c.c
>> +++ b/drivers/of/of_i2c.c
>> @@ -19,7 +19,7 @@
>>  void of_register_i2c_devices(struct i2c_adapter *adap,
>>struct device_node *adap_node)
>>  {
>> - void *result;
>> + struct i2c_client *i2c_dev;
>>   struct device_node *node;
>>
>>   for_each_child_of_node(adap_node, node) {
>> @@ -41,18 +41,38 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
>>
>>   info.addr = *addr;
>>
>> - request_module(info.type);
>> + request_module("%s", info.type);
>
> Patch description doesn't mention this change.

Patches for this have been posted before by other people and they
aren't making it in.

This is the original mail
http://lkml.org/lkml/2008/6/13/290
http://lkml.org/lkml/2008/6/12/8
I can't find the ones patching i2c.


>
>>
>> - result = i2c_new_device(adap, &info);
>> - if (result == NULL) {
>> + i2c_dev = i2c_new_device(adap, &info);
>> + if (i2c_dev == NULL) {
>>   printk(KERN_ERR
>>  "of-i2c: Failed to load driver for %s\n",
>>  info.type);
>>   irq_dispose_mapping(info.irq);
>>   continue;
>>   }
>> +
>> + i2c_dev->dev.archdata.of_node = of_node_get(node);
>
> Would break sparc build. Plus setting this after i2c_new_device() isn't
> right... Recently I sent few patches to deal with the archdata, could
> you please rebase your patch against these three patches?
>
> http://lkml.org/lkml/2008/10/16/250
> http://lkml.org/lkml/2008/10/16/251
> http://lkml.org/lkml/2008/10/16/252
>
>>   }
>>  }
>>  EXPORT_SYMBOL(of_register_i2c_devices);
>>
>> +static int of_dev_node_match(struct device *dev, void *data)
>> +{
>> +return dev->archdata.of_node == data;
>> +}
>> +
>> +struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
>
> This should be documented. Especially the fact that every time you
> call this function, you must call device_put() when you're done with
> the returned i2c_client.
>
>> +{
>> + struct device *dev;
>> +
>> + dev = bus_find_device(&i2c_bus_type, NULL, node,
>> +  of_dev_node_match);
>> + if (!dev)
>> + return NULL;
>> +
>> + return to_i2c_client(dev);
>> +}
>> +EXPORT_SYMBOL(of_find_i2c_device_by_node);
>> +
>>  MODULE_LICENSE("GPL");
>> diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
>> index bd2a870..17d5897 100644
>> --- a/include/linux/of_i2c.h
>> +++ b/include/linux/of_i2c.h
>> @@ -16,5 +16,7 @@
>>
>>  void of_register_i2c_devices(struct i2c_adapter *adap,
>>struct device_node *adap_node);
>> +struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
>> +
>>
>>  #endif /* __LINUX_OF_I2C_H */
>
> Thanks,
>
> --
> Anton Vorontsov
> email: [EMAIL PROTECTED]
> irc://irc.freenode.net/bd2
>



-- 
Jon Smirl
[EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Add the of_find_i2c_device_by_node function

2008-10-19 Thread Anton Vorontsov
On Sun, Oct 19, 2008 at 05:50:15PM -0400, Jon Smirl wrote:
> On Sun, Oct 19, 2008 at 5:20 PM, Anton Vorontsov
> <[EMAIL PROTECTED]> wrote:
> > Hi Jon,
> >
> > On Sun, Oct 19, 2008 at 10:00:40AM -0400, Jon Smirl wrote:
> >> Add the of_find_i2c_device_by_node function. This allows you to follow
> >> a reference in the device tree to an i2c device node and then locate
> >> the linux device instantiated by the device tree. Example use, an i2s
> >> codec controlled by i2c. Depends on patch exporting i2c root bus symbol.
> >>
> >> Signed-off-by: Jon Smirl <[EMAIL PROTECTED]>
> >
> > Few comments are below.
> >
> >> ---
> >>  drivers/of/of_i2c.c |   28 
> >>  1 files changed, 24 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
> >> index 6a98dc8..ba7b394 100644
> >> --- a/drivers/of/of_i2c.c
> >> +++ b/drivers/of/of_i2c.c
> >> @@ -19,7 +19,7 @@
> >>  void of_register_i2c_devices(struct i2c_adapter *adap,
> >>struct device_node *adap_node)
> >>  {
> >> - void *result;
> >> + struct i2c_client *i2c_dev;
> >>   struct device_node *node;
> >>
> >>   for_each_child_of_node(adap_node, node) {
> >> @@ -41,18 +41,38 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
> >>
> >>   info.addr = *addr;
> >>
> >> - request_module(info.type);
> >> + request_module("%s", info.type);
> >
> > Patch description doesn't mention this change.
> 
> Patches for this have been posted before by other people and they
> aren't making it in.
> 
> This is the original mail
> http://lkml.org/lkml/2008/6/13/290
> http://lkml.org/lkml/2008/6/12/8
> I can't find the ones patching i2c.

Well, I didn't disagree with the change. I think this is good change
(and good catch, btw).

Just mention it in the patch description (or better yet, you could send
a separate patch for this particular issue, it seems quite serious).


Thanks,

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: enable heap randomization for linkstations

2008-10-19 Thread Jon Smirl
On Sun, Oct 19, 2008 at 5:49 PM, Guennadi Liakhovetski
<[EMAIL PROTECTED]> wrote:
> On Sun, 19 Oct 2008, Jon Smirl wrote:
>
>> On Sun, Oct 19, 2008 at 4:59 PM, Guennadi Liakhovetski
>> <[EMAIL PROTECTED]> wrote:
>> >
>> > Yes, there seems to be a problem here now. The i2c adapter does not get
>> > probed, i.e., of-matching doesn't work. A quick look through other
>> > device-trees, using the same i2c driver, through git-logs of the i2c
>> > driver and the dts didn't bring me to a solution. Can anyone spot what's
>> > wrong with kuroboxHG.dts? lsprop output looks reasonable. Last working
>> > kernel was 2.6.25-rc6-ish.
>> >
>> >> I just saw that in the default config:
>> >>
>> >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >> # CONFIG_PPC_CLOCK is not set
>> >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >
>> > No, kurobox uses generic RTC class.
>>
>> I don't see anything obviously wrong.
>>
>> Is rtc-rs5c372 built into your kernel?
>>
>> You may need to add some debug statements in drivers/of/of_i2c.c to
>> figure out what is wrong.
>> It could be something like a _ not matching a -.
>
> Above I said:
>
>> > Yes, there seems to be a problem here now. The i2c adapter does not get
>> > probed, i.e., of-matching doesn't work. A quick look through other
>
> i.e., i2c-mpc is not matched against its fdt-node, not the rtc.

i2c-mpc.c has:

static const struct of_device_id mpc_i2c_of_match[] = {
{.compatible = "fsl-i2c",},
{},
};
MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);


/* Structure for a device driver */
static struct of_platform_driver mpc_i2c_driver = {
.match_table= mpc_i2c_of_match,
.probe  = fsl_i2c_probe,
.remove = __devexit_p(fsl_i2c_remove),
.driver = {
.owner  = THIS_MODULE,
.name   = DRV_NAME,
},
};

That should match:

[EMAIL PROTECTED] {
#address-cells = <1>;
#size-cells = <0>;
cell-index = <0>;
compatible = "fsl-i2c";
reg = <0x80003000 0x1000>;
interrupts = <5 2>;
interrupt-parent = <&mpic>;

[EMAIL PROTECTED] {
device_type = "rtc";
compatible = "ricoh,rs5c372a";
reg = <0x32>;
};
};

This code works on my mpc5200 board.

Maybe fsl_i2c_probe() is failing?

Add some printks in i2c-mpc to help debug the problem.
Any errors from i2c-mpc in dmesg?


>
> Thanks
> Guennadi
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
>



-- 
Jon Smirl
[EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: enable heap randomization for linkstations

2008-10-19 Thread Guennadi Liakhovetski
On Sun, 19 Oct 2008, Jon Smirl wrote:

> i2c-mpc.c has:
> 
> static const struct of_device_id mpc_i2c_of_match[] = {
>   {.compatible = "fsl-i2c",},
>   {},
> };
> MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
> 
> 
> /* Structure for a device driver */
> static struct of_platform_driver mpc_i2c_driver = {
>   .match_table= mpc_i2c_of_match,
>   .probe  = fsl_i2c_probe,
>   .remove = __devexit_p(fsl_i2c_remove),
>   .driver = {
>   .owner  = THIS_MODULE,
>   .name   = DRV_NAME,
>   },
> };
> 
> That should match:
> 
>   [EMAIL PROTECTED] {
>   #address-cells = <1>;
>   #size-cells = <0>;
>   cell-index = <0>;
>   compatible = "fsl-i2c";
>   reg = <0x80003000 0x1000>;
>   interrupts = <5 2>;
>   interrupt-parent = <&mpic>;
> 
>   [EMAIL PROTECTED] {
>   device_type = "rtc";
>   compatible = "ricoh,rs5c372a";
>   reg = <0x32>;
>   };
>   };

It should, but it doesn't.

> This code works on my mpc5200 board.

Don't know which 5200 board you have, but, for example lite5200 has

compatible = "fsl,mpc5200-i2c","fsl-i2c";

see the difference?

> Maybe fsl_i2c_probe() is failing?

It has a printk at each error case (ok, except kzalloc, but I don't think 
that is the case), I see none of them.

> Add some printks in i2c-mpc to help debug the problem.
> Any errors from i2c-mpc in dmesg?

None, and, as I said, there are no error messages from it, so, it doesn't 
get called at all. To be quite sure I added a printk at the entry - as 
expected it didn't get printed.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: enable heap randomization for linkstations

2008-10-19 Thread Jon Smirl
On Sun, Oct 19, 2008 at 6:28 PM, Guennadi Liakhovetski
<[EMAIL PROTECTED]> wrote:
> On Sun, 19 Oct 2008, Jon Smirl wrote:
>
>> i2c-mpc.c has:
>>
>> static const struct of_device_id mpc_i2c_of_match[] = {
>>   {.compatible = "fsl-i2c",},
>>   {},
>> };
>> MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
>>
>>
>> /* Structure for a device driver */
>> static struct of_platform_driver mpc_i2c_driver = {
>>   .match_table= mpc_i2c_of_match,
>>   .probe  = fsl_i2c_probe,
>>   .remove = __devexit_p(fsl_i2c_remove),
>>   .driver = {
>>   .owner  = THIS_MODULE,
>>   .name   = DRV_NAME,
>>   },
>> };
>>
>> That should match:
>>
>>   [EMAIL PROTECTED] {
>>   #address-cells = <1>;
>>   #size-cells = <0>;
>>   cell-index = <0>;
>>   compatible = "fsl-i2c";
>>   reg = <0x80003000 0x1000>;
>>   interrupts = <5 2>;
>>   interrupt-parent = <&mpic>;
>>
>>   [EMAIL PROTECTED] {
>>   device_type = "rtc";
>>   compatible = "ricoh,rs5c372a";
>>   reg = <0x32>;
>>   };
>>   };
>
> It should, but it doesn't.
>
>> This code works on my mpc5200 board.
>
> Don't know which 5200 board you have, but, for example lite5200 has
>
>compatible = "fsl,mpc5200-i2c","fsl-i2c";
>
> see the difference?
>
>> Maybe fsl_i2c_probe() is failing?
>
> It has a printk at each error case (ok, except kzalloc, but I don't think
> that is the case), I see none of them.
>
>> Add some printks in i2c-mpc to help debug the problem.
>> Any errors from i2c-mpc in dmesg?
>
> None, and, as I said, there are no error messages from it, so, it doesn't
> get called at all. To be quite sure I added a printk at the entry - as
> expected it didn't get printed.

Is i2c-mpc built into your kernel? It's not going to module auto-load
because the names don't match - fsl-i2c and i2c-mpc.

But a message on init and make sure it is loading.
static int __init fsl_i2c_init(void)
{
int rv;

rv = of_register_platform_driver(&mpc_i2c_driver);
if (rv)
printk(KERN_ERR DRV_NAME
   " of_register_platform_driver failed (%i)\n", rv);
return rv;
}

>
> Thanks
> Guennadi
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
>



-- 
Jon Smirl
[EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: remove device_type = "board-control"

2008-10-19 Thread David Gibson
On Sat, Oct 18, 2008 at 04:23:52AM +0400, Anton Vorontsov wrote:
> We don't want to encourage the bogus device_type usage.
> 
> The device type isn't used in the code, so we can simply remove it from
> the documentation and dts files.
> 
> Boards should specify proper compatible entries instead.
> 
> Suggested-by: David Gibson <[EMAIL PROTECTED]>
> Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]>
Acked-by: David Gibson <[EMAIL PROTECTED]>

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] Revert to real-base = 12MB on 32-bit CHRP

2008-10-19 Thread Paul Mackerras
Commit 9b09c6d909dfd8de96b99b9b9c808b94b0a71614 ("powerpc: Change the
default link address for pSeries zImage kernels") changed the
real-base value in the CHRP note added by addnote to the zImage from
12MB to 32MB.  It turns out that this causes unnecessary extra reboots
on old 32-bit CHRP machines.  This therefore adds a -r flag to addnote
to allow us to specify what real-base value it should put in the CHRP
note, and adjusts the wrapper script to pass -r c0 to addnote when
making a zImage for a CHRP machine.  Also, CHRP machines ignore the
RPA note, so we don't need to arrange for it to be the same as the
kernel's.

Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c
index dcc9ab2..6fa77d0 100644
--- a/arch/powerpc/boot/addnote.c
+++ b/arch/powerpc/boot/addnote.c
@@ -11,7 +11,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  *
- * Usage: addnote zImage [note.elf]
+ * Usage: addnote [-r realbase] zImage [note.elf]
  *
  * If note.elf is supplied, it is the name of an ELF file that contains
  * an RPA note to use instead of the built-in one.  Alternatively, the
@@ -153,18 +153,31 @@ unsigned char *read_rpanote(const char *fname, int *nnp)
 int
 main(int ac, char **av)
 {
-   int fd, n, i;
+   int fd, n, i, ai;
int ph, ps, np;
int nnote, nnote2, ns;
unsigned char *rpap;
-
-   if (ac != 2 && ac != 3) {
-   fprintf(stderr, "Usage: %s elf-file [rpanote.elf]\n", av[0]);
+   char *p, *endp;
+
+   ai = 1;
+   if (ac >= ai + 2 && strcmp(av[ai], "-r") == 0) {
+   /* process -r realbase */
+   p = av[ai + 1];
+   descr[1] = strtol(p, &endp, 16);
+   if (endp == p || *endp != 0) {
+   fprintf(stderr, "Can't parse -r argument '%s' as hex\n",
+   p);
+   exit(1);
+   }
+   ai += 2;
+   }
+   if (ac != ai + 1 && ac != ai + 2) {
+   fprintf(stderr, "Usage: %s [-r realbase] elf-file 
[rpanote.elf]\n", av[0]);
exit(1);
}
-   fd = open(av[1], O_RDWR);
+   fd = open(av[ai], O_RDWR);
if (fd < 0) {
-   perror(av[1]);
+   perror(av[ai]);
exit(1);
}
 
@@ -184,12 +197,12 @@ main(int ac, char **av)
if (buf[E_IDENT+EI_CLASS] != ELFCLASS32
|| buf[E_IDENT+EI_DATA] != ELFDATA2MSB) {
fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n",
-   av[1]);
+   av[ai]);
exit(1);
}
 
if (ac == 3)
-   rpap = read_rpanote(av[2], &nnote2);
+   rpap = read_rpanote(av[ai + 1], &nnote2);
 
ph = GET_32BE(buf, E_PHOFF);
ps = GET_16BE(buf, E_PHENTSIZE);
@@ -202,7 +215,7 @@ main(int ac, char **av)
for (i = 0; i < np; ++i) {
if (GET_32BE(buf, ph + PH_TYPE) == PT_NOTE) {
fprintf(stderr, "%s already has a note entry\n",
-   av[1]);
+   av[ai]);
exit(0);
}
ph += ps;
@@ -260,18 +273,18 @@ main(int ac, char **av)
exit(1);
}
if (i < n) {
-   fprintf(stderr, "%s: write truncated\n", av[1]);
+   fprintf(stderr, "%s: write truncated\n", av[ai]);
exit(1);
}
 
exit(0);
 
  notelf:
-   fprintf(stderr, "%s does not appear to be an ELF file\n", av[1]);
+   fprintf(stderr, "%s does not appear to be an ELF file\n", av[ai]);
exit(1);
 
  nospace:
fprintf(stderr, "sorry, I can't find space in %s to put the note\n",
-   av[1]);
+   av[ai]);
exit(1);
 }
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index ee0dc41..f390735 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -306,11 +306,14 @@ fi
 
 # post-processing needed for some platforms
 case "$platform" in
-pseries|chrp)
+pseries)
 ${CROSS}objcopy -O binary -j .fakeelf "$kernel" "$ofile".rpanote
 $objbin/addnote "$ofile" "$ofile".rpanote
 rm -r "$ofile".rpanote
 ;;
+chrp)
+$objbin/addnote -r c0 "$ofile"
+;;
 coff)
 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
 $objbin/hack-coff "$ofile"
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Add the of_find_i2c_device_by_node function

2008-10-19 Thread Benjamin Herrenschmidt
On Mon, 2008-10-20 at 02:03 +0400, Anton Vorontsov wrote:
> > This is the original mail
> > http://lkml.org/lkml/2008/6/13/290
> > http://lkml.org/lkml/2008/6/12/8
> > I can't find the ones patching i2c.
> 
> Well, I didn't disagree with the change. I think this is good change
> (and good catch, btw).
> 
> Just mention it in the patch description (or better yet, you could send
> a separate patch for this particular issue, it seems quite serious).

Yes, it should most definitely be a separate patch.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: enable heap randomization for linkstations

2008-10-19 Thread Guennadi Liakhovetski
On Sun, 19 Oct 2008, Jon Smirl wrote:

> Is i2c-mpc built into your kernel? It's not going to module auto-load
> because the names don't match - fsl-i2c and i2c-mpc.

It is built into the kernel.

Thanks
Guennadi

> 
> But a message on init and make sure it is loading.
> static int __init fsl_i2c_init(void)
> {
>   int rv;
> 
>   rv = of_register_platform_driver(&mpc_i2c_driver);
>   if (rv)
>   printk(KERN_ERR DRV_NAME
>  " of_register_platform_driver failed (%i)\n", rv);
>   return rv;
> }
> 
> >
> > Thanks
> > Guennadi
> > ---
> > Guennadi Liakhovetski, Ph.D.
> > Freelance Open-Source Software Developer
> >
> 
> 
> 
> -- 
> Jon Smirl
> [EMAIL PROTECTED]
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Support for relocatable kdump kernel

2008-10-19 Thread Michael Ellerman
> >  Forwarded Message 
> > From: Mohan Kumar M <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]
> > Cc: linuxppc-dev@ozlabs.org, [EMAIL PROTECTED]
> > Subject: [PATCH] Support for relocatable kdump kernel
> > Date: Mon, 13 Oct 2008 05:04:20 +0530
> > 
> > Support for relocatable kdump kernel
> > 
> > This patch adds relocatable kernel support for kdump. With this one can
> > use the same regular kernel to capture the kdump. A signature (0xfeed1234)
> > is passed in r8 from panic code to the next kernel through kexec_sequence
> > and purgatory code. The signature is used to differentiate between
> > relocatable kdump kernel and non-kdump kernels.

You should put a big fat warning here in the changelog. By changing the
calling sequence (adding to it), we now require that for a new kernel to
work as a kdump kernel it has to be loaded with new kexec tools.

> > The purgatory code compares the signature and sets the __kdump_flag in
> > head_64.S.  During the boot up, kernel code checks __kdump_flag and if it
> > is set, the kernel will behave as relocatable kdump kernel. This kernel
> > will boot at the address where it was loaded by kexec-tools ie at the
> > address reserved through crashkernel boot parameter
> > 
> > CONFIG_CRASH_DUMP depends on CONFIG_RELOCATABLE option to build kdump
> > kernel as relocatable. So the same kernel can be used as production and
> > kdump kernel.

Those two statements aren't really related. A CONFIG_RELOCATABLE kernel
can be used as both a kdump and a normal kernel, and we need to make
sure that a CONFIG_CRASH_DUMP kernel can be used as both - ie. that
there's no code that uses CONFIG_CRASH_DUMP to do anything we /don't/
want in a normal kernel.

> > This patch incorporates the changes suggested by Paul Mackerrass to avoid
> > GOT use and to avoid two copies of the code.
> > 
> > Signed-off-by: Mohan Kumar M <[EMAIL PROTECTED]>

> > diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
> > index 0705040..3f4bc84 100644
> > --- a/Documentation/kdump/kdump.txt
> > +++ b/Documentation/kdump/kdump.txt
> > @@ -109,7 +109,8 @@ There are two possible methods of using Kdump.
> >  2) Or use the system kernel binary itself as dump-capture kernel and there 
> > is
> > no need to build a separate dump-capture kernel. This is possible
> > only with the architecutres which support a relocatable kernel. As
> > -   of today, i386, x86_64 and ia64 architectures support relocatable 
> > kernel.
> > +   of today, i386, x86_64, ppc64 and ia64 architectures support relocatable
> > +   kernel.

This is a little bit unclear as the kernel now doesn't have a ppc64
architecture. You might want to say "64-bit powerpc (ppc64)", because
that matches the kernel arch and also kexec-tools (which still has
ppc32/64 IIRC)

> >  
> >  Building a relocatable kernel is advantageous from the point of view that
> >  one does not have to build a second kernel for capturing the dump. But
> > @@ -207,8 +208,15 @@ Dump-capture kernel config options (Arch Dependent, 
> > i386 and x86_64)
> >  Dump-capture kernel config options (Arch Dependent, ppc64)
> >  --
> >  
> > -*  Make and install the kernel and its modules. DO NOT add this kernel
> > -   to the boot loader configuration files.
> > +1) Enable "Build a kdump crash kernel" support under "Kernel" options:
> > +
> > +   CONFIG_CRASH_DUMP=y
> > +
> > +2)   Enable "Build a relocatable kernel" support
> > +
> > +   CONFIG_RELOCATABLE=y
> > +
> > +   Make and install the kernel and its modules.
> >  
> >  Dump-capture kernel config options (Arch Dependent, ia64)
> >  --
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index 17c988b..6b3e840 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -321,11 +321,11 @@ config KEXEC
> >  
> >  config CRASH_DUMP
> > bool "Build a kdump crash kernel"
> > -   depends on PPC_MULTIPLATFORM && PPC64
> > +   depends on PPC_MULTIPLATFORM && PPC64 && RELOCATABLE
> > help
> >   Build a kernel suitable for use as a kdump capture kernel.
> > - The kernel will be linked at a different address than normal, and
> > - so can only be used for Kdump.
> > + The same kernel binary can be used as production kernel and dump 
> > capture
> > + kernel
> >  
> >   Don't change this unless you know what you are doing.
> >  
> > @@ -824,11 +824,9 @@ config PAGE_OFFSET
> > default "0xc000"
> >  config KERNEL_START
> > hex
> > -   default "0xc200" if CRASH_DUMP
> > default "0xc000"
> >  config PHYSICAL_START
> > hex
> > -   default "0x0200" if CRASH_DUMP
> > default "0x"
> >  endif
> >  
> > diff --git a/arch/powerpc/include/asm/kdump.h 
> > b/arch/powerpc/include/asm/kdump.h
> > index f6c93c7..5308754 100644
> > --- a/arch/powerpc/include/asm/kdump.h
> > +++ b/arch/pow