Add microchip sama7d65 SoC I3C support
Subsystems (5)
v3 cover Add microchip sama7d65 SoC I3C support
Add support for microchip sama7d65 SoC I3C master only IP which is based on mipi-i3c-hci from synopsys implementing version 1.0 specification. The platform specific changes are integrated in the existing mipi-i3c-hci driver by introducing a quirk
I3C in master mode supports up to 12.5MHz, SDR mode data transfer in mixed bus mode (I2C and I3C target devices on same i3c bus).
Durai Manickam KR (3):
clk: at91: sama7d65: add peripheral clock for I3C
ARM: dts: microchip: add I3C controller
ARM: configs: at91: sama7: add sama7d65 i3c-hci
Manikandan Muralidharan (2):
dt-bindings: i3c: mipi-i3c-hci: add Microchip SAMA7D65 compatible
i3c: mipi-i3c-hci: add microchip sama7d65 SoC compatible with the
appropriate quirk
.../devicetree/bindings/i3c/mipi-i3c-hci.yaml | 22 +++++++++++++++---- arch/arm/boot/dts/microchip/sama7d65.dtsi | 8 +++++++ arch/arm/configs/sama7_defconfig | 2 ++ drivers/clk/at91/sama7d65.c | 1 + drivers/i3c/master/mipi-i3c-hci/core.c | 12 ++++++++++ drivers/i3c/master/mipi-i3c-hci/hci.h | 4 ++++ 6 files changed, 45 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 2/5 clk: at91: sama7d65: add peripheral clock for I3C
From: Durai Manickam KR <[email protected]>
Add peripheral clock description for I3C.
---
changes in v3:
- Fixed indentation issues
--- drivers/clk/at91/sama7d65.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/at91/sama7d65.c +1 -0
@@ -677,6 +677,7 @@ static struct { { .n = "uhphs_clk", .p = PCK_PARENT_HW_MCK5, .id = 101, }, { .n = "dsi_clk", .p = PCK_PARENT_HW_MCK3, .id = 103, }, { .n = "lvdsc_clk", .p = PCK_PARENT_HW_MCK3, .id = 104, }, + { .n = "i3cc_clk", .p = PCK_PARENT_HW_MCK8, .id = 105, }, }; /*
Signature · 1 line
2.25.1
PATCH v3 3/5 i3c: mipi-i3c-hci: add microchip sama7d65 SoC compatible with the appropriate quirk
In reply to Manikandan MuralidharanAdd support for microchip sama7d65 SoC I3C HCI master only IP with additional clock support to enable bulk clock acquisition for Microchip platforms using HCI_QUIRK_CLK_SUPPORT quirk. Introduce MCHP_I3C_CLK_IDX to define the maximum peripheral clock index
---
Changes in v3:
- Make use of existing HCI_QUIRK_* code base
- Introduce HCI_QUIRK_CLK_SUPPORT to handle/enable the required Peripheral and system generic clk in bulk
Changes in v2:
- Platform specific changes are integrated in the existing mipi-i3c-hci driver by introducing separate MCHP_HCI_QUIRK_* quirks and vendor specific quirk files
--- drivers/i3c/master/mipi-i3c-hci/core.c | 12 ++++++++++++ drivers/i3c/master/mipi-i3c-hci/hci.h | 4 ++++ 2 files changed, 16 insertions(+)
drivers/i3c/master/mipi-i3c-hci/core.c +12 -0
@@ -8,6 +8,7 @@*/ #include <linux/bitfield.h> +#include <linux/clk.h> #include <linux/device.h> #include <linux/errno.h> #include <linux/i3c/master.h>
@@ -918,6 +919,7 @@ static int i3c_hci_probe(struct platform_device *pdev) {const struct mipi_i3c_hci_platform_data *pdata = pdev->dev.platform_data;struct i3c_hci *hci; +struct clk_bulk_data *clks;int irq, ret; hci =devm_kzalloc (&pdev->dev,sizeof (*hci),GFP_KERNEL );
@@ -946,6 +948,13 @@ static int i3c_hci_probe(struct platform_device *pdev)if (!hci->quirks &&platform_get_device_id (pdev)) hci->quirks =platform_get_device_id (pdev)->driver_data; +if (hci->quirks &HCI_QUIRK_CLK_SUPPORT ) { + ret =devm_clk_bulk_get_all_enabled (&pdev->dev, &clks); +if (ret <MCHP_I3C_CLK_IDX ) +return dev_err_probe (&pdev->dev, ret, +"Failed to get clocks\n" ); + } + ret =i3c_hci_init (hci);if (ret)return ret;
@@ -971,6 +980,9 @@ static void i3c_hci_remove(struct platform_device *pdev)static const __maybe_unused struct of_device_id i3c_hci_of_match[] = { { .compatible ="mipi-i3c-hci" , }, + { .compatible ="microchip,sama7d65-i3c-hci" , + .data = (void *)(HCI_QUIRK_PIO_MODE |HCI_QUIRK_OD_PP_TIMING | +HCI_QUIRK_RESP_BUF_THLD |HCI_QUIRK_CLK_SUPPORT ) }, {}, };MODULE_DEVICE_TABLE (of, i3c_hci_of_match);
drivers/i3c/master/mipi-i3c-hci/hci.h +4 -0
@@ -140,12 +140,16 @@ struct i3c_hci_dev_data {void *ibi_data; }; +#define MCHP_I3C_CLK_IDX 2/* Max peripheral clock index for Microchip platforms */ +/* list of quirks */ #define HCI_QUIRK_RAW_CCC BIT(1)/* CCC framing must be explicit */ #define HCI_QUIRK_PIO_MODE BIT(2)/* Set PIO mode for AMD platforms */ #define HCI_QUIRK_OD_PP_TIMING BIT(3)/* Set OD and PP timings for AMD platforms */ #define HCI_QUIRK_RESP_BUF_THLD BIT(4)/* Set resp buf thld to 0 for AMD platforms */ #define HCI_QUIRK_RPM_ALLOWED BIT(5)/* Runtime PM allowed */ +#define HCI_QUIRK_CLK_SUPPORT BIT(6)/* Enable Clocks for Microchip platforms*/ +/* global functions */ void mipi_i3c_hci_resume (struct i3c_hci *hci);
Signature · 7 lines
2.25.1 -- linux-i3c mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-i3c
PATCH v3 1/5 dt-bindings: i3c: mipi-i3c-hci: add Microchip SAMA7D65 compatible
In reply to Manikandan MuralidharanAdd the microchip,sama7d65-i3c-hci compatible string to the MIPI I3C HCI binding. The Microchip SAMA7D65 I3C controller is based on the MIPI HCI specification but requires two clocks, so add a conditional constraint when this compatible is present.
--- .../devicetree/bindings/i3c/mipi-i3c-hci.yaml | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/i3c/mipi-i3c-hci.yaml +18 -4
@@ -9,9 +9,6 @@ title: MIPI I3C HCI maintainers: - Nicolas Pitre <[email protected]> -allOf: - - $ref: /schemas/i3c/i3c.yaml# - description: | MIPI I3C Host Controller Interface
@@ -28,7 +25,9 @@ description: | properties: compatible: - const: mipi-i3c-hci + enum: + - mipi-i3c-hci + - microchip,sama7d65-i3c-hci reg: maxItems: 1 interrupts:
@@ -39,6 +38,21 @@ required: - reg - interrupts +allOf: + - $ref: /schemas/i3c/i3c.yaml# + - if: + properties: + compatible: + contains: + const: microchip,sama7d65-i3c-hci + then: + properties: + clocks: + minItems: 2 + maxItems: 2 + required: + - clocks + unevaluatedProperties: false examples:
Signature · 1 line
2.25.1
PATCH v3 5/5 ARM: configs: at91: sama7: add sama7d65 i3c-hci
In reply to Manikandan MuralidharanFrom: Durai Manickam KR <[email protected]>
Enable the configs needed for I3C framework and microchip sama7d65 i3c-hci driver.
--- arch/arm/configs/sama7_defconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/configs/sama7_defconfig +2 -0
@@ -115,6 +115,8 @@ CONFIG_HW_RANDOM=y CONFIG_I2C=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_AT91=y +CONFIG_I3C=y +CONFIG_MIPI_I3C_HCI=y CONFIG_SPI=y CONFIG_SPI_ATMEL=y CONFIG_SPI_ATMEL_QUADSPI=y
Signature · 1 line
2.25.1
PATCH v3 4/5 ARM: dts: microchip: add I3C controller
In reply to Manikandan MuralidharanFrom: Durai Manickam KR <[email protected]>
Add I3C controller for sama7d65 SoC.
---
Changes in v3:
- Remove clock-names property as driver enables the clk in bulk
--- arch/arm/boot/dts/microchip/sama7d65.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/microchip/sama7d65.dtsi +8 -0
@@ -1015,5 +1015,13 @@ gic: interrupt-controller@e8c11000 { #address-cells = <0>; interrupt-controller; }; + + i3c: i3c@e9000000 { + compatible = "microchip,sama7d65-i3c-hci"; + reg = <0xe9000000 0x300>; + interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 105>, <&pmc PMC_TYPE_GCK 105>; + status = "disabled"; + }; }; };
Signature · 1 line
2.25.1
Re: [PATCH v3 3/5] i3c: mipi-i3c-hci: add microchip sama7d65 SoC compatible with the appropriate quirk
In reply to Manikandan MuralidharanQuoted 44 lines · Manikandan Muralidharan
Add support for microchip sama7d65 SoC I3C HCI master only IP with additional clock support to enable bulk clock acquisition for Microchip platforms using
HCI_QUIRK_CLK_SUPPORTquirk. IntroduceMCHP_I3C_CLK_IDXto define the maximum peripheral clock indexSigned-off-by Manikandan Muralidharan <[email protected]>---
Changes in v3:
- Make use of existing HCI_QUIRK_* code base
- IntroduceHCI_QUIRK_CLK_SUPPORTto handle/enable the required Peripheral and system generic clk in bulkChanges in v2:
- Platform specific changes are integrated in the existing mipi-i3c-hci driver by introducing separate MCHP_HCI_QUIRK_* quirks and vendor specific quirk files--- drivers/i3c/master/mipi-i3c-hci/core.c | 12 ++++++++++++ drivers/i3c/master/mipi-i3c-hci/hci.h | 4 ++++ 2 files changed, 16 insertions(+)drivers/i3c/master/mipi-i3c-hci/core.c +2
-0@@ -8,6 +8,7 @@*/ #include <linux/bitfield.h> +#include <linux/clk.h> #include <linux/device.h> #include <linux/errno.h> #include <linux/i3c/master.h> @@ -918,6 +919,7 @@ static int i3c_hci_probe(struct platform_device *pdev) {const struct mipi_i3c_hci_platform_data *pdata = pdev->dev.platform_data;struct i3c_hci *hci; +struct clk_bulk_data *clks;int irq, ret; hci =devm_kzalloc (&pdev->dev,sizeof (*hci),GFP_KERNEL );
drivers/i3c/master/mipi-i3c-hci/core.c static int i3c_hci_probe(struct platform_device *pdev) · line 953
Quoted 6 lines
drivers/i3c/master/mipi-i3c-hci/core.c +3
-0@@ -946,6 +948,13 @@ static int i3c_hci_probe(struct platform_device *pdev)if (!hci->quirks &&platform_get_device_id (pdev)) hci->quirks =platform_get_device_id (pdev)->driver_data; +if (hci->quirks &HCI_QUIRK_CLK_SUPPORT ) { + ret =devm_clk_bulk_get_all_enabled (&pdev->dev, &clks); +if (ret <MCHP_I3C_CLK_IDX )
Is MCHP_I3C_CLK_IDX really needed? Why not just:
if (ret <= 0)
i.e. don't you anyway have to assume DT has the clocks defined correctly.
Quoted 24 lines
drivers/i3c/master/mipi-i3c-hci/core.c +7
-0+return dev_err_probe (&pdev->dev, ret, +"Failed to get clocks\n" ); + } + ret =i3c_hci_init (hci);if (ret)return ret;@@ -971,6 +980,9 @@ static void i3c_hci_remove(struct platform_device *pdev)static const __maybe_unused struct of_device_id i3c_hci_of_match[] = { { .compatible ="mipi-i3c-hci" , }, + { .compatible ="microchip,sama7d65-i3c-hci" , + .data = (void *)(HCI_QUIRK_PIO_MODE |HCI_QUIRK_OD_PP_TIMING | +HCI_QUIRK_RESP_BUF_THLD |HCI_QUIRK_CLK_SUPPORT ) }, {}, };MODULE_DEVICE_TABLE (of, i3c_hci_of_match);drivers/i3c/master/mipi-i3c-hci/hci.h +0
-0@@ -140,12 +140,16 @@ struct i3c_hci_dev_data {void *ibi_data; };
drivers/i3c/master/mipi-i3c-hci/hci.h struct i3c_hci_dev_data { · line 151
Quoted 10 lines
drivers/i3c/master/mipi-i3c-hci/hci.h +3
-0+#define MCHP_I3C_CLK_IDX 2/* Max peripheral clock index for Microchip platforms */ +/* list of quirks */ #define HCI_QUIRK_RAW_CCC BIT(1)/* CCC framing must be explicit */ #define HCI_QUIRK_PIO_MODE BIT(2)/* Set PIO mode for AMD platforms */ #define HCI_QUIRK_OD_PP_TIMING BIT(3)/* Set OD and PP timings for AMD platforms */ #define HCI_QUIRK_RESP_BUF_THLD BIT(4)/* Set resp buf thld to 0 for AMD platforms */ #define HCI_QUIRK_RPM_ALLOWED BIT(5)/* Runtime PM allowed */ +#define HCI_QUIRK_CLK_SUPPORT BIT(6)/* Enable Clocks for Microchip platforms*/
Without MCHP_I3C_CLK_IDX this becomes a generic quirk that others can use
Quoted 4 lines
drivers/i3c/master/mipi-i3c-hci/hci.h +1
-0+/* global functions */ void mipi_i3c_hci_resume (struct i3c_hci *hci);
Re: [PATCH v3 1/5] dt-bindings: i3c: mipi-i3c-hci: add Microchip SAMA7D65 compatible
In reply to Manikandan MuralidharanQuoted 43 lines · Manikandan Muralidharan
Add the microchip,sama7d65-i3c-hci compatible string to the MIPI I3C HCI binding. The Microchip SAMA7D65 I3C controller is based on the MIPI HCI specification but requires two clocks, so add a conditional constraint when this compatible is present.
Signed-off-by Manikandan Muralidharan <[email protected]>--- .../devicetree/bindings/i3c/mipi-i3c-hci.yaml | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)Documentation/devicetree/bindings/i3c/mipi-i3c-hci.yaml +7
-4@@ -9,9 +9,6 @@ title: MIPI I3C HCI maintainers: - Nicolas Pitre <[email protected]> -allOf: - - $ref: /schemas/i3c/i3c.yaml# - description: | MIPI I3C Host Controller Interface@@ -28,7 +25,9 @@ description: | properties: compatible: - const: mipi-i3c-hci + enum: + - mipi-i3c-hci + - microchip,sama7d65-i3c-hci reg: maxItems: 1 interrupts:@@ -39,6 +38,21 @@ required: - reg - interrupts +allOf: + - $ref: /schemas/i3c/i3c.yaml# + - if: + properties:
Documentation/devicetree/bindings/i3c/mipi-i3c-hci.yaml required: · line 54
Quoted 10 lines
Documentation/devicetree/bindings/i3c/mipi-i3c-hci.yaml +10
-0+ compatible: + contains: + const: microchip,sama7d65-i3c-hci + then: + properties: + clocks: + minItems: 2 + maxItems: 2 + required: + - clocks
Properties should be defined at the top level, and only restricted in conditional schemas. Please add them at the top level, and provide some information as to what each clock is via a description.
pw-bot: changes-requested
Thanks,
Conor.
Quoted 7 lines
Documentation/devicetree/bindings/i3c/mipi-i3c-hci.yaml +1
-0+ unevaluatedProperties: false examples:Signature · 1 line
2.25.1
Re: [PATCH v3 3/5] i3c: mipi-i3c-hci: add microchip sama7d65 SoC compatible with the appropriate quirk
In reply to Adrian HunterQuoted 54 lines · Adrian Hunter
Quoted 44 lines · Manikandan Muralidharan
Add support for microchip sama7d65 SoC I3C HCI master only IP with additional clock support to enable bulk clock acquisition for Microchip platforms using
HCI_QUIRK_CLK_SUPPORTquirk. IntroduceMCHP_I3C_CLK_IDXto define the maximum peripheral clock indexSigned-off-by Manikandan Muralidharan <[email protected]>---
Changes in v3:
- Make use of existing HCI_QUIRK_* code base
- IntroduceHCI_QUIRK_CLK_SUPPORTto handle/enable the required Peripheral and system generic clk in bulkChanges in v2:
- Platform specific changes are integrated in the existing mipi-i3c-hci driver by introducing separate MCHP_HCI_QUIRK_* quirks and vendor specific quirk files--- drivers/i3c/master/mipi-i3c-hci/core.c | 12 ++++++++++++ drivers/i3c/master/mipi-i3c-hci/hci.h | 4 ++++ 2 files changed, 16 insertions(+)drivers/i3c/master/mipi-i3c-hci/core.c +2
-0@@ -8,6 +8,7 @@*/ #include <linux/bitfield.h> +#include <linux/clk.h> #include <linux/device.h> #include <linux/errno.h> #include <linux/i3c/master.h> @@ -918,6 +919,7 @@ static int i3c_hci_probe(struct platform_device *pdev) {const struct mipi_i3c_hci_platform_data *pdata = pdev->dev.platform_data;struct i3c_hci *hci; +struct clk_bulk_data *clks;int irq, ret; hci =devm_kzalloc (&pdev->dev,sizeof (*hci),GFP_KERNEL );drivers/i3c/master/mipi-i3c-hci/core.c static int i3c_hci_probe(struct platform_device *pdev) · line 953
Quoted 6 lines
drivers/i3c/master/mipi-i3c-hci/core.c +3
-0@@ -946,6 +948,13 @@ static int i3c_hci_probe(struct platform_device *pdev)if (!hci->quirks &&platform_get_device_id (pdev)) hci->quirks =platform_get_device_id (pdev)->driver_data; +if (hci->quirks &HCI_QUIRK_CLK_SUPPORT ) { + ret =devm_clk_bulk_get_all_enabled (&pdev->dev, &clks); +if (ret <MCHP_I3C_CLK_IDX )Is
MCHP_I3C_CLK_IDXreally needed? Why not just:
Quoted 4 lines
if (ret <= 0)i.e. don't you anyway have to assume DT has the clocks defined correctly.
Ye, I think this is kinda silly. Trust dtbs_check to have the correct number for your platform set, and let this be specific.
Re: [PATCH v3 3/5] i3c: mipi-i3c-hci: add microchip sama7d65 SoC compatible with the appropriate quirk
Quoted 55 lines · Conor Dooley
Quoted 54 lines · Adrian Hunter
Quoted 44 lines · Manikandan Muralidharan
Add support for microchip sama7d65 SoC I3C HCI master only IP with additional clock support to enable bulk clock acquisition for Microchip platforms using
HCI_QUIRK_CLK_SUPPORTquirk. IntroduceMCHP_I3C_CLK_IDXto define the maximum peripheral clock indexSigned-off-by Manikandan Muralidharan <[email protected]>---
Changes in v3:
- Make use of existing HCI_QUIRK_* code base
- IntroduceHCI_QUIRK_CLK_SUPPORTto handle/enable the required Peripheral and system generic clk in bulkChanges in v2:
- Platform specific changes are integrated in the existing mipi-i3c-hci driver by introducing separate MCHP_HCI_QUIRK_* quirks and vendor specific quirk files--- drivers/i3c/master/mipi-i3c-hci/core.c | 12 ++++++++++++ drivers/i3c/master/mipi-i3c-hci/hci.h | 4 ++++ 2 files changed, 16 insertions(+)drivers/i3c/master/mipi-i3c-hci/core.c +2
-0@@ -8,6 +8,7 @@*/ #include <linux/bitfield.h> +#include <linux/clk.h> #include <linux/device.h> #include <linux/errno.h> #include <linux/i3c/master.h> @@ -918,6 +919,7 @@ static int i3c_hci_probe(struct platform_device *pdev) {const struct mipi_i3c_hci_platform_data *pdata = pdev->dev.platform_data;struct i3c_hci *hci; +struct clk_bulk_data *clks;int irq, ret; hci =devm_kzalloc (&pdev->dev,sizeof (*hci),GFP_KERNEL );drivers/i3c/master/mipi-i3c-hci/core.c static int i3c_hci_probe(struct platform_device *pdev) · line 953
Quoted 6 lines
drivers/i3c/master/mipi-i3c-hci/core.c +3
-0@@ -946,6 +948,13 @@ static int i3c_hci_probe(struct platform_device *pdev)if (!hci->quirks &&platform_get_device_id (pdev)) hci->quirks =platform_get_device_id (pdev)->driver_data; +if (hci->quirks &HCI_QUIRK_CLK_SUPPORT ) { + ret =devm_clk_bulk_get_all_enabled (&pdev->dev, &clks); +if (ret <MCHP_I3C_CLK_IDX )Is
MCHP_I3C_CLK_IDXreally needed? Why not just:
Quoted 7 lines
Quoted 4 lines
if (ret <= 0)i.e. don't you anyway have to assume DT has the clocks defined correctly.
Ye, I think this is kinda silly. Trust
dtbs_checkto have the correct number for your platform set, and let this be specific.
Thank you Adrian and Conor
I will drop MCHP_I3C_CLK_IDX in the next version.
Signature · 2 lines
Thanks and Regards, Manikandan M.