spi: spi-mpc512x-psc: don't use obsolet cell-index property
PATCH 1/1 spi: spi-mpc512x-psc: don't use obsolet cell-index property
Use unique PSCx register base offset to obtain the SPI PSC number used for SPI bus id.
--- drivers/spi/spi-mpc512x-psc.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
drivers/spi/spi-mpc512x-psc.c +11 -6
@@ -523,16 +523,21 @@ static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op)/* get PSC id (0..11, used by port_config) */ if (op->dev.platform_data ==NULL ) { -const u32 *psc_nump; +u32 reg; +int err; - psc_nump =of_get_property (op->dev.of_node,"cell-index" ,NULL ); -if (!psc_nump || *psc_nump >11 ) { -dev_err (&op->dev,"mpc512x_psc_spi: Device node %s " -"has invalid cell-index property\n" , + err =of_property_read_u32 (op->dev.of_node,"reg" , ®); +if (err) { +dev_err (&op->dev,"Can't read reg property: %d\n" , err); +return err; + } + + id = (reg &0xf00 ) >>8 ; +if (id >11 ) { +dev_err (&op->dev,"node %s has invalid reg property\n" , op->dev.of_node->full_name);return -EINVAL ; } - id = *psc_nump; } return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,
Signature · 9 lines
1.7.7.6 ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d
A message that is not in the archive (sent off-list or not yet received): 1356100981-18685-1-git-send-email-agust-ynQEQJNshbs@public.gmane.org
Quoted 4 lines · Anatolij Gustschin
Use unique PSCx register base offset to obtain the SPI PSC number used for SPI bus id.
Signed-off-by Anatolij Gustschin <[email protected]>
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.
g.
Quoted 37 lines
--- drivers/spi/spi-mpc512x-psc.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)drivers/spi/spi-mpc512x-psc.c +11
-7@@ -523,16 +523,21 @@ static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op)/* get PSC id (0..11, used by port_config) */ if (op->dev.platform_data ==NULL ) { -const u32 *psc_nump; +u32 reg; +int err; - psc_nump =of_get_property (op->dev.of_node,"cell-index" ,NULL ); -if (!psc_nump || *psc_nump >11 ) { -dev_err (&op->dev,"mpc512x_psc_spi: Device node %s " -"has invalid cell-index property\n" , + err =of_property_read_u32 (op->dev.of_node,"reg" , ®); +if (err) { +dev_err (&op->dev,"Can't read reg property: %d\n" , err); +return err; + } + + id = (reg &0xf00 ) >>8 ; +if (id >11 ) { +dev_err (&op->dev,"node %s has invalid reg property\n" , op->dev.of_node->full_name);return -EINVAL ; } - id = *psc_nump; } return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64, --
Quoted 2 lines
1.7.7.6
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
Quoted 9 lines · Grant Likely
Quoted 4 lines · Anatolij Gustschin
Use unique PSCx register base offset to obtain the SPI PSC number used for SPI bus id.
Signed-off-by Anatolij Gustschin <[email protected]>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.
g.
---
drivers/spi/spi.c +3 -0
@@ -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
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
Hi Grant,
Quoted 11 lines · On Fri, 21 Dec 2012 19:29:14 +0000 Grant Likely…
Quoted 9 lines · Grant Likely
Quoted 4 lines · Anatolij Gustschin
Use unique PSCx register base offset to obtain the SPI PSC number used for SPI bus id.
Signed-off-by Anatolij Gustschin <[email protected]>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.
Quoted 5 lines
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
PATCH v2 1/1 spi: spi-mpc512x-psc: don't use obsolet cell-index property
In reply to Grant LikelyRemove deprecated cell-index property and use spi alias to obtain the SPI PSC number used for SPI bus id.
---
v2:
- use of_alias_get_id() to get spi bus number
drivers/spi/spi-mpc512x-psc.c | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-)
drivers/spi/spi-mpc512x-psc.c +5 -11
@@ -522,17 +522,11 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op) regaddr64 =of_translate_address (op->dev.of_node, regaddr_p);/* get PSC id (0..11, used by port_config) */ -if (op->dev.platform_data ==NULL ) { -const u32 *psc_nump; - - psc_nump =of_get_property (op->dev.of_node,"cell-index" ,NULL ); -if (!psc_nump || *psc_nump >11 ) { -dev_err (&op->dev,"mpc512x_psc_spi: Device node %s " -"has invalid cell-index property\n" , - op->dev.of_node->full_name); -return -EINVAL ; - } - id = *psc_nump; + id =of_alias_get_id (op->dev.of_node,"spi" ); +if (id <0 ) { +dev_err (&op->dev,"no alias id for %s\n" , + op->dev.of_node->full_name); +return id; } return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,
Signature · 9 lines
1.7.5.4 ------------------------------------------------------------------------------ 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
PATCH v2 1/1 spi: spi-mpc512x-psc: don't use obsolet cell-index property
In reply to Grant LikelyRemove deprecated cell-index property and use spi alias to obtain the SPI PSC number used for SPI bus id.
---
v2:
- use of_alias_get_id() to get spi bus number
drivers/spi/spi-mpc512x-psc.c | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-)
drivers/spi/spi-mpc512x-psc.c +5 -11
@@ -522,17 +522,11 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op) regaddr64 =of_translate_address (op->dev.of_node, regaddr_p);/* get PSC id (0..11, used by port_config) */ -if (op->dev.platform_data ==NULL ) { -const u32 *psc_nump; - - psc_nump =of_get_property (op->dev.of_node,"cell-index" ,NULL ); -if (!psc_nump || *psc_nump >11 ) { -dev_err (&op->dev,"mpc512x_psc_spi: Device node %s " -"has invalid cell-index property\n" , - op->dev.of_node->full_name); -return -EINVAL ; - } - id = *psc_nump; + id =of_alias_get_id (op->dev.of_node,"spi" ); +if (id <0 ) { +dev_err (&op->dev,"no alias id for %s\n" , + op->dev.of_node->full_name); +return id; } return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,
Signature · 9 lines
1.7.5.4 ------------------------------------------------------------------------------ Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812
A message that is not in the archive (sent off-list or not yet received): 1357862748-14130-1-git-send-email-agust-ynQEQJNshbs@public.gmane.org
Grant Likely
AppliedQuoted 8 lines · Anatolij Gustschin
Remove deprecated cell-index property and use spi alias to obtain the SPI PSC number used for SPI bus id.
Signed-off-by Anatolij Gustschin <[email protected]>---
v2:
- useof_alias_get_id()to get spi bus number
Applied, thanks.
g.
Quoted 33 lines
drivers/spi/spi-mpc512x-psc.c | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-)drivers/spi/spi-mpc512x-psc.c +5
-11@@ -522,17 +522,11 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op) regaddr64 =of_translate_address (op->dev.of_node, regaddr_p);/* get PSC id (0..11, used by port_config) */ -if (op->dev.platform_data ==NULL ) { -const u32 *psc_nump; - - psc_nump =of_get_property (op->dev.of_node,"cell-index" ,NULL ); -if (!psc_nump || *psc_nump >11 ) { -dev_err (&op->dev,"mpc512x_psc_spi: Device node %s " -"has invalid cell-index property\n" , - op->dev.of_node->full_name); -return -EINVAL ; - } - id = *psc_nump; + id =of_alias_get_id (op->dev.of_node,"spi" ); +if (id <0 ) { +dev_err (&op->dev,"no alias id for %s\n" , + op->dev.of_node->full_name); +return id; } return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,Signature · 1 line
1.7.5.4
Signature · 8 lines
Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb