get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/627661/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 627661,
    "url": "http://patchwork.ozlabs.org/api/patches/627661/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1464432715-10996-2-git-send-email-eddy.petrisor@gmail.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1464432715-10996-2-git-send-email-eddy.petrisor@gmail.com>",
    "list_archive_url": null,
    "date": "2016-05-28T10:51:54",
    "name": "[U-Boot,v4,1/2] serial: Introduce linflex uart support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ddcc12e01a9191dec72b49056b9ade56885496be",
    "submitter": {
        "id": 68207,
        "url": "http://patchwork.ozlabs.org/api/people/68207/?format=api",
        "name": "Eddy Petrișor",
        "email": "eddy.petrisor@gmail.com"
    },
    "delegate": {
        "id": 56520,
        "url": "http://patchwork.ozlabs.org/api/users/56520/?format=api",
        "username": "bmeng",
        "first_name": "Bin",
        "last_name": "Meng",
        "email": "bmeng.cn@gmail.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1464432715-10996-2-git-send-email-eddy.petrisor@gmail.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/627661/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/627661/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Received": [
            "from theia.denx.de (theia.denx.de [85.214.87.163])\n\tby ozlabs.org (Postfix) with ESMTP id 3rJ9zY3xSPz9t4b\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 30 May 2016 19:19:05 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id C94C8A7594;\n\tMon, 30 May 2016 11:17:58 +0200 (CEST)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id rqVKoKomwc8Z; Mon, 30 May 2016 11:17:58 +0200 (CEST)",
            "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 222D8A761E;\n\tMon, 30 May 2016 11:16:58 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 49DCDA74BA\n\tfor <u-boot@lists.denx.de>; Sat, 28 May 2016 12:52:32 +0200 (CEST)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id vTcAQUr8pByN for <u-boot@lists.denx.de>;\n\tSat, 28 May 2016 12:52:32 +0200 (CEST)",
            "from mail-wm0-f68.google.com (mail-wm0-f68.google.com\n\t[74.125.82.68])\n\tby theia.denx.de (Postfix) with ESMTPS id 05166A7498\n\tfor <u-boot@lists.denx.de>; Sat, 28 May 2016 12:52:28 +0200 (CEST)",
            "by mail-wm0-f68.google.com with SMTP id e3so6729229wme.2\n\tfor <u-boot@lists.denx.de>; Sat, 28 May 2016 03:52:28 -0700 (PDT)",
            "from localhost.localdomain ([188.25.111.212])\n\tby smtp.gmail.com with ESMTPSA id\n\txz3sm8033413wjb.35.2016.05.28.03.52.26\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSat, 28 May 2016 03:52:27 -0700 (PDT)"
        ],
        "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com header.b=Rc7gIwtg;\n\tdkim-atps=neutral",
        "X-Amavis-Alert": [
            "BAD HEADER SECTION, Duplicate header field: \"References\"",
            "BAD HEADER SECTION, Duplicate header field: \"References\""
        ],
        "X-policyd-weight": "NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5\n\tNOT_IN_BL_NJABL=-1.5 (only DNSBL check requested)",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:in-reply-to:references:mime-version:content-transfer-encoding;\n\tbh=xCynCQ7wBV8vpQXznGhS5weI+f3SpgDM8eBQVepmP3c=;\n\tb=Rc7gIwtgz9MImcsnXzSXmlUwK/4GKNEeI7+Yif4sClFK4DSOzc9oInEeG+yDwCSQ6j\n\tQctbtI/gYmhtraW59/n25jrPc4ogi3cOL6vayFEbEDOeQSGLq956ao5z7Lhu65dGfpUC\n\t6+Lx2EI9dSwRs2mCTj++ovyP8SVh+5kMVC3xHu6vxa4rCX3PefsPBzYUgR9DQTCFxo3L\n\tVPWcoaKDRC53i0ucxgWLHR/glLufD981dnHjd+kL/nzTwyceOkXbfvCEJGod0gUY5dwJ\n\t0A3dZ0GhYj/G5uVpL0V84u6WFbcmtoP3CSX2/yTcZb7Z57LO4SBRVo72duuq+5bZ3FkZ\n\tghZA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:in-reply-to:references:mime-version\n\t:content-transfer-encoding;\n\tbh=xCynCQ7wBV8vpQXznGhS5weI+f3SpgDM8eBQVepmP3c=;\n\tb=KI3UmIMZW8CQI76CnPFgVFgCzP0WAAa3c1U6HC/kO4FJTVeyihP3vhKOwV43LHb7VI\n\tdMecGb+Kx3kESy3LyFImRXURfGUs8glKskkosbfgYB4BpjXth93fKNoGoJAuB9/C8kc/\n\tTDk9AJ/WEd6SWWv996FzwVRRLneLY9e2w70mX3NGyoa5ugygC00rP+oYNjbaxZANeKGV\n\t2IyFi5HSrU0r4yqWdoBuUtxd+p/Ku7hH8OYo6c7Pmf+EOAL/BlCJw0zYWzt4IaJ9Xjf0\n\towvk2afC82csV3fj5w7thd3ungVuximcMct6+QbwdXpiWHpKhryqsmn43U/FQ6y2KTC4\n\tvajQ==",
        "X-Gm-Message-State": "ALyK8tKNgyaDAdIadUh73z7Tn/sCSQjajPkC0nGUDrueKefs4sjW+oUSvPTTQ5UT+NivUw==",
        "X-Received": "by 10.194.133.98 with SMTP id pb2mr18650880wjb.144.1464432748234;\n\tSat, 28 May 2016 03:52:28 -0700 (PDT)",
        "From": "=?UTF-8?q?Eddy=20Petri=C8=99or?= <eddy.petrisor@gmail.com>",
        "To": "U-Boot Mailing List <u-boot@lists.denx.de>",
        "Date": "Sat, 28 May 2016 13:51:54 +0300",
        "Message-Id": "<1464432715-10996-2-git-send-email-eddy.petrisor@gmail.com>",
        "X-Mailer": "git-send-email 2.5.0",
        "In-Reply-To": [
            "<1464432715-10996-1-git-send-email-eddy.petrisor@gmail.com>",
            "<1459642206-20101-1-git-send-email-eddy.petrisor@gmail.com>"
        ],
        "References": [
            "<1464432715-10996-1-git-send-email-eddy.petrisor@gmail.com>",
            "<1459642206-20101-1-git-send-email-eddy.petrisor@gmail.com>\n\t<1459642206-20101-1-git-send-email-eddy.petrisor@gmail.com>\n\t<1461794874-6105-2-git-send-email-eddy.petrisor@nxp.com>\n\t<1464429375-6191-2-git-send-email-eddy.petrisor@gmail.com>"
        ],
        "MIME-Version": "1.0",
        "Cc": "Tom Rini <trini@konsulko.com>,\n\t=?UTF-8?q?Eddy=20Petri=C8=99or?= <eddy.petrisor@gmail.com>,\n\tStoica Cosmin-Stefan <cosminstefan.stoica@freescale.com>",
        "Subject": "[U-Boot] [PATCH v4 1/2] serial: Introduce linflex uart support",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<http://lists.denx.de/mailman/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<http://lists.denx.de/mailman/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>"
    },
    "content": "From: Stoica Cosmin-Stefan <cosminstefan.stoica@freescale.com>\n\nThe Linflex module is integrated on some NXP automotive SoCs part of the former\nFreescale portfolio, like S32V234, an SoC for Advanced Driver Assistance\nSystems.\n\nOriginal-signed-off-by: Stoica Cosmin-Stefan <cosminstefan.stoica@freescale.com>\nOriginal-signed-off-by: Chircu Bogdan <Bogdan.Chircu@freescale.com>\nOriginal-signed-off-by: Depons Eric <eric.depons@freescale.com>\nOriginal-signed-off-by: Eddy Petrișor <eddy.petrisor@gmail.com>\n\nSigned-off-by: Eddy Petrișor <eddy.petrisor@gmail.com>\n---\n\nNotes:\n    Changes in v2:\n    Added support for device model. Compatibility with non-DM code is kept\n    for easier synchronization with the code on the vendor branch where the\n    conversion to DM is not done for all boards.\n    \n    Changes in v3:\n    Removed non-DM compatibility, as requested.\n    \n    Changes in v4:\n    Corrected typo: s/_debUG_uart_init/_debug_uart_init/\n\n drivers/serial/Makefile             |   1 +\n drivers/serial/serial_linflexuart.c | 221 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 222 insertions(+)\n create mode 100644 drivers/serial/serial_linflexuart.c",
    "diff": "diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile\nindex 9def128..c45cf5d 100644\n--- a/drivers/serial/Makefile\n+++ b/drivers/serial/Makefile\n@@ -34,6 +34,7 @@ obj-$(CONFIG_SCIF_CONSOLE) += serial_sh.o\n obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o\n obj-$(CONFIG_BFIN_SERIAL) += serial_bfin.o\n obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o\n+obj-$(CONFIG_FSL_LINFLEXUART) += serial_linflexuart.o\n obj-$(CONFIG_ARC_SERIAL) += serial_arc.o\n obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o\n obj-$(CONFIG_STM32_SERIAL) += serial_stm32.o\ndiff --git a/drivers/serial/serial_linflexuart.c b/drivers/serial/serial_linflexuart.c\nnew file mode 100644\nindex 0000000..2826397\n--- /dev/null\n+++ b/drivers/serial/serial_linflexuart.c\n@@ -0,0 +1,221 @@\n+/*\n+ * (C) Copyright 2013-2016 Freescale Semiconductor, Inc.\n+ *\n+ * SPDX-License-Identifier:     GPL-2.0+\n+ */\n+\n+#include <common.h>\n+#include <dm.h>\n+#include <errno.h>\n+#include <watchdog.h>\n+#include <asm/io.h>\n+#include <serial.h>\n+#include <linux/compiler.h>\n+#include <asm/arch/imx-regs.h>\n+#include <asm/arch/clock.h>\n+\n+#define US1_TDRE            (1 << 7)\n+#define US1_RDRF            (1 << 5)\n+#define UC2_TE              (1 << 3)\n+#define LINCR1_INIT         (1 << 0)\n+#define LINCR1_MME          (1 << 4)\n+#define LINCR1_BF           (1 << 7)\n+#define LINSR_LINS_INITMODE (0x00001000)\n+#define LINSR_LINS_MASK     (0x0000F000)\n+#define UARTCR_UART         (1 << 0)\n+#define UARTCR_WL0          (1 << 1)\n+#define UARTCR_PCE          (1 << 2)\n+#define UARTCR_PC0          (1 << 3)\n+#define UARTCR_TXEN         (1 << 4)\n+#define UARTCR_RXEN         (1 << 5)\n+#define UARTCR_PC1          (1 << 6)\n+#define UARTSR_DTF          (1 << 1)\n+#define UARTSR_DRF          (1 << 2)\n+#define UARTSR_RMB          (1 << 9)\n+\n+DECLARE_GLOBAL_DATA_PTR;\n+\n+#ifndef CONFIG_DM_SERIAL\n+#error \"The linflex serial driver does not have non-DM support.\"\n+#endif\n+\n+static void _linflex_serial_setbrg(struct linflex_fsl *base, int baudrate)\n+{\n+\tu32 clk = mxc_get_clock(MXC_UART_CLK);\n+\tu32 ibr, fbr;\n+\n+\tif (!baudrate)\n+\t\tbaudrate = CONFIG_BAUDRATE;\n+\n+\tibr = (u32) (clk / (16 * gd->baudrate));\n+\tfbr = (u32) (clk % (16 * gd->baudrate)) * 16;\n+\n+\t__raw_writel(ibr, &base->linibrr);\n+\t__raw_writel(fbr, &base->linfbrr);\n+}\n+\n+static int _linflex_serial_getc(struct linflex_fsl *base)\n+{\n+\tchar c;\n+\n+\tif (!(__raw_readb(&base->uartsr) & UARTSR_DRF))\n+\t\treturn -EAGAIN;\n+\n+\tif (!(__raw_readl(&base->uartsr) & UARTSR_RMB))\n+\t\treturn -EAGAIN;\n+\n+\tc = __raw_readl(&base->bdrm);\n+\t__raw_writeb((__raw_readb(&base->uartsr) | (UARTSR_DRF | UARTSR_RMB)),\n+\t\t     &base->uartsr);\n+\treturn c;\n+}\n+\n+static int _linflex_serial_putc(struct linflex_fsl *base, const char c)\n+{\n+\t__raw_writeb(c, &base->bdrl);\n+\n+\n+\tif (!(__raw_readb(&base->uartsr) & UARTSR_DTF))\n+\t\treturn -EAGAIN;\n+\n+\t__raw_writeb((__raw_readb(&base->uartsr) | UARTSR_DTF), &base->uartsr);\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * Initialise the serial port with the given baudrate. The settings\n+ * are always 8 data bits, no parity, 1 stop bit, no start bits.\n+ */\n+static int _linflex_serial_init(struct linflex_fsl *base)\n+{\n+\tvolatile u32 ctrl;\n+\n+\t/* set the Linflex in master mode amd activate by-pass filter */\n+\tctrl = LINCR1_BF | LINCR1_MME;\n+\t__raw_writel(ctrl, &base->lincr1);\n+\n+\t/* init mode */\n+\tctrl |= LINCR1_INIT;\n+\t__raw_writel(ctrl, &base->lincr1);\n+\n+\t/* waiting for init mode entry - TODO: add a timeout */\n+\twhile ((__raw_readl(&base->linsr) & LINSR_LINS_MASK) !=\n+\t       LINSR_LINS_INITMODE);\n+\n+\t/* set UART bit to allow writing other bits */\n+\t__raw_writel(UARTCR_UART, &base->uartcr);\n+\n+\t/* provide data bits, parity, stop bit, etc */\n+\tserial_setbrg();\n+\n+\t/* 8 bit data, no parity, Tx and Rx enabled, UART mode */\n+\t__raw_writel(UARTCR_PC1 | UARTCR_RXEN | UARTCR_TXEN | UARTCR_PC0\n+\t\t     | UARTCR_WL0 | UARTCR_UART, &base->uartcr);\n+\n+\tctrl = __raw_readl(&base->lincr1);\n+\tctrl &= ~LINCR1_INIT;\n+\t__raw_writel(ctrl, &base->lincr1);\t/* end init mode */\n+\n+\treturn 0;\n+}\n+\n+struct linflex_serial_platdata {\n+\tstruct linflex_fsl *base_addr;\n+\tu8 port_id; /* do we need this? */\n+};\n+\n+struct linflex_serial_priv {\n+\tstruct linflex_fsl *lfuart;\n+};\n+\n+int linflex_serial_setbrg(struct udevice *dev, int baudrate)\n+{\n+\tstruct linflex_serial_priv *priv = dev_get_priv(dev);\n+\n+\t_linflex_serial_setbrg(priv->lfuart, baudrate);\n+\n+\treturn 0;\n+}\n+\n+static int linflex_serial_getc(struct udevice *dev)\n+{\n+\tstruct linflex_serial_priv *priv = dev_get_priv(dev);\n+\n+\treturn _linflex_serial_getc(priv->lfuart);\n+}\n+\n+static int linflex_serial_putc(struct udevice *dev, const char ch)\n+{\n+\n+\tstruct linflex_serial_priv *priv = dev_get_priv(dev);\n+\n+\treturn _linflex_serial_putc(priv->lfuart, ch);\n+}\n+\n+static int linflex_serial_pending(struct udevice *dev, bool input)\n+{\n+\tstruct linflex_serial_priv *priv = dev_get_priv(dev);\n+\tuint32_t uartsr = __raw_readl(&priv->lfuart->uartsr);\n+\n+\tif (input)\n+\t\treturn ((uartsr & UARTSR_DRF) && (uartsr & UARTSR_RMB)) ? 1 : 0;\n+\telse\n+\t\treturn uartsr & UARTSR_DTF ? 0 : 1;\n+}\n+\n+static void linflex_serial_init_internal(struct linflex_fsl *lfuart)\n+{\n+\t_linflex_serial_init(lfuart);\n+\t_linflex_serial_setbrg(lfuart, CONFIG_BAUDRATE);\n+\treturn;\n+}\n+\n+static int linflex_serial_probe(struct udevice *dev)\n+{\n+\tstruct linflex_serial_platdata *plat = dev->platdata;\n+\tstruct linflex_serial_priv *priv = dev_get_priv(dev);\n+\n+\tpriv->lfuart = (struct linflex_fsl *)plat->base_addr;\n+\tlinflex_serial_init_internal(priv->lfuart);\n+\n+\treturn 0;\n+}\n+\n+static const struct dm_serial_ops linflex_serial_ops = {\n+\t.putc = linflex_serial_putc,\n+\t.pending = linflex_serial_pending,\n+\t.getc = linflex_serial_getc,\n+\t.setbrg = linflex_serial_setbrg,\n+};\n+\n+U_BOOT_DRIVER(serial_linflex) = {\n+\t.name\t= \"serial_linflex\",\n+\t.id\t= UCLASS_SERIAL,\n+\t.probe = linflex_serial_probe,\n+\t.ops\t= &linflex_serial_ops,\n+\t.flags = DM_FLAG_PRE_RELOC,\n+\t.priv_auto_alloc_size\t= sizeof(struct linflex_serial_priv),\n+};\n+\n+#ifdef CONFIG_DEBUG_UART_LINFLEXUART\n+\n+#include <debug_uart.h>\n+\n+\n+static inline void _debug_uart_init(void)\n+{\n+\tstruct linflex_fsl *base = (struct linflex_fsl *)CONFIG_DEBUG_UART_BASE;\n+\n+\tlinflex_serial_init_internal(base);\n+}\n+\n+static inline void _debug_uart_putc(int ch)\n+{\n+\tstruct linflex_fsl *base = (struct linflex_fsl *)CONFIG_DEBUG_UART_BASE;\n+\n+\t/* XXX: Is this OK? Should this use the non-DM version? */\n+\t_linflex_serial_putc(base, ch);\n+}\n+\n+#endif /* CONFIG_DEBUG_UART_LINFLEXUART */\n",
    "prefixes": [
        "U-Boot",
        "v4",
        "1/2"
    ]
}