get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1137417,
    "url": "http://patchwork.ozlabs.org/api/patches/1137417/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20190726122537.6628-1-chuanhua.han@nxp.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": "<20190726122537.6628-1-chuanhua.han@nxp.com>",
    "list_archive_url": null,
    "date": "2019-07-26T12:25:35",
    "name": "[U-Boot,v2,1/3] armv8: ls1088aqds: The ls1088aqds board supports the I2C driver model.",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6b553b1787c7bd32ab493ae3ba487c8c9d75411f",
    "submitter": {
        "id": 74737,
        "url": "http://patchwork.ozlabs.org/api/people/74737/?format=api",
        "name": "Chuanhua Han",
        "email": "chuanhua.han@nxp.com"
    },
    "delegate": {
        "id": 2467,
        "url": "http://patchwork.ozlabs.org/api/users/2467/?format=api",
        "username": "prabhu_kush",
        "first_name": "Prabhakar",
        "last_name": "Kushwaha",
        "email": "prabhakar@freescale.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20190726122537.6628-1-chuanhua.han@nxp.com/mbox/",
    "series": [
        {
            "id": 121642,
            "url": "http://patchwork.ozlabs.org/api/series/121642/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=121642",
            "date": "2019-07-26T12:25:35",
            "name": "[U-Boot,v2,1/3] armv8: ls1088aqds: The ls1088aqds board supports the I2C driver model.",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/121642/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1137417/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1137417/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>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=nxp.com"
        ],
        "Received": [
            "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 45w7pM2Dbyz9s4Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 26 Jul 2019 22:35:21 +1000 (AEST)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid EB4A9C21C6A; Fri, 26 Jul 2019 12:35:11 +0000 (UTC)",
            "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id E1A93C21C4A;\n\tFri, 26 Jul 2019 12:35:08 +0000 (UTC)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid 98C3FC21C4A; Fri, 26 Jul 2019 12:35:07 +0000 (UTC)",
            "from inva020.nxp.com (inva020.nxp.com [92.121.34.13])\n\tby lists.denx.de (Postfix) with ESMTPS id 3D1B2C21BE5\n\tfor <u-boot@lists.denx.de>; Fri, 26 Jul 2019 12:35:07 +0000 (UTC)",
            "from inva020.nxp.com (localhost [127.0.0.1])\n\tby inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id ABD2F1A0A01;\n\tFri, 26 Jul 2019 14:35:06 +0200 (CEST)",
            "from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com\n\t[165.114.16.14])\n\tby inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8EAD01A09EC;\n\tFri, 26 Jul 2019 14:35:02 +0200 (CEST)",
            "from titan.ap.freescale.net (TITAN.ap.freescale.net\n\t[10.192.208.233])\n\tby invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 7152540302;\n\tFri, 26 Jul 2019 20:34:57 +0800 (SGT)"
        ],
        "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": "Chuanhua Han <chuanhua.han@nxp.com>",
        "To": "albert.u.boot@aribaud.net, prabhakar.kushwaha@nxp.com,\n\tAshish.Kumar@nxp.com, rajesh.bhagat@nxp.com",
        "Date": "Fri, 26 Jul 2019 20:25:35 +0800",
        "Message-Id": "<20190726122537.6628-1-chuanhua.han@nxp.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "Cc": "u-boot@lists.denx.de, Chuanhua Han <chuanhua.han@nxp.com>",
        "Subject": "[U-Boot] [PATCH v2 1/3] armv8: ls1088aqds: The ls1088aqds board\n\tsupports the I2C driver model.",
        "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": "This patch is updating ls1088aqds board init code to support DM_I2C.\n\nSigned-off-by: Chuanhua Han <chuanhua.han@nxp.com>\n---\ndepends on:\n\t- http://patchwork.ozlabs.org/project/uboot/list/?series=110856\n\t- http://patchwork.ozlabs.org/project/uboot/list/?series=109459\n\t- http://patchwork.ozlabs.org/project/uboot/list/?series=120936\n\nChanges in v2:\n\t- Simplify i2c_write related function calls and reduce\nthe amount of code by using circular iteration\n\t- Place the variable definitions for udevice at\nthe beginning of the function\n\n board/freescale/ls1088a/eth_ls1088aqds.c | 149 +++++++++++++++++++++----------\n include/configs/ls1088aqds.h             |   4 +-\n 2 files changed, 104 insertions(+), 49 deletions(-)",
    "diff": "diff --git a/board/freescale/ls1088a/eth_ls1088aqds.c b/board/freescale/ls1088a/eth_ls1088aqds.c\nindex f16b78c..6fb671f 100644\n--- a/board/freescale/ls1088a/eth_ls1088aqds.c\n+++ b/board/freescale/ls1088a/eth_ls1088aqds.c\n@@ -80,11 +80,16 @@ struct ls1088a_qds_mdio {\n \tstruct mii_dev *realbus;\n };\n \n+struct reg_pair {\n+\tuint addr;\n+\tu8 *val;\n+};\n+\n static void sgmii_configure_repeater(int dpmac)\n {\n \tstruct mii_dev *bus;\n \tuint8_t a = 0xf;\n-\tint i, j, ret;\n+\tint i, j, k, ret;\n \tunsigned short value;\n \tconst char *dev = \"LS1088A_QDS_MDIO2\";\n \tint i2c_addr[] = {0x58, 0x59, 0x5a, 0x5b};\n@@ -96,8 +101,28 @@ static void sgmii_configure_repeater(int dpmac)\n \tuint8_t ch_b_eq[] = {0x1, 0x2, 0x3, 0x7};\n \tuint8_t ch_b_ctl2[] = {0x81, 0x82, 0x83, 0x84};\n \n+\tu8 reg_val[6] = {0x18, 0x38, 0x4, 0x14, 0xb5, 0x20};\n+\tstruct reg_pair reg_pair[10] = {\n+\t\t{6, &reg_val[0]}, {4, &reg_val[1]},\n+\t\t{8, &reg_val[2]}, {0xf, NULL},\n+\t\t{0x11, NULL}, {0x16, NULL},\n+\t\t{0x18, NULL}, {0x23, &reg_val[3]},\n+\t\t{0x2d, &reg_val[4]}, {4, &reg_val[5]},\n+\t};\n+#ifdef CONFIG_DM_I2C\n+\tstruct udevice *udev;\n+#endif\n+\n \t/* Set I2c to Slot 1 */\n-\ti2c_write(0x77, 0, 0, &a, 1);\n+#ifndef CONFIG_DM_I2C\n+\tret = i2c_write(0x77, 0, 0, &a, 1);\n+#else\n+\tret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev);\n+\tif (!ret)\n+\t\tret = dm_i2c_write(udev, 0, &a, 1);\n+#endif\n+\tif (ret)\n+\t\tgoto error;\n \n \tswitch (dpmac) {\n \tcase 1:\n@@ -143,31 +168,34 @@ static void sgmii_configure_repeater(int dpmac)\n \t\treturn;\n \t}\n \n+#ifdef CONFIG_DM_I2C\n+\ti2c_get_chip_for_busnum(0, i2c_phy_addr, 1, &udev);\n+#endif\n+\n \tfor (i = 0; i < 4; i++) {\n \t\tfor (j = 0; j < 4; j++) {\n-\t\t\ta = 0x18;\n-\t\t\ti2c_write(i2c_phy_addr, 6, 1, &a, 1);\n-\t\t\ta = 0x38;\n-\t\t\ti2c_write(i2c_phy_addr, 4, 1, &a, 1);\n-\t\t\ta = 0x4;\n-\t\t\ti2c_write(i2c_phy_addr, 8, 1, &a, 1);\n-\n-\t\t\ti2c_write(i2c_phy_addr, 0xf, 1,\n-\t\t\t\t  &ch_a_eq[i], 1);\n-\t\t\ti2c_write(i2c_phy_addr, 0x11, 1,\n-\t\t\t\t  &ch_a_ctl2[j], 1);\n-\n-\t\t\ti2c_write(i2c_phy_addr, 0x16, 1,\n-\t\t\t\t  &ch_b_eq[i], 1);\n-\t\t\ti2c_write(i2c_phy_addr, 0x18, 1,\n-\t\t\t\t  &ch_b_ctl2[j], 1);\n-\n-\t\t\ta = 0x14;\n-\t\t\ti2c_write(i2c_phy_addr, 0x23, 1, &a, 1);\n-\t\t\ta = 0xb5;\n-\t\t\ti2c_write(i2c_phy_addr, 0x2d, 1, &a, 1);\n-\t\t\ta = 0x20;\n-\t\t\ti2c_write(i2c_phy_addr, 4, 1, &a, 1);\n+\t\t\treg_pair[3].val = &ch_a_eq[i];\n+\t\t\treg_pair[4].val = &ch_a_ctl2[j];\n+\t\t\treg_pair[5].val = &ch_b_eq[i];\n+\t\t\treg_pair[6].val = &ch_b_ctl2[j];\n+\t\t\tfor (k = 0; k < 10; k++) {\n+#ifndef CONFIG_DM_I2C\n+\t\t\t\tret = i2c_write(i2c_phy_addr,\n+\t\t\t\t\t\treg_pair[k].addr,\n+\t\t\t\t\t\t1, reg_pair[k].val, 1);\n+#else\n+\t\t\t\tret = i2c_get_chip_for_busnum(0,\n+\t\t\t\t\t\ti2c_phy_addr,\n+\t\t\t\t\t\t1, &udev);\n+\t\t\t\tif (!ret)\n+\t\t\t\t\tret = dm_i2c_write(udev,\n+\t\t\t\t\t\t\t   reg_pair[k].addr,\n+\t\t\t\t\t\t\t   reg_pair[k].val, 1);\n+#endif\n+\t\t\t\tif (ret)\n+\t\t\t\t\tgoto error;\n+\t\t\t}\n+\n \t\t\tmdelay(100);\n \t\t\tret = miiphy_read(dev, phy_addr, 0x11, &value);\n \t\t\tif (ret > 0)\n@@ -202,7 +230,7 @@ error:\n static void qsgmii_configure_repeater(int dpmac)\n {\n \tuint8_t a = 0xf;\n-\tint i, j;\n+\tint i, j, k;\n \tint i2c_phy_addr = 0;\n \tint phy_addr = 0;\n \tint i2c_addr[] = {0x58, 0x59, 0x5a, 0x5b};\n@@ -212,12 +240,32 @@ static void qsgmii_configure_repeater(int dpmac)\n \tuint8_t ch_b_eq[] = {0x1, 0x2, 0x3, 0x7};\n \tuint8_t ch_b_ctl2[] = {0x81, 0x82, 0x83, 0x84};\n \n+\tu8 reg_val[6] = {0x18, 0x38, 0x4, 0x14, 0xb5, 0x20};\n+\tstruct reg_pair reg_pair[10] = {\n+\t\t{6, &reg_val[0]}, {4, &reg_val[1]},\n+\t\t{8, &reg_val[2]}, {0xf, NULL},\n+\t\t{0x11, NULL}, {0x16, NULL},\n+\t\t{0x18, NULL}, {0x23, &reg_val[3]},\n+\t\t{0x2d, &reg_val[4]}, {4, &reg_val[5]},\n+\t};\n+\n \tconst char *dev = mdio_names[EMI1_SLOT1];\n \tint ret = 0;\n \tunsigned short value;\n+#ifdef CONFIG_DM_I2C\n+\tstruct udevice *udev;\n+#endif\n \n \t/* Set I2c to Slot 1 */\n-\ti2c_write(0x77, 0, 0, &a, 1);\n+#ifndef CONFIG_DM_I2C\n+\tret = i2c_write(0x77, 0, 0, &a, 1);\n+#else\n+\tret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev);\n+\tif (!ret)\n+\t\tret = dm_i2c_write(udev, 0, &a, 1);\n+#endif\n+\tif (ret)\n+\t\tgoto error;\n \n \tswitch (dpmac) {\n \tcase 7:\n@@ -251,28 +299,35 @@ static void qsgmii_configure_repeater(int dpmac)\n \t\treturn;\n \t}\n \n+#ifdef CONFIG_DM_I2C\n+\ti2c_get_chip_for_busnum(0, i2c_phy_addr, 1, &udev);\n+#endif\n+\n \tfor (i = 0; i < 4; i++) {\n \t\tfor (j = 0; j < 4; j++) {\n-\t\t\ta = 0x18;\n-\t\t\ti2c_write(i2c_phy_addr, 6, 1, &a, 1);\n-\t\t\ta = 0x38;\n-\t\t\ti2c_write(i2c_phy_addr, 4, 1, &a, 1);\n-\t\t\ta = 0x4;\n-\t\t\ti2c_write(i2c_phy_addr, 8, 1, &a, 1);\n-\n-\t\t\ti2c_write(i2c_phy_addr, 0xf, 1, &ch_a_eq[i], 1);\n-\t\t\ti2c_write(i2c_phy_addr, 0x11, 1, &ch_a_ctl2[j], 1);\n-\n-\t\t\ti2c_write(i2c_phy_addr, 0x16, 1, &ch_b_eq[i], 1);\n-\t\t\ti2c_write(i2c_phy_addr, 0x18, 1, &ch_b_ctl2[j], 1);\n-\n-\t\t\ta = 0x14;\n-\t\t\ti2c_write(i2c_phy_addr, 0x23, 1, &a, 1);\n-\t\t\ta = 0xb5;\n-\t\t\ti2c_write(i2c_phy_addr, 0x2d, 1, &a, 1);\n-\t\t\ta = 0x20;\n-\t\t\ti2c_write(i2c_phy_addr, 4, 1, &a, 1);\n-\t\t\tmdelay(100);\n+\t\t\treg_pair[3].val = &ch_a_eq[i];\n+\t\t\treg_pair[4].val = &ch_a_ctl2[j];\n+\t\t\treg_pair[5].val = &ch_b_eq[i];\n+\t\t\treg_pair[6].val = &ch_b_ctl2[j];\n+\n+\t\t\tfor (k = 0; k < 10; k++) {\n+#ifndef CONFIG_DM_I2C\n+\t\t\t\tret = i2c_write(i2c_addr[dpmac],\n+\t\t\t\t\t\treg_pair[k].addr,\n+\t\t\t\t\t\t1, reg_pair[k].val, 1);\n+#else\n+\t\t\t\tret = i2c_get_chip_for_busnum(0,\n+\t\t\t\t\t\ti2c_addr[dpmac],\n+\t\t\t\t\t\t1, &udev);\n+\t\t\t\tif (!ret)\n+\t\t\t\t\tret = dm_i2c_write(udev,\n+\t\t\t\t\t\t\t   reg_pair[k].addr,\n+\t\t\t\t\t\t\t   reg_pair[k].val, 1);\n+#endif\n+\t\t\t\tif (ret)\n+\t\t\t\t\tgoto error;\n+\t\t\t}\n+\n \t\t\tret = miiphy_read(dev, phy_addr, 0x11, &value);\n \t\t\tif (ret > 0)\n \t\t\t\tgoto error;\ndiff --git a/include/configs/ls1088aqds.h b/include/configs/ls1088aqds.h\nindex 4387862..8b62bbe 100644\n--- a/include/configs/ls1088aqds.h\n+++ b/include/configs/ls1088aqds.h\n@@ -46,7 +46,9 @@ unsigned long get_board_ddr_clk(void);\n #define CONFIG_DDR_CLK_FREQ\t\t100000000\n #else\n #define CONFIG_QIXIS_I2C_ACCESS\n+#ifndef CONFIG_DM_I2C\n #define CONFIG_SYS_I2C_EARLY_INIT\n+#endif\n #define CONFIG_SYS_CLK_FREQ\t\tget_board_sys_clk()\n #define CONFIG_DDR_CLK_FREQ\t\tget_board_ddr_clk()\n #endif\n@@ -357,9 +359,7 @@ unsigned long get_board_ddr_clk(void);\n * RTC configuration\n */\n #define RTC\n-#define CONFIG_RTC_PCF8563 1\n #define CONFIG_SYS_I2C_RTC_ADDR         0x51  /* Channel 3*/\n-#define CONFIG_CMD_DATE\n \n /* EEPROM */\n #define CONFIG_ID_EEPROM\n",
    "prefixes": [
        "U-Boot",
        "v2",
        "1/3"
    ]
}