[PATCH v2 0/5] hw/arm: Add NPCM7XX Tachometer Device

Hao Wu posted 5 patches 3 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210311180855.149764-1-wuhaotsh@google.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Thomas Huth <thuth@redhat.com>, Tyrone Ting <kfting@nuvoton.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Havard Skinnemoen <hskinnemoen@google.com>
docs/system/arm/nuvoton.rst    |   2 +-
hw/arm/npcm7xx.c               |  45 ++-
hw/arm/npcm7xx_boards.c        |  99 ++++++
hw/misc/meson.build            |   1 +
hw/misc/npcm7xx_mft.c          | 540 +++++++++++++++++++++++++++++++++
hw/misc/npcm7xx_pwm.c          |   4 +
hw/misc/trace-events           |   8 +
include/hw/arm/npcm7xx.h       |  13 +-
include/hw/misc/npcm7xx_mft.h  |  70 +++++
include/hw/misc/npcm7xx_pwm.h  |   4 +-
tests/qtest/npcm7xx_pwm-test.c | 205 ++++++++++++-
11 files changed, 974 insertions(+), 17 deletions(-)
create mode 100644 hw/misc/npcm7xx_mft.c
create mode 100644 include/hw/misc/npcm7xx_mft.h
[PATCH v2 0/5] hw/arm: Add NPCM7XX Tachometer Device
Posted by Hao Wu 3 years, 1 month ago
This patch set implements the Tachometer (a.k.a Multi Functional Timer/MFT)
device in NPCM7XX SoC. This device is used by NPCM7XX boards to measure
the RPM of PWM fans.

To provide the RPM of a certain fan, since RPM = MAX_RPM * duty_percentage.
We convert the duty output in NPCM7XX PWM module into GPIOs and feed them
into the MFT module.

The connection of PWM modules and fan modules are derived from their specific
Linux device trees and coded in hw/arm/npcm7xx_boards.c.

We amend the QTest for the PWM module to include verifying the reading from
the Tachometer is correct.

Changes since v1:
- Split implementation of device and addition to board file to separate patches
- Adapt to new Clock API and address conflicts
- Use the new clock_ns_to_ticks API to calculate tachometer counts

Hao Wu (5):
  hw/misc: Add GPIOs for duty in NPCM7xx PWM
  hw/misc: Add NPCM7XX MFT Module
  hw/arm: Add MFT device to NPCM7xx Soc
  hw/arm: Connect PWM fans in NPCM7XX boards
  tests/qtest: Test PWM fan RPM using MFT in PWM test

 docs/system/arm/nuvoton.rst    |   2 +-
 hw/arm/npcm7xx.c               |  45 ++-
 hw/arm/npcm7xx_boards.c        |  99 ++++++
 hw/misc/meson.build            |   1 +
 hw/misc/npcm7xx_mft.c          | 540 +++++++++++++++++++++++++++++++++
 hw/misc/npcm7xx_pwm.c          |   4 +
 hw/misc/trace-events           |   8 +
 include/hw/arm/npcm7xx.h       |  13 +-
 include/hw/misc/npcm7xx_mft.h  |  70 +++++
 include/hw/misc/npcm7xx_pwm.h  |   4 +-
 tests/qtest/npcm7xx_pwm-test.c | 205 ++++++++++++-
 11 files changed, 974 insertions(+), 17 deletions(-)
 create mode 100644 hw/misc/npcm7xx_mft.c
 create mode 100644 include/hw/misc/npcm7xx_mft.h

-- 
2.31.0.rc2.261.g7f71774620-goog


Re: [PATCH v2 0/5] hw/arm: Add NPCM7XX Tachometer Device
Posted by Peter Maydell 3 years, 1 month ago
On Thu, 11 Mar 2021 at 18:08, Hao Wu <wuhaotsh@google.com> wrote:
>
> This patch set implements the Tachometer (a.k.a Multi Functional Timer/MFT)
> device in NPCM7XX SoC. This device is used by NPCM7XX boards to measure
> the RPM of PWM fans.
>
> To provide the RPM of a certain fan, since RPM = MAX_RPM * duty_percentage.
> We convert the duty output in NPCM7XX PWM module into GPIOs and feed them
> into the MFT module.
>
> The connection of PWM modules and fan modules are derived from their specific
> Linux device trees and coded in hw/arm/npcm7xx_boards.c.
>
> We amend the QTest for the PWM module to include verifying the reading from
> the Tachometer is correct.



Applied to target-arm.next, thanks.

-- PMM

Re: [PATCH v2 0/5] hw/arm: Add NPCM7XX Tachometer Device
Posted by Richard Henderson 2 years, 6 months ago
On Thu, 11 Mar 2021 at 13:11, Hao Wu <wuhaotsh@google.com> wrote:
>
> This patch set implements the Tachometer (a.k.a Multi Functional Timer/MFT)
> device in NPCM7XX SoC. This device is used by NPCM7XX boards to measure
> the RPM of PWM fans.
>
> To provide the RPM of a certain fan, since RPM = MAX_RPM * duty_percentage.
> We convert the duty output in NPCM7XX PWM module into GPIOs and feed them
> into the MFT module.
>
> The connection of PWM modules and fan modules are derived from their specific
> Linux device trees and coded in hw/arm/npcm7xx_boards.c.
>
> We amend the QTest for the PWM module to include verifying the reading from
> the Tachometer is correct.
>
> Changes since v1:
> - Split implementation of device and addition to board file to separate patches
> - Adapt to new Clock API and address conflicts
> - Use the new clock_ns_to_ticks API to calculate tachometer counts
>
> Hao Wu (5):
>   hw/misc: Add GPIOs for duty in NPCM7xx PWM
>   hw/misc: Add NPCM7XX MFT Module
>   hw/arm: Add MFT device to NPCM7xx Soc
>   hw/arm: Connect PWM fans in NPCM7XX boards
>   tests/qtest: Test PWM fan RPM using MFT in PWM test
>
>  docs/system/arm/nuvoton.rst    |   2 +-
>  hw/arm/npcm7xx.c               |  45 ++-
>  hw/arm/npcm7xx_boards.c        |  99 ++++++
>  hw/misc/meson.build            |   1 +
>  hw/misc/npcm7xx_mft.c          | 540 +++++++++++++++++++++++++++++++++
>  hw/misc/npcm7xx_pwm.c          |   4 +
>  hw/misc/trace-events           |   8 +
>  include/hw/arm/npcm7xx.h       |  13 +-
>  include/hw/misc/npcm7xx_mft.h  |  70 +++++
>  include/hw/misc/npcm7xx_pwm.h  |   4 +-
>  tests/qtest/npcm7xx_pwm-test.c | 205 ++++++++++++-
>  11 files changed, 974 insertions(+), 17 deletions(-)
>  create mode 100644 hw/misc/npcm7xx_mft.c
>  create mode 100644 include/hw/misc/npcm7xx_mft.h

Thanks, queued to target-arm.next.

r~

Re: [PATCH v2 0/5] hw/arm: Add NPCM7XX Tachometer Device
Posted by Hao Wu 2 years, 6 months ago
Is this reply to a wrong thread? I thought it was applied a long time ago.

Thanks,

On Mon, Nov 1, 2021 at 10:33 AM Richard Henderson <
richard.henderson@linaro.org> wrote:

> On Thu, 11 Mar 2021 at 13:11, Hao Wu <wuhaotsh@google.com> wrote:
> >
> > This patch set implements the Tachometer (a.k.a Multi Functional
> Timer/MFT)
> > device in NPCM7XX SoC. This device is used by NPCM7XX boards to measure
> > the RPM of PWM fans.
> >
> > To provide the RPM of a certain fan, since RPM = MAX_RPM *
> duty_percentage.
> > We convert the duty output in NPCM7XX PWM module into GPIOs and feed them
> > into the MFT module.
> >
> > The connection of PWM modules and fan modules are derived from their
> specific
> > Linux device trees and coded in hw/arm/npcm7xx_boards.c.
> >
> > We amend the QTest for the PWM module to include verifying the reading
> from
> > the Tachometer is correct.
> >
> > Changes since v1:
> > - Split implementation of device and addition to board file to separate
> patches
> > - Adapt to new Clock API and address conflicts
> > - Use the new clock_ns_to_ticks API to calculate tachometer counts
> >
> > Hao Wu (5):
> >   hw/misc: Add GPIOs for duty in NPCM7xx PWM
> >   hw/misc: Add NPCM7XX MFT Module
> >   hw/arm: Add MFT device to NPCM7xx Soc
> >   hw/arm: Connect PWM fans in NPCM7XX boards
> >   tests/qtest: Test PWM fan RPM using MFT in PWM test
> >
> >  docs/system/arm/nuvoton.rst    |   2 +-
> >  hw/arm/npcm7xx.c               |  45 ++-
> >  hw/arm/npcm7xx_boards.c        |  99 ++++++
> >  hw/misc/meson.build            |   1 +
> >  hw/misc/npcm7xx_mft.c          | 540 +++++++++++++++++++++++++++++++++
> >  hw/misc/npcm7xx_pwm.c          |   4 +
> >  hw/misc/trace-events           |   8 +
> >  include/hw/arm/npcm7xx.h       |  13 +-
> >  include/hw/misc/npcm7xx_mft.h  |  70 +++++
> >  include/hw/misc/npcm7xx_pwm.h  |   4 +-
> >  tests/qtest/npcm7xx_pwm-test.c | 205 ++++++++++++-
> >  11 files changed, 974 insertions(+), 17 deletions(-)
> >  create mode 100644 hw/misc/npcm7xx_mft.c
> >  create mode 100644 include/hw/misc/npcm7xx_mft.h
>
> Thanks, queued to target-arm.next.
>
> r~
>
Re: [PATCH v2 0/5] hw/arm: Add NPCM7XX Tachometer Device
Posted by Richard Henderson 2 years, 6 months ago
On 11/1/21 1:50 PM, Hao Wu wrote:
> Is this reply to a wrong thread? I thought it was applied a long time ago.

Probably.

r~

> 
> Thanks,
> 
> On Mon, Nov 1, 2021 at 10:33 AM Richard Henderson <richard.henderson@linaro.org 
> <mailto:richard.henderson@linaro.org>> wrote:
> 
>     On Thu, 11 Mar 2021 at 13:11, Hao Wu <wuhaotsh@google.com
>     <mailto:wuhaotsh@google.com>> wrote:
>      >
>      > This patch set implements the Tachometer (a.k.a Multi Functional Timer/MFT)
>      > device in NPCM7XX SoC. This device is used by NPCM7XX boards to measure
>      > the RPM of PWM fans.
>      >
>      > To provide the RPM of a certain fan, since RPM = MAX_RPM * duty_percentage.
>      > We convert the duty output in NPCM7XX PWM module into GPIOs and feed them
>      > into the MFT module.
>      >
>      > The connection of PWM modules and fan modules are derived from their specific
>      > Linux device trees and coded in hw/arm/npcm7xx_boards.c.
>      >
>      > We amend the QTest for the PWM module to include verifying the reading from
>      > the Tachometer is correct.
>      >
>      > Changes since v1:
>      > - Split implementation of device and addition to board file to separate patches
>      > - Adapt to new Clock API and address conflicts
>      > - Use the new clock_ns_to_ticks API to calculate tachometer counts
>      >
>      > Hao Wu (5):
>      >   hw/misc: Add GPIOs for duty in NPCM7xx PWM
>      >   hw/misc: Add NPCM7XX MFT Module
>      >   hw/arm: Add MFT device to NPCM7xx Soc
>      >   hw/arm: Connect PWM fans in NPCM7XX boards
>      >   tests/qtest: Test PWM fan RPM using MFT in PWM test
>      >
>      >  docs/system/arm/nuvoton.rst    |   2 +-
>      >  hw/arm/npcm7xx.c               |  45 ++-
>      >  hw/arm/npcm7xx_boards.c        |  99 ++++++
>      >  hw/misc/meson.build            |   1 +
>      >  hw/misc/npcm7xx_mft.c          | 540 +++++++++++++++++++++++++++++++++
>      >  hw/misc/npcm7xx_pwm.c          |   4 +
>      >  hw/misc/trace-events           |   8 +
>      >  include/hw/arm/npcm7xx.h       |  13 +-
>      >  include/hw/misc/npcm7xx_mft.h  |  70 +++++
>      >  include/hw/misc/npcm7xx_pwm.h  |   4 +-
>      >  tests/qtest/npcm7xx_pwm-test.c | 205 ++++++++++++-
>      >  11 files changed, 974 insertions(+), 17 deletions(-)
>      >  create mode 100644 hw/misc/npcm7xx_mft.c
>      >  create mode 100644 include/hw/misc/npcm7xx_mft.h
> 
>     Thanks, queued to target-arm.next.
> 
>     r~
> 


Re: [PATCH v2 0/5] hw/arm: Add NPCM7XX Tachometer Device
Posted by Peter Maydell 2 years, 6 months ago
On Tue, 2 Nov 2021 at 10:03, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 11/1/21 1:50 PM, Hao Wu wrote:
> > Is this reply to a wrong thread? I thought it was applied a long time ago.
>
> Probably.

Possibly you meant this 5-patch NPCM7xx series ?
https://patchew.org/QEMU/20211008002628.1958285-1-wuhaotsh@google.com/
("[PATCH v2 0/5] hw/arm: Add MMC device for NPCM7XX boards")

which has been reviewed and is ready to go in I think.

thanks
-- PMM

Re: [PATCH v2 0/5] hw/arm: Add NPCM7XX Tachometer Device
Posted by Richard Henderson 2 years, 6 months ago
On 11/2/21 6:44 AM, Peter Maydell wrote:
> On Tue, 2 Nov 2021 at 10:03, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> On 11/1/21 1:50 PM, Hao Wu wrote:
>>> Is this reply to a wrong thread? I thought it was applied a long time ago.
>>
>> Probably.
> 
> Possibly you meant this 5-patch NPCM7xx series ?
> https://patchew.org/QEMU/20211008002628.1958285-1-wuhaotsh@google.com/
> ("[PATCH v2 0/5] hw/arm: Add MMC device for NPCM7XX boards")
> 
> which has been reviewed and is ready to go in I think.

Yep, that's the one.


r~