Bug 239697 - [patch] arm/am335x: Switch to iicdev_readfrom/writeto
Summary: [patch] arm/am335x: Switch to iicdev_readfrom/writeto
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm Any
: --- Affects Some People
Assignee: Ian Lepore
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-08-07 14:57 UTC by Chuhong Yuan
Modified: 2019-09-05 16:50 UTC (History)
1 user (show)

See Also:


Attachments
am335x patch (1.09 KB, patch)
2019-08-07 14:57 UTC, Chuhong Yuan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chuhong Yuan 2019-08-07 14:57:42 UTC
Created attachment 206333 [details]
am335x patch

Use iicdev_readfrom/writeto to shrink the code size.
Comment 1 commit-hook freebsd_committer 2019-08-10 17:14:38 UTC
A commit references this bug:

Author: ian
Date: Sat Aug 10 17:14:36 UTC 2019
New revision: 350838
URL: https://svnweb.freebsd.org/changeset/base/350838

Log:
  Switch the am335x_pmic driver to using iicdev_readfrom/writeto.

  PR:		239697
  Submitted by:	Chuhong Yuan

Changes:
  head/sys/arm/ti/am335x/am335x_pmic.c
Comment 2 Ian Lepore freebsd_committer 2019-08-10 17:16:50 UTC
Committed, thanks for submitting it.  I will MFC this to 12-stable after a few days.
Comment 3 commit-hook freebsd_committer 2019-09-05 16:47:17 UTC
A commit references this bug:

Author: ian
Date: Thu Sep  5 16:46:17 UTC 2019
New revision: 351870
URL: https://svnweb.freebsd.org/changeset/base/351870

Log:
  MFC r350838, r350840-r350841, r350849, r350879

  r350838:
  Switch the am335x_pmic driver to using iicdev_readfrom/writeto.

  PR:		239697
  Submitted by:	Chuhong Yuan

  r350840:
  Garbage collect the no-longer-necessary MAX_IIC_DATA_SIZE (there is not a
  buffer allocated at that fixed size anymore).

  r350841:
  When responding to an interrupt in the am335x_pmic driver, use a taskqueue
  thread to do the work that involves i2c IO, which sleeps while the IO is
  in progress.

  r350849:
  Remove use of intr_config_hook from the am335x_pmic and tda19988 drivers.
  Long ago this was needed, but now low-level i2c controller drivers cleverly
  defer attachment of the bus until interrupts are enabled (if they require
  interrupts to function), so that every i2c slave device doesn't have to.

  r350879:
  Revert r350841.  I didn't realize that on this chip, reading the interrupt
  status register clears pending interrupts.  By moving that code out of the
  interrupt handler into a taskqueue task, I effectively created an interrupt
  storm by returning from the handler with the interrupt source still active.

  We'll have to find a different solution for this driver's need to sleep
  in an ithread context.

Changes:
_U  stable/12/
  stable/12/sys/arm/ti/am335x/am335x_pmic.c
  stable/12/sys/arm/ti/am335x/tda19988.c