aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ichiic
Commit message (Collapse)AuthorAgeFilesLines
* ig4(4): Add device HID to match I2C controller on ASUS X540 laptopsVladimir Kondratyev2022-07-211-0/+1
| | | | | Tested by: Andrés Ramírez <rrandresf_AT_hotmail_DOT_com> MFC after: 1 week
* ichiic: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-094-8/+2
|
* Remove unused iicbus_devclass.John Baldwin2022-05-061-3/+2
|
* ig4(4): Add PNP info for ACPI attachmentVladimir Kondratyev2022-03-021-0/+1
| | | | MFC after: 2 month
* ig4: Add PCI IDs for Intel Alder Lake I2C controller.Alexander Motin2021-11-251-0/+40
| | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 2 weeks
* ig4: Add PCI IDs for Intel Gemini Lake I2C controller.Vladimir Kondratyev2021-02-233-1/+24
| | | | | Submitted by: Dmitry Luhtionov MFC after: 2 weeks
* ig4(4): Increase timeout to about 1 secondAllan Jude2021-02-181-1/+1
| | | | | | | | | | | | | | | | | | Per the i2c spec, a slave device can stretch SCL idefinitely, so 25ms is a bit arbitrary in general. smbus does specify an optional timeout recovery mechanism to be done at about 25~35ms, but the IPMI SSIF spec says that BMCs don't have any obligation to implement that. The BMC on Altra seems to mostly respond within 25ms, but occasionally will stretch SCL for ~300 msec. Also, the count_us mechanism seems to actually timeout around 25% earlier than it would claim (timeout really happening around 19ms instead of 25ms). Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Reviewed by: manu, imp Differential Revision: https://reviews.freebsd.org/D28747
* ig4(4): Add PCI IDs for Intel Tiger LakeVladimir Kondratyev2020-12-053-3/+46
| | | | | | | | Submitted by: Neel Chauhan <neel AT neelc DOT org> Differential Revision: https://reviews.freebsd.org/D27483 Notes: svn path=/head/; revision=368366
* ig4(4): Add PCI IDs for Intel Comit Lake I2C controllers.Vladimir Kondratyev2020-10-311-0/+28
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=367230
* ig4iic_acpi_probe: remove set but unused variableAndriy Gapon2020-04-301-2/+0
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=360499
* ig4(4): Add PCI IDs for Intel Bay Trail I2C controllers.Vladimir Kondratyev2020-04-261-0/+14
| | | | | | | | | PR: 245654 Reported by: <xspbe3ho3p5uac@protonmail.com> MFC after: 1 week Notes: svn path=/head/; revision=360355
* ig4: ensure that drivers always attach in correct orderAndriy Gapon2020-04-241-1/+2
| | | | | | | | | | | | | | | | | | | Use DRIVER_MODULE_ORDERED(SI_ORDER_ANY) so that ig4's ACPI attachment happens after iicbus and acpi_iicbus drivers are registered. I have seen a problem where iicbus attached under ig4 instead of acpi_iicbus when ig4.ko was loaded with kldload. I believe that that happened because ig4 driver was a first driver to register, it attached and created an iicbus child. Then iicbus driver was registered and, since it was the only driver that could attach to the iicbus child device, it did exactly that. After that acpi_iicbus driver was registered. It would be able to attach to the iicbus device, but it was already attached, so nothing happened. MFC after: 2 weeks Notes: svn path=/head/; revision=360241
* iicbus(4): Add support for ACPI-based children enumerationVladimir Kondratyev2020-03-091-0/+4
| | | | | | | | | | | | | | | | | | | | When iicbus is attached as child of Designware I2C controller it scans all ACPI nodes for "I2C Serial Bus Connection Resource Descriptor" described in section 19.6.57 of ACPI specs. If such a descriptor is found, I2C child is added to iicbus, it's I2C address, IRQ resource and ACPI handle are added to ivars. Existing ACPI bus-hosted child is deleted afterwards. The driver also installs so called "I2C address space handler" which is disabled by default as nontested. Set hw.iicbus.enable_acpi_space_handler loader tunable to 1 to enable it. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22901 Notes: svn path=/head/; revision=358820
* [ig4] Remove unused methods from bus interfaceVladimir Kondratyev2019-12-102-4/+0
| | | | | | | | | | | bus_get/set_resource methods are implemented in child device (iicbus). As their implementation with bus_generic_rl_get/set calls do not recurse up the tree, the versions in ig4 are never called. Suggested by: jhb Notes: svn path=/head/; revision=355596
* [ig4] Try to workaround MIPS namespace pollution issueVladimir Kondratyev2019-11-041-5/+5
| | | | Notes: svn path=/head/; revision=354327
* [ig4] Convert ithread interrupt handler to filter based one.Vladimir Kondratyev2019-11-031-9/+13
| | | | Notes: svn path=/head/; revision=354322
* [ig4] Enable additional registers support on Appolo Lake controllersVladimir Kondratyev2019-11-031-1/+1
| | | | | | | To be inline with intel-lpss Linux driver Notes: svn path=/head/; revision=354321
* [ig4] Add support for CannonLake controllersVladimir Kondratyev2019-11-034-10/+37
| | | | | | | | | | They are clocked at 216MHz rate, much higher than previous models. PR: 240485 Submitted by: Neel Chauhan <neel@neelc.org> Notes: svn path=/head/; revision=354320
* [ig4] Add generic resource methods to bus interfaceVladimir Kondratyev2019-11-032-0/+23
| | | | | | | That allows ig4 children to allocate IRQs Notes: svn path=/head/; revision=354319
* [ig4] Minor improvement of write pipeliningVladimir Kondratyev2019-11-031-0/+8
| | | | | | | With leaving some data queued in the TX FIFO at the end of write cycle. Notes: svn path=/head/; revision=354318
* [ig4] wait for bus stop condition after stop command issuedVladimir Kondratyev2019-11-031-1/+9
| | | | | | | | It gives better error detection and ig4 driver's lock coverage in a pipelined write case Notes: svn path=/head/; revision=354317
* [ig4] On SkyLake controllers issue reset on attach unconditionally.Vladimir Kondratyev2019-11-031-1/+1
| | | | | | | | It is very helpful during debugging of I2C issues. It is done only for SkyLakes due to lack of testing on other hardware. Notes: svn path=/head/; revision=354316
* [ig4] Set STOP condition and flush TX/RX FIFOs on errorVladimir Kondratyev2019-11-032-22/+66
| | | | | | | | | if controller has not it done for us yet. Reset controller when transfer abort is failed. Notes: svn path=/head/; revision=354315
* [ig4] Improve error detectionVladimir Kondratyev2019-11-032-14/+71
| | | | | | | | | | | | | | | Handle error bits of INTR_STAT and TX_ABORT registers. Move interrupt clearing from interrupt handler to polling loop to get common execution path with polled mode. Do not clear interrupts with reading of IG4_REG_CLR_INTR register as interrupts, triggered during the period from reg_read(IG4_REG_INTR_STAT) to reg_read(IG4_REG_CLR_INTR) will be missed. Instead, read each IG4_REG_CLR_* register separately. Notes: svn path=/head/; revision=354314
* [ig4] Convert polling loop from status-based to interrupt-basedVladimir Kondratyev2019-11-031-21/+12
| | | | | | | | | INTR_STAT register exposes more useful informaton then STA register does e.g. it exposes error and I2C bus STOP conditions. Make it a main source of I2C transfer state. Notes: svn path=/head/; revision=354313
* [ig4] Use interrupts for waiting for empty TX FIFOVladimir Kondratyev2019-11-031-0/+9
| | | | Notes: svn path=/head/; revision=354312
* [ig4] Convert last remaining usage of TX_NOTFULL status to TX_EMPTYVladimir Kondratyev2019-11-031-4/+4
| | | | | | | | in ig4iic_read routine. It makes possible interrupt utilization while waiting for empty space in TX FIFO. Notes: svn path=/head/; revision=354311
* [ig4] Rewrite ig4iic_write routine to use TX_EMPTY status flagVladimir Kondratyev2019-11-031-10/+20
| | | | | | | | rather than TX_NOTFULL. It makes possible interrupt utilization while waiting for empty space in TX FIFO. Notes: svn path=/head/; revision=354310
* [ig4] Remove dead code inherited from DragonflyBSDVladimir Kondratyev2019-11-032-26/+0
| | | | Notes: svn path=/head/; revision=354309
* [ig4] Add suspend/resume supportVladimir Kondratyev2019-11-034-17/+106
| | | | | | | | | | That is done with re-execution of controller initialization procedure from resume handler. PR: 238037 Notes: svn path=/head/; revision=354308
* [ig4] Implement burst mode for data readsVladimir Kondratyev2019-11-033-24/+91
| | | | | | | | | | | In this mode DATA_CMD register reads and writes are performed in TX/RX FIFO-sized bursts to increase I2C bus utilization. That reduces read time from 60us to 30us per byte when read data is fit in to RX FIFO buffer in FAST speed mode in my setup. Notes: svn path=/head/; revision=354307
* [ig4] Set clock registers based on controller modelVladimir Kondratyev2019-11-033-27/+250
| | | | | | | | | | | | IC clock rates are varied between different controller models so we have to adjust timing registers in each case individually. Borrow intresting constants and formulas from Intel specs, i2c-designware and lpss_intel drivers and apply them to FreeBSD supported controller models. Implement fetching of timing data via ACPI methods execution if available. Notes: svn path=/head/; revision=354306
* [ig4] dump IG4_REG_COMP_PARAM1 and IG4_REG_COMP_VER registers unconditionallyVladimir Kondratyev2019-11-032-5/+3
| | | | | | | They appeared to be supported (although undocumented) on SkyLakes+ too. Notes: svn path=/head/; revision=354305
* [ig4] Do not wait until interrupts are enabled at attach stageVladimir Kondratyev2019-11-032-29/+3
| | | | | | | | | | | | as the driver is fully functional on a cold boot through utilization of polled mode. As a side effect, ig4 children probe and attach methods can be called earlier in the boot sequence, so now it is up to the child drivers to wait for a kernel initialization completion if it is required. Notes: svn path=/head/; revision=354303
* [ig4] Allow enabling of polled mode from iicbus allocation callbackVladimir Kondratyev2019-11-034-7/+50
| | | | | | | | | | If controller is allocated with IIC_NOWAIT option ig4 enables polled mode for a period of allocation that makes possible to start I2C transfers from the contexts where sleeping is not allowed e.g. from ithreads or callouts. Notes: svn path=/head/; revision=354302
* [ig4] Add support for polled modeVladimir Kondratyev2019-11-031-1/+5
| | | | | | | | | | | | Currently ig4 internally depends on it's own interrupts and uses mtx_sleep() to wait for them. That means it can not be used from any context where sleeping is disallowed e.g. on cold boot, from DDB/KDB, from other device driver's interrupt handlers and so on. This change replaces sleeps with busy loops in cold boot and DDB cases. Notes: svn path=/head/; revision=354301
* [ig4] disable controller before initialization of clock countersVladimir Kondratyev2019-11-031-5/+7
| | | | | | | It is required by controller specifications. Notes: svn path=/head/; revision=354300
* [ig4] Stop I2C controller after checking that it's kind of functional.Vladimir Kondratyev2019-11-031-0/+5
| | | | | | | Obtained from: DragonfliBSD (0b3eedb) Notes: svn path=/head/; revision=354299
* [ig4] We actually need to set the Rx threshold register one smaller.Vladimir Kondratyev2019-11-031-1/+1
| | | | | | | | | | | Setting the IG4_REG_RX_TL register to 1 was actually generating an interrupt after 2 bytes were available in the Rx fifo. We need to set the register to 0 to get an interrupt for 1 byte already. Obtained from: DragonflyBSD (02f0bf2) Notes: svn path=/head/; revision=354298
* [ig4] Ignore stray interruptsVladimir Kondratyev2019-11-031-3/+6
| | | | Notes: svn path=/head/; revision=354297
* [ig4] Reduce scope of io_lockVladimir Kondratyev2019-11-032-8/+8
| | | | | | | | | Now io_lock is used as condition variable to synchronize active process with the interrupt handler. It is not used for tasks other than waiting for interrupt and passing parameters to and from it's handler. Notes: svn path=/head/; revision=354296
* [ig4] Do not wait for interrupts in set_controller() routineVladimir Kondratyev2019-11-031-8/+1
| | | | | | | | | | Specs shows no dedicated interrupt firing on disable of the controller. Remove io lock acquisitions around set_controller() calls as they are not needed anymore. Notes: svn path=/head/; revision=354295
* [ig4] Drop driver's internal RX FIFOVladimir Kondratyev2019-11-032-69/+1
| | | | | | | | | There is no need to read all controller's RX FIFO data to clear RX_FULL bit in interrupt handler as interrupts are masked permanently since previous commit. Notes: svn path=/head/; revision=354294
* [ig4] Only enable interrupts when we want them. Otherwise keep mask at 0.Vladimir Kondratyev2019-11-033-23/+20
| | | | | | | | | | | | | | This avoids possible interrupt storms, depending on the state of the I2C controller before the driver attached. During attaching this clears the interrupt mask. Revert r338215 as this change makes it no-op. Obtained from: DragonflyBSD (d7c8555) Notes: svn path=/head/; revision=354293
* [ig4] Handle controller startup errorsVladimir Kondratyev2019-11-031-2/+10
| | | | | | | | | | | Fail the attach on controller startup errors. For some reason the dell xps 13 says there's I2C controller, but the controller appears to be permanente disabled and will refuse to enable. Obtained from: DragonflyBSD (509820b) Notes: svn path=/head/; revision=354292
* [ig4] Give common name to PCI and ACPI device driversVladimir Kondratyev2019-11-034-18/+14
| | | | | | | | | | | | | They share common device driver code with different bus attachments This commit starts a bunch of changes which have following properties: Reviewed by: imp (previous version) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22016 Notes: svn path=/head/; revision=354291
* ig4(4): Fix SDA HOLD time set too low on Skylake controllersVladimir Kondratyev2019-09-121-0/+2
| | | | | | | | | | | | | | | Execution of "Soft reset" command (IG4_REG_RESETS_SKL) at controller init stage sets SDA_HOLD register value to 0x0001 which is often too low for normal operation. Set SDA_HOLD back to 28 after reset to restore controller functionality. PR: 240339 Reported by: imp, GregV, et al. MFC after: 3 days Notes: svn path=/head/; revision=352243
* Catch up with r338948.Mark Johnston2018-12-171-1/+1
| | | | | | | MFC with: r342178 Notes: svn path=/head/; revision=342180
* fix formatting and style in ig4iic_acpi_probe afetr r339754Andriy Gapon2018-12-171-7/+3
| | | | | | | | | | | This includes removing stray whitespace, adding a line after the variable declaration block and removing a redundant check. MFC after: 1 week X-MFC with: r339754 Notes: svn path=/head/; revision=342179
* Revert r336326.Mark Johnston2018-12-171-4/+2
| | | | | | | | | | | | | | | | | | | | | In testing on a Dell Latitude 7480, having ig4.ko loaded during a suspend caused the system to hang. It turns out that ig4iic_intr() was being called after the device entered D3, and entered an infinite loop because a read of the I2C status register returned all ones, causing us to attempt to read a byte from the data buffer until one of the status bits clears. This occured because ig4iic_pci0 shares an interrupt with the VGA device on this laptop, so ig4iic_intr() gets called even when there is no work to do. This is exactly the problem fixed by r342170, which resolves the hang for me and allows suspend/resume to work with ig4.ko loaded. So, re-enable autoloading of ig4.ko in the hope that r342170 resolves the problem universally. Reviewed by: gonzo MFC after: 1 month (pending an MFC of r342170) Differential Revision: https://reviews.freebsd.org/D18587 Notes: svn path=/head/; revision=342178