mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Simon Aittamaa <simon.aittamaa@gmail.com>
To: barebox@lists.infradead.org
Subject: Re: [REGRESSION BUG] at91 is broken on barebox
Date: Mon, 5 Jan 2015 12:51:01 +0100	[thread overview]
Message-ID: <CALHxSV5M_9Z=NPFWEpExyrGMX7yHxhFP6LQWnJHx-e19TJJnag@mail.gmail.com> (raw)
In-Reply-To: <20150105102339.GG30369@pengutronix.de>

Since I also ran into this issue just before the holidays, I thought
I'd provide my 0.02$.

On 5 January 2015 at 11:23, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Fri, Dec 26, 2014 at 10:51:43AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
>> 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
>
> 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_name
> dev_request_mem_region_by_name
> dev_request_mem_region
>
>
>
Correct, these function returns the 'start' field of the struct
resource, which contains the offending address.

>>
>>       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);
>
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 :-(

> Which drivers are affected anyway?
>
I've had to remove the IS_ERR() check in:
arch/arm/mach-at91/at91sam926x_time.c
drivers/pinctrl/at91-pinctrl.c
drivers/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

> 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 |
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-01-05 11:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-26  9:51 Jean-Christophe PLAGNIOL-VILLARD
2015-01-05 10:23 ` Sascha Hauer
2015-01-05 11:51   ` Simon Aittamaa [this message]
2015-01-06 11:32 ` [PATCH 0/2] FIX AT91 support Jean-Christophe PLAGNIOL-VILLARD
2015-01-06 11:37   ` [PATCH 1/2] arm: at91: fix ecc_mode on non atmel boards Jean-Christophe PLAGNIOL-VILLARD
2015-01-06 11:37     ` [PATCH 2/2] driver: workarroud resource request that conflist with errno PTR Jean-Christophe PLAGNIOL-VILLARD
2015-01-06 12:44       ` Sascha Hauer
2015-01-07  3:14         ` Jean-Christophe PLAGNIOL-VILLARD
2015-01-07  7:34           ` Sascha Hauer
2015-01-08  7:11       ` Sascha Hauer
2015-01-06 12:36     ` [PATCH 1/2] arm: at91: fix ecc_mode on non atmel boards Raphaël Poggi
2015-01-06 12:59     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALHxSV5M_9Z=NPFWEpExyrGMX7yHxhFP6LQWnJHx-e19TJJnag@mail.gmail.com' \
    --to=simon.aittamaa@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox