From: Guenter Roeck <linux@roeck-us.net>
To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
Luca Ceresoli <luca@lucaceresoli.net>,
linux-kernel@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Chanwoo Choi <cw00.choi@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
devicetree@vger.kernel.org, linux-rtc@vger.kernel.org,
linux-watchdog@vger.kernel.org,
Chiwoong Byun <woong.byun@samsung.com>,
Laxman Dewangan <ldewangan@nvidia.com>,
Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v3 7/8] watchdog: max77714: add driver for the watchdog in the MAX77714 PMIC
Date: Fri, 12 Nov 2021 11:23:39 -0800 [thread overview]
Message-ID: <f1cbbc17-7a06-2d57-bf3d-c8133dcd30f7@roeck-us.net> (raw)
In-Reply-To: <2af4073a-a5d9-e878-d622-b757b082359b@canonical.com>
On 11/12/21 8:07 AM, Krzysztof Kozlowski wrote:
> On 12/11/2021 17:02, Luca Ceresoli wrote:
>> Hi Guenter,
>>
>> On 12/11/21 15:57, Guenter Roeck wrote:
>>> On 11/11/21 2:58 PM, Luca Ceresoli wrote:
>>>> Add a simple driver to support the watchdog embedded in the Maxim
>>>> MAX77714
>>>> PMIC.
>>>>
>>>> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
>>>>
>>>
>>> I just realized that this is effectively a rewrite of
>>> drivers/watchdog/max77620_wdt.c.
>>> The only difference I can see is is the register offsets (0x91 and 0x92
>>> vs. 1 and 2) and some implementation details. Please add support for this
>>> watchdog to the other driver or provide a _really_ good reason why that
>>> is not possible.
>>
>> I initially started developing MAX77714 watchdog support as an addition
>> to max77620_wdt.c as the procedures look identical at least for the
>> basic features.
>>
>> But the register content seems completely different. Here are the notes
>> I took at that time:
>>
>> -------------------------8<-------------------------
>>
>> MAX77620 has reg ONOFFCNFG1 at 0x41, ONOFFCNFG2 at 0x42.
>> MAX77714 has reg CNFG1_ONOFF at 0x93, CNFG2_ONOFF at 0x94.
>> OK, we can handle this with a register indirection table, indexed by
>> chip model.
>>
>> MAX77620 has MAX77620_REG_FPS_CFG0 register.
>> On MAX77714 I was unable to find any such register (I haven't looked at
>> FPS in detail though).
>> OK, we can handle this with some if()s or entirely disable PM on the
>> 77714 until anybody cares.
>>
>> MAX77620 ONOFFCNFG1 has SFT_RST in bit 7.
>> MAX77714 CNFG1_ONOFF has SFT_RST is bit 6.
>> Uhm, should we have a _bit_ indirection table in addition to the
>> _register_ indirection table?
>>
>> MAX77620 ONOFFCNFG2 bit 5 is SLP_LPM_MSK, involved in FPS.
>> MAX77620 ONOFFCNFG2 bit 6 is WD_RTS_WK, configures the watchdog timer.
>> MAX77714 CNFG2_ONOFF bit 5 is WD_RTS_WK, configures the watchdog timer.
>> On MAX77714 I haven't found SLP_LPM_MSK.
>>
>> MAX77620 has 6 CID registers with "ES version" in CID5.
>> MAX77714 has 5 CID registers with "DEVICE id" in CID3.
>> CID registers would be useful to get the chip model directly from the
>> chip, if only they had the same structure.
>>
>> Almost all of the registers I have been looking into have similar
>> differences.
>>
>> -------------------------8<-------------------------
>>
>> When I started adding indirection tables the driver started growing
>> bigger and uglier, and that little simple driver started being big and
>> complex. So I opted to add a new driver.
>>
>
> The register offset differences are trivial and we do it in several
> drivers. Also in rtc-max77686 used by you here.
> Lack of features as well - just have a variant/driver data which defines
> certain features (true/false) or quirk bits (see s3c2410_wdt).
>
> The second driver - s3c2410_wdt - also customizes the bits.
>
> Therefore if the generic device operating configuration is similar (same
> generic control flow) and differences are in bits and offsets, then it
> should be one driver.
>
Exactly.
Thanks,
Guenter
next prev parent reply other threads:[~2021-11-12 19:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 22:58 [PATCH v3 0/8] Add MAX77714 PMIC minimal driver (RTC and watchdog only) Luca Ceresoli
2021-11-11 22:58 ` [PATCH v3 1/8] rtc: max77686: convert comments to kernel-doc format Luca Ceresoli
2021-11-11 23:16 ` Randy Dunlap
2021-11-11 22:58 ` [PATCH v3 2/8] rtc: max77686: rename day-of-month defines Luca Ceresoli
2021-11-17 20:30 ` Alexandre Belloni
2021-11-11 22:58 ` [PATCH v3 3/8] rtc: max77686: remove unused code to read in 12-hour mode Luca Ceresoli
2021-11-17 20:31 ` Alexandre Belloni
2021-11-11 22:58 ` [PATCH v3 4/8] dt-bindings: mfd: add Maxim MAX77714 PMIC Luca Ceresoli
2021-11-19 16:56 ` Rob Herring
2021-11-11 22:58 ` [PATCH v3 5/8] mfd: max77714: Add driver for " Luca Ceresoli
2021-11-11 22:58 ` [PATCH v3 6/8] watchdog: Kconfig: fix help text indentation Luca Ceresoli
2021-11-11 23:14 ` Randy Dunlap
2021-11-17 13:43 ` Guenter Roeck
2021-11-11 22:58 ` [PATCH v3 7/8] watchdog: max77714: add driver for the watchdog in the MAX77714 PMIC Luca Ceresoli
2021-11-12 14:57 ` Guenter Roeck
2021-11-12 16:02 ` Luca Ceresoli
2021-11-12 16:07 ` Krzysztof Kozlowski
2021-11-12 19:23 ` Guenter Roeck [this message]
2021-11-13 13:46 ` Luca Ceresoli
2021-11-11 22:58 ` [PATCH v3 8/8] rtc: max77686: add MAX77714 support Luca Ceresoli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f1cbbc17-7a06-2d57-bf3d-c8133dcd30f7@roeck-us.net \
--to=linux@roeck-us.net \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=b.zolnierkie@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski@canonical.com \
--cc=ldewangan@nvidia.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=luca@lucaceresoli.net \
--cc=rdunlap@infradead.org \
--cc=robh+dt@kernel.org \
--cc=wim@linux-watchdog.org \
--cc=woong.byun@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®