regmap: irq: add support for chips who have separate unmask registers
PATCH v2 1/3 regmap: irq: add support for chips who have separate unmask registers
From: Guo Zeng <[email protected]>
Some chips have separate unmask registers from mask registers for some consideration of concurrency SMP write performance. And this patch adds a flag for it.
An user will be CSR SiRFSoC ARM chips.
--- drivers/base/regmap/regmap-irq.c | 28 ++++++++++++++++++++++++++-- include/linux/regmap.h | 3 +++ 2 files changed, 29 insertions(+), 2 deletions(-)
drivers/base/regmap/regmap-irq.c +26 -2
@@ -63,6 +63,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data)struct regmap *map = d->map;int i, ret;u32 reg; +u32 unmask_offset;if (d->chip->runtime_pm) { ret =pm_runtime_get_sync (map->dev);
@@ -82,7 +83,22 @@ static void regmap_irq_sync_unlock(struct irq_data *data)if (d->chip->mask_invert) ret =regmap_update_bits (d->map, reg, d->mask_buf_def[i], ~d->mask_buf[i]); -else +else if (d->chip->unmask_base) { +/* set mask with mask_base register */ + ret =regmap_update_bits (d->map, reg, + d->mask_buf_def[i], ~d->mask_buf[i]); +if (ret <0 ) +dev_err (d->map->dev, +"Failed to sync unmasks in %x\n" , + reg); + unmask_offset = d->chip->unmask_base - + d->chip->mask_base; +/* clear mask with unmask_base register */ + ret =regmap_update_bits (d->map, + reg + unmask_offset, + d->mask_buf_def[i], + d->mask_buf[i]); + }else ret =regmap_update_bits (d->map, reg, d->mask_buf_def[i], d->mask_buf[i]);if (ret !=0 )
@@ -339,6 +355,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,int i;int ret = -ENOMEM ;u32 reg; +u32 unmask_offset;if (chip->num_regs <=0 )return -EINVAL ;
@@ -420,7 +437,14 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,if (chip->mask_invert) ret =regmap_update_bits (map, reg, d->mask_buf[i], ~d->mask_buf[i]); -else +else if (d->chip->unmask_base) { + unmask_offset = d->chip->unmask_base - + d->chip->mask_base; + ret =regmap_update_bits (d->map, + reg + unmask_offset, + d->mask_buf[i], + d->mask_buf[i]); + }else ret =regmap_update_bits (map, reg, d->mask_buf[i], d->mask_buf[i]);if (ret !=0 ) {
include/linux/regmap.h +3 -0
@@ -800,6 +800,8 @@ struct regmap_irq {* * @status_base: Base status register address. * @mask_base: Base mask register address. +* @unmask_base: Base unmask register address. for chips who have +* separate mask and unmask registers * @ack_base: Base ack address. If zero then the chip is clear on read. * Using zero value is possible with @use_ack bit. * @wake_base: Base address for wake enables. If zero unsupported.
@@ -820,6 +822,7 @@ struct regmap_irq_chip {unsigned int status_base;unsigned int mask_base; +unsigned int unmask_base;unsigned int ack_base;unsigned int wake_base;unsigned int irq_reg_stride;
Signature · 1 line
1.9.1
PATCH v2 2/3 regmap: irq: add ack_invert flag for chips using cleared bits as ack
From: Guo Zeng <[email protected]>
An user will be CSR SiRFSoC ARM chips.
--- drivers/base/regmap/regmap-irq.c | 12 ++++++++++-- include/linux/regmap.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-)
drivers/base/regmap/regmap-irq.c +10 -2
@@ -132,7 +132,11 @@ static void regmap_irq_sync_unlock(struct irq_data *data)if (d->mask_buf[i] && (d->chip->ack_base || d->chip->use_ack)) { reg = d->chip->ack_base + (i * map->reg_stride * d->irq_reg_stride); - ret =regmap_write (map, reg, d->mask_buf[i]); +/* some chips ack by write 0 */ +if (d->chip->ack_invert) + ret =regmap_write (map, reg, ~d->mask_buf[i]); +else + ret =regmap_write (map, reg, d->mask_buf[i]);if (ret !=0 )dev_err (d->map->dev,"Failed to ack 0x%x: %d\n" , reg, ret);
@@ -469,7 +473,11 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,if (d->status_buf[i] && (chip->ack_base || chip->use_ack)) { reg = chip->ack_base + (i * map->reg_stride * d->irq_reg_stride); - ret =regmap_write (map, reg, +if (chip->ack_invert) + ret =regmap_write (map, reg, + ~(d->status_buf[i] & d->mask_buf[i])); +else + ret =regmap_write (map, reg, d->status_buf[i] & d->mask_buf[i]);if (ret !=0 ) { dev_err(map->dev, "Failed to ack 0x%x: %d\n",
include/linux/regmap.h +2 -0
@@ -809,6 +809,7 @@ struct regmap_irq {* @init_ack_masked: Ack all masked interrupts once during initalization. * @mask_invert: Inverted mask register: cleared bits are masked out. * @use_ack: Use @ack register even if it is zero. +* @ack_invert: Inverted ack register: cleared bits for ack. * @wake_invert: Inverted wake register: cleared bits are wake enabled. * @runtime_pm: Hold a runtime PM lock on the device when accessing it. *
@@ -829,6 +830,7 @@ struct regmap_irq_chip { bool init_ack_masked:1; bool mask_invert:1; bool use_ack:1; + bool ack_invert:1; bool wake_invert:1; bool runtime_pm:1;
Signature · 1 line
1.9.1
PATCH v2 3/3 mfd: add CSR SiRFSoC on-chip power management module driver
In reply to Barry SongFrom: Guo Zeng <[email protected]>
CSR SiRFSoC Power Control Module includes power on or power off for sysctl power and gnss, it also includes onkey, RTC domain clock controllers and interrupt controller for power events.
--- .../devicetree/bindings/mfd/sirf-pwrc.txt | 37 ++++ drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 2 + drivers/mfd/sirfsoc_pwrc.c | 238 +++++++++++++++++++++ include/linux/mfd/sirfsoc_pwrc.h | 97 +++++++++ 5 files changed, 386 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/sirf-pwrc.txt create mode 100644 drivers/mfd/sirfsoc_pwrc.c create mode 100644 include/linux/mfd/sirfsoc_pwrc.h
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +37 -0
@@ -0,0 +1,37 @@ +SiRFSoC Power Controller (PWRC) module + +Power Controller is used to control the whole SoC power process. +The power controller controls the process of Power-On sequence, +Power-Off sequence, different power modes switching and power +status configuration. the pwrc is access by io bridge, so the +node's parent should be io bridge. + +Required properties: +- compatible: "sirf,prima2-pwrc", or "sirf,atlas7-pwrc" +- reg: Address range of pwrc register set +- sysctl:mfd cell device of pwrc +- rtcm-clk:mfd cell device of pwrc +- onkey:mfd cell device of pwrc + +Example: + +pwrc@3000 { + compatible = "sirf,atlas7-pwrc"; + reg = <0x3000 0x100>; + sysctl { + compatible = "sirf,sirf-sysctl"; + }; + + rtcm-clk { + compatible = "sirf,atlas7-rtcmclk"; + }; + + onkey { + compatible = "sirf,prima2-onkey"; + }; +}; + +pwrc@3000 { + compatible = "sirf,prima2-pwrc"; + reg = <0x3000 0x100>; +};
drivers/mfd/Kconfig +12 -0
@@ -1515,5 +1515,17 @@ config MFD_VEXPRESS_SYSREG System Registers are the platform configuration block on the ARM Ltd. Versatile Express board. +config MFD_SIRFSOC_PWRC + bool "CSR SiRFSoC on-chip Power Control Module" + depends on ARCH_SIRF + default y + select MFD_CORE + select REGMAP_IRQ + help + CSR SiRFSoC Power Control Module includes power on or power + off for sysctl power and gnss, it also includes onkey, RTC + domain clock controllers and interrupt controller for power + events. + endmenu endif
drivers/mfd/Makefile +2 -0
@@ -192,3 +192,5 @@ obj-$(CONFIG_MFD_SKY81452) += sky81452.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o obj-$(CONFIG_MFD_MT6397) += mt6397-core.o + +obj-$(CONFIG_MFD_SIRFSOC_PWRC) += sirfsoc_pwrc.o
drivers/mfd/sirfsoc_pwrc.c new file +238 -0
238 lines not on this page · raw message
include/linux/mfd/sirfsoc_pwrc.h new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
Quoted 6 lines · Barry Song
From: Guo Zeng <[email protected]>
CSR SiRFSoC Power Control Module includes power on or power off for sysctl power and gnss, it also includes onkey, RTC domain clock controllers and interrupt controller for power events.
There are lots of Three (and four) Letter Abbreviations (TLAs) here, which mean nothing to the average reader. Please break them out in the commit log as I have done i.e. "Long Abbreviated Word (LAW)", so us normies can see what they mean.
Quoted 4 lines
Signed-off-by Guo Zeng <[email protected]>Signed-off-by Barry Song <[email protected]>--- .../devicetree/bindings/mfd/sirf-pwrc.txt | 37 ++++
This should be in a separate patch.
Quoted 15 lines
drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 2 + drivers/mfd/sirfsoc_pwrc.c | 238 +++++++++++++++++++++ include/linux/mfd/sirfsoc_pwrc.h | 97 +++++++++ 5 files changed, 386 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/sirf-pwrc.txt create mode 100644 drivers/mfd/sirfsoc_pwrc.c create mode 100644 include/linux/mfd/sirfsoc_pwrc.hDocumentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +0
-0
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +4
-0@@ -0,0 +1,37 @@ +SiRFSoC Power Controller (PWRC) module + +Power Controller is used to control the whole SoC power process. +The power controller controls the process of Power-On sequence,
s/power controller/Power Controller/
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 6
Quoted 2 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +2
-0+Power-Off sequence, different power modes switching and power +status configuration. the pwrc is access by io bridge, so the
s/the pwrc/The PWRC/
s/access/accessed/
s/io/IO/
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 7
Quoted 1 line
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +1
-0+node's parent should be io bridge.
s/io/IO/
Not quite sure what an IO bridge is though.
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 11
Quoted 3 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +3
-0+Required properties: +- compatible: "sirf,prima2-pwrc", or "sirf,atlas7-pwrc" +- reg: Address range of pwrc register set
Address start and size.
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 14
Quoted 3 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +3
-0+- sysctl:mfd cell device of pwrc +- rtcm-clk:mfd cell device of pwrc +- onkey:mfd cell device of pwrc
MFD is a Linuxisum. Please find another way to document them.
I always find documentation easier to read then it's tabbed out nicely. Like:
Required properties:
- compatible : "sirf,prima2-pwrc", or "sirf,atlas7-pwrc"
- reg : Address range of pwrc register set
- sysctl : mfd cell device of pwrc
- rtcm-clk : mfd cell device of pwrc
- onkey : mfd cell device of pwrc
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 20
Quoted 5 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +5
-0+Example: + +pwrc@3000 { + compatible = "sirf,atlas7-pwrc"; + reg = <0x3000 0x100>;
This doesn't look like a real address. It looks like an offset. Please provide a full example, complete with the parent node (which I assume has ranges set-up).
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 31
Quoted 11 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +11
-0+ sysctl { + compatible = "sirf,sirf-sysctl"; + }; + + rtcm-clk { + compatible = "sirf,atlas7-rtcmclk"; + }; + + onkey { + compatible = "sirf,prima2-onkey"; + };
Why do these require their own cells?
Do they have their own properties? If so, where are they documented?
Quoted 15 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +6
-0+}; + +pwrc@3000 { + compatible = "sirf,prima2-pwrc"; + reg = <0x3000 0x100>; +};drivers/mfd/Kconfig +1
-0@@ -1515,5 +1515,17 @@ config MFD_VEXPRESS_SYSREG System Registers are the platform configuration block on the ARM Ltd. Versatile Express board. +config MFD_SIRFSOC_PWRC
drivers/mfd/Kconfig config MFD_VEXPRESS_SYSREG · line 1528
Quoted 10 lines
drivers/mfd/Kconfig +10
-0+ bool "CSR SiRFSoC on-chip Power Control Module" + depends on ARCH_SIRF + default y + select MFD_CORE + select REGMAP_IRQ + help + CSR SiRFSoC Power Control Module includes power on or power + off for sysctl power and gnss, it also includes onkey, RTC + domain clock controllers and interrupt controller for power + events.
Break out the TLAs.
Your tabbing is all over the place here. Please match existing entries.
Quoted 18 lines
drivers/mfd/Kconfig +0
-0endmenu endifdrivers/mfd/Makefile +2
-0@@ -192,3 +192,5 @@ obj-$(CONFIG_MFD_SKY81452) += sky81452.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o obj-$(CONFIG_MFD_MT6397) += mt6397-core.o + +obj-$(CONFIG_MFD_SIRFSOC_PWRC) += sirfsoc_pwrc.odrivers/mfd/sirfsoc_pwrc.c new file +0
-0
drivers/mfd/sirfsoc_pwrc.c line 2
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0@@ -0,0 +1,238 @@ +/* +* power management mfd for CSR SiRFSoC chips
"Power Management MFD for CSR SiRFSoC chips"
drivers/mfd/sirfsoc_pwrc.c line 3
Quoted 1 line
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+* Copyright (c) 2014 Cambridge Silicon Radio Limited, a CSR plc group company.
This is out of date.
drivers/mfd/sirfsoc_pwrc.c line 14
Quoted 9 lines
drivers/mfd/sirfsoc_pwrc.c new file +9
-0+* Licensed under GPLv2 or later. +*/ + +#include <linux/kernel.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/io.h> +#include <linux/regmap.h> +#include <linux/module.h>
This isn't a module.
drivers/mfd/sirfsoc_pwrc.c line 15
Quoted 1 line
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+#include <linux/rtc/sirfsoc_rtciobrg.h>
What's this for?
drivers/mfd/sirfsoc_pwrc.c line 17
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+#include <linux/mfd/core.h> +#include <linux/mfd/sirfsoc_pwrc.h>
Header files should be in alphabetical order.
Quoted 50 lines
drivers/mfd/sirfsoc_pwrc.c new file +50
-0+struct sirfsoc_pwrc_register sirfsoc_a7da_pwrc = { + .pwrc_pdn_ctrl_set =0x0 , + .pwrc_pdn_ctrl_clr =0x4 , + .pwrc_pon_status =0x8 , + .pwrc_trigger_en_set =0xc , + .pwrc_trigger_en_clr =0x10 , + .pwrc_int_mask_set =0x14 , + .pwrc_int_mask_clr =0x18 , + .pwrc_int_status =0x1c , + .pwrc_pin_status =0x20 , + .pwrc_rtc_pll_ctrl =0x28 , + .pwrc_gpio3_debug =0x34 , + .pwrc_rtc_noc_pwrctl_set =0x38 , + .pwrc_rtc_noc_pwrctl_clr =0x3c , + .pwrc_rtc_can_ctrl =0x48 , + .pwrc_rtc_can_status =0x4c , + .pwrc_fsm_m3_ctrl =0x50 , + .pwrc_fsm_state =0x54 , + .pwrc_rtcldo_reg =0x58 , + .pwrc_gnss_ctrl =0x5c , + .pwrc_gnss_status =0x60 , + .pwrc_xtal_reg =0x64 , + .pwrc_xtal_ldo_mux_sel =0x68 , + .pwrc_rtc_sw_rstc_set =0x6c , + .pwrc_rtc_sw_rstc_clr =0x70 , + .pwrc_power_sw_ctrl_set =0x74 , + .pwrc_power_sw_ctrl_clr =0x78 , + .pwrc_rtc_dcog =0x7c , + .pwrc_m3_memories =0x80 , + .pwrc_can0_memory =0x84 , + .pwrc_rtc_gnss_memory =0x88 , + .pwrc_m3_clk_en =0x8c , + .pwrc_can0_clk_en =0x90 , + .pwrc_spi0_clk_en =0x94 , + .pwrc_rtc_sec_clk_en =0x98 , + .pwrc_rtc_noc_clk_en =0x9c , +}; + +struct sirfsoc_pwrc_register sirfsoc_prima2_pwrc = { + .pwrc_pdn_ctrl_set =0x0 , + .pwrc_pon_status =0x4 , + .pwrc_trigger_en_set =0x8 , + .pwrc_int_status =0xc , + .pwrc_int_mask_set =0x10 , + .pwrc_pin_status =0x14 , + .pwrc_scratch_pad1 =0x18 , + .pwrc_scratch_pad2 =0x1c , + .pwrc_scratch_pad3 =0x20 , + .pwrc_scratch_pad4 =0x24 , + .pwrc_scratch_pad5 =0x28 ,
drivers/mfd/sirfsoc_pwrc.c line 78
Quoted 10 lines
drivers/mfd/sirfsoc_pwrc.c new file +10
-0+ .pwrc_scratch_pad6 = 0x2c, + .pwrc_scratch_pad7 = 0x30, + .pwrc_scratch_pad8 = 0x34, + .pwrc_scratch_pad9 = 0x38, + .pwrc_scratch_pad10 = 0x3c, + .pwrc_scratch_pad11 = 0x40, + .pwrc_scratch_pad12 = 0x44, + .pwrc_gpio3_clk = 0x54, + .pwrc_gpio_ds = 0x78, +};
This is not the way we usually define register addresses.
Please #define them properly.
drivers/mfd/sirfsoc_pwrc.c line 83
Quoted 4 lines
drivers/mfd/sirfsoc_pwrc.c new file +4
-0+static const struct regmap_irq pwrc_irqs[] = { +/* INT0 */ + [PWRC_IRQ_ONKEY ] = { + .mask =BIT (PWRC_IRQ_ONKEY ),
Better to do the BIT() shifting in the header file.
Quoted 10 lines
drivers/mfd/sirfsoc_pwrc.c new file +10
-0+ }, + [PWRC_IRQ_EXT_ONKEY ] = { + .mask =BIT (PWRC_IRQ_EXT_ONKEY ), + }, +}; + +static struct regmap_irq_chip pwrc_irq_chip = { + .name ="pwrc_irq" , + .irqs = pwrc_irqs, + .num_irqs =ARRAY_SIZE (pwrc_irqs),
drivers/mfd/sirfsoc_pwrc.c line 103
Quoted 10 lines
drivers/mfd/sirfsoc_pwrc.c new file +10
-0+ .num_regs = 1, + .ack_invert = 1, + .init_ack_masked = true, +}; + +static const struct of_device_id pwrc_ids[] = { + { .compatible ="sirf,prima2-pwrc" , .data = &sirfsoc_prima2_pwrc}, + { .compatible ="sirf,atlas7-pwrc" , .data = &sirfsoc_a7da_pwrc}, + {} +};
Please put these _just_ before you use them, so just above .probe() in this case.
Quoted 26 lines
drivers/mfd/sirfsoc_pwrc.c new file +26
-0+static const struct mfd_cell pwrc_devs[] = { + { + .name ="rtcmclk" , + .of_compatible ="sirf,atlas7-rtcmclk" , + }, { + .name ="sirf-sysctl" , + .of_compatible ="sirf,sirf-sysctl" , + }, { + .name ="gps-power" , + .of_compatible ="sirf,gps-power" , + }, { + .name ="onkey" , + .of_compatible ="sirf,prima2-onkey" , + }, +}; + +static const struct regmap_config pwrc_regmap_config = { + .fast_io = true, + .reg_bits =32 , + .val_bits =32 , + .reg_stride =4 , +}; + +static int sirfsoc_pwrc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node;
drivers/mfd/sirfsoc_pwrc.c line 140
Quoted 10 lines
drivers/mfd/sirfsoc_pwrc.c new file +10
-0+const struct of_device_id *match; +struct sirfsoc_pwrc_info *pwrcinfo; +struct regmap_irq_chip *regmap_irq_chip; +struct sirfsoc_pwrc_register *pwrc_reg; +struct regmap *map; +int ret; +u32 base; + +if (of_property_read_u32 (np,"reg" , &base)) +panic ("unable to find base address of pwrc node in dtb\n" );
It looks like this driver should depend on OF.
Why are you obtaining the base address manually? Use:
res = platform_get_resource(); devm_ioremap_resource(res);
... instead.
drivers/mfd/sirfsoc_pwrc.c line 143
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+ pwrcinfo =devm_kzalloc (&pdev->dev, +sizeof (struct sirfsoc_pwrc_info ),GFP_KERNEL );
sizeof(pwrcinfo)
drivers/mfd/sirfsoc_pwrc.c line 151
Quoted 8 lines
drivers/mfd/sirfsoc_pwrc.c new file +8
-0+if (!pwrcinfo) +return -ENOMEM ; + pwrcinfo->base = base; + +/* +* pwrc behind rtciobrg offset is diff between prima2 and atlas7 +* here match to each ids data for it. +*/
Use uppercase characters for abbreviations.
Besides, I have no idea what you're trying to say.
drivers/mfd/sirfsoc_pwrc.c line 153
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+ match =of_match_node (pwrc_ids, np); + pwrcinfo->pwrc_reg = (struct sirfsoc_pwrc_register *)match->data;
It looks like you're trying to use the same variables two different device's register sets. That's asking for trouble, please don't do that.
drivers/mfd/sirfsoc_pwrc.c line 160
Quoted 6 lines
drivers/mfd/sirfsoc_pwrc.c new file +6
-0+if (of_device_is_compatible (np,"sirf,atlas7-pwrc" )) + pwrcinfo->ver =PWRC_ATLAS7_VER ; +else if (of_device_is_compatible (np,"sirf,prima2-pwrc" )) + pwrcinfo->ver =PWRC_PRIMA2_VER ; +else +return -EINVAL ;
These aren't versions, are they? It's different hardware.
Can't you probe for this at runtime?
drivers/mfd/sirfsoc_pwrc.c line 162
Quoted 1 line
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+of_node_put (np);
What are you putting here?
drivers/mfd/sirfsoc_pwrc.c line 165
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+ map = (struct regmap *)devm_regmap_init_iobg (&pdev->dev, + &pwrc_regmap_config);
Why are you casting?
drivers/mfd/sirfsoc_pwrc.c line 170
Quoted 5 lines
drivers/mfd/sirfsoc_pwrc.c new file +5
-0+if (IS_ERR (map)) { + ret =PTR_ERR (map); +dev_err (&pdev->dev,"Failed to allocate register map: %d\n" , + ret); + goto err;
Please remove the 'err' label and just return from here.
drivers/mfd/sirfsoc_pwrc.c line 180
Quoted 10 lines
drivers/mfd/sirfsoc_pwrc.c new file +10
-0+ } + + pwrcinfo->regmap = map; + pwrcinfo->dev = &pdev->dev; +platform_set_drvdata (pdev, pwrcinfo); + + ret =mfd_add_devices (pwrcinfo->dev,0 , pwrc_devs, +ARRAY_SIZE (pwrc_devs),NULL ,0 ,NULL ); +if (ret) { +dev_err (&pdev->dev,"Failed to add all pwrc subdev\n" );
Capitalise all abbreviations.
Don't abbreviate things like "sub devices".
drivers/mfd/sirfsoc_pwrc.c line 172
Quoted 1 line
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+ goto err;
Just return.
drivers/mfd/sirfsoc_pwrc.c line 184
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ } + + ret =of_irq_get (pdev->dev.of_node,0 );
You already put this in to a succinct variable 'np'. Please use it.
drivers/mfd/sirfsoc_pwrc.c line 187
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+if (ret <=0 ) { +dev_info (&pdev->dev, +"Unable to find IRQ for pwrc. ret=%d\n" , ret);
Just print ret. No need for the ugly "ret=".
drivers/mfd/sirfsoc_pwrc.c line 191
Quoted 4 lines
drivers/mfd/sirfsoc_pwrc.c new file +4
-0+ goto err_irq; + } + + pwrcinfo->irq = ret;
Better change this to 'irq' instead of using 'ret'.
drivers/mfd/sirfsoc_pwrc.c line 203
Quoted 12 lines
drivers/mfd/sirfsoc_pwrc.c new file +12
-0+ regmap_irq_chip = &pwrc_irq_chip; + pwrcinfo->regmap_irq_chip = regmap_irq_chip; + + pwrc_reg = pwrcinfo->pwrc_reg; + regmap_irq_chip->mask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_set; + regmap_irq_chip->unmask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_clr; + regmap_irq_chip->status_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status; + regmap_irq_chip->ack_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status;
This is ugly.
Better to create 2 regmap_irq_chip structures, one for each device.
drivers/mfd/sirfsoc_pwrc.c line 205
Quoted 1 line
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+/* enable onkey trigger interrupt controller */
Capital letters to start a sentence.
drivers/mfd/sirfsoc_pwrc.c line 214
Quoted 9 lines
drivers/mfd/sirfsoc_pwrc.c new file +9
-0+ ret =regmap_update_bits (map, + pwrcinfo->base + + pwrc_reg->pwrc_trigger_en_set, +BIT (PWRC_IRQ_ONKEY ) |BIT (PWRC_IRQ_EXT_ONKEY ), +BIT (PWRC_IRQ_ONKEY ) |BIT (PWRC_IRQ_EXT_ONKEY )); +if (ret <0 ) + goto err_irq; + +/* add irq controller for pwrc */
Capital letters to start a sentence and for abbreviations.
drivers/mfd/sirfsoc_pwrc.c line 227
Quoted 13 lines
drivers/mfd/sirfsoc_pwrc.c new file +13
-0+ ret =regmap_add_irq_chip (map, pwrcinfo->irq,IRQF_ONESHOT , +-1 , pwrcinfo->regmap_irq_chip, + &pwrcinfo->irq_data); + +if (ret) { +dev_err (&pdev->dev,"Failed to add regmap irq controller for pwrc\n" ); + goto err; + } + +return 0 ; +err_irq: +mfd_remove_devices (pwrcinfo->dev); +err:
Remove this label, it's not helpful.
drivers/mfd/sirfsoc_pwrc.c line 232
Quoted 5 lines
drivers/mfd/sirfsoc_pwrc.c new file +5
-0+return ret; +} + +static struct platform_driver sirfsoc_pwrc_driver = { + .probe = sirfsoc_pwrc_probe,
.remove?
drivers/mfd/sirfsoc_pwrc.c line 235
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ .driver = { + .name = "sirfsoc_pwrc", + .of_match_table = pwrc_ids,
of_match_ptr()
drivers/mfd/sirfsoc_pwrc.c line 238
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ }, +}; +module_platform_driver (sirfsoc_pwrc_driver);
This isn't a module.
include/linux/mfd/sirfsoc_pwrc.h line 4
Quoted 10 lines
include/linux/mfd/sirfsoc_pwrc.h new file +4
-0@@ -0,0 +1,97 @@ +/* +* CSR SiRFSoC power control module MFD interface +* +* Copyright (c) 2014 Cambridge Silicon Radio Limited, a CSR plc group company.
Out of date.
include/linux/mfd/sirfsoc_pwrc.h line 6
Quoted 2 lines
include/linux/mfd/sirfsoc_pwrc.h new file +2
-0+* Licensed under GPLv2 or later. +*/
'\n' here.
include/linux/mfd/sirfsoc_pwrc.h line 9
Quoted 2 lines
include/linux/mfd/sirfsoc_pwrc.h new file +2
-0+#ifndef _SIRFSOC_PWRC_H_ +#define _SIRFSOC_PWRC_H_
'\n' here.
include/linux/mfd/sirfsoc_pwrc.h line 10
Quoted 1 line
include/linux/mfd/sirfsoc_pwrc.h new file +1
-0+#include <linux/interrupt.h>
What's this for?
Quoted 50 lines
include/linux/mfd/sirfsoc_pwrc.h new file +50
-0+#include <linux/regmap.h> + +#define PWRC_PDN_CTRL_OFFSET 0 +#define AUDIO_POWER_EN_BIT 14 + +struct sirfsoc_pwrc_register { +/* hardware pwrc specific */ +u32 pwrc_pdn_ctrl_set; +u32 pwrc_pdn_ctrl_clr; +u32 pwrc_pon_status; +u32 pwrc_trigger_en_set; +u32 pwrc_trigger_en_clr; +u32 pwrc_int_mask_set; +u32 pwrc_int_mask_clr; +u32 pwrc_int_status; +u32 pwrc_pin_status; +u32 pwrc_rtc_pll_ctrl; +u32 pwrc_gpio3_debug; +u32 pwrc_rtc_noc_pwrctl_set; +u32 pwrc_rtc_noc_pwrctl_clr; +u32 pwrc_rtc_can_ctrl; +u32 pwrc_rtc_can_status; +u32 pwrc_fsm_m3_ctrl; +u32 pwrc_fsm_state; +u32 pwrc_rtcldo_reg; +u32 pwrc_gnss_ctrl; +u32 pwrc_gnss_status; +u32 pwrc_xtal_reg; +u32 pwrc_xtal_ldo_mux_sel; +u32 pwrc_rtc_sw_rstc_set; +u32 pwrc_rtc_sw_rstc_clr; +u32 pwrc_power_sw_ctrl_set; +u32 pwrc_power_sw_ctrl_clr; +u32 pwrc_rtc_dcog; +u32 pwrc_m3_memories; +u32 pwrc_can0_memory; +u32 pwrc_rtc_gnss_memory; +u32 pwrc_m3_clk_en; +u32 pwrc_can0_clk_en; +u32 pwrc_spi0_clk_en; +u32 pwrc_rtc_sec_clk_en; +u32 pwrc_rtc_noc_clk_en; + +/*only for prima2*/ +u32 pwrc_scratch_pad1; +u32 pwrc_scratch_pad2; +u32 pwrc_scratch_pad3; +u32 pwrc_scratch_pad4; +u32 pwrc_scratch_pad5; +u32 pwrc_scratch_pad6;
include/linux/mfd/sirfsoc_pwrc.h line 70
Quoted 10 lines
include/linux/mfd/sirfsoc_pwrc.h new file +10
-0+u32 pwrc_scratch_pad7; +u32 pwrc_scratch_pad8; +u32 pwrc_scratch_pad9; +u32 pwrc_scratch_pad10; +u32 pwrc_scratch_pad11; +u32 pwrc_scratch_pad12; +u32 pwrc_gpio3_clk; +u32 pwrc_gpio_ds; + +};
Please #define these instead.
include/linux/mfd/sirfsoc_pwrc.h line 76
Quoted 5 lines
include/linux/mfd/sirfsoc_pwrc.h new file +5
-0+enum pwrc_version { +PWRC_MARCO_VER , +PWRC_PRIMA2_VER , +PWRC_ATLAS7_VER , +};
Kerneldoc header?
include/linux/mfd/sirfsoc_pwrc.h line 83
Quoted 6 lines
include/linux/mfd/sirfsoc_pwrc.h new file +6
-0+struct sirfsoc_pwrc_info { +struct device *dev; +struct regmap *regmap; +struct sirfsoc_pwrc_register *pwrc_reg; +struct regmap_irq_chip *regmap_irq_chip; +struct regmap_irq_chip_data *irq_data;
Where are these reused?
include/linux/mfd/sirfsoc_pwrc.h line 84
Quoted 1 line
include/linux/mfd/sirfsoc_pwrc.h new file +1
-0+u32 ver;
What is this used for?
include/linux/mfd/sirfsoc_pwrc.h line 82
Quoted 1 line
include/linux/mfd/sirfsoc_pwrc.h new file +1
-0+u32 base;
Is this a u32 or a memory address?
Quoted 12 lines
include/linux/mfd/sirfsoc_pwrc.h new file +12
-0+ int irq; +}; + +enum { +PWRC_IRQ_ONKEY =0 , +PWRC_IRQ_EXT_ONKEY , +PWRC_MAX_IRQ , +}; + +extern struct sirfsoc_pwrc_register sirfsoc_a7da_pwrc; +extern struct sirfsoc_pwrc_register sirfsoc_prima2_pwrc; +#endif
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
hi Lee,
thanks very much!
2015-09-20 12:15 GMT+08:00 Lee Jones <[email protected]>:
Quoted 176 lines · Barry Song
Quoted 7 lines
From: Guo Zeng <[email protected]>
CSR SiRFSoC Power Control Module includes power on or power off for sysctl power and gnss, it also includes onkey, RTC domain clock controllers and interrupt controller for power events.
There are lots of Three (and four) Letter Abbreviations (TLAs) here, which mean nothing to the average reader. Please break them out in the commit log as I have done i.e. "Long Abbreviated Word (LAW)", so us normies can see what they mean.
Quoted 4 lines
Signed-off-by Guo Zeng <[email protected]>Signed-off-by Barry Song <[email protected]>--- .../devicetree/bindings/mfd/sirf-pwrc.txt | 37 ++++This should be in a separate patch.
Quoted 15 lines
drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 2 + drivers/mfd/sirfsoc_pwrc.c | 238 +++++++++++++++++++++ include/linux/mfd/sirfsoc_pwrc.h | 97 +++++++++ 5 files changed, 386 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/sirf-pwrc.txt create mode 100644 drivers/mfd/sirfsoc_pwrc.c create mode 100644 include/linux/mfd/sirfsoc_pwrc.hDocumentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +0
-0Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +4
-0@@ -0,0 +1,37 @@ +SiRFSoC Power Controller (PWRC) module + +Power Controller is used to control the whole SoC power process. +The power controller controls the process of Power-On sequence,s/power controller/Power Controller/
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 6
Quoted 2 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +2
-0+Power-Off sequence, different power modes switching and power +status configuration. the pwrc is access by io bridge, so thes/the pwrc/The PWRC/
s/access/accessed/
s/io/IO/
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 7
Quoted 1 line
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +1
-0+node's parent should be io bridge.s/io/IO/
Not quite sure what an IO bridge is though.
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 11
Quoted 3 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +3
-0+Required properties: +- compatible: "sirf,prima2-pwrc", or "sirf,atlas7-pwrc" +- reg: Address range of pwrc register setAddress start and size.
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 14
Quoted 3 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +3
-0+- sysctl:mfd cell device of pwrc +- rtcm-clk:mfd cell device of pwrc +- onkey:mfd cell device of pwrcMFD is a Linuxisum. Please find another way to document them.
I always find documentation easier to read then it's tabbed out nicely. Like:
Required properties:
- compatible : "sirf,prima2-pwrc", or "sirf,atlas7-pwrc" - reg : Address range of pwrc register set - sysctl : mfd cell device of pwrc - rtcm-clk : mfd cell device of pwrc - onkey : mfd cell device of pwrcDocumentation/devicetree/bindings/mfd/sirf-pwrc.txt line 20
Quoted 5 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +5
-0+Example: + +pwrc@3000 { + compatible = "sirf,atlas7-pwrc"; + reg = <0x3000 0x100>;This doesn't look like a real address. It looks like an offset. Please provide a full example, complete with the parent node (which I assume has ranges set-up).
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt line 31
Quoted 11 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +11
-0+ sysctl { + compatible = "sirf,sirf-sysctl"; + }; + + rtcm-clk { + compatible = "sirf,atlas7-rtcmclk"; + }; + + onkey { + compatible = "sirf,prima2-onkey"; + };Why do these require their own cells?
Do they have their own properties? If so, where are they documented?
Quoted 15 lines
Documentation/devicetree/bindings/mfd/sirf-pwrc.txt new file +6
-0+}; + +pwrc@3000 { + compatible = "sirf,prima2-pwrc"; + reg = <0x3000 0x100>; +};drivers/mfd/Kconfig +1
-0@@ -1515,5 +1515,17 @@ config MFD_VEXPRESS_SYSREG System Registers are the platform configuration block on the ARM Ltd. Versatile Express board. +config MFD_SIRFSOC_PWRCdrivers/mfd/Kconfig config MFD_VEXPRESS_SYSREG · line 1528
Quoted 10 lines
drivers/mfd/Kconfig +10
-0+ bool "CSR SiRFSoC on-chip Power Control Module" + depends on ARCH_SIRF + default y + select MFD_CORE + select REGMAP_IRQ + help + CSR SiRFSoC Power Control Module includes power on or power + off for sysctl power and gnss, it also includes onkey, RTC + domain clock controllers and interrupt controller for power + events.Break out the TLAs.
Your tabbing is all over the place here. Please match existing entries.
Quoted 18 lines
drivers/mfd/Kconfig +0
-0endmenu endifdrivers/mfd/Makefile +2
-0@@ -192,3 +192,5 @@ obj-$(CONFIG_MFD_SKY81452) += sky81452.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o obj-$(CONFIG_MFD_MT6397) += mt6397-core.o + +obj-$(CONFIG_MFD_SIRFSOC_PWRC) += sirfsoc_pwrc.odrivers/mfd/sirfsoc_pwrc.c new file +0
-0drivers/mfd/sirfsoc_pwrc.c line 2
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0@@ -0,0 +1,238 @@ +/* +* power management mfd for CSR SiRFSoC chips "Power Management MFD for CSR SiRFSoC chips"
drivers/mfd/sirfsoc_pwrc.c line 3
Quoted 1 line
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+* Copyright (c) 2014 Cambridge Silicon Radio Limited, a CSR plc group company. This is out of date.
drivers/mfd/sirfsoc_pwrc.c line 14
Quoted 9 lines
drivers/mfd/sirfsoc_pwrc.c new file +9
-0+* Licensed under GPLv2 or later. +*/ + +#include <linux/kernel.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/io.h> +#include <linux/regmap.h> +#include <linux/module.h> This isn't a module.
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c line 15
Quoted 1 line
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+#include <linux/rtc/sirfsoc_rtciobrg.h> What's this for?
the registers are behind a rtc io bridge. HW needs to access the bridge to access registers.
another example similar with pwrc MFD is sysrtc as below:
2019 rtc-iobg@18840000 {
2020 compatible = "sirf,prima2-rtciobg",
2021 "sirf-prima2-rtciobg-bus",
2022 "simple-bus";
2023 #address-cells = <1>;
2024 #size-cells = <1>;
2025 reg = <0x18840000 0x1000>;
2026
2027 sysrtc@2000 {
2028 compatible = "sirf,prima2-sysrtc";
2029 reg = <0x2000 0x100>;
2030 interrupts = <0 52 0>;
2031 };
2032 pwrc@3000 {
2033 compatible = "sirf,atlas7-pwrc";
2034 reg = <0x3000 0x100>;
2035 interrupts = <0 32 0>;
2036 rtcmclk: clock-controller {its driver is at
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/rtc/rtc-sirfsoc.c
Quoted 60 lines
drivers/mfd/sirfsoc_pwrc.c line 17
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+#include <linux/mfd/core.h> +#include <linux/mfd/sirfsoc_pwrc.h> Header files should be in alphabetical order.
Quoted 54 lines
drivers/mfd/sirfsoc_pwrc.c new file +54
-0+struct sirfsoc_pwrc_register sirfsoc_a7da_pwrc = { + .pwrc_pdn_ctrl_set =0x0 , + .pwrc_pdn_ctrl_clr =0x4 , + .pwrc_pon_status =0x8 , + .pwrc_trigger_en_set =0xc , + .pwrc_trigger_en_clr =0x10 , + .pwrc_int_mask_set =0x14 , + .pwrc_int_mask_clr =0x18 , + .pwrc_int_status =0x1c , + .pwrc_pin_status =0x20 , + .pwrc_rtc_pll_ctrl =0x28 , + .pwrc_gpio3_debug =0x34 , + .pwrc_rtc_noc_pwrctl_set =0x38 , + .pwrc_rtc_noc_pwrctl_clr =0x3c , + .pwrc_rtc_can_ctrl =0x48 , + .pwrc_rtc_can_status =0x4c , + .pwrc_fsm_m3_ctrl =0x50 , + .pwrc_fsm_state =0x54 , + .pwrc_rtcldo_reg =0x58 , + .pwrc_gnss_ctrl =0x5c , + .pwrc_gnss_status =0x60 , + .pwrc_xtal_reg =0x64 , + .pwrc_xtal_ldo_mux_sel =0x68 , + .pwrc_rtc_sw_rstc_set =0x6c , + .pwrc_rtc_sw_rstc_clr =0x70 , + .pwrc_power_sw_ctrl_set =0x74 , + .pwrc_power_sw_ctrl_clr =0x78 , + .pwrc_rtc_dcog =0x7c , + .pwrc_m3_memories =0x80 , + .pwrc_can0_memory =0x84 , + .pwrc_rtc_gnss_memory =0x88 , + .pwrc_m3_clk_en =0x8c , + .pwrc_can0_clk_en =0x90 , + .pwrc_spi0_clk_en =0x94 , + .pwrc_rtc_sec_clk_en =0x98 , + .pwrc_rtc_noc_clk_en =0x9c , +}; + +struct sirfsoc_pwrc_register sirfsoc_prima2_pwrc = { + .pwrc_pdn_ctrl_set =0x0 , + .pwrc_pon_status =0x4 , + .pwrc_trigger_en_set =0x8 , + .pwrc_int_status =0xc , + .pwrc_int_mask_set =0x10 , + .pwrc_pin_status =0x14 , + .pwrc_scratch_pad1 =0x18 , + .pwrc_scratch_pad2 =0x1c , + .pwrc_scratch_pad3 =0x20 , + .pwrc_scratch_pad4 =0x24 , + .pwrc_scratch_pad5 =0x28 , + .pwrc_scratch_pad6 =0x2c , + .pwrc_scratch_pad7 =0x30 , + .pwrc_scratch_pad8 =0x34 , + .pwrc_scratch_pad9 =0x38 ,
Quoted 8 lines
drivers/mfd/sirfsoc_pwrc.c line 78
Quoted 6 lines
drivers/mfd/sirfsoc_pwrc.c new file +6
-0+ .pwrc_scratch_pad10 = 0x3c, + .pwrc_scratch_pad11 = 0x40, + .pwrc_scratch_pad12 = 0x44, + .pwrc_gpio3_clk = 0x54, + .pwrc_gpio_ds = 0x78, +};This is not the way we usually define register addresses.
i agree using MARCO is the general rules. but here moving to struct is for avoiding things like:
if (prima2...)
...
elif(atlas7)
...
it is making registers offset private data which can be a member of the object.
Quoted 73 lines
Please #define them properly.
drivers/mfd/sirfsoc_pwrc.c line 83
Quoted 4 lines
drivers/mfd/sirfsoc_pwrc.c new file +4
-0+static const struct regmap_irq pwrc_irqs[] = { +/* INT0 */ + [PWRC_IRQ_ONKEY ] = { + .mask =BIT (PWRC_IRQ_ONKEY ),Better to do the
BIT()shifting in the header file.Quoted 10 lines
drivers/mfd/sirfsoc_pwrc.c new file +10
-0+ }, + [PWRC_IRQ_EXT_ONKEY ] = { + .mask =BIT (PWRC_IRQ_EXT_ONKEY ), + }, +}; + +static struct regmap_irq_chip pwrc_irq_chip = { + .name ="pwrc_irq" , + .irqs = pwrc_irqs, + .num_irqs =ARRAY_SIZE (pwrc_irqs),drivers/mfd/sirfsoc_pwrc.c line 103
Quoted 10 lines
drivers/mfd/sirfsoc_pwrc.c new file +10
-0+ .num_regs = 1, + .ack_invert = 1, + .init_ack_masked = true, +}; + +static const struct of_device_id pwrc_ids[] = { + { .compatible ="sirf,prima2-pwrc" , .data = &sirfsoc_prima2_pwrc}, + { .compatible ="sirf,atlas7-pwrc" , .data = &sirfsoc_a7da_pwrc}, + {} +};Please put these _just_ before you use them, so just above .probe() in this case.
Quoted 26 lines
drivers/mfd/sirfsoc_pwrc.c new file +26
-0+static const struct mfd_cell pwrc_devs[] = { + { + .name ="rtcmclk" , + .of_compatible ="sirf,atlas7-rtcmclk" , + }, { + .name ="sirf-sysctl" , + .of_compatible ="sirf,sirf-sysctl" , + }, { + .name ="gps-power" , + .of_compatible ="sirf,gps-power" , + }, { + .name ="onkey" , + .of_compatible ="sirf,prima2-onkey" , + }, +}; + +static const struct regmap_config pwrc_regmap_config = { + .fast_io = true, + .reg_bits =32 , + .val_bits =32 , + .reg_stride =4 , +}; + +static int sirfsoc_pwrc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node;drivers/mfd/sirfsoc_pwrc.c line 140
Quoted 10 lines
drivers/mfd/sirfsoc_pwrc.c new file +10
-0+const struct of_device_id *match; +struct sirfsoc_pwrc_info *pwrcinfo; +struct regmap_irq_chip *regmap_irq_chip; +struct sirfsoc_pwrc_register *pwrc_reg; +struct regmap *map; +int ret; +u32 base; + +if (of_property_read_u32 (np,"reg" , &base)) +panic ("unable to find base address of pwrc node in dtb\n" );It looks like this driver should depend on OF.
Quoted 6 lines
Why are you obtaining the base address manually? Use:
res = platform_get_resource(); devm_ioremap_resource(res);... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Quoted 105 lines
drivers/mfd/sirfsoc_pwrc.c line 143
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+ pwrcinfo =devm_kzalloc (&pdev->dev, +sizeof (struct sirfsoc_pwrc_info ),GFP_KERNEL );sizeof(pwrcinfo)
drivers/mfd/sirfsoc_pwrc.c line 151
Quoted 8 lines
drivers/mfd/sirfsoc_pwrc.c new file +8
-0+if (!pwrcinfo) +return -ENOMEM ; + pwrcinfo->base = base; + +/* +* pwrc behind rtciobrg offset is diff between prima2 and atlas7 +* here match to each ids data for it. +*/ Use uppercase characters for abbreviations.
Besides, I have no idea what you're trying to say.
drivers/mfd/sirfsoc_pwrc.c line 153
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+ match =of_match_node (pwrc_ids, np); + pwrcinfo->pwrc_reg = (struct sirfsoc_pwrc_register *)match->data;It looks like you're trying to use the same variables two different device's register sets. That's asking for trouble, please don't do that.
drivers/mfd/sirfsoc_pwrc.c line 160
Quoted 6 lines
drivers/mfd/sirfsoc_pwrc.c new file +6
-0+if (of_device_is_compatible (np,"sirf,atlas7-pwrc" )) + pwrcinfo->ver =PWRC_ATLAS7_VER ; +else if (of_device_is_compatible (np,"sirf,prima2-pwrc" )) + pwrcinfo->ver =PWRC_PRIMA2_VER ; +else +return -EINVAL ;These aren't versions, are they? It's different hardware.
Can't you probe for this at runtime?
drivers/mfd/sirfsoc_pwrc.c line 162
Quoted 1 line
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+of_node_put (np);What are you putting here?
drivers/mfd/sirfsoc_pwrc.c line 165
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+ map = (struct regmap *)devm_regmap_init_iobg (&pdev->dev, + &pwrc_regmap_config);Why are you casting?
drivers/mfd/sirfsoc_pwrc.c line 170
Quoted 5 lines
drivers/mfd/sirfsoc_pwrc.c new file +5
-0+if (IS_ERR (map)) { + ret =PTR_ERR (map); +dev_err (&pdev->dev,"Failed to allocate register map: %d\n" , + ret); + goto err;Please remove the 'err' label and just return from here.
drivers/mfd/sirfsoc_pwrc.c line 180
Quoted 10 lines
drivers/mfd/sirfsoc_pwrc.c new file +10
-0+ } + + pwrcinfo->regmap = map; + pwrcinfo->dev = &pdev->dev; +platform_set_drvdata (pdev, pwrcinfo); + + ret =mfd_add_devices (pwrcinfo->dev,0 , pwrc_devs, +ARRAY_SIZE (pwrc_devs),NULL ,0 ,NULL ); +if (ret) { +dev_err (&pdev->dev,"Failed to add all pwrc subdev\n" );Capitalise all abbreviations.
Don't abbreviate things like "sub devices".
drivers/mfd/sirfsoc_pwrc.c line 172
Quoted 1 line
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+ goto err;Just return.
drivers/mfd/sirfsoc_pwrc.c line 184
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ } + + ret =of_irq_get (pdev->dev.of_node,0 );You already put this in to a succinct variable 'np'. Please use it.
drivers/mfd/sirfsoc_pwrc.c line 187
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+if (ret <=0 ) { +dev_info (&pdev->dev, +"Unable to find IRQ for pwrc. ret=%d\n" , ret);Just print ret. No need for the ugly "ret=".
drivers/mfd/sirfsoc_pwrc.c line 191
Quoted 4 lines
drivers/mfd/sirfsoc_pwrc.c new file +4
-0+ goto err_irq; + } + + pwrcinfo->irq = ret;Better change this to 'irq' instead of using 'ret'.
drivers/mfd/sirfsoc_pwrc.c line 203
Quoted 12 lines
drivers/mfd/sirfsoc_pwrc.c new file +12
-0+ regmap_irq_chip = &pwrc_irq_chip; + pwrcinfo->regmap_irq_chip = regmap_irq_chip; + + pwrc_reg = pwrcinfo->pwrc_reg; + regmap_irq_chip->mask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_set; + regmap_irq_chip->unmask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_clr; + regmap_irq_chip->status_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status; + regmap_irq_chip->ack_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status;
Quoted 3 lines
This is ugly.
Better to create 2
regmap_irq_chipstructures, one for each device.
there is only one device. why two regmap_irq_chip structures?
the driver is compatible with prima2 and atlas7, but any time there is only one of them,
and the register needs to be adjust from dts and offset table.
Quoted 45 lines
drivers/mfd/sirfsoc_pwrc.c line 205
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +1
-0+/* enable onkey trigger interrupt controller */ Capital letters to start a sentence.
drivers/mfd/sirfsoc_pwrc.c line 214
Quoted 9 lines
drivers/mfd/sirfsoc_pwrc.c new file +9
-0+ ret =regmap_update_bits (map, + pwrcinfo->base + + pwrc_reg->pwrc_trigger_en_set, +BIT (PWRC_IRQ_ONKEY ) |BIT (PWRC_IRQ_EXT_ONKEY ), +BIT (PWRC_IRQ_ONKEY ) |BIT (PWRC_IRQ_EXT_ONKEY )); +if (ret <0 ) + goto err_irq; + +/* add irq controller for pwrc */ Capital letters to start a sentence and for abbreviations.
drivers/mfd/sirfsoc_pwrc.c line 227
Quoted 13 lines
drivers/mfd/sirfsoc_pwrc.c new file +13
-0+ ret =regmap_add_irq_chip (map, pwrcinfo->irq,IRQF_ONESHOT , +-1 , pwrcinfo->regmap_irq_chip, + &pwrcinfo->irq_data); + +if (ret) { +dev_err (&pdev->dev,"Failed to add regmap irq controller for pwrc\n" ); + goto err; + } + +return 0 ; +err_irq: +mfd_remove_devices (pwrcinfo->dev); +err:Remove this label, it's not helpful.
drivers/mfd/sirfsoc_pwrc.c line 232
Quoted 5 lines
drivers/mfd/sirfsoc_pwrc.c new file +5
-0+return ret; +} + +static struct platform_driver sirfsoc_pwrc_driver = { + .probe = sirfsoc_pwrc_probe,.remove?
drivers/mfd/sirfsoc_pwrc.c line 235
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ .driver = { + .name = "sirfsoc_pwrc", + .of_match_table = pwrc_ids,
Quoted 7 lines
of_match_ptr()drivers/mfd/sirfsoc_pwrc.c line 238
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ }, +}; +module_platform_driver (sirfsoc_pwrc_driver);This isn't a module.
so do you think it is still a platform, what is the best way to probe them?
Quoted 132 lines
include/linux/mfd/sirfsoc_pwrc.h line 4
Quoted 11 lines
include/linux/mfd/sirfsoc_pwrc.h new file +4
-0@@ -0,0 +1,97 @@ +/* +* CSR SiRFSoC power control module MFD interface +* +* Copyright (c) 2014 Cambridge Silicon Radio Limited, a CSR plc group company. Out of date.
include/linux/mfd/sirfsoc_pwrc.h line 6
Quoted 2 lines
include/linux/mfd/sirfsoc_pwrc.h new file +2
-0+* Licensed under GPLv2 or later. +*/ '\n' here.
include/linux/mfd/sirfsoc_pwrc.h line 9
Quoted 2 lines
include/linux/mfd/sirfsoc_pwrc.h new file +2
-0+#ifndef _SIRFSOC_PWRC_H_ +#define _SIRFSOC_PWRC_H_'\n' here.
include/linux/mfd/sirfsoc_pwrc.h line 10
Quoted 1 line
include/linux/mfd/sirfsoc_pwrc.h new file +1
-0+#include <linux/interrupt.h> What's this for?
Quoted 50 lines
include/linux/mfd/sirfsoc_pwrc.h new file +50
-0+#include <linux/regmap.h> + +#define PWRC_PDN_CTRL_OFFSET 0 +#define AUDIO_POWER_EN_BIT 14 + +struct sirfsoc_pwrc_register { +/* hardware pwrc specific */ +u32 pwrc_pdn_ctrl_set; +u32 pwrc_pdn_ctrl_clr; +u32 pwrc_pon_status; +u32 pwrc_trigger_en_set; +u32 pwrc_trigger_en_clr; +u32 pwrc_int_mask_set; +u32 pwrc_int_mask_clr; +u32 pwrc_int_status; +u32 pwrc_pin_status; +u32 pwrc_rtc_pll_ctrl; +u32 pwrc_gpio3_debug; +u32 pwrc_rtc_noc_pwrctl_set; +u32 pwrc_rtc_noc_pwrctl_clr; +u32 pwrc_rtc_can_ctrl; +u32 pwrc_rtc_can_status; +u32 pwrc_fsm_m3_ctrl; +u32 pwrc_fsm_state; +u32 pwrc_rtcldo_reg; +u32 pwrc_gnss_ctrl; +u32 pwrc_gnss_status; +u32 pwrc_xtal_reg; +u32 pwrc_xtal_ldo_mux_sel; +u32 pwrc_rtc_sw_rstc_set; +u32 pwrc_rtc_sw_rstc_clr; +u32 pwrc_power_sw_ctrl_set; +u32 pwrc_power_sw_ctrl_clr; +u32 pwrc_rtc_dcog; +u32 pwrc_m3_memories; +u32 pwrc_can0_memory; +u32 pwrc_rtc_gnss_memory; +u32 pwrc_m3_clk_en; +u32 pwrc_can0_clk_en; +u32 pwrc_spi0_clk_en; +u32 pwrc_rtc_sec_clk_en; +u32 pwrc_rtc_noc_clk_en; + +/*only for prima2*/ +u32 pwrc_scratch_pad1; +u32 pwrc_scratch_pad2; +u32 pwrc_scratch_pad3; +u32 pwrc_scratch_pad4; +u32 pwrc_scratch_pad5; +u32 pwrc_scratch_pad6;include/linux/mfd/sirfsoc_pwrc.h line 70
Quoted 10 lines
include/linux/mfd/sirfsoc_pwrc.h new file +10
-0+u32 pwrc_scratch_pad7; +u32 pwrc_scratch_pad8; +u32 pwrc_scratch_pad9; +u32 pwrc_scratch_pad10; +u32 pwrc_scratch_pad11; +u32 pwrc_scratch_pad12; +u32 pwrc_gpio3_clk; +u32 pwrc_gpio_ds; + +};Please #define these instead.
include/linux/mfd/sirfsoc_pwrc.h line 76
Quoted 5 lines
include/linux/mfd/sirfsoc_pwrc.h new file +5
-0+enum pwrc_version { +PWRC_MARCO_VER , +PWRC_PRIMA2_VER , +PWRC_ATLAS7_VER , +};Kerneldoc header?
include/linux/mfd/sirfsoc_pwrc.h line 83
Quoted 6 lines
include/linux/mfd/sirfsoc_pwrc.h new file +6
-0+struct sirfsoc_pwrc_info { +struct device *dev; +struct regmap *regmap; +struct sirfsoc_pwrc_register *pwrc_reg; +struct regmap_irq_chip *regmap_irq_chip; +struct regmap_irq_chip_data *irq_data;Where are these reused?
include/linux/mfd/sirfsoc_pwrc.h line 84
Quoted 1 line
include/linux/mfd/sirfsoc_pwrc.h new file +1
-0+u32 ver;What is this used for?
include/linux/mfd/sirfsoc_pwrc.h line 82
Quoted 1 line
include/linux/mfd/sirfsoc_pwrc.h new file +1
-0+u32 base;Is this a u32 or a memory address?
include/linux/mfd/sirfsoc_pwrc.h line 97
Quoted 12 lines
include/linux/mfd/sirfsoc_pwrc.h new file +12
-0+ int irq; +}; + +enum { +PWRC_IRQ_ONKEY =0 , +PWRC_IRQ_EXT_ONKEY , +PWRC_MAX_IRQ , +}; + +extern struct sirfsoc_pwrc_register sirfsoc_a7da_pwrc; +extern struct sirfsoc_pwrc_register sirfsoc_prima2_pwrc; +#endif --
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Quoted 2 lines
Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
-barry
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
Quoted 30 lines · Barry Song
2015-09-20 12:15 GMT+08:00 Lee Jones <[email protected]>:
Quoted 29 lines · Barry Song
Quoted 7 lines
From: Guo Zeng <[email protected]>
CSR SiRFSoC Power Control Module includes power on or power off for sysctl power and gnss, it also includes onkey, RTC domain clock controllers and interrupt controller for power events.
There are lots of Three (and four) Letter Abbreviations (TLAs) here, which mean nothing to the average reader. Please break them out in the commit log as I have done i.e. "Long Abbreviated Word (LAW)", so us normies can see what they mean.
Quoted 4 lines
Signed-off-by Guo Zeng <[email protected]>Signed-off-by Barry Song <[email protected]>--- .../devicetree/bindings/mfd/sirf-pwrc.txt | 37 ++++This should be in a separate patch.
Quoted 8 lines
drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 2 + drivers/mfd/sirfsoc_pwrc.c | 238 +++++++++++++++++++++ include/linux/mfd/sirfsoc_pwrc.h | 97 +++++++++ 5 files changed, 386 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/sirf-pwrc.txt create mode 100644 drivers/mfd/sirfsoc_pwrc.c create mode 100644 include/linux/mfd/sirfsoc_pwrc.h
[...]
Quoted 27 lines
Quoted 3 lines
Quoted 1 line
+#include <
linux/rtc/sirfsoc_rtciobrg.h>What's this for?
the registers are behind a rtc io bridge. HW needs to access the bridge to access registers.
another example similar with pwrc MFD is sysrtc as below:2019 rtc-iobg@18840000 {
2020 compatible = "sirf,prima2-rtciobg",
2021 "sirf-prima2-rtciobg-bus",
2022 "simple-bus";2023 #address-cells = <1>; 2024 #size-cells = <1>; 2025 reg = <0x18840000 0x1000>; 2026 2027 sysrtc@2000 { 2028 compatible = "sirf,prima2-sysrtc"; 2029 reg = <0x2000 0x100>; 2030 interrupts = <0 52 0>; 2031 }; 2032 pwrc@3000 { 2033 compatible = "sirf,atlas7-pwrc"; 2034 reg = <0x3000 0x100>; 2035 interrupts = <0 32 0>; 2036 rtcmclk: clock-controller {
Quoted 2 lines
its driver is at
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/rtc/rtc-sirfsoc.c
I meant what are you using in the header file, but I looked it up.
Quoted 71 lines
Quoted 59 lines
drivers/mfd/sirfsoc_pwrc.c line 17
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+#include <linux/mfd/core.h> +#include <linux/mfd/sirfsoc_pwrc.h> Header files should be in alphabetical order.
Quoted 54 lines
drivers/mfd/sirfsoc_pwrc.c new file +54
-0+struct sirfsoc_pwrc_register sirfsoc_a7da_pwrc = { + .pwrc_pdn_ctrl_set =0x0 , + .pwrc_pdn_ctrl_clr =0x4 , + .pwrc_pon_status =0x8 , + .pwrc_trigger_en_set =0xc , + .pwrc_trigger_en_clr =0x10 , + .pwrc_int_mask_set =0x14 , + .pwrc_int_mask_clr =0x18 , + .pwrc_int_status =0x1c , + .pwrc_pin_status =0x20 , + .pwrc_rtc_pll_ctrl =0x28 , + .pwrc_gpio3_debug =0x34 , + .pwrc_rtc_noc_pwrctl_set =0x38 , + .pwrc_rtc_noc_pwrctl_clr =0x3c , + .pwrc_rtc_can_ctrl =0x48 , + .pwrc_rtc_can_status =0x4c , + .pwrc_fsm_m3_ctrl =0x50 , + .pwrc_fsm_state =0x54 , + .pwrc_rtcldo_reg =0x58 , + .pwrc_gnss_ctrl =0x5c , + .pwrc_gnss_status =0x60 , + .pwrc_xtal_reg =0x64 , + .pwrc_xtal_ldo_mux_sel =0x68 , + .pwrc_rtc_sw_rstc_set =0x6c , + .pwrc_rtc_sw_rstc_clr =0x70 , + .pwrc_power_sw_ctrl_set =0x74 , + .pwrc_power_sw_ctrl_clr =0x78 , + .pwrc_rtc_dcog =0x7c , + .pwrc_m3_memories =0x80 , + .pwrc_can0_memory =0x84 , + .pwrc_rtc_gnss_memory =0x88 , + .pwrc_m3_clk_en =0x8c , + .pwrc_can0_clk_en =0x90 , + .pwrc_spi0_clk_en =0x94 , + .pwrc_rtc_sec_clk_en =0x98 , + .pwrc_rtc_noc_clk_en =0x9c , +}; + +struct sirfsoc_pwrc_register sirfsoc_prima2_pwrc = { + .pwrc_pdn_ctrl_set =0x0 , + .pwrc_pon_status =0x4 , + .pwrc_trigger_en_set =0x8 , + .pwrc_int_status =0xc , + .pwrc_int_mask_set =0x10 , + .pwrc_pin_status =0x14 , + .pwrc_scratch_pad1 =0x18 , + .pwrc_scratch_pad2 =0x1c , + .pwrc_scratch_pad3 =0x20 , + .pwrc_scratch_pad4 =0x24 , + .pwrc_scratch_pad5 =0x28 , + .pwrc_scratch_pad6 =0x2c , + .pwrc_scratch_pad7 =0x30 , + .pwrc_scratch_pad8 =0x34 , + .pwrc_scratch_pad9 =0x38 ,Quoted 8 lines
drivers/mfd/sirfsoc_pwrc.c line 78
Quoted 6 lines
drivers/mfd/sirfsoc_pwrc.c new file +6
-0+ .pwrc_scratch_pad10 = 0x3c, + .pwrc_scratch_pad11 = 0x40, + .pwrc_scratch_pad12 = 0x44, + .pwrc_gpio3_clk = 0x54, + .pwrc_gpio_ds = 0x78, +};This is not the way we usually define register addresses.
i agree using MARCO is the general rules. but here moving to struct is for avoiding things like:
Quoted 6 lines
if (prima2...)
...
elif(atlas7)
...it is making registers offset private data which can be a member of the object.
Hmm... it's pretty unusual, but I can't think of a better way of doing it yet.
[...]
Quoted 18 lines
Quoted 18 lines
drivers/mfd/sirfsoc_pwrc.c line 140
Quoted 13 lines
drivers/mfd/sirfsoc_pwrc.c new file +13
-0+static int sirfsoc_pwrc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +const struct of_device_id *match; +struct sirfsoc_pwrc_info *pwrcinfo; +struct regmap_irq_chip *regmap_irq_chip; +struct sirfsoc_pwrc_register *pwrc_reg; +struct regmap *map; +int ret; +u32 base; + +if (of_property_read_u32 (np,"reg" , &base)) +panic ("unable to find base address of pwrc node in dtb\n" );It looks like this driver should depend on OF.
Why are you obtaining the base address manually? Use:
Quoted 7 lines
Quoted 4 lines
res = platform_get_resource(); devm_ioremap_resource(res);... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Use 'ranges' in the DT, then you can pull out the proper address without hand rolling your own method.
[...]
Quoted 15 lines
Quoted 15 lines
drivers/mfd/sirfsoc_pwrc.c line 203
Quoted 12 lines
drivers/mfd/sirfsoc_pwrc.c new file +12
-0+ regmap_irq_chip = &pwrc_irq_chip; + pwrcinfo->regmap_irq_chip = regmap_irq_chip; + + pwrc_reg = pwrcinfo->pwrc_reg; + regmap_irq_chip->mask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_set; + regmap_irq_chip->unmask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_clr; + regmap_irq_chip->status_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status; + regmap_irq_chip->ack_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status;This is ugly.
Quoted 7 lines
Quoted 1 line
Better to create 2
regmap_irq_chipstructures, one for each device.there is only one device. why two
regmap_irq_chipstructures?the driver is compatible with prima2 and atlas7, but any time there is only one of them,
and the register needs to be adjust from dts and offset table.
Why does the 'base' offset have to be drawn from DT? Does it change?
I think you should create two static regmap_irq_chip structures and do only pass the relevant one to regmap.
See how everyone else does it.
[...]
Quoted 11 lines
Quoted 11 lines
drivers/mfd/sirfsoc_pwrc.c line 232
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+static struct platform_driver sirfsoc_pwrc_driver = { + .probe = sirfsoc_pwrc_probe,.remove?
drivers/mfd/sirfsoc_pwrc.c line 235
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ .driver = { + .name = "sirfsoc_pwrc", + .of_match_table = pwrc_ids,
of_match_ptr()
Quoted 8 lines
Quoted 5 lines
drivers/mfd/sirfsoc_pwrc.c line 238
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ }, +}; +module_platform_driver (sirfsoc_pwrc_driver);This isn't a module.
so do you think it is still a platform, what is the best way to probe them?
Yes, it's still a platform. It's just not a module.
[...]
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
drivers/mfd/sirfsoc_pwrc.c line 140
Quoted 13 lines
drivers/mfd/sirfsoc_pwrc.c new file +13
-0+static int sirfsoc_pwrc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +const struct of_device_id *match; +struct sirfsoc_pwrc_info *pwrcinfo; +struct regmap_irq_chip *regmap_irq_chip; +struct sirfsoc_pwrc_register *pwrc_reg; +struct regmap *map; +int ret; +u32 base; + +if (of_property_read_u32 (np,"reg" , &base)) +panic ("unable to find base address of pwrc node in dtb\n" );It looks like this driver should depend on OF.
Why are you obtaining the base address manually? Use:
res = platform_get_resource(); devm_ioremap_resource(res);
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Use 'ranges' in the DT, then you can pull out the proper address without hand rolling your own method.
it seems it is not a "ranges" thing, things behind rtciobrg is much like things behind USB or sdio. we need to use a rtciobrg protocol to do read/write.
they can not be randomly accessed by load/store, and can't be XIP. they don't have any ranges in CPU memory space.
Quoted 26 lines
[...]
Quoted 15 lines
Quoted 15 lines
drivers/mfd/sirfsoc_pwrc.c line 203
Quoted 12 lines
drivers/mfd/sirfsoc_pwrc.c new file +12
-0+ regmap_irq_chip = &pwrc_irq_chip; + pwrcinfo->regmap_irq_chip = regmap_irq_chip; + + pwrc_reg = pwrcinfo->pwrc_reg; + regmap_irq_chip->mask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_set; + regmap_irq_chip->unmask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_clr; + regmap_irq_chip->status_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status; + regmap_irq_chip->ack_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status;This is ugly.
Quoted 7 lines
Quoted 1 line
Better to create 2
regmap_irq_chipstructures, one for each device.there is only one device. why two
regmap_irq_chipstructures?the driver is compatible with prima2 and atlas7, but any time there is only one of them,
and the register needs to be adjust from dts and offset table.
Quoted 6 lines
Why does the 'base' offset have to be drawn from DT? Does it change?
I think you should create two static
regmap_irq_chipstructures and do only pass the relevant one to regmap.See how everyone else does it.
that is ok, if this driver picks up one regmap_irq_chip from two according to of compatible strings.
Quoted 21 lines
[...]
Quoted 18 lines
Quoted 16 lines
drivers/mfd/sirfsoc_pwrc.c line 232
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+static struct platform_driver sirfsoc_pwrc_driver = { + .probe = sirfsoc_pwrc_probe,.remove?
drivers/mfd/sirfsoc_pwrc.c line 235
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ .driver = { + .name = "sirfsoc_pwrc", + .of_match_table = pwrc_ids,
of_match_ptr()drivers/mfd/sirfsoc_pwrc.c line 238
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ }, +}; +module_platform_driver (sirfsoc_pwrc_driver);This isn't a module.
Quoted 3 lines
Quoted 1 line
so do you think it is still a platform, what is the best way to probe them?
Yes, it's still a platform. It's just not a module.
Lee, i don't have idea on this.
as a module, if it is built-in, it is initilized during device_initcall, if it is not built-in, it is initilized during insmod.
when you say it is not a module,
do you mean it must be built-in, or do you mean it is not a device_initcall?
-barry
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
Quoted 26 lines · Barry Song
Quoted 26 lines
Quoted 25 lines
Quoted 16 lines
drivers/mfd/sirfsoc_pwrc.c line 140
Quoted 13 lines
drivers/mfd/sirfsoc_pwrc.c new file +13
-0+static int sirfsoc_pwrc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +const struct of_device_id *match; +struct sirfsoc_pwrc_info *pwrcinfo; +struct regmap_irq_chip *regmap_irq_chip; +struct sirfsoc_pwrc_register *pwrc_reg; +struct regmap *map; +int ret; +u32 base; + +if (of_property_read_u32 (np,"reg" , &base)) +panic ("unable to find base address of pwrc node in dtb\n" );It looks like this driver should depend on OF.
Quoted 6 lines
Why are you obtaining the base address manually? Use:
res = platform_get_resource(); devm_ioremap_resource(res);... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Quoted 8 lines
Quoted 2 lines
Use 'ranges' in the DT, then you can pull out the proper address without hand rolling your own method.
it seems it is not a "ranges" thing, things behind rtciobrg is much like things behind USB or sdio. we need to use a rtciobrg protocol to do read/write.
they can not be randomly accessed by load/store, and can't be XIP. they don't have any ranges in CPU memory space.
So what's the point of 'base' then? I assumed this was the base of the IP registers which where memory mapped?
Quoted 27 lines
Quoted 27 lines
[...]
Quoted 15 lines
Quoted 15 lines
drivers/mfd/sirfsoc_pwrc.c line 203
Quoted 12 lines
drivers/mfd/sirfsoc_pwrc.c new file +12
-0+ regmap_irq_chip = &pwrc_irq_chip; + pwrcinfo->regmap_irq_chip = regmap_irq_chip; + + pwrc_reg = pwrcinfo->pwrc_reg; + regmap_irq_chip->mask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_set; + regmap_irq_chip->unmask_base = pwrcinfo->base + + pwrc_reg->pwrc_int_mask_clr; + regmap_irq_chip->status_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status; + regmap_irq_chip->ack_base = pwrcinfo->base + + pwrc_reg->pwrc_int_status;This is ugly.
Quoted 7 lines
Quoted 1 line
Better to create 2
regmap_irq_chipstructures, one for each device.there is only one device. why two
regmap_irq_chipstructures?the driver is compatible with prima2 and atlas7, but any time there is only one of them,
and the register needs to be adjust from dts and offset table.Why does the 'base' offset have to be drawn from DT? Does it change?
Quoted 7 lines
Quoted 4 lines
I think you should create two static
regmap_irq_chipstructures and do only pass the relevant one to regmap.See how everyone else does it.
that is ok, if this driver picks up one
regmap_irq_chipfrom two according to of compatible strings.
Okay, great.
Quoted 24 lines
Quoted 20 lines
[...]
Quoted 18 lines
Quoted 16 lines
drivers/mfd/sirfsoc_pwrc.c line 232
Quoted 2 lines
drivers/mfd/sirfsoc_pwrc.c new file +2
-0+static struct platform_driver sirfsoc_pwrc_driver = { + .probe = sirfsoc_pwrc_probe,.remove?
drivers/mfd/sirfsoc_pwrc.c line 235
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ .driver = { + .name = "sirfsoc_pwrc", + .of_match_table = pwrc_ids,
of_match_ptr()drivers/mfd/sirfsoc_pwrc.c line 238
Quoted 3 lines
drivers/mfd/sirfsoc_pwrc.c new file +3
-0+ }, +}; +module_platform_driver (sirfsoc_pwrc_driver);This isn't a module.
Quoted 3 lines
Quoted 1 line
so do you think it is still a platform, what is the best way to probe them?
Yes, it's still a platform. It's just not a module.
Quoted 7 lines
Lee, i don't have idea on this.
as a module, if it is built-in, it is initilized during
device_initcall, if it is not built-in, it is initilized during insmod.
when you say it is not a module,
do you mean it must be built-in, or do you mean it is not adevice_initcall?
Use builtin_platform_driver_probe().
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
2015-09-29 15:16 GMT+08:00 Lee Jones <[email protected]>:
Quoted 30 lines · Barry Song
Quoted 29 lines
Quoted 28 lines
Quoted 18 lines
Quoted 18 lines
drivers/mfd/sirfsoc_pwrc.c line 140
Quoted 13 lines
drivers/mfd/sirfsoc_pwrc.c new file +13
-0+static int sirfsoc_pwrc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +const struct of_device_id *match; +struct sirfsoc_pwrc_info *pwrcinfo; +struct regmap_irq_chip *regmap_irq_chip; +struct sirfsoc_pwrc_register *pwrc_reg; +struct regmap *map; +int ret; +u32 base; + +if (of_property_read_u32 (np,"reg" , &base)) +panic ("unable to find base address of pwrc node in dtb\n" );It looks like this driver should depend on OF.
Why are you obtaining the base address manually? Use:
Quoted 7 lines
Quoted 4 lines
res = platform_get_resource(); devm_ioremap_resource(res);... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Use 'ranges' in the DT, then you can pull out the proper address without hand rolling your own method.
Quoted 8 lines
Quoted 5 lines
it seems it is not a "ranges" thing, things behind rtciobrg is much like things behind USB or sdio. we need to use a rtciobrg protocol to do read/write.
they can not be randomly accessed by load/store, and can't be XIP. they don't have any ranges in CPU memory space.So what's the point of 'base' then? I assumed this was the base of the IP registers which where memory mapped?
just think we have a i2c device, and this i2c device has multi-functions. each function has a base of its register offset.
actually, the base is the offset of 1st register.
-barry
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
Quoted 37 lines · Barry Song
2015-09-29 15:16 GMT+08:00 Lee Jones <[email protected]>:
Quoted 36 lines · Barry Song
Quoted 34 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Review
Quoted 13 lines
(quoted diff) +13
-0+static int sirfsoc_pwrc_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match; + struct sirfsoc_pwrc_info *pwrcinfo; + struct regmap_irq_chip *regmap_irq_chip; + struct sirfsoc_pwrc_register *pwrc_reg; + struct regmap *map; + int ret; + u32 base; + + if (of_property_read_u32(np, "reg", &base)) + panic("unable to find base address of pwrc node in dtb\n");It looks like this driver should depend on OF.
Why are you obtaining the base address manually? Use:
res = platform_get_resource(); devm_ioremap_resource(res);Quoted 7 lines
Quoted 4 lines
Quoted 1 line
... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Use 'ranges' in the DT, then you can pull out the proper address without hand rolling your own method.
it seems it is not a "ranges" thing, things behind rtciobrg is much like things behind USB or sdio. we need to use a rtciobrg protocol to do read/write.
they can not be randomly accessed by load/store, and can't be XIP. they don't have any ranges in CPU memory space.
Quoted 6 lines
Quoted 2 lines
So what's the point of 'base' then? I assumed this was the base of the IP registers which where memory mapped?
just think we have a i2c device, and this i2c device has multi-functions. each function has a base of its register offset.
actually, the base is the offset of 1st register.
Does it every change, from device to device?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
2015-09-29 16:55 GMT+08:00 Lee Jones <[email protected]>:
Quoted 39 lines · Barry Song
Quoted 38 lines
2015-09-29 15:16 GMT+08:00 Lee Jones <[email protected]>:
Quoted 36 lines · Barry Song
Quoted 34 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Review
Quoted 13 lines
(quoted diff) +13
-0+static int sirfsoc_pwrc_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match; + struct sirfsoc_pwrc_info *pwrcinfo; + struct regmap_irq_chip *regmap_irq_chip; + struct sirfsoc_pwrc_register *pwrc_reg; + struct regmap *map; + int ret; + u32 base; + + if (of_property_read_u32(np, "reg", &base)) + panic("unable to find base address of pwrc node in dtb\n");It looks like this driver should depend on OF.
Why are you obtaining the base address manually? Use:
res = platform_get_resource(); devm_ioremap_resource(res);Quoted 7 lines
Quoted 4 lines
Quoted 1 line
... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Use 'ranges' in the DT, then you can pull out the proper address without hand rolling your own method.
it seems it is not a "ranges" thing, things behind rtciobrg is much like things behind USB or sdio. we need to use a rtciobrg protocol to do read/write.
they can not be randomly accessed by load/store, and can't be XIP. they don't have any ranges in CPU memory space.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
So what's the point of 'base' then? I assumed this was the base of the IP registers which where memory mapped?
just think we have a i2c device, and this i2c device has multi-functions. each function has a base of its register offset.
actually, the base is the offset of 1st register.Does it every change, from device to device?
yes. Lee. e.g:
rtc-iobg@18840000 {
reg = <0x18840000 0x1000>;
sysrtc@2000 {
compatible = "sirf,prima2-sysrtc";
reg = <0x2000 0x100>;
interrupts = <0 52 0>;
};
pwrc@3000 {
compatible = "sirf,atlas7-pwrc";
reg = <0x3000 0x100>;
interrupts = <0 32 0>;
};
}-barry
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
Quoted 48 lines · Barry Song
2015-09-29 16:55 GMT+08:00 Lee Jones <[email protected]>:
Quoted 47 lines · Barry Song
Quoted 38 lines
2015-09-29 15:16 GMT+08:00 Lee Jones <[email protected]>:
Quoted 36 lines · Barry Song
Quoted 34 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Review
Quoted 13 lines
(quoted diff) +13
-0+static int sirfsoc_pwrc_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match; + struct sirfsoc_pwrc_info *pwrcinfo; + struct regmap_irq_chip *regmap_irq_chip; + struct sirfsoc_pwrc_register *pwrc_reg; + struct regmap *map; + int ret; + u32 base; + + if (of_property_read_u32(np, "reg", &base)) + panic("unable to find base address of pwrc node in dtb\n");It looks like this driver should depend on OF.
Why are you obtaining the base address manually? Use:
res = platform_get_resource(); devm_ioremap_resource(res);Quoted 7 lines
Quoted 4 lines
Quoted 1 line
... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Use 'ranges' in the DT, then you can pull out the proper address without hand rolling your own method.
it seems it is not a "ranges" thing, things behind rtciobrg is much like things behind USB or sdio. we need to use a rtciobrg protocol to do read/write.
they can not be randomly accessed by load/store, and can't be XIP. they don't have any ranges in CPU memory space.Quoted 6 lines
Quoted 2 lines
So what's the point of 'base' then? I assumed this was the base of the IP registers which where memory mapped?
just think we have a i2c device, and this i2c device has multi-functions. each function has a base of its register offset.
actually, the base is the offset of 1st register.Does it every change, from device to device?
What I mean is ...
Quoted 6 lines
yes. Lee. e.g:
rtc-iobg@18840000 { reg = <0x18840000 0x1000>; sysrtc@2000 {
Is sysrtc always @2000, or might it be @4000 on some devices?
Quoted 5 lines
compatible = "sirf,prima2-sysrtc";
reg = <0x2000 0x100>;
interrupts = <0 52 0>;
};
pwrc@3000 {Same for pwrc?
Quoted 9 lines
compatible = "sirf,atlas7-pwrc"; reg = <0x3000 0x100>; interrupts = <0 32 0>; }; }-barry
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
2015-10-05 16:21 GMT+08:00 Lee Jones <[email protected]>:
Quoted 44 lines · Barry Song
Quoted 43 lines
2015-09-29 16:55 GMT+08:00 Lee Jones <[email protected]>:
Quoted 42 lines · Barry Song
Quoted 41 lines
2015-09-29 15:16 GMT+08:00 Lee Jones <[email protected]>:
Quoted 38 lines · Barry Song
Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 16 lines
Review
Quoted 13 lines
(quoted diff) +13
-0+static int sirfsoc_pwrc_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match; + struct sirfsoc_pwrc_info *pwrcinfo; + struct regmap_irq_chip *regmap_irq_chip; + struct sirfsoc_pwrc_register *pwrc_reg; + struct regmap *map; + int ret; + u32 base; + + if (of_property_read_u32(np, "reg", &base)) + panic("unable to find base address of pwrc node in dtb\n");It looks like this driver should depend on OF.
Quoted 6 lines
Why are you obtaining the base address manually? Use:
res = platform_get_resource(); devm_ioremap_resource(res);... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Quoted 8 lines
Quoted 2 lines
Use 'ranges' in the DT, then you can pull out the proper address without hand rolling your own method.
it seems it is not a "ranges" thing, things behind rtciobrg is much like things behind USB or sdio. we need to use a rtciobrg protocol to do read/write.
they can not be randomly accessed by load/store, and can't be XIP. they don't have any ranges in CPU memory space.So what's the point of 'base' then? I assumed this was the base of the IP registers which where memory mapped?
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
just think we have a i2c device, and this i2c device has multi-functions. each function has a base of its register offset.
actually, the base is the offset of 1st register.Does it every change, from device to device?
What I mean is ...
i get you now :-)
Quoted 9 lines
Quoted 7 lines
yes. Lee. e.g:
rtc-iobg@18840000 { reg = <0x18840000 0x1000>; sysrtc@2000 {Is sysrtc always @2000, or might it be @4000 on some devices?
that depends on the IC design. technically, they can be anywhere and in any order behind rtc-iobridge.
good luck is the existing SoCs such as prima2, atlas6, atlas7 all put it at 2000.
Quoted 8 lines
Quoted 6 lines
compatible = "sirf,prima2-sysrtc"; reg = <0x2000 0x100>; interrupts = <0 52 0>; }; pwrc@3000 {Same for pwrc?
all of the existing prima2, atlas6, atlas7 chips put it at 3000. so the problem is it a hardware OF property or a const/MARCO? i feel it is a OF property. it is pretty much similar with we can put a i2c, spi ,usb controller in different memory place in memory bus.
Quoted 8 lines
Quoted 8 lines
compatible = "sirf,atlas7-pwrc"; reg = <0x3000 0x100>; interrupts = <0 32 0>; }; }
-barry
Re: [PATCH v2 3/3] mfd: add CSR SiRFSoC on-chip power management module driver
Quoted 78 lines · Barry Song
2015-10-05 16:21 GMT+08:00 Lee Jones <[email protected]>:
Quoted 44 lines · Barry Song
Quoted 43 lines
2015-09-29 16:55 GMT+08:00 Lee Jones <[email protected]>:
Quoted 42 lines · Barry Song
Quoted 41 lines
2015-09-29 15:16 GMT+08:00 Lee Jones <[email protected]>:
Quoted 38 lines · Barry Song
Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 16 lines
Review
Quoted 13 lines
(quoted diff) +13
-0+static int sirfsoc_pwrc_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match; + struct sirfsoc_pwrc_info *pwrcinfo; + struct regmap_irq_chip *regmap_irq_chip; + struct sirfsoc_pwrc_register *pwrc_reg; + struct regmap *map; + int ret; + u32 base; + + if (of_property_read_u32(np, "reg", &base)) + panic("unable to find base address of pwrc node in dtb\n");It looks like this driver should depend on OF.
Quoted 6 lines
Why are you obtaining the base address manually? Use:
res = platform_get_resource(); devm_ioremap_resource(res);... instead.
this was explained as they are not in memory space, they are behind a bus bridge.
Quoted 8 lines
Quoted 2 lines
Use 'ranges' in the DT, then you can pull out the proper address without hand rolling your own method.
it seems it is not a "ranges" thing, things behind rtciobrg is much like things behind USB or sdio. we need to use a rtciobrg protocol to do read/write.
they can not be randomly accessed by load/store, and can't be XIP. they don't have any ranges in CPU memory space.So what's the point of 'base' then? I assumed this was the base of the IP registers which where memory mapped?
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
just think we have a i2c device, and this i2c device has multi-functions. each function has a base of its register offset.
actually, the base is the offset of 1st register.Does it every change, from device to device?
What I mean is ...
i get you now :-)
Quoted 9 lines
Quoted 7 lines
yes. Lee. e.g:
rtc-iobg@18840000 { reg = <0x18840000 0x1000>; sysrtc@2000 {Is sysrtc always @2000, or might it be @4000 on some devices?
that depends on the IC design. technically, they can be anywhere and in any order behind rtc-iobridge.
good luck is the existing SoCs such as prima2, atlas6, atlas7 all put it at 2000.Quoted 7 lines
Quoted 6 lines
compatible = "sirf,prima2-sysrtc"; reg = <0x2000 0x100>; interrupts = <0 52 0>; }; pwrc@3000 {
Quoted 6 lines
Quoted 1 line
Same for pwrc?
all of the existing prima2, atlas6, atlas7 chips put it at 3000. so the problem is it a hardware OF property or a const/MARCO? i feel it is a OF property. it is pretty much similar with we can put a i2c, spi ,usb controller in different memory place in memory bus.
Right, this is what I was getting at. I think the address is unlikely to change, and if (and that's a big IF) it does we can rework things.
It will reduced code and effort if you remove these from DT and hard-code them into your driver as a #define.
Please rework accordingly.
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
compatible = "sirf,atlas7-pwrc"; reg = <0x3000 0x100>; interrupts = <0 32 0>; }; }-barry
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Mark Brown
maintainerQuoted 5 lines · Barry Song
From: Guo Zeng <[email protected]>
Some chips have separate unmask registers from mask registers for some consideration of concurrency SMP write performance. And this patch adds a flag for it.
I've pushed a tag regmap-irq-unmask so these can be pulled into another tree if needed (like for the MFD).
2015-09-17 18:53 GMT+08:00 Mark Brown <[email protected]>:
Quoted 9 lines · Barry Song
Quoted 5 lines
From: Guo Zeng <[email protected]>
Some chips have separate unmask registers from mask registers for some consideration of concurrency SMP write performance. And this patch adds a flag for it.
I've pushed a tag regmap-irq-unmask so these can be pulled into another tree if needed (like for the MFD).
thanks, Mark, found it in your tree
https://git.kernel.org/cgit/linux/kernel/git/broonie/regmap.git/
-barry