get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 813041,
    "url": "http://patchwork.ozlabs.org/api/patches/813041/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/461cff59c468322dbd930d6dc871d4da4f42cd58.1505246502.git-series.maxime.ripard@free-electrons.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": "<461cff59c468322dbd930d6dc871d4da4f42cd58.1505246502.git-series.maxime.ripard@free-electrons.com>",
    "list_archive_url": null,
    "date": "2017-09-12T20:02:24",
    "name": "[U-Boot,v2,3/3] sunxi: Remove the MMC index hack",
    "commit_ref": "de86fc3859f9c9ae26faed6f9d8fc115e1329b4f",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6c088e71f63aef8dcbff58c13ed97de26985fbd6",
    "submitter": {
        "id": 12916,
        "url": "http://patchwork.ozlabs.org/api/people/12916/?format=api",
        "name": "Maxime Ripard",
        "email": "maxime.ripard@free-electrons.com"
    },
    "delegate": {
        "id": 17739,
        "url": "http://patchwork.ozlabs.org/api/users/17739/?format=api",
        "username": "jagan",
        "first_name": "Jagannadha Sutradharudu",
        "last_name": "Teki",
        "email": "jagannadh.teki@gmail.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/461cff59c468322dbd930d6dc871d4da4f42cd58.1505246502.git-series.maxime.ripard@free-electrons.com/mbox/",
    "series": [
        {
            "id": 2765,
            "url": "http://patchwork.ozlabs.org/api/series/2765/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=2765",
            "date": "2017-09-12T20:02:21",
            "name": "mmc: sunxi: index hack removal",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/2765/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/813041/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/813041/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",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xsG2x1LSpz9s7f\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 06:04:09 +1000 (AEST)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid D1DC2C221DC; Tue, 12 Sep 2017 20:03:16 +0000 (UTC)",
            "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id A6740C2216F;\n\tTue, 12 Sep 2017 20:02:42 +0000 (UTC)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid 873EEC221D3; Tue, 12 Sep 2017 20:02:32 +0000 (UTC)",
            "from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54])\n\tby lists.denx.de (Postfix) with ESMTP id 2BFCBC220AA\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 20:02:29 +0000 (UTC)",
            "by mail.free-electrons.com (Postfix, from userid 110)\n\tid EE8372088C; Tue, 12 Sep 2017 22:02:28 +0200 (CEST)",
            "from localhost (LFbn-TOU-1-209-191.w86-201.abo.wanadoo.fr\n\t[86.201.56.191])\n\tby mail.free-electrons.com (Postfix) with ESMTPSA id BF14A20834;\n\tTue, 12 Sep 2017 22:02:28 +0200 (CEST)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0",
        "From": "Maxime Ripard <maxime.ripard@free-electrons.com>",
        "To": "Tom Rini <trini@konsulko.com>",
        "Date": "Tue, 12 Sep 2017 22:02:24 +0200",
        "Message-Id": "<461cff59c468322dbd930d6dc871d4da4f42cd58.1505246502.git-series.maxime.ripard@free-electrons.com>",
        "X-Mailer": "git-send-email 2.13.5",
        "In-Reply-To": [
            "<cover.83f2411bc34652192975a859f986aa4fbe559a49.1505246502.git-series.maxime.ripard@free-electrons.com>",
            "<cover.83f2411bc34652192975a859f986aa4fbe559a49.1505246502.git-series.maxime.ripard@free-electrons.com>"
        ],
        "References": [
            "<cover.83f2411bc34652192975a859f986aa4fbe559a49.1505246502.git-series.maxime.ripard@free-electrons.com>",
            "<cover.83f2411bc34652192975a859f986aa4fbe559a49.1505246502.git-series.maxime.ripard@free-electrons.com>"
        ],
        "Cc": "u-boot@lists.denx.de, Jagan Teki <jagan@openedev.com>,\n\tMaxime Ripard <maxime.ripard@free-electrons.com>",
        "Subject": "[U-Boot] [PATCH v2 3/3] sunxi: Remove the MMC index hack",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.18",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/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": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "MIME-Version": "1.0",
        "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": "The current code, if there's both an eMMC and an MMC slot available on the\nboard, will swap the MMC indices based on whether we booted from the eMMC\nor the MMC. This way, the MMC we're supposed to boot on will always have\nthe index 0.\n\nHowever, this causes various issues, for example when using other\ncomponents that base their behaviour on the MMC index, such as fastboot.\n\nLet's remove that hack, and take the opposite approach. The MMC will always\nhave the same index, but the bootcmd will pick the same device than the one\nwe booted from. This is done through the introduction of the mmc_bootdev\nenvironment variable that will be filled by the board code based on the\nboot device informations we can get from the SoC.\n\nIn order to not introduce regressions, we also need to adjust the fastboot\nMMC device and the environment device in order to set it to the eMMC, over\nthe MMC, like it used to be the case.\n\nTested-by: Chen-Yu Tsai <wens@csie.org>\nSigned-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>\n---\n board/sunxi/board.c                        | 20 ++++-----------\n cmd/fastboot/Kconfig                       |  2 ++-\n configs/A20-OLinuXino-Lime2-eMMC_defconfig |  1 +-\n configs/Sinlinx_SinA33_defconfig           |  1 +-\n configs/parrot_r16_defconfig               |  1 +-\n include/configs/sunxi-common.h             | 30 ++++++++++++++++++-----\n 6 files changed, 32 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/board/sunxi/board.c b/board/sunxi/board.c\nindex 9c7fc4168894..feb8d7490d8b 100644\n--- a/board/sunxi/board.c\n+++ b/board/sunxi/board.c\n@@ -492,20 +492,6 @@ int board_mmc_init(bd_t *bis)\n \t\treturn -1;\n #endif\n \n-#if !defined(CONFIG_SPL_BUILD) && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2\n-\t/*\n-\t * On systems with an emmc (mmc2), figure out if we are booting from\n-\t * the emmc and if we are make it \"mmc dev 0\" so that boot.scr, etc.\n-\t * are searched there first. Note we only do this for u-boot proper,\n-\t * not for the SPL, see spl_boot_device().\n-\t */\n-\tif (readb(SPL_ADDR + 0x28) == SUNXI_BOOTED_FROM_MMC2) {\n-\t\t/* Booting from emmc / mmc2, swap */\n-\t\tmmc0->block_dev.devnum = 1;\n-\t\tmmc1->block_dev.devnum = 0;\n-\t}\n-#endif\n-\n \treturn 0;\n }\n #endif\n@@ -725,12 +711,18 @@ int misc_init_r(void)\n \n \tenv_set(\"fel_booted\", NULL);\n \tenv_set(\"fel_scriptaddr\", NULL);\n+\tenv_set(\"mmc_bootdev\", NULL);\n \n \tboot = sunxi_get_boot_device();\n \t/* determine if we are running in FEL mode */\n \tif (boot == BOOT_DEVICE_BOARD) {\n \t\tenv_set(\"fel_booted\", \"1\");\n \t\tparse_spl_header(SPL_ADDR);\n+\t/* or if we booted from MMC, and which one */\n+\t} else if (boot == BOOT_DEVICE_MMC1) {\n+\t\tenv_set(\"mmc_bootdev\", \"0\");\n+\t} else if (boot == BOOT_DEVICE_MMC2) {\n+\t\tenv_set(\"mmc_bootdev\", \"1\");\n \t}\n \n \tsetup_environment(gd->fdt_blob);\ndiff --git a/cmd/fastboot/Kconfig b/cmd/fastboot/Kconfig\nindex fb0c5da94cdb..6baea8974690 100644\n--- a/cmd/fastboot/Kconfig\n+++ b/cmd/fastboot/Kconfig\n@@ -69,6 +69,8 @@ config FASTBOOT_FLASH\n config FASTBOOT_FLASH_MMC_DEV\n \tint \"Define FASTBOOT MMC FLASH default device\"\n \tdepends on FASTBOOT_FLASH && MMC\n+\tdefault 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1\n+\tdefault 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1\n \thelp\n \t  The fastboot \"flash\" command requires additional information\n \t  regarding the non-volatile storage device. Define this to\ndiff --git a/configs/A20-OLinuXino-Lime2-eMMC_defconfig b/configs/A20-OLinuXino-Lime2-eMMC_defconfig\nindex 58aa988b2363..caaa0b9a0d88 100644\n--- a/configs/A20-OLinuXino-Lime2-eMMC_defconfig\n+++ b/configs/A20-OLinuXino-Lime2-eMMC_defconfig\n@@ -14,7 +14,6 @@ CONFIG_AHCI=y\n CONFIG_SPL=y\n CONFIG_SPL_I2C_SUPPORT=y\n CONFIG_FASTBOOT_FLASH=y\n-CONFIG_FASTBOOT_FLASH_MMC_DEV=0\n # CONFIG_CMD_IMLS is not set\n CONFIG_CMD_DFU=y\n # CONFIG_CMD_FLASH is not set\ndiff --git a/configs/Sinlinx_SinA33_defconfig b/configs/Sinlinx_SinA33_defconfig\nindex af00e5434763..471c843e5dcf 100644\n--- a/configs/Sinlinx_SinA33_defconfig\n+++ b/configs/Sinlinx_SinA33_defconfig\n@@ -15,7 +15,6 @@ CONFIG_DEFAULT_DEVICE_TREE=\"sun8i-a33-sinlinx-sina33\"\n # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set\n CONFIG_SPL=y\n CONFIG_FASTBOOT_FLASH=y\n-CONFIG_FASTBOOT_FLASH_MMC_DEV=0\n # CONFIG_CMD_IMLS is not set\n CONFIG_CMD_DFU=y\n # CONFIG_CMD_FLASH is not set\ndiff --git a/configs/parrot_r16_defconfig b/configs/parrot_r16_defconfig\nindex 53825eba33c3..c63e7f259f35 100644\n--- a/configs/parrot_r16_defconfig\n+++ b/configs/parrot_r16_defconfig\n@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE=\"sun8i-r16-parrot\"\n # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set\n CONFIG_SPL=y\n CONFIG_FASTBOOT_FLASH=y\n-CONFIG_FASTBOOT_FLASH_MMC_DEV=0\n # CONFIG_CMD_IMLS is not set\n # CONFIG_CMD_FLASH is not set\n # CONFIG_CMD_FPGA is not set\ndiff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h\nindex 02d7be08495d..91751171ec2b 100644\n--- a/include/configs/sunxi-common.h\n+++ b/include/configs/sunxi-common.h\n@@ -148,7 +148,13 @@\n #endif\n \n #if defined(CONFIG_ENV_IS_IN_MMC)\n-#define CONFIG_SYS_MMC_ENV_DEV\t\t0\t/* first detected MMC controller */\n+#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1\n+/* If we have two devices (most likely eMMC + MMC), favour the eMMC */\n+#define CONFIG_SYS_MMC_ENV_DEV\t\t1\n+#else\n+/* Otherwise, use the only device we have */\n+#define CONFIG_SYS_MMC_ENV_DEV\t\t0\n+#endif\n #define CONFIG_SYS_MMC_MAX_DEVICE\t4\n #elif defined(CONFIG_ENV_IS_NOWHERE)\n #define CONFIG_ENV_SIZE\t\t\t(128 << 10)\n@@ -382,15 +388,28 @@ extern int soft_i2c_gpio_scl;\n \t\"ramdisk ram \" RAMDISK_ADDR_R \" 0x4000000\\0\"\n \n #ifdef CONFIG_MMC\n-#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)\n #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1\n-#define BOOT_TARGET_DEVICES_MMC_EXTRA(func) func(MMC, mmc, 1)\n+#define BOOTENV_DEV_MMC_AUTO(devtypeu, devtypel, instance)\t\t\\\n+\tBOOTENV_DEV_MMC(MMC, mmc, 0)\t\t\t\t\t\\\n+\tBOOTENV_DEV_MMC(MMC, mmc, 1)\t\t\t\t\t\\\n+\t\"bootcmd_mmc_auto=\"\t\t\t\t\t\t\\\n+\t\t\"if test ${mmc_bootdev} -eq 1; then \"\t\t\t\\\n+\t\t\t\"run bootcmd_mmc1; \"\t\t\t\t\\\n+\t\t\t\"run bootcmd_mmc0; \"\t\t\t\t\\\n+\t\t\"elif test ${mmc_bootdev} -eq 0; then \"\t\t\t\\\n+\t\t\t\"run bootcmd_mmc0; \"\t\t\t\t\\\n+\t\t\t\"run bootcmd_mmc1; \"\t\t\t\t\\\n+\t\t\"fi\\0\"\n+\n+#define BOOTENV_DEV_NAME_MMC_AUTO(devtypeu, devtypel, instance) \\\n+\t\"mmc_auto \"\n+\n+#define BOOT_TARGET_DEVICES_MMC(func) func(MMC_AUTO, mmc_auto, na)\n #else\n-#define BOOT_TARGET_DEVICES_MMC_EXTRA(func)\n+#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)\n #endif\n #else\n #define BOOT_TARGET_DEVICES_MMC(func)\n-#define BOOT_TARGET_DEVICES_MMC_EXTRA(func)\n #endif\n \n #ifdef CONFIG_AHCI\n@@ -418,7 +437,6 @@ extern int soft_i2c_gpio_scl;\n #define BOOT_TARGET_DEVICES(func) \\\n \tfunc(FEL, fel, na) \\\n \tBOOT_TARGET_DEVICES_MMC(func) \\\n-\tBOOT_TARGET_DEVICES_MMC_EXTRA(func) \\\n \tBOOT_TARGET_DEVICES_SCSI(func) \\\n \tBOOT_TARGET_DEVICES_USB(func) \\\n \tfunc(PXE, pxe, na) \\\n",
    "prefixes": [
        "U-Boot",
        "v2",
        "3/3"
    ]
}