* [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub
@ 2022-11-29 14:47 Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 1/6] dt-bindings: qcom: geni-se: document I2C Master Hub wrapper variant Neil Armstrong
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Neil Armstrong @ 2022-11-29 14:47 UTC (permalink / raw)
To: Bjorn Andersson, Rob Herring, Andy Gross, Krzysztof Kozlowski
Cc: Krzysztof Kozlowski, linux-i2c, linux-arm-msm, Konrad Dybcio,
devicetree, linux-kernel, Neil Armstrong
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.
The I2C Master Hub only supports a variant of the I2C serial engine with:
- a separate "core" clock
- no DMA support
- non discoverable fixed FIFO size
Since DMA isn't supported, the wrapper doesn't need the Master AHB clock
and the iommus property neither.
This patchset adds the bindings changes to the QUPv3 wrapper and I2C serial
element bindings to reflect the different resources requirements.
In order to reuse the QUPv3 wrapper and I2C serial element driver support,
the I2C Master Hub requirements are expressed in new desc structs passed
as device match data.
To: Andy Gross <agross@kernel.org>
To: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Rob Herring <robh+dt@kernel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-i2c@vger.kernel.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
Changes in v3:
- Fixed check of DT clocks count on geni-se.c with Kondar help
- Added Krzysztof's Reviewed-by on patches 1 & 2
- Link to v2: https://lore.kernel.org/r/20221114-narmstrong-sm8550-upstream-i2c-master-hub-v2-0-aadaa6997b28@linaro.org
Changes in v2:
- Fixed all commits messages to remove "This" and fix grammar
- Fixed the bindings by moving the if in allOf:if
- Fixed the bindings by adding minItems: & maxItems: instead of true
- Added a warning about clock count in patch 3
- Added Reviewed-by from Konrad on patches 3, 4 & 5
- Link to v1: https://lore.kernel.org/r/20221114-narmstrong-sm8550-upstream-i2c-master-hub-v1-0-64449106a148@linaro.org
---
Neil Armstrong (6):
dt-bindings: qcom: geni-se: document I2C Master Hub wrapper variant
dt-bindings: i2c: qcom-geni: document I2C Master Hub serial I2C engine
soc: qcom: geni-se: add desc struct to specify clocks from device match data
soc: qcom: geni-se: add support for I2C Master Hub wrapper variant
i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant
i2c: qcom-geni: add support for I2C Master Hub variant
.../bindings/i2c/qcom,i2c-geni-qcom.yaml | 64 +++++++++++++++---
.../devicetree/bindings/soc/qcom/qcom,geni-se.yaml | 44 ++++++++++--
drivers/i2c/busses/i2c-qcom-geni.c | 58 +++++++++++++++-
drivers/soc/qcom/qcom-geni-se.c | 79 ++++++++++++++++++----
4 files changed, 212 insertions(+), 33 deletions(-)
---
base-commit: 094226ad94f471a9f19e8f8e7140a09c2625abaa
change-id: 20221114-narmstrong-sm8550-upstream-i2c-master-hub-44a7fb19475e
Best regards,
--
Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 1/6] dt-bindings: qcom: geni-se: document I2C Master Hub wrapper variant
2022-11-29 14:47 [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Neil Armstrong
@ 2022-11-29 14:47 ` Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 2/6] dt-bindings: i2c: qcom-geni: document I2C Master Hub serial I2C engine Neil Armstrong
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2022-11-29 14:47 UTC (permalink / raw)
To: Bjorn Andersson, Rob Herring, Andy Gross, Krzysztof Kozlowski
Cc: Krzysztof Kozlowski, linux-i2c, linux-arm-msm, Konrad Dybcio,
devicetree, linux-kernel, Neil Armstrong
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.
Document the variant compatible, forbid UART and SPI sub-nodes,
and remove requirement for the Master AHB clock and iommu property.
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
.../devicetree/bindings/soc/qcom/qcom,geni-se.yaml | 44 +++++++++++++++++++---
1 file changed, 38 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,geni-se.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,geni-se.yaml
index 2bf5293fc995..ab4df0205285 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,geni-se.yaml
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,geni-se.yaml
@@ -21,20 +21,19 @@ properties:
compatible:
enum:
- qcom,geni-se-qup
+ - qcom,geni-se-i2c-master-hub
reg:
description: QUP wrapper common register address and length.
maxItems: 1
clock-names:
- items:
- - const: m-ahb
- - const: s-ahb
+ minItems: 1
+ maxItems: 2
clocks:
- items:
- - description: Master AHB Clock
- - description: Slave AHB Clock
+ minItems: 1
+ maxItems: 2
"#address-cells":
const: 2
@@ -81,6 +80,39 @@ patternProperties:
description: GENI Serial Engine based UART Controller.
$ref: /schemas/serial/qcom,serial-geni-qcom.yaml#
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: qcom,geni-se-i2c-master-hub
+ then:
+ properties:
+ clock-names:
+ items:
+ - const: s-ahb
+
+ clocks:
+ items:
+ - description: Slave AHB Clock
+
+ iommus: false
+
+ patternProperties:
+ "spi@[0-9a-f]+$": false
+ "serial@[0-9a-f]+$": false
+ else:
+ properties:
+ clock-names:
+ items:
+ - const: m-ahb
+ - const: s-ahb
+
+ clocks:
+ items:
+ - description: Master AHB Clock
+ - description: Slave AHB Clock
+
additionalProperties: false
examples:
--
b4 0.10.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 2/6] dt-bindings: i2c: qcom-geni: document I2C Master Hub serial I2C engine
2022-11-29 14:47 [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 1/6] dt-bindings: qcom: geni-se: document I2C Master Hub wrapper variant Neil Armstrong
@ 2022-11-29 14:47 ` Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 3/6] soc: qcom: geni-se: add desc struct to specify clocks from device match data Neil Armstrong
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2022-11-29 14:47 UTC (permalink / raw)
To: Bjorn Andersson, Rob Herring, Andy Gross, Krzysztof Kozlowski
Cc: Krzysztof Kozlowski, linux-i2c, linux-arm-msm, Konrad Dybcio,
devicetree, linux-kernel, Neil Armstrong
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.
Document the I2C Serial Engine variant used within the I2C Master
Hub Wrapper.
This serial engine variant lacks DMA support, requires a core clock,
and since DMA support is lacking the memory interconnect path isn't
needed.
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
.../bindings/i2c/qcom,i2c-geni-qcom.yaml | 64 ++++++++++++++++++----
1 file changed, 54 insertions(+), 10 deletions(-)
diff --git a/Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml b/Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml
index 0e7ed00562e2..f5f7dc8f325c 100644
--- a/Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml
+++ b/Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml
@@ -10,18 +10,19 @@ maintainers:
- Andy Gross <agross@kernel.org>
- Bjorn Andersson <bjorn.andersson@linaro.org>
-allOf:
- - $ref: /schemas/i2c/i2c-controller.yaml#
-
properties:
compatible:
- const: qcom,geni-i2c
+ enum:
+ - qcom,geni-i2c
+ - qcom,geni-i2c-master-hub
clocks:
- maxItems: 1
+ minItems: 1
+ maxItems: 2
clock-names:
- const: se
+ minItems: 1
+ maxItems: 2
clock-frequency:
default: 100000
@@ -35,13 +36,12 @@ properties:
- const: rx
interconnects:
+ minItems: 2
maxItems: 3
interconnect-names:
- items:
- - const: qup-core
- - const: qup-config
- - const: qup-memory
+ minItems: 2
+ maxItems: 3
interrupts:
maxItems: 1
@@ -71,6 +71,50 @@ required:
- clock-names
- reg
+allOf:
+ - $ref: /schemas/i2c/i2c-controller.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: qcom,geni-i2c-master-hub
+ then:
+ properties:
+ clocks:
+ minItems: 2
+
+ clock-names:
+ items:
+ - const: se
+ - const: core
+
+ dmas: false
+ dma-names: false
+
+ interconnects:
+ maxItems: 2
+
+ interconnect-names:
+ items:
+ - const: qup-core
+ - const: qup-config
+ else:
+ properties:
+ clocks:
+ maxItems: 1
+
+ clock-names:
+ const: se
+
+ interconnects:
+ minItems: 3
+
+ interconnect-names:
+ items:
+ - const: qup-core
+ - const: qup-config
+ - const: qup-memory
+
unevaluatedProperties: false
examples:
--
b4 0.10.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 3/6] soc: qcom: geni-se: add desc struct to specify clocks from device match data
2022-11-29 14:47 [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 1/6] dt-bindings: qcom: geni-se: document I2C Master Hub wrapper variant Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 2/6] dt-bindings: i2c: qcom-geni: document I2C Master Hub serial I2C engine Neil Armstrong
@ 2022-11-29 14:47 ` Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 4/6] soc: qcom: geni-se: add support for I2C Master Hub wrapper variant Neil Armstrong
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2022-11-29 14:47 UTC (permalink / raw)
To: Bjorn Andersson, Rob Herring, Andy Gross, Krzysztof Kozlowski
Cc: Krzysztof Kozlowski, linux-i2c, linux-arm-msm, Konrad Dybcio,
devicetree, linux-kernel, Neil Armstrong
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.
Prepare support for the I2C Master Hub variant by moving the required
clocks list to a new desc struct then passing it through the compatible
match data.
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/soc/qcom/qcom-geni-se.c | 69 ++++++++++++++++++++++++++++++++---------
1 file changed, 55 insertions(+), 14 deletions(-)
diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index a0ceeede450f..9ddee9fd11ba 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -81,19 +81,31 @@
*/
#define MAX_CLK_PERF_LEVEL 32
-#define NUM_AHB_CLKS 2
+#define MAX_CLKS 2
/**
* struct geni_wrapper - Data structure to represent the QUP Wrapper Core
* @dev: Device pointer of the QUP wrapper core
* @base: Base address of this instance of QUP wrapper core
- * @ahb_clks: Handle to the primary & secondary AHB clocks
+ * @clks: Handle to the primary & optional secondary AHB clocks
+ * @num_clks: Count of clocks
* @to_core: Core ICC path
*/
struct geni_wrapper {
struct device *dev;
void __iomem *base;
- struct clk_bulk_data ahb_clks[NUM_AHB_CLKS];
+ struct clk_bulk_data clks[MAX_CLKS];
+ unsigned int num_clks;
+};
+
+/**
+ * struct geni_se_desc - Data structure to represent the QUP Wrapper resources
+ * @clks: Name of the primary & optional secondary AHB clocks
+ * @num_clks: Count of clock names
+ */
+struct geni_se_desc {
+ unsigned int num_clks;
+ const char * const *clks;
};
static const char * const icc_path_names[] = {"qup-core", "qup-config",
@@ -496,8 +508,7 @@ static void geni_se_clks_off(struct geni_se *se)
struct geni_wrapper *wrapper = se->wrapper;
clk_disable_unprepare(se->clk);
- clk_bulk_disable_unprepare(ARRAY_SIZE(wrapper->ahb_clks),
- wrapper->ahb_clks);
+ clk_bulk_disable_unprepare(wrapper->num_clks, wrapper->clks);
}
/**
@@ -528,15 +539,13 @@ static int geni_se_clks_on(struct geni_se *se)
int ret;
struct geni_wrapper *wrapper = se->wrapper;
- ret = clk_bulk_prepare_enable(ARRAY_SIZE(wrapper->ahb_clks),
- wrapper->ahb_clks);
+ ret = clk_bulk_prepare_enable(wrapper->num_clks, wrapper->clks);
if (ret)
return ret;
ret = clk_prepare_enable(se->clk);
if (ret)
- clk_bulk_disable_unprepare(ARRAY_SIZE(wrapper->ahb_clks),
- wrapper->ahb_clks);
+ clk_bulk_disable_unprepare(wrapper->num_clks, wrapper->clks);
return ret;
}
@@ -887,11 +896,33 @@ static int geni_se_probe(struct platform_device *pdev)
return PTR_ERR(wrapper->base);
if (!has_acpi_companion(&pdev->dev)) {
- wrapper->ahb_clks[0].id = "m-ahb";
- wrapper->ahb_clks[1].id = "s-ahb";
- ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks);
+ const struct geni_se_desc *desc;
+ int i;
+
+ desc = device_get_match_data(&pdev->dev);
+ if (!desc)
+ return -EINVAL;
+
+ wrapper->num_clks = min_t(unsigned int, desc->num_clks, MAX_CLKS);
+
+ for (i = 0; i < wrapper->num_clks; ++i)
+ wrapper->clks[i].id = desc->clks[i];
+
+ ret = of_count_phandle_with_args(dev->of_node, "clocks", "#clock-cells");
+ if (ret < 0) {
+ dev_err(dev, "invalid clocks property at %pOF\n", dev->of_node);
+ return ret;
+ }
+
+ if (ret < wrapper->num_clks) {
+ dev_err(dev, "invalid clocks count at %pOF, expected %d entries\n",
+ dev->of_node, wrapper->num_clks);
+ return -EINVAL;
+ }
+
+ ret = devm_clk_bulk_get(dev, wrapper->num_clks, wrapper->clks);
if (ret) {
- dev_err(dev, "Err getting AHB clks %d\n", ret);
+ dev_err(dev, "Err getting clks %d\n", ret);
return ret;
}
}
@@ -901,8 +932,18 @@ static int geni_se_probe(struct platform_device *pdev)
return devm_of_platform_populate(dev);
}
+static const char * const qup_clks[] = {
+ "m-ahb",
+ "s-ahb",
+};
+
+static const struct geni_se_desc qup_desc = {
+ .clks = qup_clks,
+ .num_clks = ARRAY_SIZE(qup_clks),
+};
+
static const struct of_device_id geni_se_dt_match[] = {
- { .compatible = "qcom,geni-se-qup", },
+ { .compatible = "qcom,geni-se-qup", .data = &qup_desc },
{}
};
MODULE_DEVICE_TABLE(of, geni_se_dt_match);
--
b4 0.10.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 4/6] soc: qcom: geni-se: add support for I2C Master Hub wrapper variant
2022-11-29 14:47 [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Neil Armstrong
` (2 preceding siblings ...)
2022-11-29 14:47 ` [PATCH v3 3/6] soc: qcom: geni-se: add desc struct to specify clocks from device match data Neil Armstrong
@ 2022-11-29 14:47 ` Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 5/6] i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant Neil Armstrong
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2022-11-29 14:47 UTC (permalink / raw)
To: Bjorn Andersson, Rob Herring, Andy Gross, Krzysztof Kozlowski
Cc: Krzysztof Kozlowski, linux-i2c, linux-arm-msm, Konrad Dybcio,
devicetree, linux-kernel, Neil Armstrong
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.
Add the clock list for the I2C Master Hub variant to a new desc struct
then pass it through the I2C Master Hub compatible match data.
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/soc/qcom/qcom-geni-se.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index 9ddee9fd11ba..f0475b93ca73 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -942,8 +942,18 @@ static const struct geni_se_desc qup_desc = {
.num_clks = ARRAY_SIZE(qup_clks),
};
+static const char * const i2c_master_hub_clks[] = {
+ "s-ahb",
+};
+
+static const struct geni_se_desc i2c_master_hub_desc = {
+ .clks = i2c_master_hub_clks,
+ .num_clks = ARRAY_SIZE(i2c_master_hub_clks),
+};
+
static const struct of_device_id geni_se_dt_match[] = {
{ .compatible = "qcom,geni-se-qup", .data = &qup_desc },
+ { .compatible = "qcom,geni-se-i2c-master-hub", .data = &i2c_master_hub_desc },
{}
};
MODULE_DEVICE_TABLE(of, geni_se_dt_match);
--
b4 0.10.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 5/6] i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant
2022-11-29 14:47 [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Neil Armstrong
` (3 preceding siblings ...)
2022-11-29 14:47 ` [PATCH v3 4/6] soc: qcom: geni-se: add support for I2C Master Hub wrapper variant Neil Armstrong
@ 2022-11-29 14:47 ` Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 6/6] i2c: qcom-geni: add " Neil Armstrong
2022-12-01 22:49 ` [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Wolfram Sang
6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2022-11-29 14:47 UTC (permalink / raw)
To: Bjorn Andersson, Rob Herring, Andy Gross, Krzysztof Kozlowski
Cc: Krzysztof Kozlowski, linux-i2c, linux-arm-msm, Konrad Dybcio,
devicetree, linux-kernel, Neil Armstrong
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.
Those I2C serial engines variants have some requirements:
- a separate "core" clock
- doesn't support DMA, thus no memory interconnect path
- fixed FIFO size not discoverable in the HW_PARAM_0 register
Add a desc struct specifying all those requirements which will be used in
a next change when adding the I2C Master Hub serial engine compatible.
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/i2c/busses/i2c-qcom-geni.c | 50 +++++++++++++++++++++++++++++++++++---
1 file changed, 47 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index 84a77512614d..75dd0718c5a1 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -88,6 +88,7 @@ struct geni_i2c_dev {
int cur_wr;
int cur_rd;
spinlock_t lock;
+ struct clk *core_clk;
u32 clk_freq_out;
const struct geni_i2c_clk_fld *clk_fld;
int suspended;
@@ -100,6 +101,13 @@ struct geni_i2c_dev {
bool abort_done;
};
+struct geni_i2c_desc {
+ bool has_core_clk;
+ char *icc_ddr;
+ bool no_dma_support;
+ unsigned int tx_fifo_depth;
+};
+
struct geni_i2c_err_log {
int err;
const char *msg;
@@ -764,6 +772,7 @@ static int geni_i2c_probe(struct platform_device *pdev)
u32 proto, tx_depth, fifo_disable;
int ret;
struct device *dev = &pdev->dev;
+ const struct geni_i2c_desc *desc = NULL;
gi2c = devm_kzalloc(dev, sizeof(*gi2c), GFP_KERNEL);
if (!gi2c)
@@ -776,6 +785,14 @@ static int geni_i2c_probe(struct platform_device *pdev)
if (IS_ERR(gi2c->se.base))
return PTR_ERR(gi2c->se.base);
+ desc = device_get_match_data(&pdev->dev);
+
+ if (desc && desc->has_core_clk) {
+ gi2c->core_clk = devm_clk_get(dev, "core");
+ if (IS_ERR(gi2c->core_clk))
+ return PTR_ERR(gi2c->core_clk);
+ }
+
gi2c->se.clk = devm_clk_get(dev, "se");
if (IS_ERR(gi2c->se.clk) && !has_acpi_companion(dev))
return PTR_ERR(gi2c->se.clk);
@@ -819,7 +836,7 @@ static int geni_i2c_probe(struct platform_device *pdev)
gi2c->adap.dev.of_node = dev->of_node;
strscpy(gi2c->adap.name, "Geni-I2C", sizeof(gi2c->adap.name));
- ret = geni_icc_get(&gi2c->se, "qup-memory");
+ ret = geni_icc_get(&gi2c->se, desc ? desc->icc_ddr : "qup-memory");
if (ret)
return ret;
/*
@@ -829,12 +846,17 @@ static int geni_i2c_probe(struct platform_device *pdev)
*/
gi2c->se.icc_paths[GENI_TO_CORE].avg_bw = GENI_DEFAULT_BW;
gi2c->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW;
- gi2c->se.icc_paths[GENI_TO_DDR].avg_bw = Bps_to_icc(gi2c->clk_freq_out);
+ if (!desc || desc->icc_ddr)
+ gi2c->se.icc_paths[GENI_TO_DDR].avg_bw = Bps_to_icc(gi2c->clk_freq_out);
ret = geni_icc_set_bw(&gi2c->se);
if (ret)
return ret;
+ ret = clk_prepare_enable(gi2c->core_clk);
+ if (ret)
+ return ret;
+
ret = geni_se_resources_on(&gi2c->se);
if (ret) {
dev_err(dev, "Error turning on resources %d\n", ret);
@@ -844,10 +866,15 @@ static int geni_i2c_probe(struct platform_device *pdev)
if (proto != GENI_SE_I2C) {
dev_err(dev, "Invalid proto %d\n", proto);
geni_se_resources_off(&gi2c->se);
+ clk_disable_unprepare(gi2c->core_clk);
return -ENXIO;
}
- fifo_disable = readl_relaxed(gi2c->se.base + GENI_IF_DISABLE_RO) & FIFO_IF_DISABLE;
+ if (desc && desc->no_dma_support)
+ fifo_disable = false;
+ else
+ fifo_disable = readl_relaxed(gi2c->se.base + GENI_IF_DISABLE_RO) & FIFO_IF_DISABLE;
+
if (fifo_disable) {
/* FIFO is disabled, so we can only use GPI DMA */
gi2c->gpi_mode = true;
@@ -859,6 +886,16 @@ static int geni_i2c_probe(struct platform_device *pdev)
} else {
gi2c->gpi_mode = false;
tx_depth = geni_se_get_tx_fifo_depth(&gi2c->se);
+
+ /* I2C Master Hub Serial Elements doesn't have the HW_PARAM_0 register */
+ if (!tx_depth && desc)
+ tx_depth = desc->tx_fifo_depth;
+
+ if (!tx_depth) {
+ dev_err(dev, "Invalid TX FIFO depth\n");
+ return -EINVAL;
+ }
+
gi2c->tx_wm = tx_depth - 1;
geni_se_init(&gi2c->se, gi2c->tx_wm, tx_depth);
geni_se_config_packing(&gi2c->se, BITS_PER_BYTE,
@@ -867,6 +904,7 @@ static int geni_i2c_probe(struct platform_device *pdev)
dev_dbg(dev, "i2c fifo/se-dma mode. fifo depth:%d\n", tx_depth);
}
+ clk_disable_unprepare(gi2c->core_clk);
ret = geni_se_resources_off(&gi2c->se);
if (ret) {
dev_err(dev, "Error turning off resources %d\n", ret);
@@ -932,6 +970,8 @@ static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev)
gi2c->suspended = 1;
}
+ clk_disable_unprepare(gi2c->core_clk);
+
return geni_icc_disable(&gi2c->se);
}
@@ -944,6 +984,10 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev)
if (ret)
return ret;
+ ret = clk_prepare_enable(gi2c->core_clk);
+ if (ret)
+ return ret;
+
ret = geni_se_resources_on(&gi2c->se);
if (ret)
return ret;
--
b4 0.10.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 6/6] i2c: qcom-geni: add support for I2C Master Hub variant
2022-11-29 14:47 [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Neil Armstrong
` (4 preceding siblings ...)
2022-11-29 14:47 ` [PATCH v3 5/6] i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant Neil Armstrong
@ 2022-11-29 14:47 ` Neil Armstrong
2022-12-01 22:49 ` [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Wolfram Sang
6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2022-11-29 14:47 UTC (permalink / raw)
To: Bjorn Andersson, Rob Herring, Andy Gross, Krzysztof Kozlowski
Cc: Krzysztof Kozlowski, linux-i2c, linux-arm-msm, Konrad Dybcio,
devicetree, linux-kernel, Neil Armstrong
The I2C Master Hub is a stripped down version of the GENI Serial Engine
QUP Wrapper Controller but only supporting I2C serial engines without
DMA support.
Add the I2C Master Hub serial engine compatible along the specific
requirements in a new desc struct passed through the device match data.
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/i2c/busses/i2c-qcom-geni.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index 75dd0718c5a1..bfe75038bc14 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -1026,8 +1026,16 @@ static const struct dev_pm_ops geni_i2c_pm_ops = {
NULL)
};
+const struct geni_i2c_desc i2c_master_hub = {
+ .has_core_clk = true,
+ .icc_ddr = NULL,
+ .no_dma_support = true,
+ .tx_fifo_depth = 16,
+};
+
static const struct of_device_id geni_i2c_dt_match[] = {
{ .compatible = "qcom,geni-i2c" },
+ { .compatible = "qcom,geni-i2c-master-hub", .data = &i2c_master_hub },
{}
};
MODULE_DEVICE_TABLE(of, geni_i2c_dt_match);
--
b4 0.10.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub
2022-11-29 14:47 [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Neil Armstrong
` (5 preceding siblings ...)
2022-11-29 14:47 ` [PATCH v3 6/6] i2c: qcom-geni: add " Neil Armstrong
@ 2022-12-01 22:49 ` Wolfram Sang
2022-12-05 8:31 ` Wolfram Sang
6 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2022-12-01 22:49 UTC (permalink / raw)
To: Neil Armstrong
Cc: Bjorn Andersson, Rob Herring, Andy Gross, Krzysztof Kozlowski,
Krzysztof Kozlowski, linux-i2c, linux-arm-msm, Konrad Dybcio,
devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 907 bytes --]
On Tue, Nov 29, 2022 at 03:47:00PM +0100, Neil Armstrong wrote:
> The I2C Master Hub is a stripped down version of the GENI Serial Engine
> QUP Wrapper Controller but only supporting I2C serial engines without
> DMA support.
>
> The I2C Master Hub only supports a variant of the I2C serial engine with:
> - a separate "core" clock
> - no DMA support
> - non discoverable fixed FIFO size
>
> Since DMA isn't supported, the wrapper doesn't need the Master AHB clock
> and the iommus property neither.
>
> This patchset adds the bindings changes to the QUPv3 wrapper and I2C serial
> element bindings to reflect the different resources requirements.
>
> In order to reuse the QUPv3 wrapper and I2C serial element driver support,
> the I2C Master Hub requirements are expressed in new desc structs passed
> as device match data.
Is everyone fine if I take all this via the I2C tree?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub
2022-12-01 22:49 ` [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Wolfram Sang
@ 2022-12-05 8:31 ` Wolfram Sang
2022-12-05 8:37 ` Neil Armstrong
0 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2022-12-05 8:31 UTC (permalink / raw)
To: Neil Armstrong, Bjorn Andersson, Rob Herring, Andy Gross,
Krzysztof Kozlowski, Krzysztof Kozlowski, linux-i2c,
linux-arm-msm, Konrad Dybcio, devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]
On Thu, Dec 01, 2022 at 11:49:21PM +0100, Wolfram Sang wrote:
> On Tue, Nov 29, 2022 at 03:47:00PM +0100, Neil Armstrong wrote:
> > The I2C Master Hub is a stripped down version of the GENI Serial Engine
> > QUP Wrapper Controller but only supporting I2C serial engines without
> > DMA support.
> >
> > The I2C Master Hub only supports a variant of the I2C serial engine with:
> > - a separate "core" clock
> > - no DMA support
> > - non discoverable fixed FIFO size
> >
> > Since DMA isn't supported, the wrapper doesn't need the Master AHB clock
> > and the iommus property neither.
> >
> > This patchset adds the bindings changes to the QUPv3 wrapper and I2C serial
> > element bindings to reflect the different resources requirements.
> >
> > In order to reuse the QUPv3 wrapper and I2C serial element driver support,
> > the I2C Master Hub requirements are expressed in new desc structs passed
> > as device match data.
>
> Is everyone fine if I take all this via the I2C tree?
I did this now.
All applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub
2022-12-05 8:31 ` Wolfram Sang
@ 2022-12-05 8:37 ` Neil Armstrong
0 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2022-12-05 8:37 UTC (permalink / raw)
To: Wolfram Sang, Bjorn Andersson, Rob Herring, Andy Gross,
Krzysztof Kozlowski, Krzysztof Kozlowski, linux-i2c,
linux-arm-msm, Konrad Dybcio, devicetree, linux-kernel
On 05/12/2022 09:31, Wolfram Sang wrote:
> On Thu, Dec 01, 2022 at 11:49:21PM +0100, Wolfram Sang wrote:
>> On Tue, Nov 29, 2022 at 03:47:00PM +0100, Neil Armstrong wrote:
>>> The I2C Master Hub is a stripped down version of the GENI Serial Engine
>>> QUP Wrapper Controller but only supporting I2C serial engines without
>>> DMA support.
>>>
>>> The I2C Master Hub only supports a variant of the I2C serial engine with:
>>> - a separate "core" clock
>>> - no DMA support
>>> - non discoverable fixed FIFO size
>>>
>>> Since DMA isn't supported, the wrapper doesn't need the Master AHB clock
>>> and the iommus property neither.
>>>
>>> This patchset adds the bindings changes to the QUPv3 wrapper and I2C serial
>>> element bindings to reflect the different resources requirements.
>>>
>>> In order to reuse the QUPv3 wrapper and I2C serial element driver support,
>>> the I2C Master Hub requirements are expressed in new desc structs passed
>>> as device match data.
>>
>> Is everyone fine if I take all this via the I2C tree?
>
> I did this now.
>
> All applied to for-next, thanks!
>
Thanks !
Neil
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-12-05 8:37 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-29 14:47 [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 1/6] dt-bindings: qcom: geni-se: document I2C Master Hub wrapper variant Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 2/6] dt-bindings: i2c: qcom-geni: document I2C Master Hub serial I2C engine Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 3/6] soc: qcom: geni-se: add desc struct to specify clocks from device match data Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 4/6] soc: qcom: geni-se: add support for I2C Master Hub wrapper variant Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 5/6] i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant Neil Armstrong
2022-11-29 14:47 ` [PATCH v3 6/6] i2c: qcom-geni: add " Neil Armstrong
2022-12-01 22:49 ` [PATCH v3 0/6] soc: qcom: add support for the I2C Master Hub Wolfram Sang
2022-12-05 8:31 ` Wolfram Sang
2022-12-05 8:37 ` Neil Armstrong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).