Message ID | 20121221192914.77D523E03CE@localhost (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Hi Grant, On Fri, 21 Dec 2012 19:29:14 +0000 Grant Likely <grant.likely@secretlab.ca> wrote: > On Fri, 21 Dec 2012 14:48:38 +0000, Grant Likely <grant.likely@secretlab.ca> wrote: > > On Fri, Dec 21, 2012 at 2:43 PM, Anatolij Gustschin <agust@denx.de> wrote: > > > Use unique PSCx register base offset to obtain the > > > SPI PSC number used for SPI bus id. > > > > > > Signed-off-by: Anatolij Gustschin <agust@denx.de> > > > > Don't do this. If you really want to assign a specific bus number, > > then use a property in /aliases. cell-index has been deprecated a very > > long time ago now. > > Ummm.. I really should read patches before I reply to them. I see you're > removing cell-index, not adding it back in. It is fine. > > Aliases would be a more generic solution though. Would this following > change work for you? Try it out and let me know. Sorry for delay. I've tried it now, it doesn't work. The mpc5121 psc spi driver also needs to get/enable psc clock of the used psc controller. It uses psc bus number to generate psc clock name string and to get and enable this clock, so I need to set the bus number in the driver. I'll use of_alias_get_id() in the the psc spi driver. Thanks, Anatolij ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 84c2861..de9f6ee 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -983,6 +983,9 @@ int spi_register_master(struct spi_master *master) if (master->num_chipselect == 0) return -EINVAL; + if ((master->bus_num < 0) && master->dev.of_node) + master->bus_num = of_alias_get_id(master->dev.of_node, "spi"); + /* convention: dynamically assigned bus IDs count down from the max */ if (master->bus_num < 0) { /* FIXME switch to an IDR based scheme, something like