Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/812266/?format=api
{ "id": 812266, "url": "http://patchwork.ozlabs.org/api/patches/812266/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1505121512-23283-9-git-send-email-philipp.tomsich@theobroma-systems.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": "<1505121512-23283-9-git-send-email-philipp.tomsich@theobroma-systems.com>", "list_archive_url": null, "date": "2017-09-11T09:18:14", "name": "[U-Boot,v2,08/19] rockchip: timer: implement timer_get_boot_us", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "54f8dea333bc6d51d13398ea2f8ff906ea483fa2", "submitter": { "id": 53488, "url": "http://patchwork.ozlabs.org/api/people/53488/?format=api", "name": "Philipp Tomsich", "email": "philipp.tomsich@theobroma-systems.com" }, "delegate": { "id": 69486, "url": "http://patchwork.ozlabs.org/api/users/69486/?format=api", "username": "ptomsich", "first_name": "Philipp", "last_name": "Tomsich", "email": "philipp.tomsich@theobroma-systems.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1505121512-23283-9-git-send-email-philipp.tomsich@theobroma-systems.com/mbox/", "series": [ { "id": 2462, "url": "http://patchwork.ozlabs.org/api/series/2462/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=2462", "date": "2017-09-11T09:18:08", "name": "rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/2462/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/812266/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/812266/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 3xrMt36vVzz9s75\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 19:23:23 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid B0921C21E3C; Mon, 11 Sep 2017 09:20:34 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 5C3CBC21EDE;\n\tMon, 11 Sep 2017 09:19:00 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 19F2CC21F0B; Mon, 11 Sep 2017 09:18:56 +0000 (UTC)", "from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id 4BC06C21DA9\n\tfor <u-boot@lists.denx.de>; Mon, 11 Sep 2017 09:18:52 +0000 (UTC)", "from [86.59.122.178] (port=58983 helo=android.lan)\n\tby mail.theobroma-systems.com with esmtpsa\n\t(TLS1.2:RSA_AES_128_CBC_SHA256:128)\n\t(Exim 4.80) (envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1drKri-00016d-Gk; Mon, 11 Sep 2017 11:18:50 +0200" ], "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": "Philipp Tomsich <philipp.tomsich@theobroma-systems.com>", "To": "u-boot@lists.denx.de", "Date": "Mon, 11 Sep 2017 11:18:14 +0200", "Message-Id": "<1505121512-23283-9-git-send-email-philipp.tomsich@theobroma-systems.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1505121512-23283-1-git-send-email-philipp.tomsich@theobroma-systems.com>", "References": "<1505121512-23283-1-git-send-email-philipp.tomsich@theobroma-systems.com>", "Cc": "Klaus Goger <klaus.goger@theobroma-systems.com>", "Subject": "[U-Boot] [PATCH v2 08/19] rockchip: timer: implement\n\ttimer_get_boot_us", "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": "To make the Rockchip DM timer driver useful for the timing of\nbootstages, we need a few enhancements:\n - This implements timer_get_boot_us.\n - This avoids reinitialising the timer, if it has already been\n set up (e.g. by our TPL and SPL stages). Now, we have a single\n timebase ticking from TPL through the full U-Boot.\n - This adds support for reading the timer even before the\n device-model is ready: we find the timer via /chosen/tick-timer,\n then read its address and clock-frequency, and finally read the\n timeval directly).\n\nSigned-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\nReviewed-by: Simon Glass <sjg@chromium.org>\nAcked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\n---\n\nChanges in v2: None\n\n drivers/timer/rockchip_timer.c | 72 +++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 67 insertions(+), 5 deletions(-)", "diff": "diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c\nindex cd349ca..b19aaed 100644\n--- a/drivers/timer/rockchip_timer.c\n+++ b/drivers/timer/rockchip_timer.c\n@@ -6,6 +6,7 @@\n \n #include <common.h>\n #include <dm.h>\n+#include <dm/ofnode.h>\n #include <mapmem.h>\n #include <asm/arch/timer.h>\n #include <dt-structs.h>\n@@ -25,17 +26,72 @@ struct rockchip_timer_priv {\n \tstruct rk_timer *timer;\n };\n \n-static int rockchip_timer_get_count(struct udevice *dev, u64 *count)\n+static inline int64_t rockchip_timer_get_curr_value(struct rk_timer *timer)\n {\n-\tstruct rockchip_timer_priv *priv = dev_get_priv(dev);\n \tuint64_t timebase_h, timebase_l;\n \tuint64_t cntr;\n \n-\ttimebase_l = readl(&priv->timer->timer_curr_value0);\n-\ttimebase_h = readl(&priv->timer->timer_curr_value1);\n+\ttimebase_l = readl(&timer->timer_curr_value0);\n+\ttimebase_h = readl(&timer->timer_curr_value1);\n \n-\t/* timers are down-counting */\n \tcntr = timebase_h << 32 | timebase_l;\n+\treturn cntr;\n+}\n+\n+#if CONFIG_IS_ENABLED(BOOTSTAGE)\n+ulong timer_get_boot_us(void)\n+{\n+\tuint64_t ticks = 0;\n+\tuint32_t rate;\n+\tuint64_t us;\n+\tint ret;\n+\n+\tret = dm_timer_init();\n+\n+\tif (!ret) {\n+\t\t/* The timer is available */\n+\t\trate = timer_get_rate(gd->timer);\n+\t\ttimer_get_count(gd->timer, &ticks);\n+#if !CONFIG_IS_ENABLED(OF_PLATDATA)\n+\t} else if (ret == -EAGAIN) {\n+\t\t/* We have been called so early that the DM is not ready,... */\n+\t\tofnode node = offset_to_ofnode(-1);\n+\t\tstruct rk_timer *timer = NULL;\n+\n+\t\t/*\n+\t\t * ... so we try to access the raw timer, if it is specified\n+\t\t * via the tick-timer property in /chosen.\n+\t\t */\n+\t\tnode = ofnode_get_chosen_node(\"tick-timer\");\n+\t\tif (!ofnode_valid(node)) {\n+\t\t\tdebug(\"%s: no /chosen/tick-timer\\n\", __func__);\n+\t\t\treturn 0;\n+\t\t}\n+\n+\t\ttimer = (struct rk_timer *)ofnode_get_addr(node);\n+\n+\t\t/* This timer is down-counting */\n+\t\tticks = ~0uLL - rockchip_timer_get_curr_value(timer);\n+\t\tif (ofnode_read_u32(node, \"clock-frequency\", &rate)) {\n+\t\t\tdebug(\"%s: could not read clock-frequency\\n\", __func__);\n+\t\t\treturn 0;\n+\t\t}\n+#endif\n+\t} else {\n+\t\treturn 0;\n+\t}\n+\n+\tus = (ticks * 1000) / rate;\n+\treturn us;\n+}\n+#endif\n+\n+static int rockchip_timer_get_count(struct udevice *dev, u64 *count)\n+{\n+\tstruct rockchip_timer_priv *priv = dev_get_priv(dev);\n+\tuint64_t cntr = rockchip_timer_get_curr_value(priv->timer);\n+\n+\t/* timers are down-counting */\n \t*count = ~0ull - cntr;\n \treturn 0;\n }\n@@ -58,6 +114,12 @@ static int rockchip_timer_start(struct udevice *dev)\n \tconst uint32_t reload_val_l = reload_val & 0xffffffff;\n \tconst uint32_t reload_val_h = reload_val >> 32;\n \n+\t/* don't reinit, if the timer is already running and set up */\n+\tif ((readl(&priv->timer->timer_ctrl_reg) & 1) == 1 &&\n+\t (readl(&priv->timer->timer_load_count0) == reload_val_l) &&\n+\t (readl(&priv->timer->timer_load_count1) == reload_val_h))\n+\t\treturn 0;\n+\n \t/* disable timer and reset all control */\n \twritel(0, &priv->timer->timer_ctrl_reg);\n \t/* write reload value */\n", "prefixes": [ "U-Boot", "v2", "08/19" ] }