Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'rtc-6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux

Pull RTC updates from Alexandre Belloni:
"Subsystem:
- add missing MODULE_DESCRIPTION() macro
- fix offset addition for alarms

Drivers:
- isl1208: alarm clearing fixes
- mcp794xx: oscillator failure detection
- stm32: stm32mp25 support
- tps6594: power management support"

* tag 'rtc-6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux:
rtc: stm32: add new st,stm32mp25-rtc compatible and check RIF configuration
dt-bindings: rtc: stm32: introduce new st,stm32mp25-rtc compatible
rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0
rtc: interface: Add RTC offset to alarm after fix-up
rtc: ds1307: Clamp year to valid BCD (0-99) in `set_time()`
rtc: ds1307: Detect oscillator fail on mcp794xx
rtc: isl1208: Update correct procedure for clearing alarm
rtc: isl1208: Add a delay for clearing alarm
dt-bindings: rtc: Convert rtc-fsl-ftm-alarm.txt to yaml format
rtc: add missing MODULE_DESCRIPTION() macro
rtc: abx80x: Fix return value of nvmem callback on read
rtc: cmos: Fix return value of nvmem callbacks
rtc: isl1208: Fix return value of nvmem callbacks
rtc: tps6594: Add power management support
rtc: tps6594: introduce private structure as drvdata
rtc: tps6594: Fix memleak in probe

+299 -103
+73
Documentation/devicetree/bindings/rtc/fsl,ls-ftm-alarm.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/rtc/fsl,ls-ftm-alarm.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Freescale FlexTimer Module (FTM) Alarm 8 + 9 + maintainers: 10 + - Frank Li <Frank.Li@nxp.com> 11 + 12 + properties: 13 + compatible: 14 + enum: 15 + - fsl,ls1012a-ftm-alarm 16 + - fsl,ls1021a-ftm-alarm 17 + - fsl,ls1028a-ftm-alarm 18 + - fsl,ls1043a-ftm-alarm 19 + - fsl,ls1046a-ftm-alarm 20 + - fsl,ls1088a-ftm-alarm 21 + - fsl,ls208xa-ftm-alarm 22 + - fsl,lx2160a-ftm-alarm 23 + 24 + reg: 25 + maxItems: 1 26 + 27 + interrupts: 28 + maxItems: 1 29 + 30 + fsl,rcpm-wakeup: 31 + $ref: /schemas/types.yaml#/definitions/phandle-array 32 + items: 33 + - items: 34 + - description: phandle to rcpm node 35 + - description: bit mask of IPPDEXPCR0 36 + - description: bit mask of IPPDEXPCR1 37 + - description: bit mask of IPPDEXPCR2 38 + - description: bit mask of IPPDEXPCR3 39 + - description: bit mask of IPPDEXPCR4 40 + - description: bit mask of IPPDEXPCR5 41 + - description: bit mask of IPPDEXPCR6 42 + minItems: 1 43 + description: 44 + phandle to rcpm node, Please refer 45 + Documentation/devicetree/bindings/soc/fsl/rcpm.txt 46 + 47 + big-endian: 48 + $ref: /schemas/types.yaml#/definitions/flag 49 + description: 50 + If the host controller is big-endian mode, specify this property. 51 + The default endian mode is little-endian. 52 + 53 + required: 54 + - compatible 55 + - reg 56 + - interrupts 57 + - fsl,rcpm-wakeup 58 + 59 + allOf: 60 + - $ref: rtc.yaml# 61 + 62 + unevaluatedProperties: false 63 + 64 + examples: 65 + - | 66 + #include <dt-bindings/interrupt-controller/arm-gic.h> 67 + 68 + rtc@2800000 { 69 + compatible = "fsl,ls1088a-ftm-alarm"; 70 + reg = <0x2800000 0x10000>; 71 + fsl,rcpm-wakeup = <&rcpm 0x0 0x0 0x0 0x0 0x4000 0x0>; 72 + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; 73 + };
-36
Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt
··· 1 - Freescale FlexTimer Module (FTM) Alarm 2 - 3 - Required properties: 4 - - compatible : Should be "fsl,<chip>-ftm-alarm", the 5 - supported chips include 6 - "fsl,ls1012a-ftm-alarm" 7 - "fsl,ls1021a-ftm-alarm" 8 - "fsl,ls1028a-ftm-alarm" 9 - "fsl,ls1043a-ftm-alarm" 10 - "fsl,ls1046a-ftm-alarm" 11 - "fsl,ls1088a-ftm-alarm" 12 - "fsl,ls208xa-ftm-alarm" 13 - "fsl,lx2160a-ftm-alarm" 14 - - reg : Specifies base physical address and size of the register sets for the 15 - FlexTimer Module. 16 - - interrupts : Should be the FlexTimer Module interrupt. 17 - - fsl,rcpm-wakeup property and rcpm node : Please refer 18 - Documentation/devicetree/bindings/soc/fsl/rcpm.txt 19 - 20 - Optional properties: 21 - - big-endian: If the host controller is big-endian mode, specify this property. 22 - The default endian mode is little-endian. 23 - 24 - Example: 25 - rcpm: rcpm@1e34040 { 26 - compatible = "fsl,ls1088a-rcpm", "fsl,qoriq-rcpm-2.1+"; 27 - reg = <0x0 0x1e34040 0x0 0x18>; 28 - #fsl,rcpm-wakeup-cells = <6>; 29 - }; 30 - 31 - ftm_alarm0: timer@2800000 { 32 - compatible = "fsl,ls1088a-ftm-alarm"; 33 - reg = <0x0 0x2800000 0x0 0x10000>; 34 - fsl,rcpm-wakeup = <&rcpm 0x0 0x0 0x0 0x0 0x4000 0x0>; 35 - interrupts = <0 44 4>; 36 - };
+4 -1
Documentation/devicetree/bindings/rtc/st,stm32-rtc.yaml
··· 15 15 - st,stm32-rtc 16 16 - st,stm32h7-rtc 17 17 - st,stm32mp1-rtc 18 + - st,stm32mp25-rtc 18 19 19 20 reg: 20 21 maxItems: 1 ··· 91 90 properties: 92 91 compatible: 93 92 contains: 94 - const: st,stm32mp1-rtc 93 + enum: 94 + - st,stm32mp1-rtc 95 + - st,stm32mp25-rtc 95 96 96 97 then: 97 98 properties:
+5 -4
drivers/rtc/interface.c
··· 274 274 return err; 275 275 276 276 /* full-function RTCs won't have such missing fields */ 277 - if (rtc_valid_tm(&alarm->time) == 0) { 278 - rtc_add_offset(rtc, &alarm->time); 279 - return 0; 280 - } 277 + err = rtc_valid_tm(&alarm->time); 278 + if (!err) 279 + goto done; 281 280 282 281 /* get the "after" timestamp, to detect wrapped fields */ 283 282 err = rtc_read_time(rtc, &now); ··· 378 379 if (err && alarm->enabled) 379 380 dev_warn(&rtc->dev, "invalid alarm value: %ptR\n", 380 381 &alarm->time); 382 + else 383 + rtc_add_offset(rtc, &alarm->time); 381 384 382 385 return err; 383 386 }
+1
drivers/rtc/lib_test.c
··· 97 97 98 98 kunit_test_suite(rtc_lib_test_suite); 99 99 100 + MODULE_DESCRIPTION("KUnit test for RTC lib functions"); 100 101 MODULE_LICENSE("GPL");
+1 -1
drivers/rtc/rtc-ab-b5ze-s3.c
··· 933 933 #endif 934 934 935 935 static const struct i2c_device_id abb5zes3_id[] = { 936 - { "abb5zes3", 0 }, 936 + { "abb5zes3" }, 937 937 { } 938 938 }; 939 939 MODULE_DEVICE_TABLE(i2c, abb5zes3_id);
+1 -1
drivers/rtc/rtc-ab-eoz9.c
··· 575 575 #endif 576 576 577 577 static const struct i2c_device_id abeoz9_id[] = { 578 - { "abeoz9", 0 }, 578 + { "abeoz9" }, 579 579 { } 580 580 }; 581 581
+8 -4
drivers/rtc/rtc-abx80x.c
··· 705 705 if (ret) 706 706 return ret; 707 707 708 - if (write) 708 + if (write) { 709 709 ret = i2c_smbus_write_i2c_block_data(priv->client, reg, 710 710 len, val); 711 - else 711 + if (ret) 712 + return ret; 713 + } else { 712 714 ret = i2c_smbus_read_i2c_block_data(priv->client, reg, 713 715 len, val); 714 - if (ret) 715 - return ret; 716 + if (ret <= 0) 717 + return ret ? ret : -EIO; 718 + len = ret; 719 + } 716 720 717 721 offset += len; 718 722 val += len;
+1 -1
drivers/rtc/rtc-bq32k.c
··· 304 304 } 305 305 306 306 static const struct i2c_device_id bq32k_id[] = { 307 - { "bq32000", 0 }, 307 + { "bq32000" }, 308 308 { } 309 309 }; 310 310 MODULE_DEVICE_TABLE(i2c, bq32k_id);
+4 -6
drivers/rtc/rtc-cmos.c
··· 643 643 size_t count) 644 644 { 645 645 unsigned char *buf = val; 646 - int retval; 647 646 648 647 off += NVRAM_OFFSET; 649 648 spin_lock_irq(&rtc_lock); 650 - for (retval = 0; count; count--, off++, retval++) { 649 + for (; count; count--, off++) { 651 650 if (off < 128) 652 651 *buf++ = CMOS_READ(off); 653 652 else if (can_bank2) ··· 656 657 } 657 658 spin_unlock_irq(&rtc_lock); 658 659 659 - return retval; 660 + return count ? -EIO : 0; 660 661 } 661 662 662 663 static int cmos_nvram_write(void *priv, unsigned int off, void *val, ··· 664 665 { 665 666 struct cmos_rtc *cmos = priv; 666 667 unsigned char *buf = val; 667 - int retval; 668 668 669 669 /* NOTE: on at least PCs and Ataris, the boot firmware uses a 670 670 * checksum on part of the NVRAM data. That's currently ignored ··· 672 674 */ 673 675 off += NVRAM_OFFSET; 674 676 spin_lock_irq(&rtc_lock); 675 - for (retval = 0; count; count--, off++, retval++) { 677 + for (; count; count--, off++) { 676 678 /* don't trash RTC registers */ 677 679 if (off == cmos->day_alrm 678 680 || off == cmos->mon_alrm ··· 687 689 } 688 690 spin_unlock_irq(&rtc_lock); 689 691 690 - return retval; 692 + return count ? -EIO : 0; 691 693 } 692 694 693 695 /*----------------------------------------------------------------*/
+6 -1
drivers/rtc/rtc-ds1307.c
··· 65 65 # define DS1340_BIT_CENTURY_EN 0x80 /* in REG_HOUR */ 66 66 # define DS1340_BIT_CENTURY 0x40 /* in REG_HOUR */ 67 67 #define DS1307_REG_WDAY 0x03 /* 01-07 */ 68 + # define MCP794XX_BIT_OSCRUN BIT(5) 68 69 # define MCP794XX_BIT_VBATEN 0x08 69 70 #define DS1307_REG_MDAY 0x04 /* 01-31 */ 70 71 #define DS1307_REG_MONTH 0x05 /* 01-12 */ ··· 243 242 regs[DS1307_REG_MIN] & M41T0_BIT_OF) { 244 243 dev_warn_once(dev, "oscillator failed, set time!\n"); 245 244 return -EINVAL; 245 + } else if (ds1307->type == mcp794xx && 246 + !(regs[DS1307_REG_WDAY] & MCP794XX_BIT_OSCRUN)) { 247 + dev_warn_once(dev, "oscillator failed, set time!\n"); 248 + return -EINVAL; 246 249 } 247 250 248 251 tmp = regs[DS1307_REG_SECS]; ··· 359 354 regs[DS1307_REG_MONTH] = bin2bcd(t->tm_mon + 1); 360 355 361 356 /* assume 20YY not 19YY */ 362 - tmp = t->tm_year - 100; 357 + tmp = t->tm_year % 100; 363 358 regs[DS1307_REG_YEAR] = bin2bcd(tmp); 364 359 365 360 if (chip->century_enable_bit)
+1 -1
drivers/rtc/rtc-ds1374.c
··· 52 52 #define DS1374_REG_TCR 0x09 /* Trickle Charge */ 53 53 54 54 static const struct i2c_device_id ds1374_id[] = { 55 - { "ds1374", 0 }, 55 + { "ds1374" }, 56 56 { } 57 57 }; 58 58 MODULE_DEVICE_TABLE(i2c, ds1374_id);
+1 -1
drivers/rtc/rtc-ds1672.c
··· 133 133 } 134 134 135 135 static const struct i2c_device_id ds1672_id[] = { 136 - { "ds1672", 0 }, 136 + { "ds1672" }, 137 137 { } 138 138 }; 139 139 MODULE_DEVICE_TABLE(i2c, ds1672_id);
+1 -1
drivers/rtc/rtc-ds3232.c
··· 586 586 } 587 587 588 588 static const struct i2c_device_id ds3232_id[] = { 589 - { "ds3232", 0 }, 589 + { "ds3232" }, 590 590 { } 591 591 }; 592 592 MODULE_DEVICE_TABLE(i2c, ds3232_id);
+1 -1
drivers/rtc/rtc-em3027.c
··· 129 129 } 130 130 131 131 static const struct i2c_device_id em3027_id[] = { 132 - { "em3027", 0 }, 132 + { "em3027" }, 133 133 { } 134 134 }; 135 135 MODULE_DEVICE_TABLE(i2c, em3027_id);
+1 -1
drivers/rtc/rtc-fm3130.c
··· 53 53 int data_valid; 54 54 }; 55 55 static const struct i2c_device_id fm3130_id[] = { 56 - { "fm3130", 0 }, 56 + { "fm3130" }, 57 57 { } 58 58 }; 59 59 MODULE_DEVICE_TABLE(i2c, fm3130_id);
+1
drivers/rtc/rtc-goldfish.c
··· 203 203 204 204 module_platform_driver(goldfish_rtc); 205 205 206 + MODULE_DESCRIPTION("Android Goldfish Real Time Clock driver"); 206 207 MODULE_LICENSE("GPL v2");
+2 -2
drivers/rtc/rtc-hym8563.c
··· 559 559 } 560 560 561 561 static const struct i2c_device_id hym8563_id[] = { 562 - { "hym8563", 0 }, 563 - {}, 562 + { "hym8563" }, 563 + {} 564 564 }; 565 565 MODULE_DEVICE_TABLE(i2c, hym8563_id); 566 566
+1 -1
drivers/rtc/rtc-isl12022.c
··· 366 366 MODULE_DEVICE_TABLE(of, isl12022_dt_match); 367 367 368 368 static const struct i2c_device_id isl12022_id[] = { 369 - { "isl12022", 0 }, 369 + { "isl12022" }, 370 370 { } 371 371 }; 372 372 MODULE_DEVICE_TABLE(i2c, isl12022_id);
+24 -12
drivers/rtc/rtc-isl1208.c
··· 7 7 8 8 #include <linux/bcd.h> 9 9 #include <linux/clk.h> 10 + #include <linux/delay.h> 10 11 #include <linux/i2c.h> 11 12 #include <linux/module.h> 12 13 #include <linux/of.h> ··· 629 628 struct isl1208_state *isl1208 = i2c_get_clientdata(client); 630 629 int handled = 0, sr, err; 631 630 631 + if (!isl1208->config->has_tamper) { 632 + /* 633 + * The INT# output is pulled low 250ms after the alarm is 634 + * triggered. After the INT# output is pulled low, it is low for 635 + * at least 250ms, even if the correct action is taken to clear 636 + * it. It is impossible to clear ALM if it is still active. The 637 + * host must wait for the RTC to progress past the alarm time 638 + * plus the 250ms delay before clearing ALM. 639 + */ 640 + msleep(250); 641 + } 642 + 632 643 /* 633 644 * I2C reads get NAK'ed if we read straight away after an interrupt? 634 645 * Using a mdelay/msleep didn't seem to help either, so we work around ··· 663 650 664 651 rtc_update_irq(isl1208->rtc, 1, RTC_IRQF | RTC_AF); 665 652 653 + /* Disable the alarm */ 654 + err = isl1208_rtc_toggle_alarm(client, 0); 655 + if (err) 656 + return err; 657 + 658 + fsleep(275); 659 + 666 660 /* Clear the alarm */ 667 661 sr &= ~ISL1208_REG_SR_ALM; 668 662 sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr); ··· 678 658 __func__); 679 659 else 680 660 handled = 1; 681 - 682 - /* Disable the alarm */ 683 - err = isl1208_rtc_toggle_alarm(client, 0); 684 - if (err) 685 - return err; 686 661 } 687 662 688 663 if (isl1208->config->has_tamper && (sr & ISL1208_REG_SR_EVT)) { ··· 790 775 { 791 776 struct isl1208_state *isl1208 = priv; 792 777 struct i2c_client *client = to_i2c_client(isl1208->rtc->dev.parent); 793 - int ret; 794 778 795 779 /* nvmem sanitizes offset/count for us, but count==0 is possible */ 796 780 if (!count) 797 781 return count; 798 - ret = isl1208_i2c_read_regs(client, ISL1208_REG_USR1 + off, buf, 782 + 783 + return isl1208_i2c_read_regs(client, ISL1208_REG_USR1 + off, buf, 799 784 count); 800 - return ret == 0 ? count : ret; 801 785 } 802 786 803 787 static int isl1208_nvmem_write(void *priv, unsigned int off, void *buf, ··· 804 790 { 805 791 struct isl1208_state *isl1208 = priv; 806 792 struct i2c_client *client = to_i2c_client(isl1208->rtc->dev.parent); 807 - int ret; 808 793 809 794 /* nvmem sanitizes off/count for us, but count==0 is possible */ 810 795 if (!count) 811 796 return count; 812 - ret = isl1208_i2c_set_regs(client, ISL1208_REG_USR1 + off, buf, 813 - count); 814 797 815 - return ret == 0 ? count : ret; 798 + return isl1208_i2c_set_regs(client, ISL1208_REG_USR1 + off, buf, 799 + count); 816 800 } 817 801 818 802 static const struct nvmem_config isl1208_nvmem_config = {
+1 -1
drivers/rtc/rtc-max31335.c
··· 669 669 } 670 670 671 671 static const struct i2c_device_id max31335_id[] = { 672 - { "max31335", 0 }, 672 + { "max31335" }, 673 673 { } 674 674 }; 675 675
+1 -1
drivers/rtc/rtc-max6900.c
··· 215 215 } 216 216 217 217 static const struct i2c_device_id max6900_id[] = { 218 - { "max6900", 0 }, 218 + { "max6900" }, 219 219 { } 220 220 }; 221 221 MODULE_DEVICE_TABLE(i2c, max6900_id);
+1
drivers/rtc/rtc-mpc5121.c
··· 403 403 404 404 module_platform_driver(mpc5121_rtc_driver); 405 405 406 + MODULE_DESCRIPTION("Freescale MPC5121 built-in RTC driver"); 406 407 MODULE_LICENSE("GPL"); 407 408 MODULE_AUTHOR("John Rigby <jcrigby@gmail.com>");
+1 -1
drivers/rtc/rtc-nct3018y.c
··· 567 567 } 568 568 569 569 static const struct i2c_device_id nct3018y_id[] = { 570 - { "nct3018y", 0 }, 570 + { "nct3018y" }, 571 571 { } 572 572 }; 573 573 MODULE_DEVICE_TABLE(i2c, nct3018y_id);
+1
drivers/rtc/rtc-omap.c
··· 1027 1027 module_platform_driver(omap_rtc_driver); 1028 1028 1029 1029 MODULE_AUTHOR("George G. Davis (and others)"); 1030 + MODULE_DESCRIPTION("TI OMAP1, AM33xx, DA8xx/OMAP-L13x, AM43xx and DRA7xx RTC driver"); 1030 1031 MODULE_LICENSE("GPL");
+1 -1
drivers/rtc/rtc-pcf8523.c
··· 495 495 } 496 496 497 497 static const struct i2c_device_id pcf8523_id[] = { 498 - { "pcf8523", 0 }, 498 + { "pcf8523" }, 499 499 { } 500 500 }; 501 501 MODULE_DEVICE_TABLE(i2c, pcf8523_id);
+3 -3
drivers/rtc/rtc-pcf8563.c
··· 594 594 } 595 595 596 596 static const struct i2c_device_id pcf8563_id[] = { 597 - { "pcf8563", 0 }, 598 - { "rtc8564", 0 }, 599 - { "pca8565", 0 }, 597 + { "pcf8563" }, 598 + { "rtc8564" }, 599 + { "pca8565" }, 600 600 { } 601 601 }; 602 602 MODULE_DEVICE_TABLE(i2c, pcf8563_id);
+1 -1
drivers/rtc/rtc-pcf8583.c
··· 297 297 } 298 298 299 299 static const struct i2c_device_id pcf8583_id[] = { 300 - { "pcf8583", 0 }, 300 + { "pcf8583" }, 301 301 { } 302 302 }; 303 303 MODULE_DEVICE_TABLE(i2c, pcf8583_id);
+1
drivers/rtc/rtc-rc5t583.c
··· 308 308 module_platform_driver(rc5t583_rtc_driver); 309 309 MODULE_ALIAS("platform:rtc-rc5t583"); 310 310 MODULE_AUTHOR("Venu Byravarasu <vbyravarasu@nvidia.com>"); 311 + MODULE_DESCRIPTION("RICOH 5T583 RTC driver"); 311 312 MODULE_LICENSE("GPL v2");
+2 -2
drivers/rtc/rtc-rv3029c2.c
··· 807 807 } 808 808 809 809 static const struct i2c_device_id rv3029_id[] = { 810 - { "rv3029", 0 }, 811 - { "rv3029c2", 0 }, 810 + { "rv3029" }, 811 + { "rv3029c2" }, 812 812 { } 813 813 }; 814 814 MODULE_DEVICE_TABLE(i2c, rv3029_id);
+1 -1
drivers/rtc/rtc-rx6110.c
··· 451 451 MODULE_DEVICE_TABLE(acpi, rx6110_i2c_acpi_match); 452 452 453 453 static const struct i2c_device_id rx6110_i2c_id[] = { 454 - { "rx6110", 0 }, 454 + { "rx6110" }, 455 455 { } 456 456 }; 457 457 MODULE_DEVICE_TABLE(i2c, rx6110_i2c_id);
+1 -1
drivers/rtc/rtc-rx8010.c
··· 50 50 #define RX8010_ALARM_AE BIT(7) 51 51 52 52 static const struct i2c_device_id rx8010_id[] = { 53 - { "rx8010", 0 }, 53 + { "rx8010" }, 54 54 { } 55 55 }; 56 56 MODULE_DEVICE_TABLE(i2c, rx8010_id);
+1 -1
drivers/rtc/rtc-rx8581.c
··· 307 307 } 308 308 309 309 static const struct i2c_device_id rx8581_id[] = { 310 - { "rx8581", 0 }, 310 + { "rx8581" }, 311 311 { } 312 312 }; 313 313 MODULE_DEVICE_TABLE(i2c, rx8581_id);
+1 -1
drivers/rtc/rtc-s35390a.c
··· 50 50 #define S35390A_INT2_MODE_PMIN (BIT(3) | BIT(2)) /* INT2FE | INT2ME */ 51 51 52 52 static const struct i2c_device_id s35390a_id[] = { 53 - { "s35390a", 0 }, 53 + { "s35390a" }, 54 54 { } 55 55 }; 56 56 MODULE_DEVICE_TABLE(i2c, s35390a_id);
+1 -1
drivers/rtc/rtc-sd3078.c
··· 201 201 } 202 202 203 203 static const struct i2c_device_id sd3078_id[] = { 204 - {"sd3078", 0}, 204 + { "sd3078" }, 205 205 { } 206 206 }; 207 207 MODULE_DEVICE_TABLE(i2c, sd3078_id);
+78
drivers/rtc/rtc-stm32.c
··· 5 5 */ 6 6 7 7 #include <linux/bcd.h> 8 + #include <linux/bitfield.h> 8 9 #include <linux/clk.h> 9 10 #include <linux/errno.h> 10 11 #include <linux/iopoll.h> ··· 84 83 #define STM32_RTC_VERR_MAJREV_SHIFT 4 85 84 #define STM32_RTC_VERR_MAJREV GENMASK(7, 4) 86 85 86 + /* STM32_RTC_SECCFGR bit fields */ 87 + #define STM32_RTC_SECCFGR 0x20 88 + #define STM32_RTC_SECCFGR_ALRA_SEC BIT(0) 89 + #define STM32_RTC_SECCFGR_INIT_SEC BIT(14) 90 + #define STM32_RTC_SECCFGR_SEC BIT(15) 91 + 92 + /* STM32_RTC_RXCIDCFGR bit fields */ 93 + #define STM32_RTC_RXCIDCFGR(x) (0x80 + 0x4 * (x)) 94 + #define STM32_RTC_RXCIDCFGR_CFEN BIT(0) 95 + #define STM32_RTC_RXCIDCFGR_CID GENMASK(6, 4) 96 + #define STM32_RTC_RXCIDCFGR_CID1 1 97 + 87 98 /* STM32_RTC_WPR key constants */ 88 99 #define RTC_WPR_1ST_KEY 0xCA 89 100 #define RTC_WPR_2ND_KEY 0x53 ··· 133 120 bool has_pclk; 134 121 bool need_dbp; 135 122 bool need_accuracy; 123 + bool rif_protected; 136 124 }; 137 125 138 126 struct stm32_rtc { ··· 147 133 const struct stm32_rtc_data *data; 148 134 int irq_alarm; 149 135 }; 136 + 137 + struct stm32_rtc_rif_resource { 138 + unsigned int num; 139 + u32 bit; 140 + }; 141 + 142 + static const struct stm32_rtc_rif_resource STM32_RTC_RES_ALRA = {0, STM32_RTC_SECCFGR_ALRA_SEC}; 143 + static const struct stm32_rtc_rif_resource STM32_RTC_RES_INIT = {5, STM32_RTC_SECCFGR_INIT_SEC}; 150 144 151 145 static void stm32_rtc_wpr_unlock(struct stm32_rtc *rtc) 152 146 { ··· 575 553 .has_pclk = false, 576 554 .need_dbp = true, 577 555 .need_accuracy = false, 556 + .rif_protected = false, 578 557 .regs = { 579 558 .tr = 0x00, 580 559 .dr = 0x04, ··· 598 575 .has_pclk = true, 599 576 .need_dbp = true, 600 577 .need_accuracy = false, 578 + .rif_protected = false, 601 579 .regs = { 602 580 .tr = 0x00, 603 581 .dr = 0x04, ··· 630 606 .has_pclk = true, 631 607 .need_dbp = false, 632 608 .need_accuracy = true, 609 + .rif_protected = false, 633 610 .regs = { 634 611 .tr = 0x00, 635 612 .dr = 0x04, ··· 649 624 .clear_events = stm32mp1_rtc_clear_events, 650 625 }; 651 626 627 + static const struct stm32_rtc_data stm32mp25_data = { 628 + .has_pclk = true, 629 + .need_dbp = false, 630 + .need_accuracy = true, 631 + .rif_protected = true, 632 + .regs = { 633 + .tr = 0x00, 634 + .dr = 0x04, 635 + .cr = 0x18, 636 + .isr = 0x0C, /* named RTC_ICSR on stm32mp25 */ 637 + .prer = 0x10, 638 + .alrmar = 0x40, 639 + .wpr = 0x24, 640 + .sr = 0x50, 641 + .scr = 0x5C, 642 + .verr = 0x3F4, 643 + }, 644 + .events = { 645 + .alra = STM32_RTC_SR_ALRA, 646 + }, 647 + .clear_events = stm32mp1_rtc_clear_events, 648 + }; 649 + 652 650 static const struct of_device_id stm32_rtc_of_match[] = { 653 651 { .compatible = "st,stm32-rtc", .data = &stm32_rtc_data }, 654 652 { .compatible = "st,stm32h7-rtc", .data = &stm32h7_rtc_data }, 655 653 { .compatible = "st,stm32mp1-rtc", .data = &stm32mp1_data }, 654 + { .compatible = "st,stm32mp25-rtc", .data = &stm32mp25_data }, 656 655 {} 657 656 }; 658 657 MODULE_DEVICE_TABLE(of, stm32_rtc_of_match); 658 + 659 + static int stm32_rtc_check_rif(struct stm32_rtc *stm32_rtc, 660 + struct stm32_rtc_rif_resource res) 661 + { 662 + u32 rxcidcfgr = readl_relaxed(stm32_rtc->base + STM32_RTC_RXCIDCFGR(res.num)); 663 + u32 seccfgr; 664 + 665 + /* Check if RTC available for our CID */ 666 + if ((rxcidcfgr & STM32_RTC_RXCIDCFGR_CFEN) && 667 + (FIELD_GET(STM32_RTC_RXCIDCFGR_CID, rxcidcfgr) != STM32_RTC_RXCIDCFGR_CID1)) 668 + return -EACCES; 669 + 670 + /* Check if RTC available for non secure world */ 671 + seccfgr = readl_relaxed(stm32_rtc->base + STM32_RTC_SECCFGR); 672 + if ((seccfgr & STM32_RTC_SECCFGR_SEC) | (seccfgr & res.bit)) 673 + return -EACCES; 674 + 675 + return 0; 676 + } 659 677 660 678 static int stm32_rtc_init(struct platform_device *pdev, 661 679 struct stm32_rtc *rtc) ··· 854 786 if (rtc->data->need_dbp) 855 787 regmap_update_bits(rtc->dbp, rtc->dbp_reg, 856 788 rtc->dbp_mask, rtc->dbp_mask); 789 + 790 + if (rtc->data->rif_protected) { 791 + ret = stm32_rtc_check_rif(rtc, STM32_RTC_RES_INIT); 792 + if (!ret) 793 + ret = stm32_rtc_check_rif(rtc, STM32_RTC_RES_ALRA); 794 + if (ret) { 795 + dev_err(&pdev->dev, "Failed to probe RTC due to RIF configuration\n"); 796 + goto err; 797 + } 798 + } 857 799 858 800 /* 859 801 * After a system reset, RTC_ISR.INITS flag can be read to check if
+1
drivers/rtc/rtc-tps65910.c
··· 466 466 module_platform_driver(tps65910_rtc_driver); 467 467 MODULE_ALIAS("platform:tps65910-rtc"); 468 468 MODULE_AUTHOR("Venu Byravarasu <vbyravarasu@nvidia.com>"); 469 + MODULE_DESCRIPTION("TI TPS65910 RTC driver"); 469 470 MODULE_LICENSE("GPL");
+63 -12
drivers/rtc/rtc-tps6594.c
··· 42 42 // Multiplier for ppb conversions 43 43 #define PPB_MULT NANO 44 44 45 + struct tps6594_rtc { 46 + struct rtc_device *rtc_dev; 47 + int irq; 48 + }; 49 + 45 50 static int tps6594_rtc_alarm_irq_enable(struct device *dev, 46 51 unsigned int enabled) 47 52 { ··· 330 325 return tps6594_rtc_set_calibration(dev, calibration); 331 326 } 332 327 333 - static irqreturn_t tps6594_rtc_interrupt(int irq, void *rtc) 328 + static irqreturn_t tps6594_rtc_interrupt(int irq, void *data) 334 329 { 335 - struct device *dev = rtc; 330 + struct device *dev = data; 336 331 struct tps6594 *tps = dev_get_drvdata(dev->parent); 337 - struct rtc_device *rtc_dev = dev_get_drvdata(dev); 332 + struct tps6594_rtc *rtc = dev_get_drvdata(dev); 338 333 int ret; 339 334 u32 rtc_reg; 340 335 ··· 342 337 if (ret) 343 338 return IRQ_NONE; 344 339 345 - rtc_update_irq(rtc_dev, 1, RTC_IRQF | RTC_AF); 340 + rtc_update_irq(rtc->rtc_dev, 1, RTC_IRQF | RTC_AF); 346 341 347 342 return IRQ_HANDLED; 348 343 } ··· 361 356 { 362 357 struct tps6594 *tps = dev_get_drvdata(pdev->dev.parent); 363 358 struct device *dev = &pdev->dev; 364 - struct rtc_device *rtc; 359 + struct tps6594_rtc *rtc; 365 360 int irq; 366 361 int ret; 367 362 ··· 369 364 if (!rtc) 370 365 return -ENOMEM; 371 366 372 - rtc = devm_rtc_allocate_device(dev); 373 - if (IS_ERR(rtc)) 374 - return PTR_ERR(rtc); 367 + rtc->rtc_dev = devm_rtc_allocate_device(dev); 368 + if (IS_ERR(rtc->rtc_dev)) 369 + return PTR_ERR(rtc->rtc_dev); 375 370 376 371 // Enable crystal oscillator. 377 372 ret = regmap_set_bits(tps->regmap, TPS6594_REG_RTC_CTRL_2, ··· 420 415 if (irq < 0) 421 416 return dev_err_probe(dev, irq, "Failed to get irq\n"); 422 417 418 + rtc->irq = irq; 419 + 423 420 ret = devm_request_threaded_irq(dev, irq, NULL, tps6594_rtc_interrupt, 424 421 IRQF_ONESHOT, TPS6594_IRQ_NAME_ALARM, 425 422 dev); ··· 434 427 return dev_err_probe(dev, ret, 435 428 "Failed to init rtc as wakeup source\n"); 436 429 437 - rtc->ops = &tps6594_rtc_ops; 438 - rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; 439 - rtc->range_max = RTC_TIMESTAMP_END_2099; 430 + rtc->rtc_dev->ops = &tps6594_rtc_ops; 431 + rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_2000; 432 + rtc->rtc_dev->range_max = RTC_TIMESTAMP_END_2099; 440 433 441 - return devm_rtc_register_device(rtc); 434 + return devm_rtc_register_device(rtc->rtc_dev); 442 435 } 436 + 437 + static int tps6594_rtc_resume(struct device *dev) 438 + { 439 + struct tps6594 *tps = dev_get_drvdata(dev->parent); 440 + struct tps6594_rtc *rtc = dev_get_drvdata(dev); 441 + int ret; 442 + 443 + ret = regmap_test_bits(tps->regmap, TPS6594_REG_INT_STARTUP, 444 + TPS6594_BIT_RTC_INT); 445 + if (ret < 0) { 446 + dev_err(dev, "failed to read REG_INT_STARTUP: %d\n", ret); 447 + goto out; 448 + } 449 + 450 + if (ret > 0) { 451 + /* 452 + * If the alarm bit is set, it means that the IRQ has been 453 + * fired. But, the kernel may not have woke up yet when it 454 + * happened. So, we have to clear it. 455 + */ 456 + ret = regmap_write(tps->regmap, TPS6594_REG_RTC_STATUS, 457 + TPS6594_BIT_ALARM); 458 + if (ret < 0) 459 + dev_err(dev, "error clearing alarm bit: %d", ret); 460 + 461 + rtc_update_irq(rtc->rtc_dev, 1, RTC_IRQF | RTC_AF); 462 + } 463 + out: 464 + disable_irq_wake(rtc->irq); 465 + 466 + return 0; 467 + } 468 + 469 + static int tps6594_rtc_suspend(struct device *dev) 470 + { 471 + struct tps6594_rtc *rtc = dev_get_drvdata(dev); 472 + 473 + enable_irq_wake(rtc->irq); 474 + 475 + return 0; 476 + } 477 + 478 + static DEFINE_SIMPLE_DEV_PM_OPS(tps6594_rtc_pm_ops, tps6594_rtc_suspend, tps6594_rtc_resume); 443 479 444 480 static const struct platform_device_id tps6594_rtc_id_table[] = { 445 481 { "tps6594-rtc", }, ··· 494 444 .probe = tps6594_rtc_probe, 495 445 .driver = { 496 446 .name = "tps6594-rtc", 447 + .pm = pm_sleep_ptr(&tps6594_rtc_pm_ops), 497 448 }, 498 449 .id_table = tps6594_rtc_id_table, 499 450 };
+1
drivers/rtc/rtc-twl.c
··· 685 685 module_platform_driver(twl4030rtc_driver); 686 686 687 687 MODULE_AUTHOR("Texas Instruments, MontaVista Software"); 688 + MODULE_DESCRIPTION("TI TWL4030/TWL5030/TWL6030/TPS659x0 RTC driver"); 688 689 MODULE_LICENSE("GPL");
+1 -1
drivers/rtc/rtc-x1205.c
··· 663 663 } 664 664 665 665 static const struct i2c_device_id x1205_id[] = { 666 - { "x1205", 0 }, 666 + { "x1205" }, 667 667 { } 668 668 }; 669 669 MODULE_DEVICE_TABLE(i2c, x1205_id);