From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] Raspberry Pi with driver model
Date: Tue, 25 Nov 2014 09:44:12 -0700 [thread overview]
Message-ID: <5474B1DC.8010106@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ3KHEr7Ah1H=02W2GjBaeqP++wy5SmxsnHT=rHa3rL5wg@mail.gmail.com>
On 11/24/2014 09:32 PM, Simon Glass wrote:
> Hi Stephen,
>
> On 24 November 2014 at 21:21, Stephen Warren <swarren@nvidia.com> wrote:
>> On 11/24/2014 08:58 AM, Simon Glass wrote:
>>> Hi Stephen,
>>>
>>> There was another thread where you reported a hang when booting
>>> Raspberry Pi with driver model. It can be repeated by applying this
>>> patch and trying to boot with syslinux.
>>>
>>> http://patchwork.ozlabs.org/patch/392180/
>>>
>>> When it hangs, the HDMI display displays lots of spaces, then lots of
>>> dots, scrolling forever. The serial console displays nothing further.
>>>
>>> I narrowed the problem down to writing to address 0. So it is easy to
>>> repeat with something like 'mw 0 0'.
>>>
>>> However I'm really not sure what is going on. Something with driver
>>> model seems to make address 0 sensitive to writes. I can't see what
>>> that might be, but I don't understand the platform very well. Do you
>>> have any ideas?
>>
>> The problem seems to be that inside pl01x_serial_probe() (well, I assume
>> all serial functions), dev_get_priv() returns 0, which ends up using
>> address 0 as the UART address since that's the first field in struct
>> pl01x_priv.
>>
>> I found this by amending pl01x_serial_probe() as follows, and dumping
>> the data after boot:
>>
>> uint32_t *log = (uint32_t *)(128*1024*1024);
>> uint32_t log_i = 1;
>>
>> static int pl01x_serial_probe(struct udevice *dev)
>> {
>> struct pl01x_serial_platdata *plat = dev_get_platdata(dev);
>> struct pl01x_priv *priv = dev_get_priv(dev);
>>
>> log[log_i++] = (uint32_t)dev;
>> log[log_i++] = (uint32_t)plat;
>> log[log_i++] = (uint32_t)priv;
>> log[0] = log_i;
>> priv->regs = (struct pl01x_regs *)plat->base;
>> priv->type = plat->type;
>> return pl01x_generic_serial_init(priv->regs, priv->type);
>> }
>>
>> U-Boot> md.l 0x08000000
>> 08000000: 00000007 07fffaf8 0003972c 00000000 ........,.......
>> 08000010: 1db4e108 1df8372c 00000000 00000000 ....,7..........
>>
>> It seems a bit odd that pl01x_serial_probe() is called twice, but
>> perhaps that's expected?
>
> Thanks for finding that! It just needs this in the U_BOOT_DRIVER()
> declaration in the serial driver:
>
> .priv_auto_alloc_size = sizeof(struct pl01x_priv),
>
> Then it all works. I'll update the series and resend. Thanks again.
Does it make sense to add an error check for one or more of the
following to the driver core:
a) Drivers/devices with .priv_auto_alloc_size == 0.
b) Devices with NULL priv fields, when the core is about to call the
driver-specific probe() function.
next prev parent reply other threads:[~2014-11-25 16:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 15:58 [U-Boot] Raspberry Pi with driver model Simon Glass
2014-11-25 4:21 ` Stephen Warren
2014-11-25 4:32 ` Simon Glass
2014-11-25 16:44 ` Stephen Warren [this message]
2014-11-25 17:36 ` Simon Glass
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=5474B1DC.8010106@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/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