Add nxp bbnsm module support
Subsystems (6)
v2 cover Add nxp bbnsm module support
NXP BBNSM (Battery-Backed Non-Secure Module) serves as non-volatile logic and storage for the system. it provides some similar functions like RTC and ON/OFF support as previous SNVS module found on legacy i.MX SoCs. The BBNSM is replacement of previous SNVS module, and more likely it will be used on all the future i.MX SoC or other SoCs from NXP.
This patchset add the basic support for BBNSM that found on i.MX93.
Jacky Bai (4):
dt-bindings: mfd: Add nxp bbnsm
input: bbnsm_pwrkey: Add bbnsm power key support
rtc: bbnsm: Add the bbnsm rtc support
arm64: dts: imx93: Add the bbnsm dts node
.../devicetree/bindings/mfd/nxp,bbnsm.yaml | 113 +++++++++ arch/arm64/boot/dts/freescale/imx93.dtsi | 18 ++ drivers/input/keyboard/Kconfig | 11 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/nxp-bbnsm-pwrkey.c | 190 +++++++++++++++ drivers/rtc/Kconfig | 12 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-nxp-bbnsm.c | 225 ++++++++++++++++++ 8 files changed, 571 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml create mode 100644 drivers/input/keyboard/nxp-bbnsm-pwrkey.c create mode 100644 drivers/rtc/rtc-nxp-bbnsm.c
Signature · 1 line
2.37.1
PATCH v2 1/4 dt-bindings: mfd: Add nxp bbnsm
Add binding for NXP BBNSM(Battery-Backed Non-Secure Module).
---
- v2 changes:
- remove the redundant 'bindings' string
- add ref to rtc.yaml
- add start-year property
- rename 'regmap' to 'nxp,bbnsm-regmap' and add description & type define
- add header files including in the example and correct the indentation
--- .../devicetree/bindings/mfd/nxp,bbnsm.yaml | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +113 -0
@@ -0,0 +1,113 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/nxp,bbnsm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP Battery-Backed Non-Secure Module + +maintainers: + - Jacky Bai <[email protected]> + +description: | + NXP BBNSM serves as non-volatile logic and storage for the system. + it Intergrates RTC & ON/OFF control. + The RTC can retain its state and continues counting even when the + main chip is power down. A time alarm is generated once the most + significant 32 bits of the real-time counter match the value in the + Time Alarm register. + The ON/OFF logic inside the BBNSM allows for connecting directly to + a PMIC or other voltage regulator device. both smart PMIC mode and + Dumb PMIC mode supported. + +properties: + compatible: + items: + - enum: + - nxp,bbnsm + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + + rtc: + type: object + $ref: /schemas/rtc/rtc.yaml# + + properties: + compatible: + const: nxp,bbnsm-rtc + + nxp,bbnsm-regmap: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of the bbnsm node + + interrupts: + maxItems: 1 + + start-year: true + + required: + - compatible + - nxp,bbnsm-regmap + - interrupts + + additionalProperties: false + + pwrkey: + type: object + $ref: /schemas/input/input.yaml# + + properties: + compatible: + const: nxp,bbnsm-pwrkey + + nxp,bbnsm-regmap: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of the bbnsm node + + interrupts: + maxItems: 1 + + linux,code: true + + required: + - compatible + - nxp,bbnsm-regmap + - interrupts + + additionalProperties: false + +required: + - compatible + - reg + - rtc + - pwrkey + +additionalProperties: false + +examples: + - | + #include <dt-bindings/input/linux-event-codes.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + bbnsm: bbnsm@44440000 { + compatible = "nxp,bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,bbnsm-rtc"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; + linux,code = <KEY_POWER>; + }; + };
Signature · 1 line
2.37.1
Rob Herring
maintainerRe: [PATCH v2 1/4] dt-bindings: mfd: Add nxp bbnsm
Quoted 56 lines · Jacky Bai
Add binding for NXP BBNSM(Battery-Backed Non-Secure Module).
Signed-off-by Jacky Bai <[email protected]>---
- v2 changes:
- remove the redundant 'bindings' string
- add ref tortc.yaml
- add start-year property
- rename 'regmap' to 'nxp,bbnsm-regmap' and add description & type define
- add header files including in the example and correct the indentation--- .../devicetree/bindings/mfd/nxp,bbnsm.yaml | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/nxp,bbnsm.yamlDocumentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +35
-0@@ -0,0 +1,113 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/nxp,bbnsm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP Battery-Backed Non-Secure Module + +maintainers: + - Jacky Bai <[email protected]> + +description: | + NXP BBNSM serves as non-volatile logic and storage for the system. + it Intergrates RTC & ON/OFF control. + The RTC can retain its state and continues counting even when the + main chip is power down. A time alarm is generated once the most + significant 32 bits of the real-time counter match the value in the + Time Alarm register. + The ON/OFF logic inside the BBNSM allows for connecting directly to + a PMIC or other voltage regulator device. both smart PMIC mode and + Dumb PMIC mode supported. + +properties: + compatible: + items: + - enum: + - nxp,bbnsm + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + + rtc: + type: object
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml line 45
Quoted 10 lines
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +10
-0+ $ref: /schemas/rtc/rtc.yaml# + + properties: + compatible: + const: nxp,bbnsm-rtc + + nxp,bbnsm-regmap: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of the bbnsm node
You don't need this now, it's the parent node.
Quoted 15 lines
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +15
-0+ + interrupts: + maxItems: 1 + + start-year: true + + required: + - compatible + - nxp,bbnsm-regmap + - interrupts + + additionalProperties: false + + pwrkey: + type: object
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml line 70
Quoted 10 lines
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +10
-0+ $ref: /schemas/input/input.yaml# + + properties: + compatible: + const: nxp,bbnsm-pwrkey + + nxp,bbnsm-regmap: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of the bbnsm node
Same here.
Quoted 47 lines
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +43
-0+ + interrupts: + maxItems: 1 + + linux,code: true + + required: + - compatible + - nxp,bbnsm-regmap + - interrupts + + additionalProperties: false + +required: + - compatible + - reg + - rtc + - pwrkey + +additionalProperties: false + +examples: + - | + #include <dt-bindings/input/linux-event-codes.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + bbnsm: bbnsm@44440000 { + compatible = "nxp,bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,bbnsm-rtc"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; + linux,code = <KEY_POWER>; + }; + };Signature · 1 line
2.37.1
RE: [PATCH v2 1/4] dt-bindings: mfd: Add nxp bbnsm
Hi Rob,
Quoted 22 lines
Subject: Re: [PATCH v2 1/4] dt-bindings: mfd: Add nxp bbnsm
Quoted 9 lines · Jacky Bai
Add binding for NXP BBNSM(Battery-Backed Non-Secure Module).
Signed-off-by Jacky Bai <[email protected]>---
- v2 changes:
- remove the redundant 'bindings' string
- add ref tortc.yaml
- add start-year property
- rename 'regmap' to 'nxp,bbnsm-regmap' and add description & typedefine
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml line 45
Quoted 8 lines
- add header files including in the example and correct the
indentation
---Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +5
-0+ + nxp,bbnsm-regmap: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of the bbnsm node
Quoted 1 line
You don't need this now, it's the parent node.
Thx for review. yes, it is redundant, will remove it and refine the code in V3.
BR
Quoted 76 lines
Quoted 16 lines
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +15
-0+ + interrupts: + maxItems: 1 + + start-year: true + + required: + - compatible + - nxp,bbnsm-regmap + - interrupts + + additionalProperties: false + + pwrkey: + type: objectDocumentation/devicetree/bindings/mfd/nxp,bbnsm.yaml line 70
Quoted 10 lines
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +10
-0+ $ref: /schemas/input/input.yaml# + + properties: + compatible: + const: nxp,bbnsm-pwrkey + + nxp,bbnsm-regmap: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of the bbnsm nodeSame here.
Quoted 47 lines
Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file +43
-1+ + interrupts: + maxItems: 1 + + linux,code: true + + required: + - compatible + - nxp,bbnsm-regmap + - interrupts + + additionalProperties: false + +required: + - compatible + - reg + - rtc + - pwrkey + +additionalProperties: false + +examples: + - | + #include <dt-bindings/input/linux-event-codes.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + bbnsm: bbnsm@44440000 { + compatible = "nxp,bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,bbnsm-rtc"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; + linux,code = <KEY_POWER>; + }; + }; --2.37.1
PATCH v2 2/4 input: bbnsm_pwrkey: Add bbnsm power key support
In reply to Jacky BaiThe ON/OFF logic inside the BBNSM allows for connecting directly into a PMIC or other voltage regulator device. The module has an button input signal and a wakeup request input signal. It also has two interrupts (set_pwr_off_irq and set_pwr_on_irq) and an active-low PMIC enable (pmic_en_b) output.
Add the power key support for the ON/OFF button function found in BBNSM module.
---
- v2 changes:
- use device_property_read_u32() to read the property
- clean up the goto return, return directly
- sort the header file alphabetically
- rename the file to add 'nxp' prefix
--- drivers/input/keyboard/Kconfig | 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/nxp-bbnsm-pwrkey.c | 190 ++++++++++++++++++++++ 3 files changed, 202 insertions(+) create mode 100644 drivers/input/keyboard/nxp-bbnsm-pwrkey.c
drivers/input/keyboard/Kconfig +11 -0
@@ -456,6 +456,17 @@ config KEYBOARD_SNVS_PWRKEY To compile this driver as a module, choose M here; the module will be called snvs_pwrkey. +config KEYBOARD_BBNSM_PWRKEY + tristate "NXP BBNSM Power Key Driver" + depends on ARCH_MXC || COMPILE_TEST + depends on OF + help + This is the bbnsm powerkey driver for the NXP i.MX application + processors. + + To compile this driver as a module, choose M here; the + module will be called bbnsm_pwrkey. + config KEYBOARD_IMX tristate "IMX keypad support" depends on ARCH_MXC || COMPILE_TEST
drivers/input/keyboard/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o obj-$(CONFIG_KEYBOARD_APPLESPI) += applespi.o obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o +obj-$(CONFIG_KEYBOARD_BBNSM_PWRKEY) += nxp-bbnsm-pwrkey.o obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o obj-$(CONFIG_KEYBOARD_CAP11XX) += cap11xx.o obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o
drivers/input/keyboard/nxp-bbnsm-pwrkey.c new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
2.37.1
PATCH v2 3/4 rtc: bbnsm: Add the bbnsm rtc support
In reply to Jacky BaiThe BBNSM module includes a real time counter with alarm. Add a RTC driver for this function.
---
- v2 changes:
- sort the header file alphabetically
- rename the file to add 'nxp' prefix
- refine bbnsm_rtc_irq_handler function, remove the unnecessary event variable
- add rtc enable check in .read_time, remove rtc enable in probe function
- remove unnecessary dev_err log in probe function
--- drivers/rtc/Kconfig | 12 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-nxp-bbnsm.c | 225 ++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) create mode 100644 drivers/rtc/rtc-nxp-bbnsm.c
drivers/rtc/Kconfig +12 -0
@@ -1786,6 +1786,18 @@ config RTC_DRV_SNVS This driver can also be built as a module, if so, the module will be called "rtc-snvs". +config RTC_DRV_BBNSM + tristate "NXP BBNSM RTC support" + select REGMAP_MMIO + depends on ARCH_MXC || COMPILE_TEST + depends on HAS_IOMEM + depends on OF + help + If you say yes here you get support for the NXP BBNSM RTC module. + + This driver can also be built as a module, if so, the module + will be called "rtc-bbnsm". + config RTC_DRV_IMX_SC depends on IMX_SCU depends on HAVE_ARM_SMCCC
drivers/rtc/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_RTC_DRV_ASPEED) += rtc-aspeed.o obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o obj-$(CONFIG_RTC_DRV_AT91SAM9) += rtc-at91sam9.o obj-$(CONFIG_RTC_DRV_AU1XXX) += rtc-au1xxx.o +obj-$(CONFIG_RTC_DRV_BBNSM) += rtc-nxp-bbnsm.o obj-$(CONFIG_RTC_DRV_BD70528) += rtc-bd70528.o obj-$(CONFIG_RTC_DRV_BQ32K) += rtc-bq32k.o obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o
drivers/rtc/rtc-nxp-bbnsm.c new file +225 -0
225 lines not on this page · raw message
Signature · 1 line
2.37.1
Alexandre Belloni
maintainerRe: [PATCH v2 3/4] rtc: bbnsm: Add the bbnsm rtc support
drivers/rtc/rtc-nxp-bbnsm.c line 70
Quoted 9 lines · Jacky Bai
drivers/rtc/rtc-nxp-bbnsm.c new file +9
-0+static int bbnsm_rtc_read_time (struct device *dev,struct rtc_time *tm) +{ +struct bbnsm_rtc *bbnsm =dev_get_drvdata (dev); +unsigned long time; +u32 val; + +regmap_read (bbnsm->regmap,BBNSM_CTRL , &val); +if ((val &RTC_EN_MSK ) !=RTC_EN ) { +dev_warn (dev,"RTC is not enabled, time is invalid!\n" );
I don't think this message is necessary.
Quoted 9 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +9
-0+return -EINVAL ; + } + + time =bbnsm_read_counter (bbnsm); +rtc_time64_to_tm (time, tm); + +return 0 ; +} +
[...]
Quoted 4 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +4
-0+static int bbnsm_rtc_probe (struct platform_device *pdev) +{ +struct bbnsm_rtc *bbnsm; +int ret;
drivers/rtc/rtc-nxp-bbnsm.c line 178
Quoted 10 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +10
-0+ + bbnsm =devm_kzalloc (&pdev->dev,sizeof (*bbnsm),GFP_KERNEL ); +if (!bbnsm) +return -ENOMEM ; + + bbnsm->rtc =devm_rtc_allocate_device (&pdev->dev); + + bbnsm->regmap =syscon_regmap_lookup_by_phandle (pdev->dev.of_node,"nxp,bbnsm-regmap" ); +if (IS_ERR (bbnsm->regmap)) { +dev_err (&pdev->dev,"bbnsm get regmap failed\n" );
Maybe this should be a dev_dbg?
Quoted 50 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +47
-0+return PTR_ERR (bbnsm->regmap); + } + + bbnsm->irq =platform_get_irq (pdev,0 ); +if (bbnsm->irq <0 ) +return bbnsm->irq; + +platform_set_drvdata (pdev, bbnsm); + +/* clear all the pending events */ +regmap_write (bbnsm->regmap,BBNSM_EVENTS ,0x7A ); + +device_init_wakeup (&pdev->dev, true); +dev_pm_set_wake_irq (&pdev->dev, bbnsm->irq); + + ret =devm_request_irq (&pdev->dev, bbnsm->irq, bbnsm_rtc_irq_handler, +IRQF_SHARED ,"rtc alarm" , &pdev->dev); +if (ret) { +dev_err (&pdev->dev,"failed to request irq %d: %d\n" , + bbnsm->irq, ret); +return ret; + } + + bbnsm->rtc->ops = &bbnsm_rtc_ops; + bbnsm->rtc->range_max =U32_MAX ; + +return devm_rtc_register_device (bbnsm->rtc); +} + +static const struct of_device_id bbnsm_dt_ids[] = { + { .compatible ="nxp,bbnsm-rtc" , }, + {/* sentinel */ }, +}; +MODULE_DEVICE_TABLE (of, bbnsm_dt_ids); + +static struct platform_driver bbnsm_rtc_driver = { + .driver = { + .name ="bbnsm_rtc" , + .of_match_table = bbnsm_dt_ids, + }, + .probe = bbnsm_rtc_probe, +}; +module_platform_driver (bbnsm_rtc_driver); + +MODULE_AUTHOR ("Jacky Bai <[email protected]>" ); +MODULE_DESCRIPTION ("NXP BBNSM RTC Driver" ); +MODULE_LICENSE ("GPL" );Signature · 1 line
2.37.1
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
RE: [PATCH v2 3/4] rtc: bbnsm: Add the bbnsm rtc support
Quoted 15 lines
Subject: Re: [PATCH v2 3/4] rtc: bbnsm: Add the bbnsm rtc support
drivers/rtc/rtc-nxp-bbnsm.c line 70
Quoted 9 lines · Jacky Bai
drivers/rtc/rtc-nxp-bbnsm.c new file +9
-0+static int bbnsm_rtc_read_time (struct device *dev,struct rtc_time +*tm) { +struct bbnsm_rtc *bbnsm =dev_get_drvdata (dev); +unsigned long time; +u32 val; + +regmap_read (bbnsm->regmap,BBNSM_CTRL , &val); +if ((val &RTC_EN_MSK ) !=RTC_EN ) { +dev_warn (dev,"RTC is not enabled, time is invalid!\n" );I don't think this message is necessary.
Ok, will remove it.
Quoted 25 lines
Quoted 9 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +9
-0+return -EINVAL ; + } + + time =bbnsm_read_counter (bbnsm); +rtc_time64_to_tm (time, tm); + +return 0 ; +} +[...]
drivers/rtc/rtc-nxp-bbnsm.c
Quoted 11 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +11
-0+static int bbnsm_rtc_probe (struct platform_device *pdev) { +struct bbnsm_rtc *bbnsm; +int ret; + + bbnsm =devm_kzalloc (&pdev->dev,sizeof (*bbnsm),GFP_KERNEL ); +if (!bbnsm) +return -ENOMEM ; + + bbnsm->rtc =devm_rtc_allocate_device (&pdev->dev); + + bbnsm->regmap =
syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "nxp,bbnsm-regmap");
Quoted 4 lines
drivers/rtc/rtc-nxp-bbnsm.c line 178
Quoted 2 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +2
-0+if (IS_ERR (bbnsm->regmap)) { +dev_err (&pdev->dev,"bbnsm get regmap failed\n" );Maybe this should be a
dev_dbg?
Fine, will fix in V3.
BR
Quoted 63 lines
Quoted 7 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +6
-0+return PTR_ERR (bbnsm->regmap); + } + + bbnsm->irq =platform_get_irq (pdev,0 ); +if (bbnsm->irq <0 ) +return bbnsm->irq;drivers/rtc/rtc-nxp-bbnsm.c
Quoted 10 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +10
-0+ +platform_set_drvdata (pdev, bbnsm); + +/* clear all the pending events */ +regmap_write (bbnsm->regmap,BBNSM_EVENTS ,0x7A ); + +device_init_wakeup (&pdev->dev, true); +dev_pm_set_wake_irq (&pdev->dev, bbnsm->irq); + + ret = devm_request_irq(&pdev->dev, bbnsm->irq,
bbnsm_rtc_irq_handler,Quoted 20 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +20
-0+ IRQF_SHARED, "rtc alarm", &pdev->dev); +if (ret) { +dev_err (&pdev->dev,"failed to request irq %d: %d\n" , + bbnsm->irq, ret); +return ret; + } + + bbnsm->rtc->ops = &bbnsm_rtc_ops; + bbnsm->rtc->range_max =U32_MAX ; + +return devm_rtc_register_device (bbnsm->rtc); +} + +static const struct of_device_id bbnsm_dt_ids[] = { + { .compatible ="nxp,bbnsm-rtc" , }, + {/* sentinel */ }, +}; +MODULE_DEVICE_TABLE (of, bbnsm_dt_ids); + +static struct platform_driver bbnsm_rtc_driver = {drivers/rtc/rtc-nxp-bbnsm.c line 224
Quoted 10 lines
drivers/rtc/rtc-nxp-bbnsm.c new file +10
-0+ .driver = { + .name = "bbnsm_rtc", + .of_match_table = bbnsm_dt_ids, + }, + .probe = bbnsm_rtc_probe, +}; +module_platform_driver (bbnsm_rtc_driver); + +MODULE_AUTHOR ("Jacky Bai <[email protected]>" ); +MODULE_DESCRIPTION ("NXP BBNSM RTC Driver" );
MODULE_LICENSE("GPL");Quoted 3 lines
--
2.37.1--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbootlin
.com%2F&data=05%7C01%7Cping.bai%40nxp.com%7C2a4980d832274ceac4 e908dae8c4ec12%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6 38078229719156877%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwM DAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C% 7C&sdata=nfDGoPytTNjULmOzC8IMF8r%2FrHiNJehsEls6m3lPsGc%3D&reser ved=0
PATCH v2 4/4 arm64: dts: imx93: Add the bbnsm dts node
In reply to Jacky BaiAdd the bbnsm node for RTC & ON/OFF button support
---
- v2 changes:
- update the regmap property to align with binding doc
--- arch/arm64/boot/dts/freescale/imx93.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/freescale/imx93.dtsi +18 -0
@@ -229,6 +229,24 @@ iomuxc: pinctrl@443c0000 { status = "okay"; }; + bbnsm: bbnsm@44440000 { + compatible = "nxp,bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,bbnsm-rtc"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; + linux,code = <KEY_POWER>; + }; + }; + clk: clock-controller@44450000 { compatible = "fsl,imx93-ccm"; reg = <0x44450000 0x10000>;
Signature · 1 line
2.37.1