Commit Graph

28 Commits

Author SHA1 Message Date
Pedro F. Giffuni
bd9ba70127 SPDX: fix wrong license ID tag in dev/spibus. 2017-12-28 03:04:36 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Oleksandr Tymoshenko
50868fa68b [spigen] make spigen device ready to be compiled as a module
- Add flag to indicate that device is opened by userland
- Replace "always fail" detach method with proper detach implementation

MFC after:	1 week
2017-03-09 01:00:27 +00:00
Michael Zhilin
f73628e7b1 [spibus] small code refactoring
Merge 3 sequential printf calls into one.

Reported by:	rpokala
Reviewed by:	rpokala, adrian
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D8795
2017-01-16 15:23:55 +00:00
Oleksandr Tymoshenko
32d7412741 [spigen] Fix spigen attaching as a driver for SPI devices nodes in FDT
Return BUS_PROBE_NOWILDCARD in probe method to make sure that spigen
attaches only to the device created in identify method.

Before this change spigen probe method used to return 0 which meant it
competed with other drivers to be attached to the devices created for
child nodes of SPI bus node in FDT.

Reported by:	Daniel Braniss
MFC after:	1 week
2016-12-24 00:30:29 +00:00
Emmanuel Vadot
7073d12c4d ofw_spi: Parse property for the SPI mode and CS polarity.
As cs is stored in a uint32_t, use the last bit to store the
active high flag as it's unlikely that we will have that much CS.

Reviewed by:	loos
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8614
2016-12-18 14:54:20 +00:00
Oleksandr Tymoshenko
3c43a826c6 [spigen] Make "data" part of spigen_transfer optional
Make st_data part of spigen_transfer optional by letting pass zero length
and NULL pointer. SPI controller drivers handle this case fine.

MFC after:	1 week
2016-12-16 19:09:57 +00:00
Michael Zhilin
167a228d79 [spi] reformat message and ar5315_spi minor fix
This commit corrects print of nomatch (newline was too early) and fix
unit number for new child in ar5315_spi (was 0, now is -1 to calculate it
according to actual system state)

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	ray, loos, mizhka
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8749
2016-12-13 09:53:43 +00:00
Emmanuel Vadot
dac458e0d6 Enable the use of spigen on FDT platform
MFC after:	2 weeks
2016-11-20 18:20:28 +00:00
Adrian Chadd
d67fe28ba6 [spigen] add initial spigen driver from green@
This is a simple ioctl and mmap API to issue SPI transactions from
userland.  It's useful for simple devices (eg spi temperature sensors,
etc) for experimentation.

TODO:

* Write some documentation!

Submitted by:	green
2016-05-26 07:02:20 +00:00
Adrian Chadd
055486964b [spibus] implement maximum clock frequency lookup from ofw.
Obtained from:	loos
2016-05-26 06:37:33 +00:00
Adrian Chadd
63b92359c1 [spibus] add missing break.
Pointy hat to: me
2016-05-26 06:36:58 +00:00
Adrian Chadd
f3e8760ff5 [spibus] add initial placeholders for transfer mode and frequency.
This doesn't yet implement it in the controllers or the transfer
calls, but it's a start.

Obtained from:	loos (frequency), ray/zrouter (transfer mode)
2016-05-26 06:35:11 +00:00
Ruslan Bukin
9ef5c83c17 Fix the parameter type according to method declaration.
This fixes compilation on riscv with GCC 5.2.0
2016-04-26 16:02:13 +00:00
Ruslan Bukin
a0814c1586 Revert r298268 (Add optional chip_select/deselect methods).
None of supported hardware do require that.
2016-04-19 15:39:46 +00:00
Ruslan Bukin
af8c306065 Add optional chip_select/deselect methods. This is required
when we want to keep CS asserted for multiple transfers.
2016-04-19 14:18:12 +00:00
Warner Losh
46b39c90f4 Add copyright statement I should have had on these files in 2006,
based on the spibus_if.m file.
2015-02-18 14:33:33 +00:00
Luiz Otavio O Souza
585300e937 Add an OFW SPI compatible bus. Fix the spibus probe to return
BUS_PROBE_GENERIC and not BUS_PROBE_SPECIFIC (0) so the OFW SPI bus can
attach when enabled.  Export the spibus devclass_t and driver_t
declarations.

Submitted by:	ray
Approved by:	adrian (mentor)
2013-10-24 16:56:38 +00:00
Warner Losh
6e31adaf33 Fetch the chip select in the bridge driver, like all the other spi
bridges do.
2012-08-23 22:38:37 +00:00
Warner Losh
cc90639873 Add the chip select glue. 2012-08-01 01:18:36 +00:00
Ed Schouten
75da3c1a9b Replace inline static' by static inline'.
If I interpret the C standard correctly, the storage specifier should be
placed before the inline keyword. While at it, replace __inline by
inline in the files affected.
2011-12-13 14:06:01 +00:00
Marius Strobl
4b7ec27007 - There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
  (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
  since r52045) but even recently added device drivers do this unnecessarily.
  Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
  Discussed with: jhb
- Also while at it, use __FBSDID.
2011-11-22 21:28:20 +00:00
Andriy Gapon
3d844eddb7 bus_add_child: change type of order parameter to u_int
This reflects actual type used to store and compare child device orders.
Change is mostly done via a Coccinelle (soon to be devel/coccinelle)
semantic patch.
Verified by LINT+modules kernel builds.

Followup to:	r212213
MFC after:	10 days
2010-09-10 11:19:03 +00:00
Andriy Gapon
7c6ee94f8c strict kobj signatures: fix assortment of bus_read_ivar impls
Reviewed by:	imp, current@
Approved by:	jhb (mentor)
2009-06-11 17:06:58 +00:00
Oleksandr Tymoshenko
ecd6163338 - Make SPI bus bridge be non-arch dependent by using more generic
name

Reviewed by:	imp
2009-05-13 18:42:49 +00:00
Warner Losh
86663fabdd MFp4: when passing the transfer up the foodchain, make sure we go up
the food chain.  devi == NULL is the error condition.  Treat it as such.
2006-10-20 07:11:52 +00:00
Olivier Houchard
4e9e16ed7e Fix comments. 2006-07-17 21:18:03 +00:00
Warner Losh
9a795dfa02 MFp4:
Initial spibus support.  Seems to be OK, but needs some polish.

	# someone should write a bit-bang spi parallel port interface :-)
2006-07-14 22:47:07 +00:00