linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Slight refactor of interrupt mapping for FSL parts
@ 2006-10-16 20:57 Andy Fleming
  2006-10-16 21:37 ` Kumar Gala
  2006-10-16 22:58 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 11+ messages in thread
From: Andy Fleming @ 2006-10-16 20:57 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Jeff Garzik


* Cleaned up interrupt mapping a little by adding a helper
  function which parses the irq out of the device-tree, and puts
  it into a resource.
* Changed the PHY Layer to use NO_IRQ instead of -1 for PHY_POLL.
  This means that polling will always be used if mapping the
  interrupt fails for any reason.
---
 arch/powerpc/sysdev/fsl_soc.c |   33 ++++++++++++++++-----------------
 include/linux/phy.h           |    2 +-
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index dbe92ae..aa24b51 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -146,7 +146,7 @@ static int __init gfar_mdio_of_init(void
 		}
 
 		for (k = 0; k < 32; k++)
-			mdio_data.irq[k] = -1;
+			mdio_data.irq[k] = NO_IRQ;
 
 		while ((child = of_get_next_child(np, child)) != NULL) {
 			int irq = irq_of_parse_and_map(child, 0);
@@ -177,6 +177,13 @@ static const char *gfar_tx_intr = "tx";
 static const char *gfar_rx_intr = "rx";
 static const char *gfar_err_intr = "error";
 
+
+void of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
+{
+	r->start = r->end = irq_of_parse_and_map(dev, index);
+	r->flags = IORESOURCE_IRQ;
+}
+
 static int __init gfar_of_init(void)
 {
 	struct device_node *np;
@@ -204,8 +211,7 @@ static int __init gfar_of_init(void)
 		if (ret)
 			goto err;
 
-		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
-		r[1].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[1]);
 
 		model = get_property(np, "model", NULL);
 
@@ -214,12 +220,10 @@ static int __init gfar_of_init(void)
 			r[1].name = gfar_tx_intr;
 
 			r[2].name = gfar_rx_intr;
-			r[2].start = r[2].end = irq_of_parse_and_map(np, 1);
-			r[2].flags = IORESOURCE_IRQ;
+			of_irq_to_resource(np, 1, &r[2]);
 
 			r[3].name = gfar_err_intr;
-			r[3].start = r[3].end = irq_of_parse_and_map(np, 2);
-			r[3].flags = IORESOURCE_IRQ;
+			of_irq_to_resource(np, 2, &r[3]);
 
 			n_res += 2;
 		}
@@ -323,8 +327,7 @@ static int __init fsl_i2c_of_init(void)
 		if (ret)
 			goto err;
 
-		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
-		r[1].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[1]);
 
 		i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
 		if (IS_ERR(i2c_dev)) {
@@ -459,8 +462,7 @@ static int __init fsl_usb_of_init(void)
 		if (ret)
 			goto err;
 
-		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
-		r[1].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[1]);
 
 		usb_dev_mph =
 		    platform_device_register_simple("fsl-ehci", i, r, 2);
@@ -507,8 +509,7 @@ static int __init fsl_usb_of_init(void)
 		if (ret)
 			goto unreg_mph;
 
-		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
-		r[1].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[1]);
 
 		usb_dev_dr =
 		    platform_device_register_simple("fsl-ehci", i, r, 2);
@@ -591,8 +592,7 @@ static int __init fs_enet_of_init(void)
 		r[2].name = fcc_regs_c;
 		fs_enet_data.fcc_regs_c = r[2].start;
 
-		r[3].start = r[3].end = irq_of_parse_and_map(np, 0);
-		r[3].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[3]);
 
 		fs_enet_dev =
 		    platform_device_register_simple("fsl-cpm-fcc", i, &r[0], 4);
@@ -754,8 +754,7 @@ static int __init cpm_uart_of_init(void)
 			goto err;
 		r[1].name = scc_pram;
 
-		r[2].start = r[2].end = irq_of_parse_and_map(np, 0);
-		r[2].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[2]);
 
 		cpm_uart_dev =
 		    platform_device_register_simple("fsl-cpm-scc:uart", i, &r[0], 3);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9447a57..d7b3751 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -37,7 +37,7 @@ #define PHY_GBIT_FEATURES	(PHY_BASIC_FEA
  * or not desired for this PHY.  Set to PHY_IGNORE_INTERRUPT if
  * the attached driver handles the interrupt
  */
-#define PHY_POLL		-1
+#define PHY_POLL		NO_IRQ
 #define PHY_IGNORE_INTERRUPT	-2
 
 #define PHY_HAS_INTERRUPT	0x00000001
-- 
1.4.2.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] Slight refactor of interrupt mapping for FSL parts
  2006-10-16 20:57 [PATCH] Slight refactor of interrupt mapping for FSL parts Andy Fleming
@ 2006-10-16 21:37 ` Kumar Gala
  2006-10-16 21:51   ` Joakim Tjernlund
  2006-10-16 21:54   ` Kumar Gala
  2006-10-16 22:58 ` Benjamin Herrenschmidt
  1 sibling, 2 replies; 11+ messages in thread
From: Kumar Gala @ 2006-10-16 21:37 UTC (permalink / raw)
  To: Andy Fleming; +Cc: linuxppc-dev, Jeff Garzik


On Oct 16, 2006, at 3:57 PM, Andy Fleming wrote:

>
> * Cleaned up interrupt mapping a little by adding a helper
>   function which parses the irq out of the device-tree, and puts
>   it into a resource.
> * Changed the PHY Layer to use NO_IRQ instead of -1 for PHY_POLL.
>   This means that polling will always be used if mapping the
>   interrupt fails for any reason.

You forgot to fixup the arch/ppc users of this.


> ---
>  arch/powerpc/sysdev/fsl_soc.c |   33 +++++++++++++++ 
> +-----------------
>  include/linux/phy.h           |    2 +-
>  2 files changed, 17 insertions(+), 18 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/ 
> fsl_soc.c
> index dbe92ae..aa24b51 100644
> --- a/arch/powerpc/sysdev/fsl_soc.c
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -146,7 +146,7 @@ static int __init gfar_mdio_of_init(void
>  		}
>
>  		for (k = 0; k < 32; k++)
> -			mdio_data.irq[k] = -1;
> +			mdio_data.irq[k] = NO_IRQ;
>
>  		while ((child = of_get_next_child(np, child)) != NULL) {
>  			int irq = irq_of_parse_and_map(child, 0);
> @@ -177,6 +177,13 @@ static const char *gfar_tx_intr = "tx";
>  static const char *gfar_rx_intr = "rx";
>  static const char *gfar_err_intr = "error";
>
> +
> +void of_irq_to_resource(struct device_node *dev, int index, struct  
> resource *r)
> +{
> +	r->start = r->end = irq_of_parse_and_map(dev, index);
> +	r->flags = IORESOURCE_IRQ;
> +}

Why don't you stick this in prom_parse.c (and add a prototype to prom.h)

> +
>  static int __init gfar_of_init(void)
>  {
>  	struct device_node *np;
> @@ -204,8 +211,7 @@ static int __init gfar_of_init(void)
>  		if (ret)
>  			goto err;
>
> -		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
> -		r[1].flags = IORESOURCE_IRQ;
> +		of_irq_to_resource(np, 0, &r[1]);
>
>  		model = get_property(np, "model", NULL);
>
> @@ -214,12 +220,10 @@ static int __init gfar_of_init(void)
>  			r[1].name = gfar_tx_intr;
>
>  			r[2].name = gfar_rx_intr;
> -			r[2].start = r[2].end = irq_of_parse_and_map(np, 1);
> -			r[2].flags = IORESOURCE_IRQ;
> +			of_irq_to_resource(np, 1, &r[2]);
>
>  			r[3].name = gfar_err_intr;
> -			r[3].start = r[3].end = irq_of_parse_and_map(np, 2);
> -			r[3].flags = IORESOURCE_IRQ;
> +			of_irq_to_resource(np, 2, &r[3]);
>
>  			n_res += 2;
>  		}
> @@ -323,8 +327,7 @@ static int __init fsl_i2c_of_init(void)
>  		if (ret)
>  			goto err;
>
> -		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
> -		r[1].flags = IORESOURCE_IRQ;
> +		of_irq_to_resource(np, 0, &r[1]);
>
>  		i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
>  		if (IS_ERR(i2c_dev)) {
> @@ -459,8 +462,7 @@ static int __init fsl_usb_of_init(void)
>  		if (ret)
>  			goto err;
>
> -		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
> -		r[1].flags = IORESOURCE_IRQ;
> +		of_irq_to_resource(np, 0, &r[1]);
>
>  		usb_dev_mph =
>  		    platform_device_register_simple("fsl-ehci", i, r, 2);
> @@ -507,8 +509,7 @@ static int __init fsl_usb_of_init(void)
>  		if (ret)
>  			goto unreg_mph;
>
> -		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
> -		r[1].flags = IORESOURCE_IRQ;
> +		of_irq_to_resource(np, 0, &r[1]);
>
>  		usb_dev_dr =
>  		    platform_device_register_simple("fsl-ehci", i, r, 2);
> @@ -591,8 +592,7 @@ static int __init fs_enet_of_init(void)
>  		r[2].name = fcc_regs_c;
>  		fs_enet_data.fcc_regs_c = r[2].start;
>
> -		r[3].start = r[3].end = irq_of_parse_and_map(np, 0);
> -		r[3].flags = IORESOURCE_IRQ;
> +		of_irq_to_resource(np, 0, &r[3]);
>
>  		fs_enet_dev =
>  		    platform_device_register_simple("fsl-cpm-fcc", i, &r[0], 4);
> @@ -754,8 +754,7 @@ static int __init cpm_uart_of_init(void)
>  			goto err;
>  		r[1].name = scc_pram;
>
> -		r[2].start = r[2].end = irq_of_parse_and_map(np, 0);
> -		r[2].flags = IORESOURCE_IRQ;
> +		of_irq_to_resource(np, 0, &r[2]);
>
>  		cpm_uart_dev =
>  		    platform_device_register_simple("fsl-cpm-scc:uart", i, &r 
> [0], 3);
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 9447a57..d7b3751 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -37,7 +37,7 @@ #define PHY_GBIT_FEATURES	(PHY_BASIC_FEA
>   * or not desired for this PHY.  Set to PHY_IGNORE_INTERRUPT if
>   * the attached driver handles the interrupt
>   */
> -#define PHY_POLL		-1
> +#define PHY_POLL		NO_IRQ
>  #define PHY_IGNORE_INTERRUPT	-2
>
>  #define PHY_HAS_INTERRUPT	0x00000001
> -- 
> 1.4.2.3

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH] Slight refactor of interrupt mapping for FSL parts
  2006-10-16 21:37 ` Kumar Gala
@ 2006-10-16 21:51   ` Joakim Tjernlund
  2006-10-18 13:50     ` Vitaly Bordug
  2006-10-19 19:14     ` Andy Fleming
  2006-10-16 21:54   ` Kumar Gala
  1 sibling, 2 replies; 11+ messages in thread
From: Joakim Tjernlund @ 2006-10-16 21:51 UTC (permalink / raw)
  To: 'Kumar Gala', 'Andy Fleming'
  Cc: linuxppc-dev, 'Jeff Garzik'

> > -#define PHY_POLL		-1
> > +#define PHY_POLL		NO_IRQ
> >  #define PHY_IGNORE_INTERRUPT	-2

What does PHY_IGNORE_INTERRUPT mean? Can I use that in a dummy PHY
driver that just pretends that all is well? Got a ethernet port that
is connect to a switch directly over MII.
How do I express -2 in a dts file?

 Jocke

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Slight refactor of interrupt mapping for FSL parts
  2006-10-16 21:37 ` Kumar Gala
  2006-10-16 21:51   ` Joakim Tjernlund
@ 2006-10-16 21:54   ` Kumar Gala
  1 sibling, 0 replies; 11+ messages in thread
From: Kumar Gala @ 2006-10-16 21:54 UTC (permalink / raw)
  To: Andy Fleming; +Cc: linuxppc-dev@ozlabs.org list, Jeff Garzik


On Oct 16, 2006, at 4:37 PM, Kumar Gala wrote:

>
> On Oct 16, 2006, at 3:57 PM, Andy Fleming wrote:
>
>>
>> * Cleaned up interrupt mapping a little by adding a helper
>>   function which parses the irq out of the device-tree, and puts
>>   it into a resource.
>> * Changed the PHY Layer to use NO_IRQ instead of -1 for PHY_POLL.
>>   This means that polling will always be used if mapping the
>>   interrupt fails for any reason.
>
> You forgot to fixup the arch/ppc users of this.
>
>
>> ---
>>  arch/powerpc/sysdev/fsl_soc.c |   33 +++++++++++++++
>> +-----------------
>>  include/linux/phy.h           |    2 +-
>>  2 files changed, 17 insertions(+), 18 deletions(-)
>>
>> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/
>> fsl_soc.c
>> index dbe92ae..aa24b51 100644
>> --- a/arch/powerpc/sysdev/fsl_soc.c
>> +++ b/arch/powerpc/sysdev/fsl_soc.c
>> @@ -146,7 +146,7 @@ static int __init gfar_mdio_of_init(void
>>  		}
>>
>>  		for (k = 0; k < 32; k++)
>> -			mdio_data.irq[k] = -1;
>> +			mdio_data.irq[k] = NO_IRQ;
>>
>>  		while ((child = of_get_next_child(np, child)) != NULL) {
>>  			int irq = irq_of_parse_and_map(child, 0);
>> @@ -177,6 +177,13 @@ static const char *gfar_tx_intr = "tx";
>>  static const char *gfar_rx_intr = "rx";
>>  static const char *gfar_err_intr = "error";
>>
>> +
>> +void of_irq_to_resource(struct device_node *dev, int index, struct
>> resource *r)
>> +{
>> +	r->start = r->end = irq_of_parse_and_map(dev, index);
>> +	r->flags = IORESOURCE_IRQ;
>> +}
>
> Why don't you stick this in prom_parse.c (and add a prototype to  
> prom.h)

Actually, just implement it in the header.

- k

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Slight refactor of interrupt mapping for FSL parts
  2006-10-16 20:57 [PATCH] Slight refactor of interrupt mapping for FSL parts Andy Fleming
  2006-10-16 21:37 ` Kumar Gala
@ 2006-10-16 22:58 ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-16 22:58 UTC (permalink / raw)
  To: Andy Fleming; +Cc: linuxppc-dev, Jeff Garzik


> +void of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
> +{
> +	r->start = r->end = irq_of_parse_and_map(dev, index);
> +	r->flags = IORESOURCE_IRQ;
> +}
> +

What about having that one in prom_parse.c ?

Ben.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] Slight refactor of interrupt mapping for FSL parts
@ 2006-10-17  6:27 Andy Fleming
  2006-10-17 15:50 ` Kumar Gala
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Fleming @ 2006-10-17  6:27 UTC (permalink / raw)
  To: linuxppc-dev, Kumar Gala, Jeff Garzik

* Cleaned up interrupt mapping a little by adding a helper
  function which parses the irq out of the device-tree, and puts
  it into a resource.
* Changed the PHY Layer to use NO_IRQ instead of -1 for PHY_POLL.
  This means that polling will always be used if mapping the
  interrupt fails for any reason.
* Changed the arch/ppc platform files to specify PHY_POLL, instead of -1
* Changed the fixed phy to use PHY_IGNORE_INTERRUPT
---
This is a respin of the patch to reply to comments from the community

 arch/powerpc/sysdev/fsl_soc.c                |   27 ++++++++++----------------
 arch/ppc/platforms/85xx/mpc8540_ads.c        |    4 ++--
 arch/ppc/platforms/85xx/mpc8560_ads.c        |    4 ++--
 arch/ppc/platforms/85xx/mpc85xx_cds_common.c |    6 +++---
 arch/ppc/platforms/85xx/sbc8560.c            |    2 +-
 arch/ppc/platforms/85xx/stx_gp3.c            |    2 +-
 arch/ppc/platforms/85xx/tqm85xx.c            |    4 ++--
 drivers/net/phy/fixed.c                      |    2 +-
 include/asm-powerpc/prom.h                   |    7 +++++++
 include/linux/phy.h                          |    7 ++++++-
 10 files changed, 35 insertions(+), 30 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index dbe92ae..9ed3b27 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -146,7 +146,7 @@ static int __init gfar_mdio_of_init(void
 		}
 
 		for (k = 0; k < 32; k++)
-			mdio_data.irq[k] = -1;
+			mdio_data.irq[k] = NO_IRQ;
 
 		while ((child = of_get_next_child(np, child)) != NULL) {
 			int irq = irq_of_parse_and_map(child, 0);
@@ -177,6 +177,7 @@ static const char *gfar_tx_intr = "tx";
 static const char *gfar_rx_intr = "rx";
 static const char *gfar_err_intr = "error";
 
+
 static int __init gfar_of_init(void)
 {
 	struct device_node *np;
@@ -204,8 +205,7 @@ static int __init gfar_of_init(void)
 		if (ret)
 			goto err;
 
-		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
-		r[1].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[1]);
 
 		model = get_property(np, "model", NULL);
 
@@ -214,12 +214,10 @@ static int __init gfar_of_init(void)
 			r[1].name = gfar_tx_intr;
 
 			r[2].name = gfar_rx_intr;
-			r[2].start = r[2].end = irq_of_parse_and_map(np, 1);
-			r[2].flags = IORESOURCE_IRQ;
+			of_irq_to_resource(np, 1, &r[2]);
 
 			r[3].name = gfar_err_intr;
-			r[3].start = r[3].end = irq_of_parse_and_map(np, 2);
-			r[3].flags = IORESOURCE_IRQ;
+			of_irq_to_resource(np, 2, &r[3]);
 
 			n_res += 2;
 		}
@@ -323,8 +321,7 @@ static int __init fsl_i2c_of_init(void)
 		if (ret)
 			goto err;
 
-		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
-		r[1].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[1]);
 
 		i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
 		if (IS_ERR(i2c_dev)) {
@@ -459,8 +456,7 @@ static int __init fsl_usb_of_init(void)
 		if (ret)
 			goto err;
 
-		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
-		r[1].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[1]);
 
 		usb_dev_mph =
 		    platform_device_register_simple("fsl-ehci", i, r, 2);
@@ -507,8 +503,7 @@ static int __init fsl_usb_of_init(void)
 		if (ret)
 			goto unreg_mph;
 
-		r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
-		r[1].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[1]);
 
 		usb_dev_dr =
 		    platform_device_register_simple("fsl-ehci", i, r, 2);
@@ -591,8 +586,7 @@ static int __init fs_enet_of_init(void)
 		r[2].name = fcc_regs_c;
 		fs_enet_data.fcc_regs_c = r[2].start;
 
-		r[3].start = r[3].end = irq_of_parse_and_map(np, 0);
-		r[3].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[3]);
 
 		fs_enet_dev =
 		    platform_device_register_simple("fsl-cpm-fcc", i, &r[0], 4);
@@ -754,8 +748,7 @@ static int __init cpm_uart_of_init(void)
 			goto err;
 		r[1].name = scc_pram;
 
-		r[2].start = r[2].end = irq_of_parse_and_map(np, 0);
-		r[2].flags = IORESOURCE_IRQ;
+		of_irq_to_resource(np, 0, &r[2]);
 
 		cpm_uart_dev =
 		    platform_device_register_simple("fsl-cpm-scc:uart", i, &r[0], 3);
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
index 4f839da..00a3ba5 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -92,9 +92,9 @@ #endif
 
 	mdata->irq[0] = MPC85xx_IRQ_EXT5;
 	mdata->irq[1] = MPC85xx_IRQ_EXT5;
-	mdata->irq[2] = -1;
+	mdata->irq[2] = PHY_POLL;
 	mdata->irq[3] = MPC85xx_IRQ_EXT5;
-	mdata->irq[31] = -1;
+	mdata->irq[31] = PHY_POLL;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
index 14ecec7..3a06046 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -156,9 +156,9 @@ #endif
 
 	mdata->irq[0] = MPC85xx_IRQ_EXT5;
 	mdata->irq[1] = MPC85xx_IRQ_EXT5;
-	mdata->irq[2] = -1;
+	mdata->irq[2] = PHY_POLL;
 	mdata->irq[3] = MPC85xx_IRQ_EXT5;
-	mdata->irq[31] = -1;
+	mdata->irq[31] = PHY_POLL;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index 5ce0f69..2d59eb7 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -451,9 +451,9 @@ #endif
 
 	mdata->irq[0] = MPC85xx_IRQ_EXT5;
 	mdata->irq[1] = MPC85xx_IRQ_EXT5;
-	mdata->irq[2] = -1;
-	mdata->irq[3] = -1;
-	mdata->irq[31] = -1;
+	mdata->irq[2] = PHY_POLL;
+	mdata->irq[3] = PHY_POLL;
+	mdata->irq[31] = PHY_POLL;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
index 764d580..1d10ab9 100644
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -129,7 +129,7 @@ #endif
 
 	mdata->irq[25] = MPC85xx_IRQ_EXT6;
 	mdata->irq[26] = MPC85xx_IRQ_EXT7;
-	mdata->irq[31] = -1;
+	mdata->irq[31] = PHY_POLL;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
index 4bb18ab..b1f5b73 100644
--- a/arch/ppc/platforms/85xx/stx_gp3.c
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -123,7 +123,7 @@ #endif
 
 	mdata->irq[2] = MPC85xx_IRQ_EXT5;
 	mdata->irq[4] = MPC85xx_IRQ_EXT5;
-	mdata->irq[31] = -1;
+	mdata->irq[31] = PHY_POLL;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
diff --git a/arch/ppc/platforms/85xx/tqm85xx.c b/arch/ppc/platforms/85xx/tqm85xx.c
index dd45f2e..4ee2bd1 100644
--- a/arch/ppc/platforms/85xx/tqm85xx.c
+++ b/arch/ppc/platforms/85xx/tqm85xx.c
@@ -137,9 +137,9 @@ #endif /* CONFIG_MPC8560 */
 
 	mdata->irq[0] = MPC85xx_IRQ_EXT8;
 	mdata->irq[1] = MPC85xx_IRQ_EXT8;
-	mdata->irq[2] = -1;
+	mdata->irq[2] = PHY_POLL;
 	mdata->irq[3] = MPC85xx_IRQ_EXT8;
-	mdata->irq[31] = -1;
+	mdata->irq[31] = PHY_POLL;
 
 	/* setup the board related information for the enet controllers */
 	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
index f14e992..096d4a1 100644
--- a/drivers/net/phy/fixed.c
+++ b/drivers/net/phy/fixed.c
@@ -254,7 +254,7 @@ static int fixed_mdio_register_device(in
 		goto device_create_fail;
 	}
 
-	phydev->irq = -1;
+	phydev->irq = PHY_IGNORE_INTERRUPT;
 	phydev->dev.bus = &mdio_bus_type;
 
 	if(number)
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 5246297..39f04ef 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -17,6 +17,7 @@ #ifdef __KERNEL__
  */
 #include <linux/types.h>
 #include <linux/proc_fs.h>
+#include <linux/platform_device.h>
 #include <asm/atomic.h>
 
 /* Definitions used by the flattened device tree */
@@ -331,6 +332,12 @@ extern int of_irq_map_one(struct device_
 struct pci_dev;
 extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
 
+static inline void of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
+{
+	r->start = r->end = irq_of_parse_and_map(dev, index);
+	r->flags = IORESOURCE_IRQ;
+}
+
 
 #endif /* __KERNEL__ */
 #endif /* _POWERPC_PROM_H */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9447a57..4dbffe4 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -20,6 +20,7 @@ #define __PHY_H
 
 #include <linux/spinlock.h>
 #include <linux/device.h>
+#include <asm/irq.h>
 
 #define PHY_BASIC_FEATURES	(SUPPORTED_10baseT_Half | \
 				 SUPPORTED_10baseT_Full | \
@@ -37,7 +38,11 @@ #define PHY_GBIT_FEATURES	(PHY_BASIC_FEA
  * or not desired for this PHY.  Set to PHY_IGNORE_INTERRUPT if
  * the attached driver handles the interrupt
  */
-#define PHY_POLL		-1
+#ifndef NO_IRQ
+#define NO_IRQ 0
+#endif
+
+#define PHY_POLL		NO_IRQ
 #define PHY_IGNORE_INTERRUPT	-2
 
 #define PHY_HAS_INTERRUPT	0x00000001
-- 
1.4.2.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] Slight refactor of interrupt mapping for FSL parts
  2006-10-17  6:27 Andy Fleming
@ 2006-10-17 15:50 ` Kumar Gala
  0 siblings, 0 replies; 11+ messages in thread
From: Kumar Gala @ 2006-10-17 15:50 UTC (permalink / raw)
  To: Andy Fleming; +Cc: linuxppc-dev, Jeff Garzik


On Oct 17, 2006, at 1:27 AM, Andy Fleming wrote:

> * Cleaned up interrupt mapping a little by adding a helper
>   function which parses the irq out of the device-tree, and puts
>   it into a resource.
> * Changed the PHY Layer to use NO_IRQ instead of -1 for PHY_POLL.
>   This means that polling will always be used if mapping the
>   interrupt fails for any reason.
> * Changed the arch/ppc platform files to specify PHY_POLL, instead  
> of -1
> * Changed the fixed phy to use PHY_IGNORE_INTERRUPT
> ---
> This is a respin of the patch to reply to comments from the community
>
>  arch/powerpc/sysdev/fsl_soc.c                |   27 +++++++++ 
> +----------------
>  arch/ppc/platforms/85xx/mpc8540_ads.c        |    4 ++--
>  arch/ppc/platforms/85xx/mpc8560_ads.c        |    4 ++--
>  arch/ppc/platforms/85xx/mpc85xx_cds_common.c |    6 +++---
>  arch/ppc/platforms/85xx/sbc8560.c            |    2 +-
>  arch/ppc/platforms/85xx/stx_gp3.c            |    2 +-
>  arch/ppc/platforms/85xx/tqm85xx.c            |    4 ++--
>  drivers/net/phy/fixed.c                      |    2 +-
>  include/asm-powerpc/prom.h                   |    7 +++++++
>  include/linux/phy.h                          |    7 ++++++-
>  10 files changed, 35 insertions(+), 30 deletions(-)

What about arch/ppc/platforms/83xx?  also arch/ppc/platforms/ 
mpc8272ads_setup.c

[snip]

> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 9447a57..4dbffe4 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -20,6 +20,7 @@ #define __PHY_H
>
>  #include <linux/spinlock.h>
>  #include <linux/device.h>
> +#include <asm/irq.h>
>
>  #define PHY_BASIC_FEATURES	(SUPPORTED_10baseT_Half | \
>  				 SUPPORTED_10baseT_Full | \
> @@ -37,7 +38,11 @@ #define PHY_GBIT_FEATURES	(PHY_BASIC_FEA
>   * or not desired for this PHY.  Set to PHY_IGNORE_INTERRUPT if
>   * the attached driver handles the interrupt
>   */
> -#define PHY_POLL		-1
> +#ifndef NO_IRQ
> +#define NO_IRQ 0
> +#endif
> +
> +#define PHY_POLL		NO_IRQ
>  #define PHY_IGNORE_INTERRUPT	-2
>
>  #define PHY_HAS_INTERRUPT	0x00000001

We really should run this by the larger kernel community

- k

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Slight refactor of interrupt mapping for FSL parts
  2006-10-16 21:51   ` Joakim Tjernlund
@ 2006-10-18 13:50     ` Vitaly Bordug
  2006-10-19 19:14     ` Andy Fleming
  1 sibling, 0 replies; 11+ messages in thread
From: Vitaly Bordug @ 2006-10-18 13:50 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linuxppc-dev, 'Jeff Garzik'

On Mon, 16 Oct 2006 23:51:43 +0200
"Joakim Tjernlund" <joakim.tjernlund@transmode.se> wrote:

> > > -#define PHY_POLL		-1
> > > +#define PHY_POLL		NO_IRQ
> > >  #define PHY_IGNORE_INTERRUPT	-2
> 
> What does PHY_IGNORE_INTERRUPT mean? Can I use that in a dummy PHY
> driver that just pretends that all is well? Got a ethernet port that
Well you can just use fixed phy from the phy abstraction layer, that I've implemented for the likewise aim. 

Hm, I just recalled I have to update it with new names on phy bus... Anyway, I used it with 8349-mitx to deal with vitesse switch. Just need to submit the change to make it work again. 

-- 
Sincerely, 
Vitaly

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Slight refactor of interrupt mapping for FSL parts
  2006-10-16 21:51   ` Joakim Tjernlund
  2006-10-18 13:50     ` Vitaly Bordug
@ 2006-10-19 19:14     ` Andy Fleming
  2006-10-19 22:40       ` Joakim Tjernlund
  1 sibling, 1 reply; 11+ messages in thread
From: Andy Fleming @ 2006-10-19 19:14 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linuxppc-dev, 'Jeff Garzik'


On Oct 16, 2006, at 16:51, Joakim Tjernlund wrote:

>>> -#define PHY_POLL		-1
>>> +#define PHY_POLL		NO_IRQ
>>>  #define PHY_IGNORE_INTERRUPT	-2
>
> What does PHY_IGNORE_INTERRUPT mean? Can I use that in a dummy PHY
> driver that just pretends that all is well? Got a ethernet port that
> is connect to a switch directly over MII.
> How do I express -2 in a dts file?


PHY_IGNORE_INTERRUPT means that the PHY Lib will not poll the  
interface, nor will it register for the interrupt.  Actually, it  
would be best for a dummy PHY driver.  Take a look at the driver in  
drivers/phy/fixed.c.  It's there to provide that kind of interface.   
It looks like it uses -1, which is a problem, but my revision of this  
patch will fix that.

(Sorry for the odd delay.  I was sure I had clicked "send" on this one)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH] Slight refactor of interrupt mapping for FSL parts
  2006-10-19 19:14     ` Andy Fleming
@ 2006-10-19 22:40       ` Joakim Tjernlund
  2006-10-20  0:54         ` Andy Fleming
  0 siblings, 1 reply; 11+ messages in thread
From: Joakim Tjernlund @ 2006-10-19 22:40 UTC (permalink / raw)
  To: 'Andy Fleming'; +Cc: linuxppc-dev, 'Jeff Garzik'

> 
> On Oct 16, 2006, at 16:51, Joakim Tjernlund wrote:
> 
> >>> -#define PHY_POLL		-1
> >>> +#define PHY_POLL		NO_IRQ
> >>>  #define PHY_IGNORE_INTERRUPT	-2
> >
> > What does PHY_IGNORE_INTERRUPT mean? Can I use that in a dummy PHY
> > driver that just pretends that all is well? Got a ethernet port that
> > is connect to a switch directly over MII.
> > How do I express -2 in a dts file?
> 
> 
> PHY_IGNORE_INTERRUPT means that the PHY Lib will not poll the  
> interface, nor will it register for the interrupt.  Actually, it  
> would be best for a dummy PHY driver.  Take a look at the driver in  
> drivers/phy/fixed.c.  It's there to provide that kind of interface.   
> It looks like it uses -1, which is a problem, but my revision 
> of this  
> patch will fix that.

Great, thanks. I don't see how to connect this PHY to ucc_geth driver yet. I think
it needs some PHY work first.

Maybe this patch,http://ozlabs.org/pipermail/linuxppc-dev/2006-October/026690.html, will make it better?
Why hasn't it been applied yet?

 Jocke

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Slight refactor of interrupt mapping for FSL parts
  2006-10-19 22:40       ` Joakim Tjernlund
@ 2006-10-20  0:54         ` Andy Fleming
  0 siblings, 0 replies; 11+ messages in thread
From: Andy Fleming @ 2006-10-20  0:54 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linuxppc-dev, 'Jeff Garzik'

>>
>>
>> PHY_IGNORE_INTERRUPT means that the PHY Lib will not poll the
>> interface, nor will it register for the interrupt.  Actually, it
>> would be best for a dummy PHY driver.  Take a look at the driver in
>> drivers/phy/fixed.c.  It's there to provide that kind of interface.
>> It looks like it uses -1, which is a problem, but my revision
>> of this
>> patch will fix that.
>
> Great, thanks. I don't see how to connect this PHY to ucc_geth  
> driver yet. I think
> it needs some PHY work first.
>
> Maybe this patch,http://ozlabs.org/pipermail/linuxppc-dev/2006- 
> October/026690.html, will make it better?
> Why hasn't it been applied yet?


No, there's a bigger issue.  The UCC driver has not been brought over  
to the PHY Layer.  Hopefully, this will be rectified in short order.

Andy

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-10-20  0:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-16 20:57 [PATCH] Slight refactor of interrupt mapping for FSL parts Andy Fleming
2006-10-16 21:37 ` Kumar Gala
2006-10-16 21:51   ` Joakim Tjernlund
2006-10-18 13:50     ` Vitaly Bordug
2006-10-19 19:14     ` Andy Fleming
2006-10-19 22:40       ` Joakim Tjernlund
2006-10-20  0:54         ` Andy Fleming
2006-10-16 21:54   ` Kumar Gala
2006-10-16 22:58 ` Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
2006-10-17  6:27 Andy Fleming
2006-10-17 15:50 ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).