From patchwork Mon Feb 11 05:43:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039634 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="kPsT/v/r"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="PGnM//pJ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZYh0NTJz9sBZ for ; Mon, 11 Feb 2019 16:47:19 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9D62BC21FF8; Mon, 11 Feb 2019 05:46:20 +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 6A173C22046; Mon, 11 Feb 2019 05:45:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EF199C21F06; Mon, 11 Feb 2019 05:43:06 +0000 (UTC) Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lists.denx.de (Postfix) with ESMTPS id 94945C21FFD for ; Mon, 11 Feb 2019 05:43:05 +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=1549863785; x=1581399785; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=pCoXCPBfXT/wk3+fQHbpZdi5CTiQxXUuIcxCPAIOFSo=; b=kPsT/v/rIutVoQZt2pjOAcuzrJfsF1ebBDl5dro050T9NIKPeDN3stHE OW/F3SnCibW7a0ztvMC0HcrKSlZG7TVmBmxYKvIZKpNd/GTH9R/GaqNlv 05rZDO+ZRbpYqmMuUTPBGeOI/x49caNEwfFnQn1qERDoUsFSxBjIK2MRW viEedZoNxS8MZ6yd16QPaOMBM28TRmyBtQxKig2pbdXOM1CLsm1Zyfgzt q7T49OcoSQdZziELKwtJ3IlHw8TWVHEXRmd8zxa9QmRs24ZgYQwzV8OUe a39B22vC0Onecxt1DsILEN3Qg0EoyA+mTPESKdWpwSk9TMzE41KUX0UWM w==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="206029344" Received: from mail-by2nam01lp2050.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.50]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:43:03 +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=PGnM//pJipmRxzhxaIXTRrv6Oe6KyOgIcXI8rSkFWcn4/2v7tupGckHxG12unZvhA49bmDEwDCpD7qPCQj4fwXijhazk9AOzxmf4BT0FxltljVVUb63EJEu8mWHB+yZQmdvKsolTyVO4c5dH/Skg281zjl5F0c6mmSVtKKzyuv8= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB5981.namprd04.prod.outlook.com (20.178.246.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.17; Mon, 11 Feb 2019 05:43:01 +0000 Received: from MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1]) by MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1%7]) with mapi id 15.20.1601.023; Mon, 11 Feb 2019 05:43:01 +0000 From: Anup Patel To: Rick Chen , Bin Meng , Joe Hershberger , Michal Simek , Michal Simek , Lukas Auer , Masahiro Yamada , Simon Glass Thread-Topic: [PATCH v7 12/15] cpu: Bind timer driver for boot hart Thread-Index: AQHUwcymmTcftltgeUKlC5oj55F6mw== Date: Mon, 11 Feb 2019 05:43:01 +0000 Message-ID: <20190211054030.21393-13-anup.patel@wdc.com> References: <20190211054030.21393-1-anup.patel@wdc.com> In-Reply-To: <20190211054030.21393-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0132.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::26) To MN2PR04MB6061.namprd04.prod.outlook.com (2603:10b6:208:de::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: [129.253.179.161] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MN2PR04MB5981; 6:xqIt4j14/CX9uOTgfyc5l0GiyNI/sUtd7NCAsOD9GbUqx8UHMNFF3GnmI4A2y5k4dvW9CA4+R1tzSg90414PtWcZ6jIQzrHrKLhNECw6mwkNwrWdQuV09ojtbUCncBnyjdLcCtuT3VZuDv1rl4Tb5ZPrgwYs45i5F/+zEksQaeC9iEmSXA2dlDpB6JwMNwyRUs4k1Mp0cRh9V0wV0sGb2o/zl6MM0+MqNqg/jUJTBaBsNidfuy1SZwoxGRkGgmpCc3H50aKBYHzYzBxynFnJBIMBwryStWbF1tnoyqEC5v8Y+oxfoosz6xmzmE714whtgOWLhEaDdIvCjKZBZm9u1RvYwTmVfwDS52shvEE5RWdwMuk9AbQgfrY3VqVlQ0gc7eDs8YWg2arhY6/7KwoEv/ynSQavzdAomiflWOpzdVgqxUdTg8526ZR4VddhKur+jzQAiszVk4dbo3iBlV307w==; 5:uuIgNYTMpGFzh96H5YjjGmEwU2uMZt5nDLuWf+zWgF2UkUgscdNi85u9ktpny9Q2bzHGv1xPbTsjjq5sWdRXIkmS9j0O16W+zzZSMy6TqPtaQsIeNzzq5DvvAqEP9l4qFdipSSfAx9cItRJbkb1RZMYigB8Y2cl3zFjI9N+vG28C6qwJW7fC8DYiXW8A3jwzwRfMydR4gPmmiD49DMbAZg==; 7:kC8GzWJcYdap1urn1wugcaPUngzSniUDHLNZaqje2Jn3/d1UZdstjHoDuCg/cqG1RD6aS0OEFfrauLsYEWzD5Jo9KCCaDiKF4xKk/GrcWb9wLjZlkA40IVTKYO+8zruXuUHsWMs7WnpP8LGDdJ7eIA== x-ms-office365-filtering-correlation-id: 41aa7081-09d7-497e-3ce4-08d68fe3c8fa x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:MN2PR04MB5981; x-ms-traffictypediagnostic: MN2PR04MB5981: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(346002)(39860400002)(396003)(136003)(366004)(376002)(199004)(189003)(54906003)(2616005)(81156014)(11346002)(66066001)(486006)(26005)(44832011)(6506007)(386003)(476003)(110136005)(6486002)(102836004)(316002)(446003)(50226002)(1076003)(6436002)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(105586002)(6512007)(305945005)(71190400001)(71200400001)(256004)(106356001)(25786009)(52116002)(76176011)(7736002)(3846002)(6116002)(7416002)(14454004)(97736004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5981; H:MN2PR04MB6061.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: qM5OYJUODNqvo87QvJdQ+Qzjp9yZz/femXqVa51NqNuy+QbYim2EAGeZQW2s8uYePi/Fb+Cnzs065cLinPir+8U0ch/tgWgNhACqfozc1zwFpe/seduP7BWoMPpc7NghQixKyv0904zdWjPDJdIZhkuZN23RB8SHjgzonAGpdrv/ZKl6viS6OwL9lw7T4PNtmu5gKUxfp22Ol64hhWPTY4juE6r55FMI0F1l0+tgPvvv4WnpzIvifTJLnx5FD3U/RYFchYJeGtyHyE5wJNgmIi2cO8KxayQ8J7FcS+M4UuVVTmDUovMxK9OKjLYhc094JuZn75Uwd2YPvwV+awQuV2np4imSIrE/hsAGxGOAGIpIhiQROXZx1RalcWjZ6kdUAg0d8i9AucN9O8I+FLkXxUbjBSXGPeTVViyyYLtiecI= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41aa7081-09d7-497e-3ce4-08d68fe3c8fa X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:42:56.6901 (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: MN2PR04MB5981 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v7 12/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");