Devicetree
 help / color / mirror / Atom feed
* Re: [PATCH V6] clk: qcom: Add spmi_pmic clock divider support
From: Tirupathi Reddy T @ 2017-11-21  9:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: sboyd, mturquette, mark.rutland, andy.gross, david.brown,
	linux-clk, devicetree, linux-kernel, linux-arm-msm, linux-soc
In-Reply-To: <20171117202243.you76ej4qvk3ul3g@rob-hp-laptop>



On 11/18/2017 1:52 AM, Rob Herring wrote:
> On Fri, Nov 17, 2017 at 03:18:47PM +0530, Tirupathi Reddy wrote:
>> Clkdiv module provides a clock output on the PMIC with CXO as
>> the source. This clock can be routed through PMIC GPIOs. Add
>> a device driver to configure this clkdiv module.
>>
>> Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
>> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> Normally your S-o-B would be last.
Addressed in next patch version [7]
>
>> ---
>>   .../bindings/clock/clk-spmi-pmic-div.txt           |  59 ++++
> Please split bindings to a separate patch.
Addressed in next patch version [7]
>
> Otherwise,
>
> Acked-by: Rob Herring <robh@kernel.org>
>
>>   drivers/clk/qcom/Kconfig                           |   9 +
>>   drivers/clk/qcom/Makefile                          |   1 +
>>   drivers/clk/qcom/clk-spmi-pmic-div.c               | 308 +++++++++++++++++++++
>>   4 files changed, 377 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt
>>   create mode 100644 drivers/clk/qcom/clk-spmi-pmic-div.c

^ permalink raw reply

* Re: [PATCH V6] clk: qcom: Add spmi_pmic clock divider support
From: Tirupathi Reddy T @ 2017-11-21  9:12 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: mturquette, robh+dt, mark.rutland, andy.gross, david.brown,
	linux-clk, devicetree, linux-kernel, linux-arm-msm, linux-soc
In-Reply-To: <20171117235611.GA13301@codeaurora.org>


On 11/18/2017 5:26 AM, Stephen Boyd wrote:
> On 11/17, Tirupathi Reddy wrote:
>> diff --git a/Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt b/Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt
>> new file mode 100644
>> index 0000000..2cf2aba
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt
> Please move this to qcom,spmi-clkdiv.txt like other qcom bindings.
Addressed in next patch version[7]
>
>> @@ -0,0 +1,59 @@
>> +Qualcomm Technologies, Inc. SPMI PMIC clock divider (clkdiv)
>> +
>> +clkdiv configures the clock frequency of a set of outputs on the PMIC.
>> +These clocks are typically wired through alternate functions on
>> +gpio pins.
>> +
>> +=======================
>> +Properties
>> +=======================
>> +
>> +- compatible
>> +	Usage:      required
>> +	Value type: <string>
>> +	Definition: must be "qcom,spmi-clkdiv".
>> +
>> +- reg
>> +	Usage:      required
>> +	Value type: <prop-encoded-array>
>> +	Definition: base address of CLKDIV peripherals.
>> +
>> +- qcom,num-clkdivs
>> +	Usage:      required
>> +	Value type: <u32>
>> +	Definition: number of CLKDIV peripherals.
> Would it work if we read the registers and looked for the clkdiv
> subtype ID? If we read something that doesn't match, break and
> stop adding clks? Or does reading the next "peripheral" cause
> some sort of crash and burn scenario where the device see an
> access control violation? Would be interesting to do it that way
> and avoid needing a new property in DT.
I feel it is better to go with the current design as we beforehand know the
#div-clk peripherals in a PMIC. Reading the next peripheral might result in
an unknown failure if there is no real peripheral there (PMIC peripherals
are not in contiguous address space).
>> +
>> +
>> +	parent_name = of_clk_get_parent_name(of_node, 0);
>> +	if (!parent_name) {
>> +		dev_err(dev, "missing parent clock\n");
>> +		return -ENODEV;
>> +	}
>> +
>> +	init.parent_names = &parent_name;
>> +	init.num_parents = 1;
>> +	init.ops = &clk_spmi_pmic_div_ops;
>> +
>> +	for (i = 0, clkdiv = cc->clks; i < nclks; i++) {
>> +		spin_lock_init(&clkdiv[i].lock);
>> +		clkdiv[i].base = start + i * 0x100;
>> +		clkdiv[i].regmap = regmap;
>> +		clkdiv[i].cxo_period_ns = NSEC_PER_SEC / cxo_hz;
>> +		init.name = kasprintf(GFP_KERNEL, "div_clk%d", i + 1);
> Hmm. Maybe we should just have this on the stack. 20 characters
> should be plenty?
Addressed in next patch version[7]
>> +		clkdiv[i].hw.init = &init;
>> +
>> +		ret = devm_clk_hw_register(dev, &clkdiv[i].hw);
>> +		kfree(init.name); /* clk framework made a copy */
>> +		if (ret)
>> +			return ret;
>> +	}
>> +
>> +	return of_clk_add_hw_provider(of_node, spmi_pmic_div_clk_hw_get, cc);
>> +}
>> +
>> +static int spmi_pmic_clkdiv_remove(struct platform_device *pdev)
>> +{
>> +	of_clk_del_provider(pdev->dev.of_node);
>> +
>> +	return 0;
> This can use devm now.
Addressed in next patch version.
>> +}
>> +
>> +static const struct of_device_id spmi_pmic_clkdiv_match_table[] = {
>> +	{ .compatible = "qcom,spmi-clkdiv" },
>> +	{ /* sentinel */ }
>> +};
> Nice!
Thanks


^ permalink raw reply

* [PATCH V7 2/2] dt-bindings: Add qcom spmi_pmic clock divider bindings
From: Tirupathi Reddy @ 2017-11-21  9:11 UTC (permalink / raw)
  To: sboyd, robh+dt
  Cc: mturquette, mark.rutland, andy.gross, david.brown, linux-clk,
	devicetree, linux-kernel, linux-arm-msm, linux-soc,
	Tirupathi Reddy
In-Reply-To: <1511255465-3984-1-git-send-email-tirupath@codeaurora.org>

This patch adds device tree bindings for Qualcomm SPMI PMIC
clock divider module.

Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
---
 .../bindings/clock/qcom,spmi-pmic-div.txt          | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,spmi-pmic-div.txt

diff --git a/Documentation/devicetree/bindings/clock/qcom,spmi-pmic-div.txt b/Documentation/devicetree/bindings/clock/qcom,spmi-pmic-div.txt
new file mode 100644
index 0000000..2cf2aba
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/qcom,spmi-pmic-div.txt
@@ -0,0 +1,59 @@
+Qualcomm Technologies, Inc. SPMI PMIC clock divider (clkdiv)
+
+clkdiv configures the clock frequency of a set of outputs on the PMIC.
+These clocks are typically wired through alternate functions on
+gpio pins.
+
+=======================
+Properties
+=======================
+
+- compatible
+	Usage:      required
+	Value type: <string>
+	Definition: must be "qcom,spmi-clkdiv".
+
+- reg
+	Usage:      required
+	Value type: <prop-encoded-array>
+	Definition: base address of CLKDIV peripherals.
+
+- qcom,num-clkdivs
+	Usage:      required
+	Value type: <u32>
+	Definition: number of CLKDIV peripherals.
+
+- clocks:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: reference to the xo clock.
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "xo".
+
+- clock-cells:
+	Usage: required
+	Value type: <u32>
+	Definition: shall contain 1.
+
+=======
+Example
+=======
+
+pm8998_clk_divs: clock-controller@5b00 {
+	compatible = "qcom,spmi-clkdiv";
+	reg = <0x5b00>;
+	#clock-cells = <1>;
+	qcom,num-clkdivs = <3>;
+	clocks = <&xo_board>;
+	clock-names = "xo";
+
+	assigned-clocks = <&pm8998_clk_divs 1>,
+			  <&pm8998_clk_divs 2>,
+			  <&pm8998_clk_divs 3>;
+	assigned-clock-rates = <9600000>,
+			       <9600000>,
+			       <9600000>;
+};
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply related

* [PATCH V7 1/2] clk: qcom: Add spmi_pmic clock divider support
From: Tirupathi Reddy @ 2017-11-21  9:11 UTC (permalink / raw)
  To: sboyd, robh+dt
  Cc: mturquette, mark.rutland, andy.gross, david.brown, linux-clk,
	devicetree, linux-kernel, linux-arm-msm, linux-soc,
	Tirupathi Reddy
In-Reply-To: <1511255465-3984-1-git-send-email-tirupath@codeaurora.org>

Clkdiv module provides a clock output on the PMIC with CXO as
the source. This clock can be routed through PMIC GPIOs. Add
a device driver to configure this clkdiv module.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
---
 drivers/clk/qcom/Kconfig             |   9 ++
 drivers/clk/qcom/Makefile            |   1 +
 drivers/clk/qcom/clk-spmi-pmic-div.c | 302 +++++++++++++++++++++++++++++++++++
 3 files changed, 312 insertions(+)
 create mode 100644 drivers/clk/qcom/clk-spmi-pmic-div.c

diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
index 9f6c278..20b5d6f 100644
--- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig
@@ -196,3 +196,12 @@ config MSM_MMCC_8996
 	  Support for the multimedia clock controller on msm8996 devices.
 	  Say Y if you want to support multimedia devices such as display,
 	  graphics, video encode/decode, camera, etc.
+
+config SPMI_PMIC_CLKDIV
+	tristate "SPMI PMIC clkdiv Support"
+	depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TEST
+	help
+	  This driver supports the clkdiv functionality on the Qualcomm
+	  Technologies, Inc. SPMI PMIC. It configures the frequency of
+	  clkdiv outputs of the PMIC. These clocks are typically wired
+	  through alternate functions on GPIO pins.
diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile
index 26410d3..602af38 100644
--- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile
@@ -34,3 +34,4 @@ obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o
 obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o
 obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o
 obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o
+obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
diff --git a/drivers/clk/qcom/clk-spmi-pmic-div.c b/drivers/clk/qcom/clk-spmi-pmic-div.c
new file mode 100644
index 0000000..8672ab8
--- /dev/null
+++ b/drivers/clk/qcom/clk-spmi-pmic-div.c
@@ -0,0 +1,302 @@
+/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/bitops.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/log2.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+
+#define REG_DIV_CTL1			0x43
+#define DIV_CTL1_DIV_FACTOR_MASK	GENMASK(2, 0)
+
+#define REG_EN_CTL			0x46
+#define REG_EN_MASK			BIT(7)
+
+struct clkdiv {
+	struct regmap		*regmap;
+	u16			base;
+	spinlock_t		lock;
+
+	struct clk_hw		hw;
+	unsigned int		cxo_period_ns;
+};
+
+static inline struct clkdiv *to_clkdiv(struct clk_hw *hw)
+{
+	return container_of(hw, struct clkdiv, hw);
+}
+
+static inline unsigned int div_factor_to_div(unsigned int div_factor)
+{
+	if (!div_factor)
+		div_factor = 1;
+
+	return 1 << (div_factor - 1);
+}
+
+static inline unsigned int div_to_div_factor(unsigned int div)
+{
+	return min(ilog2(div) + 1, 7);
+}
+
+static bool is_spmi_pmic_clkdiv_enabled(struct clkdiv *clkdiv)
+{
+	unsigned int val = 0;
+
+	regmap_read(clkdiv->regmap, clkdiv->base + REG_EN_CTL, &val);
+
+	return val & REG_EN_MASK;
+}
+
+static int
+__spmi_pmic_clkdiv_set_enable_state(struct clkdiv *clkdiv, bool enable,
+				    unsigned int div_factor)
+{
+	int ret;
+	unsigned int ns = clkdiv->cxo_period_ns;
+	unsigned int div = div_factor_to_div(div_factor);
+
+	ret = regmap_update_bits(clkdiv->regmap, clkdiv->base + REG_EN_CTL,
+				 REG_EN_MASK, enable ? REG_EN_MASK : 0);
+	if (ret)
+		return ret;
+
+	if (enable)
+		ndelay((2 + 3 * div) * ns);
+	else
+		ndelay(3 * div * ns);
+
+	return 0;
+}
+
+static int spmi_pmic_clkdiv_set_enable_state(struct clkdiv *clkdiv, bool enable)
+{
+	unsigned int div_factor;
+
+	regmap_read(clkdiv->regmap, clkdiv->base + REG_DIV_CTL1, &div_factor);
+	div_factor &= DIV_CTL1_DIV_FACTOR_MASK;
+
+	return __spmi_pmic_clkdiv_set_enable_state(clkdiv, enable, div_factor);
+}
+
+static int clk_spmi_pmic_div_enable(struct clk_hw *hw)
+{
+	struct clkdiv *clkdiv = to_clkdiv(hw);
+	unsigned long flags;
+	int ret;
+
+	spin_lock_irqsave(&clkdiv->lock, flags);
+	ret = spmi_pmic_clkdiv_set_enable_state(clkdiv, true);
+	spin_unlock_irqrestore(&clkdiv->lock, flags);
+
+	return ret;
+}
+
+static void clk_spmi_pmic_div_disable(struct clk_hw *hw)
+{
+	struct clkdiv *clkdiv = to_clkdiv(hw);
+	unsigned long flags;
+
+	spin_lock_irqsave(&clkdiv->lock, flags);
+	spmi_pmic_clkdiv_set_enable_state(clkdiv, false);
+	spin_unlock_irqrestore(&clkdiv->lock, flags);
+}
+
+static long clk_spmi_pmic_div_round_rate(struct clk_hw *hw, unsigned long rate,
+					 unsigned long *parent_rate)
+{
+	unsigned int div, div_factor;
+
+	div = DIV_ROUND_UP(*parent_rate, rate);
+	div_factor = div_to_div_factor(div);
+	div = div_factor_to_div(div_factor);
+
+	return *parent_rate / div;
+}
+
+static unsigned long
+clk_spmi_pmic_div_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
+{
+	struct clkdiv *clkdiv = to_clkdiv(hw);
+	unsigned int div_factor;
+
+	regmap_read(clkdiv->regmap, clkdiv->base + REG_DIV_CTL1, &div_factor);
+	div_factor &= DIV_CTL1_DIV_FACTOR_MASK;
+
+	return parent_rate / div_factor_to_div(div_factor);
+}
+
+static int clk_spmi_pmic_div_set_rate(struct clk_hw *hw, unsigned long rate,
+				      unsigned long parent_rate)
+{
+	struct clkdiv *clkdiv = to_clkdiv(hw);
+	unsigned int div_factor = div_to_div_factor(parent_rate / rate);
+	unsigned long flags;
+	bool enabled;
+	int ret;
+
+	spin_lock_irqsave(&clkdiv->lock, flags);
+	enabled = is_spmi_pmic_clkdiv_enabled(clkdiv);
+	if (enabled) {
+		ret = spmi_pmic_clkdiv_set_enable_state(clkdiv, false);
+		if (ret)
+			goto unlock;
+	}
+
+	ret = regmap_update_bits(clkdiv->regmap, clkdiv->base + REG_DIV_CTL1,
+				 DIV_CTL1_DIV_FACTOR_MASK, div_factor);
+	if (ret)
+		goto unlock;
+
+	if (enabled)
+		ret = __spmi_pmic_clkdiv_set_enable_state(clkdiv, true,
+							  div_factor);
+
+unlock:
+	spin_unlock_irqrestore(&clkdiv->lock, flags);
+
+	return ret;
+}
+
+static const struct clk_ops clk_spmi_pmic_div_ops = {
+	.enable = clk_spmi_pmic_div_enable,
+	.disable = clk_spmi_pmic_div_disable,
+	.set_rate = clk_spmi_pmic_div_set_rate,
+	.recalc_rate = clk_spmi_pmic_div_recalc_rate,
+	.round_rate = clk_spmi_pmic_div_round_rate,
+};
+
+struct spmi_pmic_div_clk_cc {
+	int		nclks;
+	struct clkdiv	clks[];
+};
+
+static struct clk_hw *
+spmi_pmic_div_clk_hw_get(struct of_phandle_args *clkspec, void *data)
+{
+	struct spmi_pmic_div_clk_cc *cc = data;
+	int idx = clkspec->args[0] - 1; /* Start at 1 instead of 0 */
+
+	if (idx < 0 || idx >= cc->nclks) {
+		pr_err("%s: index value %u is invalid; allowed range [1, %d]\n",
+		       __func__, clkspec->args[0], cc->nclks);
+		return ERR_PTR(-EINVAL);
+	}
+
+	return &cc->clks[idx].hw;
+}
+
+static int spmi_pmic_clkdiv_probe(struct platform_device *pdev)
+{
+	struct spmi_pmic_div_clk_cc *cc;
+	struct clk_init_data init = {};
+	struct clkdiv *clkdiv;
+	struct clk *cxo;
+	struct regmap *regmap;
+	struct device *dev = &pdev->dev;
+	struct device_node *of_node = dev->of_node;
+	const char *parent_name;
+	int nclks, i, ret, cxo_hz;
+	char name[20];
+	u32 start;
+
+	ret = of_property_read_u32(of_node, "reg", &start);
+	if (ret < 0) {
+		dev_err(dev, "reg property reading failed\n");
+		return ret;
+	}
+
+	regmap = dev_get_regmap(dev->parent, NULL);
+	if (!regmap) {
+		dev_err(dev, "Couldn't get parent's regmap\n");
+		return -EINVAL;
+	}
+
+	ret = of_property_read_u32(of_node, "qcom,num-clkdivs", &nclks);
+	if (ret < 0) {
+		dev_err(dev, "qcom,num-clkdivs property reading failed, ret=%d\n",
+			ret);
+		return ret;
+	}
+
+	if (!nclks)
+		return -EINVAL;
+
+	cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*cc->clks) * nclks,
+			  GFP_KERNEL);
+	if (!cc)
+		return -ENOMEM;
+	cc->nclks = nclks;
+
+	cxo = clk_get(dev, "xo");
+	if (IS_ERR(cxo)) {
+		ret = PTR_ERR(cxo);
+		if (ret != -EPROBE_DEFER)
+			dev_err(dev, "failed to get xo clock\n");
+		return ret;
+	}
+	cxo_hz = clk_get_rate(cxo);
+	clk_put(cxo);
+
+	parent_name = of_clk_get_parent_name(of_node, 0);
+	if (!parent_name) {
+		dev_err(dev, "missing parent clock\n");
+		return -ENODEV;
+	}
+
+	init.name = name;
+	init.parent_names = &parent_name;
+	init.num_parents = 1;
+	init.ops = &clk_spmi_pmic_div_ops;
+
+	for (i = 0, clkdiv = cc->clks; i < nclks; i++) {
+		snprintf(name, sizeof(name), "div_clk%d", i + 1);
+
+		spin_lock_init(&clkdiv[i].lock);
+		clkdiv[i].base = start + i * 0x100;
+		clkdiv[i].regmap = regmap;
+		clkdiv[i].cxo_period_ns = NSEC_PER_SEC / cxo_hz;
+		clkdiv[i].hw.init = &init;
+
+		ret = devm_clk_hw_register(dev, &clkdiv[i].hw);
+		if (ret)
+			return ret;
+	}
+
+	return devm_of_clk_add_hw_provider(dev, spmi_pmic_div_clk_hw_get, cc);
+}
+
+static const struct of_device_id spmi_pmic_clkdiv_match_table[] = {
+	{ .compatible = "qcom,spmi-clkdiv" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, spmi_pmic_clkdiv_match_table);
+
+static struct platform_driver spmi_pmic_clkdiv_driver = {
+	.driver		= {
+		.name	= "qcom,spmi-pmic-clkdiv",
+		.of_match_table = spmi_pmic_clkdiv_match_table,
+	},
+	.probe		= spmi_pmic_clkdiv_probe,
+};
+module_platform_driver(spmi_pmic_clkdiv_driver);
+
+MODULE_DESCRIPTION("QCOM SPMI PMIC clkdiv driver");
+MODULE_LICENSE("GPL v2");
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply related

* [PATCH V7 0/2] clk: qcom: spmi_pmic clock divider support
From: Tirupathi Reddy @ 2017-11-21  9:11 UTC (permalink / raw)
  To: sboyd, robh+dt
  Cc: mturquette, mark.rutland, andy.gross, david.brown, linux-clk,
	devicetree, linux-kernel, linux-arm-msm, linux-soc,
	Tirupathi Reddy

The SPMI_PMIC clock divider driver configures the clkdiv modules present
on Qualcomm Technologies, Inc. SPMI PMIC. This driver provides a clock
interface for each clkdiv module and allows clock operations such as enable,
disable, set_rate, recalc_rate and round_rate.

Tirupathi Reddy (2):
  clk: qcom: Add spmi_pmic clock divider support
  dt-bindings: Add qcom spmi_pmic clock divider bindings

 .../bindings/clock/qcom,spmi-pmic-div.txt          |  59 ++++
 drivers/clk/qcom/Kconfig                           |   9 +
 drivers/clk/qcom/Makefile                          |   1 +
 drivers/clk/qcom/clk-spmi-pmic-div.c               | 302 +++++++++++++++++++++
 4 files changed, 371 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,spmi-pmic-div.txt
 create mode 100644 drivers/clk/qcom/clk-spmi-pmic-div.c

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply

* [PATCH 2/3] spi: xilinx: Add support for xlnx,axi-quad-spi-1.00.a
From: Ricardo Ribalda Delgado @ 2017-11-21  9:09 UTC (permalink / raw)
  To: linux-spi-u79uwXL29TY76Z2rM5mHXA
  Cc: Ricardo Ribalda Delgado, Mark Brown, Rob Herring,
	devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20171121090904.6901-1-ricardo.ribalda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

The driver has been successfully tested with Xilinx's core
axi-quad-spi-1.0.0a. Documented on DS843:

https://www.xilinx.com/support/documentation/ip_documentation/axi_quad_spi/v1_00_a/ds843_axi_quad_spi.pdf

Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 Documentation/devicetree/bindings/spi/spi-xilinx.txt | 2 +-
 drivers/spi/spi-xilinx.c                             | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-xilinx.txt b/Documentation/devicetree/bindings/spi/spi-xilinx.txt
index c7b7856bd528..7bf61efc66c8 100644
--- a/Documentation/devicetree/bindings/spi/spi-xilinx.txt
+++ b/Documentation/devicetree/bindings/spi/spi-xilinx.txt
@@ -2,7 +2,7 @@ Xilinx SPI controller Device Tree Bindings
 -------------------------------------------------
 
 Required properties:
-- compatible		: Should be "xlnx,xps-spi-2.00.a" or "xlnx,xps-spi-2.00.b"
+- compatible		: Should be "xlnx,xps-spi-2.00.a", "xlnx,xps-spi-2.00.b" or "xlnx,axi-quad-spi-1.00.a"
 - reg			: Physical base address and size of SPI registers map.
 - interrupts		: Property with a value describing the interrupt
 			  number.
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index e0b9fe1d0e37..63fedc49ae9c 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -381,6 +381,7 @@ static int xilinx_spi_find_buffer_size(struct xilinx_spi *xspi)
 }
 
 static const struct of_device_id xilinx_spi_of_match[] = {
+	{ .compatible = "xlnx,axi-quad-spi-1.00.a", },
 	{ .compatible = "xlnx,xps-spi-2.00.a", },
 	{ .compatible = "xlnx,xps-spi-2.00.b", },
 	{}
-- 
2.15.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [v7,1/3] dt-bindings: net: add mt76 wireless device binding
From: Felix Fietkau @ 2017-11-21  8:45 UTC (permalink / raw)
  To: Kalle Valo
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring
In-Reply-To: <20171121070837.AA354607EA-4h6buKAYkuurB/BPivuO70B+6BGkLq7r@public.gmane.org>

On 2017-11-21 08:08, Kalle Valo wrote:
> Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org> wrote:
> 
>> Add documentation describing how device tree can be used to configure
>> wireless chips supported by the mt76 driver.
>> 
>> Signed-off-by: Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org>
>> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> 
> Fails to compile:
> 
> drivers/net/wireless/mediatek/mt76/mac80211.c: In function ‘mt76_led_init’:
> drivers/net/wireless/mediatek/mt76/mac80211.c:111:7: error: implicit declaration of function ‘of_get_child_by_name’ [-Werror=implicit-function-declaration]
>   np = of_get_child_by_name(np, "led");
>        ^
Sorry about that, I must have mixed up something while updating the
patches based on my git tree. Will send out a fixed version later today.

- Felix

^ permalink raw reply

* Re: [PATCH v13 6/7] overlay: Add syntactic sugar version of overlays
From: Pantelis Antoniou @ 2017-11-21  8:34 UTC (permalink / raw)
  To: Grant Likely
  Cc: David Gibson, Jon Loeliger, Frank Rowand, Rob Herring, Jan Luebbe,
	Sascha Hauer, Phil Elwell, Simon Glass, Maxime Ripard,
	Thomas Petazzoni, Boris Brezillon, Antoine Tenart, Stephen Boyd,
	Devicetree Compiler,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <CACxGe6vdGb6tUn5rW7vnnscOMPPjhYUTwVPupB=Mw5D6ub49Ww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi Grant,

> On Nov 20, 2017, at 18:12 , Grant Likely <glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
> 
> On Wed, Dec 7, 2016 at 12:48 PM, Pantelis Antoniou
> <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> wrote:
>> For simple overlays that use a single target there exists a
>> simpler syntax version.
>> 
>> &foo { }; generates an overlay with a single target at foo.
>> 
>> Signed-off-by: Pantelis Antoniou <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
>> ---
>> dtc-parser.y | 20 +++++++++++++++++---
>> dtc.h        |  1 +
>> livetree.c   | 22 ++++++++++++++++++++++
>> 3 files changed, 40 insertions(+), 3 deletions(-)
>> 
>> diff --git a/dtc-parser.y b/dtc-parser.y
>> index 27d358f..50da917 100644
>> --- a/dtc-parser.y
>> +++ b/dtc-parser.y
>> @@ -183,10 +183,19 @@ devicetree:
>>                {
>>                        struct node *target = get_node_by_ref($1, $2);
>> 
>> -                       if (target)
>> +                       if (target) {
>>                                merge_nodes(target, $3);
>> -                       else
>> -                               ERROR(&@2, "Label or path %s not found", $2);
>> +                       } else {
>> +                               /*
>> +                                * We rely on the rule being always:
>> +                                *   versioninfo plugindecl memreserves devicetree
>> +                                * so $-1 is what we want (plugindecl)
>> +                                */
>> +                               if ($<flags>-1 & DTSF_PLUGIN)
>> +                                       add_orphan_node($1, $3, $2);
>> +                               else
>> +                                       ERROR(&@2, "Label or path %s not found", $2);
>> +                       }
> 
> It seems to me that the changes to this rule also need to be made to
> the "devicetree DT_LABEL DT_REF nodedef" rule immediately above it.
> Aside from applying the label, the rules are identical.
> kkk

I don’t think this occurs for the intended case, i.e. a reference at root instead of /

>>                        $$ = $1;
>>                }
>>        | devicetree DT_DEL_NODE DT_REF ';'
>> @@ -201,6 +210,11 @@ devicetree:
>> 
>>                        $$ = $1;
>>                }
>> +       | /* empty */
>> +               {
>> +                       /* build empty node */
>> +                       $$ = name_node(build_node(NULL, NULL), "");
>> +               }
>>        ;
> 
> This change to the parser results in shift/reduce warnings due to an
> ambiguous parser. Just discovered this while playing with the mainline
> dtc.
> 
> I *think* what you're trying to do here is allow for files whose first
> tree is not '/', but a DT_REF. I've got a fix which I'll post as soon
> as I get email from my Linux box working again.
> 

Yes, that’s the only use case.

> g.
> 

Regards

— Pantelis

>> 
>> nodedef:
>> diff --git a/dtc.h b/dtc.h
>> index 2ca8601..c97e291 100644
>> --- a/dtc.h
>> +++ b/dtc.h
>> @@ -198,6 +198,7 @@ struct node *build_node_delete(void);
>> struct node *name_node(struct node *node, char *name);
>> struct node *chain_node(struct node *first, struct node *list);
>> struct node *merge_nodes(struct node *old_node, struct node *new_node);
>> +void add_orphan_node(struct node *old_node, struct node *new_node, char *ref);
>> 
>> void add_property(struct node *node, struct property *prop);
>> void delete_property_by_name(struct node *node, char *name);
>> diff --git a/livetree.c b/livetree.c
>> index df1bc04..0806e47 100644
>> --- a/livetree.c
>> +++ b/livetree.c
>> @@ -216,6 +216,28 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node)
>>        return old_node;
>> }
>> 
>> +void add_orphan_node(struct node *dt, struct node *new_node, char *ref)
>> +{
>> +       static unsigned int next_orphan_fragment = 0;
>> +       struct node *node;
>> +       struct property *p;
>> +       struct data d = empty_data;
>> +       char *name;
>> +
>> +       d = data_add_marker(d, REF_PHANDLE, ref);
>> +       d = data_append_integer(d, 0xffffffff, 32);
>> +
>> +       p = build_property("target", d);
>> +
>> +       xasprintf(&name, "fragment@%u",
>> +                       next_orphan_fragment++);
>> +       name_node(new_node, "__overlay__");
>> +       node = build_node(p, new_node);
>> +       name_node(node, name);
>> +
>> +       add_child(dt, node);
>> +}
>> +
>> struct node *chain_node(struct node *first, struct node *list)
>> {
>>        assert(first->next_sibling == NULL);
>> --
>> 2.1.4

^ permalink raw reply

* Re: [PATCH] dt-bindings: trivial-devices: Remove fsl,mc13892
From: Jonathan Neuschäfer @ 2017-11-21  8:27 UTC (permalink / raw)
  To: Rob Herring
  Cc: Jonathan Neuschäfer, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Rutland
In-Reply-To: <20171120211045.ai24ga4narlm2xo3@rob-hp-laptop>

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

On Mon, Nov 20, 2017 at 03:10:45PM -0600, Rob Herring wrote:
> On Sat, Nov 18, 2017 at 03:22:32AM +0100, Jonathan Neuschäfer wrote:
> > This device's bindings are not trivial: Additional properties are
> > documented in in Documentation/devicetree/bindings/mfd/mc13xxx.txt.
> > 
> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer-hi6Y0CQ0nG0@public.gmane.org>
> > ---
> >  Documentation/devicetree/bindings/trivial-devices.txt | 1 -
> >  1 file changed, 1 deletion(-)
> 
> Applied.

Thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* [PATCH v3 5/5] dt-bindings: pinctrl: deprecate 'microchip,irq-active-high' property
From: Phil Reid @ 2017-11-21  8:21 UTC (permalink / raw)
  To: linus.walleij, robh+dt, mark.rutland, sre, preid, linux-gpio,
	devicetree
In-Reply-To: <1511252491-79952-1-git-send-email-preid@electromag.com.au>

The irq output polarity can be determined from the 'interrupts'
configuration. So 'microchip,irq-active-high' is not required.

Signed-off-by: Phil Reid <preid@electromag.com.au>
---
 Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
index a5a8322..72bac30 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
@@ -58,8 +58,8 @@ Optional device specific properties:
         occurred on. If it is not set, the interrupt are only generated for the
         bank they belong to.
         On devices with only one interrupt output this property is useless.
-- microchip,irq-active-high: Sets the INTPOL flag in the IOCON register. This
-        configures the IRQ output polarity as active high.
+- microchip,irq-active-high: (DEPRECATED)
+        irq polarity is determined from the 'interrupts' configuration
 
 Example I2C (with interrupt):
 gpiom1: gpio@20 {
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH v3 4/5] pinctrl: mcp23s08: configure irq polarity using irq data
From: Phil Reid @ 2017-11-21  8:21 UTC (permalink / raw)
  To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	sre-DgEjT+Ai2ygdnm+yROfE0A,
	preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1511252491-79952-1-git-send-email-preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org>

The irq polarity is already encoded in the irq config. Use that to
determine the polarity for the mcp32s08 irq output instead of the
custom microchip,irq-active-high property.

Signed-off-by: Phil Reid <preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org>
---
 drivers/pinctrl/pinctrl-mcp23s08.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 8ff9b77..6b3f810 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -773,6 +773,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
 	bool mirror = false;
 	bool irq_active_high = false;
 	bool open_drain = false;
+	u32 irq_trig;
 
 	mutex_init(&mcp->lock);
 
@@ -863,9 +864,13 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
 	mcp->irq_controller =
 		device_property_read_bool(dev, "interrupt-controller");
 	if (mcp->irq && mcp->irq_controller) {
-		irq_active_high =
-			device_property_read_bool(dev,
-					      "microchip,irq-active-high");
+		if (device_property_present(dev, "microchip,irq-active-high"))
+			dev_warn(dev,
+				 "microchip,irq-active-high is deprecated\n");
+
+		irq_trig = irqd_get_trigger_type(irq_get_irq_data(mcp->irq));
+		if (irq_trig == IRQF_TRIGGER_HIGH)
+			irq_active_high = true;
 
 		mirror = device_property_read_bool(dev, "microchip,irq-mirror");
 		open_drain = device_property_read_bool(dev, "drive-open-drain");
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH v3 3/5] pinctrl: mcp23s08: add open drain configuration for irq output
From: Phil Reid @ 2017-11-21  8:21 UTC (permalink / raw)
  To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	sre-DgEjT+Ai2ygdnm+yROfE0A,
	preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1511252491-79952-1-git-send-email-preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org>

The mcp23s08 series device can be configured for wired and interrupts
using an external pull-up and open drain output via the IOCON_ODR bit.
And "drive-open-drain" property to enable this.

Signed-off-by: Phil Reid <preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org>
---
 drivers/pinctrl/pinctrl-mcp23s08.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index cc1f9f6..8ff9b77 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -772,6 +772,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
 	int status, ret;
 	bool mirror = false;
 	bool irq_active_high = false;
+	bool open_drain = false;
 
 	mutex_init(&mcp->lock);
 
@@ -867,10 +868,11 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
 					      "microchip,irq-active-high");
 
 		mirror = device_property_read_bool(dev, "microchip,irq-mirror");
+		open_drain = device_property_read_bool(dev, "drive-open-drain");
 	}
 
 	if ((status & IOCON_SEQOP) || !(status & IOCON_HAEN) || mirror ||
-	     irq_active_high) {
+	     irq_active_high || open_drain) {
 		/* mcp23s17 has IOCON twice, make sure they are in sync */
 		status &= ~(IOCON_SEQOP | (IOCON_SEQOP << 8));
 		status |= IOCON_HAEN | (IOCON_HAEN << 8);
@@ -882,6 +884,9 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
 		if (mirror)
 			status |= IOCON_MIRROR | (IOCON_MIRROR << 8);
 
+		if (open_drain)
+			status |= IOCON_ODR | (IOCON_ODR << 8);
+
 		if (type == MCP_TYPE_S18 || type == MCP_TYPE_018)
 			status |= IOCON_INTCC | (IOCON_INTCC << 8);
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH v3 2/5] dt-bindings: pinctrl: mcp23s08: add documentation for drive-open-drain
From: Phil Reid @ 2017-11-21  8:21 UTC (permalink / raw)
  To: linus.walleij, robh+dt, mark.rutland, sre, preid, linux-gpio,
	devicetree
In-Reply-To: <1511252491-79952-1-git-send-email-preid@electromag.com.au>

This flag set the mcp23s08 device irq type to open drain active low.

Signed-off-by: Phil Reid <preid@electromag.com.au>
---
 Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
index 9c451c2..a5a8322 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
@@ -45,6 +45,8 @@ Optional properties:
   - first cell is the pin number
   - second cell is used to specify flags.
 - interrupt-controller: Marks the device node as a interrupt controller.
+- drive-open-drain: Sets the ODR flag in the IOCON register. This configures
+        the IRQ output as open drain active low.
 
 Optional device specific properties:
 - microchip,irq-mirror: Sets the mirror flag in the IOCON register. Devices
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH v3 1/5] pinctrl: mcp23s08: remove hard coded irq polarity in irq_setup
From: Phil Reid @ 2017-11-21  8:21 UTC (permalink / raw)
  To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	sre-DgEjT+Ai2ygdnm+yROfE0A,
	preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1511252491-79952-1-git-send-email-preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org>

The polarity of the irq should be defined in the configuration
for the irq. eg The device tree bind already allows for either
active high / low interrupt configuration.

Signed-off-by: Phil Reid <preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org>
---
 drivers/pinctrl/pinctrl-mcp23s08.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 0aef30e..cc1f9f6 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -56,7 +56,6 @@
 
 struct mcp23s08 {
 	u8			addr;
-	bool			irq_active_high;
 	bool			reg_shift;
 
 	u16			irq_rise;
@@ -627,11 +626,6 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp)
 	int err;
 	unsigned long irqflags = IRQF_ONESHOT | IRQF_SHARED;
 
-	if (mcp->irq_active_high)
-		irqflags |= IRQF_TRIGGER_HIGH;
-	else
-		irqflags |= IRQF_TRIGGER_LOW;
-
 	err = devm_request_threaded_irq(chip->parent, mcp->irq, NULL,
 					mcp23s08_irq,
 					irqflags, dev_name(chip->parent), mcp);
@@ -777,12 +771,12 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
 {
 	int status, ret;
 	bool mirror = false;
+	bool irq_active_high = false;
 
 	mutex_init(&mcp->lock);
 
 	mcp->dev = dev;
 	mcp->addr = addr;
-	mcp->irq_active_high = false;
 
 	mcp->chip.direction_input = mcp23s08_direction_input;
 	mcp->chip.get = mcp23s08_get;
@@ -868,7 +862,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
 	mcp->irq_controller =
 		device_property_read_bool(dev, "interrupt-controller");
 	if (mcp->irq && mcp->irq_controller) {
-		mcp->irq_active_high =
+		irq_active_high =
 			device_property_read_bool(dev,
 					      "microchip,irq-active-high");
 
@@ -876,11 +870,11 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
 	}
 
 	if ((status & IOCON_SEQOP) || !(status & IOCON_HAEN) || mirror ||
-	     mcp->irq_active_high) {
+	     irq_active_high) {
 		/* mcp23s17 has IOCON twice, make sure they are in sync */
 		status &= ~(IOCON_SEQOP | (IOCON_SEQOP << 8));
 		status |= IOCON_HAEN | (IOCON_HAEN << 8);
-		if (mcp->irq_active_high)
+		if (irq_active_high)
 			status |= IOCON_INTPOL | (IOCON_INTPOL << 8);
 		else
 			status &= ~(IOCON_INTPOL | (IOCON_INTPOL << 8));
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH v3 0/5] pinctrl: mcp32s08: add open drain config for irq
From: Phil Reid @ 2017-11-21  8:21 UTC (permalink / raw)
  To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	sre-DgEjT+Ai2ygdnm+yROfE0A,
	preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

This is a continuation of patch 4/5/6 from my previous series 
"gpio: mcp23s08: add support for mcp23018"
The other patches from that series having already been applied.

Hopefully I've address all of Linus's concerns.
Wasn't too sure on how to handle the depcrated property documentation.

Changes from v2:
- Use standard 'drive-open-drain' for irq output configuration
- deprecate 'microchip,irq-active-high' property and extract
  the irq polarity from the 'interrupts' property.
- 'microchip,irq-active-high' property is now ignored except
  for a warning if the property exists. 
  This is probably safe as the 'interrupts' property is most 
  likely setup correctly. 


Phil Reid (5):
  pinctrl: mcp23s08: remove hard coded irq polarity in irq_setup
  dt-bindings: pinctrl: mcp23s08: add documentation for drive-open-drain
  pinctrl: mcp23s08: add open drain configuration for irq output
  pinctrl: mcp23s08: configure irq polarity using irq data
  dt-bindings: pinctrl: deprecate 'microchip,irq-active-high' property

 .../bindings/pinctrl/pinctrl-mcp23s08.txt          |  6 +++--
 drivers/pinctrl/pinctrl-mcp23s08.c                 | 28 ++++++++++++----------
 2 files changed, 20 insertions(+), 14 deletions(-)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v4 4/4] drivers/fsi: sbefifo: Add in-kernel API
From: kbuild test robot @ 2017-11-21  8:07 UTC (permalink / raw)
  Cc: kbuild-all-JC7UmRfGjtg, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8,
	bradleyb-r5pk2Da7Bxt8sGd51Jp2sdBPR1lH4CV8,
	cbostic-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8,
	joel-U3u1mxZcP9KHXe+LvDLADg,
	eajames-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8, Edward A. James
In-Reply-To: <1510947274-7519-5-git-send-email-eajames-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 10728 bytes --]

Hi Edward,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14 next-20171120]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Eddie-James/drivers-fsi-Add-SBEFIFO-client-driver/20171121-024602
config: um-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=um 

All errors (new ones prefixed by >>):

   WARNING: "memcpy" [drivers/net/ppp/ppp_generic.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/ppp/ppp_async.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/phy/xilinx_gmii2rgmii.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/phy/micrel.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/phy/mdio-gpio.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/phy/marvell.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/phy/bcm-phy-lib.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/netconsole.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/macvlan.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/macsec.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/ipvlan/ipvlan.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/hamradio/yam.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/hamradio/mkiss.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/hamradio/hdlcdrv.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/hamradio/bpqether.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/hamradio/6pack.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/geneve.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/ethernet/qualcomm/rmnet/rmnet.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/ethernet/qualcomm/qcauart.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/ethernet/mellanox/mlxsw/mlxsw_i2c.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/ethernet/mellanox/mlxsw/mlxsw_core.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/dummy.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/dsa/mv88e6xxx/mv88e6xxx.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/dsa/microchip/ksz_common.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/dsa/dsa_loop.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/dsa/b53/b53_common.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/can/slcan.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/can/can-dev.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/caif/caif_serial.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/caif/caif_hsi.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/bonding/bonding.ko] has no CRC!
   WARNING: "memcpy" [drivers/net/appletalk/ipddp.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/ubi/ubi.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/tests/mtd_pagetest.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/tests/mtd_nandecctest.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/tests/mtd_nandbiterrs.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/spi-nor/spi-nor.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/sm_ftl.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/nftl.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/nand/nandsim.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/nand/nand.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/mtdswap.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/mtdblock.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/mtd.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/lpddr/qinfo_probe.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/lpddr/lpddr_cmds.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/inftl.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/chips/map_rom.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/chips/map_ram.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/chips/jedec_probe.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/chips/gen_probe.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/chips/cfi_util.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/chips/cfi_probe.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/chips/cfi_cmdset_0020.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/chips/cfi_cmdset_0002.ko] has no CRC!
   WARNING: "memcpy" [drivers/mtd/chips/cfi_cmdset_0001.ko] has no CRC!
   WARNING: "memcpy" [drivers/misc/ti-st/st_drv.ko] has no CRC!
   WARNING: "memcpy" [drivers/misc/lkdtm.ko] has no CRC!
   WARNING: "memcpy" [drivers/misc/eeprom/max6875.ko] has no CRC!
   WARNING: "memcpy" [drivers/misc/eeprom/idt_89hpesx.ko] has no CRC!
   WARNING: "memcpy" [drivers/misc/eeprom/eeprom.ko] has no CRC!
   WARNING: "memcpy" [drivers/misc/eeprom/at24.ko] has no CRC!
   WARNING: "memcpy" [drivers/misc/echo/echo.ko] has no CRC!
   WARNING: "memcpy" [drivers/memstick/core/mspro_block.ko] has no CRC!
   WARNING: "memcpy" [drivers/memstick/core/memstick.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/raid456.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/raid10.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/raid1.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/persistent-data/dm-persistent-data.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/md-mod.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/md-cluster.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-zoned.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-verity.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-thin-pool.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-snapshot.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-mod.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-log.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-log-writes.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-log-userspace.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-integrity.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-era.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-crypt.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-cache.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/dm-bio-prison.ko] has no CRC!
   WARNING: "memcpy" [drivers/md/bcache/bcache.ko] has no CRC!
   WARNING: "memcpy" [drivers/leds/leds-tca6507.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/light/tsl2583.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/industrialio.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/imu/inv_mpu6050/inv-mpu6050.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/humidity/hts221_i2c.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/health/max30102.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/adc/ti-ads1015.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/accel/mma9551_core.ko] has no CRC!
   WARNING: "memcpy" [drivers/iio/accel/bmc150-accel-core.ko] has no CRC!
   WARNING: "memcpy" [drivers/i2c/muxes/i2c-mux-gpio.ko] has no CRC!
   WARNING: "memcpy" [drivers/i2c/i2c-slave-eeprom.ko] has no CRC!
   WARNING: "memcpy" [drivers/i2c/i2c-core.ko] has no CRC!
   WARNING: "memcpy" [drivers/gpio/gpio-pca953x.ko] has no CRC!
>> ERROR: "of_platform_device_create" [drivers/fsi/fsi-sbefifo.ko] undefined!
   WARNING: "memcpy" [drivers/fsi/fsi-sbefifo.ko] has no CRC!
   WARNING: "memcpy" [drivers/fsi/fsi-core.ko] has no CRC!
   WARNING: "memcpy" [drivers/fmc/fmc.ko] has no CRC!
   WARNING: "memcpy" [drivers/fmc/fmc-fakedev.ko] has no CRC!
   WARNING: "memcpy" [drivers/connector/cn.ko] has no CRC!
   WARNING: "memcpy" [drivers/cdrom/cdrom.ko] has no CRC!
   WARNING: "memcpy" [drivers/bluetooth/hci_vhci.ko] has no CRC!
   WARNING: "memcpy" [drivers/bluetooth/hci_uart.ko] has no CRC!
   WARNING: "memcpy" [drivers/bluetooth/btwilink.ko] has no CRC!
   WARNING: "memcpy" [drivers/bluetooth/btqca.ko] has no CRC!
   WARNING: "memcpy" [drivers/bluetooth/btmrvl.ko] has no CRC!
   WARNING: "memcpy" [drivers/bluetooth/btintel.ko] has no CRC!
   WARNING: "memcpy" [drivers/block/rbd.ko] has no CRC!
   WARNING: "memcpy" [drivers/block/null_blk.ko] has no CRC!
   WARNING: "memcpy" [drivers/block/nbd.ko] has no CRC!
   WARNING: "memcpy" [drivers/block/loop.ko] has no CRC!
   WARNING: "memcpy" [drivers/block/drbd/drbd.ko] has no CRC!
   WARNING: "memcpy" [drivers/block/cryptoloop.ko] has no CRC!
   WARNING: "memcpy" [drivers/block/brd.ko] has no CRC!
   WARNING: "memcpy" [drivers/block/aoe/aoe.ko] has no CRC!
   WARNING: "memcpy" [drivers/base/firmware_class.ko] has no CRC!
   ERROR: "devm_ioremap_resource" [drivers/auxdisplay/img-ascii-lcd.ko] undefined!
   WARNING: "memcpy" [drivers/auxdisplay/img-ascii-lcd.ko] has no CRC!
   WARNING: "memcpy" [drivers/atm/atmtcp.ko] has no CRC!
   WARNING: "memcpy" [crypto/xcbc.ko] has no CRC!
   WARNING: "memcpy" [crypto/wp512.ko] has no CRC!
   WARNING: "memcpy" [crypto/vmac.ko] has no CRC!
   WARNING: "memcpy" [crypto/tgr192.ko] has no CRC!
   WARNING: "memcpy" [crypto/sm3_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/sha512_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/sha3_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/salsa20_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/rmd320.ko] has no CRC!
   WARNING: "memcpy" [crypto/rmd256.ko] has no CRC!
   WARNING: "memcpy" [crypto/rmd160.ko] has no CRC!
   WARNING: "memcpy" [crypto/rmd128.ko] has no CRC!
   WARNING: "memcpy" [crypto/poly1305_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/pcbc.ko] has no CRC!
   WARNING: "memcpy" [crypto/michael_mic.ko] has no CRC!
   WARNING: "memcpy" [crypto/md4.ko] has no CRC!
   WARNING: "memcpy" [crypto/mcryptd.ko] has no CRC!
   WARNING: "memcpy" [crypto/lrw.ko] has no CRC!
   WARNING: "memcpy" [crypto/keywrap.ko] has no CRC!
   WARNING: "memcpy" [crypto/fcrypt.ko] has no CRC!
   WARNING: "memcpy" [crypto/echainiv.ko] has no CRC!
   WARNING: "memcpy" [crypto/ecdh_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/des_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/cts.ko] has no CRC!
   WARNING: "memcpy" [crypto/cryptd.ko] has no CRC!
   WARNING: "memcpy" [crypto/cmac.ko] has no CRC!
   WARNING: "memcpy" [crypto/chacha20poly1305.ko] has no CRC!
   WARNING: "memcpy" [crypto/chacha20_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/ccm.ko] has no CRC!
   WARNING: "memcpy" [crypto/cast6_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/cast5_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/camellia_generic.ko] has no CRC!
   WARNING: "memcpy" [crypto/async_tx/async_memcpy.ko] has no CRC!
   WARNING: "memcpy" [crypto/ansi_cprng.ko] has no CRC!
   WARNING: "memcpy" [crypto/af_alg.ko] has no CRC!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 20020 bytes --]

^ permalink raw reply

* Re: [v7,1/3] dt-bindings: net: add mt76 wireless device binding
From: Kalle Valo @ 2017-11-21  7:08 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, devicetree, Rob Herring
In-Reply-To: <20171120193549.80831-2-nbd@nbd.name>

Felix Fietkau <nbd@nbd.name> wrote:

> Add documentation describing how device tree can be used to configure
> wireless chips supported by the mt76 driver.
> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> Acked-by: Rob Herring <robh@kernel.org>

Fails to compile:

drivers/net/wireless/mediatek/mt76/mac80211.c: In function ‘mt76_led_init’:
drivers/net/wireless/mediatek/mt76/mac80211.c:111:7: error: implicit declaration of function ‘of_get_child_by_name’ [-Werror=implicit-function-declaration]
  np = of_get_child_by_name(np, "led");
       ^
drivers/net/wireless/mediatek/mt76/mac80211.c:111:5: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  np = of_get_child_by_name(np, "led");
     ^
drivers/net/wireless/mediatek/mt76/mac80211.c:113:8: error: implicit declaration of function ‘of_property_read_u32’ [-Werror=implicit-function-declaration]
   if (!of_property_read_u32(np, "led-sources", &led_pin))
        ^
drivers/net/wireless/mediatek/mt76/mac80211.c:115:17: error: implicit declaration of function ‘of_property_read_bool’ [-Werror=implicit-function-declaration]
   dev->led_al = of_property_read_bool(np, "led-active-low");
                 ^
cc1: some warnings being treated as errors
make[5]: *** [drivers/net/wireless/mediatek/mt76/mac80211.o] Error 1
make[5]: *** Waiting for unfinished jobs....
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c: In function ‘mt76x2_mac_process_rate’:
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:49:20: error: ‘RX_FLAG_SHORTPRE’ undeclared (first use in this function)
    status->flag |= RX_FLAG_SHORTPRE;
                    ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:49:20: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:58:19: error: ‘RX_FLAG_HT_GF’ undeclared (first use in this function)
   status->flag |= RX_FLAG_HT_GF;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:61:19: error: ‘RX_FLAG_HT’ undeclared (first use in this function)
   status->flag |= RX_FLAG_HT;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:65:19: error: ‘RX_FLAG_VHT’ undeclared (first use in this function)
   status->flag |= RX_FLAG_VHT;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:67:9: error: ‘struct ieee80211_rx_status’ has no member named ‘vht_nss’
   status->vht_nss = FIELD_GET(MT_RATE_INDEX_VHT_NSS, idx) + 1;
         ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:75:19: error: ‘RX_FLAG_LDPC’ undeclared (first use in this function)
   status->flag |= RX_FLAG_LDPC;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:78:19: error: ‘RX_FLAG_SHORT_GI’ undeclared (first use in this function)
   status->flag |= RX_FLAG_SHORT_GI;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:81:24: error: ‘RX_FLAG_STBC_SHIFT’ undeclared (first use in this function)
   status->flag |= 1 << RX_FLAG_STBC_SHIFT;
                        ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:87:19: error: ‘RX_FLAG_40MHZ’ undeclared (first use in this function)
   status->flag |= RX_FLAG_40MHZ;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:90:9: error: ‘struct ieee80211_rx_status’ has no member named ‘vht_flag’
   status->vht_flag |= RX_VHT_FLAG_80MHZ;
         ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:90:23: error: ‘RX_VHT_FLAG_80MHZ’ undeclared (first use in this function)
   status->vht_flag |= RX_VHT_FLAG_80MHZ;
                       ^
make[5]: *** [drivers/net/wireless/mediatek/mt76/mt76x2_mac.o] Error 1
make[4]: *** [drivers/net/wireless/mediatek/mt76] Error 2
make[3]: *** [drivers/net/wireless/mediatek] Error 2
make[2]: *** [drivers/net/wireless] Error 2
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2

3 patches set to Changes Requested.

10067143 [v7,1/3] dt-bindings: net: add mt76 wireless device binding
10067141 [v7,2/3] mt76: add common code shared between multiple chipsets
10067145 [v7,3/3] mt76: add driver code for MT76x2e

-- 
https://patchwork.kernel.org/patch/10067143/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply

* Re: [v7,1/3] dt-bindings: net: add mt76 wireless device binding
From: Kalle Valo @ 2017-11-21  7:08 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring
In-Reply-To: <20171120193549.80831-2-nbd-Vt+b4OUoWG0@public.gmane.org>

Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org> wrote:

> Add documentation describing how device tree can be used to configure
> wireless chips supported by the mt76 driver.
> 
> Signed-off-by: Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org>
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Fails to compile:

drivers/net/wireless/mediatek/mt76/mac80211.c: In function ‘mt76_led_init’:
drivers/net/wireless/mediatek/mt76/mac80211.c:111:7: error: implicit declaration of function ‘of_get_child_by_name’ [-Werror=implicit-function-declaration]
  np = of_get_child_by_name(np, "led");
       ^
drivers/net/wireless/mediatek/mt76/mac80211.c:111:5: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  np = of_get_child_by_name(np, "led");
     ^
drivers/net/wireless/mediatek/mt76/mac80211.c:113:8: error: implicit declaration of function ‘of_property_read_u32’ [-Werror=implicit-function-declaration]
   if (!of_property_read_u32(np, "led-sources", &led_pin))
        ^
drivers/net/wireless/mediatek/mt76/mac80211.c:115:17: error: implicit declaration of function ‘of_property_read_bool’ [-Werror=implicit-function-declaration]
   dev->led_al = of_property_read_bool(np, "led-active-low");
                 ^
cc1: some warnings being treated as errors
make[5]: *** [drivers/net/wireless/mediatek/mt76/mac80211.o] Error 1
make[5]: *** Waiting for unfinished jobs....
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c: In function ‘mt76x2_mac_process_rate’:
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:49:20: error: ‘RX_FLAG_SHORTPRE’ undeclared (first use in this function)
    status->flag |= RX_FLAG_SHORTPRE;
                    ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:49:20: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:58:19: error: ‘RX_FLAG_HT_GF’ undeclared (first use in this function)
   status->flag |= RX_FLAG_HT_GF;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:61:19: error: ‘RX_FLAG_HT’ undeclared (first use in this function)
   status->flag |= RX_FLAG_HT;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:65:19: error: ‘RX_FLAG_VHT’ undeclared (first use in this function)
   status->flag |= RX_FLAG_VHT;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:67:9: error: ‘struct ieee80211_rx_status’ has no member named ‘vht_nss’
   status->vht_nss = FIELD_GET(MT_RATE_INDEX_VHT_NSS, idx) + 1;
         ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:75:19: error: ‘RX_FLAG_LDPC’ undeclared (first use in this function)
   status->flag |= RX_FLAG_LDPC;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:78:19: error: ‘RX_FLAG_SHORT_GI’ undeclared (first use in this function)
   status->flag |= RX_FLAG_SHORT_GI;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:81:24: error: ‘RX_FLAG_STBC_SHIFT’ undeclared (first use in this function)
   status->flag |= 1 << RX_FLAG_STBC_SHIFT;
                        ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:87:19: error: ‘RX_FLAG_40MHZ’ undeclared (first use in this function)
   status->flag |= RX_FLAG_40MHZ;
                   ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:90:9: error: ‘struct ieee80211_rx_status’ has no member named ‘vht_flag’
   status->vht_flag |= RX_VHT_FLAG_80MHZ;
         ^
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c:90:23: error: ‘RX_VHT_FLAG_80MHZ’ undeclared (first use in this function)
   status->vht_flag |= RX_VHT_FLAG_80MHZ;
                       ^
make[5]: *** [drivers/net/wireless/mediatek/mt76/mt76x2_mac.o] Error 1
make[4]: *** [drivers/net/wireless/mediatek/mt76] Error 2
make[3]: *** [drivers/net/wireless/mediatek] Error 2
make[2]: *** [drivers/net/wireless] Error 2
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2

3 patches set to Changes Requested.

10067143 [v7,1/3] dt-bindings: net: add mt76 wireless device binding
10067141 [v7,2/3] mt76: add common code shared between multiple chipsets
10067145 [v7,3/3] mt76: add driver code for MT76x2e

-- 
https://patchwork.kernel.org/patch/10067143/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: RFC: Copying Device Tree File into reserved area of VMLINUX before deployment
From: Ulf Samuelsson @ 2017-11-21  6:19 UTC (permalink / raw)
  To: Frank Rowand, LKML, devicetree@vger.kernel.org, Rob Herring
In-Reply-To: <872e81dc-82ba-f838-c4f8-88d2208d23d2@emagii.com>



On 2017-11-21 00:09, Ulf Samuelsson wrote:
> 
> 
> On 2017-11-20 22:39, Frank Rowand wrote:
>> Hi Ulf, Rob,
>>
>> On 11/20/17 15:19, Ulf Samuelsson wrote:
>>>
>>>
>>> On 2017-11-20 05:32, Frank Rowand wrote:
>>>> Hi Ulf,
>>>>
>>>>
>>>> On 11/19/17 23:23, Frank Rowand wrote:
>>>>> adding devicetree list, devicetree maintainers
>>>>>
>>>>> On 11/18/17 12:59, Ulf Samuelsson wrote:
>>>>>> I noticed when checking out the OpenWRT support for the board that 
>>>>>> they have a method to avoid having to pass the device tree address 
>>>>>> to the kernel, and can thus boot device tree based kernels with 
>>>>>> U-boots that
>>>>>> does not support device trees.
>>>>>>
>>>>>> Is this something that would be considered useful for including in 
>>>>>> mainstream:
>>>>>>
>>>>>> BACKGROUND:
>>>>>> Trying to load a yocto kernel into a MIPS target (MT7620A based),
>>>>>> and the U-Boot is more than stupid.
>>>>>> Does not support the "run" command as an example.
>>>>>> They modified the U-Boot MAGIC Word to complicate things.
>>>>>> The U-Boot is not configured to use device tree files.
>>>>>> The board runs a 2.6 kernel right now.
>>>>>>
>>>>>> Several attempts by me a and others to rebuild U-Boot according to
>>>>>> the H/W vendors source code and build instructions results in a
>>>>>> bricked unit. Bricked units cannot be recovered.
>>>>
>>>> Hopefully you have brought this to the attention of the vendor.  U-Boot
>>>> is GPL v2 (or in some ways possibly GPL v2 or later), so if you can not
>>>> build U-Boot that is equivalent to the binary U-Boot they shipped, the
>>>> vendor may want to ensure that they are shipping the proper source and
>>>> build instructions.
>>>>
>>>
>>> I am not the one in contact with the H/W vendor.
>>> The U-boot is pretty old, and from comments from those
>>> in contact with them, the U-Boot knowledge at the H/W vendor
>>> is minimal at best.
>>> It might even be that they program an U-boot where the upgrade of the 
>>> U-boot is broken...
>>>
>>>
>>>>
>>>>>> Not my choice of H/W, so I cannot change it.
>>>>>>
>>>>>>
>>>>>> ===================================================================
>>>>>> OPENWRT:
>>>>>> I noticed when checking out the OpenWRT support for the board that
>>>>>> they have a method to avoid having to pass the device tree address
>>>>>> to the kernel, and can thus boot device tree based kernels with
>>>>>> U-boots that does not support device trees.
>>>>>>
>>>>>> What they do is to reserve 16 kB of kernel space, and tag it with
>>>>>> an ASCII string "OWRTDTB:". After the kernel and dtb is built, a
>>>>>> utility "patch-dtb" will update the vmlinux binary, copying in the
>>>>>> device tree file.
>>>>>>
>>>>>> ===================================================================
>>>>>> It would be useful to me, and I could of course patch the
>>>>>> mainstream kernel, but first I would like to check if this is of
>>>>>> interest for mainstream.
>>>>
>>>> Not in this form.  Hard coding a fixed size area in the boot image
>>>> to contain the FDT (aka DTB) is a non-starter.
>>>
>>> OK, Is it the fixed size, which is a problem?
>>
>> Yes, it is the fixed size which is a problem.
> 
> The size can of course be changed, by setting the size configuration 
> option (DTB_SIZE).
> OpenWRT does not support that, but I think it needs to be there for a 
> generic option (but You have to recompile the kernel to increase the size).
> 
> One problem is that you normally compile and link the kernel before you
> compile the dtbs, so you do not know what size is until afterwards.
> 
Found this link:	https://csl.name/post/embedding-binary-data/

=======================================
...
Let's say you have an image target.dtb and want to embed it into your 
application. You can create an object file with


image_dtb.o:	<target dtb>
	mv <target dtb>   image_dtb
	ld -r -b binary image_dtb -o image_dtb.o

The object file will have three symbols in it,

$ nm cat.o
0000000000000512 D _binary_image_dtb_end
0000000000000512 A _binary_image_dtb_size
0000000000000000 D _binary_image_dtb_start
=======================================

This assumes that the dtbs are built before the kernel is linked.
The copy step is neccessary, since the generated names are
taken from the name of the "in file".
(Would have been better, if they used the "out file")

Otherwise you can create an assembler file which "incbin's" the dtb file.




> 
>>
>>> Is generally combining an image with a DTB into a single file also a 
>>> non-starter?
>>
>> Can you jump in here Rob?  My understanding is that 
>> CONFIG_ARM_APPENDED_DTB,
>> which is the ARM based solution that Mark mentioned, was envisioned as a
>> temporary stop gap until boot loaders could add devicetree support.  I 
>> don't
>> know if there is a desire to limit this approach or to remove it in the
>> future.
>>
>> I'm not sure why this feature should not be permanently supported.  
>> I'm being
>> cautious, just in case I'm overlooking or missing an important issue, 
>> thus
>> asking for Rob's input.  I do know that this feature does not advance the
>> desires of people who want a single kernel (single boot image?) that 
>> runs on
>> many different systems, instead of a boot image that is unique to each
>> target platform.  But I don't see why that desire precludes also having
>> an option to have a target specific boot image.
> The main reason to keep it is when you are really constrained for memory.
> The U-Boot on the board is 96 kB, which is just a fraction of a more 
> normal U-Boot.
> Also, the u-boot is old.
> 
> 
>>
>> -Frank
>>
>>
>>>>
>>>> And again, I would first approach the H/W vendor before trying to
>>>> come up with a work around like this.
>>>>
>>>>
>>>>>> I envisage the support would look something like:
>>>>>>
>>>>>> ============
>>>>>> Kconfig.
>>>>>> config MIPS
>>>>>>       select    HAVE_IMAGE_DTB
>>>>>>
>>>>>> config    HAVE_IMAGE_DTB
>>>>>>       bool
>>>>>>
>>>>>> if HAVE_IMAGE_DTB
>>>>>> config     IMAGE_DTB
>>>>>>       bool    "Allocated space for DTB within image
>>>>>>
>>>>>> config    DTB_SIZE
>>>>>>       int    "DTB space (kB)
>>>>>>
>>>>>> config    DTB_TAG
>>>>>>       string    "DTB space tag"
>>>>>>       default    "OWRTDTB:"
>>>>>> endif
>>>>>>
>>>>>> ============
>>>>>> Some Makefile
>>>>>> obj-$(CONFIG_INCLUDE_DTB) += image_dtb.o
>>>>>>
>>>>>> ============
>>>>>> image_dtb.S:
>>>>>>       .text
>>>>>>       .align    5
>>>>>>       .ascii    CONFIG_DTB_TAG
>>>>>>       EXPORT(__image_dtb)
>>>>>>       .fill    DTB_SIZE * 1024
>>>>>>
>>>>>> ===================
>>>>>> arch/mips/xxx/of.c:
>>>>>>
>>>>>> #if    defined(CONFIG_IMAGE_DTB)
>>>>>>       if (<conditions to boot from dtb_space>)
>>>>>>           __dt_setup_arch(__dtb_start);
>>>>>>       else
>>>>>>           __dt_setup_arch(&__image_dtb);
>>>>>> #else
>>>>>>       __dt_setup_arch(__dtb_start);
>>>>>> #endif
>>>>>>
>>>>>> I imagine that if the support is enabled for a target, it should
>>>>>> be possible to override it with a CMDLINE argument
>>>>>>            They do something similar for the CMDLINE; copying it 
>>>>>> into the vmlinux, to allow a smaller boot
>>>
>>
> 

-- 
Best Regards
Ulf Samuelsson

^ permalink raw reply

* [PATCH v2] clk: qoriq: add more divider clocks support
From: andy.tang @ 2017-11-21  6:13 UTC (permalink / raw)
  To: mturquette, sboyd, robh+dt
  Cc: mark.rutland, linux-clk, devicetree, Yuantian Tang

From: Yuantian Tang <andy.tang@nxp.com>

More divider clocks are needed by IP. So enlarge the PLL divider
array to accommodate more divider clocks.

Signed-off-by: Tang Yuantian <andy.tang@nxp.com>
---
v2:
  - fix a logical error

 Documentation/devicetree/bindings/clock/qoriq-clock.txt | 1 +
 drivers/clk/clk-qoriq.c                                 | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/clock/qoriq-clock.txt b/Documentation/devicetree/bindings/clock/qoriq-clock.txt
index 6498e1fdbb33..97f46adac85f 100644
--- a/Documentation/devicetree/bindings/clock/qoriq-clock.txt
+++ b/Documentation/devicetree/bindings/clock/qoriq-clock.txt
@@ -78,6 +78,7 @@ second cell is the clock index for the specified type.
 	2	hwaccel		index (n in CLKCGnHWACSR)
 	3	fman		0 for fm1, 1 for fm2
 	4	platform pll	0=pll, 1=pll/2, 2=pll/3, 3=pll/4
+				4=pll/5, 5=pll/6, 6=pll/7, 7=pll/8
 	5	coreclk		must be 0
 
 3. Example
diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index b0ea753b8709..3a1812f65e5d 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -41,7 +41,7 @@ struct clockgen_pll_div {
 };
 
 struct clockgen_pll {
-	struct clockgen_pll_div div[4];
+	struct clockgen_pll_div div[8];
 };
 
 #define CLKSEL_VALID	1
@@ -1127,6 +1127,13 @@ static void __init create_one_pll(struct clockgen *cg, int idx)
 		struct clk *clk;
 		int ret;
 
+		/*
+		 * For platform PLL, there are 8 divider clocks.
+		 * For core PLL, there are 4 divider clocks at most.
+		 */
+		if (idx != PLATFORM_PLL && i >= 4)
+			break;
+
 		snprintf(pll->div[i].name, sizeof(pll->div[i].name),
 			 "cg-pll%d-div%d", idx, i + 1);
 
-- 
2.14.1


^ permalink raw reply related

* [PATCH] drivers/fsi: sbefifo: fix call_kern.cocci warnings
From: Julia Lawall @ 2017-11-21  6:12 UTC (permalink / raw)
  Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8,
	bradleyb-r5pk2Da7Bxt8sGd51Jp2sdBPR1lH4CV8,
	cbostic-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8,
	joel-U3u1mxZcP9KHXe+LvDLADg,
	eajames-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8, Edward A. James,
	kbuild-all-JC7UmRfGjtg, linux-kernel-u79uwXL29TY76Z2rM5mHXA

Function sbefifo_enq_xfr called inside lock from sbefifo_write_common but
uses GFP_KERNEL.  Change to GFP_ATOMIC.

Generated by: scripts/coccinelle/locks/call_kern.cocci

Fixes: 0f8664fbfc9f ("drivers/fsi: sbefifo: Add miscdevice")
CC: Edward A. James <eajames-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>
Signed-off-by: Fengguang Wu <fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

Semantic patch information:
 The proposed change of converting the GFP_KERNEL is not necessarily the
 correct one.  It may be desired to unlock the lock, or to not call the
 function under the lock in the first place.


 fsi-sbefifo.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -266,7 +266,7 @@ static struct sbefifo_xfr *sbefifo_enq_x
 	if (READ_ONCE(sbefifo->rc))
 		return ERR_PTR(sbefifo->rc);

-	xfr = kzalloc(sizeof(*xfr), GFP_KERNEL);
+	xfr = kzalloc(sizeof(*xfr), GFP_ATOMIC);
 	if (!xfr)
 		return ERR_PTR(-ENOMEM);

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [patches] Re: [PATCH] dt-bindings: Add a RISC-V SBI firmware node
From: Jonathan Neuschäfer @ 2017-11-21  1:08 UTC (permalink / raw)
  To: patches-q3qR2WxjNRFS9aJRtSZj7A
  Cc: j.neuschaefer-hi6Y0CQ0nG0, mark.rutland-5wv7dgnIgG8,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <mhng-4a3ed3c5-a562-427c-817e-cd897789d5c0@palmer-si-x1c4>

[-- Attachment #1: Type: text/plain, Size: 2452 bytes --]

On Mon, Nov 20, 2017 at 01:28:01PM -0800, Palmer Dabbelt wrote:
[...]
> > > +++ b/Documentation/devicetree/bindings/firmware/riscv.sbi.txt
> > 
> > Nit: Other bindings use either a comma (as in the compatible string,
> > "riscv,sbi.txt") or a dash (vendor-product.txt, "riscv-sbi.txt") in the
> > file name.
> 
> That was just a typo, I'll fix it.

Ok

> > > @@ -0,0 +1,20 @@
> > > +RISC-V Supervisor Binary Interface (SBI)
> > > +
> > > +The RISC-V privileged ISA specification mandates the presence of a supervisor
> > > +binary interface that performs some operations which might otherwise require
> > > +particularly complicated instructions.  This interface includes
> > > +inter-processor interrupts, TLB flushes, i-cache and TLB shootdowns, a
> > > +console, and power management.
> > > +
> > > +Required properties:
> > > +- compatible: must contain one of the following
> > > + * "riscv,sbi" for the SBI defined by the privileged specification of the
> > > +   system.
> > 
> > "of the system" seems to imply that different RISC-V systems (different
> > RISC-V implementations) can have different privileged specifications.
> 
> Actually, that was intentional -- I wrote it this way because different
> RISC-V systems do have different privileged specifications.  The RISC-V
> specifications aren't frozen in time, they're just guaranteed to be
> compatible in the future.  For example, the user ISA document has been
> updated multiple times (the C spec, eliminating some unspecified behavior)
> and will continue to be updated (V and other extensions, the memory model).
> The privileged spec will be updated in a compatible way just like the user
> spec will be -- I know there's at least hypervisor support in the works, and
> I saw some things to remove undefined behavior go past as well.
> 
> In a similar fashion, the ABI and SBI will continue to evolve.  For example,
> we'll probably add new system calls to extend the user ABI and new hyper
> calls to extend the SBI.

My problem with the wording was that the OS somehow has to know which
version and variant of the SBI it is talking to -- either through
in-band communication (an SBI call to request SBI information, etc.), or
through devicetree or similar mechanisms.

> 
> > I think it's better to refer to concrete documents, that don't depend on
> > the rest of the system, instead. Either:


Thanks,
Jonathan Neuschäfer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH v3 1/3] leds: core: Introduce generic pattern interface
From: Bjorn Andersson @ 2017-11-21  0:21 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Greg KH, Richard Purdie, Jacek Anaszewski, linux-kernel,
	linux-leds, linux-arm-msm, Rob Herring, Mark Rutland, devicetree,
	Fenglin Wu
In-Reply-To: <20171120232015.GB13906@amd>

On Mon 20 Nov 15:20 PST 2017, Pavel Machek wrote:

> On Wed 2017-11-15 08:36:42, Greg KH wrote:
> > On Tue, Nov 14, 2017 at 11:13:43PM -0800, Bjorn Andersson wrote:
> > > Some LED controllers have support for autonomously controlling
> > > brightness over time, according to some preprogrammed pattern or
> > > function.
> > > 
> > > This adds a new optional operator that LED class drivers can implement
> > > if they support such functionality as well as a new device attribute to
> > > configure the pattern for a given LED.
> > > 
> > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > > ---
> > > 
> > > Changes since v2:
> > > - None
> > > 
> > > Changes since v1:
> > > - New patch, based on discussions following v1
> > > 
> > >  Documentation/ABI/testing/sysfs-class-led |  20 ++++
> > >  drivers/leds/led-class.c                  | 150 ++++++++++++++++++++++++++++++
> > >  include/linux/leds.h                      |  21 +++++
> > >  3 files changed, 191 insertions(+)
> > > 
> > > diff --git a/Documentation/ABI/testing/sysfs-class-led b/Documentation/ABI/testing/sysfs-class-led
> > > index 5f67f7ab277b..74a7f5b1f89b 100644
> > > --- a/Documentation/ABI/testing/sysfs-class-led
> > > +++ b/Documentation/ABI/testing/sysfs-class-led
> > > @@ -61,3 +61,23 @@ Description:
> > >  		gpio and backlight triggers. In case of the backlight trigger,
> > >  		it is useful when driving a LED which is intended to indicate
> > >  		a device in a standby like state.
> > > +
> > > +What:		/sys/class/leds/<led>/pattern
> > > +Date:		July 2017
> > 
> > That was many months ago :)
> > 
> > > +KernelVersion:	4.14
> > 
> > And that kernel version is long since released :)
> 
> Yeah, the other problem is it has some interesting format with ":|"
> marking repeat,

So what would you prefer?

We can either add another file ("pattern_repeat"?) that allows you to
describe this separately or some other symbol.

> and is not really suitable for RGB LEDs...
> 

I can think of two ways to support patterns for a RGB LED;
1) Provide N files for the N channels
2) Make each entry in the suggested pattern file be N brightness values
   followed by the duration - if we wrap each N-tuple in some symbol
   (e.g. <>) this would transparently support "set all channels to same
   brightness value" and per-channel values.

The latter being fully compatible with the proposed interface.

> I'd really prefer to get driver in first, and add pattern interface
> later.
> 

Sure, I can move all the pattern-related code from the driver into a
separate patch.

Regards,
Bjorn

^ permalink raw reply

* [PATCH v3 12/12] hwmon (occ): Add sysfs notification for errors and throttling
From: Eddie James @ 2017-11-20 23:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-hwmon, devicetree, linux-doc, linux, jdelvare, corbet,
	mark.rutland, robh+dt, joel, eajames, Edward A. James
In-Reply-To: <1511222021-562-1-git-send-email-eajames@linux.vnet.ibm.com>

From: "Edward A. James" <eajames@us.ibm.com>

In order to aid application usage of the error, throttling, and
presence count properties, use sysfs_notify to notify users of change on
these attributes.

Signed-off-by: Edward A. James <eajames@us.ibm.com>
---
 drivers/hwmon/occ/common.c | 53 ++++++++++++++++++++++++++++++++++++++++++++--
 drivers/hwmon/occ/common.h |  5 +++++
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index 7a0606d..7c97a4c 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -146,6 +146,8 @@ static ssize_t occ_show_error(struct device *dev,
 
 static DEVICE_ATTR(occ_error, 0444, occ_show_error, NULL);
 
+static void occ_sysfs_notify(struct occ *occ);
+
 static int occ_poll(struct occ *occ)
 {
 	struct occ_poll_response_header *header;
@@ -169,7 +171,7 @@ static int occ_poll(struct occ *occ)
 		if (occ->error_count++ > OCC_ERROR_COUNT_THRESHOLD)
 			occ->error = rc;
 
-		return rc;
+		goto done;
 	}
 
 	/* clear error since communication was successful */
@@ -190,7 +192,9 @@ static int occ_poll(struct occ *occ)
 		occ->last_safe = 0;
 	}
 
-	return 0;
+done:
+	occ_sysfs_notify(occ);
+	return rc;
 }
 
 static int occ_set_user_power_cap(struct occ *occ, u16 user_power_cap)
@@ -1244,6 +1248,51 @@ static ssize_t occ_show_status(struct device *dev,
 	.attrs = occ_attributes,
 };
 
+static void occ_sysfs_notify(struct occ *occ)
+{
+	const char *name;
+	struct occ_poll_response_header *header =
+		(struct occ_poll_response_header *)occ->resp.data;
+
+	/* sysfs attributes aren't loaded yet; don't proceed */
+	if (!occ->hwmon)
+		goto done;
+
+	if (header->occs_present != occ->previous_occs_present &&
+	    (header->status & OCC_STAT_MASTER)) {
+		name = sensor_dev_attr_occs_present.dev_attr.attr.name;
+		sysfs_notify(&occ->bus_dev->kobj, NULL, name);
+	}
+
+	if ((header->ext_status & OCC_EXT_STAT_DVFS_OT) !=
+	    (occ->previous_ext_status & OCC_EXT_STAT_DVFS_OT)) {
+		name = sensor_dev_attr_occ_dvfs_ot.dev_attr.attr.name;
+		sysfs_notify(&occ->bus_dev->kobj, NULL, name);
+	}
+
+	if ((header->ext_status & OCC_EXT_STAT_DVFS_POWER) !=
+	    (occ->previous_ext_status & OCC_EXT_STAT_DVFS_POWER)) {
+		name = sensor_dev_attr_occ_dvfs_power.dev_attr.attr.name;
+		sysfs_notify(&occ->bus_dev->kobj, NULL, name);
+	}
+
+	if ((header->ext_status & OCC_EXT_STAT_MEM_THROTTLE) !=
+	    (occ->previous_ext_status & OCC_EXT_STAT_MEM_THROTTLE)) {
+		name = sensor_dev_attr_occ_mem_throttle.dev_attr.attr.name;
+		sysfs_notify(&occ->bus_dev->kobj, NULL, name);
+	}
+
+	if (occ->error && occ->error != occ->previous_error) {
+		name = dev_attr_occ_error.attr.name;
+		sysfs_notify(&occ->bus_dev->kobj, NULL, name);
+	}
+
+done:
+	occ->previous_error = occ->error;
+	occ->previous_ext_status = header->ext_status;
+	occ->previous_occs_present = header->occs_present;
+}
+
 /* only need to do this once at startup, as OCC won't change sensors on us */
 static void occ_parse_poll_response(struct occ *occ)
 {
diff --git a/drivers/hwmon/occ/common.h b/drivers/hwmon/occ/common.h
index cef2174..ffc809f 100644
--- a/drivers/hwmon/occ/common.h
+++ b/drivers/hwmon/occ/common.h
@@ -111,6 +111,11 @@ struct occ {
 	int error;
 	unsigned int error_count;	/* number of errors observed */
 	unsigned long last_safe;	/* time OCC entered safe state */
+
+	/* store previous poll state to compare; notify sysfs on change */
+	int previous_error;
+	u8 previous_ext_status;
+	u8 previous_occs_present;
 };
 
 int occ_setup(struct occ *occ, const char *name);
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH v3 11/12] hwmon (occ): Add error handling
From: Eddie James @ 2017-11-20 23:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-hwmon, devicetree, linux-doc, linux, jdelvare, corbet,
	mark.rutland, robh+dt, joel, eajames, Edward A. James
In-Reply-To: <1511222021-562-1-git-send-email-eajames@linux.vnet.ibm.com>

From: "Edward A. James" <eajames@us.ibm.com>

Add logic to detect a number of error scenarios on the OCC. Export any
errors through an additional non-hwmon device attribute. The error
counting and state verification are required by the OCC hardware
specification.

Signed-off-by: Edward A. James <eajames@us.ibm.com>
---
 drivers/hwmon/occ/common.c | 55 +++++++++++++++++++++++++++++++++++++++++++++-
 drivers/hwmon/occ/common.h |  4 ++++
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index 53e3592..7a0606d 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -18,6 +18,11 @@
 
 #include "common.h"
 
+#define OCC_ERROR_COUNT_THRESHOLD	2	/* OCC HW defined */
+
+#define OCC_STATE_SAFE			4
+#define OCC_SAFE_TIMEOUT		msecs_to_jiffies(60000) /* 1 min */
+
 #define OCC_UPDATE_FREQUENCY		msecs_to_jiffies(1000)
 
 #define OCC_TEMP_SENSOR_FAULT		0xFF
@@ -131,10 +136,22 @@ struct extended_sensor {
 	u8 data[6];
 } __packed;
 
+static ssize_t occ_show_error(struct device *dev,
+			      struct device_attribute *attr, char *buf)
+{
+	struct occ *occ = dev_get_drvdata(dev);
+
+	return snprintf(buf, PAGE_SIZE - 1, "%d\n", occ->error);
+}
+
+static DEVICE_ATTR(occ_error, 0444, occ_show_error, NULL);
+
 static int occ_poll(struct occ *occ)
 {
+	struct occ_poll_response_header *header;
 	u16 checksum = occ->poll_cmd_data + 1;
 	u8 cmd[8];
+	int rc;
 
 	/* big endian */
 	cmd[0] = 0;			/* sequence number */
@@ -147,7 +164,33 @@ static int occ_poll(struct occ *occ)
 	cmd[7] = 0;
 
 	/* mutex should already be locked if necessary */
-	return occ->send_cmd(occ, cmd);
+	rc = occ->send_cmd(occ, cmd);
+	if (rc) {
+		if (occ->error_count++ > OCC_ERROR_COUNT_THRESHOLD)
+			occ->error = rc;
+
+		return rc;
+	}
+
+	/* clear error since communication was successful */
+	occ->error_count = 0;
+	occ->error = 0;
+
+	/* check for safe state */
+	header = (struct occ_poll_response_header *)occ->resp.data;
+	if (header->occ_state == OCC_STATE_SAFE) {
+		if (occ->last_safe) {
+			if (time_after(jiffies,
+				       occ->last_safe + OCC_SAFE_TIMEOUT))
+				occ->error = -EHOSTDOWN;
+		} else {
+			occ->last_safe = jiffies;
+		}
+	} else {
+		occ->last_safe = 0;
+	}
+
+	return 0;
 }
 
 static int occ_set_user_power_cap(struct occ *occ, u16 user_power_cap)
@@ -176,6 +219,15 @@ static int occ_set_user_power_cap(struct occ *occ, u16 user_power_cap)
 
 	mutex_unlock(&occ->lock);
 
+	if (rc) {
+		if (occ->error_count++ > OCC_ERROR_COUNT_THRESHOLD)
+			occ->error = rc;
+	} else {
+		/* successful communication so clear the error */
+		occ->error_count = 0;
+		occ->error = 0;
+	}
+
 	return rc;
 }
 
@@ -1184,6 +1236,7 @@ static ssize_t occ_show_status(struct device *dev,
 	&sensor_dev_attr_occ_quick_drop.dev_attr.attr,
 	&sensor_dev_attr_occ_status.dev_attr.attr,
 	&sensor_dev_attr_occs_present.dev_attr.attr,
+	&dev_attr_occ_error.attr,
 	NULL
 };
 
diff --git a/drivers/hwmon/occ/common.h b/drivers/hwmon/occ/common.h
index dc9e06d..cef2174 100644
--- a/drivers/hwmon/occ/common.h
+++ b/drivers/hwmon/occ/common.h
@@ -107,6 +107,10 @@ struct occ {
 	struct occ_attribute *attrs;
 	struct attribute_group group;
 	const struct attribute_group *groups[2];
+
+	int error;
+	unsigned int error_count;	/* number of errors observed */
+	unsigned long last_safe;	/* time OCC entered safe state */
 };
 
 int occ_setup(struct occ *occ, const char *name);
-- 
1.8.3.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox