* current-speed property in serial devices causes kernel panic
@ 2007-06-30 4:26 Timur Tabi
2007-07-02 16:46 ` Kumar Gala
2007-07-02 20:01 ` Timur Tabi
0 siblings, 2 replies; 3+ messages in thread
From: Timur Tabi @ 2007-06-30 4:26 UTC (permalink / raw)
To: linuxppc-dev list
I see this code in function of_platform_serial_setup():
static int __devinit of_platform_serial_setup(struct of_device *ofdev,
int type, struct uart_port *port)
{
struct resource resource;
struct device_node *np = ofdev->node;
const unsigned int *clk, *spd;
int ret;
memset(port, 0, sizeof *port);
spd = of_get_property(np, "current-speed", NULL);
...
port->custom_divisor = *clk / (16 * (*spd));
return 0;
}
There is no check in this code to make sure spd is not null. And sure enough, in most DTS files, current-speed does not exist. So whenever this function is called on a node like this, the kernel panics.
I'm adding support for a new 86xx platform, and I'm also creating a driver for a new SOC device. In my platform driver, I have this code:
static struct of_device_id mpc86xx_ids[] = {
{ .type = "soc", },
{}
};
static int __init mpc86xx_declare_of_platform_devices(void)
{
printk(KERN_ALERT "%s\n", __FUNCTION__);
if (!machine_is(mpc86xx_hpcn))
return 0;
of_platform_bus_probe(NULL, mpc86xx_ids, NULL);
return 0;
}
device_initcall(mpc86xx_declare_of_platform_devices);
The kernel panic occurs only if I call of_platform_bus_probe().
If you look at the code for the 836x platform, you'll see that it also has serial SOC devices and it also calls of_platform_bus_probe(), but it doesn't experience kernel panics.
Is the call to of_platform_bus_probe() effectively trying to probe the serial devices twice? I just don't understand why this code isn't working.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: current-speed property in serial devices causes kernel panic
2007-06-30 4:26 current-speed property in serial devices causes kernel panic Timur Tabi
@ 2007-07-02 16:46 ` Kumar Gala
2007-07-02 20:01 ` Timur Tabi
1 sibling, 0 replies; 3+ messages in thread
From: Kumar Gala @ 2007-07-02 16:46 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev list, Arnd Bergmann
On Jun 29, 2007, at 11:26 PM, Timur Tabi wrote:
> I see this code in function of_platform_serial_setup():
>
> static int __devinit of_platform_serial_setup(struct of_device *ofdev,
> int type, struct uart_port
> *port)
> {
> struct resource resource;
> struct device_node *np = ofdev->node;
> const unsigned int *clk, *spd;
> int ret;
>
> memset(port, 0, sizeof *port);
> spd = of_get_property(np, "current-speed", NULL);
> ...
> port->custom_divisor = *clk / (16 * (*spd));
>
> return 0;
> }
>
> There is no check in this code to make sure spd is not null. And
> sure enough, in most DTS files, current-speed does not exist. So
> whenever this function is called on a node like this, the kernel
> panics.
I'm wondering why we set port->custom_divisor instead of setting port-
>speed. (plus the null check).
- k
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: current-speed property in serial devices causes kernel panic
2007-06-30 4:26 current-speed property in serial devices causes kernel panic Timur Tabi
2007-07-02 16:46 ` Kumar Gala
@ 2007-07-02 20:01 ` Timur Tabi
1 sibling, 0 replies; 3+ messages in thread
From: Timur Tabi @ 2007-07-02 20:01 UTC (permalink / raw)
To: linuxppc-dev list
Timur Tabi wrote:
> The kernel panic occurs only if I call of_platform_bus_probe().
FYI, thanks to Kumar, I found the problem: I had CONFIG_SERIAL_OF_PLATFORM enabled. This
causes of_serial.c to be compiled and loaded. On my platform, that wasn't doing anything
because initially I wasn't calling of_platform_bus_probe(). When I added that call to my
platform code, of_serial.c sprang to life and tried to probe the serial nodes in my device
tree. Apparently, of_serial.c is not compatible with fsl_soc.c.
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-02 20:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-30 4:26 current-speed property in serial devices causes kernel panic Timur Tabi
2007-07-02 16:46 ` Kumar Gala
2007-07-02 20:01 ` Timur Tabi
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).