Re: [PATCH -mm v3][POWERPC] mpc8xxx : allow SPI without cs.

2009-06-19 Thread Rini van Zetten

This patch adds the possibility to have a spi device without a cs.

For example, the dts file should look something like this:

spi-controller {
   gpios = pio1 1 0  /* cs0 */
0  /* cs1, no GPIO */
pio2 2 0;/* cs2 */

Signed-off-by: Rini van Zetten r...@arvoo.nl
---
Changes :
patch against 2.6.30-rc8-mm1
style updates
compiler warning fix
comment :
This feature is needed on our home made board to program an onboard 
fpga.
The fpga needs some special pin toggling to put it in programming mode.
That's why we want to skip the usual gpio cs and do the pin toggling
in our driver


diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c
index 0fd0ec4..3a367ce 100644
--- a/drivers/spi/spi_mpc8xxx.c
+++ b/drivers/spi/spi_mpc8xxx.c
@@ -666,9 +666,12 @@ static void mpc8xxx_spi_cs_control(struct spi_device *spi, 
bool on)
struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(dev-platform_data);
u16 cs = spi-chip_select;
int gpio = pinfo-gpios[cs];
-   bool alow = pinfo-alow_flags[cs];

-   gpio_set_value(gpio, on ^ alow);
+   if (gpio != -EEXIST) {
+   bool alow = pinfo-alow_flags[cs];
+
+   gpio_set_value(gpio, on ^ alow);
+   }
 }

 static int of_mpc8xxx_spi_get_chipselects(struct device *dev)
@@ -707,27 +710,31 @@ static int of_mpc8xxx_spi_get_chipselects(struct device 
*dev)
enum of_gpio_flags flags;

gpio = of_get_gpio_flags(np, i, flags);
-   if (!gpio_is_valid(gpio)) {
+   if (gpio_is_valid(gpio)) {
+   ret = gpio_request(gpio, dev_name(dev));
+   if (ret) {
+   dev_err(dev, can't request gpio #%d: %d\n,
+i, ret);
+   goto err_loop;
+   }
+
+   pinfo-gpios[i] = gpio;
+   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
+
+   ret = gpio_direction_output(pinfo-gpios[i],
+   pinfo-alow_flags[i]);
+   if (ret) {
+   dev_err(dev, can't set output direction for
+   gpio #%d: %d\n,
+   i, ret);
+   goto err_loop;
+   }
+   } else if (gpio == -EEXIST) {
+   pinfo-gpios[i] = -EEXIST;
+   } else {
dev_err(dev, invalid gpio #%d: %d\n, i, gpio);
goto err_loop;
}
-
-   ret = gpio_request(gpio, dev_name(dev));
-   if (ret) {
-   dev_err(dev, can't request gpio #%d: %d\n, i, ret);
-   goto err_loop;
-   }
-
-   pinfo-gpios[i] = gpio;
-   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
-
-   ret = gpio_direction_output(pinfo-gpios[i],
-   pinfo-alow_flags[i]);
-   if (ret) {
-   dev_err(dev, can't set output direction for gpio 
-   #%d: %d\n, i, ret);
-   goto err_loop;
-   }
}

pdata-max_chipselect = ngpios;
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH -mm v3][POWERPC] mpc8xxx : allow SPI without cs.

2009-06-19 Thread Rini van Zetten


On Jun 19, 2009, at 2:26 AM, Rini van Zetten wrote:


This patch adds the possibility to have a spi device without a cs.

For example, the dts file should look something like this:

spi-controller {
  gpios = pio1 1 0  /* cs0 */
   0  /* cs1, no GPIO */
   pio2 2 0;/* cs2 */

Signed-off-by: Rini van Zetten r...@arvoo.nl
---
Changes :
patch against 2.6.30-rc8-mm1
style updates
compiler warning fix
comment :
This feature is needed on our home made board to program an 
onboard fpga.
The fpga needs some special pin toggling to put it in programming 
mode.

That's why we want to skip the usual gpio cs and do the pin toggling
in our driver



Which FSL chip are you using?


We use the MPC8377E

Rini



- k

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


--
Rini van Zetten
Senior Software Engineer

-
ARVOO Engineering B.V.
Tasveld 13
3417 XS Montfoort
The Netherlands

E-mail : mailto:r...@arvoo.com Rini van Zetten

Web : www.arvoo.com



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


Re: [PATCH -mm v4][POWERPC] mpc8xxx : allow SPI without cs.

2009-06-19 Thread Rini van Zetten

This patch adds the possibility to have a spi device without a cs.

For example, the dts file should look something like this:

spi-controller {
   gpios = pio1 1 0  /* cs0 */
0  /* cs1, no GPIO */
pio2 2 0;/* cs2 */

This feature is needed on our home made board to program an onboard fpga.
The fpga needs some special pin toggling to put it in programming mode.
That's why we want to skip the usual gpio cs and do the pin toggling
in our driver

Signed-off-by: Rini van Zetten r...@arvoo.nl
Acked-by: Anton Vorontsov avoront...@ru.mvista.com
---
Changes :
patch against 2.6.30-rc8-mm1
style updates
compiler warning fix
v4 :
missing space in error text added
splitted lines combined

diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c
index 0fd0ec4..de95790 100644
--- a/drivers/spi/spi_mpc8xxx.c
+++ b/drivers/spi/spi_mpc8xxx.c
@@ -666,9 +666,12 @@ static void mpc8xxx_spi_cs_control(struct spi_device *spi, 
bool on)
struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(dev-platform_data);
u16 cs = spi-chip_select;
int gpio = pinfo-gpios[cs];
-   bool alow = pinfo-alow_flags[cs];

-   gpio_set_value(gpio, on ^ alow);
+   if (gpio != -EEXIST) {
+   bool alow = pinfo-alow_flags[cs];
+
+   gpio_set_value(gpio, on ^ alow);
+   }
 }

 static int of_mpc8xxx_spi_get_chipselects(struct device *dev)
@@ -678,7 +681,7 @@ static int of_mpc8xxx_spi_get_chipselects(struct device 
*dev)
struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
unsigned int ngpios;
int i = 0;
-   int ret;
+   int ret = 0;

ngpios = of_gpio_count(np);
if (!ngpios) {
@@ -707,27 +710,30 @@ static int of_mpc8xxx_spi_get_chipselects(struct device 
*dev)
enum of_gpio_flags flags;

gpio = of_get_gpio_flags(np, i, flags);
-   if (!gpio_is_valid(gpio)) {
+   if (gpio_is_valid(gpio)) {
+   ret = gpio_request(gpio, dev_name(dev));
+   if (ret) {
+   dev_err(dev, can't request gpio #%d: %d\n,
+i, ret);
+   goto err_loop;
+   }
+
+   pinfo-gpios[i] = gpio;
+   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
+
+   ret = gpio_direction_output(pinfo-gpios[i],
+   pinfo-alow_flags[i]);
+   if (ret) {
+   dev_err(dev, can't set output direction for 
+   gpio #%d: %d\n, i, ret);
+   goto err_loop;
+   }
+   } else if (gpio == -EEXIST) {
+   pinfo-gpios[i] = -EEXIST;
+   } else {
dev_err(dev, invalid gpio #%d: %d\n, i, gpio);
goto err_loop;
}
-
-   ret = gpio_request(gpio, dev_name(dev));
-   if (ret) {
-   dev_err(dev, can't request gpio #%d: %d\n, i, ret);
-   goto err_loop;
-   }
-
-   pinfo-gpios[i] = gpio;
-   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
-
-   ret = gpio_direction_output(pinfo-gpios[i],
-   pinfo-alow_flags[i]);
-   if (ret) {
-   dev_err(dev, can't set output direction for gpio 
-   #%d: %d\n, i, ret);
-   goto err_loop;
-   }
}

pdata-max_chipselect = ngpios;
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH -mm][POWERPC] mpc8xxx : allow SPI without cs.

2009-06-18 Thread Rini van Zetten

This patch adds the possibility to have a spi device without a cs.

For example, the dts file should look something like this:

spi-controller {
   gpios = pio1 1 0  /* cs0 */
0  /* cs1, no GPIO */
pio2 2 0;/* cs2 */



Signed-off-by: Rini van Zetten r...@arvoo.nl
---
Changes :
patch against 2.6.30-rc8-mm1

--- drivers/spi/spi_mpc8xxx.c.org   2009-06-12 10:45:21.0 +0200
+++ drivers/spi/spi_mpc8xxx.c   2009-06-12 10:54:48.0 +0200
@@ -666,9 +666,10 @@ static void mpc8xxx_spi_cs_control(struc
struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(dev-platform_data);
u16 cs = spi-chip_select;
int gpio = pinfo-gpios[cs];
-   bool alow = pinfo-alow_flags[cs];
-
-   gpio_set_value(gpio, on ^ alow);
+   if (gpio != -EEXIST) {
+   bool alow = pinfo-alow_flags[cs];
+   gpio_set_value(gpio, on ^ alow);
+   }
 }

 static int of_mpc8xxx_spi_get_chipselects(struct device *dev)
@@ -707,27 +708,29 @@ static int of_mpc8xxx_spi_get_chipselect
enum of_gpio_flags flags;

gpio = of_get_gpio_flags(np, i, flags);
-   if (!gpio_is_valid(gpio)) {
+   if (gpio_is_valid(gpio)) {
+   ret = gpio_request(gpio, dev_name(dev));
+   if (ret) {
+   dev_err(dev, can't request gpio #%d: %d\n, i, 
ret);
+   goto err_loop;
+   }
+
+   pinfo-gpios[i] = gpio;
+   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
+
+   ret = gpio_direction_output(pinfo-gpios[i],
+   pinfo-alow_flags[i]);
+   if (ret) {
+   dev_err(dev, can't set output direction for gpio 

+   #%d: %d\n, i, ret);
+   goto err_loop;
+   }
+   } else if (gpio == -EEXIST) {
+   pinfo-gpios[i] = -EEXIST;
+   } else {
dev_err(dev, invalid gpio #%d: %d\n, i, gpio);
goto err_loop;
}
-
-   ret = gpio_request(gpio, dev_name(dev));
-   if (ret) {
-   dev_err(dev, can't request gpio #%d: %d\n, i, ret);
-   goto err_loop;
-   }
-
-   pinfo-gpios[i] = gpio;
-   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
-
-   ret = gpio_direction_output(pinfo-gpios[i],
-   pinfo-alow_flags[i]);
-   if (ret) {
-   dev_err(dev, can't set output direction for gpio 
-   #%d: %d\n, i, ret);
-   goto err_loop;
-   }
}

pdata-max_chipselect = ngpios;
--


--
Rini van Zetten
Senior Software Engineer

-
ARVOO Engineering B.V.
Tasveld 13
3417 XS Montfoort
The Netherlands

E-mail : mailto:r...@arvoo.com Rini van Zetten

Web : www.arvoo.com



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


[PATCH -mm][POWERPC] mpc8xxx : allow SPI without cs.

2009-06-12 Thread Rini van Zetten

This patch adds the possibility to have a spi device without a cs.

For example, the dts file should look something like this:

spi-controller {
   gpios = pio1 1 0  /* cs0 */
0  /* cs1, no GPIO */
pio2 2 0;/* cs2 */



Signed-off-by: Rini van Zetten r...@arvoo.nl
---
Changes :
patch against 2.6.30-rc8-mm1

--- drivers/spi/spi_mpc8xxx.c.org   2009-06-12 10:45:21.0 +0200
+++ drivers/spi/spi_mpc8xxx.c   2009-06-12 10:54:48.0 +0200
@@ -666,9 +666,10 @@ static void mpc8xxx_spi_cs_control(struc
struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(dev-platform_data);
u16 cs = spi-chip_select;
int gpio = pinfo-gpios[cs];
-   bool alow = pinfo-alow_flags[cs];
-
-   gpio_set_value(gpio, on ^ alow);
+   if (gpio != -EEXIST) {
+   bool alow = pinfo-alow_flags[cs];
+   gpio_set_value(gpio, on ^ alow);
+   }
 }

 static int of_mpc8xxx_spi_get_chipselects(struct device *dev)
@@ -707,27 +708,29 @@ static int of_mpc8xxx_spi_get_chipselect
enum of_gpio_flags flags;

gpio = of_get_gpio_flags(np, i, flags);
-   if (!gpio_is_valid(gpio)) {
+   if (gpio_is_valid(gpio)) {
+   ret = gpio_request(gpio, dev_name(dev));
+   if (ret) {
+   dev_err(dev, can't request gpio #%d: %d\n, i, 
ret);
+   goto err_loop;
+   }
+
+   pinfo-gpios[i] = gpio;
+   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
+
+   ret = gpio_direction_output(pinfo-gpios[i],
+   pinfo-alow_flags[i]);
+   if (ret) {
+   dev_err(dev, can't set output direction for gpio 

+   #%d: %d\n, i, ret);
+   goto err_loop;
+   }
+   } else if (gpio == -EEXIST) {
+   pinfo-gpios[i] = -EEXIST;
+   } else {
dev_err(dev, invalid gpio #%d: %d\n, i, gpio);
goto err_loop;
}
-
-   ret = gpio_request(gpio, dev_name(dev));
-   if (ret) {
-   dev_err(dev, can't request gpio #%d: %d\n, i, ret);
-   goto err_loop;
-   }
-
-   pinfo-gpios[i] = gpio;
-   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
-
-   ret = gpio_direction_output(pinfo-gpios[i],
-   pinfo-alow_flags[i]);
-   if (ret) {
-   dev_err(dev, can't set output direction for gpio 
-   #%d: %d\n, i, ret);
-   goto err_loop;
-   }
}

pdata-max_chipselect = ngpios;
--
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH][POWERPC] mpc83xx : allow SPI without cs.

2009-06-11 Thread Rini van Zetten

This patch adds the possibility to have a spi device without a cs.

For example, the dts file should look something like this:

spi-controller {
   gpios = pio1 1 0  /* cs0 */
0  /* cs1, no GPIO */
pio2 2 0;/* cs2 */



Signed-off-by: Rini van Zetten r...@arvoo.nl
---
 drivers/spi/spi_mpc83xx.c |   44 +++-
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index f4573a9..d06027e 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -687,9 +687,10 @@ static void mpc83xx_spi_cs_control(struct spi_device *spi, 
bool on)
struct mpc83xx_spi_probe_info *pinfo = to_of_pinfo(dev-platform_data);
u16 cs = spi-chip_select;
int gpio = pinfo-gpios[cs];
-   bool alow = pinfo-alow_flags[cs];
-
-   gpio_set_value(gpio, on ^ alow);
+   if ( gpio != -EEXIST ) {
+   bool alow = pinfo-alow_flags[cs];
+   gpio_set_value(gpio, on ^ alow);
+   }
 }

 static int of_mpc83xx_spi_get_chipselects(struct device *dev)
@@ -728,27 +729,28 @@ static int of_mpc83xx_spi_get_chipselects(struct device 
*dev)
enum of_gpio_flags flags;

gpio = of_get_gpio_flags(np, i, flags);
-   if (!gpio_is_valid(gpio)) {
+   if (gpio_is_valid(gpio)) {
+   ret = gpio_request(gpio, dev_name(dev));
+   if (ret) {
+   dev_err(dev, can't request gpio #%d: %d\n, i, 
ret);
+   goto err_loop;
+   }
+   pinfo-gpios[i] = gpio;
+   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
+
+   ret = gpio_direction_output(pinfo-gpios[i],
+   pinfo-alow_flags[i]);
+   if (ret) {
+   dev_err(dev, can't set output direction for gpio 

+   #%d: %d\n, i, ret);
+   goto err_loop;
+   }
+   } else if (gpio == -EEXIST) {
+   pinfo-gpios[i] = -EEXIST;
+   } else {
dev_err(dev, invalid gpio #%d: %d\n, i, gpio);
goto err_loop;
}
-
-   ret = gpio_request(gpio, dev_name(dev));
-   if (ret) {
-   dev_err(dev, can't request gpio #%d: %d\n, i, ret);
-   goto err_loop;
-   }
-
-   pinfo-gpios[i] = gpio;
-   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
-
-   ret = gpio_direction_output(pinfo-gpios[i],
-   pinfo-alow_flags[i]);
-   if (ret) {
-   dev_err(dev, can't set output direction for gpio 
-   #%d: %d\n, i, ret);
-   goto err_loop;
-   }
}

pdata-max_chipselect = ngpios;
--

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


Re: [PATCH][POWERPC] mpc83xx : allow SPI without cs.

2009-06-11 Thread Rini van Zetten

excuse me for my ignorance, but which -mm tree do you mean and where can I find 
it.

Regards,
Rini

Kumar Gala schreef:


On Jun 11, 2009, at 4:10 AM, Rini van Zetten wrote:


This patch adds the possibility to have a spi device without a cs.

For example, the dts file should look something like this:

spi-controller {
  gpios = pio1 1 0  /* cs0 */
   0  /* cs1, no GPIO */
   pio2 2 0;/* cs2 */



Signed-off-by: Rini van Zetten r...@arvoo.nl
---
drivers/spi/spi_mpc83xx.c |   44 
+++-

1 files changed, 23 insertions(+), 21 deletions(-)


This patch needs to be respun against the -mm tree as a lot of other spi 
patches are queued up there that will cause this patch to not merge 
correctly.


- k


--
Rini van Zetten
Senior Software Engineer

-
ARVOO Engineering B.V.
Tasveld 13
3417 XS Montfoort
The Netherlands

E-mail : mailto:r...@arvoo.com Rini van Zetten

Web : www.arvoo.com



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


[PATCH][POWERPC] mpc83xx : allow SPI without cs.

2009-05-13 Thread Rini van Zetten

This patch adds the possibility to have a spi device without a cs.

For example, the dts file should look something like this:

spi-controller {
   gpios = pio1 1 0  /* cs0 */
0  /* cs1, no GPIO */
pio2 2 0;/* cs2 */



Signed-off-by: Rini van Zetten r...@arvoo.nl
---
 drivers/spi/spi_mpc83xx.c |   44 +++-
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index f4573a9..d06027e 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -687,9 +687,10 @@ static void mpc83xx_spi_cs_control(struct spi_device *spi, 
bool on)
struct mpc83xx_spi_probe_info *pinfo = to_of_pinfo(dev-platform_data);
u16 cs = spi-chip_select;
int gpio = pinfo-gpios[cs];
-   bool alow = pinfo-alow_flags[cs];
-
-   gpio_set_value(gpio, on ^ alow);
+   if ( gpio != -EEXIST ) {
+   bool alow = pinfo-alow_flags[cs];
+   gpio_set_value(gpio, on ^ alow);
+   }
 }

 static int of_mpc83xx_spi_get_chipselects(struct device *dev)
@@ -728,27 +729,28 @@ static int of_mpc83xx_spi_get_chipselects(struct device 
*dev)
enum of_gpio_flags flags;

gpio = of_get_gpio_flags(np, i, flags);
-   if (!gpio_is_valid(gpio)) {
+   if (gpio_is_valid(gpio)) {
+   ret = gpio_request(gpio, dev_name(dev));
+   if (ret) {
+   dev_err(dev, can't request gpio #%d: %d\n, i, 
ret);
+   goto err_loop;
+   }
+   pinfo-gpios[i] = gpio;
+   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
+
+   ret = gpio_direction_output(pinfo-gpios[i],
+   pinfo-alow_flags[i]);
+   if (ret) {
+   dev_err(dev, can't set output direction for gpio 

+   #%d: %d\n, i, ret);
+   goto err_loop;
+   }
+   } else if (gpio == -EEXIST) {
+   pinfo-gpios[i] = -EEXIST;
+   } else {
dev_err(dev, invalid gpio #%d: %d\n, i, gpio);
goto err_loop;
}
-
-   ret = gpio_request(gpio, dev_name(dev));
-   if (ret) {
-   dev_err(dev, can't request gpio #%d: %d\n, i, ret);
-   goto err_loop;
-   }
-
-   pinfo-gpios[i] = gpio;
-   pinfo-alow_flags[i] = flags  OF_GPIO_ACTIVE_LOW;
-
-   ret = gpio_direction_output(pinfo-gpios[i],
-   pinfo-alow_flags[i]);
-   if (ret) {
-   dev_err(dev, can't set output direction for gpio 
-   #%d: %d\n, i, ret);
-   goto err_loop;
-   }
}

pdata-max_chipselect = ngpios;
--
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH net] gianfar : Do right check on num_txbdfree

2009-02-26 Thread Rini van Zetten

This patch fixes a wrong check on num_txbdfree. It could lead to num_txbdfree 
become nagative.
Result was that the gianfar stops sending data.


Signed-off-by: Rini van Zetten rini at arvoo dot nl
---
 drivers/net/gianfar.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 7ef1ffd..2dc3bd3 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1284,9 +1284,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct 
net_device *dev)
spin_lock_irqsave(priv-txlock, flags);

/* check if there is space to queue this packet */
-   if (nr_frags  priv-num_txbdfree) {
+   if ( (nr_frags+1)  priv-num_txbdfree) {
/* no space, stop the queue */
netif_stop_queue(dev);
dev-stats.tx_fifo_errors++;
spin_unlock_irqrestore(priv-txlock, flags);
--


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


[PATCH v2 net] gianfar : Do right check on num_txbdfree

2009-02-26 Thread Rini van Zetten

This patch fixes a wrong check on num_txbdfree. It could lead to num_txbdfree 
become nagative.
Result was that the gianfar stops sending data.

Changes from first version :
- removed a space between parens (David Millers comment)
- full email address in signed off line


Signed-off-by: Rini van Zetten r...@arvoo.nl
---
 drivers/net/gianfar.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 7ef1ffd..2dc3bd3 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1284,9 +1284,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct 
net_device *dev)
 spin_lock_irqsave(priv-txlock, flags);

 /* check if there is space to queue this packet */
-if (nr_frags  priv-num_txbdfree) {
+if ((nr_frags+1)  priv-num_txbdfree) {
 /* no space, stop the queue */
 netif_stop_queue(dev);
 dev-stats.tx_fifo_errors++;
 spin_unlock_irqrestore(priv-txlock, flags);
--
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


gianfar device hangs when transmitting tcp frames

2009-02-25 Thread Rini van Zetten

Hi,

We have a home made board with the mpc8377E.
We use the latest linux kernel 2.6.29-rc6.

The problem occurs when send a lot of tcp packet (eg by iperf as client)
sometimes we get an watchdog timeout : see below.

If we undo the commit  :

-#define BD_LENGTH_MASK 0x00ff
+#define BD_LENGTH_MASK 0x

the device works fine.

Is this commit introducing a bug or is it another problem ?

Regards,
Rini



kernel: NETDEV WATCHDOG: eth0 (fsl-gianfar): transmit timed out
kernel: [ cut here ]
kernel: Badness at 
/arv-002/rini/Projects/ax601/linux-galak/net/sched/sch_generic.c:226
kernel: NIP: c02f6920 LR: c02f6920 CTR: 0001
kernel: REGS: c04cbd00 TRAP: 0700   Not tainted  (2.6.29-rc5-arvoo-0.2)
kernel: MSR: 00029032 EE,ME,CE,IR,DR  CR: 24002024  XER: 2000
kernel: TASK = c04a0588[0] 'swapper' THREAD: c04ca000
kernel: GPR00: c02f6920 c04cbdb0 c04a0588 003b 27aa  c04d 
0002
kernel: GPR08: 0036  27aa c04a2414 44002082  07ffc000 
06fb1000
kernel: GPR16: 01000100    03000130 07daf863 0001 
c04f
kernel: GPR24: c041  c78431c0 c04ca000 c7843000 0001 c04d 
c04a
kernel: NIP [c02f6920] dev_watchdog+0x2e8/0x2f8
kernel: LR [c02f6920] dev_watchdog+0x2e8/0x2f8
kernel: Call Trace:
kernel: [c04cbdb0] [c02f6920] dev_watchdog+0x2e8/0x2f8 (unreliable)
kernel: [c04cbe20] [c002b314] run_timer_softirq+0x180/0x224
kernel: [c04cbe50] [c0025b0c] __do_softirq+0x84/0x128
kernel: [c04cbe80] [c00060f8] do_softirq+0x58/0x5c
kernel: [c04cbe90] [c0025730] irq_exit+0x60/0x80
kernel: [c04cbea0] [c000e94c] timer_interrupt+0x12c/0x188
kernel: [c04cbec0] [c0012130] ret_from_except+0x0/0x14
kernel: --- Exception: 901 at cpu_idle+0xa0/0x100
kernel: LR = cpu_idle+0xa0/0x100
kernel: [c04cbf80] [c00094dc] cpu_idle+0xe4/0x100 (unreliable)
kernel: [c04cbfa0] [c036af70] __got2_end+0x7c/0x90
kernel: [c04cbfc0] [c04747e0] start_kernel+0x224/0x2a8
kernel: [c04cbff0] [3438] 0x3438
kernel: Instruction dump:
kernel: 3801 7c0903a6 4bfffe28 38810008 7f83e378 38a00040 4bfeb539 7f84e378
kernel: 7c651b78 3c60c045 38638c24 4bd29cc1 0fe0 3801 901e1b24 
4b94

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