get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 627658,
    "url": "http://patchwork.ozlabs.org/api/patches/627658/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1464429375-6191-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": "<1464429375-6191-2-git-send-email-eddy.petrisor@gmail.com>",
    "list_archive_url": null,
    "date": "2016-05-28T09:56:14",
    "name": "[U-Boot,v3,1/2] serial: Introduce linflex uart support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "cfca4ce012f4c6d102ed7ab52e9d903490390532",
    "submitter": {
        "id": 68207,
        "url": "http://patchwork.ozlabs.org/api/people/68207/?format=api",
        "name": "Eddy Petrișor",
        "email": "eddy.petrisor@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1464429375-6191-2-git-send-email-eddy.petrisor@gmail.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/627658/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/627658/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 3rJ9yW0bY4z9t4b\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 30 May 2016 19:18:11 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id B9464A74C5;\n\tMon, 30 May 2016 11:17:24 +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 1VZif8jVXXiR; Mon, 30 May 2016 11:17:24 +0200 (CEST)",
            "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 91F7CA75C8;\n\tMon, 30 May 2016 11:16:38 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 4AE58A74BA\n\tfor <u-boot@lists.denx.de>; Sat, 28 May 2016 11:57:33 +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 nBRfxraKQoOx for <u-boot@lists.denx.de>;\n\tSat, 28 May 2016 11:57:33 +0200 (CEST)",
            "from mail-wm0-f66.google.com (mail-wm0-f66.google.com\n\t[74.125.82.66])\n\tby theia.denx.de (Postfix) with ESMTPS id 120ECA7498\n\tfor <u-boot@lists.denx.de>; Sat, 28 May 2016 11:57:28 +0200 (CEST)",
            "by mail-wm0-f66.google.com with SMTP id a136so6470919wme.0\n\tfor <u-boot@lists.denx.de>; Sat, 28 May 2016 02:57:28 -0700 (PDT)",
            "from localhost.localdomain ([188.25.111.212])\n\tby smtp.gmail.com with ESMTPSA id\n\tw3sm23581847wjt.0.2016.05.28.02.57.27\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSat, 28 May 2016 02:57: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=Sh3iqqRL;\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=o5F0tu7BUvbJE7N04ENny4vLFR5LN0qvwD94PMsQDt0=;\n\tb=Sh3iqqRL/2vZ6aRTRshjww5PmCql9vbB8osI2sgLCAN8c0aB9yhg090MFOFKMQr9di\n\t5tec0jChaU6UQDe6uJGQgS7qOaxhlkbStPMTdXNkdSIKHbCDCU7lwgGZRkR1hZ0N/oC1\n\tOIXnZdIxohsEY9SHds5lLtuRCwK5fyMr8/xWoCHJ+7pux39dXm9/3hPZIwAzh4wPrh/H\n\tDbhD9YAy6RTkm2iUsAr3EzvExretlCNkwLoPJ/HH3jSG1zZiRDtpPtWHmCiaIhNWEExc\n\ttLwGxyYoyz2B+Ee9etV5BPABrECgoAPQpySPcv/JJcVHTQ6MlKbbjyfC+qDrbSlOPRoe\n\td9Hg==",
        "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=o5F0tu7BUvbJE7N04ENny4vLFR5LN0qvwD94PMsQDt0=;\n\tb=WVoV/CdPPSxxVKv+Ldn4Fj/uLhIYoGVytD2e3LeTv3kHAJdbx8LjOATiQs5gYT2H4i\n\twtlswcQxMp/altpmyUu94Amfe289361ufe9lJ5tu/p6aPoaHGxcAOh5V/MAsohZv5W8U\n\tpOB7niFd3rg6i4Q87FjnSAHt0sYu2wzmKdYAot8TYNY875z9NaU8dBMy5pRfO1/ly+0K\n\t/JsbbImHOZh1ZPtEKs0Ut14wkFEnxO9mMC3Sa8Pd+mbXwEY8Vf6ZD/v2iNvtFgXdlPDR\n\tLTxyCN8wlQqksi4pR0PPpRpn8MwcBGxqA3ih8QWGsRxEeq+/dEvSpphkwUOxJ8VQY6Os\n\tKhxg==",
        "X-Gm-Message-State": "ALyK8tKH6yg9S8RegfpKtpGEG5O0KJptEooFCcqh4vl1Cf/5z6k2IUs4UUAgGhLpoHOPhg==",
        "X-Received": "by 10.28.23.84 with SMTP id 81mr2916485wmx.46.1464429448360;\n\tSat, 28 May 2016 02:57: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 12:56:14 +0300",
        "Message-Id": "<1464429375-6191-2-git-send-email-eddy.petrisor@gmail.com>",
        "X-Mailer": "git-send-email 2.5.0",
        "In-Reply-To": [
            "<1464429375-6191-1-git-send-email-eddy.petrisor@gmail.com>",
            "<1459642206-20101-1-git-send-email-eddy.petrisor@gmail.com>"
        ],
        "References": [
            "<1464429375-6191-1-git-send-email-eddy.petrisor@gmail.com>",
            "<1459642206-20101-1-git-send-email-eddy.petrisor@gmail.com>\n\t<1461794874-6105-2-git-send-email-eddy.petrisor@nxp.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 v3 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 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..771d0bd\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",
        "v3",
        "1/2"
    ]
}