All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V8 1/3] dt-bindings: rtc: zynqmp: Add clock information
@ 2022-06-13 12:58 ` Srinivas Neeli
  0 siblings, 0 replies; 16+ messages in thread
From: Srinivas Neeli @ 2022-06-13 12:58 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni, robh+dt, krzysztof.kozlowski+dt,
	michal.simek, sgoud, shubhraj, srinivas.neeli, neelisrinivas18
  Cc: devicetree, linux-rtc, linux-arm-kernel, linux-kernel, git,
	Srinivas Neeli

Added clock information and deprecated calibration support.

Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
---
Changes in V8:
-None
Changes in V7:
-None
Changes in V6:
-Removed dtc warnings.
Changes in V5:
-Removed quotes and _clk suffix from clocknames.
Changes in V4:
- Deprecated calibrtion support
Changes in V3:
- New patch
---
 .../devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml     | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml b/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml
index bdb72d3ddf2a..638dd1d8bb26 100644
--- a/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml
@@ -23,8 +23,15 @@ properties:
   reg:
     maxItems: 1
 
+  clocks:
+    items:
+      - description: rtc_clk is the operating frequency of crystal.
+
+  clock-names:
+    maxItems: 1
+
   interrupts:
-    minItems: 2
+    maxItems: 2
 
   interrupt-names:
     items:
@@ -39,6 +46,7 @@ properties:
     minimum: 0x1
     maximum: 0x1FFFFF
     default: 0x198233
+    deprecated: true
 
 required:
   - compatible
@@ -61,5 +69,7 @@ examples:
         interrupts = <0 26 4>, <0 27 4>;
         interrupt-names = "alarm", "sec";
         calibration = <0x198233>;
+        clock-names = "rtc_clk";
+        clocks = <&rtc_clk>;
       };
     };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* Re: [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support
  2022-06-13 12:58   ` Srinivas Neeli
@ 2022-06-27  7:39 ` Dan Carpenter
  -1 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2022-06-27  3:04 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4845 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220613125836.523449-3-srinivas.neeli@xilinx.com>
References: <20220613125836.523449-3-srinivas.neeli@xilinx.com>
TO: Srinivas Neeli <srinivas.neeli@xilinx.com>

Hi Srinivas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.19-rc3 next-20220624]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Srinivas-Neeli/dt-bindings-rtc-zynqmp-Add-clock-information/20220614-013701
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
:::::: branch date: 12 days ago
:::::: commit date: 12 days ago
config: arc-randconfig-m031-20220622
compiler: arceb-elf-gcc (GCC) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/rtc/rtc-zynqmp.c:238 xlnx_rtc_set_offset() error: uninitialized symbol 'fract_tick'.

vim +/fract_tick +238 drivers/rtc/rtc-zynqmp.c

2781fd75583878 Srinivas Neeli  2022-06-13  200  
2781fd75583878 Srinivas Neeli  2022-06-13  201  static int xlnx_rtc_set_offset(struct device *dev, long offset)
2781fd75583878 Srinivas Neeli  2022-06-13  202  {
2781fd75583878 Srinivas Neeli  2022-06-13  203  	struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
2781fd75583878 Srinivas Neeli  2022-06-13  204  	unsigned long long rtc_ppb = RTC_PPB;
2781fd75583878 Srinivas Neeli  2022-06-13  205  	unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
2781fd75583878 Srinivas Neeli  2022-06-13  206  	unsigned char fract_tick;
2781fd75583878 Srinivas Neeli  2022-06-13  207  	unsigned int calibval;
2781fd75583878 Srinivas Neeli  2022-06-13  208  	short int  max_tick;
2781fd75583878 Srinivas Neeli  2022-06-13  209  	int fract_offset;
2781fd75583878 Srinivas Neeli  2022-06-13  210  
2781fd75583878 Srinivas Neeli  2022-06-13  211  	if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
2781fd75583878 Srinivas Neeli  2022-06-13  212  		return -ERANGE;
2781fd75583878 Srinivas Neeli  2022-06-13  213  
2781fd75583878 Srinivas Neeli  2022-06-13  214  	/* Number ticks for given offset */
2781fd75583878 Srinivas Neeli  2022-06-13  215  	max_tick = div_s64_rem(offset, tick_mult, &fract_offset);
2781fd75583878 Srinivas Neeli  2022-06-13  216  
2781fd75583878 Srinivas Neeli  2022-06-13  217  	/* Number fractional ticks for given offset */
2781fd75583878 Srinivas Neeli  2022-06-13  218  	if (fract_offset) {
2781fd75583878 Srinivas Neeli  2022-06-13  219  		if (fract_offset < 0) {
2781fd75583878 Srinivas Neeli  2022-06-13  220  			fract_offset = fract_offset + tick_mult;
2781fd75583878 Srinivas Neeli  2022-06-13  221  			max_tick--;
2781fd75583878 Srinivas Neeli  2022-06-13  222  		}
2781fd75583878 Srinivas Neeli  2022-06-13  223  		if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
2781fd75583878 Srinivas Neeli  2022-06-13  224  			for (fract_tick = 1; fract_tick < 16; fract_tick++) {
2781fd75583878 Srinivas Neeli  2022-06-13  225  				if (fract_offset <=
2781fd75583878 Srinivas Neeli  2022-06-13  226  				    (fract_tick *
2781fd75583878 Srinivas Neeli  2022-06-13  227  				     (tick_mult / RTC_FR_MAX_TICKS)))
2781fd75583878 Srinivas Neeli  2022-06-13  228  					break;
2781fd75583878 Srinivas Neeli  2022-06-13  229  			}
2781fd75583878 Srinivas Neeli  2022-06-13  230  		}
2781fd75583878 Srinivas Neeli  2022-06-13  231  	}
2781fd75583878 Srinivas Neeli  2022-06-13  232  
2781fd75583878 Srinivas Neeli  2022-06-13  233  	/* Zynqmp RTC uses second and fractional tick
2781fd75583878 Srinivas Neeli  2022-06-13  234  	 * counters for compensation
11143c19eb57a8 Suneel Garapati 2015-08-19  235  	 */
2781fd75583878 Srinivas Neeli  2022-06-13  236  	calibval = max_tick + RTC_CALIB_DEF;
2781fd75583878 Srinivas Neeli  2022-06-13  237  
2781fd75583878 Srinivas Neeli  2022-06-13 @238  	if (fract_tick)
2781fd75583878 Srinivas Neeli  2022-06-13  239  		calibval |= RTC_FR_EN;
2781fd75583878 Srinivas Neeli  2022-06-13  240  
2781fd75583878 Srinivas Neeli  2022-06-13  241  	calibval |= (fract_tick << RTC_FR_DATSHIFT);
2781fd75583878 Srinivas Neeli  2022-06-13  242  
2781fd75583878 Srinivas Neeli  2022-06-13  243  	writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
2781fd75583878 Srinivas Neeli  2022-06-13  244  
2781fd75583878 Srinivas Neeli  2022-06-13  245  	return 0;
11143c19eb57a8 Suneel Garapati 2015-08-19  246  }
11143c19eb57a8 Suneel Garapati 2015-08-19  247  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-06-27  7:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-13 12:58 [PATCH V8 1/3] dt-bindings: rtc: zynqmp: Add clock information Srinivas Neeli
2022-06-13 12:58 ` Srinivas Neeli
2022-06-13 12:58 ` [PATCH V8 2/3] rtc: zynqmp: Updated calibration value Srinivas Neeli
2022-06-13 12:58   ` Srinivas Neeli
2022-06-14 11:39   ` Peter Korsgaard
2022-06-14 11:39     ` Peter Korsgaard
2022-06-13 12:58 ` [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support Srinivas Neeli
2022-06-13 12:58   ` Srinivas Neeli
2022-06-14  4:04   ` kernel test robot
2022-06-14  4:24   ` kernel test robot
2022-06-14 20:51 ` [PATCH V8 1/3] dt-bindings: rtc: zynqmp: Add clock information Rob Herring
2022-06-14 20:51   ` Rob Herring
2022-06-18  0:38 ` Krzysztof Kozlowski
2022-06-18  0:38   ` Krzysztof Kozlowski
  -- strict thread matches above, loose matches on Subject: below --
2022-06-27  3:04 [PATCH V8 3/3] rtc: zynqmp: Add calibration set and get support kernel test robot
2022-06-27  7:39 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.