i2c: Add Tegra BPMP I2C proxy driver
v2 cover i2c: Add Tegra BPMP I2C proxy driver
From: Thierry Reding <[email protected]>
Hi Wolfram,
I had originally sent these in for the last merge window but then got bounces indicating that your email server was not accepting emails. At the time it seemed like I wasn't the only one having these problems.
Looking at my mailbox that situation now seems to be resolved, so here's hoping it'll work this time. Note that because of the above I've carried this in the Tegra tree for a while now to get it more compile testing. If you end up applying the set, please let me know so I can drop them from the Tegra tree and avoid conflicts in linux-next.
On the bright side the dependencies for this were merged during the last release cycle, so these should be good to go in without further complications.
Thanks,
Thierry
Shardar Shariff Md (1):
i2c: Add Tegra BPMP I2C proxy driver
Stephen Warren (1):
dt-bindings: Add Tegra186 BPMP I2C binding
.../bindings/i2c/nvidia,tegra186-bpmp-i2c.txt | 42 +++ drivers/i2c/busses/Kconfig | 11 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-tegra-bpmp.c | 365 +++++++++++++++++++++ 4 files changed, 419 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt create mode 100644 drivers/i2c/busses/i2c-tegra-bpmp.c
Signature · 1 line
2.11.0
A message that is not in the archive (sent off-list or not yet received): 20170127083939.20393-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH v2 1/2 dt-bindings: Add Tegra186 BPMP I2C binding
From: Stephen Warren <[email protected]>
In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW devices, such as the I2C controller for the power management I2C bus. Software running on other CPUs must perform IPC to the BPMP in order to execute transactions on that I2C bus. This binding describes an I2C bus that is accessed in such a fashion.
--- .../bindings/i2c/nvidia,tegra186-bpmp-i2c.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt new file +42 -0
@@ -0,0 +1,42 @@ +NVIDIA Tegra186 BPMP I2C controller + +In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW +devices, such as the I2C controller for the power management I2C bus. Software +running on other CPUs must perform IPC to the BPMP in order to execute +transactions on that I2C bus. This binding describes an I2C bus that is +accessed in such a fashion. + +The BPMP I2C node must be located directly inside the main BPMP node. See +../firmware/nvidia,tegra186-bpmp.txt for details of the BPMP binding. + +This node represents an I2C controller. See ../i2c/i2c.txt for details of the +core I2C binding. + +Required properties: +- compatible: + Array of strings. + One of: + - "nvidia,tegra186-bpmp-i2c". +- #address-cells: Address cells for I2C device address. + Single-cell integer. + Must be <1>. +- #size-cells: + Single-cell integer. + Must be <0>. +- nvidia,bpmp-bus-id: + Single-cell integer. + Indicates the I2C bus number this DT node represent, as defined by the + BPMP firmware. + +Example: + +bpmp { + ... + + i2c { + compatible = "nvidia,tegra186-bpmp-i2c"; + #address-cells = <1>; + #size-cells = <0>; + nvidia,bpmp-bus-id = <5>; + }; +};
Signature · 1 line
2.11.0
Re: [PATCH v2 1/2] dt-bindings: Add Tegra186 BPMP I2C binding
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt line 29
Quoted 5 lines
+- nvidia,bpmp-bus-id:
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt new file +3
-0+ Single-cell integer. + Indicates the I2C bus number this DT node represent, as defined by the + BPMP firmware.
I'd like to get an ack from Rob for this one if vendor-specific bindings are still the way to go to encode firmware data. I simply don't know.
Quoted 13 lines
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt new file +13
-0+ +Example: + +bpmp { + ... + + i2c { + compatible = "nvidia,tegra186-bpmp-i2c"; + #address-cells = <1>; + #size-cells = <0>; + nvidia,bpmp-bus-id = <5>; + }; +};
A message that is not in the archive (sent off-list or not yet received): 20170127083939.20393-2-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH v2 1/2] dt-bindings: Add Tegra186 BPMP I2C binding
Quoted 13 lines · Thierry Reding
From: Stephen Warren <[email protected]>
In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW devices, such as the I2C controller for the power management I2C bus. Software running on other CPUs must perform IPC to the BPMP in order to execute transactions on that I2C bus. This binding describes an I2C bus that is accessed in such a fashion.
Signed-off-by Stephen Warren <[email protected]>Reviewed-by Simon Glass <[email protected]>Signed-off-by Tom Warren <[email protected]>Acked-by Jon Hunter <[email protected]>Signed-off-by Thierry Reding <[email protected]>
Quoted 4 lines
--- .../bindings/i2c/nvidia,tegra186-bpmp-i2c.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt
Rob, sorry for not Cc'ing you earlier on this, but I had thought this binding had already been reviewed and acked since it is merged in U-Boot.
Wolfram was concerned in particular about the nvidia,bpmp-bus-id property below.
Can you give this a quick look, please?
Thanks,
Thierry
Quoted 51 lines
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt new file +42
-0@@ -0,0 +1,42 @@ +NVIDIA Tegra186 BPMP I2C controller + +In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW +devices, such as the I2C controller for the power management I2C bus. Software +running on other CPUs must perform IPC to the BPMP in order to execute +transactions on that I2C bus. This binding describes an I2C bus that is +accessed in such a fashion. + +The BPMP I2C node must be located directly inside the main BPMP node. See +../firmware/nvidia,tegra186-bpmp.txt for details of the BPMP binding. + +This node represents an I2C controller. See ../i2c/i2c.txt for details of the +core I2C binding. + +Required properties: +- compatible: + Array of strings. + One of: + - "nvidia,tegra186-bpmp-i2c". +- #address-cells: Address cells for I2C device address. + Single-cell integer. + Must be <1>. +- #size-cells: + Single-cell integer. + Must be <0>. +- nvidia,bpmp-bus-id: + Single-cell integer. + Indicates the I2C bus number this DT node represent, as defined by the + BPMP firmware. + +Example: + +bpmp { + ... + + i2c { + compatible = "nvidia,tegra186-bpmp-i2c"; + #address-cells = <1>; + #size-cells = <0>; + nvidia,bpmp-bus-id = <5>; + }; +};Signature · 1 line
2.11.0
A message that is not in the archive (sent off-list or not yet received): 20170127221857.GA15715-+E7KM1FDEuO2P7RxrfNFTMXXUOn6P5/[email protected]
Re: [PATCH v2 1/2] dt-bindings: Add Tegra186 BPMP I2C binding
Quoted 19 lines · Thierry Reding
Quoted 13 lines · Thierry Reding
From: Stephen Warren <[email protected]>
In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW devices, such as the I2C controller for the power management I2C bus. Software running on other CPUs must perform IPC to the BPMP in order to execute transactions on that I2C bus. This binding describes an I2C bus that is accessed in such a fashion.
Signed-off-by Stephen Warren <[email protected]>Reviewed-by Simon Glass <[email protected]>Signed-off-by Tom Warren <[email protected]>Acked-by Jon Hunter <[email protected]>Signed-off-by Thierry Reding <[email protected]>Quoted 4 lines
--- .../bindings/i2c/nvidia,tegra186-bpmp-i2c.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt
Quoted 3 lines
Rob, sorry for not Cc'ing you earlier on this, but I had thought this binding had already been reviewed and acked since it is merged in U-Boot.
Ha! Good one. :(
Quoted 36 lines
Wolfram was concerned in particular about the nvidia,bpmp-bus-id property below.
Can you give this a quick look, please?
Thanks,
ThierryQuoted 27 lines
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt new file +21
-0@@ -0,0 +1,42 @@ +NVIDIA Tegra186 BPMP I2C controller + +In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW +devices, such as the I2C controller for the power management I2C bus. Software +running on other CPUs must perform IPC to the BPMP in order to execute +transactions on that I2C bus. This binding describes an I2C bus that is +accessed in such a fashion. + +The BPMP I2C node must be located directly inside the main BPMP node. See +../firmware/nvidia,tegra186-bpmp.txt for details of the BPMP binding. + +This node represents an I2C controller. See ../i2c/i2c.txt for details of the +core I2C binding. + +Required properties: +- compatible: + Array of strings. + One of: + - "nvidia,tegra186-bpmp-i2c". +- #address-cells: Address cells for I2C device address. + Single-cell integer.
Quoted 8 lines
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt line 29
Quoted 8 lines
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt new file +8
-0+ Must be <1>. +- #size-cells: + Single-cell integer. + Must be <0>. +- nvidia,bpmp-bus-id: + Single-cell integer. + Indicates the I2C bus number this DT node represent, as defined by the + BPMP firmware.
This seems okay to me given it's a pretty specific use and dictated by the firmware. If there were multiple, then perhaps we should use reg, but that may collide with other BPMP child nodes.
Rob
A message that is not in the archive (sent off-list or not yet received): CAL_Jsq+Sr=dOw7_9UAL4jO0zXycT7sHoCvUM4C2-9LBgdx=25g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v2 1/2] dt-bindings: Add Tegra186 BPMP I2C binding
Quoted 21 lines · Rob Herring
Quoted 19 lines · Thierry Reding
Quoted 17 lines · Thierry Reding
From: Stephen Warren <[email protected]>
In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW devices, such as the I2C controller for the power management I2C bus. Software running on other CPUs must perform IPC to the BPMP in order to execute transactions on that I2C bus. This binding describes an I2C bus that is accessed in such a fashion.
Signed-off-by Stephen Warren <[email protected]>Reviewed-by Simon Glass <[email protected]>Signed-off-by Tom Warren <[email protected]>Acked-by Jon Hunter <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- .../bindings/i2c/nvidia,tegra186-bpmp-i2c.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt
Quoted 5 lines
Quoted 3 lines
Rob, sorry for not Cc'ing you earlier on this, but I had thought this binding had already been reviewed and acked since it is merged in U-Boot.
Ha! Good one. :(
So I went looking for earlier discussion on this patch because I distinctly remembered you being part of it, and found this:
https://patchwork.ozlabs.org/patch/650385/
You already gave an Acked-by, but I failed to pick it up for some reason. Given what you said below I'm going to assume that it still applies.
Wolfram, do you want me to resend with Rob's Acked-by from back in July or do you want to add it yourself when applying?
Thanks,
Thierry
Quoted 53 lines
Quoted 35 lines
Wolfram was concerned in particular about the nvidia,bpmp-bus-id property below.
Can you give this a quick look, please?
Thanks,
ThierryQuoted 27 lines
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt new file +21
-0@@ -0,0 +1,42 @@ +NVIDIA Tegra186 BPMP I2C controller + +In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW +devices, such as the I2C controller for the power management I2C bus. Software +running on other CPUs must perform IPC to the BPMP in order to execute +transactions on that I2C bus. This binding describes an I2C bus that is +accessed in such a fashion. + +The BPMP I2C node must be located directly inside the main BPMP node. See +../firmware/nvidia,tegra186-bpmp.txt for details of the BPMP binding. + +This node represents an I2C controller. See ../i2c/i2c.txt for details of the +core I2C binding. + +Required properties: +- compatible: + Array of strings. + One of: + - "nvidia,tegra186-bpmp-i2c". +- #address-cells: Address cells for I2C device address. + Single-cell integer.Quoted 8 lines
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt line 29
Quoted 8 lines
Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt new file +8
-0+ Must be <1>. +- #size-cells: + Single-cell integer. + Must be <0>. +- nvidia,bpmp-bus-id: + Single-cell integer. + Indicates the I2C bus number this DT node represent, as defined by the + BPMP firmware.This seems okay to me given it's a pretty specific use and dictated by the firmware. If there were multiple, then perhaps we should use reg, but that may collide with other BPMP child nodes.
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/2] dt-bindings: Add Tegra186 BPMP I2C binding
In reply to Thierry RedingQuoted 19 lines · Thierry Reding
Quoted 13 lines · Thierry Reding
From: Stephen Warren <[email protected]>
In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW devices, such as the I2C controller for the power management I2C bus. Software running on other CPUs must perform IPC to the BPMP in order to execute transactions on that I2C bus. This binding describes an I2C bus that is accessed in such a fashion.
Signed-off-by Stephen Warren <[email protected]>Reviewed-by Simon Glass <[email protected]>Signed-off-by Tom Warren <[email protected]>Acked-by Jon Hunter <[email protected]>Signed-off-by Thierry Reding <[email protected]>Quoted 4 lines
--- .../bindings/i2c/nvidia,tegra186-bpmp-i2c.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt
Quoted 3 lines
Rob, sorry for not Cc'ing you earlier on this, but I had thought this binding had already been reviewed and acked since it is merged in U-Boot.
I'm pretty sure all the DT binding patches for Tegra186 that I submitted were ack'd by Rob. They were certainly all posted to relevant Linux lists and discussed and ack'd by someone before I pushed them into U-Boot. Probably 2nd quarter last year, or maybe 3rd.
A message that is not in the archive (sent off-list or not yet received): 8841854b-d058-1a8d-3e40-955bf3546cef-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org
Re: [PATCH v2 1/2] dt-bindings: Add Tegra186 BPMP I2C binding
Quoted 20 lines · Stephen Warren
Quoted 19 lines · Thierry Reding
Quoted 17 lines · Thierry Reding
From: Stephen Warren <[email protected]>
In Tegra186, the BPMP (Boot and Power Management Processor) owns certain HW devices, such as the I2C controller for the power management I2C bus. Software running on other CPUs must perform IPC to the BPMP in order to execute transactions on that I2C bus. This binding describes an I2C bus that is accessed in such a fashion.
Signed-off-by Stephen Warren <[email protected]>Reviewed-by Simon Glass <[email protected]>Signed-off-by Tom Warren <[email protected]>Acked-by Jon Hunter <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- .../bindings/i2c/nvidia,tegra186-bpmp-i2c.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/nvidia,tegra186-bpmp-i2c.txt
Quoted 8 lines
Quoted 3 lines
Rob, sorry for not Cc'ing you earlier on this, but I had thought this binding had already been reviewed and acked since it is merged in U-Boot.
I'm pretty sure all the DT binding patches for Tegra186 that I submitted were ack'd by Rob. They were certainly all posted to relevant Linux lists and discussed and ack'd by someone before I pushed them into U-Boot. Probably 2nd quarter last year, or maybe 3rd.
Yes, I thought I had seen an Acked-by myself, and I know that you're very diligent about this. And true enough, it's in patchwork. I probably missed it because I was cherry-picking it directly from U-Boot where the Acked-by wasn't present.
Thierry
PATCH v2 2/2 i2c: Add Tegra BPMP I2C proxy driver
In reply to a message not in the archiveFrom: Shardar Shariff Md <[email protected]>
Add Tegra BPMP I2C driver. The BPMP is the boot and power management processor embedded in Tegra SoCs. In newer SoC versions, access to one of the I2C busses goes via the BPMP, requiring a different "proxy" I2C driver that accesses the bus via the real I2C driver embedded in the BPMP firmware.
--- drivers/i2c/busses/Kconfig | 11 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-tegra-bpmp.c | 365 ++++++++++++++++++++++++++++++++++++ 3 files changed, 377 insertions(+) create mode 100644 drivers/i2c/busses/i2c-tegra-bpmp.c
drivers/i2c/busses/Kconfig +11 -0
@@ -919,6 +919,17 @@ config I2C_TEGRA If you say yes to this option, support will be included for the I2C controller embedded in NVIDIA Tegra SOCs +config I2C_TEGRA_BPMP + tristate "NVIDIA Tegra BPMP I2C controller" + depends on TEGRA_BPMP + help + If you say yes to this option, support will be included for the I2C + controller embedded in NVIDIA Tegra SoCs accessed via the BPMP. + + This I2C driver is a 'virtual' I2C driver. The real driver is part + of the BPMP firmware, and this driver merely communicates with that + real driver. + config I2C_UNIPHIER tristate "UniPhier FIFO-less I2C controller" depends on ARCH_UNIPHIER || COMPILE_TEST
drivers/i2c/busses/Makefile +1 -0
@@ -88,6 +88,7 @@ obj-$(CONFIG_I2C_ST) += i2c-st.o obj-$(CONFIG_I2C_STU300) += i2c-stu300.o obj-$(CONFIG_I2C_SUN6I_P2WI) += i2c-sun6i-p2wi.o obj-$(CONFIG_I2C_TEGRA) += i2c-tegra.o +obj-$(CONFIG_I2C_TEGRA_BPMP) += i2c-tegra-bpmp.o obj-$(CONFIG_I2C_UNIPHIER) += i2c-uniphier.o obj-$(CONFIG_I2C_UNIPHIER_F) += i2c-uniphier-f.o obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
drivers/i2c/busses/i2c-tegra-bpmp.c new file +365 -0
365 lines not on this page · raw message
Signature · 1 line
2.11.0
Hi there,
Quoted 5 lines
drivers/i2c/busses/i2c-tegra-bpmp.c new file +5
-0+static int tegra_bpmp_i2c_msg_len_check (struct i2c_msg *msgs,unsigned int num) +{ +size_t tx_len =0 , rx_len =0 ; +unsigned int i; +
drivers/i2c/busses/i2c-tegra-bpmp.c line 198
Quoted 10 lines
drivers/i2c/busses/i2c-tegra-bpmp.c new file +10
-0+for (i =0 ; i < num; i++) +if (!(msgs[i].flags &I2C_M_RD )) + tx_len +=SERIALI2C_HDR_SIZE + msgs[i].len; + +if (tx_len >TEGRA_I2C_IPC_MAX_IN_BUF_SIZE ) +return -EINVAL ; + +for (i =0 ; i < num; i++) +if ((msgs[i].flags &I2C_M_RD )) + rx_len += msgs[i].len;
You could have done with iterating over all msgs only once, but no need to fix. I think I'll update the i2c core quirks feature to support your case and rework that incrementally.
drivers/i2c/busses/i2c-tegra-bpmp.c line 247
Quoted 3 lines
drivers/i2c/busses/i2c-tegra-bpmp.c new file +3
-0+/* TODO: move this somewhere else */ +memset (&request,0 ,sizeof (request)); +memset (&response,0 ,sizeof (response));
So? :)
drivers/i2c/busses/i2c-tegra-bpmp.c line 308
Quoted 1 line
drivers/i2c/busses/i2c-tegra-bpmp.c new file +1
-0+ i2c->adapter.class =I2C_CLASS_HWMON ;
Do you really need that?
drivers/i2c/busses/i2c-tegra-bpmp.c line 319
Quoted 3 lines
drivers/i2c/busses/i2c-tegra-bpmp.c new file +3
-0+ err =i2c_add_adapter (&i2c->adapter); +if (err <0 ) { +dev_err (&pdev->dev,"failed to add I2C adapter: %d\n" , err);
No error message here, the core will do that.
drivers/i2c/busses/i2c-tegra-bpmp.c line 354
Quoted 5 lines
drivers/i2c/busses/i2c-tegra-bpmp.c new file +5
-0+static int __init tegra_bpmp_i2c_init_driver (void ) +{ +return platform_driver_register (&tegra_bpmp_i2c_driver); +} +subsys_initcall (tegra_bpmp_i2c_init_driver);
Have you tried if subsys_initcall is really really necessary?
Thanks,
Wolfram