Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752163AbcDZOd0 (ORCPT ); Tue, 26 Apr 2016 10:33:26 -0400 Received: from mail-db3on0109.outbound.protection.outlook.com ([157.55.234.109]:22016 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751798AbcDZOdY (ORCPT ); Tue, 26 Apr 2016 10:33:24 -0400 X-Greylist: delayed 8602 seconds by postgrey-1.27 at vger.kernel.org; Tue, 26 Apr 2016 10:33:23 EDT Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=gomspace.com; Subject: Re: [PATCH 1/3] mfd: add Cypress FM33256B Processor Companion driver To: Alexandre Belloni , Rob Herring References: <1461150471-23163-1-git-send-email-jlp@gomspace.com> <1461150471-23163-2-git-send-email-jlp@gomspace.com> <20160422193232.GA9737@rob-hp-laptop> <20160422201153.GB17051@piout.net> CC: , , , , , , , , , , From: Jeppe Ledet-Pedersen Message-ID: <571F7BD2.60201@gomspace.com> Date: Tue, 26 Apr 2016 16:31:46 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160422201153.GB17051@piout.net> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [77.243.61.136] X-ClientProxiedBy: AM4PR02CA0033.eurprd02.prod.outlook.com (2a01:111:e400:7a66::43) To DB3PR04MB0635.eurprd04.prod.outlook.com (2a01:111:e400:9431::21) X-MS-Office365-Filtering-Correlation-Id: 030c365e-9127-4fd6-f1d7-08d36ddfb0f3 X-Microsoft-Exchange-Diagnostics: 1;DB3PR04MB0635;2:z4uS46r8hAXl37Vz/p6vPqVOeGXQNIzvkm8TYk6ftNrEjffFOjDwRlHnWgxkDv1gvT+ggfMC6121Op8qAAR5b47TcfCp/qlagY9C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JodtPlpYOOZdAs68s1ib0c0rCYCob;4:+Mj2OTZploGZa5fIv6NIh60Au48kIMBN1Nj89ZPPghSmLEMq2nop9uvU9bVaRH3Lov3yE3g9hh4vsBu4YPmj9+xJUIegVmhIvp0PAhzMkaFwb7/OXFQTpPEo87oK9RZ7/SeiRNhh612JpRstxqsVid424vtiq3SQMHZtBst1NhYTLXX33EkrT0wbz/YNlLLs4PplCEJrh4N9VT2N20Ss37MObZmhPtzQnTo1tcYwnuJ5Vhd7A4hv5r7LgWs/liPrDwyWZMEomnN1KpblDbt8BUCbt1qJ/Dbw9TAfc8ldr/J12nZJ2s7xb1ZZMzFDFCPGMsdzXFFNNC7I20Ejj021NeGekMONQtj2JfQxanvX0u+7FNSYnXL6Cridktho2Qmeb/gOz3L7ku/V4BjkVbw49yV3KhSc0QWWkUVCXmz4usEomg67a3/i+/woXnYymR1sSCX9Ue47MJUYjs4wVQ7nZQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521072)(6040130)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041072)(6043046);SRVR:DB3PR04MB0635;BCL:0;PCL:0;RULEID:;SRVR:DB3PR04MB0635; X-Forefront-PRVS: 0924C6A0D5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(24454002)(76176999)(54356999)(345774005)(33656002)(36756003)(92566002)(65816999)(2906002)(50986999)(3846002)(19580405001)(19580395003)(5001770100001)(230700001)(4326007)(4001350100001)(6116002)(2950100001)(5004730100002)(586003)(189998001)(5008740100001)(42186005)(66066001)(47776003)(65956001)(93886004)(81166005)(86362001)(50466002)(83506001)(1096002)(23746002)(64126003);DIR:OUT;SFP:1102;SCL:1;SRVR:DB3PR04MB0635;H:Jeppes-MacBook-Pro.local;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB3PR04MB0635;23:D0Swl6kbwmZF7rN0AqCEQk0dDWCzdm2k0zfRM?= =?Windows-1252?Q?WBWXGOKdUic3sFUKSnmP3AUDfhCG68Usz2tWmcBR3Qo57/o8t4jMddjI?= =?Windows-1252?Q?Q4JrgYru0GtIoGhc3YOusWz7jUlOQ+imD3J9+bYwBEexAgnbpjHckmnY?= =?Windows-1252?Q?m+Z2JhYPZxuemZBKktaqG+KocVoZc+Yzy57TEOjV22dIhk43HiV/7Zne?= =?Windows-1252?Q?AcG+SpROHRVKJSueLHWZADHIQ0yY+vuQAQTh/FpHLJiBk0EP6F5KtYLl?= =?Windows-1252?Q?JPRBLaGmHEOlhgvqzgmZuIIAejIIVA8ZFLiHYKlHdX41j0GXW9+wfL+F?= =?Windows-1252?Q?EKtyfEtDT6M0TmCwG7NullnovDDhIlKUTFD3m+7/mmAcu4tGqpavm9u0?= =?Windows-1252?Q?g/d+Im257LEiQ84Px8XCF5bIDjyDC7ax+Orl00ELsaSWDGxferOe3HXp?= =?Windows-1252?Q?KZJpiRyyoMBLZ+8Oo4/QJqeCXiEnlzPoFG0BtTspTtClLvKK92CPWmkS?= =?Windows-1252?Q?KiZmOW24OHDuUxur4iawn5Vsx0B2n8G2FqllSZOm0PFfME5M453g0EjT?= =?Windows-1252?Q?2cTHJ3XP2b+7WxE9ckFN6FYuXvaJMb+4nyp058D5IVl9BDZ/wwzvR1Nr?= =?Windows-1252?Q?fZoCZ8Fz6aprzSFg/kkdXfSe0ii0Mj3gTHdQtTjGRVaX0dI/Z6ef0NWv?= =?Windows-1252?Q?oJoxGUOXzXTXD8asplWlXC1IylnzSHABSEmSGgzpKqOaPYJNBtfkfDrG?= =?Windows-1252?Q?n6wJON8+pbq+y+KvdbfHTmb8pnOx7lBKE04EYpa9zugqEYRbLI3OlXzP?= =?Windows-1252?Q?TRHQWwY8Ja2d1jLrfjxwhx6pCjFHPtBjaeHgXN7R1nl4kmPiIdmchSPs?= =?Windows-1252?Q?Y9XnMHs/q9+6rVQ+gDCBAp+Om98J3T+9VBftqylTjiMK17j/g7wnI5ly?= =?Windows-1252?Q?oNIowbrCSq5zV/ludWB5bjufuVTqk6uVm+Q/X/HvJpDsuDKvRZShSaWE?= =?Windows-1252?Q?Lo3xC9XjfMdDLWNoQUXVAEhJk+fgkGDgLY2Lo3OSXRPnBiWiTzrx2wyn?= =?Windows-1252?Q?4ebYghR4UAwHrZPwzrWm5V9lXwiMYShAwfU?= X-Microsoft-Exchange-Diagnostics: 1;DB3PR04MB0635;5:pwqyXqN9IditmcT8tcSAdB8Q6iItPntrOxYS7l8vNsdagigoR01W8M2sGaBKSNIBeICVLiladWWiY+UrudGE/nZvaQsWuKT2HrLCvH/lR5f+WFTMbHZdbfWSJBHVPDo49DHL66om+OGav4pqt9DjjA==;24:Ug5tNLMVFFLSMErjOUjqrDJIcM+TK1u5O9UgngMXksd/4KeLZIUGCY8xUft0lrkSrXj6u4S7fxZw9uUkmkKElzV6Y5BST2n3Rzp1UQU3UfA= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: gomspace.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2016 14:33:07.2501 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR04MB0635 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3897 Lines: 100 On 22/04/16 22:11, Alexandre Belloni wrote: > On 22/04/2016 at 14:32:32 -0500, Rob Herring wrote : >> On Wed, Apr 20, 2016 at 01:07:49PM +0200, Jeppe Ledet-Pedersen wrote: >>> This patch adds support for the Cypress Semiconductor FM33256B processor >>> companion. The device contains a 256 kbit FRAM, an RTC, a supply voltage >>> monitor, and a watchdog timer. >>> >>> Signed-off-by: Jeppe Ledet-Pedersen >>> --- >>> Documentation/devicetree/bindings/mfd/fm33256b.txt | 30 ++ >>> MAINTAINERS | 6 + >>> drivers/mfd/Kconfig | 16 + >>> drivers/mfd/Makefile | 1 + >>> drivers/mfd/fm33256b.c | 488 +++++++++++++++++++++ >>> include/linux/mfd/fm33256b.h | 76 ++++ >>> 6 files changed, 617 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/mfd/fm33256b.txt >>> create mode 100644 drivers/mfd/fm33256b.c >>> create mode 100644 include/linux/mfd/fm33256b.h >>> >>> diff --git a/Documentation/devicetree/bindings/mfd/fm33256b.txt b/Documentation/devicetree/bindings/mfd/fm33256b.txt >>> new file mode 100644 >>> index 0000000..6591c94 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/mfd/fm33256b.txt >>> @@ -0,0 +1,30 @@ >>> +Device-tree bindings for Cypress Semiconductor FM33256B Processor Companion >>> +--------------------------------------------------------------------------- >>> + >>> +Required properties: >>> +- compatible: must be "cypress,fm33256b". >>> +- reg: SPI chip select >>> +- spi-max-frequency: Max SPI frequency to use (< 16000000) >>> + >>> +Optional properties: >>> +- cypress,charge-enabled: enable trickle charger >> >> What does the driver do if charging is disabled? Would using 'status = >> "disabled"' be any different? >> > > Good catch, I didn't look at this patch but it includes a lot of code > that should be going to the RTC driver. > If trickle charging is not enabled, I guess the RTC will not charge its > backup battery. Thank you for the comments. Alexandre is correct. If the "cypress,charge-enabled" property is present, the internal 80 uA trickle charger is enabled to charge a backup capacitor on the VBAK pin. Do you want more code than the trickle charger setup moved to the RTC driver? >>> +- cypress,charge-fast: enable fast (1 mA) charging >> >> What does fast mean? >> Fast charging means charging with 1 mA instead of 80 uA. The wording is from the datasheet, but I agree it should be renamed to something that better explains what the difference is. >> I think it is time for a common binding here. There's all sorts of >> variations on setting the charge current in bindings. Add something like >> "charge-current-microamp" in power_supply.txt and use it here. Then >> 1000uA implies "fast charge". > > Well, this is not a power supply, it is an RTC. > > I think both properties should got to the RTC subdevice and be parsed in > the RTC driver. The backup capacitor is primarily used to supply current to the RTC, but a couple of other registers are also battery-backed (watchdog reset cause, event counter), so I put the charger setup in the main MFD file. If you prefer, I can move them both to the RTC driver? > Note that for trickle charging, we currently have the following > properties: > - trickle-resistor-ohms > - trickle-diode-disable > - abracon,tc-diode > - abracon,tc-resistor > > abracon,tc-resistor can be replaced by trickle-resistor-ohms, I'll make > a patch but abracon,tc-diode allows to select a diode type (and in > particular a voltage drop). > > I think we could add a trickle-current-microamp like you suggested and > trickle-diode-disable can be reused. So replace "cypress,charge-enabled/charge-fast" with "trickle-current-microamp" and a check for 0/80/1000 uA? Thanks, -Jeppe