at91 is broken on barebox
Subsystems (6)
HI,
since the switch to ERR_PTR & co
for dev_get_resource_by_name & others the at91 is broken
as on barebox we use a 1:1 mapping and the check of the IS_ERR is ((unsigned long)-MAX_ERRNO)
but on at91 the PIT and so on are at 0xfffffd30 so on always seen as an error
so can we revert the commit on
ommit 92cc1b1f9e3363046583962859a3a8c054f4b94d
& co
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
HI,
since the switch to
ERR_PTR& cofor
dev_get_resource_by_name& others the at91 is brokenas on barebox we use a 1:1 mapping and the check of the
IS_ERRis ((unsigned long)-MAX_ERRNO)but on at91 the PIT and so on are at
0xfffffd30so on always seen as an error
Damn :(
Since dev_get_resource_by_name returns a struct resource pointer it shouldn't be broken, right? What's broken should be:
dev_get_mem_region_by_namedev_request_mem_region_by_namedev_request_mem_region
Quoted 4 lines
so can we revert the commit on ommit 92cc1b1f9e3363046583962859a3a8c054f4b94d
Since these commits touch so many files I'm not sure we can simply revert these commits. All drivers that check for IS_ERR() from the above functions that were introduced after the commits to revert would have to be changed aswell.
The functions should still work, but the error check with IS_ERR() does not, right? So as a stop gap solution we could drop the error check from the affected drivers and as the next step change the prototype of the affected functions to something like:
int dev_request_mem_region(struct device_d *dev, int num, void __iomem **base);
Which drivers are affected anyway?
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Since I also ran into this issue just before the holidays, I thought I'd provide my 0.02$.
Quoted 13 lines · Sascha Hauer
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
HI,
since the switch to
ERR_PTR& cofor
dev_get_resource_by_name& others the at91 is brokenas on barebox we use a 1:1 mapping and the check of the
IS_ERRis ((unsigned long)-MAX_ERRNO)but on at91 the PIT and so on are at
0xfffffd30so on always seen as an error
Quoted 11 lines
Damn :(
Since
dev_get_resource_by_namereturns a struct resource pointer it shouldn't be broken, right? What's broken should be:
dev_get_mem_region_by_namedev_request_mem_region_by_namedev_request_mem_region
Correct, these function returns the 'start' field of the struct resource, which contains the offending address.
Quoted 10 lines
Quoted 4 lines
so can we revert the commit on
ommit
92cc1b1f9e3363046583962859a3a8c054f4b94dSince these commits touch so many files I'm not sure we can simply revert these commits. All drivers that check for
IS_ERR()from the above functions that were introduced after the commits to revert would have to be changed aswell.
Quoted 7 lines
The functions should still work, but the error check with
IS_ERR()does not, right? So as a stop gap solution we could drop the error check from the affected drivers and as the next step change the prototype of the affected functions to something like:int
dev_request_mem_region(struct device_d *dev, int num, void __iomem **base);
Sounds like the only sane way, and that is also the point when I realized that I had to put the fix on my TODO-list and live with the workaround for now, since I have a few show-stopping issues that I have to deal with first :-(
Quoted 2 lines
Which drivers are affected anyway?
I've had to remove the IS_ERR() check in:arch/arm/mach-at91/at91sam926x_time.cdrivers/pinctrl/at91-pinctrl.cdrivers/serial/atmel.c
There might be more drivers affected, but the list of drivers to check shouldn't be that long, see the memory map on page 15 in the reference manual[1]. Since it checks the base-address the AIC (0xfffff000) should be fine, but the rest (PIOA, PIOB, ...) could incorrectly fail.
Best,
Simon Aittamaa
[1]: http://www.atmel.com/Images/doc6221.pdf
Quoted 8 lines
Sascha
--
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
cover FIX AT91 support
In reply to Jean-Christophe PLAGNIOL-VILLARDHi,
This patch series fix at91 support that is broken for more than 3 months
please apply this on fix releases
Not even tested by Atmel when adding now SoC and Board
The following changes since commit 631be8e6cbe003f469a7e6b54046a743b710d989:
blspec: print error when devicetree not found (2014-12-16 14:29:23 +0100)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git delivery/at91_fix
for you to fetch changes up to 8f48b25818d29d406b3eba170910c6c24bd3a347:
driver: workarroud resource request that conflist with errno PTR (2015-01-05 17:46:38 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (2):
arm: at91: fix ecc_mode on non atmel boards
driver: workarroud resource request that conflist with errno PTR
arch/arm/boards/animeo_ip/init.c | 1 + arch/arm/boards/pm9261/init.c | 1 + arch/arm/boards/pm9263/init.c | 1 + arch/arm/boards/pm9g45/init.c | 1 + arch/arm/boards/qil-a926x/init.c | 1 + arch/arm/boards/telit-evk-pro3/init.c | 2 ++ arch/arm/boards/tny-a926x/init.c | 1 + arch/arm/boards/usb-a926x/init.c | 1 + arch/arm/mach-at91/at91sam926x_time.c | 6 +++--- drivers/base/driver.c | 31 +++++++++++++++++++++++++++++-- drivers/pinctrl/pinctrl-at91.c | 6 +++--- drivers/serial/atmel.c | 6 +++--- include/driver.h | 8 ++++++++ 13 files changed, 55 insertions(+), 11 deletions(-)
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/2 arm: at91: fix ecc_mode on non atmel boards
since
commit 54bccadddd52cb4cbbecd1403b9091fe651bd0fd
Author: Raphaël Poggi <[email protected]>
mtd: atmel_nand: retrieve ecc_mode from pdata
break most of the non atmel AT91 boards that did not provide a ecc_mode params in the nand pdata
--- arch/arm/boards/animeo_ip/init.c | 1 + arch/arm/boards/pm9261/init.c | 1 + arch/arm/boards/pm9263/init.c | 1 + arch/arm/boards/pm9g45/init.c | 1 + arch/arm/boards/qil-a926x/init.c | 1 + arch/arm/boards/telit-evk-pro3/init.c | 2 ++ arch/arm/boards/tny-a926x/init.c | 1 + arch/arm/boards/usb-a926x/init.c | 1 + 8 files changed, 9 insertions(+)
arch/arm/boards/animeo_ip/init.c +1 -0
@@ -93,6 +93,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .bus_width_16 = 0, .on_flash_bbt = 1, };
arch/arm/boards/pm9261/init.c +1 -0
@@ -50,6 +50,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PA16, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT,#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 ) .bus_width_16 = 1,#else
arch/arm/boards/pm9263/init.c +1 -0
@@ -50,6 +50,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PB30, .enable_pin = AT91_PIN_PD15, + .ecc_mode = NAND_ECC_SOFT,#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 ) .bus_width_16 = 1,#else
arch/arm/boards/pm9g45/init.c +1 -0
@@ -49,6 +49,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PD3, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .bus_width_16 = 0, .on_flash_bbt = 1, };
arch/arm/boards/qil-a926x/init.c +1 -0
@@ -43,6 +43,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .on_flash_bbt = 1, };
arch/arm/boards/telit-evk-pro3/init.c +2 -0
@@ -18,6 +18,7 @@#include <gpio.h> #include <init.h> #include <linux/clk.h> +#include <linux/mtd/nand.h> #include <mach/at91_rstc.h> #include <mach/at91sam9_smc.h> #include <mach/board.h>
@@ -33,6 +34,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .on_flash_bbt = 1, };
arch/arm/boards/tny-a926x/init.c +1 -0
@@ -55,6 +55,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .on_flash_bbt = 1, };
arch/arm/boards/usb-a926x/init.c +1 -0
@@ -59,6 +59,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .on_flash_bbt = 1, };
Signature · 7 lines
2.1.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/2 driver: workarroud resource request that conflist with errno PTR
broken since
commit ed6e965824303255cacc1c1a195d3684caa26bce
Author: Sascha Hauer <[email protected]>
resource: Let dev_request_mem_region return an error pointer
Introduce dev_request_mem_region_err_null
only used on platform like at91 where the Ressource address collision with
--- arch/arm/mach-at91/at91sam926x_time.c | 6 +++--- drivers/base/driver.c | 31 +++++++++++++++++++++++++++++-- drivers/pinctrl/pinctrl-at91.c | 6 +++--- drivers/serial/atmel.c | 6 +++--- include/driver.h | 8 ++++++++ 5 files changed, 46 insertions(+), 11 deletions(-)
arch/arm/mach-at91/at91sam926x_time.c +3 -3
@@ -89,9 +89,9 @@ static int at91_pit_probe(struct device_d *dev)return ret; } - pit_base =dev_request_mem_region (dev,0 ); -if (IS_ERR (pit_base)) -return PTR_ERR (pit_base); + pit_base =dev_request_mem_region_err_null (dev,0 ); +if (!pit_base) +return -ENOENT ; pit_rate =clk_get_rate (clk) /16 ;
drivers/base/driver.c +29 -2
@@ -242,8 +242,8 @@ int register_driver(struct driver_d *drv) }EXPORT_SYMBOL (register_driver); -struct resource *dev_get_resource (struct device_d *dev,unsigned long type, -int num) +static struct resource *__dev_get_resource (struct device_d *dev, +unsigned long type,int num) {int i, n =0 ;
@@ -256,6 +256,17 @@ struct resource *dev_get_resource(struct device_d *dev, unsigned long type, } } +return NULL ; +} + +struct resource *dev_get_resource (struct device_d *dev,unsigned long type, +int num) +{ +struct resource *res =__dev_get_resource (dev, type, num); + +if (res) +return res; +return ERR_PTR (-ENOENT ); }
@@ -318,6 +329,22 @@ void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *n }EXPORT_SYMBOL (dev_request_mem_region_by_name); +void __iomem *dev_request_mem_region_err_null (struct device_d *dev,int num) +{ +struct resource *res; + + res =__dev_get_resource (dev,IORESOURCE_MEM , num); +if (!res) +return res; + + res =request_iomem_region (dev_name (dev), res->start, res->end); +if (IS_ERR (res)) +return ERR_CAST (res); + +return (void __force __iomem *)res->start; +} +EXPORT_SYMBOL (dev_request_mem_region_err_null); +void __iomem *dev_request_mem_region (struct device_d *dev,int num) {struct resource *res;
drivers/pinctrl/pinctrl-at91.c +3 -3
@@ -652,9 +652,9 @@ static int at91_gpio_probe(struct device_d *dev) } gpio_banks =max (gpio_banks, alias_idx +1 ); - at91_gpio->regbase =dev_request_mem_region (dev,0 ); -if (IS_ERR (at91_gpio->regbase)) -return PTR_ERR (at91_gpio->regbase); + at91_gpio->regbase =dev_request_mem_region_err_null (dev,0 ); +if (!at91_gpio->regbase) +return -ENOENT ; at91_gpio->chip.ops = &at91_gpio_ops; at91_gpio->chip.ngpio =MAX_NB_GPIO_PER_BANK ;
drivers/serial/atmel.c +3 -3
@@ -398,9 +398,9 @@ static int atmel_serial_init_port(struct console_device *cdev)struct device_d *dev = cdev->dev;struct atmel_uart_port *uart =to_atmel_uart_port (cdev); - uart->base =dev_request_mem_region (dev,0 ); -if (IS_ERR (uart->base)) -return PTR_ERR (uart->base); + uart->base =dev_request_mem_region_err_null (dev,0 ); +if (!uart->base) +return -ENOENT ; uart->clk =clk_get (dev,"usart" );clk_enable (uart->clk);
include/driver.h +8 -0
@@ -206,6 +206,14 @@ void *dev_get_mem_region(struct device_d *dev, int num);*/ void __iomem *dev_request_mem_region (struct device_d *dev,int num); +/* +* exlusively request register base 'num' for a device +* will return NULL on error +* only used on platform like at91 where the Ressource address collision with +* PTR errno +*/ +void __iomem *dev_request_mem_region_err_null (struct device_d *dev,int num); +struct device_d *device_alloc (const char *devname,int id);int device_add_resources (struct device_d *dev,const struct resource *res,int num);
Signature · 7 lines
2.1.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/2] driver: workarroud resource request that conflist with errno PTR
Quoted 58 lines · Jean-Christophe PLAGNIOL-VILLARD
broken since
commit
ed6e965824303255cacc1c1a195d3684caa26bce
Author: Sascha Hauer <[email protected]>
resource: Letdev_request_mem_regionreturn an error pointerIntroduce
dev_request_mem_region_err_nullonly used on platform like at91 where the Ressource address collision with
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/mach-at91/at91sam926x_time.c | 6 +++--- drivers/base/driver.c | 31 +++++++++++++++++++++++++++++-- drivers/pinctrl/pinctrl-at91.c | 6 +++--- drivers/serial/atmel.c | 6 +++--- include/driver.h | 8 ++++++++ 5 files changed, 46 insertions(+), 11 deletions(-)arch/arm/mach-at91/at91sam926x_time.c +3
-3@@ -89,9 +89,9 @@ static int at91_pit_probe(struct device_d *dev)return ret; } - pit_base =dev_request_mem_region (dev,0 ); -if (IS_ERR (pit_base)) -return PTR_ERR (pit_base); + pit_base =dev_request_mem_region_err_null (dev,0 ); +if (!pit_base) +return -ENOENT ; pit_rate =clk_get_rate (clk) /16 ;drivers/base/driver.c +5
-2@@ -242,8 +242,8 @@ int register_driver(struct driver_d *drv) }EXPORT_SYMBOL (register_driver); -struct resource *dev_get_resource (struct device_d *dev,unsigned long type, -int num) +static struct resource *__dev_get_resource (struct device_d *dev, +unsigned long type,int num) {int i, n =0 ;@@ -256,6 +256,17 @@ struct resource *dev_get_resource(struct device_d *dev, unsigned long type, } } +return NULL ; +} +
drivers/base/driver.c struct resource *dev_get_resource(struct device_d *dev, unsigned long type, · line 271
Quoted 10 lines
drivers/base/driver.c +8
-0+struct resource *dev_get_resource (struct device_d *dev,unsigned long type, +int num) +{ +struct resource *res =__dev_get_resource (dev, type, num); + +if (res) +return res; +return ERR_PTR (-ENOENT ); }
No need to change dev_get_resource(), it returns a struct resource * which will never conflict with an err ptr.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/2] driver: workarroud resource request that conflist with errno PTR
Quoted 59 lines · Sascha Hauer
Quoted 55 lines · Jean-Christophe PLAGNIOL-VILLARD
broken since
commit
ed6e965824303255cacc1c1a195d3684caa26bce
Author: Sascha Hauer <[email protected]>
resource: Letdev_request_mem_regionreturn an error pointerIntroduce
dev_request_mem_region_err_nullonly used on platform like at91 where the Ressource address collision with
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>---
arch/arm/mach-at91/at91sam926x_time.c | 6 +++--- drivers/base/driver.c | 31 +++++++++++++++++++++++++++++-- drivers/pinctrl/pinctrl-at91.c | 6 +++--- drivers/serial/atmel.c | 6 +++--- include/driver.h | 8 ++++++++ 5 files changed, 46 insertions(+), 11 deletions(-)arch/arm/mach-at91/at91sam926x_time.c +3
-3@@ -89,9 +89,9 @@ static int at91_pit_probe(struct device_d *dev)return ret; } - pit_base =dev_request_mem_region (dev,0 ); -if (IS_ERR (pit_base)) -return PTR_ERR (pit_base); + pit_base =dev_request_mem_region_err_null (dev,0 ); +if (!pit_base) +return -ENOENT ; pit_rate =clk_get_rate (clk) /16 ;drivers/base/driver.c +2
-2@@ -242,8 +242,8 @@ int register_driver(struct driver_d *drv) }EXPORT_SYMBOL (register_driver); -struct resource *dev_get_resource (struct device_d *dev,unsigned long type, -int num) +static struct resource *__dev_get_resource (struct device_d *dev, +unsigned long type,int num) {int i, n =0 ;@@ -256,6 +256,17 @@ struct resource *dev_get_resource(struct device_d *dev, unsigned long type, } }
Quoted 16 lines
drivers/base/driver.c struct resource *dev_get_resource(struct device_d *dev, unsigned long type, · line 271
Quoted 13 lines
drivers/base/driver.c +11
-0+return NULL ; +} + +struct resource *dev_get_resource (struct device_d *dev,unsigned long type, +int num) +{ +struct resource *res =__dev_get_resource (dev, type, num); + +if (res) +return res; +return ERR_PTR (-ENOENT ); }No need to change
dev_get_resource(), it returns a struct resource * which will never conflict with an err ptr.
but as if no ressource is found it return ERR_PTR(-ENOENT)
so it does conflict
Best Regards,
J.
Quoted 8 lines
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/2] driver: workarroud resource request that conflist with errno PTR
Quoted 76 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 59 lines · Sascha Hauer
Quoted 55 lines · Jean-Christophe PLAGNIOL-VILLARD
broken since
commit
ed6e965824303255cacc1c1a195d3684caa26bce
Author: Sascha Hauer <[email protected]>
resource: Letdev_request_mem_regionreturn an error pointerIntroduce
dev_request_mem_region_err_nullonly used on platform like at91 where the Ressource address collision with
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>---
arch/arm/mach-at91/at91sam926x_time.c | 6 +++--- drivers/base/driver.c | 31 +++++++++++++++++++++++++++++-- drivers/pinctrl/pinctrl-at91.c | 6 +++--- drivers/serial/atmel.c | 6 +++--- include/driver.h | 8 ++++++++ 5 files changed, 46 insertions(+), 11 deletions(-)arch/arm/mach-at91/at91sam926x_time.c +3
-3@@ -89,9 +89,9 @@ static int at91_pit_probe(struct device_d *dev)return ret; } - pit_base =dev_request_mem_region (dev,0 ); -if (IS_ERR (pit_base)) -return PTR_ERR (pit_base); + pit_base =dev_request_mem_region_err_null (dev,0 ); +if (!pit_base) +return -ENOENT ; pit_rate =clk_get_rate (clk) /16 ;drivers/base/driver.c +2
-2@@ -242,8 +242,8 @@ int register_driver(struct driver_d *drv) }EXPORT_SYMBOL (register_driver); -struct resource *dev_get_resource (struct device_d *dev,unsigned long type, -int num) +static struct resource *__dev_get_resource (struct device_d *dev, +unsigned long type,int num) {int i, n =0 ;@@ -256,6 +256,17 @@ struct resource *dev_get_resource(struct device_d *dev, unsigned long type, } }Quoted 16 lines
drivers/base/driver.c struct resource *dev_get_resource(struct device_d *dev, unsigned long type, · line 271
Quoted 13 lines
drivers/base/driver.c +11
-0+return NULL ; +} + +struct resource *dev_get_resource (struct device_d *dev,unsigned long type, +int num) +{ +struct resource *res =__dev_get_resource (dev, type, num); + +if (res) +return res; +return ERR_PTR (-ENOENT ); }No need to change
dev_get_resource(), it returns a struct resource * which will never conflict with an err ptr.
Quoted 1 line
but as if no ressource is found it return
ERR_PTR(-ENOENT)
Yes, and this is always correct. Only your dev_request_mem_region_err_null() function must return NULL in this case and not ERR_CAST(res) like dev_request_mem_region() does.
void __iomem *dev_request_mem_region_err_null(struct device_d *dev, int num)
{
struct resource *res;
res = dev_get_resource(dev, IORESOURCE_MEM, num);
if (IS_ERR(res))
return NULL;
res = request_iomem_region(dev_name(dev), res->start, res->end);
if (IS_ERR(res))
return ERR_CAST(res);
return (void __force __iomem *)res->start;
}EXPORT_SYMBOL(dev_request_mem_region_err_null);
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/2] driver: workarroud resource request that conflist with errno PTR
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 74 lines · Jean-Christophe PLAGNIOL-VILLARD
broken since
commit
ed6e965824303255cacc1c1a195d3684caa26bce
Author: Sascha Hauer <[email protected]>
resource: Letdev_request_mem_regionreturn an error pointerIntroduce
dev_request_mem_region_err_nullonly used on platform like at91 where the Ressource address collision with
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/mach-at91/at91sam926x_time.c | 6 +++--- drivers/base/driver.c | 31 +++++++++++++++++++++++++++++-- drivers/pinctrl/pinctrl-at91.c | 6 +++--- drivers/serial/atmel.c | 6 +++--- include/driver.h | 8 ++++++++ 5 files changed, 46 insertions(+), 11 deletions(-)arch/arm/mach-at91/at91sam926x_time.c +3
-3@@ -89,9 +89,9 @@ static int at91_pit_probe(struct device_d *dev)return ret; } - pit_base =dev_request_mem_region (dev,0 ); -if (IS_ERR (pit_base)) -return PTR_ERR (pit_base); + pit_base =dev_request_mem_region_err_null (dev,0 ); +if (!pit_base) +return -ENOENT ; pit_rate =clk_get_rate (clk) /16 ;drivers/base/driver.c +14
-2@@ -242,8 +242,8 @@ int register_driver(struct driver_d *drv) }EXPORT_SYMBOL (register_driver); -struct resource *dev_get_resource (struct device_d *dev,unsigned long type, -int num) +static struct resource *__dev_get_resource (struct device_d *dev, +unsigned long type,int num) {int i, n =0 ;@@ -256,6 +256,17 @@ struct resource *dev_get_resource(struct device_d *dev, unsigned long type, } } +return NULL ; +} + +struct resource *dev_get_resource (struct device_d *dev,unsigned long type, +int num) +{ +struct resource *res =__dev_get_resource (dev, type, num); + +if (res) +return res; +return ERR_PTR (-ENOENT ); }@@ -318,6 +329,22 @@ void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *n }EXPORT_SYMBOL (dev_request_mem_region_by_name); +void __iomem *dev_request_mem_region_err_null (struct device_d *dev,int num)
drivers/base/driver.c void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *n · line 342
Quoted 10 lines
drivers/base/driver.c +10
-0+{ +struct resource *res; + + res =__dev_get_resource (dev,IORESOURCE_MEM , num); +if (!res) +return res; + + res =request_iomem_region (dev_name (dev), res->start, res->end); +if (IS_ERR (res)) +return ERR_CAST (res);
The function promises to return NULL on error, so this is wrong here. I just sent an updated patch so that the release doesn't get delayed any more.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/2] arm: at91: fix ecc_mode on non atmel boards
In reply to Jean-Christophe PLAGNIOL-VILLARDGood catch, I ACK this patch.
2015-01-06 12:37 GMT+01:00 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 130 lines
since
commit54bccadddd52cb4cbbecd1403b9091fe651bd0fd
Author: Raphaël Poggi <[email protected]>mtd:
atmel_nand: retrieveecc_modefrom pdatabreak most of the non atmel AT91 boards that did not provide a
ecc_modeparams in the nand pdataSigned-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>Cc Raphaël Poggi <[email protected]>--- arch/arm/boards/animeo_ip/init.c | 1 + arch/arm/boards/pm9261/init.c | 1 + arch/arm/boards/pm9263/init.c | 1 + arch/arm/boards/pm9g45/init.c | 1 + arch/arm/boards/qil-a926x/init.c | 1 + arch/arm/boards/telit-evk-pro3/init.c | 2 ++ arch/arm/boards/tny-a926x/init.c | 1 + arch/arm/boards/usb-a926x/init.c | 1 + 8 files changed, 9 insertions(+)arch/arm/boards/animeo_ip/init.c +1
-0@@ -93,6 +93,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .bus_width_16 = 0, .on_flash_bbt = 1, };arch/arm/boards/pm9261/init.c +1
-0@@ -50,6 +50,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PA16, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT,#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 ) .bus_width_16 = 1,#else arch/arm/boards/pm9263/init.c +1
-0@@ -50,6 +50,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PB30, .enable_pin = AT91_PIN_PD15, + .ecc_mode = NAND_ECC_SOFT,#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 ) .bus_width_16 = 1,#else arch/arm/boards/pm9g45/init.c +1
-0@@ -49,6 +49,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PD3, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .bus_width_16 = 0, .on_flash_bbt = 1, };arch/arm/boards/qil-a926x/init.c +1
-0@@ -43,6 +43,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .on_flash_bbt = 1, };arch/arm/boards/telit-evk-pro3/init.c +2
-0@@ -18,6 +18,7 @@#include <gpio.h> #include <init.h> #include <linux/clk.h> +#include <linux/mtd/nand.h> #include <mach/at91_rstc.h> #include <mach/at91sam9_smc.h> #include <mach/board.h> @@ -33,6 +34,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .on_flash_bbt = 1, };arch/arm/boards/tny-a926x/init.c +1
-0@@ -55,6 +55,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .on_flash_bbt = 1, };arch/arm/boards/usb-a926x/init.c +1
-1@@ -59,6 +59,7 @@ static struct atmel_nand_data nand_pdata = { .det_pin = -EINVAL, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, + .ecc_mode = NAND_ECC_SOFT, .on_flash_bbt = 1, }; --2.1.3
Quoted 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedRe: [PATCH 1/2] arm: at91: fix ecc_mode on non atmel boards
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
since
commit54bccadddd52cb4cbbecd1403b9091fe651bd0fd
Author: Raphaël Poggi <[email protected]>mtd:
atmel_nand: retrieveecc_modefrom pdatabreak most of the non atmel AT91 boards that did not provide a
ecc_modeparams in the nand pdataSigned-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>Cc Raphaël Poggi <[email protected]>
Applied, thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox