Skip to contentSkip to conversation

Linux SPI slave support

DISCUSSION Marek Vasut 2 participants 8 messages Jun 30, 2012 – Jul 17, 2012 5 messages not in the archive SPI

lore
Share & tools
lore
#0 lore raw

Hello,

is there currently any ongoing effort to support SPI slave mode in Linux?

If there is none, could you please share any hints that might help me better choose and go in the direction of implementing the SPI slave support?

I had this quick idea of simply extending the flags field of struct spi_master {} by something like SPI_MASTER_CAN_BE_SWITCHED_TO_SLAVE_MODE (shortened of course). Then there'd have to be a function present that can switch the mode, also in struct spi_master it seems. And then, any driver willing to use the slave support will simply call this switch function. Something amongst those lines maybe? Basically, the idea would be to have SPI slave mode drivers and master mode drivers using the same API, just make the bus configured differently.

Please advise. Thanks in advance!

Best regards,
Marek Vasut

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hello,

Quoted 6 lines · Marek Vasut

Hello,

is there currently any ongoing effort to support SPI slave mode in Linux?

If there is none, could you please share any hints that might help me better choose and go in the direction of implementing the SPI slave support?

May be you may want to check the archives.
You may want to see below before designing.

http://permalink.gmane.org/gmane.linux.kernel.spi.devel/7495

Quoted 15 lines

I had this quick idea of simply extending the flags field of struct spi_master {} by something like SPI_MASTER_CAN_BE_SWITCHED_TO_SLAVE_MODE (shortened of course). Then there'd have to be a function present that can switch the mode, also in struct spi_master it seems. And then, any driver willing to use the slave support will simply call this switch function. Something amongst those lines maybe? Basically, the idea would be to have SPI slave mode drivers and master mode drivers using the same API, just make the bus configured differently.

Please advise. Thanks in advance!

Best regards,
Marek Vasut

Quoted 10 lines

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
spi-devel-general mailing list spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

A message that is not in the archive (sent off-list or not yet received): CAM=Q2cs8zGTMu+Du1E8aLkiLpyB6mVH=Omt7pJRe1iFBb+Zqaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Dear Shubhrajyoti Datta,

Quoted 7 lines

Hello,

Quoted 4 lines · Marek Vasut

Hello,

is there currently any ongoing effort to support SPI slave mode in Linux?

Quoted 8 lines
Quoted 3 lines

If there is none, could you please share any hints that might help me better choose and go in the direction of implementing the SPI slave support?

May be you may want to check the archives.
You may want to see below before designing.

http://permalink.gmane.org/gmane.linux.kernel.spi.devel/7495

Oh, didn't find this one. Thanks a lot!

[...]

Best regards,
Marek Vasut

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

#5 lore raw
In reply to a message not in the archive

Dear Shubhrajyoti Datta,

Quoted 7 lines

Hello,

Quoted 4 lines · Marek Vasut

Hello,

is there currently any ongoing effort to support SPI slave mode in Linux?

Quoted 8 lines
Quoted 3 lines

If there is none, could you please share any hints that might help me better choose and go in the direction of implementing the SPI slave support?

May be you may want to check the archives.
You may want to see below before designing.

http://permalink.gmane.org/gmane.linux.kernel.spi.devel/7495

I also noticed this stuff below, the intel moorestown SPI slave work. Did it get anywhere?

http://www.mail-archive.com/spi-devel-
[email protected]/msg03514.html

Best regards,
Marek Vasut

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

#6 lore raw
In reply to a message not in the archive

Dear Shubhrajyoti Datta,

Quoted 7 lines

Hello,

Quoted 4 lines · Marek Vasut

Hello,

is there currently any ongoing effort to support SPI slave mode in Linux?

Quoted 8 lines
Quoted 3 lines

If there is none, could you please share any hints that might help me better choose and go in the direction of implementing the SPI slave support?

May be you may want to check the archives.
You may want to see below before designing.

http://permalink.gmane.org/gmane.linux.kernel.spi.devel/7495

[...]

So, idea V2:

1) Separate out common parts from struct spi_master
2) Create struct spi_slave
2a) Implement spi_slave_send_message for spi_slave
2b) Implement <?> netlink interface to push and pull messages to/from userland ?

The protocol won't be done in kernel, but completely in userland.

Is this good approach to take? Or maybe 2b can be replaced by blocking read on character device? I think netlink interface might actually be suited quite well for this task.

Best regards,
Marek Vasut

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 26 lines · Marek Vasut

Dear Shubhrajyoti Datta,

Quoted 7 lines

Hello,

Quoted 4 lines · Marek Vasut

Hello,

is there currently any ongoing effort to support SPI slave mode in Linux?

Quoted 8 lines
Quoted 3 lines

If there is none, could you please share any hints that might help me better choose and go in the direction of implementing the SPI slave support?

May be you may want to check the archives.
You may want to see below before designing.

http://permalink.gmane.org/gmane.linux.kernel.spi.devel/7495

[...]

So, idea V2:

1) Separate out common parts from struct spi_master
2) Create struct spi_slave
2a) Implement spi_slave_send_message for spi_slave
2b) Implement <?> netlink interface to push and pull messages to/from userland ?

Quoted 5 lines

The protocol won't be done in kernel, but completely in userland.

Is this good approach to take? Or maybe 2b can be replaced by blocking read on character device? I think netlink interface might actually be suited quite well for this task.

The other option is to have something like a gpio for synchronization.

Quoted 3 lines

Best regards,
Marek Vasut

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

A message that is not in the archive (sent off-list or not yet received): CAM=Q2ctBCOtSkC-vK4+drsuAmEkk4e=Tk3ZQtZYfqqOejhS_xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#10 lore raw

Dear Shubhrajyoti Datta,

Quoted 30 lines · Marek Vasut
Quoted 29 lines

Dear Shubhrajyoti Datta,

Quoted 8 lines

Hello,

Quoted 5 lines · Marek Vasut

Hello,

is there currently any ongoing effort to support SPI slave mode in Linux?

Quoted 8 lines
Quoted 3 lines

If there is none, could you please share any hints that might help me better choose and go in the direction of implementing the SPI slave support?

May be you may want to check the archives.
You may want to see below before designing.

http://permalink.gmane.org/gmane.linux.kernel.spi.devel/7495

[...]

So, idea V2:

1) Separate out common parts from struct spi_master
2) Create struct spi_slave
2a) Implement spi_slave_send_message for spi_slave
2b) Implement <?> netlink interface to push and pull messages to/from userland ?

Quoted 7 lines
Quoted 5 lines

The protocol won't be done in kernel, but completely in userland.

Is this good approach to take? Or maybe 2b can be replaced by blocking read on character device? I think netlink interface might actually be suited quite well for this task.

The other option is to have something like a gpio for synchronization.

Synchronisation of what exactly? With my hardware (that doesn't exist yet I guess), the idea is to simply cross-connect the MISO/MOSI pins and connect the CLK signal. Is that possible btw?

Thanks!

Quoted 2 lines
Quoted 2 lines

Best regards,
Marek Vasut

Best regards,
Marek Vasut

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw
Quoted 4 lines · Marek Vasut

Dear Shubhrajyoti Datta,

Quoted 2 lines · Marek Vasut
Quoted 1 line

Dear Shubhrajyoti Datta,

[..]

Quoted 5 lines
Quoted 1 line

The other option is to have something like a gpio for synchronization.

Synchronisation of what exactly? With my hardware (that doesn't exist yet I guess), the idea is to simply cross-connect the MISO/MOSI pins and connect the CLK signal. Is that possible btw?

IIUC , the clock is to be driven by master. The slave gets the clock. Master knows when to start and stop the transaction.

However for the slave the options are to
1) Keep listening always.
2) Use something to syncronize( I may have used the word loosely) master and slave.
So that it doesnt have to listen always.

Btw it is just a suggestion. I am not opposed to any other implementation.

Thanks and Regards,

Quoted 3 lines

Thanks!

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/