Commit Graph

163 Commits

Author SHA1 Message Date
Gleb Smirnoff
540b1a7238 Clean up SIOCSIFDSTADDR usage from ifnet drivers. The ioctl itself is
extremely outdated, and I doubt that it was ever used for ifnet drivers.
It was used for AF_INET sockets in pre-FreeBSD time.

Approved by:	re (hrs)
Sponsored by:	Nginx, Inc.
2013-09-11 09:19:44 +00:00
Gleb Smirnoff
47e8d432d5 Add const qualifier to the dst parameter of the ifnet if_output method. 2013-04-26 12:50:32 +00:00
Sofian Brabez
61bfd86762 Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays
Reviewed by:	cognet
Approved by:	cognet
2013-01-30 18:01:20 +00:00
Kevin Lo
72794e9e2c Check the return value of uiomove(9). 2012-11-13 05:58:52 +00:00
Marius Strobl
f9e26776a6 It turns out that as documented, PCF8563_R_SECOND_VL (i.e. battery low)
doesn't automatically clear when VDD rises above Vlow again and needs to be
cleared manually. However, apparently this needs all of the time registers
to be set, i.e. pcf8563_settime(), and not just PCF8563_R_SECOND in order
for PCF8563_R_SECOND_VL to stick. Thus, we just issue a warning during
pcf8563_attach() rather than failing with ENXIO in case it is set.

MFC after:	3 days
2012-10-18 10:29:16 +00:00
Kevin Lo
374c6ff93a Remove unused variables. 2012-09-29 16:15:27 +00:00
Hiroki Sato
f8e8af9cf2 Add s35390a_rtc(4) driver for Seiko Instruments S-35390A RTC.
Submitted by:	Yusuke Tanaka
2012-08-21 17:31:10 +00:00
Andreas Tobler
a894f6a0d4 Add a new temperature driver for certain PowerMacs. Found here on my Quad G5. 2012-08-19 19:37:14 +00:00
Andreas Tobler
58af3406d2 Unify the sysctl description with the other PowerMac temperature drivers. 2012-08-19 19:34:10 +00:00
Andreas Tobler
3b29957407 Avoid using the degree symbol. Looks ugly on the console. 2012-08-19 19:32:38 +00:00
Andreas Tobler
11e31cd29a Do the ADC init only at startup and not during every sensor read call.
This reduces the number of interrupts.
2012-08-19 19:31:36 +00:00
Marcel Moolenaar
d08dfc3305 Don't include MIPS machine headers. There's no need for it. 2012-05-19 17:42:11 +00:00
Marius Strobl
34f4e555b5 Add a driver for the NXP (Philips) PCF8563 RTC.
Obtained from:	NetBSD (pcf8563reg.h)
2012-04-13 23:07:32 +00:00
Jayachandran C.
1ab68cbb08 Driver for OpenCores I2C controller.
Add a Simple polled driver iicoc for the OpenCores I2C controller. This
is used in Netlogic XLP processors.

Submitted by:	Sreekanth M. S. (kanthms at netlogicmicro com)
2012-03-27 10:44:32 +00:00
Jayachandran C.
1513a6ff90 Move driver for DS1374 RTC to sys/dev/iicbus
The earlier version of the driver is sys/mips/rmi/dev/iic/ds1374u.c
Convert all references to ds1374u to ds1374, and use DEVMETHOD_END.
Also update the license header as Netlogic is now Broadcom.
2012-03-27 09:48:18 +00:00
Andreas Tobler
10520ef88f Fix typo. 2012-03-02 18:18:14 +00:00
Alexander Kabaev
d4280a0fab Provide pre/post transfer method callbacks for icbbb
clients.

These are helful when making certain drivers work on both Linux
and FreeBSD without changing the code flow too much.

Reviewed by: kib, wlosh
MFC after: 1 month
2012-03-01 20:58:20 +00:00
Adrian Chadd
fd06fec782 IIC bitbang changes - prepare to make the bit delay configurable; debug print changes.
* Right now the delay is hard coded at 10uS. This is a bit long when doing lots
  of periodic i2c transactions. So create a 'udelay' parameter and initialise it
  to 10. This can be tuned later.

* Add a newline after a transaction finishes, so the debugging output isn't so
  horrible.
2011-12-20 02:49:01 +00:00
Adrian Chadd
9844b3b3ab Allow the i2c node requirements to be slightly relaxed.
These realtek switch PHYs speak a variant of i2c with some slightly
modified handling.

From the submitter, slightly modified now that some further digging
has been done:

  The I2C framework makes a assumption that the read/not-write bit of the first
  byte (the address) indicates whether reads or writes are to follow.

  The RTL8366 family uses the bus: after sending the address+read/not-write byte,
  two register address bytes are sent, then the 16-bit register value is sent
  or received.  While the register write access can be performed as a 4-byte
  write, the read access requires the read bit to be set, but the first two bytes
  for the register address then need to be transmitted.

This patch maintains the i2c protocol behaviour but allows it to be relaxed
(for these kinds of switch PHYs, and whatever else Realtek may do with this
almost-but-not-quite i2c bus) - by setting the "strict" hint to 0.
The "strict" hint defaults to 1.

Submitted by:	Stefan Bethke <stb@lassitu.de>
2011-12-04 11:55:33 +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
Ed Schouten
d745c852be Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
2011-11-07 06:44:47 +00:00
Christian Brueffer
04c4548981 Revert r226398 and instead move the allocation of usrbufs after the error check.
Suggested by:	pjd
MFC after:	1 week
2011-10-16 17:38:20 +00:00
Christian Brueffer
0ad684e7b4 Properly free resources in an error case.
CID:		4203
Found with:	Coverity Prevent(tm)
MFC after:	1 week
2011-10-15 15:57:55 +00:00
Bjoern A. Zeeb
a34c6aeb85 Tag mbufs of all incoming frames or packets with the interface's FIB
setting (either default or if supported as set by SIOCSIFFIB, e.g.
from ifconfig).

Submitted by:	Alexander V. Chernikov (melifaro ipfw.ru)
Reviewed by:	julian
MFC after:	2 weeks
2011-07-03 16:08:38 +00:00
Kevin Lo
ee6eac62f7 Remove duplicate header includes 2011-06-28 08:36:48 +00:00
Andreas Tobler
d91c258074 - Improve error handling.
- Add retry loops in the i2c read/write functions.
- Combied the ADC channel selection and readout of the value into
  one iicbus_transfer to avoid possible races.

Reviewed by: nwhitehorn
2011-06-08 16:00:30 +00:00
Andreas Tobler
1b49664037 - Improve error handling.
- Add a retry loop for the i2c sensor reading.
- Check on busy status of the chip and on invalid values.
- Fix a typo in a comment.
- Replace the constant 2732 with the ZERO_C_TO_K macro.

Approved by:	nwhitehorn (mentor)
2011-06-04 09:23:54 +00:00
Andreas Tobler
7cced077f8 Replace the FCU_ZERO_C_TO_K with the ZERO_C_TO_K from powermac_thermal.h.
Approved by:	nwhitehorn (mentor)
2011-06-04 09:19:53 +00:00
Andreas Tobler
aa7e99afbd - Improve error handling.
- Add a retry loop for the i2c sensor reading.
- Update the sensor handling for sensors which do not have a location
entry. [1]

Submitted by: [1] Justin Hibbits.
Approved by:	nwhitehorn (mentor)
2011-06-03 18:58:32 +00:00
Nathan Whitehorn
6b9a12b391 Move the celsius-to-kelvin conversion to a place that powermac_thermal can
see it as well.
2011-05-29 19:53:46 +00:00
Nathan Whitehorn
815d7d92c1 Update the I2C-based temperature/fan drivers to connect to the Powermac
thermal control module. This provides automatic fan management on all G5
PowerMacs and Xserves.
2011-05-29 18:35:57 +00:00
Andreas Tobler
d188174a4f Add a new driver, the ad7417, to read temperatures and voltages on some
PowerMac's.

Approved by:	nwhitehorn (mentor)
2011-05-29 14:25:42 +00:00
Andreas Tobler
14be64618e There are PowerMacs which do not have a hwsensor-location property
for this sensor. Instead of leaving this location empty we use here
the default name 'sensor'.

Submitted by: Justin Hibbits <chmeeedalf at gmail dot com>
Approved by: nwhitehorn (mentor)
2011-01-18 21:47:30 +00:00
Andreas Tobler
b919d343a9 Remove unused variable. Spotted by a cppcheck
(devel/cppcheck, http://sourceforge.net/projects/cppcheck) run.

Approved by: nwhitehorn (mentor)
2011-01-15 19:16:56 +00:00
Andreas Tobler
7cea3d952b On the Xserve G5 we find the LM75 instead of the DS1775. The core
functionality is the same, a difference is that the DS1775 has a better
precision than the LM75. But we do not use it in our setup. Make the
LM75 work the same as the DS1775.

Fix a typo in device_set_desc.

Tested by: Paul Mather <paul at gromit dlib vt edu>

Approved by:	nwhitehorn (mentor)
2010-12-10 20:27:50 +00:00
Nathan Whitehorn
134a9563c7 Provide support for IIC_M_NOSTOP/IIC_M_NOSTART for bit-banging and
otherwise low-level controllers.

Reviewed by:	thompsa
2010-11-08 19:53:16 +00:00
Andreas Tobler
da89fa28c6 Add three new drivers for fan control and temperature reading on the
PowerMac7,2.

- The fcu driver lets us read and write the fan RPMs for all fans in the
  PowerMac7,2. This driver is PowerMac specific.
- The ds1775 is a driver to read the temperature for the drive bay sensor.
- The max6690 is another driver to read temperatures. Here it is used to
  read the inlet, the backside and the U3 heatsink temperature.

An additional driver, the ad7417, will follow later.

Thanks to nwhitehorn for guiding me through this driver development.

Approved by:	nwhitehorn (mentor)
2010-10-15 20:08:16 +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
Joel Dahl
7f22a6d334 Fix typo in comment. 2010-08-07 08:31:32 +00:00
Nathan Whitehorn
517524ec87 Fix iicbus_get_addr() on 64-bit big-endian systems. The bus accessor
passes a uintptr_t, not a uint32_t.
2010-07-08 14:19:52 +00:00
Nathan Whitehorn
9f220e4d78 Revert changes accidentally committed as part of r209298. 2010-06-18 14:20:54 +00:00
Nathan Whitehorn
eaef5f0af8 Provide for multiple, cascaded PICs on PowerPC systems, and extend the
OFW interrupt map interface to also return the device's interrupt parent.

MFC after:	8.1-RELEASE
2010-06-18 14:06:27 +00:00
Nathan Whitehorn
fed318596c Add two new flags (IIC_M_NOSTOP and IIC_M_NOSTART) to struct iic_msg to
allow consumers of iicbus_transfer() to send messages with repeated starts.

Reviewed by:	imp
2010-06-05 17:48:26 +00:00
Maxim Sobolev
e50d35e6c6 Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

MFC after:	1 month
2010-05-03 07:32:50 +00:00
Stanislav Sedov
97958cafc8 - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc"
respectivly. This will allow one to have a kernel with both devices
  present and use it for multiple boards with different types of RTC
  sitting on a bus.

Discussed with:	imp
2009-04-21 22:48:12 +00:00
Stanislav Sedov
50aababbfb - Give a warning and start the oscillator if it was not previously
runned.
- Rename ds1672 -> rtc to follow the other drivers.
- Refactor/simplify the code a bit.

MFC after:	2 weeks
2009-04-20 15:47:06 +00:00
Kip Macy
279aa3d419 Change if_output to take a struct route as its fourth argument in order
to allow passing a cached struct llentry * down to L2

Reviewed by:	rwatson
2009-04-16 20:30:28 +00:00
Warner Losh
b23193a559 Fix iicbus_intr, iicbus_write and device_read_ivar prototypes... 2009-02-10 22:50:23 +00:00
Rafal Jaworowski
1aef11be0e Teach iic(4) the 'repeated start' I2C condition. This will be used by the
upcoming i2c(8) diag utility.

Reviewed by:	bms, stas
Obtained from:	Semihalf
2009-01-26 13:53:39 +00:00
Nathan Whitehorn
f5a78b2f7e Change the probe priority for PCI and I2C generic bus modules from
numerical constants to BUS_PROBE_GENERIC.

Suggested by:	jhb
2009-01-20 00:05:43 +00:00