From: Arnd Bergmann <arnd@arndb•de>
To: linuxppc-dev@ozlabs•org
Cc: linuxppc-embedded@ozlabs•org
Subject: Re: Generic MMC-over-SPI binding?
Date: Tue, 8 Jan 2008 18:27:13 +0100 [thread overview]
Message-ID: <200801081827.13940.arnd@arndb.de> (raw)
In-Reply-To: <47838708.5050008@hogyros.de>
On Tuesday 08 January 2008, Simon Richter wrote:
> in an embedded system similar to the lite5200 board, there is an MMC
> card socket connected to one of the PSCs. Ideally, I'd like to express
> this fact via the device tree and have the kernel bind the mmc-spi
> driver to the SPI interface, but I cannot find any place where to insert
> this code that I feel comfortable with.
> ...
> Any ideas?
>
One way you could do it would be to have an spi_board_info in the
way that mpc832x_spi_init does it, but that would not make use of the
device tree.
What would probably be a better way is to call spi_new_device()
from the mpc52xx_psc_spi driver, with an spi_board_info you generate
on the fly for each child of the spi controller.
The important part where this connects to the mmc-spi driver is that
you need to set spi_board_info->modalias to "mmc-spi", if the
device node can be identified as an mmc card.
We'd have to define a list of valid identifications of SPI devices
in the device tree, and teach the SPI drivers how they relate to
linux device drivers like mmc-spi.
Since that part of the code would be used by all device tree based
SPI master drivers, it should be in a separate module, which can
consist of a single exported function, like (paraphrased):
void spi_of_scan_master(struct spi_master *master)
{
struct device_node *child;
of_dev_for_each_child(master->dev->node, child) {
struct spi_board_info *info;
info = kzalloc(sizeof (*info), GFP_KERNEL);
if (of_device_is_compatible(child, "spi,mmc"))
strcpy(info->modalias, "mmc-spi");
else if (of_device_is_compatible(child, "spi,foo"))
strcpy(info->modalias, "foo");
else
strcpy(info->modalias, "");
info->irq = irq_of_parse_and_map(child);
spi_new_device(master, child);
}
}
Then you call that function after registering the master, from
mpc52xx_psc_spi_of_probe.
Arnd <><
next prev parent reply other threads:[~2008-01-08 17:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-08 14:22 Generic MMC-over-SPI binding? Simon Richter
2008-01-08 16:11 ` Robert Schwebel
2008-01-08 16:29 ` Simon Richter
2008-01-08 17:27 ` Arnd Bergmann [this message]
2008-01-09 17:17 ` Simon Richter
2008-01-09 21:55 ` Arnd Bergmann
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=200801081827.13940.arnd@arndb.de \
--to=arnd@arndb$(echo .)de \
--cc=linuxppc-dev@ozlabs$(echo .)org \
--cc=linuxppc-embedded@ozlabs$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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