[PATCH] powerpc: Declare hcall_inst_seq_ops const

2009-09-07 Thread Tobias Klauser
Marking it const moves it to the .rodata section, which avoids false
sharing with potential dirty data. In addition it'll catch accidental
writes at compile time to these shared resources.

(description taken from commit 5dfe4c964a0dd7bb3a1d64a4166835a153146207)

Signed-off-by: Tobias Klauser tklau...@distanz.ch
---
 arch/powerpc/platforms/pseries/hvCall_inst.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c 
b/arch/powerpc/platforms/pseries/hvCall_inst.c
index eae51ef..3631a4f 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -71,7 +71,7 @@ static int hc_show(struct seq_file *m, void *p)
return 0;
 }
 
-static struct seq_operations hcall_inst_seq_ops = {
+static const struct seq_operations hcall_inst_seq_ops = {
 .start = hc_start,
 .next  = hc_next,
 .stop  = hc_stop,
-- 
1.6.0.4

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


Re: [PATCH] mpc512x: Reset module

2009-09-07 Thread Wolfram Sang
Hi,

On Mon, Sep 07, 2009 at 10:06:01AM +1000, Damien Dusha wrote:
 Dear all,
 
 I have written a small patch to get the software reset working on the
 mpc5121.  It is similar to the reset driver found in
 arch/powerpc/platforms/83xx/misc.c except it has been modified to look
 for the reset node in the device tree before writing to the reset
 module.

Heh, my patch looks quite similar :)

From: Wolfram Sang w.s...@pengutronix.de
Subject: mpc5121: add restart capability

Hack? Not intended for upstream yet.

Signed-off-by: Wolfram Sang w.s...@pengutronix.de
---
 arch/powerpc/platforms/512x/mpc5121_generic.c |   32 ++
 1 file changed, 32 insertions(+)

Index: arch/powerpc/platforms/512x/mpc5121_generic.c
===
--- arch/powerpc/platforms/512x/mpc5121_generic.c.orig
+++ arch/powerpc/platforms/512x/mpc5121_generic.c
@@ -20,6 +20,7 @@
 #include asm/ipic.h
 #include asm/prom.h
 #include asm/time.h
+#include asm/mpc512x.h
 
 #include mpc512x.h
 
@@ -49,6 +50,36 @@ static int __init mpc5121_generic_probe(
return board[i] != NULL;
 }
 
+static void mpc5121_restart(char *cmd) {
+
+   struct mpc512x_reset_module *rm;
+   struct device_node *rmnode;
+
+   /* HACK: Proably not good from IRQ context */
+
+   rmnode = of_find_compatible_node(NULL, NULL, fsl,mpc5121-reset);
+   if (!rmnode) {
+   printk(KERN_ERR Missing 'fsl,mpc5121-reset' 
+   node in device tree!\n);
+   goto out;
+   }
+
+   rm = of_iomap(rmnode, 0);
+   if (!rm) {
+   printk(KERN_ERR Error mapping reset module node!\n);
+   goto out;
+   }
+
+   local_irq_disable();
+
+   /* Unlock register first, then reset */
+   out_be32(rm-rpr, 0x52535445);
+   out_be32(rm-rcr, 0x0002);
+out:
+   while (1) ;
+}
+
 define_machine(mpc5121_generic) {
.name   = MPC5121 generic,
.probe  = mpc5121_generic_probe,
@@ -56,4 +89,5 @@ define_machine(mpc5121_generic) {
.init_IRQ   = mpc512x_init_IRQ,
.get_irq= ipic_get_irq,
.calibrate_decr = generic_calibrate_decr,
+   .restart= mpc5121_restart,
 };



There is one reason which I wanted to check before submitting this (alas, no
time :( ). From mpc52xx_common.c:

...
/*
 * This variable is mapped in mpc52xx_map_wdt() and used in mpc52xx_restart().
 * Permanent mapping is required because mpc52xx_restart() can be called
 * from interrupt context while node mapping (which calls ioremap())
 * cannot be used at such point.
 */
static DEFINE_SPINLOCK(mpc52xx_lock);
static struct mpc52xx_gpt __iomem *mpc52xx_wdt;
...

I think this may be needed here also...

 
 Comments are welcome.  It's my first patch to the mailing list, so
 I'll apologise in advance for any problems with the submission
 procedure.
 
 Damien.

 diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c 
 b/arch/powerpc/platforms/512x/mpc5121_ads.c
 index a8976b4..16ca250 100644
 --- a/arch/powerpc/platforms/512x/mpc5121_ads.c
 +++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
 @@ -70,4 +70,5 @@ define_machine(mpc5121_ads) {
   .init_IRQ   = mpc5121_ads_init_IRQ,
   .get_irq= ipic_get_irq,
   .calibrate_decr = generic_calibrate_decr,
 +.restart= mpc512x_restart,

Please use tabs and not spaces (See CodingStyle).

  };
 diff --git a/arch/powerpc/platforms/512x/mpc512x.h 
 b/arch/powerpc/platforms/512x/mpc512x.h
 index f4db8a7..d77f0ab 100644
 --- a/arch/powerpc/platforms/512x/mpc512x.h
 +++ b/arch/powerpc/platforms/512x/mpc512x.h
 @@ -14,5 +14,6 @@
  extern unsigned long mpc512x_find_ips_freq(struct device_node *node);
  extern void __init mpc512x_init_IRQ(void);
  extern void __init mpc512x_init_i2c(void);
 +extern void mpc512x_restart(char *cmd);

Um, do we need that?

  void __init mpc512x_declare_of_platform_devices(void);
  #endif   /* __MPC512X_H__ */
 diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c 
 b/arch/powerpc/platforms/512x/mpc512x_shared.c
 index 135fd6b..deddafc 100644
 --- a/arch/powerpc/platforms/512x/mpc512x_shared.c
 +++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
 @@ -22,6 +22,7 @@
  #include asm/prom.h
  #include asm/time.h
  
 +#include asm/mpc512x.h
  #include mpc512x.h
  
  unsigned long
 @@ -89,6 +90,33 @@ void __init mpc512x_init_i2c(void)
   }
  }
  
 +void mpc512x_restart(char *cmd)
 +{
 +struct device_node *np;

Again spaces instead of a tab.

 +struct mpc512x_reset_module *rm;
 +
 +local_irq_disable();
 +
 + np = of_find_compatible_node(NULL, NULL, fsl,mpc5121-reset);
 +
 + if (np) {
 +
 +rm = of_iomap(np, 0);
 + if (rm) {

Here you used tabs :)

 +
 +/* Enable software reset RSTE (in hex) */
 +out_be32( 

[PATCH] seq_file: convert /proc/device-tree/ to seq_file

2009-09-07 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan adobri...@gmail.com
---

 fs/proc/proc_devtree.c |   41 +
 1 file changed, 21 insertions(+), 20 deletions(-)

--- a/fs/proc/proc_devtree.c
+++ b/fs/proc/proc_devtree.c
@@ -7,6 +7,7 @@
 #include linux/init.h
 #include linux/time.h
 #include linux/proc_fs.h
+#include linux/seq_file.h
 #include linux/stat.h
 #include linux/string.h
 #include asm/prom.h
@@ -25,26 +26,27 @@ static struct proc_dir_entry *proc_device_tree;
 /*
  * Supply data on a read from /proc/device-tree/node/property.
  */
-static int property_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static int property_proc_show(struct seq_file *m, void *v)
 {
-   struct property *pp = data;
-   int n;
+   struct property *pp = m-private;
 
-   if (off = pp-length) {
-   *eof = 1;
-   return 0;
-   }
-   n = pp-length - off;
-   if (n  count)
-   n = count;
-   else
-   *eof = 1;
-   memcpy(page, (char *)pp-value + off, n);
-   *start = page;
-   return n;
+   seq_write(m, pp-value, pp-length);
+   return 0;
+}
+
+static int property_proc_open(struct inode *inode, struct file *file)
+{
+   return single_open(file, property_proc_show, PDE(inode)-data);
 }
 
+static const struct file_operations property_proc_fops = {
+   .owner  = THIS_MODULE,
+   .open   = property_proc_open,
+   .read   = seq_read,
+   .llseek = seq_lseek,
+   .release= single_release,
+};
+
 /*
  * For a node with a name like g...@10, we make symlinks called gc
  * and @10 to it.
@@ -63,10 +65,9 @@ __proc_device_tree_add_prop(struct proc_dir_entry *de, 
struct property *pp,
 * Unfortunately proc_register puts each new entry
 * at the beginning of the list.  So we rearrange them.
 */
-   ent = create_proc_read_entry(name,
-strncmp(name, security-, 9)
-? S_IRUGO : S_IRUSR, de,
-property_read_proc, pp);
+   ent = proc_create_data(name,
+  strncmp(name, security-, 9) ? S_IRUGO : 
S_IRUSR,
+  de, property_proc_fops, pp);
if (ent == NULL)
return NULL;
 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: MPC8536DS: u-boot detects PCIe card but Linux 2.6.30 does not.

2009-09-07 Thread Leon Woestenberg
Hello,

On Mon, Sep 7, 2009 at 1:01 PM, Leon
Woestenbergleon.woestenb...@gmail.com wrote:
 on my MPC8536DS development board, a PCIe card does not get detected
 by Linux, u-boot does list it.

 I'm suspecting the PCIe bridge (?) to not initialize correctly, but
 that is a wild guess. See the u-boot log and kernel boot log with PCI


It seems this might be a endpoint hardware issue where the PCIe hot
reset signal is ignored.

Investigating further.

Regards,
-- 
Leon
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev