From patchwork Tue Feb 5 13:05:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1036739 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="krH0OtlX"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="ZvIpc+/L"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43v4jM0xmrz9s4V for ; Wed, 6 Feb 2019 00:11:51 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BDF1EC21F00; Tue, 5 Feb 2019 13:09:05 +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.6 required=5.0 tests=KHOP_BIG_TO_CC, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2D71EC21F38; Tue, 5 Feb 2019 13:08:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 83C2CC21F7E; Tue, 5 Feb 2019 13:05:51 +0000 (UTC) Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by lists.denx.de (Postfix) with ESMTPS id 47FFAC21F38 for ; Tue, 5 Feb 2019 13:05:46 +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=1549371947; x=1580907947; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=pCoXCPBfXT/wk3+fQHbpZdi5CTiQxXUuIcxCPAIOFSo=; b=krH0OtlXiQrbCUj09fYAq45jA3KfS6AK1amtFKp06eDYElmpNKgu62lb HmsIT5jxIV66/IGdtksiMoi8SRM3ji48NBkMX5mssZePpdHDPGMEoVmhO e1a/Bk4LkyqraHiB7pxv9oqSRImICKRaqMfBHw8gTRrS9KR2jpDkqB6Iv YpbuwTj1vCYnZxkGg72oE4UQzVZKtZAvn7rpGaaA8aZHywiyi6NtM+ywk lkA2kfZjal9WBErt1rYoF+AsKGgBamZB0snX3jXhHJoKWryhjzAeL3YB/ ywb4ZK5DjRI0Jg3mYii0xicFwdC0CKXsk1z1f/eqda6BKIu6JaI2d19BN Q==; X-IronPort-AV: E=Sophos;i="5.56,564,1539619200"; d="scan'208";a="101827092" Received: from mail-by2nam03lp2055.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) ([104.47.42.55]) by ob1.hgst.iphmx.com with ESMTP; 05 Feb 2019 21:05:45 +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=ZZB34B/CzEhFRK9+VzMubQrgwTt3jeoeLouxhZhH8Y0=; b=ZvIpc+/LotWCeyCOI2UZnq/Wa3/wmkrqp7y6W2/Rhy2dH3RopwtL5qjZQOOcQy1dfK0tozmVaVryDqeFf2ywUzskZ9Mn2pYY4fe6sRoEA67GfzBfTCUCHMQ7+32BYcBl6wtqUlZu/6mD63CVUr7pnhsscwdlERgrypB+1PDhAlI= Received: from BYAPR04MB5303.namprd04.prod.outlook.com (20.178.49.148) by BYAPR04MB6229.namprd04.prod.outlook.com (20.178.235.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.17; Tue, 5 Feb 2019 13:05:42 +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.1580.019; Tue, 5 Feb 2019 13:05:42 +0000 From: Anup Patel To: Rick Chen , Bin Meng , Joe Hershberger , Michal Simek , Michal Simek , Lukas Auer , Masahiro Yamada , Simon Glass Thread-Topic: [PATCH v5 13/15] cpu: Bind timer driver for boot hart Thread-Index: AQHUvVN/Hz2L2gFvJUS+bMdzaf0RTg== Date: Tue, 5 Feb 2019 13:05:42 +0000 Message-ID: <20190205130346.77175-14-anup.patel@wdc.com> References: <20190205130346.77175-1-anup.patel@wdc.com> In-Reply-To: <20190205130346.77175-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0071.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::33) 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.55.104] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR04MB6229; 6:RiOXZUBVd2LQUTv7WGBQxIxpzZFmOAhuzdwWU4n6L8tkbkIlums2xW7+t4tY01LLCr8Wx2FppHXkCNXNqNZJbWWSBz/j4sIA972B/GSIgIGcNyfuLFchKJWoUIOmFguLLVAPyiDoA4t12C4ciew1Gabe70YaUVsynf+wQEf+zXBHMCIj6GuwcAsY71z/yjPNZg/6yfa0dKSZeRKb5ZjPdEu7VbjuVswgTOJVv9029DWQpLyOKzl7UQWWR+dfVC1UlF5BLFxOpAuwR2RZAmI7Xt+oGtH4/VFIJOPep6DcOQqZgA8Li3XHAQ23h+bgXGhjiL1iw9k1d4QRGk2MgLZxmDEgSJzkgcvjSvqDtLzN/Ffr+2YzrXyRWZph21l2hHIYy0SkR3kuopxLELR/1St3R7h1mU1Z+Dacvp0V/kyO3IvGqx+g7TgOCHnN5gPAST2xXpU/poZW2/cu1b6Fa/0FXw==; 5:dG3wh90CRbvSsrm/b3BYWJ0hTI4ji7+Hwc/xs9A7iskTakq9IQC+3AC04ksCzB6oPTKDbC4M+XujyW3PXIQz+lmPWsbMeGb5+r0kfqqIcJrxs5bg20FUXZcanM79kXrcbnRWyFPb5mpL/rIR3Qb0I4sznq0KAJtAWpPJGrYveHqZBPHI5SPfXcw0vJ1AnEEj1NUNIRHBE8ZXEetJEWMqfg==; 7:DsFuiXtUlmU00GE3vFOOuh7TuSQI1HPGsGO3EzSo/3OSYrcYbzHq8VuaJMEfuYpl3EXSvg4VIcaNt3rj+v2NSR/6/qpvye+bdvN+2H4bZ5sr0x2+1hLQC39DSf2GSLuPK6i958VQ3ol/7BuG0nfrxg== x-ms-office365-filtering-correlation-id: 4bbcdd1b-7c1d-454f-98f4-08d68b6aa245 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:BYAPR04MB6229; x-ms-traffictypediagnostic: BYAPR04MB6229: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(366004)(39860400002)(376002)(346002)(136003)(189003)(199004)(4326008)(72206003)(6512007)(54906003)(110136005)(53936002)(68736007)(7416002)(25786009)(316002)(14454004)(305945005)(36756003)(478600001)(66066001)(7736002)(1076003)(6486002)(71200400001)(71190400001)(476003)(81156014)(86362001)(81166006)(106356001)(2616005)(44832011)(256004)(486006)(8936002)(8676002)(386003)(6506007)(6116002)(3846002)(2906002)(52116002)(99286004)(55236004)(446003)(97736004)(6436002)(105586002)(186003)(102836004)(50226002)(76176011)(11346002)(26005); DIR:OUT; SFP:1102; SCL:1; SRVR:BYAPR04MB6229; 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: tXEQaVCC8JuZ2vuYWZOgci5Dbp8MY5Lac/bsfeIHWqciVoNBJPEihQ9rwfn3Zlj4ncjZjSauuLqHT70x12czBy/s5FBiWknh8juNHrf4BO0KihLbEKurq6hzJDmrAn00BQ1iV8BkZzEVzzb1q7hlrJs3tBXjMGOoKDwJ63XLTGEg4M8LQAyaAst/XFEXPJU69GqyRUKWkfliN0zUfbvEo1XFS9PjV2B4SydfVUG5koq0ZCO7YRUBZAwtfKXQaa1LDQURpzmfQWCBa80a6u4TIlMO19xQLG0XPSknUjXoyXYv7jpmik/1f5d09jOyG0ee8XyL3YH9eUye2opPB4MpIGLkN624wIb/2lWYP7bCQyP8yxxPLKBIdO57eYJHrenB/U0v3htoKDTsPxle5NVj5/gIsn3cW3dAeajkNJ5VR4Y= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bbcdd1b-7c1d-454f-98f4-08d68b6aa245 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 13:05:38.7246 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR04MB6229 Cc: Palmer Dabbelt , U-Boot Mailing List , Alexander Graf , Christoph Hellwig Subject: [U-Boot] [PATCH v5 13/15] 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 Signed-off-by: Anup Patel 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");