From patchwork Fri Jan 18 11:19:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1027224 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="eyMK6a6M"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="dnMhejOW"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43gzBQ1p0Xz9sCs for ; Fri, 18 Jan 2019 22:25:02 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C57F6C220D6; Fri, 18 Jan 2019 11:22:45 +0000 (UTC) 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=KHOP_BIG_TO_CC, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 96AB8C21E74; Fri, 18 Jan 2019 11:21:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6C522C21E13; Fri, 18 Jan 2019 11:19:37 +0000 (UTC) Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by lists.denx.de (Postfix) with ESMTPS id 8E58FC220BB for ; Fri, 18 Jan 2019 11:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1547810374; x=1579346374; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=8vRAvQuFS8l5cJUScEwF1zqozYOyphpdu3sp+7FWWzQ=; b=eyMK6a6M8Wz47CVKOOeywWpwN4tX3+ugI1Vb0L5ihx9nTRJbKjVSIMzE w1QiSvT8BJZJXnXBWI5GD2WHtOOV+I1EXdtPx/Dpnawn58fClW0SIdcxU pf2LZ4rl6Xl6QApVLG3zhRNokM88xbnrieD4rXVvbzg5hQQC5/5qeHQBD hYSmK72aD+mRq9g3IJbaSBRDCHRC7/pM7ZDD7MESFxVWxp4xDMs3CdqzI lVCvzyROot83pWJuZd/JNQfkRliUVL9hMwNtcztksltpMpXNIH1Vzvd60 8eCRAxEvgC8vO2RXS+3rLqhyaghklr88lcf+Fczz91eIk8H65XxcHWaUm A==; X-IronPort-AV: E=Sophos;i="5.56,491,1539619200"; d="scan'208";a="100370996" Received: from mail-sn1nam02lp2056.outbound.protection.outlook.com (HELO NAM02-SN1-obe.outbound.protection.outlook.com) ([104.47.36.56]) by ob1.hgst.iphmx.com with ESMTP; 18 Jan 2019 19:19:32 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wXO//Kfin1gKj/p0yKbWUyJRtCa0TcduIQBkAaUkopc=; b=dnMhejOW6wFXBDVxtCdDvgeZ/L86Oa5wc2fLKyd8OL0fDMCVgBKg9m9EkkH2/Ps2HG7KcPxkk6Quqw7hcw4nT0kV/9/bmZCpDmS1Y2BGImw9zrDl7qIxGptxGvOFFrl7jdNEX3nISjfgaCW+HfFi22Ne+BDTY7etWl1OXvpJdOk= Received: from BYAPR04MB5303.namprd04.prod.outlook.com (20.178.49.148) by BYAPR04MB4197.namprd04.prod.outlook.com (20.176.250.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.24; Fri, 18 Jan 2019 11:19:30 +0000 Received: from BYAPR04MB5303.namprd04.prod.outlook.com ([fe80::add1:92cc:65d7:5d94]) by BYAPR04MB5303.namprd04.prod.outlook.com ([fe80::add1:92cc:65d7:5d94%2]) with mapi id 15.20.1537.018; Fri, 18 Jan 2019 11:19:30 +0000 From: Anup Patel To: Rick Chen , Bin Meng , Joe Hershberger , Lukas Auer , Masahiro Yamada , Simon Glass Thread-Topic: [PATCH v2 10/11] cpu: Bind timer driver for boot hart Thread-Index: AQHUrx+uEDn2jxI+dk2pvqMhGC/O6g== Date: Fri, 18 Jan 2019 11:19:30 +0000 Message-ID: <20190118111820.71349-11-anup.patel@wdc.com> References: <20190118111820.71349-1-anup.patel@wdc.com> In-Reply-To: <20190118111820.71349-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0115.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::31) To BYAPR04MB5303.namprd04.prod.outlook.com (2603:10b6:a03:c8::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [49.207.48.211] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR04MB4197; 6:RxVeZ1GM3RQfszerprTnUhvV7wosMBNGjg4dsm3heBohh76PS/YCj4/hrIiAAKdN96Rg8Z+nAShWLLKRilZ3vXVOwcb/pIBY68FIIa+9d56FBdtaQk0J3T0Yrf4qMIjr0DdbUoTUZsM9u7v9FTlhBN/tzv9t5f+BET24UsA8BjxAN2EF4epNrkhGdL4b/5YmmUApjr1oWufAw5WhKVfvu/hsawM9BP1F+rxX5oCUE/LPrGmdu3StO8VLWcvbnNNcD2J59XJzXx+0mrD1yGJbbKLlHVdpl4kT8ENSKTrT4w9o63Y1z6Nfb0B/fujWDgo7UlVbPNWa/tlZ44s5MnbLrK2CMJ42O3jYoSmaqBEdadb95BL/DLCMj9ycfI0CoSPayQutBOstpY0GmNA62UEwv5ZgAhS1OvoToWX1nkj+WTQ2HXxEUmp6ix2L3mpg3HbvG1b0D+/u8Gzi0XrVk0FDbA==; 5:/8K2v80OUC4GAs+ibohB3MRCVNHOOOkzt6IffkDZJj6pp1OCddujRHjHu112uwPFvXrM8OV+LUSHurNnQv0N/gy3GL9H9ijumnTtRSOGwiQByXSTY6Wbz3+O/15zUS8Xbrj6B+pqUkQDXoSsXWZgKj6wXg0YylRyk95wwR/Mf1Ggy1g9ipDZYudqqnkCHWletrTPx91yX+2CfuVZzadU6g==; 7:ChxPwWpf5CEOhZGiy/k11XTLk6vY/cbIQVY5rhhp+idJVMJGxaLro4KEcqoJHnxXS4ZOg1jTolfcyCRvnXMDTmE+e5ELpmTBARLxdvPjn9OMjLf1MN/qptVhglCzDwIvC6ZE8kq1Omk5rx5o8SecKQ== x-ms-office365-filtering-correlation-id: 47852459-ed8d-4820-68da-08d67d36d0a2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:BYAPR04MB4197; x-ms-traffictypediagnostic: BYAPR04MB4197: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0921D55E4F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(39860400002)(366004)(376002)(396003)(346002)(189003)(199004)(81156014)(81166006)(14454004)(8676002)(7736002)(4326008)(39060400002)(305945005)(36756003)(478600001)(68736007)(8936002)(50226002)(97736004)(2906002)(256004)(25786009)(476003)(486006)(2616005)(105586002)(72206003)(6436002)(6486002)(6512007)(44832011)(1076003)(110136005)(54906003)(71190400001)(71200400001)(106356001)(316002)(386003)(6116002)(76176011)(102836004)(6506007)(26005)(55236004)(186003)(11346002)(53936002)(3846002)(446003)(86362001)(7416002)(52116002)(5660300001)(99286004)(66066001); DIR:OUT; SFP:1102; SCL:1; SRVR:BYAPR04MB4197; H:BYAPR04MB5303.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: xOOEhvSXuUqUtlx9tq2JlRN2Mj36q1IY6lG+9XcBdSH8N0+VChSEaWtrZHRa3b9raO3+36gesLWWNa+nYgNtAIOQv+8ayYqe8CKkid4YKwFLBNXGT6UWdPMZFgUdcBfH8pvsnIUHW73FWzkO+YTUjdCprg9eFCdmCChcWX8DkOWXXUaJSikj335jK/mdmsNIdgi+rihcYjvS9CyqIBUR/HumkvfX2HrRUMaeHnHIpJA9oWcNMzxvWou11Ymi3lOJq2tKTnUD4XyUxy3qihMT6ZBlma3XmfiFj9Hrr/XDW0T6xAMgELtxPlj5etZhaKnRJUjHDA/FK6726jbJgN2dJpeWl4ZmaNTDmGsuiE0sfxPkDhFzRoFG7dD/IJhBmuAxoQmYOArq68fWuK9FzSlb75sLUOmVKj1G++A34sRwuuI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47852459-ed8d-4820-68da-08d67d36d0a2 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jan 2019 11:19:26.9014 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR04MB4197 Cc: Palmer Dabbelt , U-Boot Mailing List , Alexander Graf , Christoph Hellwig , Paul Walmsley Subject: [U-Boot] [PATCH v2 10/11] cpu: Bind timer driver for boot hart X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Atish Patra Currently, timer driver is bound only for hart0. There is no mandatory requirement that hart0 should always come up. In fact, HiFive Unleashed SoC hart0 doesn't boot in S-mode because it only has M-mode. The timer driver should be bound for boot hart. Signed-off-by: Atish Patra Reviewed-by: Alexander Graf Reviewed-by: Lukas Auer Reviewed-by: Bin Meng --- drivers/cpu/riscv_cpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c index 5e15df590e..f77c126499 100644 --- a/drivers/cpu/riscv_cpu.c +++ b/drivers/cpu/riscv_cpu.c @@ -10,6 +10,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + static int riscv_cpu_get_desc(struct udevice *dev, char *buf, int size) { const char *isa; @@ -62,7 +64,6 @@ static int riscv_cpu_bind(struct udevice *dev) /* save the hart id */ plat->cpu_id = dev_read_addr(dev); - /* first examine the property in current cpu node */ ret = dev_read_u32(dev, "timebase-frequency", &plat->timebase_freq); /* if not found, then look at the parent /cpus node */ @@ -71,7 +72,7 @@ static int riscv_cpu_bind(struct udevice *dev) &plat->timebase_freq); /* - * Bind riscv-timer driver on hart 0 + * Bind riscv-timer driver on boot hart. * * We only instantiate one timer device which is enough for U-Boot. * Pass the "timebase-frequency" value as the driver data for the @@ -80,7 +81,7 @@ static int riscv_cpu_bind(struct udevice *dev) * Return value is not checked since it's possible that the timer * driver is not included. */ - if (!plat->cpu_id && plat->timebase_freq) { + if (plat->cpu_id == gd->arch.boot_hart && plat->timebase_freq) { drv = lists_driver_lookup_name("riscv_timer"); if (!drv) { debug("Cannot find the timer driver, not included?\n");