* [PATCH v2 05/10] mailbox: tegra-hsp: Add suspend/resume support
From: Thierry Reding @ 2018-11-12 15:18 UTC (permalink / raw)
To: Thierry Reding, Jassi Brar, Greg Kroah-Hartman
Cc: devicetree, Mika Liljeberg, Mikko Perttunen, Timo Alho,
linux-serial, Jiri Slaby, linux-tegra, Pekka Pessi, Jon Hunter,
linux-arm-kernel
In-Reply-To: <20181112151853.29289-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
Upon resuming from a system sleep state, the interrupts for all active
shared mailboxes need to be reenabled, otherwise they will not work.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/mailbox/tegra-hsp.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index 0100a974149b..1259abf3542f 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -18,6 +18,7 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
+#include <linux/pm.h>
#include <linux/slab.h>
#include <dt-bindings/mailbox/tegra186-hsp.h>
@@ -817,6 +818,23 @@ static int tegra_hsp_remove(struct platform_device *pdev)
return 0;
}
+static int tegra_hsp_resume(struct device *dev)
+{
+ struct tegra_hsp *hsp = dev_get_drvdata(dev);
+ unsigned int i;
+
+ for (i = 0; i < hsp->num_sm; i++) {
+ struct tegra_hsp_mailbox *mb = &hsp->mailboxes[i];
+
+ if (mb->channel.chan->cl)
+ tegra_hsp_mailbox_startup(mb->channel.chan);
+ }
+
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(tegra_hsp_pm_ops, NULL, tegra_hsp_resume);
+
static const struct tegra_hsp_db_map tegra186_hsp_db_map[] = {
{ "ccplex", TEGRA_HSP_DB_MASTER_CCPLEX, HSP_DB_CCPLEX, },
{ "bpmp", TEGRA_HSP_DB_MASTER_BPMP, HSP_DB_BPMP, },
@@ -843,6 +861,7 @@ static struct platform_driver tegra_hsp_driver = {
.driver = {
.name = "tegra-hsp",
.of_match_table = tegra_hsp_match,
+ .pm = &tegra_hsp_pm_ops,
},
.probe = tegra_hsp_probe,
.remove = tegra_hsp_remove,
--
2.19.1
^ permalink raw reply related
* [PATCH v2 04/10] mailbox: tegra-hsp: Add support for shared mailboxes
From: Thierry Reding @ 2018-11-12 15:18 UTC (permalink / raw)
To: Thierry Reding, Jassi Brar, Greg Kroah-Hartman
Cc: devicetree, Mika Liljeberg, Mikko Perttunen, Timo Alho,
linux-serial, Jiri Slaby, linux-tegra, Pekka Pessi, Jon Hunter,
linux-arm-kernel
In-Reply-To: <20181112151853.29289-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
The Tegra HSP block supports 'shared mailboxes' that are simple 32-bit
registers consisting of a FULL bit in MSB position and 31 bits of data.
The hardware can be configured to trigger interrupts when a mailbox
is empty or full. Add support for these shared mailboxes to the HSP
driver.
The initial use for the mailboxes is the Tegra Combined UART. For this
purpose, we use interrupts to receive data, and spinning to wait for
the transmit mailbox to be emptied to minimize unnecessary overhead.
Based on work by Mikko Perttunen <mperttunen@nvidia.com>.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- do not write per-mailbox interrupt enable registers on Tegra186
- merge handlers for empty and full interrupts
- track direction of shared mailboxes
drivers/mailbox/tegra-hsp.c | 498 +++++++++++++++++++++++++++++++-----
1 file changed, 437 insertions(+), 61 deletions(-)
diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index 0cde356c11ab..0100a974149b 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -11,6 +11,7 @@
* more details.
*/
+#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/mailbox_controller.h>
@@ -21,6 +22,17 @@
#include <dt-bindings/mailbox/tegra186-hsp.h>
+#include "mailbox.h"
+
+#define HSP_INT_IE(x) (0x100 + ((x) * 4))
+#define HSP_INT_IV 0x300
+#define HSP_INT_IR 0x304
+
+#define HSP_INT_EMPTY_SHIFT 0
+#define HSP_INT_EMPTY_MASK 0xff
+#define HSP_INT_FULL_SHIFT 8
+#define HSP_INT_FULL_MASK 0xff
+
#define HSP_INT_DIMENSIONING 0x380
#define HSP_nSM_SHIFT 0
#define HSP_nSS_SHIFT 4
@@ -34,6 +46,11 @@
#define HSP_DB_RAW 0x8
#define HSP_DB_PENDING 0xc
+#define HSP_SM_SHRD_MBOX 0x0
+#define HSP_SM_SHRD_MBOX_FULL BIT(31)
+#define HSP_SM_SHRD_MBOX_FULL_INT_IE 0x04
+#define HSP_SM_SHRD_MBOX_EMPTY_INT_IE 0x08
+
#define HSP_DB_CCPLEX 1
#define HSP_DB_BPMP 3
#define HSP_DB_MAX 7
@@ -55,6 +72,12 @@ struct tegra_hsp_doorbell {
unsigned int index;
};
+struct tegra_hsp_mailbox {
+ struct tegra_hsp_channel channel;
+ unsigned int index;
+ bool producer;
+};
+
struct tegra_hsp_db_map {
const char *name;
unsigned int master;
@@ -63,13 +86,18 @@ struct tegra_hsp_db_map {
struct tegra_hsp_soc {
const struct tegra_hsp_db_map *map;
+ bool has_per_mb_ie;
};
struct tegra_hsp {
+ struct device *dev;
const struct tegra_hsp_soc *soc;
- struct mbox_controller mbox;
+ struct mbox_controller mbox_db;
+ struct mbox_controller mbox_sm;
void __iomem *regs;
- unsigned int irq;
+ unsigned int doorbell_irq;
+ unsigned int *shared_irqs;
+ unsigned int shared_irq;
unsigned int num_sm;
unsigned int num_as;
unsigned int num_ss;
@@ -78,13 +106,10 @@ struct tegra_hsp {
spinlock_t lock;
struct list_head doorbells;
-};
+ struct tegra_hsp_mailbox *mailboxes;
-static inline struct tegra_hsp *
-to_tegra_hsp(struct mbox_controller *mbox)
-{
- return container_of(mbox, struct tegra_hsp, mbox);
-}
+ unsigned long mask;
+};
static inline u32 tegra_hsp_readl(struct tegra_hsp *hsp, unsigned int offset)
{
@@ -158,7 +183,7 @@ static irqreturn_t tegra_hsp_doorbell_irq(int irq, void *data)
spin_lock(&hsp->lock);
- for_each_set_bit(master, &value, hsp->mbox.num_chans) {
+ for_each_set_bit(master, &value, hsp->mbox_db.num_chans) {
struct tegra_hsp_doorbell *db;
db = __tegra_hsp_doorbell_get(hsp, master);
@@ -182,6 +207,71 @@ static irqreturn_t tegra_hsp_doorbell_irq(int irq, void *data)
return IRQ_HANDLED;
}
+static irqreturn_t tegra_hsp_shared_irq(int irq, void *data)
+{
+ struct tegra_hsp *hsp = data;
+ unsigned long bit, mask;
+ u32 status, value;
+ void *msg;
+
+ status = tegra_hsp_readl(hsp, HSP_INT_IR) & hsp->mask;
+
+ /* process EMPTY interrupts first */
+ mask = (status >> HSP_INT_EMPTY_SHIFT) & HSP_INT_EMPTY_MASK;
+
+ for_each_set_bit(bit, &mask, hsp->num_sm) {
+ struct tegra_hsp_mailbox *mb = &hsp->mailboxes[bit];
+
+ if (mb->producer) {
+ /*
+ * Disable EMPTY interrupts until data is sent with
+ * the next message. These interrupts are level-
+ * triggered, so if we kept them enabled they would
+ * constantly trigger until we next write data into
+ * the message.
+ */
+ spin_lock(&hsp->lock);
+
+ hsp->mask &= ~BIT(HSP_INT_EMPTY_SHIFT + mb->index);
+ tegra_hsp_writel(hsp, hsp->mask,
+ HSP_INT_IE(hsp->shared_irq));
+
+ spin_unlock(&hsp->lock);
+
+ mbox_chan_txdone(mb->channel.chan, 0);
+ }
+ }
+
+ /* process FULL interrupts */
+ mask = (status >> HSP_INT_FULL_SHIFT) & HSP_INT_FULL_MASK;
+
+ for_each_set_bit(bit, &mask, hsp->num_sm) {
+ struct tegra_hsp_mailbox *mb = &hsp->mailboxes[bit];
+
+ if (!mb->producer) {
+ value = tegra_hsp_channel_readl(&mb->channel,
+ HSP_SM_SHRD_MBOX);
+ value &= ~HSP_SM_SHRD_MBOX_FULL;
+ msg = (void *)(unsigned long)value;
+ mbox_chan_received_data(mb->channel.chan, msg);
+
+ /*
+ * Need to clear all bits here since some producers,
+ * such as TCU, depend on fields in the register
+ * getting cleared by the consumer.
+ *
+ * The mailbox API doesn't give the consumers a way
+ * of doing that explicitly, so we have to make sure
+ * we cover all possible cases.
+ */
+ tegra_hsp_channel_writel(&mb->channel, 0x0,
+ HSP_SM_SHRD_MBOX);
+ }
+ }
+
+ return IRQ_HANDLED;
+}
+
static struct tegra_hsp_channel *
tegra_hsp_doorbell_create(struct tegra_hsp *hsp, const char *name,
unsigned int master, unsigned int index)
@@ -194,7 +284,7 @@ tegra_hsp_doorbell_create(struct tegra_hsp *hsp, const char *name,
if (!db)
return ERR_PTR(-ENOMEM);
- offset = (1 + (hsp->num_sm / 2) + hsp->num_ss + hsp->num_as) << 16;
+ offset = (1 + (hsp->num_sm / 2) + hsp->num_ss + hsp->num_as) * SZ_64K;
offset += index * 0x100;
db->channel.regs = hsp->regs + offset;
@@ -235,8 +325,8 @@ static int tegra_hsp_doorbell_startup(struct mbox_chan *chan)
unsigned long flags;
u32 value;
- if (db->master >= hsp->mbox.num_chans) {
- dev_err(hsp->mbox.dev,
+ if (db->master >= chan->mbox->num_chans) {
+ dev_err(chan->mbox->dev,
"invalid master ID %u for HSP channel\n",
db->master);
return -EINVAL;
@@ -281,46 +371,168 @@ static void tegra_hsp_doorbell_shutdown(struct mbox_chan *chan)
spin_unlock_irqrestore(&hsp->lock, flags);
}
-static const struct mbox_chan_ops tegra_hsp_doorbell_ops = {
+static const struct mbox_chan_ops tegra_hsp_db_ops = {
.send_data = tegra_hsp_doorbell_send_data,
.startup = tegra_hsp_doorbell_startup,
.shutdown = tegra_hsp_doorbell_shutdown,
};
-static struct mbox_chan *of_tegra_hsp_xlate(struct mbox_controller *mbox,
+static int tegra_hsp_mailbox_send_data(struct mbox_chan *chan, void *data)
+{
+ struct tegra_hsp_mailbox *mb = chan->con_priv;
+ struct tegra_hsp *hsp = mb->channel.hsp;
+ unsigned long flags;
+ u32 value;
+
+ WARN_ON(!mb->producer);
+
+ /* copy data and mark mailbox full */
+ value = (u32)(unsigned long)data;
+ value |= HSP_SM_SHRD_MBOX_FULL;
+
+ tegra_hsp_channel_writel(&mb->channel, value, HSP_SM_SHRD_MBOX);
+
+ if (!irqs_disabled()) {
+ /* enable EMPTY interrupt for the shared mailbox */
+ spin_lock_irqsave(&hsp->lock, flags);
+
+ hsp->mask |= BIT(HSP_INT_EMPTY_SHIFT + mb->index);
+ tegra_hsp_writel(hsp, hsp->mask, HSP_INT_IE(hsp->shared_irq));
+
+ spin_unlock_irqrestore(&hsp->lock, flags);
+ }
+
+ return 0;
+}
+
+static int tegra_hsp_mailbox_flush(struct mbox_chan *chan,
+ unsigned long timeout)
+{
+ struct tegra_hsp_mailbox *mb = chan->con_priv;
+ struct tegra_hsp_channel *ch = &mb->channel;
+ u32 value;
+
+ timeout = jiffies + msecs_to_jiffies(timeout);
+
+ while (time_before(jiffies, timeout)) {
+ value = tegra_hsp_channel_readl(ch, HSP_SM_SHRD_MBOX);
+ if ((value & HSP_SM_SHRD_MBOX_FULL) == 0) {
+ mbox_chan_txdone(chan, 0);
+ return 0;
+ }
+
+ udelay(1);
+ }
+
+ return -ETIME;
+}
+
+static int tegra_hsp_mailbox_startup(struct mbox_chan *chan)
+{
+ struct tegra_hsp_mailbox *mb = chan->con_priv;
+ struct tegra_hsp_channel *ch = &mb->channel;
+ struct tegra_hsp *hsp = mb->channel.hsp;
+ unsigned long flags;
+
+ chan->txdone_method = TXDONE_BY_IRQ;
+
+ /*
+ * Shared mailboxes start out as consumers by default. FULL and EMPTY
+ * interrupts are coalesced at the same shared interrupt.
+ *
+ * Keep EMPTY interrupts disabled at startup and only enable them when
+ * the mailbox is actually full. This is required because the FULL and
+ * EMPTY interrupts are level-triggered, so keeping EMPTY interrupts
+ * enabled all the time would cause an interrupt storm while mailboxes
+ * are idle.
+ */
+
+ spin_lock_irqsave(&hsp->lock, flags);
+
+ if (mb->producer)
+ hsp->mask &= ~BIT(HSP_INT_EMPTY_SHIFT + mb->index);
+ else
+ hsp->mask |= BIT(HSP_INT_FULL_SHIFT + mb->index);
+
+ tegra_hsp_writel(hsp, hsp->mask, HSP_INT_IE(hsp->shared_irq));
+
+ spin_unlock_irqrestore(&hsp->lock, flags);
+
+ if (hsp->soc->has_per_mb_ie) {
+ if (mb->producer)
+ tegra_hsp_channel_writel(ch, 0x0,
+ HSP_SM_SHRD_MBOX_EMPTY_INT_IE);
+ else
+ tegra_hsp_channel_writel(ch, 0x1,
+ HSP_SM_SHRD_MBOX_FULL_INT_IE);
+ }
+
+ return 0;
+}
+
+static void tegra_hsp_mailbox_shutdown(struct mbox_chan *chan)
+{
+ struct tegra_hsp_mailbox *mb = chan->con_priv;
+ struct tegra_hsp_channel *ch = &mb->channel;
+ struct tegra_hsp *hsp = mb->channel.hsp;
+ unsigned long flags;
+
+ if (hsp->soc->has_per_mb_ie) {
+ if (mb->producer)
+ tegra_hsp_channel_writel(ch, 0x0,
+ HSP_SM_SHRD_MBOX_EMPTY_INT_IE);
+ else
+ tegra_hsp_channel_writel(ch, 0x0,
+ HSP_SM_SHRD_MBOX_FULL_INT_IE);
+ }
+
+ spin_lock_irqsave(&hsp->lock, flags);
+
+ if (mb->producer)
+ hsp->mask &= ~BIT(HSP_INT_EMPTY_SHIFT + mb->index);
+ else
+ hsp->mask &= ~BIT(HSP_INT_FULL_SHIFT + mb->index);
+
+ tegra_hsp_writel(hsp, hsp->mask, HSP_INT_IE(hsp->shared_irq));
+
+ spin_unlock_irqrestore(&hsp->lock, flags);
+}
+
+static const struct mbox_chan_ops tegra_hsp_sm_ops = {
+ .send_data = tegra_hsp_mailbox_send_data,
+ .flush = tegra_hsp_mailbox_flush,
+ .startup = tegra_hsp_mailbox_startup,
+ .shutdown = tegra_hsp_mailbox_shutdown,
+};
+
+static struct mbox_chan *tegra_hsp_db_xlate(struct mbox_controller *mbox,
const struct of_phandle_args *args)
{
+ struct tegra_hsp *hsp = container_of(mbox, struct tegra_hsp, mbox_db);
+ unsigned int type = args->args[0], master = args->args[1];
struct tegra_hsp_channel *channel = ERR_PTR(-ENODEV);
- struct tegra_hsp *hsp = to_tegra_hsp(mbox);
- unsigned int type = args->args[0];
- unsigned int master = args->args[1];
struct tegra_hsp_doorbell *db;
struct mbox_chan *chan;
unsigned long flags;
unsigned int i;
- switch (type) {
- case TEGRA_HSP_MBOX_TYPE_DB:
- db = tegra_hsp_doorbell_get(hsp, master);
- if (db)
- channel = &db->channel;
+ if (type != TEGRA_HSP_MBOX_TYPE_DB || !hsp->doorbell_irq)
+ return ERR_PTR(-ENODEV);
- break;
-
- default:
- break;
- }
+ db = tegra_hsp_doorbell_get(hsp, master);
+ if (db)
+ channel = &db->channel;
if (IS_ERR(channel))
return ERR_CAST(channel);
spin_lock_irqsave(&hsp->lock, flags);
- for (i = 0; i < hsp->mbox.num_chans; i++) {
- chan = &hsp->mbox.chans[i];
+ for (i = 0; i < mbox->num_chans; i++) {
+ chan = &mbox->chans[i];
if (!chan->con_priv) {
- chan->con_priv = channel;
channel->chan = chan;
+ chan->con_priv = db;
break;
}
@@ -332,6 +544,29 @@ static struct mbox_chan *of_tegra_hsp_xlate(struct mbox_controller *mbox,
return chan ?: ERR_PTR(-EBUSY);
}
+static struct mbox_chan *tegra_hsp_sm_xlate(struct mbox_controller *mbox,
+ const struct of_phandle_args *args)
+{
+ struct tegra_hsp *hsp = container_of(mbox, struct tegra_hsp, mbox_sm);
+ unsigned int type = args->args[0], index;
+ struct tegra_hsp_mailbox *mb;
+
+ index = args->args[1] & TEGRA_HSP_SM_MASK;
+
+ if (type != TEGRA_HSP_MBOX_TYPE_SM || !hsp->shared_irqs ||
+ index >= hsp->num_sm)
+ return ERR_PTR(-ENODEV);
+
+ mb = &hsp->mailboxes[index];
+
+ if ((args->args[1] & TEGRA_HSP_SM_FLAG_TX) == 0)
+ mb->producer = false;
+ else
+ mb->producer = true;
+
+ return mb->channel.chan;
+}
+
static void tegra_hsp_remove_doorbells(struct tegra_hsp *hsp)
{
struct tegra_hsp_doorbell *db, *tmp;
@@ -364,10 +599,65 @@ static int tegra_hsp_add_doorbells(struct tegra_hsp *hsp)
return 0;
}
+static int tegra_hsp_add_mailboxes(struct tegra_hsp *hsp, struct device *dev)
+{
+ int i;
+
+ hsp->mailboxes = devm_kcalloc(dev, hsp->num_sm, sizeof(*hsp->mailboxes),
+ GFP_KERNEL);
+ if (!hsp->mailboxes)
+ return -ENOMEM;
+
+ for (i = 0; i < hsp->num_sm; i++) {
+ struct tegra_hsp_mailbox *mb = &hsp->mailboxes[i];
+
+ mb->index = i;
+
+ mb->channel.hsp = hsp;
+ mb->channel.regs = hsp->regs + SZ_64K + i * SZ_32K;
+ mb->channel.chan = &hsp->mbox_sm.chans[i];
+ mb->channel.chan->con_priv = mb;
+ }
+
+ return 0;
+}
+
+static int tegra_hsp_request_shared_irqs(struct tegra_hsp *hsp)
+{
+ unsigned int i, irq = 0;
+ int err;
+
+ for (i = 0; i < hsp->num_si; i++) {
+ if (hsp->shared_irq == 0 && hsp->shared_irqs[i] > 0) {
+ irq = hsp->shared_irqs[i];
+ hsp->shared_irq = i;
+ break;
+ }
+ }
+
+ if (irq > 0) {
+ err = devm_request_irq(hsp->dev, irq, tegra_hsp_shared_irq, 0,
+ dev_name(hsp->dev), hsp);
+ if (err < 0) {
+ dev_err(hsp->dev, "failed to request interrupt: %d\n",
+ err);
+ return err;
+ }
+
+ /* disable all interrupts */
+ tegra_hsp_writel(hsp, 0, HSP_INT_IE(hsp->shared_irq));
+
+ dev_dbg(hsp->dev, "interrupt requested: %u\n", irq);
+ }
+
+ return 0;
+}
+
static int tegra_hsp_probe(struct platform_device *pdev)
{
struct tegra_hsp *hsp;
struct resource *res;
+ unsigned int i;
u32 value;
int err;
@@ -375,6 +665,7 @@ static int tegra_hsp_probe(struct platform_device *pdev)
if (!hsp)
return -ENOMEM;
+ hsp->dev = &pdev->dev;
hsp->soc = of_device_get_match_data(&pdev->dev);
INIT_LIST_HEAD(&hsp->doorbells);
spin_lock_init(&hsp->lock);
@@ -392,58 +683,136 @@ static int tegra_hsp_probe(struct platform_device *pdev)
hsp->num_si = (value >> HSP_nSI_SHIFT) & HSP_nINT_MASK;
err = platform_get_irq_byname(pdev, "doorbell");
- if (err < 0) {
- dev_err(&pdev->dev, "failed to get doorbell IRQ: %d\n", err);
- return err;
+ if (err >= 0)
+ hsp->doorbell_irq = err;
+
+ if (hsp->num_si > 0) {
+ unsigned int count = 0;
+
+ hsp->shared_irqs = devm_kcalloc(&pdev->dev, hsp->num_si,
+ sizeof(*hsp->shared_irqs),
+ GFP_KERNEL);
+ if (!hsp->shared_irqs)
+ return -ENOMEM;
+
+ for (i = 0; i < hsp->num_si; i++) {
+ char *name;
+
+ name = kasprintf(GFP_KERNEL, "shared%u", i);
+ if (!name)
+ return -ENOMEM;
+
+ err = platform_get_irq_byname(pdev, name);
+ if (err >= 0) {
+ hsp->shared_irqs[i] = err;
+ count++;
+ }
+
+ kfree(name);
+ }
+
+ if (count == 0) {
+ devm_kfree(&pdev->dev, hsp->shared_irqs);
+ hsp->shared_irqs = NULL;
+ }
+ }
+
+ /* setup the doorbell controller */
+ hsp->mbox_db.of_xlate = tegra_hsp_db_xlate;
+ hsp->mbox_db.num_chans = 32;
+ hsp->mbox_db.dev = &pdev->dev;
+ hsp->mbox_db.ops = &tegra_hsp_db_ops;
+
+ hsp->mbox_db.chans = devm_kcalloc(&pdev->dev, hsp->mbox_db.num_chans,
+ sizeof(*hsp->mbox_db.chans),
+ GFP_KERNEL);
+ if (!hsp->mbox_db.chans)
+ return -ENOMEM;
+
+ if (hsp->doorbell_irq) {
+ err = tegra_hsp_add_doorbells(hsp);
+ if (err < 0) {
+ dev_err(&pdev->dev, "failed to add doorbells: %d\n",
+ err);
+ return err;
+ }
}
- hsp->irq = err;
+ err = mbox_controller_register(&hsp->mbox_db);
+ if (err < 0) {
+ dev_err(&pdev->dev, "failed to register doorbell mailbox: %d\n", err);
+ goto remove_doorbells;
+ }
- hsp->mbox.of_xlate = of_tegra_hsp_xlate;
- hsp->mbox.num_chans = 32;
- hsp->mbox.dev = &pdev->dev;
- hsp->mbox.txdone_irq = false;
- hsp->mbox.txdone_poll = false;
- hsp->mbox.ops = &tegra_hsp_doorbell_ops;
+ /* setup the shared mailbox controller */
+ hsp->mbox_sm.of_xlate = tegra_hsp_sm_xlate;
+ hsp->mbox_sm.num_chans = hsp->num_sm;
+ hsp->mbox_sm.dev = &pdev->dev;
+ hsp->mbox_sm.ops = &tegra_hsp_sm_ops;
- hsp->mbox.chans = devm_kcalloc(&pdev->dev, hsp->mbox.num_chans,
- sizeof(*hsp->mbox.chans),
- GFP_KERNEL);
- if (!hsp->mbox.chans)
+ hsp->mbox_sm.chans = devm_kcalloc(&pdev->dev, hsp->mbox_sm.num_chans,
+ sizeof(*hsp->mbox_sm.chans),
+ GFP_KERNEL);
+ if (!hsp->mbox_sm.chans)
return -ENOMEM;
- err = tegra_hsp_add_doorbells(hsp);
+ if (hsp->shared_irqs) {
+ err = tegra_hsp_add_mailboxes(hsp, &pdev->dev);
+ if (err < 0) {
+ dev_err(&pdev->dev, "failed to add mailboxes: %d\n",
+ err);
+ goto unregister_mbox_db;
+ }
+ }
+
+ err = mbox_controller_register(&hsp->mbox_sm);
if (err < 0) {
- dev_err(&pdev->dev, "failed to add doorbells: %d\n", err);
- return err;
+ dev_err(&pdev->dev, "failed to register shared mailbox: %d\n", err);
+ goto unregister_mbox_db;
}
platform_set_drvdata(pdev, hsp);
- err = mbox_controller_register(&hsp->mbox);
- if (err) {
- dev_err(&pdev->dev, "failed to register mailbox: %d\n", err);
- tegra_hsp_remove_doorbells(hsp);
- return err;
+ if (hsp->doorbell_irq) {
+ err = devm_request_irq(&pdev->dev, hsp->doorbell_irq,
+ tegra_hsp_doorbell_irq, IRQF_NO_SUSPEND,
+ dev_name(&pdev->dev), hsp);
+ if (err < 0) {
+ dev_err(&pdev->dev,
+ "failed to request doorbell IRQ#%u: %d\n",
+ hsp->doorbell_irq, err);
+ goto unregister_mbox_sm;
+ }
}
- err = devm_request_irq(&pdev->dev, hsp->irq, tegra_hsp_doorbell_irq,
- IRQF_NO_SUSPEND, dev_name(&pdev->dev), hsp);
- if (err < 0) {
- dev_err(&pdev->dev, "failed to request IRQ#%u: %d\n",
- hsp->irq, err);
- return err;
+ if (hsp->shared_irqs) {
+ err = tegra_hsp_request_shared_irqs(hsp);
+ if (err < 0)
+ goto unregister_mbox_sm;
}
return 0;
+
+unregister_mbox_sm:
+ mbox_controller_unregister(&hsp->mbox_sm);
+unregister_mbox_db:
+ mbox_controller_unregister(&hsp->mbox_db);
+remove_doorbells:
+ if (hsp->doorbell_irq)
+ tegra_hsp_remove_doorbells(hsp);
+
+ return err;
}
static int tegra_hsp_remove(struct platform_device *pdev)
{
struct tegra_hsp *hsp = platform_get_drvdata(pdev);
- mbox_controller_unregister(&hsp->mbox);
- tegra_hsp_remove_doorbells(hsp);
+ mbox_controller_unregister(&hsp->mbox_sm);
+ mbox_controller_unregister(&hsp->mbox_db);
+
+ if (hsp->doorbell_irq)
+ tegra_hsp_remove_doorbells(hsp);
return 0;
}
@@ -456,10 +825,17 @@ static const struct tegra_hsp_db_map tegra186_hsp_db_map[] = {
static const struct tegra_hsp_soc tegra186_hsp_soc = {
.map = tegra186_hsp_db_map,
+ .has_per_mb_ie = false,
+};
+
+static const struct tegra_hsp_soc tegra194_hsp_soc = {
+ .map = tegra186_hsp_db_map,
+ .has_per_mb_ie = true,
};
static const struct of_device_id tegra_hsp_match[] = {
{ .compatible = "nvidia,tegra186-hsp", .data = &tegra186_hsp_soc },
+ { .compatible = "nvidia,tegra194-hsp", .data = &tegra194_hsp_soc },
{ }
};
--
2.19.1
^ permalink raw reply related
* [PATCH v2 03/10] dt-bindings: tegra186-hsp: Add shared mailboxes
From: Thierry Reding @ 2018-11-12 15:18 UTC (permalink / raw)
To: Thierry Reding, Jassi Brar, Greg Kroah-Hartman, Rob Herring
Cc: devicetree, Mika Liljeberg, Mikko Perttunen, Timo Alho,
linux-serial, Jiri Slaby, linux-tegra, Pekka Pessi, Jon Hunter,
linux-arm-kernel
In-Reply-To: <20181112151853.29289-1-thierry.reding@gmail.com>
From: Mikko Perttunen <mperttunen@nvidia.com>
Shared mailboxes are a mechanism to transport data from one processor in
the system to another. They are bidirectional links with both a producer
and a consumer. Interrupts are used to let the consumer know when data
was written to the mailbox by the producer, and to let the producer know
when the consumer has read the data from the mailbox. These interrupts
are mapped to one or more "shared interrupts". Typically each processor
in the system owns one of these shared interrupts.
Add documentation to the device tree bindings about how clients can use
mailbox specifiers to request a specific shared mailbox and select which
direction they drive. Also document how to specify the shared interrupts
in addition to the existing doorbell interrupt.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- describe in more detail how the mailbox specifiers are constructed
- encode mailbox direction in the device tree mailbox specifier
Rob,
you had already reviewed this and I've kept your tag for now, even
though there have been slight changes in this. If you don't mind taking
another look to verify that the changes I've made are still okay.
Thanks,
Thierry
.../bindings/mailbox/nvidia,tegra186-hsp.txt | 30 +++++++++++++++----
include/dt-bindings/mailbox/tegra186-hsp.h | 11 +++++++
2 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt b/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt
index b99d25fc2f26..ff3eafc5a882 100644
--- a/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt
+++ b/Documentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt
@@ -15,12 +15,15 @@ Required properties:
Array of strings.
one of:
- "nvidia,tegra186-hsp"
+ - "nvidia,tegra194-hsp", "nvidia,tegra186-hsp"
- reg : Offset and length of the register set for the device.
- interrupt-names
Array of strings.
Contains a list of names for the interrupts described by the interrupt
property. May contain the following entries, in any order:
- "doorbell"
+ - "sharedN", where 'N' is a number from zero up to the number of
+ external interrupts supported by the HSP instance minus one.
Users of this binding MUST look up entries in the interrupt property
by name, using this interrupt-names property to do so.
- interrupts
@@ -29,12 +32,29 @@ Required properties:
in a matching order.
- #mbox-cells : Should be 2.
-The mbox specifier of the "mboxes" property in the client node should
-contain two data. The first one should be the HSP type and the second
-one should be the ID that the client is going to use. Those information
-can be found in the following file.
+The mbox specifier of the "mboxes" property in the client node should contain
+two cells. The first cell determines the HSP type and the second cell is used
+to identify the mailbox that the client is going to use.
-- <dt-bindings/mailbox/tegra186-hsp.h>.
+For doorbells, the second cell specifies the index of the doorbell to use.
+
+For shared mailboxes, the second cell is composed of two fields:
+- bits 31..24:
+ A bit mask of flags that further specify how the shared mailbox will be
+ used. Valid flags are:
+ - bit 31:
+ Defines the direction of the mailbox. If set, the mailbox will be used
+ as a producer (i.e. used to send data). If cleared, the mailbox is the
+ consumer of data sent by a producer.
+
+- bits 23.. 0:
+ The index of the shared mailbox to use. The number of available mailboxes
+ may vary by instance of the HSP block and SoC generation.
+
+The following file contains definitions that can be used to construct mailbox
+specifiers:
+
+ <dt-bindings/mailbox/tegra186-hsp.h>
Example:
diff --git a/include/dt-bindings/mailbox/tegra186-hsp.h b/include/dt-bindings/mailbox/tegra186-hsp.h
index bcab5b7ca785..3bdec7a84d35 100644
--- a/include/dt-bindings/mailbox/tegra186-hsp.h
+++ b/include/dt-bindings/mailbox/tegra186-hsp.h
@@ -22,4 +22,15 @@
#define TEGRA_HSP_DB_MASTER_CCPLEX 17
#define TEGRA_HSP_DB_MASTER_BPMP 19
+/*
+ * Shared mailboxes are unidirectional, so the direction needs to be specified
+ * in the device tree.
+ */
+#define TEGRA_HSP_SM_MASK 0x00ffffff
+#define TEGRA_HSP_SM_FLAG_RX (0 << 31)
+#define TEGRA_HSP_SM_FLAG_TX (1 << 31)
+
+#define TEGRA_HSP_SM_RX(x) (TEGRA_HSP_SM_FLAG_RX | ((x) & TEGRA_HSP_SM_MASK))
+#define TEGRA_HSP_SM_TX(x) (TEGRA_HSP_SM_FLAG_TX | ((x) & TEGRA_HSP_SM_MASK))
+
#endif
--
2.19.1
^ permalink raw reply related
* [PATCH v2 02/10] mailbox: Allow multiple controllers per device
From: Thierry Reding @ 2018-11-12 15:18 UTC (permalink / raw)
To: Thierry Reding, Jassi Brar, Greg Kroah-Hartman
Cc: devicetree, Mika Liljeberg, Mikko Perttunen, Timo Alho,
linux-serial, Jiri Slaby, linux-tegra, Pekka Pessi, Jon Hunter,
linux-arm-kernel
In-Reply-To: <20181112151853.29289-1-thierry.reding@gmail.com>
From: Mikko Perttunen <mperttunen@nvidia.com>
Look through the whole controller list when mapping device tree
phandles to controllers instead of stopping at the first one.
Each controller is intended to only contain one kind of mailbox,
but some devices (like Tegra HSP) implement multiple kinds and use
the same device tree node for all of them. As such, we need to allow
multiple mbox_controllers per device tree node.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/mailbox/mailbox.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 0eaf21259874..f34820bcf33c 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -335,7 +335,8 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
list_for_each_entry(mbox, &mbox_cons, node)
if (mbox->dev->of_node == spec.np) {
chan = mbox->of_xlate(mbox, &spec);
- break;
+ if (!IS_ERR(chan))
+ break;
}
of_node_put(spec.np);
--
2.19.1
^ permalink raw reply related
* [PATCH v2 01/10] mailbox: Support blocking transfers in atomic context
From: Thierry Reding @ 2018-11-12 15:18 UTC (permalink / raw)
To: Thierry Reding, Jassi Brar, Greg Kroah-Hartman
Cc: devicetree, Mika Liljeberg, Mikko Perttunen, Timo Alho,
linux-serial, Jiri Slaby, linux-tegra, Pekka Pessi, Jon Hunter,
linux-arm-kernel
In-Reply-To: <20181112151853.29289-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
The mailbox framework supports blocking transfers via completions for
clients that can sleep. In order to support blocking transfers in cases
where the transmission is not permitted to sleep, add a new ->flush()
callback that controller drivers can implement to busy loop until the
transmission has been completed. This will automatically be called when
available and interrupts are disabled for clients that request blocking
transfers.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/mailbox/mailbox.c | 8 ++++++++
include/linux/mailbox_controller.h | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 674b35f402f5..0eaf21259874 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -267,6 +267,14 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)
unsigned long wait;
int ret;
+ if (irqs_disabled() && chan->mbox->ops->flush) {
+ ret = chan->mbox->ops->flush(chan, chan->cl->tx_tout);
+ if (ret < 0)
+ tx_tick(chan, ret);
+
+ return ret;
+ }
+
if (!chan->cl->tx_tout) /* wait forever */
wait = msecs_to_jiffies(3600000);
else
diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h
index 74deadb42d76..2a07d93f781a 100644
--- a/include/linux/mailbox_controller.h
+++ b/include/linux/mailbox_controller.h
@@ -24,6 +24,9 @@ struct mbox_chan;
* transmission of data is reported by the controller via
* mbox_chan_txdone (if it has some TX ACK irq). It must not
* sleep.
+ * @flush: Called when a client requests transmissions to be blocking but
+ * the context doesn't allow sleeping. Typically the controller
+ * will implement a busy loop waiting for the data to flush out.
* @startup: Called when a client requests the chan. The controller
* could ask clients for additional parameters of communication
* to be provided via client's chan_data. This call may
@@ -46,6 +49,7 @@ struct mbox_chan;
*/
struct mbox_chan_ops {
int (*send_data)(struct mbox_chan *chan, void *data);
+ int (*flush)(struct mbox_chan *chan, unsigned long timeout);
int (*startup)(struct mbox_chan *chan);
void (*shutdown)(struct mbox_chan *chan);
bool (*last_tx_done)(struct mbox_chan *chan);
--
2.19.1
^ permalink raw reply related
* [PATCH v2 00/10] serial: Add Tegra Combined UART driver
From: Thierry Reding @ 2018-11-12 15:18 UTC (permalink / raw)
To: Thierry Reding, Jassi Brar, Greg Kroah-Hartman
Cc: devicetree, Mika Liljeberg, Mikko Perttunen, Timo Alho,
linux-serial, Jiri Slaby, linux-tegra, Pekka Pessi, Jon Hunter,
linux-arm-kernel
From: Thierry Reding <treding@nvidia.com>
Hi everyone,
this is a reworked version of Mikko's earlier proposal[0]. I've reworked
the TCU driver itself so that it relies less on global variables as well
as added a Kconfig option to allow the console support to be selected. I
also fixed a couple of issues that manifested themselves as I was moving
towards the IRQ driven mode (TCU was passing a pointer to a local
variable which was getting stored in the mailbox's ring buffer and the
data pointed at was becoming stale by the time the mailbox got around to
dequeue it).
The biggest bulk of the changes is in the mailbox driver. This series
addresses all of Jassi's comments from back at the time. One notable
additional change is that shared mailboxes are now interrupt driven,
which removes the need for polling mode.
Unfortunately there is still an issue because the TCU uses the mailbox
in atomic context for both TTY and console modes, so we get a sleeping-
while-atomic BUG when using mbox_client->tx_block = true in order to
rate-limit mbox_send_message(). In order to work around this, I added a
mechanism to mbox_send_message() that will allow blocking from atomic
context if the mailbox controller implements the new ->flush() callback.
For Tegra HSP shared mailboxes this is done by spinning on the shared
mailbox register until the receiver has marked the mailbox as empty. I
have been running this locally for a couple of days now and it works
perfectly.
Furthermore this series incorporates Mikko's work in progress on
splitting up the mailbox controllers and allowing multiple controllers
to match on the same device tree node during mbox_request_channel().
Last but not least there are no build-time dependencies between the
mailbox and serial drivers, so I think the easiest way to merge this is
if Jassi picks up patches 1-5, Greg takes patches 6 & 7 and I pick up
patches 8-10 into the Tegra tree.
Changes in v2:
- address all of Pekka's comments regarding shared interrupts, registers
that don't exist on Tegra186 and shared mailbox directionality
- add a patch to enable the TCU in the 64-bit ARM default configuration
Thanks,
Thierry
[0]: https://lore.kernel.org/patchwork/project/lkml/list/?series=357641
Mikko Perttunen (5):
mailbox: Allow multiple controllers per device
dt-bindings: tegra186-hsp: Add shared mailboxes
dt-bindings: serial: Add bindings for nvidia,tegra194-tcu
arm64: tegra: Add nodes for TCU on Tegra194
arm64: tegra: Mark TCU as primary serial port on Tegra194 P2888
Thierry Reding (5):
mailbox: Support blocking transfers in atomic context
mailbox: tegra-hsp: Add support for shared mailboxes
mailbox: tegra-hsp: Add suspend/resume support
serial: Add Tegra Combined UART driver
arm64: defconfig: Enable Tegra TCU
.../bindings/mailbox/nvidia,tegra186-hsp.txt | 30 +-
.../bindings/serial/nvidia,tegra194-tcu.txt | 35 ++
.../arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 2 +-
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 38 +-
arch/arm64/configs/defconfig | 1 +
drivers/mailbox/mailbox.c | 11 +-
drivers/mailbox/tegra-hsp.c | 517 +++++++++++++++---
drivers/tty/serial/Kconfig | 22 +
drivers/tty/serial/Makefile | 1 +
drivers/tty/serial/tegra-tcu.c | 299 ++++++++++
include/dt-bindings/mailbox/tegra186-hsp.h | 11 +
include/linux/mailbox_controller.h | 4 +
include/uapi/linux/serial_core.h | 3 +
13 files changed, 903 insertions(+), 71 deletions(-)
create mode 100644 Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.txt
create mode 100644 drivers/tty/serial/tegra-tcu.c
--
2.19.1
^ permalink raw reply
* Re: [PATCH] Add support of TI ICDI to USB simple serial device
From: Johan Hovold @ 2018-11-12 9:17 UTC (permalink / raw)
To: Dashi Cao; +Cc: linux-usb, linux-kernel, linux-serial, Felipe Balbi
In-Reply-To: <20181026113807.20735-1-dscao999@gmail.com>
On Fri, Oct 26, 2018 at 07:38:07PM +0800, Dashi Cao wrote:
> TI In-Circuit Debug Interface (ICDI) is a debugging interface for TI ARM microcontrollers. It has four USB interfaces and the first two of them are presented as standard ACM serial device. The 3rd interface is the debugging interface and it can be driven as a Linux USB simple serial device. With it, debugging sessions and firmware up/down loading are supported on Linux.
Please break your lines at 72 column or so.
And use the common subject prefix (e.g. "USB: serial: add support
of TI ICD...").
> Signed-off-by: Dashi Cao <dscao999@gmail.com>
You never replied to Felipe's question whether you had verified that this
doesn't break OpenOCD?
> ---
> drivers/usb/serial/usb-serial-simple.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
> index 4d0273508043..ae43088b659e 100644
> --- a/drivers/usb/serial/usb-serial-simple.c
> +++ b/drivers/usb/serial/usb-serial-simple.c
> @@ -109,6 +109,11 @@ DEVICE(suunto, SUUNTO_IDS);
> { USB_DEVICE(0x908, 0x0004) }
> DEVICE(siemens_mpi, SIEMENS_IDS);
>
> +/* TI In-Circuit Debug Interface */
> +#define ICDI_IDS() \
> + { USB_DEVICE_INTERFACE_CLASS(0x1cbe, 0x00fd, USB_CLASS_VENDOR_SPEC) }
> +DEVICE(ti_icdi, ICDI_IDS);
Please use a TI_ prefix for ICDI_IDS as well.
Can you post the lsusb -v output (or usb-devices) for the device for
reference?
> +
> /* All of the above structures mushed into two lists */
> static struct usb_serial_driver * const serial_drivers[] = {
> &carelink_device,
> @@ -124,6 +129,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
> &hp4x_device,
> &suunto_device,
> &siemens_mpi_device,
> + &ti_icdi_device,
> NULL
> };
>
> @@ -141,6 +147,7 @@ static const struct usb_device_id id_table[] = {
> HP4X_IDS(),
> SUUNTO_IDS(),
> SIEMENS_IDS(),
> + ICDI_IDS(),
> { },
> };
> MODULE_DEVICE_TABLE(usb, id_table);
Thanks,
Johan
^ permalink raw reply
* Re: [GIT PULL] TTY/Serial fixes for 4.20-rc2
From: pr-tracker-bot @ 2018-11-10 19:35 UTC (permalink / raw)
To: Greg KH
Cc: Linus Torvalds, Jiri Slaby, Stephen Rothwell, Andrew Morton,
linux-kernel, linux-serial
In-Reply-To: <20181110185708.GA13637@kroah.com>
The pull request you sent on Sat, 10 Nov 2018 10:57:08 -0800:
> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tags/tty-4.20-rc2
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e255aee5b66ce4af025e6f77122114c01303b861
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
^ permalink raw reply
* [GIT PULL] TTY/Serial fixes for 4.20-rc2
From: Greg KH @ 2018-11-10 18:57 UTC (permalink / raw)
To: Linus Torvalds
Cc: Jiri Slaby, Stephen Rothwell, Andrew Morton, linux-kernel,
linux-serial
The following changes since commit 0238df646e6224016a45505d2c111a24669ebe21:
Linux 4.19-rc7 (2018-10-07 17:26:02 +0200)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tags/tty-4.20-rc2
for you to fetch changes up to 641a41dbba217ee5bd26abe6be77f8cead9cd00e:
serial: sh-sci: Fix could not remove dev_attr_rx_fifo_timeout (2018-11-09 09:34:50 -0800)
----------------------------------------------------------------
TTY/Serial fixes for 4.20-rc2
Here are some small tty fixes for 4.20-rc2
One of these missed the original 4.19-final release, I missed that I
hadn't done a pull request for it as it was in linux-next and my branch
for a long time, that's my fault.
The others are small, fixing some reported issues and finally fixing the
termios mess for alpha so that glibc has a chance to implement some
missing functionality that has been pending for many years now.
All of these have been in linux-next with no reported issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----------------------------------------------------------------
Geert Uytterhoeven (1):
serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA
H. Peter Anvin (1):
termios, tty/tty_baudrate.c: fix buffer overrun
H. Peter Anvin (Intel) (1):
arch/alpha, termios: implement BOTHER, IBSHIFT and termios2
Mikulas Patocka (1):
vt: fix broken display when running aptitude
Yoshihiro Shimoda (1):
serial: sh-sci: Fix could not remove dev_attr_rx_fifo_timeout
arch/alpha/include/asm/termios.h | 8 +++++++-
arch/alpha/include/uapi/asm/ioctls.h | 5 +++++
arch/alpha/include/uapi/asm/termbits.h | 17 +++++++++++++++++
drivers/tty/serial/sh-sci.c | 8 ++++----
drivers/tty/tty_baudrate.c | 4 ++--
drivers/tty/vt/vt.c | 2 +-
6 files changed, 36 insertions(+), 8 deletions(-)
^ permalink raw reply
* [PATCH V4 1/5] dt-bindings: serial: lpuart: add imx8qxp compatible string
From: A.s. Dong @ 2018-11-10 15:48 UTC (permalink / raw)
To: linux-arm-kernel@lists.infradead.org
Cc: A.s. Dong, Mark Rutland, dongas86@gmail.com,
devicetree@vger.kernel.org, catalin.marinas@arm.com,
will.deacon@arm.com, robh+dt@kernel.org, dl-linux-imx,
kernel@pengutronix.de, linux-serial@vger.kernel.org,
Fabio Estevam, shawnguo@kernel.org
In-Reply-To: <1541864596-15958-1-git-send-email-aisheng.dong@nxp.com>
Add imx8qxp compatible string
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-serial@vger.kernel.org
Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
Documentation/devicetree/bindings/serial/fsl-lpuart.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
index 6bd3f2e..21483ba 100644
--- a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
+++ b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt
@@ -8,6 +8,8 @@ Required properties:
on LS1021A SoC with 32-bit big-endian register organization
- "fsl,imx7ulp-lpuart" for lpuart compatible with the one integrated
on i.MX7ULP SoC with 32-bit little-endian register organization
+ - "fsl,imx8qxp-lpuart" for lpuart compatible with the one integrated
+ on i.MX8QXP SoC with 32-bit little-endian register organization
- reg : Address and length of the register set for the device
- interrupts : Should contain uart interrupt
- clocks : phandle + clock specifier pairs, one for each entry in clock-names
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v2 0/5] serial: Finish sysrq on qcom_geni; fix sysrq vs. lockdep on 8250
From: Greg Kroah-Hartman @ 2018-11-09 17:07 UTC (permalink / raw)
To: Douglas Anderson
Cc: dan.carpenter, vigneshr, linux-aspeed, andrew, linux-arm-msm,
tony, joel, linux-serial, Jiri Slaby, andriy.shevchenko,
linux-arm-kernel, jk
In-Reply-To: <20181030221107.79758-1-dianders@chromium.org>
On Tue, Oct 30, 2018 at 03:11:02PM -0700, Douglas Anderson wrote:
> I started out this series trying to make sysrq work over the serial
> console on qcom_geni_serial, then fell into a rat's nest.
>
> To solve the deadlock I faced when enabling sysrq I tried to borrow
> code from '8250_port.c' which avoided grabbing the port lock in
> console_write(). ...but since these days I try to run with lockdep on
> all the time, I found it caused an annoying lockdep splat (which I
> also reproduced on my rk3399 board). ...so I instead changed my
> qcom_geni_serial solution to borrow code from 'msm_serial.c'
>
> I wasn't super happy with the solution in 'msm_serial.c' though. I
> don't like releasing the spinlock there. Not only is it ugly but it
> means we are unlocking / re-locking _all the time_ even though sysrq
> characters are rare. ...so I came up with what I think is a better
> solution and then implemented it for qcom_geni_serial.
>
> Since I had a good way to test 8250-based UARTs, I also fixed that
> driver to use my new method. When doing so, I ran into a missing
> include in serial_core.h. NOTE: I didn't have a way to test
> msm_serial.c at all, so I didn't switch that (or all other serial
> drivers for that matter) to the new method.
>
> NOTE: from a serial point of view v2 is the same as v1 but I've
> removed the extra kgdb-related patches and made it obvious that this
> is really for all sysrq, not just kgdb. I've also generally tried to
> curate the CCs more properly.
Looks good, thanks for cleaning this up. All now queued up.
greg k-h
^ permalink raw reply
* Re: [PATCH 7/9] serial: Add Tegra Combined UART driver
From: Greg Kroah-Hartman @ 2018-11-09 17:05 UTC (permalink / raw)
To: Thierry Reding
Cc: Jassi Brar, Jiri Slaby, Mikko Perttunen, Jon Hunter, Timo Alho,
Pekka Pessi, Mika Liljeberg, linux-tegra, linux-serial,
devicetree, linux-arm-kernel, linux-kernel
In-Reply-To: <20181026111638.10759-8-thierry.reding@gmail.com>
On Fri, Oct 26, 2018 at 01:16:36PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> The Tegra Combined UART (TCU) is a mailbox-based mechanism that allows
> multiplexing multiple "virtual UARTs" into a single hardware serial
> port. The TCU is the primary serial port on Tegra194 devices.
>
> Add a TCU driver utilizing the mailbox framework, as the used mailboxes
> are part of Tegra HSP blocks that are already controlled by the Tegra
> HSP mailbox driver.
>
> Based on work by Mikko Perttunen <mperttunen@nvidia.com>.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply
* Re: [PATCH v3 1/1] serial: imx - Add dma buffer confugration via sysfs
From: Greg KH @ 2018-11-09 17:02 UTC (permalink / raw)
To: Fabien Lahoudere; +Cc: linux-kernel, linux-serial
In-Reply-To: <1539764425.3694.1.camel@collabora.com>
On Wed, Oct 17, 2018 at 10:20:25AM +0200, Fabien Lahoudere wrote:
> Hi Greg,
>
> On Mon, 2018-10-15 at 16:01 +0200, Greg KH wrote:
> > On Thu, Oct 11, 2018 at 11:25:03AM +0200, Fabien Lahoudere wrote:
> > > In order to optimize serial communication on imx53 and imx6, we may
> > > need to tweak DMA period and buffer length per period.
> >
> > Why can you not just automatically determine this information? What is
> > userspace going to know that the kernel can not just learn now?
> >
> > Having tunables is nice, but it is even better to not need them at all.
>
> I agree that it is better to let the kernel do the configuration.
Great!
> However in our case we use several serial communication for different device
> and one of them need to tweak that configuration to get small data with a better
> period. However having this parameter for all serial port implies a bigger number
> of interrupts for others too.
Why can you not dynamically figure this out? How are you figuring it
out "by hand" today in userspace?
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH 2/2] tty: serial: add driver for the SiFive UART
From: Greg Kroah-Hartman @ 2018-11-09 17:00 UTC (permalink / raw)
To: Paul Walmsley
Cc: linux-serial, Jiri Slaby, Palmer Dabbelt, Wesley Terpstra,
linux-riscv, linux-kernel, Paul Walmsley
In-Reply-To: <20181109165951.GA13927@kroah.com>
On Fri, Nov 09, 2018 at 08:59:51AM -0800, Greg Kroah-Hartman wrote:
> On Thu, Oct 18, 2018 at 04:43:54PM -0700, Paul Walmsley wrote:
> > Add a serial driver for the SiFive UART, found on SiFive FU540 devices
> > (among others).
> >
> > The underlying serial IP block is relatively basic, and currently does
> > not support serial break detection. Further information on the IP
> > block can be found in the documentation and Chisel sources:
> >
> > https://static.dev.sifive.com/FU540-C000-v1.0.pdf
> >
> > https://github.com/sifive/sifive-blocks/tree/master/src/main/scala/devices/uart
> >
> > This driver was written in collaboration with Wesley Terpstra
> > <wesley@sifive.com>.
> >
> > Boot-tested on a SiFive HiFive Unleashed A00 board.
> >
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Jiri Slaby <jslaby@suse.com>
> > Cc: Palmer Dabbelt <palmer@sifive.com>
> > Cc: Wesley Terpstra <wesley@sifive.com>
> > Cc: linux-serial@vger.kernel.org
> > Cc: linux-riscv@lists.infradead.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
> > Signed-off-by: Paul Walmsley <paul@pwsan.com>
> > ---
> > drivers/tty/serial/Kconfig | 24 +
> > drivers/tty/serial/Makefile | 1 +
> > drivers/tty/serial/sifive.c | 1070 ++++++++++++++++++++++++++++++
> > include/uapi/linux/serial_core.h | 3 +
> > 4 files changed, 1098 insertions(+)
> > create mode 100644 drivers/tty/serial/sifive.c
>
> Seems like the 0-day bot did not like this driver, can you fix up those
> build errors and resend?
Nevermind, you did, sorry about that...
^ permalink raw reply
* Re: [PATCH 2/2] tty: serial: add driver for the SiFive UART
From: Greg Kroah-Hartman @ 2018-11-09 16:59 UTC (permalink / raw)
To: Paul Walmsley
Cc: linux-serial, Jiri Slaby, Palmer Dabbelt, Wesley Terpstra,
linux-riscv, linux-kernel, Paul Walmsley
In-Reply-To: <20181018234352.26788-3-paul.walmsley@sifive.com>
On Thu, Oct 18, 2018 at 04:43:54PM -0700, Paul Walmsley wrote:
> Add a serial driver for the SiFive UART, found on SiFive FU540 devices
> (among others).
>
> The underlying serial IP block is relatively basic, and currently does
> not support serial break detection. Further information on the IP
> block can be found in the documentation and Chisel sources:
>
> https://static.dev.sifive.com/FU540-C000-v1.0.pdf
>
> https://github.com/sifive/sifive-blocks/tree/master/src/main/scala/devices/uart
>
> This driver was written in collaboration with Wesley Terpstra
> <wesley@sifive.com>.
>
> Boot-tested on a SiFive HiFive Unleashed A00 board.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.com>
> Cc: Palmer Dabbelt <palmer@sifive.com>
> Cc: Wesley Terpstra <wesley@sifive.com>
> Cc: linux-serial@vger.kernel.org
> Cc: linux-riscv@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
> Signed-off-by: Paul Walmsley <paul@pwsan.com>
> ---
> drivers/tty/serial/Kconfig | 24 +
> drivers/tty/serial/Makefile | 1 +
> drivers/tty/serial/sifive.c | 1070 ++++++++++++++++++++++++++++++
> include/uapi/linux/serial_core.h | 3 +
> 4 files changed, 1098 insertions(+)
> create mode 100644 drivers/tty/serial/sifive.c
Seems like the 0-day bot did not like this driver, can you fix up those
build errors and resend?
thanks,
greg k-h
^ permalink raw reply
* Re: [LINUX PATCHv3 0/9] serial-uartlite: Add support for dynamic allocation
From: Greg KH @ 2018-11-09 16:45 UTC (permalink / raw)
To: shubhrajyoti.datta
Cc: linux-serial, linux-kernel, jslaby, jacmet, Shubhrajyoti Datta
In-Reply-To: <1539685088-13465-1-git-send-email-shubhrajyoti.datta@gmail.com>
On Tue, Oct 16, 2018 at 03:47:59PM +0530, shubhrajyoti.datta@gmail.com wrote:
> From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>
> Currently the number of uarts are configured through a Kconfig
> option Make it dynamic.
> While at it adapt to the runtime framework.
>
> It is based a similar series on the uartps from Michal
I've applied the first 5, can you fix up the rest and resend so that
they do not cause build breakage at any point?
thanks,
greg k-h
^ permalink raw reply
* [PATCH 3.18 064/144] serial: samsung: Add the support for Exynos5433 SoC
From: Greg Kroah-Hartman @ 2018-11-08 21:50 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, stable, Jiri Slaby, linux-serial,
Chanwoo Choi, Inki Dae, Geunsik Lim, Sasha Levin
In-Reply-To: <20181108215054.826084593@linuxfoundation.org>
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 31ec77aca72ee5920ed3ec3d047734dc0bc43342 ]
This patch adds new s3c24xx_serial_drv_data structure for Exynos5433 SoC
because Exynos5433 has different fifo size from existing Exynos4 SoC.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: linux-serial@vger.kernel.org
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Geunsik Lim <geunsik.lim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/samsung.c | 56 +++++++++++++++++++++++-------------
1 file changed, 36 insertions(+), 20 deletions(-)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index ba59a76edc8b..957992ceba0a 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1785,32 +1785,43 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = {
#endif
#if defined(CONFIG_ARCH_EXYNOS)
+#define EXYNOS_COMMON_SERIAL_DRV_DATA \
+ .info = &(struct s3c24xx_uart_info) { \
+ .name = "Samsung Exynos UART", \
+ .type = PORT_S3C6400, \
+ .has_divslot = 1, \
+ .rx_fifomask = S5PV210_UFSTAT_RXMASK, \
+ .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, \
+ .rx_fifofull = S5PV210_UFSTAT_RXFULL, \
+ .tx_fifofull = S5PV210_UFSTAT_TXFULL, \
+ .tx_fifomask = S5PV210_UFSTAT_TXMASK, \
+ .tx_fifoshift = S5PV210_UFSTAT_TXSHIFT, \
+ .def_clk_sel = S3C2410_UCON_CLKSEL0, \
+ .num_clks = 1, \
+ .clksel_mask = 0, \
+ .clksel_shift = 0, \
+ }, \
+ .def_cfg = &(struct s3c2410_uartcfg) { \
+ .ucon = S5PV210_UCON_DEFAULT, \
+ .ufcon = S5PV210_UFCON_DEFAULT, \
+ .has_fracval = 1, \
+ } \
+
static struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = {
- .info = &(struct s3c24xx_uart_info) {
- .name = "Samsung Exynos4 UART",
- .type = PORT_S3C6400,
- .has_divslot = 1,
- .rx_fifomask = S5PV210_UFSTAT_RXMASK,
- .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT,
- .rx_fifofull = S5PV210_UFSTAT_RXFULL,
- .tx_fifofull = S5PV210_UFSTAT_TXFULL,
- .tx_fifomask = S5PV210_UFSTAT_TXMASK,
- .tx_fifoshift = S5PV210_UFSTAT_TXSHIFT,
- .def_clk_sel = S3C2410_UCON_CLKSEL0,
- .num_clks = 1,
- .clksel_mask = 0,
- .clksel_shift = 0,
- },
- .def_cfg = &(struct s3c2410_uartcfg) {
- .ucon = S5PV210_UCON_DEFAULT,
- .ufcon = S5PV210_UFCON_DEFAULT,
- .has_fracval = 1,
- },
+ EXYNOS_COMMON_SERIAL_DRV_DATA,
.fifosize = { 256, 64, 16, 16 },
};
+
+static struct s3c24xx_serial_drv_data exynos5433_serial_drv_data = {
+ EXYNOS_COMMON_SERIAL_DRV_DATA,
+ .fifosize = { 64, 256, 16, 256 },
+};
+
#define EXYNOS4210_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos4210_serial_drv_data)
+#define EXYNOS5433_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos5433_serial_drv_data)
#else
#define EXYNOS4210_SERIAL_DRV_DATA (kernel_ulong_t)NULL
+#define EXYNOS5433_SERIAL_DRV_DATA (kernel_ulong_t)NULL
#endif
static struct platform_device_id s3c24xx_serial_driver_ids[] = {
@@ -1832,6 +1843,9 @@ static struct platform_device_id s3c24xx_serial_driver_ids[] = {
}, {
.name = "exynos4210-uart",
.driver_data = EXYNOS4210_SERIAL_DRV_DATA,
+ }, {
+ .name = "exynos5433-uart",
+ .driver_data = EXYNOS5433_SERIAL_DRV_DATA,
},
{ },
};
@@ -1851,6 +1865,8 @@ static const struct of_device_id s3c24xx_uart_dt_match[] = {
.data = (void *)S5PV210_SERIAL_DRV_DATA },
{ .compatible = "samsung,exynos4210-uart",
.data = (void *)EXYNOS4210_SERIAL_DRV_DATA },
+ { .compatible = "samsung,exynos5433-uart",
+ .data = (void *)EXYNOS5433_SERIAL_DRV_DATA },
{},
};
MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match);
--
2.17.1
^ permalink raw reply related
* patch "arch/alpha, termios: implement BOTHER, IBSHIFT and termios2" added to tty-linus
From: gregkh @ 2018-11-08 13:32 UTC (permalink / raw)
To: hpa, alan, esyr, gregkh, ink, johan, jslaby, kstewart,
linux-alpha, linux-serial, mattst88, pombredanne, rth, stable,
tglx, viro
This is a note to let you know that I've just added the patch titled
arch/alpha, termios: implement BOTHER, IBSHIFT and termios2
to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
>From d0ffb805b729322626639336986bc83fc2e60871 Mon Sep 17 00:00:00 2001
From: "H. Peter Anvin (Intel)" <hpa@zytor.com>
Date: Mon, 22 Oct 2018 09:19:05 -0700
Subject: arch/alpha, termios: implement BOTHER, IBSHIFT and termios2
Alpha has had c_ispeed and c_ospeed, but still set speeds in c_cflags
using arbitrary flags. Because BOTHER is not defined, the general
Linux code doesn't allow setting arbitrary baud rates, and because
CBAUDEX == 0, we can have an array overrun of the baud_rate[] table in
drivers/tty/tty_baudrate.c if (c_cflags & CBAUD) == 037.
Resolve both problems by #defining BOTHER to 037 on Alpha.
However, userspace still needs to know if setting BOTHER is actually
safe given legacy kernels (does anyone actually care about that on
Alpha anymore?), so enable the TCGETS2/TCSETS*2 ioctls on Alpha, even
though they use the same structure. Define struct termios2 just for
compatibility; it is the exact same structure as struct termios. In a
future patchset, this will be cleaned up so the uapi headers are
usable from libc.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Eugene Syromiatnikov <esyr@redhat.com>
Cc: <linux-alpha@vger.kernel.org>
Cc: <linux-serial@vger.kernel.org>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/alpha/include/asm/termios.h | 8 +++++++-
arch/alpha/include/uapi/asm/ioctls.h | 5 +++++
arch/alpha/include/uapi/asm/termbits.h | 17 +++++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/arch/alpha/include/asm/termios.h b/arch/alpha/include/asm/termios.h
index 6a8c53dec57e..b7c77bb1bfd2 100644
--- a/arch/alpha/include/asm/termios.h
+++ b/arch/alpha/include/asm/termios.h
@@ -73,9 +73,15 @@
})
#define user_termios_to_kernel_termios(k, u) \
- copy_from_user(k, u, sizeof(struct termios))
+ copy_from_user(k, u, sizeof(struct termios2))
#define kernel_termios_to_user_termios(u, k) \
+ copy_to_user(u, k, sizeof(struct termios2))
+
+#define user_termios_to_kernel_termios_1(k, u) \
+ copy_from_user(k, u, sizeof(struct termios))
+
+#define kernel_termios_to_user_termios_1(u, k) \
copy_to_user(u, k, sizeof(struct termios))
#endif /* _ALPHA_TERMIOS_H */
diff --git a/arch/alpha/include/uapi/asm/ioctls.h b/arch/alpha/include/uapi/asm/ioctls.h
index 3729d92d3fa8..dc8c20ac7191 100644
--- a/arch/alpha/include/uapi/asm/ioctls.h
+++ b/arch/alpha/include/uapi/asm/ioctls.h
@@ -32,6 +32,11 @@
#define TCXONC _IO('t', 30)
#define TCFLSH _IO('t', 31)
+#define TCGETS2 _IOR('T', 42, struct termios2)
+#define TCSETS2 _IOW('T', 43, struct termios2)
+#define TCSETSW2 _IOW('T', 44, struct termios2)
+#define TCSETSF2 _IOW('T', 45, struct termios2)
+
#define TIOCSWINSZ _IOW('t', 103, struct winsize)
#define TIOCGWINSZ _IOR('t', 104, struct winsize)
#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
diff --git a/arch/alpha/include/uapi/asm/termbits.h b/arch/alpha/include/uapi/asm/termbits.h
index de6c8360fbe3..4575ba34a0ea 100644
--- a/arch/alpha/include/uapi/asm/termbits.h
+++ b/arch/alpha/include/uapi/asm/termbits.h
@@ -26,6 +26,19 @@ struct termios {
speed_t c_ospeed; /* output speed */
};
+/* Alpha has identical termios and termios2 */
+
+struct termios2 {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_cc[NCCS]; /* control characters */
+ cc_t c_line; /* line discipline (== c_cc[19]) */
+ speed_t c_ispeed; /* input speed */
+ speed_t c_ospeed; /* output speed */
+};
+
/* Alpha has matching termios and ktermios */
struct ktermios {
@@ -152,6 +165,7 @@ struct ktermios {
#define B3000000 00034
#define B3500000 00035
#define B4000000 00036
+#define BOTHER 00037
#define CSIZE 00001400
#define CS5 00000000
@@ -169,6 +183,9 @@ struct ktermios {
#define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */
+#define CIBAUD 07600000
+#define IBSHIFT 16
+
/* c_lflag bits */
#define ISIG 0x00000080
#define ICANON 0x00000100
--
2.19.1
^ permalink raw reply related
* Re: [PATCH] serial: sh-sci: Document r8a774a1 bindings
From: Simon Horman @ 2018-11-08 12:25 UTC (permalink / raw)
To: Fabrizio Castro
Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland, linux-serial,
devicetree, linux-kernel, Geert Uytterhoeven, Chris Paterson,
Biju Das, linux-renesas-soc
In-Reply-To: <1534250042-15815-1-git-send-email-fabrizio.castro@bp.renesas.com>
On Tue, Aug 14, 2018 at 01:34:02PM +0100, Fabrizio Castro wrote:
> RZ/G2M (R8A774A1) SoC also has the R-Car Gen3 compatible SCIF and
> HSCIF ports, so document the SoC specific bindings. While at it,
> update the RZ/G1 and RZ/G2 family specific strings description as
> outdated.
>
> Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
^ permalink raw reply
* RE: [PATCH] serial: sh-sci: Document r8a774a1 bindings
From: Fabrizio Castro @ 2018-11-08 11:19 UTC (permalink / raw)
To: Fabrizio Castro, Greg Kroah-Hartman, Rob Herring, Mark Rutland
Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Simon Horman, Geert Uytterhoeven,
Chris Paterson, Biju Das, linux-renesas-soc@vger.kernel.org
In-Reply-To: <1534250042-15815-1-git-send-email-fabrizio.castro@bp.renesas.com>
Dear All,
This is just a gentle reminder.
Thanks,
Fab
> From: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> Sent: 14 August 2018 13:34
> Subject: [PATCH] serial: sh-sci: Document r8a774a1 bindings
>
> RZ/G2M (R8A774A1) SoC also has the R-Car Gen3 compatible SCIF and
> HSCIF ports, so document the SoC specific bindings. While at it,
> update the RZ/G1 and RZ/G2 family specific strings description as
> outdated.
>
> Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das@bp.renesas.com>
> ---
> .../devicetree/bindings/serial/renesas,sci-serial.txt | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt b/Documentation/devicetree/bindings/serial/renesas,sci-
> serial.txt
> index eaca9da..1994ab8 100644
> --- a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
> +++ b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
> @@ -20,6 +20,8 @@ Required properties:
> - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible UART.
> - "renesas,scif-r8a77470" for R8A77470 (RZ/G1C) SCIF compatible UART.
> - "renesas,hscif-r8a77470" for R8A77470 (RZ/G1C) HSCIF compatible UART.
> + - "renesas,scif-r8a774a1" for R8A774A1 (RZ/G2M) SCIF compatible UART.
> + - "renesas,hscif-r8a774a1" for R8A774A1 (RZ/G2M) HSCIF compatible UART.
> - "renesas,scif-r8a7778" for R8A7778 (R-Car M1) SCIF compatible UART.
> - "renesas,scif-r8a7779" for R8A7779 (R-Car H1) SCIF compatible UART.
> - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART.
> @@ -55,13 +57,13 @@ Required properties:
> - "renesas,scifa-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFA compatible UART.
> - "renesas,scifb-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFB compatible UART.
> - "renesas,rcar-gen1-scif" for R-Car Gen1 SCIF compatible UART,
> - - "renesas,rcar-gen2-scif" for R-Car Gen2 SCIF compatible UART,
> - - "renesas,rcar-gen3-scif" for R-Car Gen3 SCIF compatible UART,
> - - "renesas,rcar-gen2-scifa" for R-Car Gen2 SCIFA compatible UART,
> - - "renesas,rcar-gen2-scifb" for R-Car Gen2 SCIFB compatible UART,
> + - "renesas,rcar-gen2-scif" for R-Car Gen2 and RZ/G1 SCIF compatible UART,
> + - "renesas,rcar-gen3-scif" for R-Car Gen3 and RZ/G2 SCIF compatible UART,
> + - "renesas,rcar-gen2-scifa" for R-Car Gen2 and RZ/G1 SCIFA compatible UART,
> + - "renesas,rcar-gen2-scifb" for R-Car Gen2 and RZ/G1 SCIFB compatible UART,
> - "renesas,rcar-gen1-hscif" for R-Car Gen1 HSCIF compatible UART,
> - - "renesas,rcar-gen2-hscif" for R-Car Gen2 HSCIF compatible UART,
> - - "renesas,rcar-gen3-hscif" for R-Car Gen3 HSCIF compatible UART,
> + - "renesas,rcar-gen2-hscif" for R-Car Gen2 and RZ/G1 HSCIF compatible UART,
> + - "renesas,rcar-gen3-hscif" for R-Car Gen3 and RZ/G2 HSCIF compatible UART,
> - "renesas,scif" for generic SCIF compatible UART.
> - "renesas,scifa" for generic SCIFA compatible UART.
> - "renesas,scifb" for generic SCIFB compatible UART.
> --
> 2.7.4
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
^ permalink raw reply
* Re: [PATCH v2 0/5] serial: Finish sysrq on qcom_geni; fix sysrq vs. lockdep on 8250
From: Petr Mladek @ 2018-11-08 9:41 UTC (permalink / raw)
To: Doug Anderson
Cc: Dan Carpenter, vigneshr, linux-aspeed, sergey.senozhatsky,
Andrew Jeffery, Greg Kroah-Hartman, linux-arm-msm, Steven Rostedt,
Tony Lindgren, joel, linux-serial, Jiri Slaby, Andy Shevchenko,
Linux ARM, Jeremy Kerr
In-Reply-To: <CAD=FV=Xyra4+cLB0J64+SWqCF=YKdEJpAuybQboYxOcfrdTeQg@mail.gmail.com>
On Wed 2018-11-07 11:26:56, Doug Anderson wrote:
> On Wed, Nov 7, 2018 at 10:23 AM Andy Shevchenko
> Ah! Based on who you added to the CC list I guess you meant to CC
> "printk" folks?
>
> PRINTK
> M: Petr Mladek <pmladek@suse.com>
> M: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> R: Steven Rostedt <rostedt@goodmis.org>
> S: Maintained
> F: kernel/printk/
> F: include/linux/printk.h
>
>
> I'd be happy to CC those folks on future spins (if there are any).
> I'm not convinced that these patches are directly relevant to the
> printk subsystem, but I'm always happy for more people to have a
> chance to review patches.
I, as a printk maintainer, am not completely familiar with all
the console driver problems. But we, printk maintainers, come
to similar deadlocks from the printk side, so we are definitely
interested into this kind of patches.
BTW: There was an attempt to avoid the console_unlock() related
deadlocks a more generic way, see
https://lore.kernel.org/lkml/20181016050428.17966-1-sergey.senozhatsky@gmail.com
Unfortunately, there is some push back against introducing a new
printk-related-locking API.
> Hopefully anyone who needs this patch can find it on one of the
> relevant mailing lists. I screwed up and missed LKML this time
> around, but there are plenty of other mailing lists here that it could
> be found on. If requested I'm also happy to re-post the same series
> adding those 3 people if that's what everyone wants.
I have glanced over the patches via
https://www.spinics.net/lists/linux-arm-msm/msg44083.html
I still have to think about it. I will be traveling next week
so it might take some time.
Anyway, please CC printk people into v2 if any.
Best Reagards,
Petr
^ permalink raw reply
* Re: [PATCH v2 0/5] serial: Finish sysrq on qcom_geni; fix sysrq vs. lockdep on 8250
From: Andy Shevchenko @ 2018-11-07 19:54 UTC (permalink / raw)
To: Doug Anderson
Cc: pmladek, vigneshr, linux-aspeed, sergey.senozhatsky,
Andrew Jeffery, Greg Kroah-Hartman, linux-arm-msm, Steven Rostedt,
Tony Lindgren, joel, linux-serial, Jiri Slaby, Dan Carpenter,
Linux ARM, Jeremy Kerr
In-Reply-To: <CAD=FV=Xyra4+cLB0J64+SWqCF=YKdEJpAuybQboYxOcfrdTeQg@mail.gmail.com>
On Wed, Nov 07, 2018 at 11:26:56AM -0800, Doug Anderson wrote:
> Hi,
>
> On Wed, Nov 7, 2018 at 10:23 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Tue, Oct 30, 2018 at 03:11:02PM -0700, Douglas Anderson wrote:
> > > I started out this series trying to make sysrq work over the serial
> > > console on qcom_geni_serial, then fell into a rat's nest.
> > >
> > > To solve the deadlock I faced when enabling sysrq I tried to borrow
> > > code from '8250_port.c' which avoided grabbing the port lock in
> > > console_write(). ...but since these days I try to run with lockdep on
> > > all the time, I found it caused an annoying lockdep splat (which I
> > > also reproduced on my rk3399 board). ...so I instead changed my
> > > qcom_geni_serial solution to borrow code from 'msm_serial.c'
> > >
> > > I wasn't super happy with the solution in 'msm_serial.c' though. I
> > > don't like releasing the spinlock there. Not only is it ugly but it
> > > means we are unlocking / re-locking _all the time_ even though sysrq
> > > characters are rare. ...so I came up with what I think is a better
> > > solution and then implemented it for qcom_geni_serial.
> > >
> > > Since I had a good way to test 8250-based UARTs, I also fixed that
> > > driver to use my new method. When doing so, I ran into a missing
> > > include in serial_core.h. NOTE: I didn't have a way to test
> > > msm_serial.c at all, so I didn't switch that (or all other serial
> > > drivers for that matter) to the new method.
> > >
> > > NOTE: from a serial point of view v2 is the same as v1 but I've
> > > removed the extra kgdb-related patches and made it obvious that this
> > > is really for all sysrq, not just kgdb. I've also generally tried to
> > > curate the CCs more properly.
> >
> > It seems your forgot console people to Cc.
>
> Can you be more specific, please? Which section of the "MAINTAINERS"
> file should I be looking at for the "console" you are thinking of?
I have added them to Cc list: Petr, Sergey, and Steven.
> Certainly there are lots of hits for "console" in MAINTAINERS but I
> don't think I see any that are relevant that I missed. Grepping:
> Ah! Based on who you added to the CC list I guess you meant to CC
> "printk" folks?
Correct.
> PRINTK
> M: Petr Mladek <pmladek@suse.com>
> M: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> R: Steven Rostedt <rostedt@goodmis.org>
> S: Maintained
> F: kernel/printk/
> F: include/linux/printk.h
> I'd be happy to CC those folks on future spins (if there are any).
> I'm not convinced that these patches are directly relevant to the
> printk subsystem, but I'm always happy for more people to have a
> chance to review patches.
If you look retrospectively in the mailing lists, you can find that they are
doing most of the console core work, which I believe includes SysRq behaviour.
So, don't be confused their names are listed under PRINTK.
> Hopefully anyone who needs this patch can find it on one of the
> relevant mailing lists. I screwed up and missed LKML this time
> around, but there are plenty of other mailing lists here that it could
> be found on. If requested I'm also happy to re-post the same series
> adding those 3 people if that's what everyone wants.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v2 0/5] serial: Finish sysrq on qcom_geni; fix sysrq vs. lockdep on 8250
From: Doug Anderson @ 2018-11-07 19:26 UTC (permalink / raw)
To: Andy Shevchenko
Cc: pmladek, vigneshr, linux-aspeed, sergey.senozhatsky,
Andrew Jeffery, Greg Kroah-Hartman, linux-arm-msm, Steven Rostedt,
Tony Lindgren, joel, linux-serial, Jiri Slaby, Dan Carpenter,
Linux ARM, Jeremy Kerr
In-Reply-To: <20181107182349.GP10650@smile.fi.intel.com>
Hi,
On Wed, Nov 7, 2018 at 10:23 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Tue, Oct 30, 2018 at 03:11:02PM -0700, Douglas Anderson wrote:
> > I started out this series trying to make sysrq work over the serial
> > console on qcom_geni_serial, then fell into a rat's nest.
> >
> > To solve the deadlock I faced when enabling sysrq I tried to borrow
> > code from '8250_port.c' which avoided grabbing the port lock in
> > console_write(). ...but since these days I try to run with lockdep on
> > all the time, I found it caused an annoying lockdep splat (which I
> > also reproduced on my rk3399 board). ...so I instead changed my
> > qcom_geni_serial solution to borrow code from 'msm_serial.c'
> >
> > I wasn't super happy with the solution in 'msm_serial.c' though. I
> > don't like releasing the spinlock there. Not only is it ugly but it
> > means we are unlocking / re-locking _all the time_ even though sysrq
> > characters are rare. ...so I came up with what I think is a better
> > solution and then implemented it for qcom_geni_serial.
> >
> > Since I had a good way to test 8250-based UARTs, I also fixed that
> > driver to use my new method. When doing so, I ran into a missing
> > include in serial_core.h. NOTE: I didn't have a way to test
> > msm_serial.c at all, so I didn't switch that (or all other serial
> > drivers for that matter) to the new method.
> >
> > NOTE: from a serial point of view v2 is the same as v1 but I've
> > removed the extra kgdb-related patches and made it obvious that this
> > is really for all sysrq, not just kgdb. I've also generally tried to
> > curate the CCs more properly.
>
> It seems your forgot console people to Cc.
Can you be more specific, please? Which section of the "MAINTAINERS"
file should I be looking at for the "console" you are thinking of?
Certainly there are lots of hits for "console" in MAINTAINERS but I
don't think I see any that are relevant that I missed. Grepping:
$ grep -i console MAINTAINERS
HYPERVISOR VIRTUAL CONSOLE DRIVER
F: drivers/video/console/sti*
PCDP - PRIMARY CONSOLE AND DEBUG PORT
SGI SN-IA64 (Altix) SERIAL CONSOLE DRIVER
STAGING - SPEAKUP CONSOLE SPEECH DRIVER
VIRTIO CONSOLE DRIVER
F: drivers/char/virtio_console.c
F: include/linux/virtio_console.h
F: include/uapi/linux/virtio_console.h
...none of those seem relevant upon first glance but I'm happy to
stand corrected.
Ah! Based on who you added to the CC list I guess you meant to CC
"printk" folks?
PRINTK
M: Petr Mladek <pmladek@suse.com>
M: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
R: Steven Rostedt <rostedt@goodmis.org>
S: Maintained
F: kernel/printk/
F: include/linux/printk.h
I'd be happy to CC those folks on future spins (if there are any).
I'm not convinced that these patches are directly relevant to the
printk subsystem, but I'm always happy for more people to have a
chance to review patches.
Hopefully anyone who needs this patch can find it on one of the
relevant mailing lists. I screwed up and missed LKML this time
around, but there are plenty of other mailing lists here that it could
be found on. If requested I'm also happy to re-post the same series
adding those 3 people if that's what everyone wants.
-Doug
^ permalink raw reply
* Re: [PATCH v2 0/5] serial: Finish sysrq on qcom_geni; fix sysrq vs. lockdep on 8250
From: Andy Shevchenko @ 2018-11-07 18:23 UTC (permalink / raw)
To: Douglas Anderson
Cc: Petr Mladek, vigneshr, linux-aspeed, Sergey Senozhatsky, andrew,
Greg Kroah-Hartman, linux-arm-msm, Steven Rostedt, tony, joel,
linux-serial, Jiri Slaby, dan.carpenter, linux-arm-kernel, jk
In-Reply-To: <20181030221107.79758-1-dianders@chromium.org>
On Tue, Oct 30, 2018 at 03:11:02PM -0700, Douglas Anderson wrote:
> I started out this series trying to make sysrq work over the serial
> console on qcom_geni_serial, then fell into a rat's nest.
>
> To solve the deadlock I faced when enabling sysrq I tried to borrow
> code from '8250_port.c' which avoided grabbing the port lock in
> console_write(). ...but since these days I try to run with lockdep on
> all the time, I found it caused an annoying lockdep splat (which I
> also reproduced on my rk3399 board). ...so I instead changed my
> qcom_geni_serial solution to borrow code from 'msm_serial.c'
>
> I wasn't super happy with the solution in 'msm_serial.c' though. I
> don't like releasing the spinlock there. Not only is it ugly but it
> means we are unlocking / re-locking _all the time_ even though sysrq
> characters are rare. ...so I came up with what I think is a better
> solution and then implemented it for qcom_geni_serial.
>
> Since I had a good way to test 8250-based UARTs, I also fixed that
> driver to use my new method. When doing so, I ran into a missing
> include in serial_core.h. NOTE: I didn't have a way to test
> msm_serial.c at all, so I didn't switch that (or all other serial
> drivers for that matter) to the new method.
>
> NOTE: from a serial point of view v2 is the same as v1 but I've
> removed the extra kgdb-related patches and made it obvious that this
> is really for all sysrq, not just kgdb. I've also generally tried to
> curate the CCs more properly.
It seems your forgot console people to Cc.
>
>
> Douglas Anderson (5):
> serial: qcom_geni_serial: Finish supporting sysrq
> serial: core: Allow processing sysrq at port unlock time
> serial: qcom_geni_serial: Process sysrq at port unlock time
> serial: core: Include console.h from serial_core.h
> serial: 8250: Process sysrq at port unlock time
>
> drivers/tty/serial/8250/8250_aspeed_vuart.c | 6 +++-
> drivers/tty/serial/8250/8250_fsl.c | 6 +++-
> drivers/tty/serial/8250/8250_omap.c | 6 +++-
> drivers/tty/serial/8250/8250_port.c | 8 ++---
> drivers/tty/serial/qcom_geni_serial.c | 10 ++++--
> include/linux/serial_core.h | 38 ++++++++++++++++++++-
> 6 files changed, 63 insertions(+), 11 deletions(-)
>
> --
> 2.19.1.568.g152ad8e336-goog
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH 1/7] serial: qcom_geni_serial: Finish supporting sysrq
From: Stephen Boyd @ 2018-11-02 16:47 UTC (permalink / raw)
To: Daniel Thompson, Jason Wessel, gregkh, mingo, tglx
Cc: linux-arm-msm, kgdb-bugreport, Douglas Anderson, linux-kernel,
linux-serial, jslaby
In-Reply-To: <20181029180707.207546-2-dianders@chromium.org>
Quoting Douglas Anderson (2018-10-29 11:07:01)
> The geni serial driver already had some sysrq code in it, but since
> SUPPORT_SYSRQ wasn't defined the code didn't do anything useful.
> Let's make it useful by adding that define using the same formula
> found in other serial drivers.
>
> In order to prevent deadlock, we'll take a page from the
> 'msm_serial.c' where the spinlock is released around
> uart_handle_sysrq_char(). This seemed better than copying from
> '8250_port.c' where we skip locking in the console_write function
> since the '8250_port.c' method can cause lockdep warnings when
> dropping into kgdb.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Given that it's the same as msm_serial.c, and I wrote the msm_serial.c
"hack" then:
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox