The of_register_spi_devices() was not called after registering the spi master.
PATCH 1/1 The of_register_spi_devices() was not called after registering the spi master.
The of_register_spi_devices() was not called after registering the spi master. It should be called for powerpc platforms which use the device tree to populate the SPI bus.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
A message that is not in the archive (sent off-list or not yet received): 1222417480-3144-1-git-send-email-sbabic-ynQEQJNshbs@public.gmane.org
PATCH 1/1 The of_register_spi_devices() was not called after registering the spi master.
From: Stefano Babic <[email protected]>
--- drivers/spi/mpc52xx_psc_spi.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
drivers/spi/mpc52xx_psc_spi.c +13 -3
@@ -18,6 +18,7 @@#if defined(CONFIG_PPC_MERGE )#include <linux/of_platform.h> +#include <linux/of_spi.h> #else #include <linux/platform_device.h> #endif
@@ -439,8 +440,10 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, } ret =spi_register_master (master); -if (ret <0 ) +if (ret <0 ) { +dev_err (dev,"spi_register_master FAILED\n" ); goto unreg_master; + }return ret;
@@ -524,6 +527,8 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,const u32 *regaddr_p;u64 regaddr64, size64;s16 id =-1 ; +struct spi_master *master; +int ret; regaddr_p =of_get_address (op->node,0 , &size64,NULL );if (!regaddr_p) {
@@ -545,8 +550,13 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op, id = *psc_nump +1 ; } -return mpc52xx_psc_spi_do_probe (&op->dev, (u32 )regaddr64, (u32 )size64, -irq_of_parse_and_map (op->node,0 ), id); +if ((ret =mpc52xx_psc_spi_do_probe (&op->dev, (u32 )regaddr64, (u32 )size64, +irq_of_parse_and_map (op->node,0 ), id))) +return ret; + master =spi_busnum_to_master (id); +of_register_spi_devices (master, op->node); + +return 0 ; } static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op)
Signature · 8 lines
1.5.4.3 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
A message that is not in the archive (sent off-list or not yet received): 1222417480-3144-2-git-send-email-sbabic-ynQEQJNshbs@public.gmane.org
Quoted 3 lines · On Fri, Sep 26, 2008 at 10:24:40AM +0200, [email protected]…
From: Stefano Babic <[email protected]>
Signed-off-by Stefano Babic <[email protected]>
One comment below.
Quoted 9 lines
--- drivers/spi/mpc52xx_psc_spi.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)drivers/spi/mpc52xx_psc_spi.c +0
-0
drivers/spi/mpc52xx_psc_spi.c static int __init mpc52xx_psc_spi_of_probe(struct of_device *op, · line 555
Quoted 8 lines
drivers/spi/mpc52xx_psc_spi.c +3
-2@@ -545,8 +550,13 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op, id = *psc_nump +1 ; } -return mpc52xx_psc_spi_do_probe (&op->dev, (u32 )regaddr64, (u32 )size64, -irq_of_parse_and_map (op->node,0 ), id); +if ((ret =mpc52xx_psc_spi_do_probe (&op->dev, (u32 )regaddr64, (u32 )size64, +irq_of_parse_and_map (op->node,0 ), id))) +return ret;
Preferred form is:
ret = mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, irq_of_parse_and_map(op->node, 0), id); if (ret) return ret;
Burying the assignment inside the if() makes the code harder to read and understand.
Otherwise, this looks right to me.
Thanks,
g.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
A message that is not in the archive (sent off-list or not yet received): 20080929141230.GA9448-s3s/[email protected]
Quoted 9 lines · Grant Likely
Preferred form is:
ret = mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, irq_of_parse_and_map(op->node, 0), id); if (ret) return ret;Burying the assignment inside the
if()makes the code harder to read and understand.
Thanks, understood. I will avoid in future to use this encryptic form ;)
I have another issue about this driver that I have found recently. According to the MPC5200 manual the "tdfOnExit" flag must be set on the last byte we want to send and the PSC controller holds SS low until the flag is set.
However, this flag is set always on the last byte written into the FIFO, independently if it is the last byte of the whole transfer:
for (; send_at_once; sb++, send_at_once--) {
/* set EOF flag before the last word is sent */
if (send_at_once == 1)
out_8(&psc->ircr2, 0x01);This generates spurious toggling of the SS signal that breaks the protocol of some peripherals when we have to send more than 512 bytes. (I have a peripheral that requires a start byte as first byte after SS goes low).
IMHO this is a bug, because changing of the SS signal must be ruled only by the cs_change field in the spi_transfer structure. However, it seems nobody complains about this and probably it is not seen as a bug...
Stefano
Signature · 12 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: [email protected] ===================================================================== ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 12 lines · Stefano Babic
I have another issue about this driver that I have found recently. According to the MPC5200 manual the "tdfOnExit" flag must be set on the last byte we want to send and the PSC controller holds SS low until the flag is set.
However, this flag is set always on the last byte written into the FIFO, independently if it is the last byte of the whole transfer:for (; send_at_once; sb++, send_at_once--) { /* set EOF flag before the last word is sent */ if (send_at_once == 1) out_8(&psc->ircr2, 0x01);
Quoted 7 lines
This generates spurious toggling of the SS signal that breaks the protocol of some peripherals when we have to send more than 512 bytes. (I have a peripheral that requires a start byte as first byte after SS goes low).
IMHO this is a bug, because changing of the SS signal must be ruled only by thecs_changefield in thespi_transferstructure. However, it seems nobody complains about this and probably it is not seen as a bug...
Yes, this is a bug. Some boards do the SS with a GPIO instead of using the SS pin and so probably see this problem. It should be fixed.
g.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/