lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 24 Oct 2011 09:41:24 +0200
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Felipe Balbi <balbi@...com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Linux USB Mailing List <linux-usb@...r.kernel.org>
Subject: Re: DeviceTree and children devices

On Mon, Oct 24, 2011 at 09:42:28AM +0300, Felipe Balbi wrote:
> Hi Grant,
> 
> I have a question about how DeviceTree should be written in case a
> device has a child device.
> 
> The way things are integrated on OMAP is that we will always have a
> parent device which is a wrapper around an IP core in order to
> integrate with the OMAP context (clocks, power management, etc).
> 
> That wrapper has its own address space and its own IRQ number
> (generally). On my dwc3 driver I have modeled the OMAP wrapper as a
> parent device which allocates a child device for the core IP driver.
> This makes it a lot easier to re-use the core IP driver on other SoCs or
> PCI (there's a glue layer for PCI too).
> 
> So I wonder if we should describe that on DeviceTree and not have the
> OMAP glue layer allocate the core IP driver. Just to illustrate, here's
> what we have:
> 
> static int dwc3_omap_probe(struct platform_device *pdev)
> {
> 	struct platform_device	*dwc3;
> 	struct resource		res[2];
> 
> 	dwc3 = platform_device_alloc("dwc3", -1);
> 	/* check*/
> 
> 	dwc3->dev.parent = &pdev->dev;
> 
> 	/* copy DMA fields from parent too */
> 
> 	res[0].start = start_address;
> 	res[0].end = end_address;
> 	res[0].flags = IORESOURCE_MEM;
> 
> 	res[1].start = irq_number;
> 	res[1].flags = IORESOURCE_IRQ;
> 
> 	ret = platform_add_resources(dwc3, res, ARRAY_SIZE(res));
> 	/* check */
> 
> 	return platform_add_device(dwc3);
> }
> 
> and I wonder if I should have a DeviceTree like so:
> 
> usb@...xx {
> 	compatible = "ti,dwc3-omap";		// This is TI OMAP
> 						// wrapper
> 	range = <....>;
> 
> 	...
> 
> 	usb@...y {
> 		compatible = "synopsys,dwc3",	// This is core IP
> 						// inside wrapper
> 
> 		...
> 	};
> };
> 
> then I can drop the dwc3 platform_device allocation and all of that
> resource copying, etc.
> 
> What do you think ?

Looks reasonable to me.  of_platform_populate() should be able to
handle the device generation for you here.

g.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ