Thomas Cort [Mon, 16 Sep 2013 23:16:12 +0000 (19:16 -0400)]
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.
Thomas Cort [Mon, 16 Sep 2013 17:33:00 +0000 (13:33 -0400)]
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.
Thomas Cort [Sun, 15 Sep 2013 23:48:29 +0000 (19:48 -0400)]
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.
Ben Gras [Mon, 16 Sep 2013 15:33:44 +0000 (15:33 +0000)]
test70: reduce ITERATIONS
. full number was needed to reliably trigger the race
condition
. takes a bit too long (7 mins on fast x86 hardware) for a
condition that "can't" happen again, so let's cut the iteration
count and trust that the test will trigger soon enough for
a similar condition in the future.
Ben Gras [Fri, 13 Sep 2013 12:05:50 +0000 (12:05 +0000)]
vm: enable filemap=1 by default
. turns on mmap() functionality for files by default
. also causes exec() to use it to map in executables
without copying and with sharing those pages with the
disk cache and other instances of the executable
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.
Thomas Cort [Tue, 3 Sep 2013 11:47:59 +0000 (07:47 -0400)]
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.
Thomas Cort [Wed, 28 Aug 2013 04:43:45 +0000 (00:43 -0400)]
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.
Thomas Cort [Mon, 26 Aug 2013 02:07:42 +0000 (22:07 -0400)]
weatherstation: BeagleBone Weather Cape demo app.
The BeagleBone Weather cape enhances the BeagleBone's capabilities
by providing environment sensors (temperature, humidity, pressure,
and ambient light level).
The weatherstation demo is a port of the bonescript weatherstation
to Minix. It provides a nice visual display of the sensor data in
a web browser.
The code is installed to /usr/share/beaglebone/weather on 'earm'
and an embedded web server is started at boot time on port 80
when the cape is attached. Further details are provided in the
README.txt file.
Thomas Cort [Thu, 22 Aug 2013 15:22:01 +0000 (11:22 -0400)]
rc: start drivers for attached BeagleBone Capes
BeagleBone Capes add additional hardware to the BeagleBone to
improve functionality.
This patch probes the third i2c bus for capes and loads the
appropriate drivers for each detected cape. Currently only
the 'BeagleBone Weather' cape is supported.
Thomas Cort [Thu, 22 Aug 2013 15:16:08 +0000 (11:16 -0400)]
eepromread: add board info for BeagleBone Capes
Capes (i.e. expansion boards for the BeagleBone and BeagleBone Black)
each have their own cat24c256 EEPROM with information about the cape
such as the name of the cape, pins used, power requirements, etc.
This patch adds support for displaying the cape data fields. It
can be used in shell scripts to detect and identify attached capes.
PFS: unblock the child when unsuspending an accept
Previously, PFS would incorrectly try to unsuspend the parent (i.e.,
the listening socket), resulting in the child hanging until the other
side performed another action. Test56 started failing on this now.
Arne Welzel [Thu, 15 Nov 2012 11:05:51 +0000 (12:05 +0100)]
libaudiodriver: handle interrupt only once
Apparently, qemu's sb16 doesn't reset the interrupt register
of the mixer and the driver ends up in an endless loop when
playing a "multi-fragment" sample.
Arne Welzel [Wed, 14 Nov 2012 21:43:42 +0000 (22:43 +0100)]
libaudiodriver: allocate mem lower 16 MB and 64K aligned
Righ now, the DMA controller will access some random memory below 16 MB,
as the physical address returned by alloc_contig() is simply truncated
when given to the DMA controller.
Ben Gras [Wed, 14 Aug 2013 12:27:39 +0000 (12:27 +0000)]
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.
Michal Maka [Tue, 13 Aug 2013 15:01:14 +0000 (17:01 +0200)]
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
Previously, all incoming messages would be blocked before a DL_CONF
message arrives from the TCP/IP stack. This however makes it impossible
for a driver to process interrupts before the DL_CONF initialization.
This patch blocks only datalink messages before the initial DL_CONF,
and lets through all other messages to the driver.
Thomas Cort [Fri, 9 Aug 2013 20:41:13 +0000 (20:41 +0000)]
mined: K&R to ANSI, fix function sigs & warnings
- Re-write function declarations from K&R style to ANSI style.
- Change declaration of write_char(), S(), in_list() to match ptotos.
- Resolve clang warnings about assignments in conditionals.
Thomas Cort [Mon, 12 Aug 2013 17:39:54 +0000 (13:39 -0400)]
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().
Thomas Cort [Sat, 10 Aug 2013 05:22:48 +0000 (05:22 +0000)]
backup: bug fix for improper struct dirent usage
Between Minix 3.1.2 and Minix 3.1.3, the d_name member of struct
dirent was reduced from 61 characters to 1 character. backup(8)
blindly copies the result of readdir() into an array of dirent
structs. As a consequence, the structs in the array only contain
the first letter of the name and the name string was not null
terminated. This caused the backup utility to always fail.
Remedy the situation by adding room for the full d_name.
Thomas Cort [Mon, 29 Jul 2013 16:21:48 +0000 (12:21 -0400)]
Importing sys/dev/videomode
NetBSD provides an in-kernel EDID parser, validator, and printer
along with other useful functions. This code will be re-used by
the Minix fb driver as it is a complete and well tested
implementation.
Thomas Cort [Wed, 7 Aug 2013 01:34:08 +0000 (21:34 -0400)]
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.
Thomas Cort [Thu, 8 Aug 2013 00:06:47 +0000 (20:06 -0400)]
readclock: code clean-up, add -q, manpage updates
- Simplify the message passing between readclock and the driver.
- Add a -q command line option to suppress warning messages. This
cuts down on the noise when readclock is called early in the boot
sequence and a secondary RTC driver (ex TPS95650) isn't up yet.
- Update the man page to be less i386 centric and add details about
the new -q option.
The VM server now manages its call masks such that all user processes
share the same call mask. As a result, an update for the call mask of
any user process will apply to all user processes. This is similar to
the privilege infrastructure employed by the kernel, and may serve as
a template for similar fine-grained restrictions in other servers.
Concretely, this patch fixes the problem of "service edit init" not
applying the given VM call mask to user processes started from RC
scripts during system startup.
In addition, this patch makes RS set a proper VM call mask for each
recovery script it spawns.
Lukasz Hryniuk [Wed, 7 Aug 2013 10:17:09 +0000 (12:17 +0200)]
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
Thomas Cort [Fri, 2 Aug 2013 14:10:59 +0000 (10:10 -0400)]
pm: notify readclock of reboot(RBT_POWEROFF)
Some ARM chips handle power-off with RTC alarms. PM notifies
readclock (the driver for RTCs) about the impending power-off.
If the power-off mechanism is an RTC alarm, readclock will
set the alarm. If not, there is no effect.
Thomas Cort [Fri, 2 Aug 2013 14:10:55 +0000 (10:10 -0400)]
kernel: add support for am335x PMIC-base power-off
AM335X SoCs support power-off via a power management
chip (PMIC). An alarm in the real time clock is used
to trigger the PMIC to cut the power.
To ensure the alarm goes off when the system is in
a safe state, the RTC is frozen when the alarm is
set. At the last moment, the kernel unfreezes the RTC
to let the alarm go off.
This patch adds a mini driver for unfreezing the RTC
as well as code to handle RBT_POWEROFF on Minix/arm.
Thomas Cort [Fri, 2 Aug 2013 14:10:30 +0000 (10:10 -0400)]
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.
Thomas Cort [Fri, 26 Jul 2013 23:44:52 +0000 (19:44 -0400)]
i2c: increase BUFLEN/CMDLEN to 128, add page flag.
128 byte reads are much more common than 32 byte reads. The message
passing + setup/teardown for a read is much more expensive, in terms
of time, than the reading itself. A slightly bigger struct is well
worth the time savings. This reduces read times for /dev/eeprom
from 57 seconds per 4KB to 14 seconds.
Additionally, make sending the page address in the eeprom driver
and utility optional. This can save a little time when reading
within the same page and allows support for smaller devices that
don't support pages (example: chips containing EDID).
Kyua/ATF being written in C++, it depends on libstdc++ which is
provided by GCC. As this is not part of the sources, Kyua is only
compiled when the native GCC utils are installed.
To install Kyua do the following:
* In a cross-build enviromnent, add the following to the build.sh
commandline: -V MKBINUTILS=yes -V MKGCCCMDS=yes
WARNING:
At this point the import is still experimental, and not supported
on native builds (a.k.a make build).
Thomas Cort [Mon, 15 Jul 2013 14:29:37 +0000 (10:29 -0400)]
eepromread: simple program to view eeprom contents
This program uses the i2c /dev interface to read the
contents of EEPROMs and display it to the user in
HEX and ASCII. It also has a mode that can display
data in label:value pairs. That mode is used for
board detection in the rc script to start the right
i2c drivers for the board.
Thomas Cort [Mon, 15 Jul 2013 14:28:58 +0000 (10:28 -0400)]
kernel: i2c padconf workaround
The padconf library runs in user mode, but to actually affect the
padconf register contents, the processor has to be in privileged
mode. A full server based solution will be developed, but for now
just set the pinmux in the kernel at boot.