get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1671166,
    "url": "http://patchwork.ozlabs.org/api/patches/1671166/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20220827180630.31933-1-pali@kernel.org/",
    "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": "<20220827180630.31933-1-pali@kernel.org>",
    "list_archive_url": null,
    "date": "2022-08-27T18:06:30",
    "name": "board: turris: Initialize serial# env",
    "commit_ref": "7bb9ea47e1a47e00d4aef86d66293379be0b47b0",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "46635bcde47547dc4f0758d5567512cc29b5f99a",
    "submitter": {
        "id": 78810,
        "url": "http://patchwork.ozlabs.org/api/people/78810/?format=api",
        "name": "Pali Rohár",
        "email": "pali@kernel.org"
    },
    "delegate": {
        "id": 1696,
        "url": "http://patchwork.ozlabs.org/api/users/1696/?format=api",
        "username": "stroese",
        "first_name": "Stefan",
        "last_name": "Roese",
        "email": "sr@denx.de"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20220827180630.31933-1-pali@kernel.org/mbox/",
    "series": [
        {
            "id": 315663,
            "url": "http://patchwork.ozlabs.org/api/series/315663/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=315663",
            "date": "2022-08-27T18:06:30",
            "name": "board: turris: Initialize serial# env",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/315663/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1671166/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1671166/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)",
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=JSljFDJU;\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.b=\"JSljFDJU\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=kernel.org",
            "phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4MFPmM19X5z1yhQ\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 28 Aug 2022 04:06:56 +1000 (AEST)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 1B30584001;\n\tSat, 27 Aug 2022 20:06:47 +0200 (CEST)",
            "by phobos.denx.de (Postfix, from userid 109)\n id A23E18171B; Sat, 27 Aug 2022 20:06:45 +0200 (CEST)",
            "from ams.source.kernel.org (ams.source.kernel.org\n [IPv6:2604:1380:4601:e00::1])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 309F984001\n for <u-boot@lists.denx.de>; Sat, 27 Aug 2022 20:06:42 +0200 (CEST)",
            "from smtp.kernel.org (relay.kernel.org [52.25.139.140])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by ams.source.kernel.org (Postfix) with ESMTPS id 9B47DB80955;\n Sat, 27 Aug 2022 18:06:41 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 03835C433C1;\n Sat, 27 Aug 2022 18:06:40 +0000 (UTC)",
            "by pali.im (Postfix)\n id 5ACAFC7A; Sat, 27 Aug 2022 20:06:37 +0200 (CEST)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,\n SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no\n version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1661623600;\n bh=XLFEAlW+UwhtZLlBzgq9Dt6ZgWuJawt5WPgAPzhpLhs=;\n h=From:To:Cc:Subject:Date:From;\n b=JSljFDJUPogCHCM6uw9xJqb3sfLUsIwG0xiNk4pZKWBJAWWwn1QdLCRPT1O3HnRY1\n hkaqR2u9gfChsMWWp7M86nBq+Lmk3KZXRKO/zZRoNtAtyOAHXqwCOQXd9LgZqKayEa\n xmc5WMW/tUBKFRpzNMJNVtgnjYmewkSq4i2uNQlkrQ7Yhht58c6z6jRwRwGYy1C/Bm\n ufn2uaa0CzNnS/6JxoykGyv7gQhv9VOEGYcwiXvpUVm45IPzVTMxzlspoA+B0l0ift\n TvDDT9j8gcffyQkhq6SRPAmwYzjM0v4LI6r0hZhyqx4o5RPf1jlyGYWLgcRwEMmUny\n zxBZWbdhmI2ig==",
        "From": "=?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>",
        "To": "=?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org>, Stefan Roese <sr@denx.de>",
        "Cc": "u-boot@lists.denx.de",
        "Subject": "[PATCH] board: turris: Initialize serial# env",
        "Date": "Sat, 27 Aug 2022 20:06:30 +0200",
        "Message-Id": "<20220827180630.31933-1-pali@kernel.org>",
        "X-Mailer": "git-send-email 2.20.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.39",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://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": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.6 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "Store serial number from atsha cryptochip into the serial# env variable.\nU-Boot automatically puts content of this variable into the root device\ntree property serial-number when booting Linux kernel. Refactor turris\natsha code and from turris_atsha_otp_get_serial_number() function returns\ndirectly string suitable for printing or storing into device tree. Because\nduring different boot stages is env storage read-only, it is not possible\nto always store serial number into env storage. So introduce a new function\nturris_atsha_otp_init_serial_number() which is called at later stage and\nwhich ensures that serial number is correctly stored into env.\n\nSigned-off-by: Pali Rohár <pali@kernel.org>\n---\n board/CZ.NIC/turris_atsha_otp.c          | 33 +++++++++++++++++++++---\n board/CZ.NIC/turris_atsha_otp.h          |  3 ++-\n board/CZ.NIC/turris_omnia/turris_omnia.c | 11 +++-----\n 3 files changed, 36 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/board/CZ.NIC/turris_atsha_otp.c b/board/CZ.NIC/turris_atsha_otp.c\nindex aa4e29b1560e..a29fe3623174 100644\n--- a/board/CZ.NIC/turris_atsha_otp.c\n+++ b/board/CZ.NIC/turris_atsha_otp.c\n@@ -93,30 +93,57 @@ int turris_atsha_otp_init_mac_addresses(int first_idx)\n \treturn 0;\n }\n \n-int turris_atsha_otp_get_serial_number(u32 *version_num, u32 *serial_num)\n+int turris_atsha_otp_init_serial_number(void)\n+{\n+\tchar serial[17];\n+\tint ret;\n+\n+\tret = turris_atsha_otp_get_serial_number(serial);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (!env_get(\"serial#\"))\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n+int turris_atsha_otp_get_serial_number(char serial[17])\n {\n \tstruct udevice *dev = get_atsha204a_dev();\n+\tu32 version_num, serial_num;\n+\tconst char *serial_env;\n \tint ret;\n \n \tif (!dev)\n \t\treturn -1;\n \n+\tserial_env = env_get(\"serial#\");\n+\tif (serial_env && strlen(serial_env) == 16) {\n+\t\tmemcpy(serial, serial_env, 17);\n+\t\treturn 0;\n+\t}\n+\n \tret = atsha204a_wakeup(dev);\n \tif (ret)\n \t\treturn ret;\n \n \tret = atsha204a_read(dev, ATSHA204A_ZONE_OTP, false,\n \t\t\t     TURRIS_ATSHA_OTP_VERSION,\n-\t\t\t     (u8 *)version_num);\n+\t\t\t     (u8 *)&version_num);\n \tif (ret)\n \t\treturn ret;\n \n \tret = atsha204a_read(dev, ATSHA204A_ZONE_OTP, false,\n \t\t\t     TURRIS_ATSHA_OTP_SERIAL,\n-\t\t\t     (u8 *)serial_num);\n+\t\t\t     (u8 *)&serial_num);\n \tif (ret)\n \t\treturn ret;\n \n \tatsha204a_sleep(dev);\n+\n+\tsprintf(serial, \"%08X%08X\", be32_to_cpu(version_num), be32_to_cpu(serial_num));\n+\tenv_set(\"serial#\", serial);\n+\n \treturn 0;\n }\ndiff --git a/board/CZ.NIC/turris_atsha_otp.h b/board/CZ.NIC/turris_atsha_otp.h\nindex bd4308fdc3ef..2cfe20bbc3a7 100644\n--- a/board/CZ.NIC/turris_atsha_otp.h\n+++ b/board/CZ.NIC/turris_atsha_otp.h\n@@ -4,6 +4,7 @@\n #define TURRIS_ATSHA_OTP_H\n \n int turris_atsha_otp_init_mac_addresses(int first_idx);\n-int turris_atsha_otp_get_serial_number(u32 *version_num, u32 *serial_num);\n+int turris_atsha_otp_init_serial_number(void);\n+int turris_atsha_otp_get_serial_number(char serial[17]);\n \n #endif\ndiff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c\nindex ab5061ef582b..cf8a6026702b 100644\n--- a/board/CZ.NIC/turris_omnia/turris_omnia.c\n+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c\n@@ -963,19 +963,15 @@ int board_late_init(void)\n \n int show_board_info(void)\n {\n-\tu32 version_num, serial_num;\n+\tchar serial[17];\n \tint err;\n \n-\terr = turris_atsha_otp_get_serial_number(&version_num, &serial_num);\n+\terr = turris_atsha_otp_get_serial_number(serial);\n \tprintf(\"Model: Turris Omnia\\n\");\n \tprintf(\"  MCU type: %s\\n\", omnia_get_mcu_type());\n \tprintf(\"  MCU version: %s\\n\", omnia_get_mcu_version());\n \tprintf(\"  RAM size: %i MiB\\n\", omnia_get_ram_size_gb() * 1024);\n-\tif (err)\n-\t\tprintf(\"  Serial Number: unknown\\n\");\n-\telse\n-\t\tprintf(\"  Serial Number: %08X%08X\\n\", be32_to_cpu(version_num),\n-\t\t       be32_to_cpu(serial_num));\n+\tprintf(\"  Serial Number: %s\\n\", !err ? serial : \"unknown\");\n \n \treturn 0;\n }\n@@ -983,6 +979,7 @@ int show_board_info(void)\n int misc_init_r(void)\n {\n \tturris_atsha_otp_init_mac_addresses(1);\n+\tturris_atsha_otp_init_serial_number();\n \treturn 0;\n }\n \n",
    "prefixes": []
}