Commit Graph

75 Commits

Author SHA1 Message Date
mlelstv b1ce595009 Protect ioctl and declare MPSAFE. 2021-05-16 08:48:20 +00:00
jmcneill af67ce95ae Replace aprint_error with aprint_error_dev in config_interrupts callback. 2021-05-14 09:25:14 +00:00
thorpej 2685996b0e Merge thorpej-cfargs branch:
Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
  actually needed.
- Don't be explicit about what interface attribute is attaching if
  the device only has one.  (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
  situations, making is visibly easier to see when indirect config is
  in play, and allowing for future change in semantics.  (As of now,
  this is just a wrapper around config_match(), but that is an
  implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance.  This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
2021-04-24 23:36:23 +00:00
thorpej 18f3098ca5 Use DEVICE_COMPAT_EOL. 2021-01-27 02:29:48 +00:00
thorpej 1f5ee02347 Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup().  This pattern is less awkward to use.
2021-01-18 15:28:21 +00:00
thorpej 7246a94523 Use designated initializers and a consistent termination style in
compat_data[].
2021-01-17 21:42:35 +00:00
kardel 3761416972 Use mutex for lwp/interrupt coordination. using splX() simply does not work
on multiprocessor systems.

fixes PR kern/55506
2020-08-04 13:20:45 +00:00
thorpej 814a779807 Update for proplib(3) API changes. 2020-06-11 02:32:06 +00:00
hkenken af6f2f7b13 Remove GPIO driver attach defer. 2019-11-27 07:26:08 +00:00
hkenken 59f7698778 Change manufacturer to Micron from Numonyx.
N25Q -> MT25Q
2019-11-26 02:41:58 +00:00
tnn 57e890b14b add fdt device_compatible_entry 2019-11-02 22:55:57 +00:00
tnn c022c48edf fix hang when SSDFB_ATTACH_FLAG_CONSOLE used with spi 2019-11-02 17:13:20 +00:00
tnn 281830f270 add spi(4) bus frontend for ssdfb(4) 2019-11-02 14:33:27 +00:00
tnn a0d9af4553 On second thought revert that. Let's open this can of worms some other day. 2019-09-14 15:12:12 +00:00
tnn 35a7abb119 KB -> kB 2019-09-14 14:41:23 +00:00
bouyer d5eb278c85 Add support for Winbond W25Q128.V (128mb) chips, as found on newer lime2-emmc
boards.
While there fix a missing \n in dmesg.
2019-09-05 16:17:48 +00:00
martin 3ee8645531 Make this at least compile - I have no way to test. 2019-08-21 08:03:22 +00:00
hkenken 1cd721f3f9 Fix typo. 2019-08-19 10:56:33 +00:00
tnn 1583622be1 m25p: add compatible entry for "jedec,spi-nor" and match on it 2019-08-13 17:11:32 +00:00
tnn f5ccd4002e spi: prepare for fdt direct attachment of spi slaves
Introduce sba_child_devices array in spibus_attach_args. If the parent has
populated sba_child_devices then attach them first. Then do any devices
devices the user has wired in the kernel config, if any.
2019-08-13 16:37:15 +00:00
tnn b656910d5f spi: make the "slave" config(5) locator optional
needed to be able to support FDT direct attachment of SPI slaves
2019-08-05 23:42:48 +00:00
tnn 8bb11c75f4 m25p: change devices recently added from 4kB "sector size" to 64kB ...
... even though it is wrong and these devices really use 4kB sector size.
Despite the struct member being named sector size it is actually used as
block size. Our spiflash driver doesn't issue sector erase commands.
Stopgap measure to fix data corruption until the driver is fixed.
2019-08-04 22:13:24 +00:00
tnn e9ef85cfea m25p: add GigaDevice 25Q127CSIG
(This is the boot ROM found on ROCKPro64.)
2019-08-04 20:49:54 +00:00
tnn 55423e6fd6 m25p: add some ~2010 vintage parts found in junk drawer 2019-08-03 02:22:06 +00:00
tnn c0d3233ca1 m25p: print vendor & device id before bailing out on unknown devices 2019-08-03 00:46:02 +00:00
hkenken f5808f43a4 Avoid workqueue_check_duplication(). 2019-07-04 11:13:26 +00:00
mlelstv 26a59cedc6 More input validation. Fix off-by-1 for size limit. 2019-03-09 07:53:12 +00:00
mlelstv 975ce0ba8d Add userland driver to spi framework.
Previously spi would configure the controller to use the lowest speed of
all connected devices since the kernel started and to fail attempted mode
changes. This is now improved to keep individual modes and speeds for each
slave and to reconfigure the controller as necessary for each transfer.

Added man page for spi(9).
2019-02-23 10:43:25 +00:00
riastradh d1579b2d70 Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)
2018-09-03 16:29:22 +00:00
jakllsch bcc691bb0b Add four Winbond devices. 2018-01-31 16:00:03 +00:00
jakllsch 31c83f40e5 We always need bp->b_resid initialized before we try to toss the transfer. 2018-01-12 19:38:52 +00:00
hkenken 5a40d81280 Add support Microchip SST25VF016B.
- Fixed imxspi send and receive bugs.
2017-08-07 09:24:43 +00:00
phx ac36483cc7 Fixed typo in name for MCP3304. 2016-11-20 12:38:04 +00:00
jakllsch 91a739399d Reset b_resid when tossing transfer with non-zero b_error. 2016-08-19 03:23:39 +00:00
hkenken b802f479cb use workqueue(9) 2015-12-14 10:31:38 +00:00
phx d643dd143b MI driver for the Microchip 3x0x series of SAR analog to digital converters. 2015-08-18 15:54:20 +00:00
ryo 4469b0d73d need to forward the data pointer 2015-07-22 10:07:59 +00:00
mlelstv 6f00c789e1 Use C99-style initializers for struct dkdriver. 2015-04-26 15:15:19 +00:00
mlelstv 217621d7a9 use disk_init() wrapper function instead of poking data structures. 2014-10-11 13:56:01 +00:00
dholland f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland 8c70ef39af Add d_discard to all struct bdevsw instances I could find.
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
2014-07-25 08:02:18 +00:00
dholland da7427b662 "peripheral", not "peripherial". 2014-07-13 17:12:23 +00:00
kardel a845bf81d9 add Microchip MCP23S17 GPIO driver
(via SPI interface)
2014-04-06 17:59:39 +00:00
hkenken 459f2ce05f Add optical joystick support for NetWalker.
+ OJ6SH-T25 (Sharp "Optical TOUCH CRUISER" sensor)
+ 2 Mouse buttons (GPIO)
2014-03-29 12:00:27 +00:00
hkenken 3dbfb37284 Fix printf formating in DPRINTF. 2014-03-28 11:52:51 +00:00
skrll dd7bb1e0a8 G/C sys/simplelock.h includes 2014-02-28 10:16:51 +00:00
rkujawa 21a43d7204 Add preliminary driver for Microchip MCP48x1 family of DACs.
Needs more testing and an appropriate API for such (non-audio) DACs. For now
one can set the output value using sysctl node. Also sysmon(4) will conveniently
report the voltage on Vout pin of the DAC. Note that this is not an actual
measured voltage, but merely calculated using equation from datasheet. Real
voltage might be different and depend on analog circuitry attached to the DAC.
2014-02-25 20:09:37 +00:00
martin 666d626222 Remove an unused variable 2014-01-28 19:26:32 +00:00
rkujawa 61e65effad Add support for M25P16, tested on Raspberry PI with Digilent PmodSF. 2013-10-26 15:18:21 +00:00
rkujawa ca819ab5ac Add support for STMicro M25PX64 and Numonyx N25Q128.
Obtained from Marvell, Semihalf.
2013-04-21 08:38:16 +00:00