Skip to contentSkip to conversation

uartlite: Fix build on sparc.

PATCH In review David Miller 4 participants 10 messages Mar 3, 2010 – Mar 4, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uartlite: Fix build on sparc.

We can get this driver enabled via MFD_TIMBERDALE which only requires GPIO to be on.

But the of_address_to_resource() function is only present on powerpc and microblaze, so we have to conditionalize the CONFIG_OF probing bits on that.

drivers/serial/uartlite.c +5 -5
index ab2ab3c..f0a6c61 100644
@@ -19,7 +19,7 @@
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <asm/io.h>
-#if defined(CONFIG_OF)
+#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
@@ -581,7 +581,7 @@ static struct platform_driver ulite_platform_driver = {
 /* ---------------------------------------------------------------------
  * OF bus bindings
  */
-#if defined(CONFIG_OF)
+#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
 static int __devinit
 ulite_of_probe(struct of_device *op, const struct of_device_id *match)
 {
@@ -631,11 +631,11 @@ static inline void __exit ulite_of_unregister(void)
 {
 	of_unregister_platform_driver(&ulite_of_driver);
 }
-#else /* CONFIG_OF */
-/* CONFIG_OF not enabled; do nothing helpers */
+#else /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
+/* Appropriate config not enabled; do nothing helpers */
 static inline int __init ulite_of_register(void) { return 0; }
 static inline void __exit ulite_of_unregister(void) { }
-#endif /* CONFIG_OF */
+#endif /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
 
 /* ---------------------------------------------------------------------
  * Module setup/teardown
#1 lore raw
Quoted 15 lines · David Miller

We can get this driver enabled via MFD_TIMBERDALE which only requires GPIO to be on.

But the of_address_to_resource() function is only present on powerpc and microblaze, so we have to conditionalize the CONFIG_OF probing bits on that.

drivers/serial/uartlite.c +0 -0
index ab2ab3c..f0a6c61 100644

drivers/serial/uartlite.c line 22

Quoted 5 lines
drivers/serial/uartlite.c +1 -1
@@ -19,7 +19,7 @@
  #include <linux/interrupt.h>
  #include <linux/init.h>
  #include <asm/io.h>
-#if defined(CONFIG_OF)
+#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))

ARM will probably end up using this driver. How about simply defined(CONFIG_OF) && !defined(CONFIG_SPARC)?

Or if you prefer, I could expedite my patch that moves of_address_to_resource() into common code (it's currently in my test branch). I wasn't planning to merge it until 2.6.35, but it is pretty low risk so I'd be comfortable merging it now.

g.

#2 lore raw

From: Grant Likely <[email protected]>
Date: Wed, 3 Mar 2010 08:51:27 -0700

Quoted 4 lines

Or if you prefer, I could expedite my patch that moves of_address_to_resource() into common code (it's currently in my test branch). I wasn't planning to merge it until 2.6.35, but it is pretty low risk so I'd be comfortable merging it now.

I prefer if you deal with it this way.

#3 lore raw
Quoted 9 lines · David Miller

From: Grant Likely <[email protected]>
Date: Wed, 3 Mar 2010 08:51:27 -0700

Quoted 4 lines

Or if you prefer, I could expedite my patch that moves of_address_to_resource() into common code (it's currently in my test branch).  I wasn't planning to merge it until 2.6.35, but it is pretty low risk so I'd be comfortable merging it now.

I prefer if you deal with it this way.

Hmmm... on second look my patch depends on a bunch of other stuff that doesn't work with sparc yet. grumble. Sorry, this isn't going to work yet. I'll have to block out the uartlite driver instead. In the mean time I'll change the Kconfig to omit uartlite on sparc.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#4 lore raw
Quoted 9 lines · Grant Likely
Quoted 8 lines · David Miller

From: Grant Likely <[email protected]>
Date: Wed, 3 Mar 2010 08:51:27 -0700

Quoted 4 lines

Or if you prefer, I could expedite my patch that moves of_address_to_resource() into common code (it's currently in my test branch).  I wasn't planning to merge it until 2.6.35, but it is pretty low risk so I'd be comfortable merging it now.

Quoted 6 lines
Quoted 1 line

I prefer if you deal with it this way.

Hmmm... on second look my patch depends on a bunch of other stuff that doesn't work with sparc yet.  grumble.  Sorry, this isn't going to work yet.  I'll have to block out the uartlite driver instead.  In the mean time I'll change the Kconfig to omit uartlite on sparc.

/me looks at the Kconfig.

Double grumble.

Yeah, you're right. The place to change it is in the .c file.

g.

#5 lore raw
In reply to Grant Likely

From: Grant Likely <[email protected]>
Date: Wed, 3 Mar 2010 09:40:14 -0700

Quoted 9 lines · David Miller
Quoted 8 lines

From: Grant Likely <[email protected]>
Date: Wed, 3 Mar 2010 08:51:27 -0700

Quoted 4 lines

Or if you prefer, I could expedite my patch that moves of_address_to_resource() into common code (it's currently in my test branch).  I wasn't planning to merge it until 2.6.35, but it is pretty low risk so I'd be comfortable merging it now.

Quoted 6 lines
Quoted 1 line

I prefer if you deal with it this way.

Hmmm... on second look my patch depends on a bunch of other stuff that doesn't work with sparc yet. grumble. Sorry, this isn't going to work yet. I'll have to block out the uartlite driver instead. In the mean time I'll change the Kconfig to omit uartlite on sparc.

BTW, while looking at this I can provide something similar to the of_address_to_resource() interface on sparc but it would need to provide the of_device pointer not the device_node one.

I precompute all of the IRQs and I/O addresses of OF nodes and stick them into of_device->resource[] and of_device->irq[].

So if I have the of_device pointer I can just:

	memset(res, op->resource[n], sizeof(*res));

as my implementation.

#6 lore raw
Quoted 23 lines · David Miller

From: Grant Likely <[email protected]>
Date: Wed, 3 Mar 2010 09:40:14 -0700

Quoted 9 lines · David Miller
Quoted 8 lines

From: Grant Likely <[email protected]>
Date: Wed, 3 Mar 2010 08:51:27 -0700

Quoted 4 lines

Or if you prefer, I could expedite my patch that moves of_address_to_resource() into common code (it's currently in my test branch).  I wasn't planning to merge it until 2.6.35, but it is pretty low risk so I'd be comfortable merging it now.

Quoted 6 lines
Quoted 1 line

I prefer if you deal with it this way.

Hmmm... on second look my patch depends on a bunch of other stuff that doesn't work with sparc yet.  grumble.  Sorry, this isn't going to work yet.  I'll have to block out the uartlite driver instead.  In the mean time I'll change the Kconfig to omit uartlite on sparc.

BTW, while looking at this I can provide something similar to the of_address_to_resource() interface on sparc but it would need to provide the of_device pointer not the device_node one.

Quoted 8 lines

I precompute all of the IRQs and I/O addresses of OF nodes and stick them into of_device->resource[] and of_device->irq[].

So if I have the of_device pointer I can just:

       memset(res, op->resource[n], sizeof(*res));

as my implementation.

Cool.

I'm actually hoping to do much the same with the other OF architectures, so hopefully of_address_to_resource() will become only used in arch code when talking to hardware before the devices are registered.

I also need to look at merging the bus address translation code. It looks like sparc and ppc are using variations on the same codebase, but they seem to have diverged quite a lot.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
Acked-by on v1 1/1
#7 lore raw
In reply to David Miller
Quoted 9 lines · David Miller

We can get this driver enabled via MFD_TIMBERDALE which only requires GPIO to be on.

But the of_address_to_resource() function is only present on powerpc and microblaze, so we have to conditionalize the CONFIG_OF probing bits on that.

Linus or Greg, can you please pick this bug fix up?

Thanks,
g.

Quoted 39 lines
drivers/serial/uartlite.c +2 -2
index ab2ab3c..f0a6c61 100644
@@ -19,7 +19,7 @@
  #include <linux/interrupt.h>
  #include <linux/init.h>
  #include <asm/io.h>
-#if defined(CONFIG_OF)
+#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
  #include <linux/of.h>
  #include <linux/of_device.h>
  #include <linux/of_platform.h>
@@ -581,7 +581,7 @@ static struct platform_driver ulite_platform_driver = {
  /* ---------------------------------------------------------------------
  * OF bus bindings
  */
-#if defined(CONFIG_OF)
+#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))

 static int __devinit
 ulite_of_probe(struct of_device *op, const struct of_device_id *match) {

drivers/serial/uartlite.c +3 -3
@@ -631,11 +631,11 @@ static inline void __exit ulite_of_unregister(void)
  {
        of_unregister_platform_driver(&ulite_of_driver);
  }
-#else /* CONFIG_OF */
-/* CONFIG_OF not enabled; do nothing helpers */
+#else /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
+/* Appropriate config not enabled; do nothing helpers */
  static inline int __init ulite_of_register(void) { return 0; }
  static inline void __exit ulite_of_unregister(void) { }
-#endif /* CONFIG_OF */
+#endif /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
 
  /* ---------------------------------------------------------------------
  * Module setup/teardown
Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#8 lore raw
Quoted 9 lines · Grant Likely
Quoted 8 lines · David Miller

We can get this driver enabled via MFD_TIMBERDALE which only requires GPIO to be on.

But the of_address_to_resource() function is only present on powerpc and microblaze, so we have to conditionalize the CONFIG_OF probing bits on that.

Quoted 5 lines
Quoted 1 line

Linus or Greg, can you please pick this bug fix up?

I can if someone sends it to me in a form I can apply it :)

thanks,

greg k-h

#9 lore raw
In reply to Grant Likely
Quoted 9 lines · Grant Likely
Quoted 8 lines · David Miller

We can get this driver enabled via MFD_TIMBERDALE which only requires GPIO to be on.

But the of_address_to_resource() function is only present on powerpc and microblaze, so we have to conditionalize the CONFIG_OF probing bits on that.

Quoted 5 lines
Quoted 1 line

Linus or Greg, can you please pick this bug fix up?

Ok, I found it in the archives, I'll take this now.

thanks,

greg k-h