From: "Kári Davíðsson" <kari.davidsson@marel.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>
Subject: Re: Chipselect in SPI binding with mpc5200-psc-spi
Date: Tue, 16 Jun 2009 10:41:02 +0000 [thread overview]
Message-ID: <4A3776BE.6010601@marel.com> (raw)
In-Reply-To: <fa686aa40906151031p74636557oc1ab173236d0a81b@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]
Now my driver gets probed.
This "modalias" error was due to wrong "compatible" attribute of
my of node.
But I still need to have the call to of_register_spi_devices().
The attached patch shows what I mean.
rg
kd
Grant Likely wrote:
> On Mon, Jun 15, 2009 at 10:36 AM, Kári
> Davíðsson<kari.davidsson@marel.com> wrote:
>> Is this true?
>>
>> Grant Likely wrote:
>>> Yes, this is right. The psc_spi driver automatically registers all
>>> spi children that it finds in the device tree onto the SPI bus.
>>> Therefore registering an spi_driver() is the right thing to do.
>> I am writing an SPI protocol driver and I find that my driver
>> is never probed.
>>
>> I tried to add and call to of_register_spi_devices() in the
>> drivers/spi/mpc52xx_psc_spi.c::mpc52xx_psc_spi_of_probe() function,
>> without much effect besided that the DTS node is parsed but the driver probe
>> is not called, actually it complains about a modalias for my node is
>> missing.
>
> What do you see when you look in /sys/bus/spi/devices? You should see
> a directory for your device. What do you see in /sys/bus/spi/drivers?
> In here you should see your driver. If they are both there, then you
> just have a problem matching your driver name to the device name.
>
> g.
>
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1677 bytes --]
Index: drivers/spi/mpc52xx_psc_spi.c
===================================================================
--- drivers/spi/mpc52xx_psc_spi.c (revision 548)
+++ drivers/spi/mpc52xx_psc_spi.c (working copy)
@@ -22,6 +22,7 @@
#include <linux/delay.h>
#include <linux/spi/spi.h>
#include <linux/fsl_devices.h>
+#include <linux/of_spi.h>
#include <asm/mpc52xx.h>
#include <asm/mpc52xx_psc.h>
@@ -371,7 +372,7 @@
/* bus_num is used only for the case dev->platform_data == NULL */
static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
- u32 size, unsigned int irq, s16 bus_num)
+ u32 size, unsigned int irq, s16 bus_num, struct spi_master ** pmaster)
{
struct fsl_spi_platform_data *pdata = dev->platform_data;
struct mpc52xx_psc_spi *mps;
@@ -439,6 +440,10 @@
if (ret < 0)
goto unreg_master;
+ dev_info(dev, "Activated\n");
+
+ *pmaster = master;
+
return ret;
unreg_master:
@@ -474,6 +479,8 @@
const u32 *regaddr_p;
u64 regaddr64, size64;
s16 id = -1;
+ int res;
+ struct spi_master * master = NULL;;
regaddr_p = of_get_address(op->node, 0, &size64, NULL);
if (!regaddr_p) {
@@ -495,8 +502,16 @@
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);
+ res = mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
+ irq_of_parse_and_map(op->node, 0), id, &master);
+
+ if( master != NULL )
+ {
+ /* Add any subnodes on the SPI bus */
+ of_register_spi_devices( master, op->node);
+ }
+
+ return res;
}
static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op)
next prev parent reply other threads:[~2009-06-16 10:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-29 13:43 Chipselect in SPI binding with mpc5200-psc-spi Henk Stegeman
2008-10-29 14:45 ` Grant Likely
2009-02-13 10:40 ` Henk Stegeman
2009-02-13 15:19 ` Grant Likely
2009-02-13 15:52 ` Henk Stegeman
2009-06-15 16:36 ` Kári Davíðsson
2009-06-15 17:31 ` Grant Likely
2009-06-16 10:41 ` Kári Davíðsson [this message]
2009-07-07 14:31 ` Henk Stegeman
2009-07-07 15:57 ` Grant Likely
2009-07-08 13:07 ` Henk Stegeman
2009-03-27 21:14 Yann Pelletier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A3776BE.6010601@marel.com \
--to=kari.davidsson@marel.com \
--cc=grant.likely@secretlab.ca \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).