Devicetree
 help / color / mirror / Atom feed
* Re: [PATCH v3 5/6] bus: Add Baikal-T1 APB-bus driver
From: Arnd Bergmann @ 2020-05-28 12:17 UTC (permalink / raw)
  To: Serge Semin
  Cc: Thomas Bogendoerfer, Greg Kroah-Hartman, Serge Semin,
	Alexey Malahov, Paul Burton, Olof Johansson, Rob Herring,
	open list:BROADCOM NVRAM DRIVER, SoC Team, DTML,
	linux-kernel@vger.kernel.org
In-Reply-To: <20200526125928.17096-6-Sergey.Semin@baikalelectronics.ru>

On Tue, May 26, 2020 at 2:59 PM Serge Semin
<Sergey.Semin@baikalelectronics.ru> wrote:
>
> Baikal-T1 AXI-APB bridge is used to access the SoC subsystem CSRs.
> IO requests are routed to this bus by means of the DW AMBA 3 AXI
> Interconnect. In case if an attempted APB transaction stays with no
> response for a pre-defined time an interrupt occurs and the bus gets
> freed for a next operation. This driver provides the interrupt handler
> to detect the erroneous address, prints an error message about the
> address fault, updates an errors counter. The counter and the APB-bus
> operations timeout can be accessed via corresponding sysfs nodes.
> A dedicated sysfs-node can be also used to artificially cause the
> bus errors described above.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
> Cc: Paul Burton <paulburton@kernel.org>
> Cc: Olof Johansson <olof@lixom.net>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: linux-mips@vger.kernel.org
> Cc: soc@kernel.org
> Cc: devicetree@vger.kernel.org
>
> ---

Applied with this fixup:

--- a/drivers/bus/bt1-apb.c
+++ b/drivers/bus/bt1-apb.c
@@ -16,6 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/nmi.h>
+#include <linux/of.h>
 #include <linux/regmap.h>
 #include <linux/clk.h>
 #include <linux/reset.h>
@@ -309,13 +310,13 @@ static ssize_t timeout_store(struct device *dev,
 }
 static DEVICE_ATTR_RW(timeout);

-static int inject_error_show(struct device *dev, struct device_attribute *attr,
+static ssize_t inject_error_show(struct device *dev, struct
device_attribute *attr,
                             char *buf)
 {
        return scnprintf(buf, PAGE_SIZE, "Error injection: nodev irq\n");
 }

-static int inject_error_store(struct device *dev,
+static ssize_t inject_error_store(struct device *dev,
                              struct device_attribute *attr,
                              const char *data, size_t count)
 {

^ permalink raw reply

* [PATCH v2 3/4] dt-bindings: power: Add BQ28z610 compatible
From: Dan Murphy @ 2020-05-28 12:21 UTC (permalink / raw)
  To: sre, afd, pali; +Cc: linux-pm, robh, linux-kernel, devicetree, Dan Murphy
In-Reply-To: <20200528122147.6171-1-dmurphy@ti.com>

Add the Texas Instruments bq28z610 battery monitor to the bq27xxx
binding.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 Documentation/devicetree/bindings/power/supply/bq27xxx.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml b/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
index 51cb1f685dcf..d74c99c21604 100644
--- a/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
+++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
@@ -50,6 +50,7 @@ properties:
       - ti,bq27441
       - ti,bq27621
       - ti,bq27561
+      - ti,bq28z610
 
   reg:
     maxItems: 1
-- 
2.26.2


^ permalink raw reply related

* [PATCH v2 1/4] dt-bindings: power: Add BQ27561 compatible
From: Dan Murphy @ 2020-05-28 12:21 UTC (permalink / raw)
  To: sre, afd, pali; +Cc: linux-pm, robh, linux-kernel, devicetree, Dan Murphy

Add the Texas Instruments bq27561 battery monitor to the bq27xxx
binding.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 Documentation/devicetree/bindings/power/supply/bq27xxx.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml b/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
index 03d1020a2e47..51cb1f685dcf 100644
--- a/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
+++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
@@ -49,6 +49,7 @@ properties:
       - ti,bq27426
       - ti,bq27441
       - ti,bq27621
+      - ti,bq27561
 
   reg:
     maxItems: 1
-- 
2.26.2


^ permalink raw reply related

* [PATCH v2 2/4] power: supply: bq27xxx_battery: Add the BQ27561 Battery monitor
From: Dan Murphy @ 2020-05-28 12:21 UTC (permalink / raw)
  To: sre, afd, pali; +Cc: linux-pm, robh, linux-kernel, devicetree, Dan Murphy
In-Reply-To: <20200528122147.6171-1-dmurphy@ti.com>

Add the Texas Instruments BQ27561 battery monitor.  The register address
map is laid out the same as compared to other devices within the file.
The battery status register has differing bits to determine if the
battery is full, discharging or dead.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 68 +++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 +
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 942c92127b6d..466bbc549799 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -43,6 +43,7 @@
  * http://www.ti.com/product/bq27411-g1
  * http://www.ti.com/product/bq27441-g1
  * http://www.ti.com/product/bq27621-g1
+ * https://www.ti.com/lit/gpn/bq27z561
  */
 
 #include <linux/device.h>
@@ -79,6 +80,11 @@
 #define BQ27000_FLAG_FC		BIT(5)
 #define BQ27000_FLAG_CHGS	BIT(7) /* Charge state flag */
 
+/* BQ27561 has different layout for Flags register */
+#define BQ27561_FLAG_FDC	BIT(4) /* Battery fully discharged */
+#define BQ27561_FLAG_FC		BIT(5) /* Battery fully charged */
+#define BQ27561_FLAG_DIS_CH	BIT(6) /* Battery is discharging */
+
 /* control register params */
 #define BQ27XXX_SEALED			0x20
 #define BQ27XXX_SET_CFGUPDATE		0x13
@@ -431,12 +437,32 @@ static u8
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x18,
 		BQ27XXX_DM_REG_ROWS,
-	};
+	},
 #define bq27411_regs bq27421_regs
 #define bq27425_regs bq27421_regs
 #define bq27426_regs bq27421_regs
 #define bq27441_regs bq27421_regs
 #define bq27621_regs bq27421_regs
+	bq27561_regs[BQ27XXX_REG_MAX] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x22,
+		BQ27XXX_DM_REG_ROWS,
+	};
 
 static enum power_supply_property bq27000_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
@@ -672,6 +698,25 @@ static enum power_supply_property bq27421_props[] = {
 #define bq27441_props bq27421_props
 #define bq27621_props bq27421_props
 
+static enum power_supply_property bq27561_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 struct bq27xxx_dm_reg {
 	u8 subclass_id;
 	u8 offset;
@@ -767,11 +812,14 @@ static struct bq27xxx_dm_reg bq27621_dm_regs[] = {
 #define bq27621_dm_regs 0
 #endif
 
+#define bq27561_dm_regs 0
+
 #define BQ27XXX_O_ZERO	0x00000001
 #define BQ27XXX_O_OTDC	0x00000002 /* has OTC/OTD overtemperature flags */
 #define BQ27XXX_O_UTOT  0x00000004 /* has OT overtemperature flag */
 #define BQ27XXX_O_CFGUP	0x00000008
 #define BQ27XXX_O_RAM	0x00000010
+#define BQ27561_O_BITS	0x00000020
 
 #define BQ27XXX_DATA(ref, key, opt) {		\
 	.opts = (opt),				\
@@ -816,6 +864,7 @@ static struct {
 	[BQ27426]   = BQ27XXX_DATA(bq27426,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
 	[BQ27441]   = BQ27XXX_DATA(bq27441,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
 	[BQ27621]   = BQ27XXX_DATA(bq27621,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
+	[BQ27561]   = BQ27XXX_DATA(bq27561,   0         , BQ27561_O_BITS),
 };
 
 static DEFINE_MUTEX(bq27xxx_list_lock);
@@ -1551,6 +1600,8 @@ static bool bq27xxx_battery_dead(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->opts & BQ27XXX_O_ZERO)
 		return flags & (BQ27000_FLAG_EDV1 | BQ27000_FLAG_EDVF);
+	else if (di->opts & BQ27561_O_BITS)
+		return flags & BQ27561_FLAG_FDC;
 	else
 		return flags & (BQ27XXX_FLAG_SOC1 | BQ27XXX_FLAG_SOCF);
 }
@@ -1595,6 +1646,7 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di)
 				cache.time_to_empty_avg = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTECP);
 			if (di->regs[BQ27XXX_REG_TTF] != INVALID_REG_ADDR)
 				cache.time_to_full = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTF);
+
 			cache.charge_full = bq27xxx_battery_read_fcc(di);
 			cache.capacity = bq27xxx_battery_read_soc(di);
 			if (di->regs[BQ27XXX_REG_AE] != INVALID_REG_ADDR)
@@ -1682,6 +1734,13 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di,
 			status = POWER_SUPPLY_STATUS_NOT_CHARGING;
 		else
 			status = POWER_SUPPLY_STATUS_DISCHARGING;
+	} else if (di->opts & BQ27561_O_BITS) {
+		if (di->cache.flags & BQ27561_FLAG_FC)
+			status = POWER_SUPPLY_STATUS_FULL;
+		else if (di->cache.flags & BQ27561_FLAG_DIS_CH)
+			status = POWER_SUPPLY_STATUS_DISCHARGING;
+		else
+			status = POWER_SUPPLY_STATUS_CHARGING;
 	} else {
 		if (di->cache.flags & BQ27XXX_FLAG_FC)
 			status = POWER_SUPPLY_STATUS_FULL;
@@ -1710,6 +1769,13 @@ static int bq27xxx_battery_capacity_level(struct bq27xxx_device_info *di,
 			level = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL;
 		else
 			level = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL;
+	} else if (di->opts & BQ27561_O_BITS) {
+		if (di->cache.flags & BQ27561_FLAG_FC)
+			level = POWER_SUPPLY_CAPACITY_LEVEL_FULL;
+		else if (di->cache.flags & BQ27561_FLAG_DIS_CH)
+			level = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL;
+		else
+			level = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL;
 	} else {
 		if (di->cache.flags & BQ27XXX_FLAG_FC)
 			level = POWER_SUPPLY_CAPACITY_LEVEL_FULL;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 2677c38a8a42..d0d55e0959d5 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -253,6 +253,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27426", BQ27426 },
 	{ "bq27441", BQ27441 },
 	{ "bq27621", BQ27621 },
+	{ "bq27561", BQ27561 },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, bq27xxx_i2c_id_table);
@@ -286,6 +287,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27426" },
 	{ .compatible = "ti,bq27441" },
 	{ .compatible = "ti,bq27621" },
+	{ .compatible = "ti,bq27561" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, bq27xxx_battery_i2c_of_match_table);
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 507c5e214c42..4a319950ea22 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -30,6 +30,7 @@ enum bq27xxx_chip {
 	BQ27426,
 	BQ27441,
 	BQ27621,
+	BQ27561,
 };
 
 struct bq27xxx_device_info;
-- 
2.26.2


^ permalink raw reply related

* [PATCH v2 4/4] power: supply: bq27xxx_battery: Add the BQ28z610 Battery monitor
From: Dan Murphy @ 2020-05-28 12:21 UTC (permalink / raw)
  To: sre, afd, pali; +Cc: linux-pm, robh, linux-kernel, devicetree, Dan Murphy
In-Reply-To: <20200528122147.6171-1-dmurphy@ti.com>

Add the Texas Instruments BQ28z610 battery monitor.
The register address map is laid out the same as compared to other
devices within the file.

The battery status register bits are similar to the BQ27561 but they
are different compared to other fuel gauge devices within this file.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 42 ++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 466bbc549799..07b7d01a720d 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -44,6 +44,7 @@
  * http://www.ti.com/product/bq27441-g1
  * http://www.ti.com/product/bq27621-g1
  * https://www.ti.com/lit/gpn/bq27z561
+ * https://www.ti.com/lit/gpn/bq28z610
  */
 
 #include <linux/device.h>
@@ -462,6 +463,26 @@ static u8
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x22,
 		BQ27XXX_DM_REG_ROWS,
+	},
+	bq28z610_regs[BQ27XXX_REG_MAX] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x22,
+		BQ27XXX_DM_REG_ROWS,
 	};
 
 static enum power_supply_property bq27000_props[] = {
@@ -717,6 +738,25 @@ static enum power_supply_property bq27561_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq28z610_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 struct bq27xxx_dm_reg {
 	u8 subclass_id;
 	u8 offset;
@@ -813,6 +853,7 @@ static struct bq27xxx_dm_reg bq27621_dm_regs[] = {
 #endif
 
 #define bq27561_dm_regs 0
+#define bq28z610_dm_regs 0
 
 #define BQ27XXX_O_ZERO	0x00000001
 #define BQ27XXX_O_OTDC	0x00000002 /* has OTC/OTD overtemperature flags */
@@ -865,6 +906,7 @@ static struct {
 	[BQ27441]   = BQ27XXX_DATA(bq27441,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
 	[BQ27621]   = BQ27XXX_DATA(bq27621,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
 	[BQ27561]   = BQ27XXX_DATA(bq27561,   0         , BQ27561_O_BITS),
+	[BQ28Z610]  = BQ27XXX_DATA(bq28z610,  0         , BQ27561_O_BITS),
 };
 
 static DEFINE_MUTEX(bq27xxx_list_lock);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index d0d55e0959d5..12cf0c619d6d 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -254,6 +254,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27441", BQ27441 },
 	{ "bq27621", BQ27621 },
 	{ "bq27561", BQ27561 },
+	{ "bq28z610", BQ28Z610 },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, bq27xxx_i2c_id_table);
@@ -288,6 +289,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27441" },
 	{ .compatible = "ti,bq27621" },
 	{ .compatible = "ti,bq27561" },
+	{ .compatible = "ti,bq28z610" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, bq27xxx_battery_i2c_of_match_table);
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 4a319950ea22..50f6230f42c4 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -31,6 +31,7 @@ enum bq27xxx_chip {
 	BQ27441,
 	BQ27621,
 	BQ27561,
+	BQ28Z610,
 };
 
 struct bq27xxx_device_info;
-- 
2.26.2


^ permalink raw reply related

* Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver
From: Serge Semin @ 2020-05-28 12:27 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Serge Semin, Andy Shevchenko, Thomas Bogendoerfer,
	Greg Kroah-Hartman, Alexey Malahov, Paul Burton, Olof Johansson,
	Rob Herring, linux-mips@vger.kernel.org, soc@kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <CAK8P3a2WMqTRitUU86hSV3HSK12-hF_RDoFg51PRGTLmXwznvA@mail.gmail.com>

On Thu, May 28, 2020 at 02:14:58PM +0200, Arnd Bergmann wrote:
> On Thu, May 28, 2020 at 12:01 AM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Tuesday, May 26, 2020, Serge Semin <Sergey.Semin@baikalelectronics.ru> wrote:
> >>
> >> AXI3-bus is the main communication bus connecting all high-speed
> >> peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1
> >> SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI
> >> Interconnect (so called AXI Main Interconnect) routing IO requests from
> >> one SoC block to another. This driver provides a way to detect any bus
> >> protocol errors and device not responding situations by means of an
> >> embedded on top of the interconnect errors handler block (EHB). AXI
> >> Interconnect QoS arbitration tuning is currently unsupported.
> >> The bus doesn't provide a way to detect the interconnected devices,
> >> so they are supposed to be statically defined like by means of the
> >> simple-bus sub-nodes.
> >
> >
> >
> > Few comments in case if you need a new version. Main point is about sysfs_streq().
> 
> I've applied the patch now and folded in fixes for the build warnings and
> errors pointed out by the test robot, but I did not include the changes you
> suggested.

Are you saying that the build-errors and warnings have already been fixed by
you, right? If so could you please give me a link to the repo with those
commits, so I'd work with the up-to-date code?

> 
> Serge, could you send a follow-up patch to address those?

Ok.

-Sergey

> 
>      Arnd

^ permalink raw reply

* Re: [PATCH v5 4/6] pinctrl: mediatek: add pinctrl support for MT6779 SoC
From: Hanks Chen @ 2020-05-28 12:34 UTC (permalink / raw)
  To: Sean Wang
  Cc: Mark Rutland, devicetree, wsd_upstream, Andy Teng, Linus Walleij,
	lkml, Rob Herring, moderated list:ARM/Mediatek SoC support,
	Matthias Brugger, Mars Cheng
In-Reply-To: <CAGp9Lzrci=qhU6QXPfGg=-dGtKNq1Xn-rhYWvPp-8Wj6v6oJwA@mail.gmail.com>

On Thu, 2020-04-02 at 14:46 -0700, Sean Wang wrote:
> Hi Hanks,
> 
> On Wed, Mar 25, 2020 at 2:31 AM Hanks Chen <hanks.chen@mediatek.com> wrote:
> >
> > This adds MT6779 pinctrl driver based on MediaTek pinctrl-paris core.
> >
> 
> We can add some useful help text about MT6779 pinctrl, especially
> about specific parts like virtual gpio and its attributes
> Then Acked-by: Sean Wang <sean.wang@kernel.org>
> 
Got it, I'll add it in next version.
Thanks for the advices.

> > Signed-off-by: Hanks Chen <hanks.chen@mediatek.com>
> > Signed-off-by: Mars Cheng <mars.cheng@mediatek.com>
> > Signed-off-by: Andy Teng <andy.teng@mediatek.com>
> > ---
> >  drivers/pinctrl/mediatek/Kconfig              |    7 +
> >  drivers/pinctrl/mediatek/Makefile             |    1 +
> >  drivers/pinctrl/mediatek/pinctrl-mt6779.c     |  775 +++++++++
> >  drivers/pinctrl/mediatek/pinctrl-mtk-mt6779.h | 2085 +++++++++++++++++++++++++
> >  4 files changed, 2868 insertions(+)
> >  create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt6779.c
> >  create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt6779.h
> >
> > diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
> > index 701f9af..f628d01 100644
> > --- a/drivers/pinctrl/mediatek/Kconfig
> > +++ b/drivers/pinctrl/mediatek/Kconfig
> > @@ -86,6 +86,13 @@ config PINCTRL_MT6765
> >         default ARM64 && ARCH_MEDIATEK
> >         select PINCTRL_MTK_PARIS
> >
> > +config PINCTRL_MT6779
> > +       bool "Mediatek MT6779 pin control"
> > +       depends on OF
> > +       depends on ARM64 || COMPILE_TEST
> > +       default ARM64 && ARCH_MEDIATEK
> > +       select PINCTRL_MTK_PARIS
> > +
> >  config PINCTRL_MT6797
> >         bool "Mediatek MT6797 pin control"
> >         depends on OF
> > diff --git a/drivers/pinctrl/mediatek/Makefile b/drivers/pinctrl/mediatek/Makefile
> > index a74325a..59c1c60 100644
> > --- a/drivers/pinctrl/mediatek/Makefile
> > +++ b/drivers/pinctrl/mediatek/Makefile
> > @@ -11,6 +11,7 @@ obj-$(CONFIG_PINCTRL_MT2712)  += pinctrl-mt2712.o
> >  obj-$(CONFIG_PINCTRL_MT8135)   += pinctrl-mt8135.o
> >  obj-$(CONFIG_PINCTRL_MT8127)   += pinctrl-mt8127.o
> >  obj-$(CONFIG_PINCTRL_MT6765)   += pinctrl-mt6765.o
> > +obj-$(CONFIG_PINCTRL_MT6779)   += pinctrl-mt6779.o
> >  obj-$(CONFIG_PINCTRL_MT6797)   += pinctrl-mt6797.o
> >  obj-$(CONFIG_PINCTRL_MT7622)   += pinctrl-mt7622.o
> >  obj-$(CONFIG_PINCTRL_MT7623)   += pinctrl-mt7623.o
> > diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6779.c b/drivers/pinctrl/mediatek/pinctrl-mt6779.c
> > new file mode 100644
> > index 0000000..145bf22
> > --- /dev/null
> > +++ b/drivers/pinctrl/mediatek/pinctrl-mt6779.c
> > @@ -0,0 +1,775 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2019 MediaTek Inc.
> > + * Author: Andy Teng <andy.teng@mediatek.com>
> > + *
> > + */
> > +
> > +#include "pinctrl-mtk-mt6779.h"
> > +#include "pinctrl-paris.h"
> > +
> > +/* MT6779 have multiple bases to program pin configuration listed as the below:
> > + * gpio:0x10005000,     iocfg_rm:0x11C20000, iocfg_br:0x11D10000,
> > + * iocfg_lm:0x11E20000, iocfg_lb:0x11E70000, iocfg_rt:0x11EA0000,
> > + * iocfg_lt:0x11F20000, iocfg_tl:0x11F30000
> > + * _i_based could be used to indicate what base the pin should be mapped into.
> > + */
> > +
> > +#define PIN_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \
> > +       PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, \
> > +                      32, 0)
> > +
> 
> <snip>
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek


^ permalink raw reply

* Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver
From: Serge Semin @ 2020-05-28 12:37 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Serge Semin, Andy Shevchenko, Thomas Bogendoerfer,
	Greg Kroah-Hartman, Alexey Malahov, Paul Burton, Olof Johansson,
	Rob Herring, linux-mips@vger.kernel.org, soc@kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <CAK8P3a2WMqTRitUU86hSV3HSK12-hF_RDoFg51PRGTLmXwznvA@mail.gmail.com>

On Thu, May 28, 2020 at 02:14:58PM +0200, Arnd Bergmann wrote:
> On Thu, May 28, 2020 at 12:01 AM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Tuesday, May 26, 2020, Serge Semin <Sergey.Semin@baikalelectronics.ru> wrote:
> >>
> >> AXI3-bus is the main communication bus connecting all high-speed
> >> peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1
> >> SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI
> >> Interconnect (so called AXI Main Interconnect) routing IO requests from
> >> one SoC block to another. This driver provides a way to detect any bus
> >> protocol errors and device not responding situations by means of an
> >> embedded on top of the interconnect errors handler block (EHB). AXI
> >> Interconnect QoS arbitration tuning is currently unsupported.
> >> The bus doesn't provide a way to detect the interconnected devices,
> >> so they are supposed to be statically defined like by means of the
> >> simple-bus sub-nodes.
> >
> >
> >
> > Few comments in case if you need a new version. Main point is about sysfs_streq().
> 
> I've applied the patch now and folded in fixes for the build warnings and
> errors pointed out by the test robot, but I did not include the changes you
> suggested.

On the other hand if you haven't pushed the patches to the public repo yet,
I could just resend the series. So have you?

-Sergey

> 
> Serge, could you send a follow-up patch to address those?


> 
>      Arnd

^ permalink raw reply

* Re: [PATCH] of/fdt: Remove redundant kbasename function call
From: Qi Zheng @ 2020-05-28 12:37 UTC (permalink / raw)
  To: Rob Herring; +Cc: frowand.list, devicetree, linux-kernel
In-Reply-To: <20200527182708.GA2458626@bogus>

Hi Rob,

Thanks for your review.
I will send you a patch of v2 later.

Yours,
Qi Zheng

On 2020/5/28 上午2:27, Rob Herring wrote:
> On Tue, May 12, 2020 at 11:49:09PM +0800, Qi Zheng wrote:
>> For version 1 to 3 of the device tree, this is the node full
>> path as a zero terminated string, starting with "/". The
>> following equation will not hold, since the node name has
>> been processed in the fdt_get_name().
>>
>> 	*pathp == '/'
>>
>> For version 16 and later, this is the node unit name only
>> (or an empty string for the root node). So the above
>> equation will still not hold.
>>
>> So the kbasename() is redundant, just remove it.
> 
> There's 2 occurrences of this. Can you remove the other one too.
> 
> Rob
> 

^ permalink raw reply

* Re: [PATCH 4/6] serdev: ngsm: Add generic serdev-ngsm driver
From: Johan Hovold @ 2020-05-28 12:43 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Greg Kroah-Hartman, Johan Hovold, Rob Herring, Alan Cox,
	Lee Jones, Jiri Slaby, Merlijn Wajer, Pavel Machek, Peter Hurley,
	Sebastian Reichel, linux-serial, devicetree, linux-kernel,
	linux-omap
In-Reply-To: <20200512214713.40501-5-tony@atomide.com>

On Tue, May 12, 2020 at 02:47:11PM -0700, Tony Lindgren wrote:
> We can have a generic serdev-ngsm driver bring up the TS 27.010 line
> discipline on the selected serial ports based on device tree data.
> 
> And we can now do standard Linux device driver for the dedicated
> TS 27.010 channels for devices like GNSS and ALSA found on modems.
> 
> Tested-by: Pavel Machek <pavel@ucw.cz>
> Reviewed-by: Pavel Machek <pavel@ucw.cz>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/tty/serdev/Kconfig       |  10 +
>  drivers/tty/serdev/Makefile      |   1 +
>  drivers/tty/serdev/serdev-ngsm.c | 449 +++++++++++++++++++++++++++++++

The n in n_gsm indicates that its a line discipline so doesn't really
make sense here.

How about just calling the driver something like gsm0710.c, gsmmux.c, or
gsm_serdev.c if you really want to include the interface in the name?

As it's a tty driver I think it should live in drivers/tty (tty/serdev
is for serdev core and serdev controllers).

And I think this one should be merged with the patch adding functions to
n_gsm that you depend on (and there shouldn't be a need to export those
functions globally).

>  include/linux/serdev-gsm.h       |  11 +
>  4 files changed, 471 insertions(+)
>  create mode 100644 drivers/tty/serdev/serdev-ngsm.c
> 
> diff --git a/drivers/tty/serdev/Kconfig b/drivers/tty/serdev/Kconfig
> --- a/drivers/tty/serdev/Kconfig
> +++ b/drivers/tty/serdev/Kconfig
> @@ -22,4 +22,14 @@ config SERIAL_DEV_CTRL_TTYPORT
>  	depends on SERIAL_DEV_BUS != m
>  	default y
>  
> +config SERIAL_DEV_N_GSM
> +	tristate "Serial device TS 27.010 support"
> +	depends on N_GSM
> +	depends on SERIAL_DEV_CTRL_TTYPORT
> +	help
> +	  Select this if you want to use the TS 27.010 with a serial port with
> +	  devices such as modems and GNSS devices.
> +
> +	  If unsure, say N.
> +
>  endif
> diff --git a/drivers/tty/serdev/Makefile b/drivers/tty/serdev/Makefile
> --- a/drivers/tty/serdev/Makefile
> +++ b/drivers/tty/serdev/Makefile
> @@ -4,3 +4,4 @@ serdev-objs := core.o
>  obj-$(CONFIG_SERIAL_DEV_BUS) += serdev.o
>  
>  obj-$(CONFIG_SERIAL_DEV_CTRL_TTYPORT) += serdev-ttyport.o
> +obj-$(CONFIG_SERIAL_DEV_N_GSM) += serdev-ngsm.o
> diff --git a/drivers/tty/serdev/serdev-ngsm.c b/drivers/tty/serdev/serdev-ngsm.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/tty/serdev/serdev-ngsm.c
> @@ -0,0 +1,449 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Generic TS 27.010 serial line discipline serdev driver
> + * Copyright (C) 2020 Tony Lindgren <tony@atomide.com>
> + */
> +
> +#include <linux/device.h>
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/serdev.h>
> +#include <linux/serdev-gsm.h>
> +
> +#include <linux/phy/phy.h>
> +
> +#include <uapi/linux/gsmmux.h>
> +
> +#define TS27010_C_N2		3	/* TS 27.010 default value */
> +#define TS27010_RESERVED_DLCI	(BIT_ULL(63) | BIT_ULL(62) | BIT_ULL(0))
> +
> +struct serdev_ngsm_cfg {
> +	const struct gsm_config *gsm;
> +	unsigned int init_retry_quirk:1;
> +	unsigned int needs_usb_phy:1;
> +	unsigned int aggressive_pm:1;
> +	int (*init)(struct serdev_device *serdev); /* for device quirks */
> +};
> +
> +struct serdev_ngsm {
> +	struct device *dev;
> +	struct gsm_serdev gsd;
> +	struct phy *phy;
> +	u32 baudrate;
> +	DECLARE_BITMAP(ttymask, 64);
> +	const struct serdev_ngsm_cfg *cfg;
> +};
> +
> +static int serdev_ngsm_tty_init(struct serdev_ngsm *ddata)
> +{
> +	struct gsm_serdev *gsd = &ddata->gsd;
> +	struct device *dev = ddata->dev;
> +	int bit, err;
> +
> +	for_each_set_bit(bit, ddata->ttymask, 64) {
> +		if (BIT_ULL(bit) & TS27010_RESERVED_DLCI)
> +			continue;
> +
> +		err = gsm_serdev_register_tty_port(gsd, bit);
> +		if (err) {
> +			dev_err(dev, "ngsm tty init failed for dlci%i: %i\n",
> +				bit, err);
> +			return err;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static void serdev_ngsm_tty_exit(struct serdev_ngsm *ddata)
> +{
> +	struct gsm_serdev *gsd = &ddata->gsd;
> +	int bit;
> +
> +	for_each_set_bit(bit, ddata->ttymask, 64) {
> +		if (BIT_ULL(bit) & TS27010_RESERVED_DLCI)
> +			continue;
> +
> +		gsm_serdev_unregister_tty_port(gsd, bit);
> +	}
> +}
> +
> +/*
> + * Note that we rely on gsm_serdev_register_dlci() locking for
> + * reserved channels that serdev_ngsm_tty_init() and consumer
> + * drivers may have already reserved.
> + */
> +int serdev_ngsm_register_dlci(struct device *dev,
> +			      struct gsm_serdev_dlci *dlci)
> +{
> +	struct serdev_ngsm *ddata = gsm_serdev_get_drvdata(dev);
> +	struct gsm_serdev *gsd = &ddata->gsd;
> +	int err;
> +
> +	err = gsm_serdev_register_dlci(gsd, dlci);
> +	if (err)
> +		return err;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(serdev_ngsm_register_dlci);
> +
> +void serdev_ngsm_unregister_dlci(struct device *dev,
> +				 struct gsm_serdev_dlci *dlci)
> +{
> +	struct serdev_ngsm *ddata = gsm_serdev_get_drvdata(dev);
> +	struct gsm_serdev *gsd = &ddata->gsd;
> +
> +	gsm_serdev_unregister_dlci(gsd, dlci);
> +}
> +EXPORT_SYMBOL_GPL(serdev_ngsm_unregister_dlci);
> +
> +int serdev_ngsm_write(struct device *dev, struct gsm_serdev_dlci *ops,
> +		      const u8 *buf, int len)
> +{
> +	struct serdev_ngsm *ddata = gsm_serdev_get_drvdata(dev);
> +	struct gsm_serdev *gsd = &ddata->gsd;
> +	int ret;
> +
> +	ret = pm_runtime_get_sync(dev);
> +	if ((ret != -EINPROGRESS) && ret < 0) {
> +		pm_runtime_put_noidle(dev);
> +
> +		return ret;
> +	}
> +
> +	ret = gsm_serdev_write(gsd, ops, buf, len);
> +
> +	pm_runtime_mark_last_busy(dev);
> +	pm_runtime_put_autosuspend(dev);
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(serdev_ngsm_write);

These three shouldn't be needed with proper serdev child devices.

> +
> +static int serdev_ngsm_set_config(struct device *dev)
> +{
> +	struct serdev_ngsm *ddata = gsm_serdev_get_drvdata(dev);
> +	struct gsm_serdev *gsd = &ddata->gsd;
> +	struct gsm_config c;
> +	int err, n2;
> +
> +	memcpy(&c, ddata->cfg->gsm, sizeof(c));
> +
> +	if (ddata->cfg->init_retry_quirk) {
> +		n2 = c.n2;
> +		c.n2 *= 10;
> +		err = gsm_serdev_set_config(gsd, &c);
> +		if (err)
> +			return err;
> +
> +		msleep(5000);
> +		c.n2 = n2;
> +	}
> +
> +	err = gsm_serdev_set_config(gsd, &c);
> +	if (err)
> +		return err;
> +
> +	return 0;
> +}
> +
> +static int serdev_ngsm_output(struct gsm_serdev *gsd, u8 *data, int len)
> +{
> +	struct serdev_device *serdev = gsd->serdev;
> +	struct device *dev = &serdev->dev;
> +	int err;
> +
> +	err = pm_runtime_get(dev);
> +	if ((err != -EINPROGRESS) && err < 0) {
> +		pm_runtime_put_noidle(dev);
> +
> +		return err;
> +	}
> +
> +	serdev_device_write_buf(serdev, data, len);
> +
> +	pm_runtime_put(dev);
> +
> +	return len;
> +}
> +
> +static int serdev_ngsm_runtime_suspend(struct device *dev)
> +{
> +	struct serdev_ngsm *ddata = gsm_serdev_get_drvdata(dev);
> +	int err;
> +
> +	if (ddata->cfg->needs_usb_phy) {
> +		err = phy_pm_runtime_put(ddata->phy);
> +		if (err < 0) {
> +			dev_warn(dev, "%s: phy_pm_runtime_put: %i\n",
> +				 __func__, err);

No need to include __func__ here; I'd spell out what went wrong instead
of relying on a function name (e.g. "failed to suspend phy: %d\n");

> +
> +			return err;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static int serdev_ngsm_runtime_resume(struct device *dev)
> +{
> +	struct serdev_ngsm *ddata = gsm_serdev_get_drvdata(dev);
> +	int err;
> +
> +	if (ddata->cfg->needs_usb_phy) {
> +		err = phy_pm_runtime_get_sync(ddata->phy);
> +		if (err < 0) {
> +			dev_warn(dev, "%s: phy_pm_runtime_get: %i\n",
> +				 __func__, err);
> +
> +			return err;
> +		}
> +	}
> +
> +	gsm_serdev_data_kick(&ddata->gsd);
> +
> +	return 0;
> +}
> +
> +static const struct dev_pm_ops serdev_ngsm_pm_ops = {
> +	SET_RUNTIME_PM_OPS(serdev_ngsm_runtime_suspend,
> +			   serdev_ngsm_runtime_resume,
> +			   NULL)
> +};
> +
> +/*
> + * At least Motorola MDM6600 devices have GPIO wake pins shared between the
> + * USB PHY and the TS 27.010 interface. So for PM, we need to use the calls
> + * for phy_pm_runtime. Otherwise the modem won't respond to anything on the
> + * UART and will never idle either.
> + */
> +static int serdev_ngsm_phy_init(struct device *dev)
> +{
> +	struct serdev_ngsm *ddata = gsm_serdev_get_drvdata(dev);
> +	int err;
> +
> +	if (!ddata->cfg->needs_usb_phy)
> +		return 0;
> +
> +	ddata->phy = devm_of_phy_get(dev, dev->of_node, NULL);
> +	if (IS_ERR(ddata->phy)) {
> +		err = PTR_ERR(ddata->phy);
> +		if (err != -EPROBE_DEFER)
> +			dev_err(dev, "%s: phy error: %i\n", __func__, err);

"failed to lookup phy: %d"?

> +
> +		return err;
> +	}
> +
> +	return 0;
> +}
> +
> +/*
> + * Configure SoC 8250 device for 700 ms autosuspend delay, Values around 600 ms
> + * and shorter cause spurious wake-up events at least on Droid 4. Also keep the
> + * SoC 8250 device active during use because of the OOB GPIO wake-up signaling
> + * shared with USB PHY.
> + */
> +static int motmdm_init(struct serdev_device *serdev)
> +{
> +	pm_runtime_set_autosuspend_delay(serdev->ctrl->dev.parent, 700);
> +	pm_suspend_ignore_children(&serdev->ctrl->dev, false);
> +
> +	return 0;
> +}
> +
> +static const struct gsm_config adaption1 = {
> +	.i = 1,			/* 1 = UIH, 2 = UI */
> +	.initiator = 1,
> +	.encapsulation = 0,	/* basic mode */
> +	.adaption = 1,
> +	.mru = 1024,		/* from android TS 27010 driver */
> +	.mtu = 1024,		/* from android TS 27010 driver */
> +	.t1 = 10,		/* ack timer, default 10ms */
> +	.t2 = 34,		/* response timer, default 34 */
> +	.n2 = 3,		/* retransmissions, default 3 */
> +};
> +
> +static const struct serdev_ngsm_cfg adaption1_cfg = {
> +	.gsm = &adaption1,
> +};
> +
> +static const struct serdev_ngsm_cfg motmdm_cfg = {
> +	.gsm = &adaption1,
> +	.init_retry_quirk = 1,
> +	.needs_usb_phy = 1,
> +	.aggressive_pm = 1,
> +	.init = motmdm_init,
> +};
> +
> +static const struct of_device_id serdev_ngsm_id_table[] = {
> +	{
> +		.compatible = "etsi,3gpp-ts27010-adaption1",
> +		.data = &adaption1_cfg,

Hmm. Yeah, how should we deal with the mux configuration. There's a
bunch of parameters, some of which can be negotiated.

Perhaps not something that needs to be solved now, but it should be
given some though before partially encoding the configuration in the
compatible strings, I'd say.

This is also not generally useful until there's a way to actually setup
the mux, right (i.e. AT+CMUX)?

> +	},
> +	{
> +		.compatible = "motorola,mapphone-mdm6600-serial",
> +		.data = &motmdm_cfg,
> +	},
> +	{ /* sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(of, serdev_ngsm_id_table);
> +
> +static int serdev_ngsm_probe(struct serdev_device *serdev)
> +{
> +	struct device *dev = &serdev->dev;
> +	const struct of_device_id *match;
> +	struct gsm_serdev *gsd;
> +	struct serdev_ngsm *ddata;
> +	u64 ttymask;
> +	int err;
> +
> +	match = of_match_device(of_match_ptr(serdev_ngsm_id_table), dev);
> +	if (!match)
> +		return -ENODEV;
> +
> +	ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
> +	if (!ddata)
> +		return -ENOMEM;
> +
> +	ddata->dev = dev;
> +	ddata->cfg = match->data;
> +
> +	gsd = &ddata->gsd;
> +	gsd->serdev = serdev;
> +	gsd->output = serdev_ngsm_output;
> +	serdev_device_set_drvdata(serdev, gsd);
> +	gsm_serdev_set_drvdata(dev, ddata);
> +
> +	err = serdev_ngsm_phy_init(dev);
> +	if (err)
> +		return err;
> +
> +	err = of_property_read_u64(dev->of_node, "ttymask", &ttymask);
> +	if (err) {
> +		dev_err(dev, "invalid or missing ttymask: %i\n", err);
> +
> +		return err;
> +	}
> +
> +	bitmap_from_u64(ddata->ttymask, ttymask);
> +
> +	pm_runtime_set_autosuspend_delay(dev, 200);
> +	pm_runtime_use_autosuspend(dev);
> +	pm_runtime_enable(dev);
> +	err = pm_runtime_get_sync(dev);
> +	if (err < 0) {
> +		pm_runtime_put_noidle(dev);
> +

pm_runtime_disable()? dont_use_autosuspend()?

> +		return err;
> +	}
> +
> +	err = gsm_serdev_register_device(gsd);
> +	if (err)
> +		goto err_disable;
> +
> +	err = serdev_device_open(gsd->serdev);
> +	if (err)
> +		goto err_disable;
> +
> +	/* Optional serial port configuration */
> +	of_property_read_u32(dev->of_node->parent, "current-speed",
> +			     &ddata->baudrate);

Should this be dev->of_node? The parent would be the serial port itself
(i.e. not the client).

> +	if (ddata->baudrate)
> +		serdev_device_set_baudrate(gsd->serdev, ddata->baudrate);
> +
> +	if (of_get_property(dev->of_node->parent, "uart-has-rtscts", NULL)) {

This looks like a layering issue; why not set these unconditionally and
let the upper layers deal with it?

> +		serdev_device_set_rts(gsd->serdev, true);

Do you really need this? The RTS would have been asserted on open by the
serial driver.

> +		serdev_device_set_flow_control(gsd->serdev, true);
> +	}
> +
> +	err = serdev_ngsm_set_config(dev);
> +	if (err)
> +		goto err_close;
> +
> +	err = serdev_ngsm_tty_init(ddata);
> +	if (err)
> +		goto err_tty;
> +
> +	if (ddata->cfg->init) {
> +		err = ddata->cfg->init(serdev);
> +		if (err)
> +			goto err_tty;
> +	}
> +
> +	err = of_platform_populate(dev->of_node, NULL, NULL, dev);
> +	if (err)
> +		goto err_tty;

This bit wouldn't be needed either if you register the tty devices using
tty_port_register_device_serdev() and possibly rethink the device tree
binding.

> +
> +	/* Allow parent serdev device to idle when open, balanced in remove */
> +	if (ddata->cfg->aggressive_pm)
> +		pm_runtime_put(&serdev->ctrl->dev);
> +
> +	pm_runtime_mark_last_busy(dev);
> +	pm_runtime_put_autosuspend(dev);
> +
> +	return 0;
> +
> +err_tty:
> +	serdev_ngsm_tty_exit(ddata);
> +
> +err_close:
> +	serdev_device_close(serdev);
> +
> +err_disable:
> +	pm_runtime_dont_use_autosuspend(dev);
> +	pm_runtime_put_sync(dev);
> +	pm_runtime_disable(dev);
> +	gsm_serdev_unregister_device(gsd);
> +
> +	return err;
> +}
> +
> +static void serdev_ngsm_remove(struct serdev_device *serdev)
> +{
> +	struct gsm_serdev *gsd = serdev_device_get_drvdata(serdev);
> +	struct device *dev = &serdev->dev;
> +	struct serdev_ngsm *ddata;
> +	int err;
> +
> +	ddata = gsm_serdev_get_drvdata(dev);
> +
> +	/* Balance the put done in probe for UART */
> +	if (ddata->cfg->aggressive_pm)
> +		pm_runtime_get(&serdev->ctrl->dev);
> +
> +	err = pm_runtime_get_sync(dev);
> +	if (err < 0)
> +		dev_warn(dev, "%s: PM runtime: %i\n", __func__, err);
> +
> +	of_platform_depopulate(dev);
> +	serdev_ngsm_tty_exit(ddata);
> +	serdev_device_close(serdev);
> +	gsm_serdev_unregister_device(gsd);
> +
> +	pm_runtime_dont_use_autosuspend(dev);
> +	pm_runtime_put_sync(dev);
> +	pm_runtime_disable(dev);
> +}
> +
> +static struct serdev_device_driver serdev_ngsm_driver = {
> +	.driver = {
> +		.name = "serdev_ngsm",

"gsmmux"? No need to include "serdev" in the driver name for a driver on
the serdev bus.

> +		.of_match_table = of_match_ptr(serdev_ngsm_id_table),
> +		.pm = &serdev_ngsm_pm_ops,
> +	},
> +	.probe = serdev_ngsm_probe,
> +	.remove = serdev_ngsm_remove,
> +};
> +
> +module_serdev_device_driver(serdev_ngsm_driver);
> +
> +MODULE_DESCRIPTION("serdev n_gsm driver");
> +MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/serdev-gsm.h b/include/linux/serdev-gsm.h
> --- a/include/linux/serdev-gsm.h
> +++ b/include/linux/serdev-gsm.h
> @@ -45,6 +45,17 @@ struct gsm_serdev_dlci {
>  
>  #if IS_ENABLED(CONFIG_N_GSM) && IS_ENABLED(CONFIG_SERIAL_DEV_BUS)
>  
> +/* TS 27.010 channel specific functions for consumer drivers */
> +#if IS_ENABLED(CONFIG_SERIAL_DEV_N_GSM)
> +extern int
> +serdev_ngsm_register_dlci(struct device *dev, struct gsm_serdev_dlci *dlci);
> +extern void serdev_ngsm_unregister_dlci(struct device *dev,
> +					struct gsm_serdev_dlci *dlci);
> +extern int serdev_ngsm_write(struct device *dev, struct gsm_serdev_dlci *ops,
> +			     const u8 *buf, int len);
> +#endif
> +
> +/* Interface for_gsm serdev support */
>  extern int gsm_serdev_register_device(struct gsm_serdev *gsd);
>  extern void gsm_serdev_unregister_device(struct gsm_serdev *gsd);
>  extern int gsm_serdev_register_tty_port(struct gsm_serdev *gsd, int line);

Johan

^ permalink raw reply

* Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver
From: Arnd Bergmann @ 2020-05-28 12:44 UTC (permalink / raw)
  To: Serge Semin
  Cc: Serge Semin, Andy Shevchenko, Thomas Bogendoerfer,
	Greg Kroah-Hartman, Alexey Malahov, Paul Burton, Olof Johansson,
	Rob Herring, linux-mips@vger.kernel.org, soc@kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20200528122738.rbl2dkgep4ipr2je@mobilestation>

On Thu, May 28, 2020 at 2:27 PM Serge Semin
<Sergey.Semin@baikalelectronics.ru> wrote:
>
> On Thu, May 28, 2020 at 02:14:58PM +0200, Arnd Bergmann wrote:
> > On Thu, May 28, 2020 at 12:01 AM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > > On Tuesday, May 26, 2020, Serge Semin <Sergey.Semin@baikalelectronics.ru> wrote:
> > >>
> > >> AXI3-bus is the main communication bus connecting all high-speed
> > >> peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1
> > >> SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI
> > >> Interconnect (so called AXI Main Interconnect) routing IO requests from
> > >> one SoC block to another. This driver provides a way to detect any bus
> > >> protocol errors and device not responding situations by means of an
> > >> embedded on top of the interconnect errors handler block (EHB). AXI
> > >> Interconnect QoS arbitration tuning is currently unsupported.
> > >> The bus doesn't provide a way to detect the interconnected devices,
> > >> so they are supposed to be statically defined like by means of the
> > >> simple-bus sub-nodes.
> > >
> > >
> > >
> > > Few comments in case if you need a new version. Main point is about sysfs_streq().
> >
> > I've applied the patch now and folded in fixes for the build warnings and
> > errors pointed out by the test robot, but I did not include the changes you
> > suggested.
>
> Are you saying that the build-errors and warnings have already been fixed by
> you, right? If so could you please give me a link to the repo with those
> commits, so I'd work with the up-to-date code?

I've pushed it to https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git/,

I made a local "baikal/drivers" branch with just your patches, updated
to address the build reports. This is merged into the "arm/drivers"
branch that contains all driver specific changes across all SoCs and
this is what I'll send to Linus next week.

There is also the "for-next" branch that contains all arm/* branches,
and this is what gets pulled into linux-next, so your patches will show
up there tomorrow as well.

You can normally check the status of any submission to soc@kernel.org
at https://patchwork.kernel.org/project/linux-soc/list/, but it seems that
has not picked up the status yet, and I'll have to update it manually.

       Arnd

^ permalink raw reply

* Re: [PATCHv8 0/6] n_gsm serdev support and GNSS driver for droid4
From: Pavel Machek @ 2020-05-28 12:57 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Tony Lindgren, Greg Kroah-Hartman, Rob Herring, Alan Cox,
	Lee Jones, Jiri Slaby, Merlijn Wajer, Peter Hurley,
	Sebastian Reichel, linux-serial, devicetree, linux-kernel,
	linux-omap
In-Reply-To: <20200528083918.GB10358@localhost>

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

On Thu 2020-05-28 10:39:18, Johan Hovold wrote:
> On Tue, May 12, 2020 at 02:47:07PM -0700, Tony Lindgren wrote:
> > Hi all,
> > 
> > Here's the updated set of these patches fixed up for Johan's and
> > Pavel's earlier comments.
> > 
> > This series does the following:
> > 
> > 1. Adds functions to n_gsm.c for serdev-ngsm.c driver to use
> > 
> > 2. Adds a generic serdev-ngsm.c driver that brings up the TS 27.010
> >    TTY ports configured in devicetree with help of n_gsm.c
> > 
> > 3. Allows the use of standard Linux device drivers for dedicated
> >    TS 27.010 channels for devices like GNSS and ALSA found on some
> >    modems for example
> 
> Unfortunately that does not seem to be the case just yet. Your gnss
> driver is still aware that it's using n_gsm for the transport and calls
> into the "parent" serdev-ngsm driver instead of using the serdev
> interface (e.g. as if this was still and MFD driver).
> 
> If you model this right, the GNSS driver should work equally well
> regardless of whether you use the serial interface (with n_gsm) or USB
> (e.g. cdc-acm or usb-serial).

I believe we are pretty sure we'll not see that protocol anywhere
else.

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

^ permalink raw reply

* Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver
From: Serge Semin @ 2020-05-28 13:00 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Serge Semin, Andy Shevchenko, Thomas Bogendoerfer,
	Greg Kroah-Hartman, Alexey Malahov, Paul Burton, Olof Johansson,
	Rob Herring, linux-mips@vger.kernel.org, soc@kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <CAK8P3a1ctV8Lj4PGJyzZ_eRMcXxoW1T7Wbk_2wkT4HUcFUTqdQ@mail.gmail.com>

On Thu, May 28, 2020 at 02:44:32PM +0200, Arnd Bergmann wrote:
> On Thu, May 28, 2020 at 2:27 PM Serge Semin
> <Sergey.Semin@baikalelectronics.ru> wrote:
> >
> > On Thu, May 28, 2020 at 02:14:58PM +0200, Arnd Bergmann wrote:
> > > On Thu, May 28, 2020 at 12:01 AM Andy Shevchenko
> > > <andy.shevchenko@gmail.com> wrote:
> > > > On Tuesday, May 26, 2020, Serge Semin <Sergey.Semin@baikalelectronics.ru> wrote:
> > > >>
> > > >> AXI3-bus is the main communication bus connecting all high-speed
> > > >> peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1
> > > >> SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI
> > > >> Interconnect (so called AXI Main Interconnect) routing IO requests from
> > > >> one SoC block to another. This driver provides a way to detect any bus
> > > >> protocol errors and device not responding situations by means of an
> > > >> embedded on top of the interconnect errors handler block (EHB). AXI
> > > >> Interconnect QoS arbitration tuning is currently unsupported.
> > > >> The bus doesn't provide a way to detect the interconnected devices,
> > > >> so they are supposed to be statically defined like by means of the
> > > >> simple-bus sub-nodes.
> > > >
> > > >
> > > >
> > > > Few comments in case if you need a new version. Main point is about sysfs_streq().
> > >
> > > I've applied the patch now and folded in fixes for the build warnings and
> > > errors pointed out by the test robot, but I did not include the changes you
> > > suggested.
> >
> > Are you saying that the build-errors and warnings have already been fixed by
> > you, right? If so could you please give me a link to the repo with those
> > commits, so I'd work with the up-to-date code?
> 

> I've pushed it to https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git/,
> 
> I made a local "baikal/drivers" branch with just your patches, updated
> to address the build reports. This is merged into the "arm/drivers"
> branch that contains all driver specific changes across all SoCs and
> this is what I'll send to Linus next week.
> 
> There is also the "for-next" branch that contains all arm/* branches,
> and this is what gets pulled into linux-next, so your patches will show
> up there tomorrow as well.

I see. Thanks for explanation. I've monitored the soc/soc.git a few minutes
ago, but the gitolite web-interface showed me that the last update was made
9 hours ago. So I thought you could be using some another repo. Now I see
the fresh updates and the drivers being merges.

I'll address the Andy's comments and send a follow-up patches with fixes shortly
today.

BTW I don't see the next commit:
[PATCH v3 3/6] dt-bindings: memory: Add Baikal-T1 L2-cache Control Block binding
in the baikal/drivers, so the l2-ctl binding hasn't been merged into the
arm/drivers and for-next branches. You must have missed that patch. Could you
please make sure it's also merged in?

Thanks
-Sergey

> 
> You can normally check the status of any submission to soc@kernel.org
> at https://patchwork.kernel.org/project/linux-soc/list/, but it seems that
> has not picked up the status yet, and I'll have to update it manually.
> 
>        Arnd

^ permalink raw reply

* Re: [PATCH 5/6] gnss: motmdm: Add support for Motorola Mapphone MDM6600 modem
From: Johan Hovold @ 2020-05-28 13:06 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Greg Kroah-Hartman, Johan Hovold, Rob Herring, Alan Cox,
	Lee Jones, Jiri Slaby, Merlijn Wajer, Pavel Machek, Peter Hurley,
	Sebastian Reichel, linux-serial, devicetree, linux-kernel,
	linux-omap
In-Reply-To: <20200512214713.40501-6-tony@atomide.com>

On Tue, May 12, 2020 at 02:47:12PM -0700, Tony Lindgren wrote:
> Motorola is using a custom TS 27.010 based serial port line discipline
> for various devices on the modem. These devices can be accessed on
> dedicated channels using Linux kernel serdev-ngsm driver.
> 
> For the GNSS on these devices, we need to kick the GNSS device at a
> desired rate. Otherwise the GNSS device stops sending data after a
> few minutes. The rate we poll data defaults to 1000 ms, and can be
> specified with a module option rate_ms between 1 to 16 seconds.
> 
> Note that AGPS with xtra2.bin is not yet supported, so getting a fix
> can take quite a while. And a recent gpsd is needed to parse the
> $GNGNS output, and to properly handle the /dev/gnss0 character device.
> I've confirmed it works properly with gpsd-3.20.
> 
> Tested-by: Pavel Machek <pavel@ucw.cz>
> Reviewed-by: Pavel Machek <pavel@ucw.cz>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/gnss/Kconfig  |   8 +
>  drivers/gnss/Makefile |   3 +
>  drivers/gnss/motmdm.c | 419 ++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 430 insertions(+)
>  create mode 100644 drivers/gnss/motmdm.c
> 
> diff --git a/drivers/gnss/Kconfig b/drivers/gnss/Kconfig
> --- a/drivers/gnss/Kconfig
> +++ b/drivers/gnss/Kconfig
> @@ -13,6 +13,14 @@ menuconfig GNSS
>  
>  if GNSS
>  
> +config GNSS_MOTMDM
> +	tristate "Motorola Modem TS 27.010 serdev GNSS receiver support"
> +	depends on SERIAL_DEV_N_GSM
> +	---help---
> +	  Say Y here if you have a Motorola modem using TS 27.010 line
> +	  discipline for GNSS such as a Motorola Mapphone series device
> +	  like Droid 4.
> +
>  config GNSS_SERIAL
>  	tristate
>  
> diff --git a/drivers/gnss/Makefile b/drivers/gnss/Makefile
> --- a/drivers/gnss/Makefile
> +++ b/drivers/gnss/Makefile
> @@ -6,6 +6,9 @@
>  obj-$(CONFIG_GNSS)			+= gnss.o
>  gnss-y := core.o
>  
> +obj-$(CONFIG_GNSS_MOTMDM)		+= gnss-motmdm.o
> +gnss-motmdm-y := motmdm.o
> +
>  obj-$(CONFIG_GNSS_SERIAL)		+= gnss-serial.o
>  gnss-serial-y := serial.o
>  
> diff --git a/drivers/gnss/motmdm.c b/drivers/gnss/motmdm.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/gnss/motmdm.c
> @@ -0,0 +1,419 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Motorola Modem TS 27.010 serdev GNSS driver
> + *
> + * Copyright (C) 2018 - 2020 Tony Lindgren <tony@atomide.com>
> + *
> + * Based on drivers/gnss/sirf.c driver example:
> + * Copyright (C) 2018 Johan Hovold <johan@kernel.org>
> + */
> +
> +#include <linux/errno.h>
> +#include <linux/gnss.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/serdev-gsm.h>
> +#include <linux/slab.h>
> +
> +#define MOTMDM_GNSS_TIMEOUT	1000
> +#define MOTMDM_GNSS_RATE	1000
> +
> +/*
> + * Motorola MDM GNSS device communicates over a dedicated TS 27.010 channel
> + * using custom data packets. The packets look like AT commands embedded into
> + * a Motorola invented packet using format like "U1234AT+MPDSTART=0,1,100,0".
> + * But it's not an AT compatible serial interface, it's a packet interface
> + * using AT like commands.
> + */

So this shouldn't depend on TS 27.010 and instead be a generic gnss
serial driver. 

What does the interface look like over the corresponding USB port?
AT-commands without the U1234 prefix?

> +#define MOTMDM_GNSS_HEADER_LEN	5				/* U1234 */
> +#define MOTMDM_GNSS_RESP_LEN	(MOTMDM_GNSS_HEADER_LEN + 4)	/* U1234+MPD */
> +#define MOTMDM_GNSS_DATA_LEN	(MOTMDM_GNSS_RESP_LEN + 1)	/* U1234~+MPD */
> +#define MOTMDM_GNSS_STATUS_LEN	(MOTMDM_GNSS_DATA_LEN + 7)	/* STATUS= */
> +#define MOTMDM_GNSS_NMEA_LEN	(MOTMDM_GNSS_DATA_LEN + 8)	/* NMEA=NN, */
> +
> +enum motmdm_gnss_status {
> +	MOTMDM_GNSS_UNKNOWN,
> +	MOTMDM_GNSS_INITIALIZED,
> +	MOTMDM_GNSS_DATA_OR_TIMEOUT,
> +	MOTMDM_GNSS_STARTED,
> +	MOTMDM_GNSS_STOPPED,
> +};
> +
> +struct motmdm_gnss_data {
> +	struct gnss_device *gdev;
> +	struct device *modem;
> +	struct gsm_serdev_dlci dlci;
> +	struct delayed_work restart_work;
> +	struct mutex mutex;	/* For modem commands */
> +	ktime_t last_update;
> +	int status;
> +	unsigned char *buf;
> +	size_t len;
> +	wait_queue_head_t read_queue;
> +	unsigned int parsed:1;
> +};
> +
> +static unsigned int rate_ms = MOTMDM_GNSS_RATE;
> +module_param(rate_ms, uint, 0644);
> +MODULE_PARM_DESC(rate_ms, "GNSS refresh rate between 1000 and 16000 ms (default 1000 ms)");

No module parameters please. Either pick a good default or we need to
come up with a generic (sysfs) interface for polled drivers like this
one.

> +
> +/*
> + * Note that multiple commands can be sent in series with responses coming
> + * out-of-order. For GNSS, we don't need to care about the out-of-order
> + * responses, and can assume we have at most one command active at a time.
> + * For the commands, can use just a jiffies base packet ID and let the modem
> + * sort out the ID conflicts with the modem's unsolicited message ID
> + * numbering.
> + */
> +static int motmdm_gnss_send_command(struct motmdm_gnss_data *ddata,
> +				    const u8 *buf, int len)
> +{
> +	struct gnss_device *gdev = ddata->gdev;
> +	const int timeout_ms = 1000;
> +	unsigned char cmd[128];
> +	int ret, cmdlen;
> +
> +	cmdlen = len + 5 + 1;
> +	if (cmdlen > 128)
> +		return -EINVAL;
> +
> +	mutex_lock(&ddata->mutex);
> +	memset(ddata->buf, 0, ddata->len);
> +	ddata->parsed = false;
> +	snprintf(cmd, cmdlen, "U%04li%s", jiffies % 10000, buf);
> +	ret = serdev_ngsm_write(ddata->modem, &ddata->dlci, cmd, cmdlen);
> +	if (ret < 0)
> +		goto out_unlock;
> +
> +	ret = wait_event_timeout(ddata->read_queue, ddata->parsed,
> +				 msecs_to_jiffies(timeout_ms));
> +	if (ret == 0) {
> +		ret = -ETIMEDOUT;
> +		goto out_unlock;
> +	} else if (ret < 0) {
> +		goto out_unlock;
> +	}
> +
> +	if (!strstr(ddata->buf, ":OK")) {
> +		dev_err(&gdev->dev, "command %s error %s\n",
> +			cmd, ddata->buf);
> +		ret = -EPIPE;
> +	}

I'm still not sure I like all this string parsing being done inside the
kernel (and reimplemented in every driver using an AT interface).

> +
> +	ret = len;
> +
> +out_unlock:
> +	mutex_unlock(&ddata->mutex);
> +
> +	return ret;
> +}
> +
> +/*
> + * Android uses AT+MPDSTART=0,1,100,0 which starts GNSS for a while,
> + * and then GNSS needs to be kicked with an AT command based on a
> + * status message.
> + */
> +static void motmdm_gnss_restart(struct work_struct *work)
> +{
> +	struct motmdm_gnss_data *ddata =
> +		container_of(work, struct motmdm_gnss_data,
> +			     restart_work.work);

Split declaration and initialisation to avoid the line breaks.

> +	struct gnss_device *gdev = ddata->gdev;
> +	const unsigned char *cmd = "AT+MPDSTART=0,1,100,0";
> +	int error;
> +
> +	ddata->last_update = ktime_get();
> +
> +	error = motmdm_gnss_send_command(ddata, cmd, strlen(cmd));
> +	if (error < 0) {
> +		/* Timeouts can happen, don't warn and try again */
> +		if (error != -ETIMEDOUT)
> +			dev_warn(&gdev->dev, "%s: could not start: %i\n",
> +				 __func__, error);

No function names in messages, please. Just spell out what went wrong.

> +
> +		schedule_delayed_work(&ddata->restart_work,
> +				      msecs_to_jiffies(MOTMDM_GNSS_RATE));
> +
> +		return;
> +	}
> +}
> +
> +static void motmdm_gnss_start(struct gnss_device *gdev, int delay_ms)
> +{
> +	struct motmdm_gnss_data *ddata = gnss_get_drvdata(gdev);
> +	ktime_t now, next, delta;
> +	int next_ms;
> +
> +	now = ktime_get();
> +	next = ktime_add_ms(ddata->last_update, delay_ms);
> +	delta = ktime_sub(next, now);
> +	next_ms = ktime_to_ms(delta);
> +
> +	if (next_ms < 0)
> +		next_ms = 0;
> +	if (next_ms > delay_ms)
> +		next_ms = delay_ms;
> +
> +	schedule_delayed_work(&ddata->restart_work, msecs_to_jiffies(next_ms));
> +}
> +
> +static int motmdm_gnss_stop(struct gnss_device *gdev)
> +{
> +	struct motmdm_gnss_data *ddata = gnss_get_drvdata(gdev);
> +	const unsigned char *cmd = "AT+MPDSTOP";
> +
> +	cancel_delayed_work_sync(&ddata->restart_work);
> +
> +	return motmdm_gnss_send_command(ddata, cmd, strlen(cmd));
> +}
> +
> +static int motmdm_gnss_init(struct gnss_device *gdev)
> +{
> +	struct motmdm_gnss_data *ddata = gnss_get_drvdata(gdev);
> +	const unsigned char *cmd = "AT+MPDINIT=1";
> +	int error;
> +
> +	error = motmdm_gnss_send_command(ddata, cmd, strlen(cmd));
> +	if (error < 0)
> +		return error;
> +
> +	motmdm_gnss_start(gdev, 0);
> +
> +	return 0;
> +}
> +
> +static int motmdm_gnss_finish(struct gnss_device *gdev)
> +{
> +	struct motmdm_gnss_data *ddata = gnss_get_drvdata(gdev);
> +	const unsigned char *cmd = "AT+MPDINIT=0";
> +	int error;
> +
> +	error = motmdm_gnss_stop(gdev);
> +	if (error < 0)
> +		return error;
> +
> +	return motmdm_gnss_send_command(ddata, cmd, strlen(cmd));
> +}
> +
> +static int motmdm_gnss_receive_data(struct gsm_serdev_dlci *dlci,
> +				    const unsigned char *buf,
> +				    size_t len)
> +{
> +	struct gnss_device *gdev = dlci->drvdata;
> +	struct motmdm_gnss_data *ddata = gnss_get_drvdata(gdev);
> +	const unsigned char *msg;
> +	size_t msglen;
> +	int error = 0;
> +
> +	if (len <= MOTMDM_GNSS_RESP_LEN)
> +		return 0;
> +
> +	/* Handle U1234+MPD style command response */
> +	if (buf[MOTMDM_GNSS_HEADER_LEN] != '~') {
> +		msg = buf + MOTMDM_GNSS_RESP_LEN;
> +		strncpy(ddata->buf, msg, len - MOTMDM_GNSS_RESP_LEN);
> +		ddata->parsed = true;
> +		wake_up(&ddata->read_queue);
> +
> +		return len;
> +	}
> +
> +	if (len <= MOTMDM_GNSS_DATA_LEN)
> +		return 0;
> +
> +	/* Handle U1234~+MPD style unsolicted message */
> +	switch (buf[MOTMDM_GNSS_DATA_LEN]) {

Shouldn't you check the command string?

> +	case 'N':	/* UNNNN~+MPDNMEA=NN, */
> +		msg = buf + MOTMDM_GNSS_NMEA_LEN;
> +		msglen = len - MOTMDM_GNSS_NMEA_LEN;
> +
> +		/*
> +		 * Firmware bug: Strip out extra duplicate line break always
> +		 * in the data
> +		 */
> +		msglen--;
> +
> +		/*
> +		 * Firmware bug: Strip out extra data based on an
> +		 * earlier line break in the data
> +		 */
> +		if (msg[msglen - 5 - 1] == 0x0a)
> +			msglen -= 5;
> +
> +		error = gnss_insert_raw(gdev, msg, msglen);
> +		break;
> +	case 'S':	/* UNNNN~+MPDSTATUS=N,NN */
> +		msg = buf + MOTMDM_GNSS_STATUS_LEN;
> +		msglen = len - MOTMDM_GNSS_STATUS_LEN;
> +
> +		switch (msg[0]) {
> +		case '1':
> +			ddata->status = MOTMDM_GNSS_INITIALIZED;
> +			break;
> +		case '2':
> +			ddata->status = MOTMDM_GNSS_DATA_OR_TIMEOUT;
> +			if (rate_ms < MOTMDM_GNSS_RATE)
> +				rate_ms = MOTMDM_GNSS_RATE;
> +			if (rate_ms > 16 * MOTMDM_GNSS_RATE)
> +				rate_ms = 16 * MOTMDM_GNSS_RATE;
> +			motmdm_gnss_start(gdev, rate_ms);
> +			break;
> +		case '3':
> +			ddata->status = MOTMDM_GNSS_STARTED;
> +			break;
> +		case '4':
> +			ddata->status = MOTMDM_GNSS_STOPPED;
> +			break;
> +		default:
> +			ddata->status = MOTMDM_GNSS_UNKNOWN;
> +			break;
> +		}
> +		break;
> +	case 'X':	/* UNNNN~+MPDXREQ=N for updated xtra2.bin needed */
> +	default:
> +		break;
> +	}
> +
> +	return len;
> +}
> +
> +static int motmdm_gnss_open(struct gnss_device *gdev)
> +{
> +	struct motmdm_gnss_data *ddata = gnss_get_drvdata(gdev);
> +	struct gsm_serdev_dlci *dlci = &ddata->dlci;
> +	int error;
> +
> +	dlci->drvdata = gdev;
> +	dlci->receive_buf = motmdm_gnss_receive_data;
> +
> +	error = serdev_ngsm_register_dlci(ddata->modem, dlci);
> +	if (error)
> +		return error;
> +
> +	error = motmdm_gnss_init(gdev);
> +	if (error) {
> +		serdev_ngsm_unregister_dlci(ddata->modem, dlci);
> +
> +		return error;
> +	}
> +
> +	return 0;
> +}

How does your "aggressive pm" gsmmux implementation work with the gps if
there are no other clients keeping the modem awake? It seems the modem
would be suspended after 600 milliseconds after being woken up every 10
seconds or so by the polling gnss driver?

What happens to the satellite lock in between? Does the request block
until the gps has an updated position?

Johan

^ permalink raw reply

* Re: [PATCH v8 00/13] add ecspi ERR009165 for i.mx6/7 soc family
From: Mark Brown @ 2020-05-28 13:07 UTC (permalink / raw)
  To: catalin.marinas, vkoul, mark.rutland, will.deacon, s.hauer,
	festevam, dan.j.williams, Robin Gong, shawnguo, u.kleine-koenig,
	martin.fuzzey, robh+dt
  Cc: linux-imx, linux-spi, kernel, linux-arm-kernel, devicetree,
	linux-kernel
In-Reply-To: <1590006865-20900-1-git-send-email-yibin.gong@nxp.com>

On Thu, 21 May 2020 04:34:12 +0800, Robin Gong wrote:
> There is ecspi ERR009165 on i.mx6/7 soc family, which cause FIFO
> transfer to be send twice in DMA mode. Please get more information from:
> https://www.nxp.com/docs/en/errata/IMX6DQCE.pdf. The workaround is adding
> new sdma ram script which works in XCH  mode as PIO inside sdma instead
> of SMC mode, meanwhile, 'TX_THRESHOLD' should be 0. The issue should be
> exist on all legacy i.mx6/7 soc family before i.mx6ul.
> NXP fix this design issue from i.mx6ul, so newer chips including i.mx6ul/
> 6ull/6sll do not need this workaroud anymore. All other i.mx6/7/8 chips
> still need this workaroud. This patch set add new 'fsl,imx6ul-ecspi'
> for ecspi driver and 'ecspi_fixed' in sdma driver to choose if need errata
> or not.
> The first two reverted patches should be the same issue, though, it
> seems 'fixed' by changing to other shp script. Hope Sean or Sascha could
> have the chance to test this patch set if could fix their issues.
> Besides, enable sdma support for i.mx8mm/8mq and fix ecspi1 not work
> on i.mx8mm because the event id is zero.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: imx: fallback to PIO if dma setup failure
      commit: bcd8e7761ec9c128b9102b0833d9c7052ae2dbcf

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply

* Re: [PATCH v3 5/6] bus: Add Baikal-T1 APB-bus driver
From: Serge Semin @ 2020-05-28 13:13 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Serge Semin, Thomas Bogendoerfer, Greg Kroah-Hartman,
	Alexey Malahov, Paul Burton, Olof Johansson, Rob Herring,
	open list:BROADCOM NVRAM DRIVER, SoC Team, DTML,
	linux-kernel@vger.kernel.org
In-Reply-To: <CAK8P3a1KT6G0pcLt56spm2O_Q5m_s+cdHfUrp2YUStS0wGigwQ@mail.gmail.com>

On Thu, May 28, 2020 at 02:17:17PM +0200, Arnd Bergmann wrote:
> On Tue, May 26, 2020 at 2:59 PM Serge Semin
> <Sergey.Semin@baikalelectronics.ru> wrote:
> >
> > Baikal-T1 AXI-APB bridge is used to access the SoC subsystem CSRs.
> > IO requests are routed to this bus by means of the DW AMBA 3 AXI
> > Interconnect. In case if an attempted APB transaction stays with no
> > response for a pre-defined time an interrupt occurs and the bus gets
> > freed for a next operation. This driver provides the interrupt handler
> > to detect the erroneous address, prints an error message about the
> > address fault, updates an errors counter. The counter and the APB-bus
> > operations timeout can be accessed via corresponding sysfs nodes.
> > A dedicated sysfs-node can be also used to artificially cause the
> > bus errors described above.
> >
> > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> > Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
> > Cc: Paul Burton <paulburton@kernel.org>
> > Cc: Olof Johansson <olof@lixom.net>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: linux-mips@vger.kernel.org
> > Cc: soc@kernel.org
> > Cc: devicetree@vger.kernel.org
> >
> > ---
> 
> Applied with this fixup:

I'm afraid linux/io.h is also needed here.(

-Sergey

> 
> --- a/drivers/bus/bt1-apb.c
> +++ b/drivers/bus/bt1-apb.c
> @@ -16,6 +16,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/interrupt.h>
>  #include <linux/nmi.h>
> +#include <linux/of.h>
>  #include <linux/regmap.h>
>  #include <linux/clk.h>
>  #include <linux/reset.h>
> @@ -309,13 +310,13 @@ static ssize_t timeout_store(struct device *dev,
>  }
>  static DEVICE_ATTR_RW(timeout);
> 
> -static int inject_error_show(struct device *dev, struct device_attribute *attr,
> +static ssize_t inject_error_show(struct device *dev, struct
> device_attribute *attr,
>                              char *buf)
>  {
>         return scnprintf(buf, PAGE_SIZE, "Error injection: nodev irq\n");
>  }
> 
> -static int inject_error_store(struct device *dev,
> +static ssize_t inject_error_store(struct device *dev,
>                               struct device_attribute *attr,
>                               const char *data, size_t count)
>  {

^ permalink raw reply

* Re: [PATCH v2] arm: dts: am335x-boneblack: add gpio-line-names
From: Drew Fustini @ 2020-05-28 13:16 UTC (permalink / raw)
  To: Linus Walleij, Grygorii Strashko, Benoît Cousson,
	Tony Lindgren, Rob Herring, Linux-OMAP, devicetree, linux-kernel,
	Jason Kridner, Robert Nelson
In-Reply-To: <20200521200926.GC429020@x1>

On Thu, May 21, 2020 at 10:09:26PM +0200, Drew Fustini wrote:
> The BeagleBone Black has P8 and P9 headers [0] which expose many of the
> AM3358 ZCZ SoC balls to stacking expansion boards called "capes", or to
> other external connections like jumper wires connected to a breadboard.
> BeagleBone users will often refer to the "Cape Exanpsion Headers" pin
> diagram [1] as it is in the "Bone101" getting started tutorial. [2]
> 
> Most of the P8 and P9 header pins can muxed to a GPIO line.  The
> gpio-line-names describe which P8 or P9 pin that line goes to and the
> default mux for that P8 or P9 pin if it is not GPIO.
> 
> For example, gpiochip 1 line 0 is connected to P8 header pin 25 (P8_25)
> however the default device tree has the corresponding BGA ball (ZCZ U7)
> muxed to mmc1_dat0 as it is used for the on-board eMMC chip.  For that
> GPIO line to be used, one would need to modify the device tree to
> disable the eMMC and change the pin mux for that ball to GPIO mode.
> 
> Some of the AM3358 ZCZ balls corresponding to GPIO lines are not routed
> to a P8 or P9 header, but are instead wired to some peripheral device
> like on-board eMMC, HDMI framer IC, or status LEDs.  Those names are in
> brackets to denote those GPIO lines can not be used.
> 
> Some GPIO lines are named "[NC]" as the corresponding balls are not
> routed to anything on the PCB.
> 
> The goal for these names is to make it easier for a user viewing the
> output of gpioinfo to determine which P8 or P9 pin is connected to a
> GPIO line.  The output of gpioinfo on a BeagleBone Black would be:
> 
> gpiochip0 - 32 lines:
> 	line   0: "[ethernet]"       unused   input  active-high 
> 	line   1: "[ethernet]"       unused   input  active-high 
> 	line   2: "P9_22 [spi0_sclk]" unused input active-high 
> 	line   3: "P9_21 [spi0_d0]" unused input active-high 
> 	line   4: "P9_18 [spi0_d1]" unused input active-high 
> 	line   5: "P9_17 [spi0_cs0]" unused input active-high 
> 	line   6:  "[sd card]"         "cd"   input   active-low [used]
> 	line   7: "P9_42A [ecappwm0]" unused input active-high 
> 	line   8: "P8_35 [hdmi]" unused input active-high 
> 	line   9: "P8_33 [hdmi]" unused input active-high 
> 	line  10: "P8_31 [hdmi]" unused input active-high 
> 	line  11: "P8_32 [hdmi]" unused input active-high 
> 	line  12: "P9_20 [i2c2_sda]" unused input active-high 
> 	line  13: "P9_19 [i2c2_scl]" unused input active-high 
> 	line  14: "P9_26 [uart1_rxd]" unused input active-high 
> 	line  15: "P9_24 [uart1_txd]" unused input active-high 
> 	line  16: "[ethernet]"       unused   input  active-high 
> 	line  17: "[ethernet]"       unused   input  active-high 
> 	line  18:      "[usb]"       unused   input  active-high 
> 	line  19:     "[hdmi]"       unused   input  active-high 
> 	line  20:     "P9_41B"       unused   input  active-high 
> 	line  21: "[ethernet]"       unused   input  active-high 
> 	line  22: "P8_19 [ehrpwm2a]" unused input active-high 
> 	line  23: "P8_13 [ehrpwm2b]" unused input active-high 
> 	line  24:       "[NC]"       unused   input  active-high 
> 	line  25:       "[NC]"       unused   input  active-high 
> 	line  26:      "P8_14"       unused   input  active-high 
> 	line  27:      "P8_17"       unused   input  active-high 
> 	line  28: "[ethernet]"       unused   input  active-high 
> 	line  29: "[ethernet]"       unused   input  active-high 
> 	line  30: "P9_11 [uart4_rxd]" unused input active-high 
> 	line  31: "P9_13 [uart4_txd]" unused input active-high 
> gpiochip1 - 32 lines:
> 	line   0: "P8_25 [emmc]" unused input active-high 
> 	line   1:     "[emmc]"       unused   input  active-high 
> 	line   2: "P8_5 [emmc]" unused input active-high 
> 	line   3: "P8_6 [emmc]" unused input active-high 
> 	line   4: "P8_23 [emmc]" unused input active-high 
> 	line   5: "P8_22 [emmc]" unused input active-high 
> 	line   6: "P8_3 [emmc]" unused input active-high 
> 	line   7: "P8_4 [emmc]" unused input active-high 
> 	line   8:       "[NC]"       unused   input  active-high 
> 	line   9:       "[NC]"       unused   input  active-high 
> 	line  10:       "[NC]"       unused   input  active-high 
> 	line  11:       "[NC]"       unused   input  active-high 
> 	line  12:      "P8_12"       unused   input  active-high 
> 	line  13:      "P8_11"       unused   input  active-high 
> 	line  14:      "P8_16"       unused   input  active-high 
> 	line  15:      "P8_15"       unused   input  active-high 
> 	line  16:     "P9_15A"       unused   input  active-high 
> 	line  17:      "P9_23"       unused   input  active-high 
> 	line  18: "P9_14 [ehrpwm1a]" unused input active-high 
> 	line  19: "P9_16 [ehrpwm1b]" unused input active-high 
> 	line  20:     "[emmc]"       unused   input  active-high 
> 	line  21: "[usr0 led]" "beaglebone:green:heartbeat" output active-high [used]
> 	line  22: "[usr1 led]" "beaglebone:green:mmc0" output active-high [used]
> 	line  23: "[usr2 led]" "beaglebone:green:usr2" output active-high [used]
> 	line  24: "[usr3 led]" "beaglebone:green:usr3" output active-high [used]
> 	line  25:     "[hdmi]"  "interrupt"   input  active-high [used]
> 	line  26:      "[usb]"       unused   input  active-high 
> 	line  27: "[hdmi audio]" "enable" output active-high [used]
> 	line  28:      "P9_12"       unused   input  active-high 
> 	line  29:      "P8_26"       unused   input  active-high 
> 	line  30: "P8_21 [emmc]" unused input active-high 
> 	line  31: "P8_20 [emmc]" unused input active-high 
> gpiochip2 - 32 lines:
> 	line   0:     "P9_15B"       unused   input  active-high 
> 	line   1:      "P8_18"       unused   input  active-high 
> 	line   2:       "P8_7"       unused   input  active-high 
> 	line   3:       "P8_8"       unused   input  active-high 
> 	line   4:      "P8_10"       unused   input  active-high 
> 	line   5:       "P8_9"       unused   input  active-high 
> 	line   6: "P8_45 [hdmi]" unused input active-high 
> 	line   7: "P8_46 [hdmi]" unused input active-high 
> 	line   8: "P8_43 [hdmi]" unused input active-high 
> 	line   9: "P8_44 [hdmi]" unused input active-high 
> 	line  10: "P8_41 [hdmi]" unused input active-high 
> 	line  11: "P8_42 [hdmi]" unused input active-high 
> 	line  12: "P8_39 [hdmi]" unused input active-high 
> 	line  13: "P8_40 [hdmi]" unused input active-high 
> 	line  14: "P8_37 [hdmi]" unused input active-high 
> 	line  15: "P8_38 [hdmi]" unused input active-high 
> 	line  16: "P8_36 [hdmi]" unused input active-high 
> 	line  17: "P8_34 [hdmi]" unused input active-high 
> 	line  18: "[ethernet]"       unused   input  active-high 
> 	line  19: "[ethernet]"       unused   input  active-high 
> 	line  20: "[ethernet]"       unused   input  active-high 
> 	line  21: "[ethernet]"       unused   input  active-high 
> 	line  22: "P8_27 [hdmi]" unused input active-high 
> 	line  23: "P8_29 [hdmi]" unused input active-high 
> 	line  24: "P8_28 [hdmi]" unused input active-high 
> 	line  25: "P8_30 [hdmi]" unused input active-high 
> 	line  26:     "[emmc]"       unused   input  active-high 
> 	line  27:     "[emmc]"       unused   input  active-high 
> 	line  28:     "[emmc]"       unused   input  active-high 
> 	line  29:     "[emmc]"       unused   input  active-high 
> 	line  30:     "[emmc]"       unused   input  active-high 
> 	line  31:     "[emmc]"       unused   input  active-high 
> gpiochip3 - 32 lines:
> 	line   0: "[ethernet]"       unused   input  active-high 
> 	line   1: "[ethernet]"       unused   input  active-high 
> 	line   2: "[ethernet]"       unused   input  active-high 
> 	line   3: "[ethernet]"       unused   input  active-high 
> 	line   4: "[ethernet]"       unused   input  active-high 
> 	line   5:     "[i2c0]"       unused   input  active-high 
> 	line   6:     "[i2c0]"       unused   input  active-high 
> 	line   7:      "[emu]"       unused   input  active-high 
> 	line   8:      "[emu]"       unused   input  active-high 
> 	line   9: "[ethernet]"       unused   input  active-high 
> 	line  10: "[ethernet]"       unused   input  active-high 
> 	line  11:       "[NC]"       unused   input  active-high 
> 	line  12:       "[NC]"       unused   input  active-high 
> 	line  13:      "[usb]"       unused   input  active-high 
> 	line  14: "P9_31 [spi1_sclk]" unused input active-high 
> 	line  15: "P9_29 [spi1_d0]" unused input active-high 
> 	line  16: "P9_30 [spi1_d1]" unused input active-high 
> 	line  17: "P9_28 [spi1_cs0]" unused input active-high 
> 	line  18: "P9_42B [ecappwm0]" unused input active-high 
> 	line  19:      "P9_27"       unused   input  active-high 
> 	line  20:     "P9_41A"       unused   input  active-high 
> 	line  21:      "P9_25"       unused   input  active-high 
> 	line  22:       "[NC]"       unused   input  active-high 
> 	line  23:       "[NC]"       unused   input  active-high 
> 	line  24:       "[NC]"       unused   input  active-high 
> 	line  25:       "[NC]"       unused   input  active-high 
> 	line  26:       "[NC]"       unused   input  active-high 
> 	line  27:       "[NC]"       unused   input  active-high 
> 	line  28:       "[NC]"       unused   input  active-high 
> 	line  29:       "[NC]"       unused   input  active-high 
> 	line  30:       "[NC]"       unused   input  active-high 
> 	line  31:       "[NC]"       unused   input  active-high 
> 
> [0] https://git.io/JfgOd
> [1] https://beagleboard.org/capes
> [1] https://beagleboard.org/Support/bone101
> [2] https://beagleboard.org/static/images/cape-headers.png
> 
> Reviewed-by: Jason Kridner <jason@beagleboard.org>
> Reviewed-by: Robert Nelson <robertcnelson@gmail.com>
> Signed-off-by: Drew Fustini <drew@beagleboard.org>
> ---
> V2 change:
> - include output of gpioinfo to illustrate how the gpio-line-names
> will appear. My apologies for forgetting to include in V1.
> 
> V1 note:
> I had posted a patch with these line names for am335x-bone-common.dtsi
> but Grygorii Strashko pointed out that the names are not applicable to
> all BeagleBone models.  Thus I have created this patch to add these
> names just for the BeagleBone Black.
> 
>  arch/arm/boot/dts/am335x-boneblack.dts | 144 +++++++++++++++++++++++++
>  1 file changed, 144 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
> index d3928662aed4..5f31e832eb82 100644
> --- a/arch/arm/boot/dts/am335x-boneblack.dts
> +++ b/arch/arm/boot/dts/am335x-boneblack.dts
> @@ -23,3 +23,147 @@ oppnitro-1000000000 {
>  		opp-supported-hw = <0x06 0x0100>;
>  	};
>  };
> +
> +&gpio0 {
> +	gpio-line-names =
> +		"[ethernet]",
> +		"[ethernet]",
> +		"P9_22 [spi0_sclk]",
> +		"P9_21 [spi0_d0]",
> +		"P9_18 [spi0_d1]",
> +		"P9_17 [spi0_cs0]",
> +		"[sd card]",
> +		"P9_42A [ecappwm0]",
> +		"P8_35 [hdmi]",
> +		"P8_33 [hdmi]",
> +		"P8_31 [hdmi]",
> +		"P8_32 [hdmi]",
> +		"P9_20 [i2c2_sda]",
> +		"P9_19 [i2c2_scl]",
> +		"P9_26 [uart1_rxd]",
> +		"P9_24 [uart1_txd]",
> +		"[ethernet]",
> +		"[ethernet]",
> +		"[usb]",
> +		"[hdmi]",
> +		"P9_41B",
> +		"[ethernet]",
> +		"P8_19 [ehrpwm2a]",
> +		"P8_13 [ehrpwm2b]",
> +		"[NC]",
> +		"[NC]",
> +		"P8_14",
> +		"P8_17",
> +		"[ethernet]",
> +		"[ethernet]",
> +		"P9_11 [uart4_rxd]",
> +		"P9_13 [uart4_txd]";
> +};
> +
> +&gpio1 {
> +	gpio-line-names =
> +		"P8_25 [emmc]",
> +		"[emmc]",
> +		"P8_5 [emmc]",
> +		"P8_6 [emmc]",
> +		"P8_23 [emmc]",
> +		"P8_22 [emmc]",
> +		"P8_3 [emmc]",
> +		"P8_4 [emmc]",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]",
> +		"P8_12",
> +		"P8_11",
> +		"P8_16",
> +		"P8_15",
> +		"P9_15A",
> +		"P9_23",
> +		"P9_14 [ehrpwm1a]",
> +		"P9_16 [ehrpwm1b]",
> +		"[emmc]",
> +		"[usr0 led]",
> +		"[usr1 led]",
> +		"[usr2 led]",
> +		"[usr3 led]",
> +		"[hdmi]",
> +		"[usb]",
> +		"[hdmi audio]",
> +		"P9_12",
> +		"P8_26",
> +		"P8_21 [emmc]",
> +		"P8_20 [emmc]";
> +};
> +
> +&gpio2 {
> +	gpio-line-names =
> +		"P9_15B",
> +		"P8_18",
> +		"P8_7",
> +		"P8_8",
> +		"P8_10",
> +		"P8_9",
> +		"P8_45 [hdmi]",
> +		"P8_46 [hdmi]",
> +		"P8_43 [hdmi]",
> +		"P8_44 [hdmi]",
> +		"P8_41 [hdmi]",
> +		"P8_42 [hdmi]",
> +		"P8_39 [hdmi]",
> +		"P8_40 [hdmi]",
> +		"P8_37 [hdmi]",
> +		"P8_38 [hdmi]",
> +		"P8_36 [hdmi]",
> +		"P8_34 [hdmi]",
> +		"[ethernet]",
> +		"[ethernet]",
> +		"[ethernet]",
> +		"[ethernet]",
> +		"P8_27 [hdmi]",
> +		"P8_29 [hdmi]",
> +		"P8_28 [hdmi]",
> +		"P8_30 [hdmi]",
> +		"[emmc]",
> +		"[emmc]",
> +		"[emmc]",
> +		"[emmc]",
> +		"[emmc]",
> +		"[emmc]";
> +};
> +
> +&gpio3 {
> +	gpio-line-names =
> +		"[ethernet]",
> +		"[ethernet]",
> +		"[ethernet]",
> +		"[ethernet]",
> +		"[ethernet]",
> +		"[i2c0]",
> +		"[i2c0]",
> +		"[emu]",
> +		"[emu]",
> +		"[ethernet]",
> +		"[ethernet]",
> +		"[NC]",
> +		"[NC]",
> +		"[usb]",
> +		"P9_31 [spi1_sclk]",
> +		"P9_29 [spi1_d0]",
> +		"P9_30 [spi1_d1]",
> +		"P9_28 [spi1_cs0]",
> +		"P9_42B [ecappwm0]",
> +		"P9_27",
> +		"P9_41A",
> +		"P9_25",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]",
> +		"[NC]";
> +};
> -- 
> 2.25.1
> 


FYI - Linus W. provided an Acked-by in related thread [0].

Anyone else have any review comments?

thank you,
drew

[0] https://lore.kernel.org/linux-devicetree/CACRpkdZLRjcE0FGwVR-Q7a50aEmpB=xO4q6H8_EaV199fGr0OA@mail.gmail.com/

^ permalink raw reply

* [PATCH dt-schema] Fix interrupt controllers with interrupt-map
From: Geert Uytterhoeven @ 2020-05-28 13:23 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, Geert Uytterhoeven

When an interrupt controller has an "interrupt-map" property, an "is
valid under each of" error is triggered.

Fix this by allowing "interrupt-controller" and "interrupt-map" to
coexist, in both the interrrupts meta-schema and the
interrupt-controller schema.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 meta-schemas/interrupts.yaml      | 2 +-
 schemas/interrupt-controller.yaml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta-schemas/interrupts.yaml b/meta-schemas/interrupts.yaml
index 7073063486d44dab..93d8e4cafca679d3 100644
--- a/meta-schemas/interrupts.yaml
+++ b/meta-schemas/interrupts.yaml
@@ -26,7 +26,7 @@ properties:
 dependencies:
   interrupt-map: ['#interrupt-cells', 'interrupt-map-mask']
   '#interrupt-cells':
-    oneOf:
+    anyOf:
       - required:
           - interrupt-controller
       - required:
diff --git a/schemas/interrupt-controller.yaml b/schemas/interrupt-controller.yaml
index f65d5f6d2f1ac524..5dce87d839959489 100644
--- a/schemas/interrupt-controller.yaml
+++ b/schemas/interrupt-controller.yaml
@@ -30,7 +30,7 @@ dependencies:
   interrupt-controller: ['#interrupt-cells']
   interrupt-map: ['#interrupt-cells', 'interrupt-map-mask']
   "#interrupt-cells":
-    oneOf:
+    anyOf:
       - required:
           - interrupt-controller
       - required:
-- 
2.17.1


^ permalink raw reply related

* [PATCH v2] of/fdt: Remove redundant kbasename function call
From: Qi Zheng @ 2020-05-28 13:25 UTC (permalink / raw)
  To: robh+dt, robh, frowand.list; +Cc: devicetree, linux-kernel, Qi Zheng

For version 1 to 3 of the device tree, this is the node full
path as a zero terminated string, starting with "/". The
following equation will not hold, since the node name has
been processed in the fdt_get_name().

	*pathp == '/'

For version 16 and later, this is the node unit name only
(or an empty string for the root node). So the above
equation will still not hold.

So the kbasename() is redundant, just remove it.

Signed-off-by: Qi Zheng <arch0.zheng@gmail.com>
---

Change in v2:
	remove another kbasename() also.

 drivers/of/fdt.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 38619e9ef6b2..4602e467ca8b 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -643,8 +643,6 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
 	     offset = fdt_next_node(blob, offset, &depth)) {
 
 		pathp = fdt_get_name(blob, offset, NULL);
-		if (*pathp == '/')
-			pathp = kbasename(pathp);
 		rc = it(offset, pathp, depth, data);
 	}
 	return rc;
@@ -671,8 +669,6 @@ int __init of_scan_flat_dt_subnodes(unsigned long parent,
 		int rc;
 
 		pathp = fdt_get_name(blob, node, NULL);
-		if (*pathp == '/')
-			pathp = kbasename(pathp);
 		rc = it(node, pathp, data);
 		if (rc)
 			return rc;
-- 
2.25.1


^ permalink raw reply related

* [PATCH net-next] dt-bindings: net: rename the bindings document for MediaTek STAR MAC
From: Bartosz Golaszewski @ 2020-05-28 13:27 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Rob Herring, Matthias Brugger
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Fabien Parent, Stephane Le Provost, Pedro Tsai,
	Andrew Perepech, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

The driver itself was renamed before getting merged into mainline, but
the binding document kept the old name. This makes both names consistent.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 .../net/{mediatek,eth-mac.yaml => mediatek,star-emac.yaml}        | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Documentation/devicetree/bindings/net/{mediatek,eth-mac.yaml => mediatek,star-emac.yaml} (100%)

diff --git a/Documentation/devicetree/bindings/net/mediatek,eth-mac.yaml b/Documentation/devicetree/bindings/net/mediatek,star-emac.yaml
similarity index 100%
rename from Documentation/devicetree/bindings/net/mediatek,eth-mac.yaml
rename to Documentation/devicetree/bindings/net/mediatek,star-emac.yaml
-- 
2.26.1


^ permalink raw reply

* [PATCH] dt-bindings: irqchip: renesas-rza1-irqc: Convert to json-schema
From: Geert Uytterhoeven @ 2020-05-28 13:28 UTC (permalink / raw)
  To: Rob Herring
  Cc: Chris Brandt, Thomas Gleixner, Jason Cooper, Marc Zyngier,
	devicetree, linux-kernel, linux-renesas-soc, Geert Uytterhoeven

Convert the Renesas RZ/A1 Interrupt Controller Device Tree binding
documentation to json-schema.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Validation depends on "[PATCH dt-schema] Fix interrupt controllers with
interrupt-map".
http://lore.kernel.org/r/20200528132323.30288-1-geert+renesas@glider.be
---
 .../renesas,rza1-irqc.txt                     | 43 ----------
 .../renesas,rza1-irqc.yaml                    | 80 +++++++++++++++++++
 2 files changed, 80 insertions(+), 43 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,rza1-irqc.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,rza1-irqc.yaml

diff --git a/Documentation/devicetree/bindings/interrupt-controller/renesas,rza1-irqc.txt b/Documentation/devicetree/bindings/interrupt-controller/renesas,rza1-irqc.txt
deleted file mode 100644
index 727b7e4cd6e01110..0000000000000000
--- a/Documentation/devicetree/bindings/interrupt-controller/renesas,rza1-irqc.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-DT bindings for the Renesas RZ/A1 Interrupt Controller
-
-The RZ/A1 Interrupt Controller is a front-end for the GIC found on Renesas
-RZ/A1 and RZ/A2 SoCs:
-  - IRQ sense select for 8 external interrupts, 1:1-mapped to 8 GIC SPI
-    interrupts,
-  - NMI edge select.
-
-Required properties:
-  - compatible: Must be "renesas,<soctype>-irqc", and "renesas,rza1-irqc" as
-		fallback.
-		Examples with soctypes are:
-		  - "renesas,r7s72100-irqc" (RZ/A1H)
-		  - "renesas,r7s9210-irqc" (RZ/A2M)
-  - #interrupt-cells: Must be 2 (an interrupt index and flags, as defined
-				 in interrupts.txt in this directory)
-  - #address-cells: Must be zero
-  - interrupt-controller: Marks the device as an interrupt controller
-  - reg: Base address and length of the memory resource used by the interrupt
-         controller
-  - interrupt-map: Specifies the mapping from external interrupts to GIC
-		   interrupts
-  - interrupt-map-mask: Must be <7 0>
-
-Example:
-
-	irqc: interrupt-controller@fcfef800 {
-		compatible = "renesas,r7s72100-irqc", "renesas,rza1-irqc";
-		#interrupt-cells = <2>;
-		#address-cells = <0>;
-		interrupt-controller;
-		reg = <0xfcfef800 0x6>;
-		interrupt-map =
-			<0 0 &gic GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
-			<1 0 &gic GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
-			<2 0 &gic GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
-			<3 0 &gic GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
-			<4 0 &gic GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
-			<5 0 &gic GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
-			<6 0 &gic GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
-			<7 0 &gic GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
-		interrupt-map-mask = <7 0>;
-	};
diff --git a/Documentation/devicetree/bindings/interrupt-controller/renesas,rza1-irqc.yaml b/Documentation/devicetree/bindings/interrupt-controller/renesas,rza1-irqc.yaml
new file mode 100644
index 0000000000000000..755cdfabfcd06c85
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/renesas,rza1-irqc.yaml
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/renesas,rza1-irqc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas RZ/A1 Interrupt Controller
+
+maintainers:
+  - Chris Brandt <chris.brandt@renesas.com>
+  - Geert Uytterhoeven <geert+renesas@glider.be>
+
+description: |
+  The RZ/A1 Interrupt Controller is a front-end for the GIC found on Renesas RZ/A1 and
+  RZ/A2 SoCs:
+    - IRQ sense select for 8 external interrupts, 1:1-mapped to 8 GIC SPI interrupts,
+    - NMI edge select.
+
+allOf:
+  - $ref: /schemas/interrupt-controller.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,r7s72100-irqc # RZ/A1H
+          - renesas,r7s9210-irqc  # RZ/A2M
+      - const: renesas,rza1-irqc
+
+  '#interrupt-cells':
+    const: 2
+
+  '#address-cells':
+    const: 0
+
+  interrupt-controller: true
+
+  reg:
+    maxItems: 1
+
+  interrupt-map:
+    maxItems: 8
+    description: Specifies the mapping from external interrupts to GIC interrupts.
+
+  interrupt-map-mask:
+    items:
+      - const: 7
+      - const: 0
+
+required:
+  - compatible
+  - '#interrupt-cells'
+  - '#address-cells'
+  - interrupt-controller
+  - reg
+  - interrupt-map
+  - interrupt-map-mask
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    irqc: interrupt-controller@fcfef800 {
+            compatible = "renesas,r7s72100-irqc", "renesas,rza1-irqc";
+            #interrupt-cells = <2>;
+            #address-cells = <0>;
+            interrupt-controller;
+            reg = <0xfcfef800 0x6>;
+            interrupt-map =
+                    <0 0 &gic GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+                    <1 0 &gic GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+                    <2 0 &gic GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+                    <3 0 &gic GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+                    <4 0 &gic GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+                    <5 0 &gic GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+                    <6 0 &gic GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+                    <7 0 &gic GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+            interrupt-map-mask = <7 0>;
+    };
-- 
2.17.1


^ permalink raw reply related

* [PATCH] dt-bindings: timer: renesas: mtu2: Convert to json-schema
From: Geert Uytterhoeven @ 2020-05-28 13:30 UTC (permalink / raw)
  To: Rob Herring
  Cc: Laurent Pinchart, Daniel Lezcano, Thomas Gleixner, devicetree,
	linux-kernel, linux-renesas-soc, Geert Uytterhoeven

Convert the Renesas Multi-Function Timer Pulse Unit 2 (MTU2) Device Tree
binding documentation to json-schema.

Add missing properties.
Update the example to match reality.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 .../bindings/timer/renesas,mtu2.txt           | 42 ----------
 .../bindings/timer/renesas,mtu2.yaml          | 76 +++++++++++++++++++
 2 files changed, 76 insertions(+), 42 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/timer/renesas,mtu2.txt
 create mode 100644 Documentation/devicetree/bindings/timer/renesas,mtu2.yaml

diff --git a/Documentation/devicetree/bindings/timer/renesas,mtu2.txt b/Documentation/devicetree/bindings/timer/renesas,mtu2.txt
deleted file mode 100644
index ba0a34d97eb80261..0000000000000000
--- a/Documentation/devicetree/bindings/timer/renesas,mtu2.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-* Renesas Multi-Function Timer Pulse Unit 2 (MTU2)
-
-The MTU2 is a multi-purpose, multi-channel timer/counter with configurable
-clock inputs and programmable compare match.
-
-Channels share hardware resources but their counter and compare match value
-are independent. The MTU2 hardware supports five channels indexed from 0 to 4.
-
-Required Properties:
-
-  - compatible: must be one or more of the following:
-    - "renesas,mtu2-r7s72100" for the r7s72100 MTU2
-    - "renesas,mtu2" for any MTU2
-      This is a fallback for the above renesas,mtu2-* entries
-
-  - reg: base address and length of the registers block for the timer module.
-
-  - interrupts: interrupt specifiers for the timer, one for each entry in
-    interrupt-names.
-  - interrupt-names: must contain one entry named "tgi?a" for each enabled
-    channel, where "?" is the channel index expressed as one digit from "0" to
-    "4".
-
-  - clocks: a list of phandle + clock-specifier pairs, one for each entry
-    in clock-names.
-  - clock-names: must contain "fck" for the functional clock.
-
-
-Example: R7S72100 (RZ/A1H) MTU2 node
-
-	mtu2: timer@fcff0000 {
-		compatible = "renesas,mtu2-r7s72100", "renesas,mtu2";
-		reg = <0xfcff0000 0x400>;
-		interrupts = <0 139 IRQ_TYPE_LEVEL_HIGH>,
-			     <0 146 IRQ_TYPE_LEVEL_HIGH>,
-			     <0 150 IRQ_TYPE_LEVEL_HIGH>,
-			     <0 154 IRQ_TYPE_LEVEL_HIGH>,
-			     <0 159 IRQ_TYPE_LEVEL_HIGH>;
-		interrupt-names = "tgi0a", "tgi1a", "tgi2a", "tgi3a", "tgi4a";
-		clocks = <&mstp3_clks R7S72100_CLK_MTU2>;
-		clock-names = "fck";
-	};
diff --git a/Documentation/devicetree/bindings/timer/renesas,mtu2.yaml b/Documentation/devicetree/bindings/timer/renesas,mtu2.yaml
new file mode 100644
index 0000000000000000..15d8dddf4ae9555b
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/renesas,mtu2.yaml
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/timer/renesas,mtu2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas Multi-Function Timer Pulse Unit 2 (MTU2)
+
+maintainers:
+  - Geert Uytterhoeven <geert+renesas@glider.be>
+  - Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+
+description:
+  The MTU2 is a multi-purpose, multi-channel timer/counter with configurable clock inputs
+  and programmable compare match.
+
+  Channels share hardware resources but their counter and compare match value are
+  independent. The MTU2 hardware supports five channels indexed from 0 to 4.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,mtu2-r7s72100 # RZ/A1H
+      - const: renesas,mtu2
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    minItems: 1
+    maxItems: 5
+    description: One entry for each enabled channel.
+
+  interrupt-names:
+    minItems: 1
+    items:
+      - const: tgi0a
+      - const: tgi1a
+      - const: tgi2a
+      - const: tgi3a
+      - const: tgi4a
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: fck
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - clocks
+  - clock-names
+  - power-domains
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/r7s72100-clock.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    mtu2: timer@fcff0000 {
+            compatible = "renesas,mtu2-r7s72100", "renesas,mtu2";
+            reg = <0xfcff0000 0x400>;
+            interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+            interrupt-names = "tgi0a";
+            clocks = <&mstp3_clks R7S72100_CLK_MTU2>;
+            clock-names = "fck";
+            power-domains = <&cpg_clocks>;
+    };
-- 
2.17.1


^ permalink raw reply related

* Re: [PATCH v3 04/20] arm64: dts: arm: vexpress: Move fixed devices out of bus node
From: André Przywara @ 2020-05-28 13:30 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Rob Herring, Liviu Dudau, Sudeep Holla, Lorenzo Pieralisi,
	Mark Rutland, devicetree, linux-arm-kernel
In-Reply-To: <20200528024810.GA232303@roeck-us.net>

On 28/05/2020 03:48, Guenter Roeck wrote:

Hi Guenter,

> On Wed, May 13, 2020 at 11:30:00AM +0100, Andre Przywara wrote:
>> The devicetree compiler complains when DT nodes without a reg property
>> live inside a (simple) bus node:
>> Warning (simple_bus_reg): Node /bus@8000000/motherboard-bus/refclk32khz
>>                           missing or empty reg/ranges property
>>
>> Move the fixed clocks, the fixed regulator, the leds and the config bus
>> subtree to the root node, since they do not depend on any busses.
>>
>> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> 
> This patch results in tracebacks when booting the vexpress-a15 machine
> with vexpress-v2p-ca15-tc1 devicetree file in qemu. Reverting it as well
> as the subsequent patches affecting the same file (to avoid revert
> conflicts) fixes the problem.

Many thanks for the heads up! I was able to reproduce it here. On the
first glance it looks like the UART is probed before the clocks now,
because the traversal of the changed DT leads to a different probe
order. I will look into how to fix this.

Cheers,
Andre

> 
> Guenter
> 
> ---
> [   12.744248] ------------[ cut here ]------------
> [   12.744562] WARNING: CPU: 0 PID: 20 at drivers/tty/serial/serial_core.c:471 uart_get_baud_rate+0x100/0x154
> [   12.744607] Modules linked in:
> [   12.744785] CPU: 0 PID: 20 Comm: kworker/0:1 Not tainted 5.7.0-rc7-next-20200526 #1
> [   12.744818] Hardware name: ARM-Versatile Express
> [   12.745021] Workqueue: events amba_deferred_retry_func
> [   12.745155] [<c0312484>] (unwind_backtrace) from [<c030c490>] (show_stack+0x10/0x14)
> [   12.745206] [<c030c490>] (show_stack) from [<c0880f04>] (dump_stack+0xc8/0xdc)
> [   12.745239] [<c0880f04>] (dump_stack) from [<c0346e44>] (__warn+0xdc/0xf4)
> [   12.745270] [<c0346e44>] (__warn) from [<c0346f0c>] (warn_slowpath_fmt+0xb0/0xb8)
> [   12.745302] [<c0346f0c>] (warn_slowpath_fmt) from [<c0a6b16c>] (uart_get_baud_rate+0x100/0x154)
> [   12.745336] [<c0a6b16c>] (uart_get_baud_rate) from [<c0a7f5ac>] (pl011_set_termios+0x48/0x32c)
> [   12.745367] [<c0a7f5ac>] (pl011_set_termios) from [<c0a6bbbc>] (uart_set_options+0x124/0x164)
> [   12.745404] [<c0a6bbbc>] (uart_set_options) from [<c1b8c804>] (pl011_console_setup+0x214/0x230)
> [   12.745438] [<c1b8c804>] (pl011_console_setup) from [<c03ab0d8>] (try_enable_new_console+0x98/0x138)
> [   12.745469] [<c03ab0d8>] (try_enable_new_console) from [<c03acc64>] (register_console+0xe8/0x304)
> [   12.745499] [<c03acc64>] (register_console) from [<c0a6c88c>] (uart_add_one_port+0x4c0/0x504)
> [   12.745529] [<c0a6c88c>] (uart_add_one_port) from [<c0a80404>] (pl011_register_port+0x5c/0xac)
> [   12.745568] [<c0a80404>] (pl011_register_port) from [<c097f5a0>] (amba_probe+0x9c/0x110)
> [   12.745602] [<c097f5a0>] (amba_probe) from [<c0b57e84>] (really_probe+0x218/0x348)
> [   12.745632] [<c0b57e84>] (really_probe) from [<c0b580c0>] (driver_probe_device+0x5c/0xb4)
> [   12.745662] [<c0b580c0>] (driver_probe_device) from [<c0b55ff4>] (bus_for_each_drv+0x58/0xb8)
> [   12.745692] [<c0b55ff4>] (bus_for_each_drv) from [<c0b57bf8>] (__device_attach+0xd4/0x140)
> [   12.745721] [<c0b57bf8>] (__device_attach) from [<c0b56eb0>] (bus_probe_device+0x88/0x90)
> [   12.745751] [<c0b56eb0>] (bus_probe_device) from [<c0b53234>] (device_add+0x3d4/0x6e8)
> [   12.745782] [<c0b53234>] (device_add) from [<c097f664>] (amba_device_try_add+0x50/0x2d4)
> [   12.745812] [<c097f664>] (amba_device_try_add) from [<c097f924>] (amba_deferred_retry+0x3c/0x98)
> [   12.745847] [<c097f924>] (amba_deferred_retry) from [<c097f988>] (amba_deferred_retry_func+0x8/0x40)
> [   12.745881] [<c097f988>] (amba_deferred_retry_func) from [<c0365b6c>] (process_one_work+0x2b8/0x6e8)
> [   12.745912] [<c0365b6c>] (process_one_work) from [<c0365fe0>] (worker_thread+0x44/0x540)
> [   12.745942] [<c0365fe0>] (worker_thread) from [<c036d810>] (kthread+0x16c/0x178)
> [   12.745973] [<c036d810>] (kthread) from [<c03001a8>] (ret_from_fork+0x14/0x2c)
> [   12.746041] Exception stack(0xc73abfb0 to 0xc73abff8)
> [   12.746181] bfa0:                                     00000000 00000000 00000000 00000000
> [   12.746302] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [   12.746397] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
> [   12.746651] ---[ end trace 2a3f61da56bd8a49 ]---
> 
> ---
> # bad: [b0523c7b1c9d0edcd6c0fe6d2cb558a9ad5c60a8] Add linux-next specific files for 20200526
> # good: [9cb1fd0efd195590b828b9b865421ad345a4a145] Linux 5.7-rc7
> git bisect start 'next-20200526' 'v5.7-rc7'
> # bad: [0c7351ad83670964e48cb9a098ad732c1ecbf804] Merge remote-tracking branch 'crypto/master'
> git bisect bad 0c7351ad83670964e48cb9a098ad732c1ecbf804
> # bad: [42e11d9b4682229fa7187d129758b8c382f8cd5d] Merge remote-tracking branch 'jc_docs/docs-next'
> git bisect bad 42e11d9b4682229fa7187d129758b8c382f8cd5d
> # bad: [ab6f501559e9efa687c711a781243cf6651a82d3] Merge remote-tracking branch 'm68k/for-next'
> git bisect bad ab6f501559e9efa687c711a781243cf6651a82d3
> # bad: [44aaa516ca63b3ab2da8ae81e9c6a58656e6acb5] Merge branch 'arm/drivers' into for-next
> git bisect bad 44aaa516ca63b3ab2da8ae81e9c6a58656e6acb5
> # good: [1cb00f8c3b36e6ae026fb58d1cd2ccd78b81aa9f] Merge tag 'qcom-arm64-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into arm/dt
> git bisect good 1cb00f8c3b36e6ae026fb58d1cd2ccd78b81aa9f
> # bad: [ed0c25932fbfafdfe37e9633dee21770d3c5a306] Merge branch 'arm/defconfig' into for-next
> git bisect bad ed0c25932fbfafdfe37e9633dee21770d3c5a306
> # bad: [9eddc06a3bc79402f50176703237ed045ae77b16] Merge branch 'mmp/fixes' into arm/dt
> git bisect bad 9eddc06a3bc79402f50176703237ed045ae77b16
> # bad: [87b990ab62722a8a3cb0691107971ab1bd7bddb5] Merge tag 'mvebu-dt64-5.8-1' of git://git.infradead.org/linux-mvebu into arm/dt
> git bisect bad 87b990ab62722a8a3cb0691107971ab1bd7bddb5
> # bad: [94cc3f1baabac5e5c4dcc6c2f070353f8315d0ee] arm64: dts: juno: Fix SCPI shared mem node name
> git bisect bad 94cc3f1baabac5e5c4dcc6c2f070353f8315d0ee
> # bad: [a78aee9e434932a500db36cc6d88daeff3745e9f] arm64: dts: juno: Fix GIC child nodes
> git bisect bad a78aee9e434932a500db36cc6d88daeff3745e9f
> # bad: [feebdc3f7950d7e44e914e821f6c04e58e292c74] arm64: dts: fvp: Move fixed clocks out of bus node
> git bisect bad feebdc3f7950d7e44e914e821f6c04e58e292c74
> # good: [849bfc3dfc13cde6ec04fbcf32af553ded9f7ec3] arm64: dts: fvp: Move fixed devices out of bus node
> git bisect good 849bfc3dfc13cde6ec04fbcf32af553ded9f7ec3
> # bad: [d9258898ad49cbb46caffe23af0d4f0b766e67a2] arm64: dts: vexpress: Move fixed devices out of bus node
> git bisect bad d9258898ad49cbb46caffe23af0d4f0b766e67a2
> # first bad commit: [d9258898ad49cbb46caffe23af0d4f0b766e67a2] arm64: dts: vexpress: Move fixed devices out of bus node
> 


^ permalink raw reply

* Re: [PATCH v4 3/4] dmaengine: mediatek-cqdma: fix compatible
From: Matthias Brugger @ 2020-05-28 13:39 UTC (permalink / raw)
  To: EastL, Sean Wang
  Cc: vkoul, robh+dt, mark.rutland, dmaengine, linux-kernel,
	linux-arm-kernel, linux-mediatek, devicetree, wsd_upstream
In-Reply-To: <1590659832-31476-4-git-send-email-EastL.Lee@mediatek.com>



On 28/05/2020 11:57, EastL wrote:
> This patch fixes mediatek-cqdma compatible to common.
> 
> Signed-off-by: EastL <EastL.Lee@mediatek.com>
> ---
>  drivers/dma/mediatek/mtk-cqdma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c
> index 905bbcb..bca7118 100644
> --- a/drivers/dma/mediatek/mtk-cqdma.c
> +++ b/drivers/dma/mediatek/mtk-cqdma.c
> @@ -544,7 +544,7 @@ static void mtk_cqdma_hw_deinit(struct mtk_cqdma_device *cqdma)
>  }
>  
>  static const struct of_device_id mtk_cqdma_match[] = {
> -	{ .compatible = "mediatek,mt6765-cqdma" },
> +	{ .compatible = "mediatek,cqdma" },

We can't just delete and old compatible. If other cqdma IP blocks are the same
as mt6795, we should instead add entries in the binding description with
fallback compatible. For example for mt6779 the DTS would look like this:
compatible = "mediatek,mt6779-cqdma", "mediatek,mt6765-cqdma";

This way we the kernel will take care to bind the device against the driver with
mt7665-cqdma, but leaves us the posibillity to add any changes to the driver in
the future if we find some bugs/features for mt6779 that are not present in mt6765.

Regards,
Matthias

>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, mtk_cqdma_match);
> 

^ permalink raw reply

* Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver
From: Serge Semin @ 2020-05-28 13:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Serge Semin, Thomas Bogendoerfer, Greg Kroah-Hartman,
	Arnd Bergmann, Alexey Malahov, Paul Burton, Olof Johansson,
	Rob Herring, linux-mips@vger.kernel.org, soc@kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <CAHp75VcfkPPy5YjNrcv8c6doyQz5C47QyREE0v6tfQjXYrBijQ@mail.gmail.com>

On Thu, May 28, 2020 at 01:00:57AM +0300, Andy Shevchenko wrote:
> On Tuesday, May 26, 2020, Serge Semin <Sergey.Semin@baikalelectronics.ru>
> wrote:
> 
> > AXI3-bus is the main communication bus connecting all high-speed
> > peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1
> > SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI
> > Interconnect (so called AXI Main Interconnect) routing IO requests from
> > one SoC block to another. This driver provides a way to detect any bus
> > protocol errors and device not responding situations by means of an
> > embedded on top of the interconnect errors handler block (EHB). AXI
> > Interconnect QoS arbitration tuning is currently unsupported.
> > The bus doesn't provide a way to detect the interconnected devices,
> > so they are supposed to be statically defined like by means of the
> > simple-bus sub-nodes.
> 
> 
> 
> Few comments in case if you need a new version. Main point is about
> sysfs_streq().

Hello, Andy. Thanks for your comments. I'll address most of them in a follow-up
patches. See just one note below.

> 
> 
> > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> > Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
> > Cc: Paul Burton <paulburton@kernel.org>
> > Cc: Olof Johansson <olof@lixom.net>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: linux-mips@vger.kernel.org
> > Cc: soc@kernel.org
> > Cc: devicetree@vger.kernel.org
> >

[nip]

> > +
> > +static void bt1_axi_clear_data(void *data)
> > +{
> > +       struct bt1_axi *axi = data;
> > +       struct platform_device *pdev = to_platform_device(axi->dev);
> > +
> > +       platform_set_drvdata(pdev, NULL);
> 
> 

> Doesn't device driver core do this already?

It doesn't on remove. This cleanups the drvdata pointer when the driver is
unloaded at the moment of remove() callback calling. This is a good
practice to leave the device the same as it has been before usage including
the pointer value. In this case if theoretically someone (though very
unlikely, but anyway) would try to use the pointer without having it
initialized, the NULL-dereference would pop up, otherwise we may
corrupt someones memory, which is very nasty.

-Sergey

^ permalink raw reply


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