Commit graph

889 commits

Author SHA1 Message Date
David van Moolenbroek 6e6bb544c6 printer: use libchardriver
Change-Id: Ifa3cabeada74c32df2613b8279c00f86e831c775
2014-03-01 09:04:50 +01:00
David van Moolenbroek 597151d963 libchardriver: full API rewrite
The new API now covers the entire character driver protocol, while
hiding all the message details. It should therefore be used by all
new character drivers. All existing drivers that already made use of
libchardriver have been changed to use the new API.

As one of the most important API changes, support for scatter and
gather transfers has been removed, as several key drivers already
did not support this, and it could be supported at the safecopy
level instead (for a future readv/writev).

Additional changes include:

- respond to block device open requests to avoid hanging VFS threads;
- add support for sef_cancel.

Change-Id: I1bab6c1cb66916c71b87aeb1db54a9bdf171fe6b
2014-03-01 09:04:50 +01:00
David van Moolenbroek 6700874deb Block drivers: make IOCTL request unsigned long
The block driver protocol and libblockdriver's bdr_ioctl hook are
changed, as well as the users of this hook. Other parts of the system
are expected to change accordingly eventually, since the ioctl(2)
prototype has been aligned with NetBSD's.

Change-Id: Ide46245b22cfa89ed267a38088fb0ab7696eba92
2014-02-19 11:22:15 +01:00
David van Moolenbroek 95624ae072 Block protocol: add user endpoint to IOCTL request
I/O control requests now come with the endpoint of the user process
that initiated the ioctl(2) call. It is stored in a new BDEV_USER
field, which is an alias for BDEV_FLAGS. The contents of this field
are to be used only in highly specific situations. It should be
preserved (not replaced!) by services that forward IOCTL requests,
and may be set to NONE for service-initiated IOCTL requests.

Change-Id: I68a01b9ce43eca00e61b985a9cf87f55ba683de4
2014-02-19 11:22:15 +01:00
David van Moolenbroek 113635b019 Block protocol: use own [RW]_BIT definitions
The original R_BIT and W_BIT definitions have nothing to do with the
way these bits are used. Their distinct usage is more apparent when
they have different names.

Change-Id: Ia984457f900078b2e3502ceed565fead4e5bb965
2014-02-19 11:22:15 +01:00
David van Moolenbroek 0f7f3c0d54 libblockdriver: various updates
- internal structure rearrangement;
- respond to char device open requests to avoid hanging VFS threads;
- make drivers use designated initializers;
- use devminor_t for all minor device numbers;
- change bdr_other hook to take ipc_status and return nothing;
- fix default geometry computation;
- add support for sef_cancel.

Change-Id: Ia063a136a3ddb2b78de36180feda870605753d70
2014-02-19 11:22:15 +01:00
David van Moolenbroek 26cb85535e Block drivers: reply ENOTTY to unknown IOCTLs
Change-Id: Ie2e82d2491d546f4dd73b009100646e249a147b5
2014-02-19 11:22:15 +01:00
David van Moolenbroek a1f00d5527 Move SUB_PER_DRIVE definition into minix/drvlib.h
Change-Id: Id25761085ce1868955da34d8e530e170448ea154
2014-02-19 11:21:56 +01:00
David van Moolenbroek 660d34cd85 I2C: change BUSC_I2C_xxx to use own protocol
Previously it would use bits of the character driver protocol, which
will change heavily.  In the new situation, the BUSC_I2C_xxx requests
use a protocol more in line with the PCI protocol, with the reply code
in m_type.

Change-Id: I51597b3f191078c8178ce17372de123031f7a4c4
2014-02-18 11:25:03 +01:00
David van Moolenbroek 20173cb5d7 TTY: fix for PTY open/close logic
Opening and closing the master side of a pseudo terminal without
opening the slave side would result in the pseudo terminal becoming
permanently unavailable.  In addition, reopening the slave side
would be possible but not allow for I/O.  Finally, attempting to
open an in-use master would wipe its I/O state.  These issues have
been resolved.

Change-Id: I9235e3d9aba321803f9280b86b6b5e3646ad5ef3
2014-02-18 11:25:03 +01:00
David van Moolenbroek 6331e8f845 Retire the synchronous character driver protocol
- change all sync char drivers into async drivers;
- retire support for the sync protocol in libchardev;
- remove async dev style, as this is now the default;
- remove dev_status from VFS;
- clean up now-unused protocol messages.

Change-Id: I6aacff712292f6b29f2ccd51bc1e7d7003723e87
2014-02-18 11:25:02 +01:00
David van Moolenbroek 97172a1db0 Sync char protocol: add nonblocking transfer flag
The async char protocol already has this, so this patch closes the
gap between the two protocols a bit. Support for this flag has been
added to all sync char drivers that support CANCEL at all.

The LOG driver was already using the asynchronous protocol, but it
did not support the nonblocking transfer flag. This has been fixed
as well.

Change-Id: Ia55432c9f102765b59ad3feb45a8bd47a782c93f
2014-02-18 11:25:02 +01:00
Lionel Sambuc 7d1cb1caef ABI Break: aligning struct termios
Change-Id: I0109188fffbb166a5036e324a4a75b2491c39fb3
2014-02-18 11:25:01 +01:00
Lionel Sambuc 58f5d8dd5e moving prototypes to lib.h
Change-Id: If53d3f5ee761b10e0f3d4346a0c5b39ba7901c65
2014-02-18 11:25:01 +01:00
Lionel Sambuc 84a7c3f464 fix sysroot clang
Change-Id: I63adf8460e7fdbe3d9d5ad6c828ae5758cb1643c
2014-02-18 11:25:01 +01:00
Kees Jongenburger 9dec6c12f1 arm:replace ifdef's by runtime checks in the omap rtc driver.
Change-Id: I038f0fcf88061ae60d6d029d86c84153bf0f0020
2014-02-12 13:47:47 +01:00
Kees Jongenburger 5ec8c93e95 arm:replace ifdef's by runtime checks in the lan8710a driver.
Change-Id: I1f345240b88362658e987a85f1642324471119c3
2014-02-12 13:47:46 +01:00
Kees Jongenburger 6f4a88c1d2 arm:fix GPIO revision check on DM37XX.
The GPIO revision check assumed the major and minor revision numbers where
located at same location in the register. This is not true.

Change-Id: Ieaff07ed8a19e6b4cf1d121a41d3290880b78a82
2014-01-20 09:33:16 +01:00
Kees Jongenburger 3b447ae154 arm:replace ifdef's by runtime checks in the i2c driver.
Change-Id: I5cdff48d8be9bbe5a4734192b451dc45983fbef2
2013-12-17 11:32:38 +01:00
Kees Jongenburger 43581a14ee arm:replace ifdef's by runtime checks.
Change-Id: Iff966f2214e2d8bb6b72dd0a119085709f2d4a9c
2013-12-03 09:19:25 +01:00
Gerard f1b0deacf3 Replaced add64, add64u and add64ul with operators.
Change-Id: Ia537f83e15cb686f1b81b34d73596f4298b0a924
2013-11-13 13:11:33 +00:00
Kees Jongenburger 7d85156ac0 arm:mmc driver refactor (use structs)
Defined register offsets and device configurations in structs to
allow more flexibility. This change will allow to support multiple
instances of a driver using a different bus. This is needed for the
BeagleBone Black.

Change-Id: I24e16faeea338c9a847941a846e6d4e49432525e
2013-11-01 16:46:39 +01:00
David van Moolenbroek 36041198ad ahci: fix integer sign extension bug
Reported by Coverity.

Change-Id: Ie7eef9570c89c69a05ba45169a0ea838f0d8e320
2013-10-22 13:58:59 +00:00
Kees Jongenburger 02f6308a2b arm:mmc driver speedup.
Speedup the mmc driver one more time before doing a proper fix.

Change-Id: I9dbe9b1e16e71fed00c8ac3ca7fdc6c4374284c0
2013-09-26 12:11:29 +02:00
Thomas Cort cb5e2921b3 i2c: increase read/write timeout
The sht21 temperature and humidity sensor holds the i2c bus while
an ADC conversion is in progress. For example, a temperature
measurement is requested, a read operation is started, and the
sht21 doesn't respond to the read request until the result of
the measurement is ready. The conversion time isn't constant.
On rare occations (one in hundreds of samples) the timeout in the
i2c driver expires returning an error.

The example code from Sensirion, the sht21's manufacturer, suggests
a bus timeout of 1 second to accommodate the sht21. This commit
increases the bus timeout to 1 second. The timeout is only reached
when chips do not respond normally, so the change doesn't affect the
performance of any other drivers.

Change-Id: I57b0f958a5d0b69b221af380b771fe67401ff604
2013-09-18 08:10:26 -04:00
Thomas Cort 75bd3009d3 libi2cdriver: add functions for IC register access
Many i2c device drivers used similar code to access registers on
the ICs they drive. This commit implements that functionality in
libi2cdriver and updates the drivers to use the library instead of
their own register access functions. The net result is 375+ fewer
lines of code and less work for people developing new drivers.

The two exceptions were cat24c256 and parts of tda19988. They access
the bus in uncommon ways. It doesn't make sense at this time to
move their read/write functions into libi2cdriver.

Change-Id: Id8280b71af33b710a49944d7f20a7262be9f5988
2013-09-18 08:10:26 -04:00
Thomas Cort 43471c3110 bmp085: remove duplicate code
A copy and paste error caused a few lines of code to be duplicated.
This patch removes the excess code.

Change-Id: I7313efb537e2a4102fb25ce05782e82ae0c84285
2013-09-18 08:10:26 -04:00
Thomas Cort 493e4fffc5 tda19988: add missing blockdriver_announce() call
To provide EDID to fb, the TDA19988 implements the block device
protocol with libblockdriver. To properly use the library,
blockdriver_announce() should be called by the driver.

Issue reported by David van Moolenbroek

Change-Id: Id55d159d91502a9afac5c1d4de0fee1e8945b5c1
2013-09-18 08:10:26 -04:00
Aurelien Jarno f0c391e09b virtio-net: acknowledge used features
According to the virtio specifications, the host present the supported
features to the guest, and the guest should answer woth the features it
supports. This allows the host to disable support for features that the
guest is not going to use.

Minix tells to the host it doesn't support any extended features, while
it uses at least VIRTIO_NET_F_MAC and VIRTIO_NET_F_CTRL_VQ. For the
latter it seems it only allocate the queue while not using it later.
However starting with QEMU 1.4.0, with multiqueue support added, the
control queue is not allocated on the host side if the guest doesn't
tell it supports this feature. This cause virtio-net to crash on the
Minix side.

This patch fixes that by correctly telling the features that are
used by the Minix guest for more than printing a debug message. This
fixes virtio-net on QEMU 1.4.x.

Change-Id: I8bbf757c09d24e0f5fe5835531a1c9203b714bd7
2013-09-11 18:34:11 +02:00
Thomas Cort 0a9eab0bb6 gpio: port to am335x
* port libgpio to am335x.
 * increase NR_IRQ to 16 to avoid too many IRQs requested error.
 * move gpio binary to /sbin (that's where mount looks for drivers).
 * fix bug that re-enabled banks that were disabled due to bad revision.
 * fix padconf masks for dm37xx in gpio driver (should be 16-bit).
 * fix a few typos in README.txt and comments.

Change-Id: I32374415a97135174c5224f76374a870909fa90c
2013-09-03 08:14:18 -04:00
Thomas Cort 4593804bf0 kernel: add padconf kernel call
On the AM335X, writes to the padconf registers must be done in privileged
mode. To allow userspace drivers to dynamically change the padconf at
runtime, a kernel call has been added.

Change-Id: I4b25d2879399b1785a360912faa0e90b5c258533
2013-08-28 12:53:05 -04:00
Ben Gras c8f3b10909 fix a few more minix specific warnings
. also disable stack protection feature for gcc,
	  causes build errors for pkgsrc gcc on minix

Change-Id: I1c6e2bcb4d948098d642543d7b2711284ee55c72
2013-08-27 16:16:03 +00:00
Thomas Cort 471dc65ada bmp085: driver for the BMP085 temp&pressure sensor
Change-Id: I5c297a7f4f8cea2549e537df30a5c7bf5b9d8b51
2013-08-22 16:54:03 -04:00
Thomas Cort 3bdd1ae659 sht21: driver for the SHT21 humidity & temp sensor
Change-Id: Ia71168e394a7b260019e74973db6c9d75d3d4482
2013-08-22 16:53:57 -04:00
Thomas Cort 845aabfe65 tsl2550: driver for the TSL2550 light sensor
Change-Id: I9e1c87132404509ffec8bf22a8c6cc993df1aa73
2013-08-22 16:53:49 -04:00
Arne Welzel b026d9f946 sb16: Don't confuse pv_set()
Change-Id: Ib7b528aa3a369b54dda3bbceb498db4a600c4cb4
2013-08-20 19:42:30 +02:00
Ben Gras 6e5a113837 a bit more -Werror compatability
for clang, fix warnings in drivers/, lib/, servers/, sys/, common/.
by turning off fatal warnings (takes effect if the default is on),
fixing warnings or reducing the warning level.

Change-Id: Ia1b4bc877c879ba783158081b59aa6ebb021a50f
2013-08-20 11:37:40 +02:00
Michal Maka 0c044c6b02 beaglebone ethernet improvements
. added enable interrupts routine at the HW init stage
	. remove workaround, obsoleted by libnetdriver change
	. change netconf.sh to allow configuring this driver,
	  changed README.txt to reflect this

Change-Id: Ib659d5a55be96022b5e9013caa556dca5092ce89
2013-08-19 13:47:10 +00:00
Thomas Cort 228e84ad2a i2c: general clean-up
Implement changes based on Kees comments on the code review:
	http://gerrit-minix.few.vu.nl/#/c/676/

Changes:
 - use spin API instead of micro_delay() for busy-wait loops.
 - use read16/write16/set16 from mmio.h to access I2C registers.
 - reduce the timeout for soft reset.
 - in read/write, don't mix variable declaration and initialization.
 - after transfer, wait for access ready instead of blindly delaying.
 - rename constants am335x, dm37xx to AM335X_I2C_BUS, DM37XX_I2C_BUS.
 - rename ADDRESS_MASK to MAX_I2C_SA_MASK for clairity.
 - rename omap_i2c_claim_bus() to omap_i2c_bus_is_free().

Change-Id: Ic221e6134e024ea0a6690f21cff208a728286948
2013-08-13 16:29:22 -04:00
Thomas Cort 26f14d6b5d fb: auto-configure with EDID
Use EDID when available to configure the frame buffer driver with
good settings for the attached display.

Change-Id: I69a78155a93e55ffa1ca3ff6621a879a56cdbceb
2013-08-11 20:37:16 +02:00
Thomas Cort 6405d78182 readclock/tda19988: fix compiler/cppcheck warnings
readclock:
 - the setup function for readclock on i386 was missing a return.
 - the message field for RTCDEV_GRANT wasn't the right type.

tda19988:
 - position variable was used without being initialized.

Change-Id: I3f78dd0a9d44f35eb38cb7da0974909f066b7007
2013-08-10 14:36:10 -04:00
Thomas Cort 039c8db774 readclock.drv: add support for the TPS65950 RTC
On the BeagleBoard-xM, the RTC is located on the Power Management IC
(PMIC). To keep things consistent, access to the PMIC's RTC is done
through the readclock driver. The readclock driver forwards the request
on to the TPS65950 driver which does the work of manipulating the
registers on the chip.

Change-Id: I53cefbb59c5a9ab87fab90df3cc1a75a6e430f58
2013-08-09 12:41:58 +02:00
Thomas Cort bab2a34e1b tps65950: driver for the TPS65950 PMIC
Change-Id: I6b6163e59233d1f823f03550b949d53e1738a7f4
2013-08-09 12:41:43 +02:00
David van Moolenbroek 0f07506951 ahci: make 64-bit native 2013-08-08 17:36:41 +02:00
Lukasz Hryniuk 06154a34a4 Some more 64bit function eradication.
. Replace 64bit funcions with operators in arch_clock.c
  . Replace 64bit funcions with operators in proc.c
  . Replace 64bit funcions with operators in vbox.c
  . Replace 64bit funcions with operators in driver.c
  . Eradicates is_zero64, make_zero64, neg64

Change-Id: Ie4e1242a73534f114725271b2e2365b2004cb7b9
2013-08-07 12:35:53 +00:00
Antoine Leca 530c9fa61a Audio drivers: use correct build receipt 2013-08-06 11:46:28 +02:00
Antoine Leca 96ffd57540 dec21140A: remove ACK option in Makefile 2013-08-06 11:46:22 +02:00
Thomas Cort d9b62047f1 tps65217: driver for the TPS65217 PMIC
Change-Id: Ic2259c15645816627d757c9c45560cb4c5c0156c
2013-08-05 10:22:59 -04:00
Thomas Cort 09db2a8c67 readclock: add support for am335x RTC
Add support for getting/setting the am335x SoC's internal real
time clock. Also, allow the power off alarm to be set.

Make readclock an "always on" driver. This is needed for setting
power-off alarms whenever the power button is pressed on the BBB.

Replace the readclock.sh script & single run driver with a
readclock program that takes the same arguments and forwards
the requests on to the always up readclock driver.

Change-Id: Ifd6c2acd80ae4b5e79d83df510df445c24e24a71
2013-08-05 08:37:51 -04:00
Gregg Hernandez 1939870c2e removed some 64-bit functions
Change-Id: Idbafdbf13714f984f03770bd3b39521cb1014cdb
2013-08-05 10:40:26 +02:00