public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: freddy2_es@yahoo.com (Alfredo Quesada Sánchez)
To: linux-arm-kernel@lists.infradead.org
Subject: Using SPI in a kernel module
Date: Sun, 27 Jun 2010 11:25:34 -0700 (PDT)	[thread overview]
Message-ID: <419523.332.qm@web33805.mail.mud.yahoo.com> (raw)

After reading many things about SPI in linux (including the kernel Documentation, that is, spi_summary.txt) and having read many source files in the kernel itself I'm not sure which is the right way to deal with SPI from a kernel module if you don't want to use the spidev (neither the spi-gpio) implementation.

My goal is to create an spidev-like module, which generates a /dev entry (that is the easy part) and hides the details of the device, such as an EEPROM. The way to communicate with userspace using /dev files is simple, but the access to spi.h features isn't that much.

According to some board specific code there is one spi device registered in the system (it's wired to a serial dataflash in my development board), but I don't know how I can get a reference to the spi_device that should give me access to it.

By looking to other existing drivers I should register my own spi_driver, mostly providing probe and remove functions. And the questions are:
- When should I receive a probe call?
- What if I have more than 1 spi device on my system (let's say.. 3)? Will I receive 3 calls to probe?
- Is this the only way to get valid references to spi_device's? Is there any other way to access to the "list" of available spi_device's?

I did a small test with a fake module, which registers a spi_driver, but I did not receive any probe call, that's why this might not be the right way to access to the spi_device.
Besides in other low level code I can see calls to 

Regards



      

             reply	other threads:[~2010-06-27 18:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-27 18:25 Alfredo Quesada Sánchez [this message]
2010-06-27 20:09 ` Using SPI in a kernel module Mykhail Lodygin
2010-06-27 20:55   ` Alfredo Quesada Sánchez
2010-06-27 21:26     ` Mykhail Lodygin
2010-06-27 21:47       ` Alfredo Quesada Sánchez
2010-06-27 22:30         ` Mykhail Lodygin

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=419523.332.qm@web33805.mail.mud.yahoo.com \
    --to=freddy2_es@yahoo.com \
    --cc=linux-arm-kernel@lists.infradead.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