Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
80e45c3b
Commit
80e45c3b
authored
May 26, 2006
by
Tony Lindgren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sync SPI stuff with mainline tree manually
parent
3ec21be9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
33 deletions
+78
-33
drivers/spi/Kconfig
drivers/spi/Kconfig
+32
-7
drivers/spi/Makefile
drivers/spi/Makefile
+4
-0
drivers/spi/spi_bitbang.c
drivers/spi/spi_bitbang.c
+22
-9
include/linux/spi/spi.h
include/linux/spi/spi.h
+20
-17
No files found.
drivers/spi/Kconfig
View file @
80e45c3b
...
...
@@ -75,15 +75,34 @@ config SPI_BUTTERFLY
inexpensive battery powered microcontroller evaluation board.
This same cable can be used to flash new firmware.
config SPI_
BUTTERFLY
tristate "
Parallel port adapter for AVR Butterfly (DEVELOPMENT)
"
depends on SPI_MASTER && P
ARPORT
&& EXPERIMENTAL
config SPI_
MPC83xx
tristate "
Freescale MPC83xx SPI controller
"
depends on SPI_MASTER && P
PC_83xx
&& EXPERIMENTAL
select SPI_BITBANG
help
This uses a custom parallel port cable to connect to an AVR
Butterfly <http://www.atmel.com/products/avr/butterfly>, an
inexpensive battery powered microcontroller evaluation board.
This same cable can be used to flash new firmware.
This enables using the Freescale MPC83xx SPI controller in master
mode.
Note, this driver uniquely supports the SPI controller on the MPC83xx
family of PowerPC processors. The MPC83xx uses a simple set of shift
registers for data (opposed to the CPM based descriptor model).
config SPI_PXA2XX
tristate "PXA2xx SSP SPI master"
depends on SPI_MASTER && ARCH_PXA && EXPERIMENTAL
help
This enables using a PXA2xx SSP port as a SPI master controller.
The driver can be configured to use any SSP port and additional
documentation can be found a Documentation/spi/pxa2xx.
config SPI_S3C24XX_GPIO
tristate "Samsung S3C24XX series SPI by GPIO"
depends on SPI_MASTER && ARCH_S3C2410 && SPI_BITBANG && EXPERIMENTAL
help
SPI driver for Samsung S3C24XX series ARM SoCs using
GPIO lines to provide the SPI bus. This can be used where
the inbuilt hardware cannot provide the transfer mode, or
where the board is using non hardware connected pins.
config SPI_OMAP_UWIRE
tristate "OMAP MicroWire"
...
...
@@ -103,6 +122,12 @@ config SPI_OMAP24XX
#
config SPI_S3C24XX
tristate "Samsung S3C24XX series SPI"
depends on SPI_MASTER && ARCH_S3C2410 && EXPERIMENTAL
help
SPI driver for Samsung S3C24XX series ARM SoCs
#
# There are lots of SPI device types, with sensors and memory
# being probably the most widely used ones.
...
...
drivers/spi/Makefile
View file @
80e45c3b
...
...
@@ -13,6 +13,10 @@ obj-$(CONFIG_SPI_MASTER) += spi.o
# SPI master controller drivers (bus)
obj-$(CONFIG_SPI_BITBANG)
+=
spi_bitbang.o
obj-$(CONFIG_SPI_BUTTERFLY)
+=
spi_butterfly.o
obj-$(CONFIG_SPI_PXA2XX)
+=
pxa2xx_spi.o
obj-$(CONFIG_SPI_MPC83xx)
+=
spi_mpc83xx.o
obj-$(CONFIG_SPI_S3C24XX_GPIO)
+=
spi_s3c24xx_gpio.o
obj-$(CONFIG_SPI_S3C24XX)
+=
spi_s3c24xx.o
obj-$(CONFIG_SPI_OMAP24XX)
+=
omap2_mcspi.o
obj-$(CONFIG_SPI_OMAP_UWIRE)
+=
omap_uwire.o
# ... add above this line ...
...
...
drivers/spi/spi_bitbang.c
View file @
80e45c3b
...
...
@@ -167,9 +167,11 @@ int spi_bitbang_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
/* nsecs = (clock period)/2 */
if
(
!
hz
)
hz
=
spi
->
max_speed_hz
;
if
(
hz
)
{
cs
->
nsecs
=
(
1000000000
/
2
)
/
hz
;
if
(
cs
->
nsecs
>
MAX_UDELAY_MS
*
1000
)
if
(
cs
->
nsecs
>
(
MAX_UDELAY_MS
*
1000
*
1000
)
)
return
-
EINVAL
;
}
return
0
;
}
...
...
@@ -184,7 +186,14 @@ int spi_bitbang_setup(struct spi_device *spi)
struct
spi_bitbang
*
bitbang
;
int
retval
;
if
(
!
spi
->
max_speed_hz
)
bitbang
=
spi_master_get_devdata
(
spi
->
master
);
/* REVISIT: some systems will want to support devices using lsb-first
* bit encodings on the wire. In pure software that would be trivial,
* just bitbang_txrx_le_cphaX() routines shifting the other way, and
* some hardware controllers also have this support.
*/
if
((
spi
->
mode
&
SPI_LSB_FIRST
)
!=
0
)
return
-
EINVAL
;
if
(
!
cs
)
{
...
...
@@ -193,7 +202,6 @@ int spi_bitbang_setup(struct spi_device *spi)
return
-
ENOMEM
;
spi
->
controller_state
=
cs
;
}
bitbang
=
spi_master_get_devdata
(
spi
->
master
);
if
(
!
spi
->
bits_per_word
)
spi
->
bits_per_word
=
8
;
...
...
@@ -207,7 +215,7 @@ int spi_bitbang_setup(struct spi_device *spi)
if
(
retval
<
0
)
return
retval
;
dev_dbg
(
&
spi
->
dev
,
"%s, mode %d, %u bits/w, %u nsec
\n
"
,
dev_dbg
(
&
spi
->
dev
,
"%s, mode %d, %u bits/w, %u nsec
/bit
\n
"
,
__FUNCTION__
,
spi
->
mode
&
(
SPI_CPOL
|
SPI_CPHA
),
spi
->
bits_per_word
,
2
*
cs
->
nsecs
);
...
...
@@ -396,6 +404,7 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m)
{
struct
spi_bitbang
*
bitbang
;
unsigned
long
flags
;
int
status
=
0
;
m
->
actual_length
=
0
;
m
->
status
=
-
EINPROGRESS
;
...
...
@@ -405,11 +414,15 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m)
return
-
ESHUTDOWN
;
spin_lock_irqsave
(
&
bitbang
->
lock
,
flags
);
if
(
!
spi
->
max_speed_hz
)
status
=
-
ENETDOWN
;
else
{
list_add_tail
(
&
m
->
queue
,
&
bitbang
->
queue
);
queue_work
(
bitbang
->
workqueue
,
&
bitbang
->
work
);
}
spin_unlock_irqrestore
(
&
bitbang
->
lock
,
flags
);
return
0
;
return
status
;
}
EXPORT_SYMBOL_GPL
(
spi_bitbang_transfer
);
...
...
include/linux/spi/spi.h
View file @
80e45c3b
...
...
@@ -35,10 +35,13 @@ extern struct bus_type spi_bus_type;
* @chip-select: Chipselect, distinguishing chips handled by "master".
* @mode: The spi mode defines how data is clocked out and in.
* This may be changed by the device's driver.
* The "active low" default for chipselect mode can be overridden,
* as can the "MSB first" default for each word in a transfer.
* @bits_per_word: Data transfers involve one or more words; word sizes
* like eight or 12 bits are common. In-memory wordsizes are
* powers of two bytes (e.g. 20 bit samples use 32 bits).
* This may be changed by the device's driver.
* This may be changed by the device's driver, or left at the
* default (0) indicating protocol words are eight bit bytes.
* The spi_transfer.bits_per_word can override this for each transfer.
* @irq: Negative, or the number passed to request_irq() to receive
* interrupts from this device.
...
...
@@ -67,6 +70,7 @@ struct spi_device {
#define SPI_MODE_2 (SPI_CPOL|0)
#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
#define SPI_CS_HIGH 0x04
/* chipselect active high? */
#define SPI_LSB_FIRST 0x08
/* per-word bits-on-wire */
u8
bits_per_word
;
int
irq
;
void
*
controller_state
;
...
...
@@ -75,7 +79,6 @@ struct spi_device {
// likely need more hooks for more protocol options affecting how
// the controller talks to each chip, like:
// - bit order (default is wordwise msb-first)
// - memory packing (12 bit samples into low bits, others zeroed)
// - priority
// - drop chipselect after each word
...
...
@@ -169,13 +172,13 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
struct
spi_master
{
struct
class_device
cdev
;
/* other than
zero
(== assign one dynamically), bus_num is fully
/* other than
negative
(== assign one dynamically), bus_num is fully
* board-specific. usually that simplifies to being SOC-specific.
* example: one SOC has three SPI controllers, numbered
1..3
,
* example: one SOC has three SPI controllers, numbered
0..2
,
* and one board's schematics might show it using SPI-2. software
* would normally use bus_num=2 for that controller.
*/
u
16
bus_num
;
s
16
bus_num
;
/* chipselects will be integral to many controllers; some others
* might use board-specific GPIOs.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment