From patchwork Mon Feb 11 05:41:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039625 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="Y5pzYBbw"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="j36zp59I"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZRb5TzRz9sMp for ; Mon, 11 Feb 2019 16:42:03 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 7D3E9C21F51; Mon, 11 Feb 2019 05:41:42 +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 2561EC21F63; Mon, 11 Feb 2019 05:41:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6ED40C21F01; Mon, 11 Feb 2019 05:41:27 +0000 (UTC) Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lists.denx.de (Postfix) with ESMTPS id 34657C21E2B for ; Mon, 11 Feb 2019 05:41:26 +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=1549863708; x=1581399708; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=5tZq2mcSdiVDj2DzdrOo2kinrTqbXuwd79elr0zoDvg=; b=Y5pzYBbw7LzxiKYhWjbxxHkcOJ5lNqc9xMLsAJM1aMNX+Os8E7h67rbJ GsY4jvw0PB4bnyo8PFWVarw/mYKV1CoO+f96kCUK20JNF81TESMyV0zIs edlUV2O74MRi/IOAV/6Z4EwCMRK01sJaoXHYXDnsr5M/h+5dJyLWQPNYI 6M+QyTF/Mt21TYKjGWSMEivXC49wPHjbf75Ti2G38xYi9meAJTWEgl/lH 3W2pIQiMGZPo/+vgBE68ek4qHjXYtFa/iTyhmSpd9jmk2oN97d4cfV9FF rMc/+qym4m9Oc4HwrvG0UndpPnAwDx2Cc8WL4i8Vpkonwe5Pb2ssnGhrZ Q==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="199087384" Received: from mail-bn3nam01lp2054.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.54]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:41:28 +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=28H76r1RkZ9Ba/1UBrKvO+eKHxY6tk2Zj0RnjFAbgLE=; b=j36zp59IuerjEzYXEYhgyG0elt5G1xxrvqTFV253knIXj4p5aql3blC1UYHZH0zAK7TYV2pWip6etS7LNztirjEk2blsCqI/okcLGx+whbXzevOnVj2O30EZKqu9/KUh752soRLpIEjj9PnDZf+vnZ1WyOZP+i8CLOTx139eUQM= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB5903.namprd04.prod.outlook.com (20.179.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Mon, 11 Feb 2019 05:41:10 +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:41:10 +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 01/15] riscv: Enable create symlink using kconfig Thread-Index: AQHUwcxka/99/FThV0SN227CsUA7qA== Date: Mon, 11 Feb 2019 05:41:10 +0000 Message-ID: <20190211054030.21393-2-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; MN2PR04MB5903; 6:ddOIv09LnvOk5p9OsV2VdG/iqTWdGjsUpC8WrEHLDWkCTVHbCN7nJw/q/Qo8ckJzycRRVUiNWvH8apSUeywFPq4JzENl6hjXs5EhB3qBxxo1E0eMMh8tv6JXblk2oQmKQ3lrEROWiDx80eWJmcHpMGSJ4I3/smu0n2Qt5rM60cQrgxual/AtY7n7/BAQyNJzUmQRCim4k7HYcihVxfXFqNq/dRhFcqMvMUveoaNlG76LBAOImiuh77bodMDOHoxiwZAVXwjEl1JGgJCusqDWtXSH++HpFg2r5irbgMFmUFd/BqMb5s703KEqcgPcyzC+DBCineb9zRs6TamOrVobsUvlDbWe3sFA4UFLFPR2wU+yxo2Wrfe5B1mrJp3LCO7O/3sFwtZVyzjwuBbupi2uebP23pORh7cqndKS/Rd2czTiVGJeCncD/abPEG6eO/EwZrfWd5dqZt8hsU0V5FfWLg==; 5:5rhcH7iWTKmS+WbFGCzyTDEL+7o9S5VVi2u/R8MWkXyUjZyNSDjjW9LIn+MaQkK9deyEvD6uAEU/LG5p2qtAtLGSpCczI/fX3yhr0J/dvootN85KLwVDP4t0Fxvgwi2ARpvyNshi9AGdcWZGrHjkADdavRrZbt5FTkzPq+ndLQ4VJKIbHv1lVNH92nnZTcWHVXuKmn6UF8j/8Z5z+QA/8w==; 7:3crN2oQzB7uXJz7Is5likh97v8LGVIT9K+7v8n6yAfB9CYfknfQN7cOUO7DpOdr7GpGzbCJbFQ5xujP/gCIvQSGwOAymOJi6HAjgiNGLml1/mT0Niw8HOYZqKTpwRCyJmvxdx37syL4snD1bEZQtOw== x-ms-office365-filtering-correlation-id: be108e52-177c-4519-c0c4-08d68fe386c2 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:MN2PR04MB5903; x-ms-traffictypediagnostic: MN2PR04MB5903: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(366004)(136003)(396003)(346002)(199004)(189003)(81156014)(54906003)(2616005)(11346002)(26005)(66066001)(386003)(6506007)(44832011)(102836004)(6486002)(476003)(110136005)(486006)(446003)(316002)(50226002)(6436002)(1076003)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(6512007)(4744005)(71190400001)(71200400001)(305945005)(256004)(105586002)(106356001)(25786009)(97736004)(7736002)(52116002)(76176011)(3846002)(6116002)(7416002)(14454004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5903; 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: Xiaw4WVNn5e+cnCEO1P8XGpUWUGkYvsYju70K/029xykC34Lpqj8GJnqLGk4wlwq/6U9EOgd6s6awA/skzy31mTz6GSOCjKPnvMLvPpULPZJ97psJQmlPrCuonemgoc2UM69CvSu2ktnv5wNP3PmXrnb7RnjMaAikRyfWAXtop3Dt6pBVoZjkDlebaaeT1hhrIaXlJdutzRAIbjkZn+scjCMtoQsSmmEF/hmpdPCSPSD8123l5t87GkdUNul8I43SNdwBfH6Lm06zjOLOU8kyP2j4NPvMmLNN1+/N5lnFWrZ1Uf3mowfXuW5pZSFtSNSA7yMGe5w2bikby3YMNMQ+GpI/Ufq4HqVivq7qKu4rG+Rswl5MszkH7h74qD2YpZ9YlcmgJ8g/zRzgjWBnlPixONIj07G+jceIc7f+ewDOq0= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: be108e52-177c-4519-c0c4-08d68fe386c2 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:41:05.1505 (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: MN2PR04MB5903 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v7 01/15] riscv: Enable create symlink using kconfig 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" We select CREATE_ARCH_SYMLINK for RISC-V so that we can have include/asm/arch linked to include/asm/arch-xyz. Signed-off-by: Anup Patel Reviewed-by: Bin Meng --- arch/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/Kconfig b/arch/Kconfig index 35e2712fce..4ebc66227e 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -61,6 +61,7 @@ config PPC config RISCV bool "RISC-V architecture" + select CREATE_ARCH_SYMLINK select SUPPORT_OF_CONTROL select OF_CONTROL select DM From patchwork Mon Feb 11 05:41:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039626 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="SGIdhmpt"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="lAZcF0qq"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZRw2X0Pz9sMM for ; Mon, 11 Feb 2019 16:42:20 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E2F06C21F06; Mon, 11 Feb 2019 05:42:00 +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 DEDCBC21F4E; Mon, 11 Feb 2019 05:41:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 65FBCC21F98; Mon, 11 Feb 2019 05:41:38 +0000 (UTC) Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lists.denx.de (Postfix) with ESMTPS id B683AC21FED for ; Mon, 11 Feb 2019 05:41:34 +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=1549863721; x=1581399721; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=+1dHWBdw2XLpAcMfCWYr+PqC98zOpyZ5wR1sDvmGbmU=; b=SGIdhmptJsICpOg78KuJODMfnTNA2HCMe3t9g4GvTTfJ5sRccgT4rBRG hJ1M0Ez6IuazVLMJCpvnCs4/DnVLux35aSFUoDxpOodwMw0Gnwn//y8m2 31DBm8mC4sH4xcu8/fmxlTlt7X5q1afkzgw9zmmRFM+iBcPLz14SAuem+ wZWFN/SXxp6jY1J32W+XtPA2dG6Tt4ufcfhwesqRklUvrdHmW3HgHOpvP FGhaAaiYIY2kat9l8gvebKpttem+DgFuWWf18clhQuX3qNCx6cEskHwIp 8S8SD9lIjOavZsIFLWEkhYpSsin2+1+n9s2/VWfvX7iCFGPVPDdTAkZi6 w==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="199087392" Received: from mail-bn3nam01lp2058.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.58]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:41:57 +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=iHDjkn2y8af6w0D8nrocEn5MgT/9t0sM/TjNyKkoQ2c=; b=lAZcF0qqqxf93nZeq8lzmH69yiIKWc1Ogj/0TFOykcKkMKnjhNR8f1fjleyQ8W0s48ZpjKGPc1a4WkkQV7l0wKXAKC4w/DxHXvlMQqG9jL2xxP7yH2RTlUXKEr7IbRj05ewzZ4juu9rynPdXQXqW7zcAGXwtmk71uIxY4Rn8smM= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB5903.namprd04.prod.outlook.com (20.179.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Mon, 11 Feb 2019 05:41:16 +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:41:16 +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 02/15] riscv: Rename cpu/qemu to cpu/generic Thread-Index: AQHUwcxoskuEey5Bm0uW8nba49nYCg== Date: Mon, 11 Feb 2019 05:41:16 +0000 Message-ID: <20190211054030.21393-3-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; MN2PR04MB5903; 6:W4aHPp1ybhJtq41iR4Utf/9AobVZh+Fa/4gevXqRkT8WSbJHyBoILd0kp8e4jwZkj/uw3mYNsEdeJILyoHtzLoDa6tuAxUEzUDBeDvMPt3n+GqL0ob6EWuEVbWciIuEzxpsY1DkBd6sD1dmlaG9/P+UbjT09crebFlzC/fbcbyEmOjchnXmevg3IdVIYsYlJ5xYB/vW3fwSmPaqGtU0GBPWRNvZcZw5NN5enTEoO1/bGZtnKqjusXZU+7UhszmbFpkTZuhWyHwaHHIPhgdZAGgoy9gPK0B2ujyVgvT+96CUFi/dGpkc+TkRzQ9OxddRkgY6MRxbUeLqHUbw4OEnc7SO28UmfRsHFTFnU9nG2Pc4aKIYf41OmM2fzvYJYne6tloNWK7AKFXT1Zf1NEdyOHBDObBQuPb08otdEaPNT/z3+WtWjHaWr9AJtxe/pPjkfRhEg1LgZHsPZlzxDsIRcSQ==; 5:urH/bSa0sqXaWqU6YQToaRDEcYuqW3/adQkk7QxxY1G5GVyGHVpfp4rU1sHQcd81UNNHkBfL0s6oFHde+57R933r2g/nac7NYkuO0X9GFLdFK/+y5BJeYeW7JJQNhcJrmovrO7b9EzI58w7drwVUp2qdIXOn6bQ6JP6aZGVMALyuDIS3++AkkC630mE0tchZ8X6lCWyzh0UzOWHrW245Ow==; 7:YiQvVCr2rC7cVpdTFL0lKUU/27v5KHu+qwqsPzf4svoVSCOQcuBoU4ZN075+wOmlc2UAz4cQTxvDCJr7pHtP4x6GURKfap/tAqQfD2Nu0J2nE4ATtYHw1ZozrfU1stedTI/E7Waf5+Rlev1kb8csnA== x-ms-office365-filtering-correlation-id: 62564fdc-7949-4cd5-2a35-08d68fe38a98 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:MN2PR04MB5903; x-ms-traffictypediagnostic: MN2PR04MB5903: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(366004)(136003)(396003)(346002)(199004)(189003)(81156014)(54906003)(2616005)(11346002)(26005)(66066001)(386003)(6506007)(44832011)(102836004)(6486002)(476003)(110136005)(486006)(446003)(316002)(50226002)(6436002)(1076003)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(6512007)(71190400001)(71200400001)(305945005)(256004)(105586002)(106356001)(25786009)(97736004)(7736002)(52116002)(76176011)(3846002)(6116002)(7416002)(14454004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003)(41533002); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5903; 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: aIsud9XzzaiMoazYOvahBPgihmZMrKZaK8eKcNp6866pJQ6p2d6dr2VUViTQXi0+UV3H5Sz05tltW4T1kUPf1E6Fw/ELJ49hm1fI7VYC/GE4NQmArIDypReJP98FJt8M1JBiV1MYwvspEZ6zz8lI4WLGHbC/nag0qm2P+yzYbMdODWBghkSXUt9b98/WK1VLIC2wGEEIGQi8Iun9zdXzNs8ZlI9HETagmR8kJUalKXuBWduAyIwPeSdm3wkgmzPZa7ua4b8n4TPWdUeIbij+rHgVNlnI/Kp0UzqYWBqi7p5qTSmHu8K7a66YB0jV7Ww2FjS4vEbihFT7vcN9Ye2KwGHyMCdEOJDF9T1Jzyj74xsu5TpqUoqzdSkMd4g33mpKwVXqH8wYtlPMhYwJaz+TeTmqu3pIZ2ETPwzb2DxSAqU= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62564fdc-7949-4cd5-2a35-08d68fe38a98 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:41:11.7885 (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: MN2PR04MB5903 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v7 02/15] riscv: Rename cpu/qemu to cpu/generic 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" The QEMU CPU support under arch/riscv is pretty much generic and works fine for SiFive Unleashed as well. In fact, there will be quite a few RISC-V SOCs for which QEMU CPU support will work fine. This patch renames cpu/qemu to cpu/generic to indicate the above fact. If there are SOC specific errata workarounds required in cpu/generic then those can be done at runtime in cpu/generic based on CPU vendor specific DT compatible string. Signed-off-by: Anup Patel Reviewed-by: Alexander Graf Reviewed-by: Lukas Auer Reviewed-by: Bin Meng --- arch/riscv/Kconfig | 2 +- arch/riscv/cpu/{qemu => generic}/Kconfig | 2 +- arch/riscv/cpu/{qemu => generic}/Makefile | 0 arch/riscv/cpu/{qemu => generic}/cpu.c | 0 arch/riscv/cpu/{qemu => generic}/dram.c | 0 board/emulation/qemu-riscv/Kconfig | 4 ++-- 6 files changed, 4 insertions(+), 4 deletions(-) rename arch/riscv/cpu/{qemu => generic}/Kconfig (91%) rename arch/riscv/cpu/{qemu => generic}/Makefile (100%) rename arch/riscv/cpu/{qemu => generic}/cpu.c (100%) rename arch/riscv/cpu/{qemu => generic}/dram.c (100%) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index c45e4d73a8..6879047ff7 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -22,7 +22,7 @@ source "board/emulation/qemu-riscv/Kconfig" # platform-specific options below source "arch/riscv/cpu/ax25/Kconfig" -source "arch/riscv/cpu/qemu/Kconfig" +source "arch/riscv/cpu/generic/Kconfig" # architecture-specific options below diff --git a/arch/riscv/cpu/qemu/Kconfig b/arch/riscv/cpu/generic/Kconfig similarity index 91% rename from arch/riscv/cpu/qemu/Kconfig rename to arch/riscv/cpu/generic/Kconfig index f48751e6de..1d6ab5032d 100644 --- a/arch/riscv/cpu/qemu/Kconfig +++ b/arch/riscv/cpu/generic/Kconfig @@ -2,7 +2,7 @@ # # Copyright (C) 2018, Bin Meng -config QEMU_RISCV +config GENERIC_RISCV bool select ARCH_EARLY_INIT_R imply CPU diff --git a/arch/riscv/cpu/qemu/Makefile b/arch/riscv/cpu/generic/Makefile similarity index 100% rename from arch/riscv/cpu/qemu/Makefile rename to arch/riscv/cpu/generic/Makefile diff --git a/arch/riscv/cpu/qemu/cpu.c b/arch/riscv/cpu/generic/cpu.c similarity index 100% rename from arch/riscv/cpu/qemu/cpu.c rename to arch/riscv/cpu/generic/cpu.c diff --git a/arch/riscv/cpu/qemu/dram.c b/arch/riscv/cpu/generic/dram.c similarity index 100% rename from arch/riscv/cpu/qemu/dram.c rename to arch/riscv/cpu/generic/dram.c diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig index 0d865acf10..88d07d568e 100644 --- a/board/emulation/qemu-riscv/Kconfig +++ b/board/emulation/qemu-riscv/Kconfig @@ -7,7 +7,7 @@ config SYS_VENDOR default "emulation" config SYS_CPU - default "qemu" + default "generic" config SYS_CONFIG_NAME default "qemu-riscv" @@ -18,7 +18,7 @@ config SYS_TEXT_BASE config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select QEMU_RISCV + select GENERIC_RISCV imply SYS_NS16550 imply VIRTIO_MMIO imply VIRTIO_NET From patchwork Mon Feb 11 05:41:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039627 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="MWrd9p6d"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="NEINakEo"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZT529Jmz9sML for ; Mon, 11 Feb 2019 16:43:21 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id F1356C21FD0; Mon, 11 Feb 2019 05:42:15 +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 7369EC21F01; Mon, 11 Feb 2019 05:41:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 16D85C21EFF; Mon, 11 Feb 2019 05:41:39 +0000 (UTC) Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lists.denx.de (Postfix) with ESMTPS id 85232C21FD0 for ; Mon, 11 Feb 2019 05:41:35 +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=1549863722; x=1581399722; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=K/kNbbU4OzFs1n0QiJklFreVcLLbip2rY4C5Ejf7+SQ=; b=MWrd9p6dH/JVFHdQELUUJCmyGWZJ54Z8dpxFZWjjPCPWY4Lb99R+Wk9Q w/B5GyTkNtORayu7MNdaAXmCNOQOwon2CADEjKejaYmCDdlzXWcowHOgK 7ufhPzck38A07ES8XQh5sh5BYtXUUIoNkA1OrympCvikAX9ts6QPvZp1R C8YlAHD2/H3D3BLgwzf/BkFl/u5LjxJ1ufkFicsLOQ4RQNL6ApSn/Tgfj cVZfos/yLbf+Z9EwF5W+xzhHSFu+vUjUMv0eZA6/tlw1roZrvXd/4TAt+ DpNR5okEbSnbG7Bz/kEe05pqO+V4yvJl2jWTcsdV5k4f7Q+Yh83sz8MYr w==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="199087397" Received: from mail-bn3nam01lp2058.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.58]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:41:59 +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=Rpk/XN7Lg2I6GJgqfRw3BepiYnKjncupt56lTf/FP44=; b=NEINakEoiF8RKToCRexIncq0pg6KtI3EmM/BAMbL55StLnjWALEcnlulSSALHincNxJQ2oUcjCaOnSe93wAal2hjLzge5+w/mCoKVXCswJcc27L2UJPWaNmfAgWF3cBWPN+FKSMmYP0lbJ4XNspnSRxKx5m0T7zxWywIX2VcNRQ= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB5903.namprd04.prod.outlook.com (20.179.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Mon, 11 Feb 2019 05:41:22 +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:41:22 +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 03/15] riscv: Add asm/dma-mapping.h for DMA mappings Thread-Index: AQHUwcxrr9FI3hxmw0WB8eYpb0p+Jg== Date: Mon, 11 Feb 2019 05:41:22 +0000 Message-ID: <20190211054030.21393-4-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; MN2PR04MB5903; 6:uQ2qGs/Rcw0Eab1jVSAPML2Rxm7p4PLCT+XDysg2fse57yyhtYeW+oYxKcoyN0fMGSidcXHHZwneYdbk0DaKOEA4bwOoQKbsiwXUq2HopJ5oxx258TKei0RrVFmfJZV//7LztMWKJlf/Psudn5Y2/zKZ46gBLb83+PYanqB8ZMFfhET8IiPBMM9SYePU9WXxqpY67PmpZGiusNBeDA8gW6pi/orrFDcqhr1itnfic41BXTc71mDrZMlrsoLrzYkmMqxNee6XrCGh/zI3nUmyUlhiT/XJD8BYUfYTwVUNCIDPpwcmW859FIRhWqh3cAJBko1S8dNVVSqJAMcFfNsGxsgg54Uc9oyKI5EwtJAnHMn9prLJ7JXACZP/YeqlOvs/ISpwZN5+tYT2tWS8DxS2G1luWlHUCAoDwI87C7xmWSGcMYVHWZ5eZUXxg9hsMHqqVeF77EbwL0FQ69p9ogJRRg==; 5:bLFsOC9GTocMlYv5SW4OsxLGlWwzvPCWa7xFa/GeFQLcIabUsOzhgGYAJ5NNAxueJ5DOFyJKCbcGpdvO2Unew4xTBZyo1PYY+sqzJDRw1nUGiOf7HIWmKhFfCkKi3WS1LgDkfr/rsA4AJot96RoGmrQgZueWsjAKomXDsMPMZGkF/GzKIidUjVRlP/DoGoE3CexHzQMTYBOJEyHxinxcVA==; 7:ADIGuryTLpPQ+bQ4b8b6fGSXce+8jveSLQT7zFxpVwSh7lOTgjBuiSdoNA5Ektc8zglAHg5SkuDPLvG/vDSeymlolyD7rshfAcyCVxnQYWpkxnrWysNNqzt5eWq4nbKy64YdETDZ2Gl8OY04UMhTzw== x-ms-office365-filtering-correlation-id: 32e84e81-ca4a-4445-028c-08d68fe38e15 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:MN2PR04MB5903; x-ms-traffictypediagnostic: MN2PR04MB5903: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(366004)(136003)(396003)(346002)(199004)(189003)(81156014)(54906003)(2616005)(11346002)(26005)(66066001)(386003)(6506007)(44832011)(102836004)(6486002)(476003)(110136005)(486006)(446003)(316002)(50226002)(6436002)(1076003)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(6512007)(71190400001)(71200400001)(305945005)(256004)(105586002)(106356001)(25786009)(97736004)(7736002)(52116002)(76176011)(3846002)(6116002)(7416002)(14454004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5903; 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: jrNEXRZDhVgYP4sXEcrpAiq3C37d3M9cLeN51TLZX5bWFeu7QbmNKqNcBG6CVspDvZVTapBy7eqlUJ2gPkq3Gs7sM/AeFEdfEwUvUIOMz2RHEhaA9FYRRorICRbml79MdFtRH1+JMH4MOcucA2j2XZUQwKm3jTpqBvUSQgRWNoT1C2W3zBYK8Y1LJK5tG8n39xEbs8FTIq2Nua51viNmldwPrBUsaQ59oGtfW7P+0l7a5x/3bG6gm2oFx8iiL8zDNS5LZ7fVp/JFKUpsuEeYdBWitce6vimlnNpxlXQxizAJJL5ImdsyE5H7Mh+fkKS0iOVUKAdp3ZGEMR0+QuxYPlSlAVK4g35HQzi8AJmXW5j7em86JXZH0o+x8H1Smgnt2Kehi6L06vYl872yfKG6LOfzufrUvymFVxHYC7/VZeQ= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32e84e81-ca4a-4445-028c-08d68fe38e15 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:41:18.0091 (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: MN2PR04MB5903 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v7 03/15] riscv: Add asm/dma-mapping.h for DMA mappings 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" This patch adds asm/dma-mapping.h for Linux-like DMA mappings APIs required by some of the drivers (such as, Cadance MACB Ethernet driver). Signed-off-by: Anup Patel Reviewed-by: Bin Meng Reviewed-by: Alexander Graf Reviewed-by: Lukas Auer --- arch/riscv/include/asm/dma-mapping.h | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 arch/riscv/include/asm/dma-mapping.h diff --git a/arch/riscv/include/asm/dma-mapping.h b/arch/riscv/include/asm/dma-mapping.h new file mode 100644 index 0000000000..3d930c90ec --- /dev/null +++ b/arch/riscv/include/asm/dma-mapping.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2018 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + */ + +#ifndef __ASM_RISCV_DMA_MAPPING_H +#define __ASM_RISCV_DMA_MAPPING_H + +#include + +#define dma_mapping_error(x, y) 0 + +static inline void *dma_alloc_coherent(size_t len, unsigned long *handle) +{ + *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len); + return (void *)*handle; +} + +static inline void dma_free_coherent(void *addr) +{ + free(addr); +} + +static inline unsigned long dma_map_single(volatile void *vaddr, size_t len, + enum dma_data_direction dir) +{ + return (unsigned long)vaddr; +} + +static inline void dma_unmap_single(volatile void *vaddr, size_t len, + unsigned long paddr) +{ +} + +#endif /* __ASM_RISCV_DMA_MAPPING_H */ From patchwork Mon Feb 11 05:41:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039628 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="CXyKFJBy"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="MhBzs5Wk"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZTG1SdQz9sBZ for ; Mon, 11 Feb 2019 16:43:30 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C5E1EC21F27; Mon, 11 Feb 2019 05:42:47 +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 32504C22000; Mon, 11 Feb 2019 05:42:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 12355C21F92; Mon, 11 Feb 2019 05:41:56 +0000 (UTC) Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lists.denx.de (Postfix) with ESMTPS id D5313C21F20 for ; Mon, 11 Feb 2019 05:41:53 +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=1549863750; x=1581399750; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Rxw/HGk4Ef30lcWLuGVBwavDVNe9aTlDMBS9ivUuj80=; b=CXyKFJByuq28bfXiFahAVpXNAUvDrxVQ/DO+gV7uKUKUFrxF+9AwpT9U 4ZKsPw9NlI0j3XXrrXTWLIaF03gfI7xAK4yJRNJ2Vpy7Y4S2/gIIXK6+8 kJMIJprxCN5KtQN7VCdICvipDnQ9lF63tGHavpitO87PMvuIOJVP8T7Ms 2rwUyerWmKPto4ycSg1f03onQyM+mjpu3zCbNBw6XDwwZj7soYspmgcvm 3ba1Y9cCoz+5xhKB50Xy+iYZ9S1U6XepnmrvDBA0z6VYKMzj6Vesv3Y10 CfHOJjTF/jyOLKqbz6ZUvBcR1CY2PejmK+2xFfCaCnAd9dsrPIczNttGC A==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="199087412" Received: from mail-bn3nam01lp2053.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.53]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:42:26 +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=46Re403FrHXRWiUWqwzz0Vhd+b6jG4OxlhdwKxVhyf4=; b=MhBzs5WkbtO5PviZEk2+AL0SICfBNj23wmmpFE3MKssYVYk4geAsHvoXT50dPbh9BaxoHWQjiqoIb1coHBmF83s/NCvKTZ+q32Gqwha6PWT1Tw/8Qkp01QAbzCjhJ8fLgv5cwZH4MheefAP+QfkyMFSP8Ifzrgf5b2XntGOfF/Q= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB5903.namprd04.prod.outlook.com (20.179.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Mon, 11 Feb 2019 05:41:35 +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:41:35 +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 04/15] riscv: Add place-holder asm/arch/clk.h for driver compilation Thread-Index: AQHUwcxzC1KGp8IRGEG/pNkwwQcx3A== Date: Mon, 11 Feb 2019 05:41:35 +0000 Message-ID: <20190211054030.21393-5-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; MN2PR04MB5903; 6:846mj6iNCTgLjY6HWHRczY1axplmU6nj3KMRGUGc8TpN/qKATIeZ6qUxKOvoVt73Lx3JiKVLsPxlx/21d6R8aV2kWnNpkwUg012fifBnHtyCvBiWZEHoQscunAK/9IGowhZ5G28uvIAUtw1/03VspS3B7Z1q0eKlQejH4bTLhpw8HT8oE+yAs5dZxwWGctlOGkfEIltYnaaiss/JvU/bwcOqmSpOXGqLbt/fyrHZPNH2djKgQHy19hEp5XhGb1QGQv0denSfnyd+eBenW7RDYhKlRKWz8e5Xq/CHze06g9RY3K2+lVucWPAkC9JTuRNtOIDiLj/VN7KRSS6xvV//zMtQSFihgSlj9zzR4oMRcO1ONV2Sz1IUXu5FowDWWWNBFiz00uEPU/b/nEl79z3A2oEbV9DK/W8ZF5PwCz3MVaXpN4cL0foX40xVb7mPSUrFFBttPhEbVaheN6cl12wfAA==; 5:wNZhW/IO0bx1oqv5/P3oJ+z7/Ybh5GQVrtmxlwVLnFRkJYojojDgu78YCcXCtsv/b2FyezAjEVB9IfwboT5dYdbrQmO5OkBEjtzx81fTKxNJchC59k8QWO7Fs5WBdj1qH7tb8dht6TvN/Osilc+pz6k/aY2CavV6KCL0LPqBChgKwAUSh5+xkFaltI6w012QiR8rgbDybUqVOuKMiDvRmg==; 7:BQPMNgMINkwLnW38qvuLSkZgyLcg0+5X1WkMmYCuHlmGyWEAaz354B32HaxjUWVQRrpOzcaPxzdfXRyPETrwkEJGuZhqX79q77hs+O+AA4a14H66QD9w8ayQYuzYs7S3013P0bJUvAPNK9DZ5mcc+Q== x-ms-office365-filtering-correlation-id: 807f3341-1b36-4baf-6299-08d68fe395c8 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:MN2PR04MB5903; x-ms-traffictypediagnostic: MN2PR04MB5903: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(366004)(136003)(396003)(346002)(199004)(189003)(81156014)(54906003)(2616005)(11346002)(26005)(66066001)(386003)(6506007)(44832011)(102836004)(6486002)(476003)(110136005)(486006)(446003)(316002)(50226002)(6436002)(1076003)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(6512007)(4744005)(71190400001)(71200400001)(305945005)(256004)(105586002)(106356001)(25786009)(97736004)(7736002)(52116002)(76176011)(3846002)(6116002)(7416002)(14454004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5903; 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: t754TLtHyr7m8B6zBui2kG5RGYdMpqQN5pYlniktKDQ8V9ZLPI7r66PIElf5JuqJPbji74sO1L2eO6lmt+WNyiQDP+JxluDlKHbEHdcXDtkJw5DqYqgeOplcfCzBKtfRjuUaZmyHVNLJMYT4vGUbsCCaSoMf70FgIICJJHK0chg6vlJNfp965CpONfT+GCueAOj/OTMCRpEXIeWuHxFrLDgoVAQVVKkZDlLIKs3IZdQxTTykfp3xFvkNn4ug1agM8wbbSg1lT/pCjYm03VUoDyE1dD5vvvQ/hTyOQGQIDJ3lTLXAporqG0jNHP3OrLeAmuHcvYxRH5furvn4Ahb5cK7ruf9HGuUWvxlxbmbZ+Nw3yzOBjqhIWFrbRDgZEGK+IcQYTWUVjvaGUtibdJnOs36+ZKDmtIMAt8I6s4zH/98= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 807f3341-1b36-4baf-6299-08d68fe395c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:41:30.6024 (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: MN2PR04MB5903 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v7 04/15] riscv: Add place-holder asm/arch/clk.h for driver compilation 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" Some of the drivers (such as Cadence MACB ethernet driver) expect asm/arch/clk.h to be provided by arch support so we add place-holder asm/arch-generic/clk.h for RISC-V generic CPU. Signed-off-by: Anup Patel Reviewed-by: Lukas Auer Reviewed-by: Bin Meng --- arch/riscv/include/asm/arch-generic/clk.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 arch/riscv/include/asm/arch-generic/clk.h diff --git a/arch/riscv/include/asm/arch-generic/clk.h b/arch/riscv/include/asm/arch-generic/clk.h new file mode 100644 index 0000000000..1631f5f0bd --- /dev/null +++ b/arch/riscv/include/asm/arch-generic/clk.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + */ + +#ifndef __ASM_RISCV_ARCH_CLK_H +#define __ASM_RISCV_ARCH_CLK_H + +/* Note: This is a placeholder header for driver compilation. */ + +#endif From patchwork Mon Feb 11 05:41:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039629 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="YOKWhG/R"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="Mm9d6ncN"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZVm1KFdz9sBZ for ; Mon, 11 Feb 2019 16:44:47 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A00FFC21EFF; Mon, 11 Feb 2019 05:42:28 +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 2239EC21F4E; Mon, 11 Feb 2019 05:42:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CD17AC21ED6; Mon, 11 Feb 2019 05:41:56 +0000 (UTC) Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lists.denx.de (Postfix) with ESMTPS id BED0DC21FAA for ; Mon, 11 Feb 2019 05:41:54 +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=1549863751; x=1581399751; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=AmwHm6MLugXWJNntqplRcTB+sRQRl608VcWm5AALqZM=; b=YOKWhG/RP9+hh+WIpjcv4yaCNELVsLnofHyyyzRj/bE3qSKM8ffBLE/U 0Vi1IBuDvdXR/+YRVL6bt9mVpXeMpeTgRH1x5oLdgpq2kXMXig9Nj8fxl 9fH69BEGbo4UoYgqkz9kwQJNta+bGSM4KObAIoKJfvEvZytqaJtXeVxU3 ixaDNXuiKHKXa7pKgkFzmyxljD1UmRJeUZAPGFBvDH1A1kK7bGxSLfzVF 6DoqXsilLtRT2vTBrh9AC/eqf2O/nnFnX2q05KuWJE7pkMxYdiKkQtHqO nsHRor9PhUtvuP8MGFgGkpfp/HcE3HEGxDoGIK7PSqkMzeLFCtHRiNFH9 A==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="199087415" Received: from mail-bn3nam01lp2053.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.53]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:42:28 +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=3aTNfY0lQkSqxLcqBZUihCW7zErFNQCbjMgV2rgvR98=; b=Mm9d6ncNbz3uXHbab6Ng3HvO5ZgEO0uA0NPOIrHQe9MWZukGIVZTHmBqSm3RlSXXAD5iSNLLj6hKeLaELHHuBryBciweV2J33+7R/1r5z4DHCu4F3OjugrEEzGMLEqz5TRs7t8Yya4deaw7UVtmxfC33ZH55+VSWl48ziyqYV00= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB5903.namprd04.prod.outlook.com (20.179.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Mon, 11 Feb 2019 05:41:47 +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:41:47 +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 05/15] riscv: generic: Ensure that U-Boot runs within 4GB for 64bit systems Thread-Index: AQHUwcx6HBv7v0nRoUGTMqLHrIMxuw== Date: Mon, 11 Feb 2019 05:41:47 +0000 Message-ID: <20190211054030.21393-6-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; MN2PR04MB5903; 6:eIvhn9uh2Ug9jWg2P76L2H6zyyIRqEr0NL6Gtvgm6bOFucbqTAR7Sh0zG1wd3OSHnFnnhEIQ9rl5/EyaKlYOCOT+8mjOD4FngYmnsg45//KvMAH1TYbif77Abs2wQK3bkFLuGbIuUzbLIWPxOod3gmVPEeffAgVgDdLffXbN67TJshvM+pOR8n67v9//pa4IOf5BO98Efgw+lw73Y5l6+KF181vsgivFWlgQPy3fHLVKR6Ljw1mYMceURJhAQKAtT/nO1n5bJD4NXxZhLtmCWT+iMaoCJUADcfL/v9hTbw5d7Lck5qbX+uYYL7vqYzcb1JJKmseC/ppq1OrtX8Y5XUwhledgM6k7HXhFEIM0Z3F5ouls54VoXEqtKVKtRa6qTE+f9f+4cBwORl7hTh7Tk3b9KSJdtxD+BY+NxyWTAxGQcdKvh6mnlxQokDyM3oa2nYTNWcGtOfDXEnIRxzo+Rw==; 5:sTD4xrGrMX/0V84IXa/BvssDNmkyiQIkF+pAtFD0NsxmBg5mPLKXVm3pOKZYjsC8EoZc2n9090qE2dOiRuAYuXTgIbROKDyzBN3g+HCpVqudMKP/ese4eJ98/LJAJkgYmvRArdd1LGrgsexwxqbbGNbRfKb2DxCEW2lG1aVfsaB7MWWnnXXS8QJBBXoiy/OBn/KCRJcFqihNBYH2Bs8gGg==; 7:RPwyQKiID7DvXvv11DskUg1s5QJwYo2ch+ScIdCAWhA9+KP7lVCeQZkDvWBuu/xmVZPmtLQN5Ihj04Ouz0sV0UlB8366KsPthJLdjZL7AisvxCOkx4VUOm+AZflMvAhHLEZDzKXpQYA6ZWuSMvUSBw== x-ms-office365-filtering-correlation-id: 417e46c6-6a19-442f-fcdb-08d68fe39cae 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:MN2PR04MB5903; x-ms-traffictypediagnostic: MN2PR04MB5903: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(366004)(136003)(396003)(346002)(199004)(189003)(81156014)(54906003)(2616005)(11346002)(26005)(66066001)(386003)(6506007)(44832011)(102836004)(6486002)(476003)(110136005)(486006)(446003)(316002)(50226002)(6436002)(1076003)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(6512007)(71190400001)(71200400001)(305945005)(256004)(105586002)(106356001)(25786009)(97736004)(7736002)(52116002)(76176011)(3846002)(6116002)(7416002)(14454004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003)(41533002); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5903; 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: 5WR8ev9femubS40xUNKlRfR7IdkeT4U8EsQUZQrF0mRVxXLSgWSdX9PwiyBy96nGazOOt4LBiXNUBT78DR8WMXa3XpIRiCCWFZAhALEqXDAK3AjyEUdIWjkAWqCR/49Dn3C0NxSZaSRKSYFJ9K5RpFPGQfpaZRx0rW/N/OOAowCXYJC7l0BcN0mhwr2EPhADWnX6Vf/NNJgpXPKhyhVWsMKRueKgs9nwx/1GFd+Dsbu3RHyGH4KfNiQK2nUazO3sTZfvcdJ/QY5hXFxzQfpMUY4yvL+KdwZ7cCHUDbmXv06eZ3Dp9FyGYfQVhErUCTc9ahSAxLILE5Y7UeXYPGknKZWJVqFyrZiu6p3S7gDZoWrSvM1q1VuS0U2jItia2fFZ6BSfu222Yb+KGq39o3dv2xyYzCAxbJfjj9WsJl446IE= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 417e46c6-6a19-442f-fcdb-08d68fe39cae X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:41:42.5593 (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: MN2PR04MB5903 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v7 05/15] riscv: generic: Ensure that U-Boot runs within 4GB for 64bit systems 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" On 64bit systems, the DRAM top can be easily beyond 4GB and U-Boot DMA mapping APIs will generate DMA addresses beyond 4GB. This breaks DMA programming in 32bit DMA capable devices (such as Cadence MACB ethernet). For example, If DRAM is more then 2GB on QEMU sifive_u machine then Cadence MACB ethernet stops working for U-Boot because it is a 32bit DMA capable device. To handle 32bit DMA capable devices on 64bit systems, we provide custom implementation of board_get_usable_ram_top() which ensures that usable ram top is not more then 4GB. This in-turn ensures that U-Boot always runs within 4GB hence DMA addresses generated by DMA mapping APIs will be within 4GB too. Signed-off-by: Atish Patra Signed-off-by: Anup Patel Reviewed-by: Alexander Graf Reviewed-by: Lukas Auer Reviewed-by: Bin Meng --- arch/riscv/cpu/generic/dram.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/riscv/cpu/generic/dram.c b/arch/riscv/cpu/generic/dram.c index 84d87d2a7f..b7b1207235 100644 --- a/arch/riscv/cpu/generic/dram.c +++ b/arch/riscv/cpu/generic/dram.c @@ -5,6 +5,9 @@ #include #include +#include + +DECLARE_GLOBAL_DATA_PTR; int dram_init(void) { @@ -15,3 +18,20 @@ int dram_init_banksize(void) { return fdtdec_setup_memory_banksize(); } + +ulong board_get_usable_ram_top(ulong total_size) +{ +#ifdef CONFIG_64BIT + /* + * Ensure that we run from first 4GB so that all + * addresses used by U-Boot are 32bit addresses. + * + * This in-turn ensures that 32bit DMA capable + * devices work fine because DMA mapping APIs will + * provide 32bit DMA addresses only. + */ + if (gd->ram_top > SZ_4G) + return SZ_4G; +#endif + return gd->ram_top; +} From patchwork Mon Feb 11 05:41:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039633 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="jF0tM2Lt"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="Sb1oB+Cs"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZYd09rWz9sML for ; Mon, 11 Feb 2019 16:47:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id ADFADC2201F; Mon, 11 Feb 2019 05:43:14 +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 E687DC21EAE; Mon, 11 Feb 2019 05:43:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2D0B9C21FFD; Mon, 11 Feb 2019 05:42:19 +0000 (UTC) Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lists.denx.de (Postfix) with ESMTPS id 05EFBC21F1D for ; Mon, 11 Feb 2019 05:42:14 +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=1549863735; x=1581399735; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=l+g1VYxwveufpXi9FIK/bKuXqshYy00XEfGj9jUYsTI=; b=jF0tM2LtWgG9iJlaP3xuN75MLL5RKlmdMPkgjO2UG9tzMUE+XIoOf9tb Swce22Rk0TDOiR2XVyyCP17z6RmZldRb7PZSk/YfZMLNlc55aRw4aYZx+ BA9x/9zbrKraPJyTWneymH1aPpxvjmXl3g6k28G+mzzwT25uTmaHahq3E OvWyjw082/YD3yWVEnt0KLtikoSkNMq8xB4SzgHigpHjkTLovEiLs2Jmp PhkYoOzLc3UgX+Bo3sj8NCUBMqGzEXkcx2SG4OPMwlI59fJ5lpJrgl5Ho ipLVqPAdJXESDA6/t7v4XDtUGwtCVhI9/fX7mNKbEiLXgj1ZLmzvBuHj8 Q==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="100895097" Received: from mail-bn3nam01lp2055.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.55]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:41:59 +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=KBiKdkvLifoqQQ8eZXYbp67PE2yINpW3R1gJgkbcaf4=; b=Sb1oB+CsQS7ABEmwJi6bsPPoBia/AiivfCQVPKC3x4CGMRc8vBGncBTAiYOerkQrivnOkRDlCcHYk0TCyFjCEZTHxuDLqghRGpAvCAigqbO5xPCwZ6GE2Tp+kxzDstatihD5Ye5Xi85T+0frTt50YeF90UZSKbc8ecwc/FPT/R4= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB5903.namprd04.prod.outlook.com (20.179.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Mon, 11 Feb 2019 05:41:56 +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:41:56 +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 06/15] net: macb: Fix clk API usage for RISC-V systems Thread-Index: AQHUwcx/iXMgJqMNmke3G9f2ApCaeA== Date: Mon, 11 Feb 2019 05:41:56 +0000 Message-ID: <20190211054030.21393-7-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; MN2PR04MB5903; 6:7djTJu7ZA/B6obLN0/6j2/ft/A57T6yN0fYB1Hto4JDLcqoCWYnKx+yPgOFYPRbp8lVd1SBDbLj63w3GyUXi6wI8U0MpZwgauzW6BdBMYf7e2QtcCTSWHE1wCZjj6ndiIQyNodDqMKi3gHmLkOAvP6RsyQZp7KDPq0jSRGjKTG1lku9ZL2NM/P0aU4mfkK/MVgjnLwdrQRd+DsoHixPvAyR+5XtZpc1OxmLVRTOHVenR3C3MZmA0ShyGCKt7r/uucLvorvcg/qJTS0eTId6H+yJyMs+oDykPcNu5bJPr+CnKhe5KvplbK19cZQx2lH8sSYKpGTvee0C+Dfc/JNK3pbj9ftml+zpYDCOQT3x2V6GehMnK7hJTB3fCLI5ZQulakxrndaB11/D9STdWLwiDTU5qCEO7e+w6YOO0VaBgak5ON9d7P7QDOeUJqOilrJC0k39ptBrDm4giYe1idEsqJA==; 5:9MnrdidYsWgIBpGVffuCdJ0BYYKoP2npeMGZ+tstH+ePcVlNh+/w0VUHfMphI2r9lBIS13wbmILEjrgZsKgrdnw0C4DdCiRSPcagnaYuih4q/jsK04Fj7T16f3ICEvgTtQWRex3aLiumK2kWYBBi7z6DMlUjfi3ntRmItS+yTLdle4sL/E+nHbHVJEYRhZmGgueKpFCJbVEzQgbOIACHUg==; 7:c0+v+jEFdRJjkxsOoeisYB8tQSauDykuUD1OjKyAKD8UJevJk5uEEzKqyrm7cRVwOpr3Yx4h+g150bWgFFPKnhHZ1/NrfjPxiTytTU4RCBmLeMzeQmWk4wiwnt+qH5ZSY6nOgYmkN7XU8W3Gv+aZYw== x-ms-office365-filtering-correlation-id: b0c7c73a-e8cd-4d67-f5ae-08d68fe3a21b 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:MN2PR04MB5903; x-ms-traffictypediagnostic: MN2PR04MB5903: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(366004)(136003)(396003)(346002)(199004)(189003)(81156014)(54906003)(2616005)(11346002)(26005)(66066001)(386003)(6506007)(44832011)(102836004)(6486002)(476003)(110136005)(486006)(446003)(316002)(50226002)(6436002)(1076003)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(6512007)(4744005)(71190400001)(71200400001)(305945005)(256004)(105586002)(106356001)(25786009)(97736004)(7736002)(52116002)(76176011)(3846002)(6116002)(7416002)(14454004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5903; 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: YSTnKO7LBYpeaiMCpGugRF0qCkzciq/MB1ivfdZba1Ke3sFMqsOQ4Uasgys+/qt0hu4fB72kbuN7f+BWIJJ9w6/sX5MpaQAwQ8Y7UyFvlR4dwqi2kOg1tG3qE1QGVd8nr1jWEYo8K0id6Gx+jboZjws2Y8Gnr2Y2I93gIMeIxKKwVvHy4QPbJ071q3j/2klg1rWWPfI5oJ8cQ1SvR5VgGw/csq/JXfS8+U+umph1qrHK93ukU5BflZblC3ChZ9n1OjOA4DWgL4U3ZCg6l2Y3/pjec/ieWsGvWG/0R8adXNL8G/D5Yd3QCrQiNMJWBOTUWl2/c2W2aQGm+CU/jiwwyRKTe1cUYsf0RPUBLuMAxeZ+GVsxe6Umj1BYRI831su7J6Q8oFc2daSgSlUSLEud5W6Sj5TX0X5upfhBfehc0Po= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0c7c73a-e8cd-4d67-f5ae-08d68fe3a21b X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:41:50.2310 (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: MN2PR04MB5903 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v7 06/15] net: macb: Fix clk API usage for RISC-V systems 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" Don't fail in macb_enable_clk() if clk_enable() returns -ENOSYS because we get -ENOSYS for fixed-rate clocks. Signed-off-by: Anup Patel Reviewed-by: Bin Meng --- drivers/net/macb.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index c9ee22279a..0254e211e6 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -1061,14 +1061,13 @@ static int macb_enable_clk(struct udevice *dev) return -EINVAL; /* - * Zynq clock driver didn't support for enable or disable - * clock. Hence, clk_enable() didn't apply for Zynq + * If clock driver didn't support enable or disable then + * we get -ENOSYS from clk_enable(). To handle this, we + * don't fail for ret == -ENOSYS. */ -#ifndef CONFIG_MACB_ZYNQ ret = clk_enable(&clk); - if (ret) + if (ret && ret != -ENOSYS) return ret; -#endif clk_rate = clk_get_rate(&clk); if (!clk_rate) From patchwork Mon Feb 11 05:42:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039630 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="oigpyVbl"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="eMbGzPwY"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZW55nflz9sBZ for ; Mon, 11 Feb 2019 16:45:05 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 60CBFC21F06; Mon, 11 Feb 2019 05:43:28 +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 E340BC21FFD; Mon, 11 Feb 2019 05:43:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 615E9C21F21; Mon, 11 Feb 2019 05:42:19 +0000 (UTC) Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lists.denx.de (Postfix) with ESMTPS id D185DC21F01 for ; Mon, 11 Feb 2019 05:42:15 +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=1549863736; x=1581399736; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=LlTCSPJ/Yu8bm7rEJLHuYRSuGY29LWAFeLkZ3c2Pnak=; b=oigpyVblZhycSuWt4y73pSC/fOgEvvUIbTj/Jk1uSFQM+bT/i+AxLpCT hUhATNyhZ0o6xm6yNfmWgw4RaTgLypYmsUe1GCs5h3MEtZ5fHdskZcudb B5b62s5ZvfSE4W+vpubty/kKUt1df0utZlkLjrCs2fkPDJoRqqW/I9v1E 7Zk5D4mUvCBvzAyYFo5fS/awDwcplMva+mWccfaHeVaUibXFMg9tN4tQb XRAR9Wp/+v32NRe9SS6W0yvfJ/mwMzH7BBLB7IHp+4/FEDjgaIqP535W6 HpKstVZbly1XMkMXTlezVbihe/xUrWF/yOsW3r0JKu28TwyxGl9f1oZYe A==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="100895106" Received: from mail-bn3nam01lp2051.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.51]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:42:06 +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=msftbBUqEpiZ3a39NHQGnrLa3goQOb64pC4uvALOL9s=; b=eMbGzPwYqZSMUydtYWjXJIOXV/97mZUkke7kybdRlTF4RpxCGqnrfRThFo/opuI/vxl0C8eS6CmgMWvHyAd0eSrnRXqP5HI1cbDMnDUTyv+bQnpSC1fX3Va5kuZe6p7wninQ/aU957h2xMqgDj7cZhbqWyORQ7LYPeKlrmI+aBQ= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB5903.namprd04.prod.outlook.com (20.179.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Mon, 11 Feb 2019 05:42:04 +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:42:04 +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 07/15] net: macb: Fix GEM hardware detection Thread-Index: AQHUwcyEIIgjXEKeAUCHxZECAKEN4Q== Date: Mon, 11 Feb 2019 05:42:03 +0000 Message-ID: <20190211054030.21393-8-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; MN2PR04MB5903; 6:tG/2jOLnostB0hiFXOgHylIvSWabYv+UK6Y8BJPduBpnE6j+zE69J6u6eGLN9tGGHoPY/ar8nDyH0Urmc/fH5qplPAajy2Y3B6T97HACI71wtMbG+LS+IztodJHHR0Vw9u3EpQ3nC2u0w62WzpQyqv75yWjqtYALkH9KOrNqNQm4IMqtFmKxH9xX2vaimZyHcj9AVaLTY1wvJySBdwCIywZduDbAKpOoMsDCew17tW06I6KnNU+C2Z2jliRQwMMcZSWB56Z5ETRwpl+vpPZaVmyjQYa1hD5WecOWWVRGsUcYtv7m/5vLPJ6UmvVpX40vs7PHC8vPWLOFY06D4GXvFvl1qGPBHBuTiR4jyhTnmMDBydli5kkq9YYdSeuxwW9H6/jmBtYgMvhF03I+EeBkxQOJj1UsVhHYndXk6LxMnAMn8ejJeXe9KXbRfzxRzYnel3LdjIFvJ2rICZQKZKcGgg==; 5:vk9GF51mAiPXCDODihpO4Htli1Al1qOlPAMe+FxJITpQt+i9HiyNKN7IuXG88nVgSAX5fyWoCsUFMgSHHsAWEhyyibQNV8w6zw9Z0IoUKHMOgn1zqKhTUi6NmP81yjpNf/qrH8sgh6pqjqZLr3L0cOOKkWuru68AvfPqf30odrxNBDQRVeGBwueONzLsW02OZ58/kTZJDeO3dwnStMvJfw==; 7:Shb5WTXijRvrB6pPjdPUNHio19bqSMInnCay0oclVpIhHpvpc5hW7+HX25yIF0+jCSeqU+CwZpf1mOBweGMyZTtLSgyHvvdWu1FYlYeAw65UiYCpnZmEnEsDgvR8AMFiFbqFnlDWbGKB60mbqcF8aA== x-ms-office365-filtering-correlation-id: ad507f45-7416-4b9f-f063-08d68fe3a69b 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:MN2PR04MB5903; x-ms-traffictypediagnostic: MN2PR04MB5903: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(366004)(136003)(396003)(346002)(199004)(189003)(81156014)(54906003)(2616005)(11346002)(26005)(66066001)(386003)(6506007)(44832011)(102836004)(6486002)(476003)(110136005)(486006)(446003)(316002)(50226002)(6436002)(1076003)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(6512007)(4744005)(71190400001)(71200400001)(305945005)(256004)(14444005)(105586002)(106356001)(25786009)(97736004)(7736002)(52116002)(76176011)(3846002)(6116002)(7416002)(14454004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5903; 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: ZzAikVdeKe66gBKlfTkToHU4dT+kxcq0RYph9YYsiRRdVYpC76xzA2/2abgO1QYKxfe4MxqLh66+wVJ87/wKE79Vl80p/I+3NxqAYP1v5+8iFAcQO9SEGqVQD7FPkTm8Vh8ZPFNjMGBR0MhbYr6Ai23lUVWPm4QR4F9dgtrx8+qEtuVPX5I+RKZN1NO3G0BOa5Pm3/unkKLgTPpfCa4aKGby1ASiREd6clIOK0jLy57QzofJu6SIK5fFCZqTBShE7eMuv35rFPfLW5PKk0Ndvcaz4+6z/bp36zCrwfPBsE303naksydg2piiGhj02C8B3QCoaDLi+srUywFx/4KO2WdQZd1VmP/om9ChQ0AItGoX5LDSW1yi0APwUPgNbMOt3e91Dy45PqFTyvQnsFtehKPlFgUJtqWLql8PfWqJGWw= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad507f45-7416-4b9f-f063-08d68fe3a69b X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:41:59.1887 (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: MN2PR04MB5903 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v7 07/15] net: macb: Fix GEM hardware detection 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 Fix MID bit field check to correctly identify all GEM hardwares. The check is updated as per macb driver in Linux location: /drivers/net/ethernet/cadence/macb_main.c:259 Signed-off-by: Atish Patra Signed-off-by: Anup Patel Reviewed-by: Alexander Graf Reviewed-by: Lukas Auer Acked-by: Joe Hershberger --- drivers/net/macb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 0254e211e6..182331f61d 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -143,7 +143,7 @@ struct macb_device { static int macb_is_gem(struct macb_device *macb) { - return MACB_BFEXT(IDNUM, macb_readl(macb, MID)) == 0x2; + return MACB_BFEXT(IDNUM, macb_readl(macb, MID)) >= 0x2; } #ifndef cpu_is_sama5d2 From patchwork Mon Feb 11 05:42:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039635 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="Y7zxoxif"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="RSg96HLS"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZZJ28KZz9sBZ for ; Mon, 11 Feb 2019 16:47:52 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id CC9FDC2200C; Mon, 11 Feb 2019 05:44:55 +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 20B7CC21F07; Mon, 11 Feb 2019 05:44:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4C6A9C21EFF; Mon, 11 Feb 2019 05:42:37 +0000 (UTC) Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lists.denx.de (Postfix) with ESMTPS id 6717EC21ED6 for ; Mon, 11 Feb 2019 05:42:32 +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=1549863753; x=1581399753; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=WKdgPfysrJfprxqWz6673H0Pg3LGNKo5A+D3WR+hsmM=; b=Y7zxoxif3c4D+zOlPY5Jy6E1h0eeksH5L7aVjSfLcbaBWBTivvVyZjcB WXFDFdCVs3XrC3KLPqO7BTVpnpBx333hBNZ0XsOFx6O21I6vrXMj23chK Eup9vrhEc60upS2Y3AdmXGU9yQCQpmZrlW52NN6Dyo4BMUejdxRvaITig Ld+gIHGKp4TtDUOyP2CAD0O+STPbyVwXHrr26hjDENRDaCfZIs9UE1eVO u7H1kq4wmk9qOkacPi+LxY8kx90MxX7W0uEMCkGaR+0ImIy8VWEkei9U0 NTnpn5SWuLWaUBQaRVAXsBdzjqp6CF4ODVrJVv7w8W/OVrK+j0WNJ8kGr w==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="102674553" Received: from mail-bn3nam01lp2053.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.53]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:42:15 +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=QvlzGKwUkx52aoHvg95svqj5vP0IQrQZjQkaykGZqL4=; b=RSg96HLSWIah9Il4W5ORP2qgWHes2YwS6J3F9ecn0Itk+VlJ6Eg1tsTMsGZn2FuhT9dbgCae7C2W/LyQQ4HndpfIHslXl/UcnV13CUOe8vbOPue5ucTNgHOaSJAH0FQ7QEL15Sp1v2CEKTSa1gMkJ/PIxXOJG6JoS6Bl3cCYqvs= 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:42:12 +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:42:12 +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 08/15] clk: Add SiFive FU540 PRCI clock driver Thread-Index: AQHUwcyJb0NceuEhSUOwX9x9rO/tGQ== Date: Mon, 11 Feb 2019 05:42:12 +0000 Message-ID: <20190211054030.21393-9-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:JQ4acveb7eOy8MZtRCqALx51DMrZ9suU8IhVVA3hkLV6wdMmDHKh9qPOafKK8DsoOsEBg/XL6pKtcC1ryApzZOcMdDcmnVpmMJchvsGNrf/W6jb3M7iNUoW9dpy6W+rH9ZU97pUK795hk0jDCjIk+EVTB2U2hpg6quwn4iFpkDUaUclCCXcZ2Kac9ybKL3rHEC4kOFsRq0MD0eCT2Urh+37pFI/FANlmTN6EDs9iUj5q+ZiGQTklanETqiXlvQPnU7WYWE4fvNGPSGfgzZXm1Hj/QXzd9K+ZwqQwF6RP5ZGDRC6KdG2Q+4/knGQSgRmcmtSMM/ujnQUOvL8GONHAUZdCSaFAIcWwbN2zRA7inmwfbdISgnEL3xCFRmXzAFs0wtzg7ZXQ6sNU/AlRIDTb1EemAvx9VTjISIE18L9fjfwzURUJ5KhS3PsBg2BlapAKewMLRo1qQ4J9mk3akN16qw==; 5:CC3rMhXXHpHKm+eWpIjZPQ5rk8q4oFBtiEcdOTVDUz0Tvqc3srHuHarQ/sfINesOns/KZ89OZ8PrDBYqrvGahAyCrqLHHC9ouuiVkXm+7Tb6UjQnN8NTM2kCBC4L90bqXLzSZmOvO0XfR1to8dpMG7Vi9VVc04ikywkSmiKzKMBq/C614XuUd2sGmnKUEtnWUsh0spNo1p6e2B55abQw+g==; 7:mjAilirO5Na4j6HsTIBM5KwtbhTMmzsxRGrnL2gr7x6Jv7rfkIsH2a3T9tbhDaVkqMqUZsXpWzYhyoIWYHp1D41/WJv/4WgrRSL6e8gl31VE5KsIA2cM0cdIu4iJvsJBbTph6PV8wy9kPp1OgYW3HA== x-ms-office365-filtering-correlation-id: 9c531519-46ab-4db3-3994-08d68fe3ab82 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: x-ms-exchange-purlcount: 1 wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6029001)(366004)(136003)(396003)(376002)(39860400002)(346002)(189003)(199004)(7416002)(3846002)(6116002)(478600001)(97736004)(966005)(72206003)(14454004)(25786009)(76176011)(52116002)(7736002)(2906002)(86362001)(186003)(36756003)(99286004)(476003)(110136005)(446003)(50226002)(6486002)(316002)(102836004)(11346002)(54906003)(81156014)(2616005)(44832011)(386003)(6506007)(486006)(66066001)(26005)(6512007)(305945005)(105586002)(53946003)(106356001)(6306002)(30864003)(14444005)(71190400001)(71200400001)(256004)(8936002)(68736007)(6436002)(4326008)(1076003)(81166006)(53936002)(8676002)(2004002)(579004)(569006); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5981; H:MN2PR04MB6061.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: ckHA6OI9KGDgiDlAOAWFLmoEYKpixUxp5npRQbf3T3x1iSH2QiJaPohRVkcdydTul8MDBxNzNAKLqRf3m4749gLzJOzglRKFIyYSkr/a1Lx4H2DT6hP20MtM4XwLavkg0KW/izDaII5HL4CzsaxqZ3va1Ui1zAI/V+Bz3TcPEGOHBi8khgtyBqWdB/0544NOlZtOW4x0dNSk3WSPWjsPeO7sdLCtaskf/k/4ZsRklVGMOdmbLaFyLdtAU9tXizVscpuC5pXa5uchmNaNrCflgQQzpD40qC7Y3DL0G8oqEwW2keY8lei/y44kyRPv3Apxx1d5ujqKaAMKLnS0O2LnwAiaNSeIEDefMbOrO3Y2HY1ehWMOcrbmifZMhNeG2hezXGIbTsCbVsp7BrHf7C3JLfE++7m8pPtN0Vq4i2ssQAk= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c531519-46ab-4db3-3994-08d68fe3ab82 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:42:07.1526 (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 08/15] clk: Add SiFive FU540 PRCI clock driver 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" Add driver code for the SiFive FU540 PRCI IP block. This IP block handles reset and clock control for the SiFive FU540 device and implements SoC-level clock tree controls and dividers. Based on code written by Wesley Terpstra found in commit 999529edf517ed75b56659d456d221b2ee56bb60 of: https://github.com/riscv/riscv-linux Boot and PLL rate change were tested on a SiFive HiFive Unleashed board. Signed-off-by: Paul Walmsley Signed-off-by: Atish Patra Signed-off-by: Anup Patel Reviewed-by: Alexander Graf --- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/sifive/Kconfig | 19 + drivers/clk/sifive/Makefile | 5 + .../clk/sifive/analogbits-wrpll-cln28hpc.h | 101 +++ drivers/clk/sifive/fu540-prci.c | 604 ++++++++++++++++++ drivers/clk/sifive/wrpll-cln28hpc.c | 390 +++++++++++ include/dt-bindings/clk/sifive-fu540-prci.h | 29 + 8 files changed, 1150 insertions(+) create mode 100644 drivers/clk/sifive/Kconfig create mode 100644 drivers/clk/sifive/Makefile create mode 100644 drivers/clk/sifive/analogbits-wrpll-cln28hpc.h create mode 100644 drivers/clk/sifive/fu540-prci.c create mode 100644 drivers/clk/sifive/wrpll-cln28hpc.c create mode 100644 include/dt-bindings/clk/sifive-fu540-prci.h diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 51c931b906..ff60fc5c45 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -105,6 +105,7 @@ source "drivers/clk/mvebu/Kconfig" source "drivers/clk/owl/Kconfig" source "drivers/clk/renesas/Kconfig" source "drivers/clk/sunxi/Kconfig" +source "drivers/clk/sifive/Kconfig" source "drivers/clk/tegra/Kconfig" source "drivers/clk/uniphier/Kconfig" diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 6a4ff9143b..de3d60ed05 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_CLK_HSDK) += clk-hsdk-cgu.o obj-$(CONFIG_CLK_MPC83XX) += mpc83xx_clk.o obj-$(CONFIG_CLK_OWL) += owl/ obj-$(CONFIG_CLK_RENESAS) += renesas/ +obj-$(CONFIG_CLK_SIFIVE) += sifive/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ obj-$(CONFIG_CLK_STM32F) += clk_stm32f.o obj-$(CONFIG_CLK_STM32MP1) += clk_stm32mp1.o diff --git a/drivers/clk/sifive/Kconfig b/drivers/clk/sifive/Kconfig new file mode 100644 index 0000000000..81fc9f8fda --- /dev/null +++ b/drivers/clk/sifive/Kconfig @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0 + +config CLK_ANALOGBITS_WRPLL_CLN28HPC + bool + +config CLK_SIFIVE + bool "SiFive SoC driver support" + depends on CLK + help + SoC drivers for SiFive Linux-capable SoCs. + +config CLK_SIFIVE_FU540_PRCI + bool "PRCI driver for SiFive FU540 SoCs" + depends on CLK_SIFIVE + select CLK_ANALOGBITS_WRPLL_CLN28HPC + help + Supports the Power Reset Clock interface (PRCI) IP block found in + FU540 SoCs. If this kernel is meant to run on a SiFive FU540 SoC, + enable this driver. diff --git a/drivers/clk/sifive/Makefile b/drivers/clk/sifive/Makefile new file mode 100644 index 0000000000..1155e07e37 --- /dev/null +++ b/drivers/clk/sifive/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-$(CONFIG_CLK_ANALOGBITS_WRPLL_CLN28HPC) += wrpll-cln28hpc.o + +obj-$(CONFIG_CLK_SIFIVE_FU540_PRCI) += fu540-prci.o diff --git a/drivers/clk/sifive/analogbits-wrpll-cln28hpc.h b/drivers/clk/sifive/analogbits-wrpll-cln28hpc.h new file mode 100644 index 0000000000..4432e24749 --- /dev/null +++ b/drivers/clk/sifive/analogbits-wrpll-cln28hpc.h @@ -0,0 +1,101 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * + * Copyright (C) 2018 SiFive, Inc. + * Wesley Terpstra + * Paul Walmsley + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_CLK_ANALOGBITS_WRPLL_CLN28HPC_H +#define __LINUX_CLK_ANALOGBITS_WRPLL_CLN28HPC_H + +#include + +/* DIVQ_VALUES: number of valid DIVQ values */ +#define DIVQ_VALUES 6 + +/* + * Bit definitions for struct analogbits_wrpll_cfg.flags + * + * WRPLL_FLAGS_BYPASS_FLAG: if set, the PLL is either in bypass, or should be + * programmed to enter bypass + * WRPLL_FLAGS_RESET_FLAG: if set, the PLL is in reset + * WRPLL_FLAGS_INT_FEEDBACK_FLAG: if set, the PLL is configured for internal + * feedback mode + * WRPLL_FLAGS_EXT_FEEDBACK_FLAG: if set, the PLL is configured for external + * feedback mode (not yet supported by this driver) + * + * The flags WRPLL_FLAGS_INT_FEEDBACK_FLAG and WRPLL_FLAGS_EXT_FEEDBACK_FLAG are + * mutually exclusive. If both bits are set, or both are zero, the struct + * analogbits_wrpll_cfg record is uninitialized or corrupt. + */ +#define WRPLL_FLAGS_BYPASS_SHIFT 0 +#define WRPLL_FLAGS_BYPASS_MASK BIT(WRPLL_FLAGS_BYPASS_SHIFT) +#define WRPLL_FLAGS_RESET_SHIFT 1 +#define WRPLL_FLAGS_RESET_MASK BIT(WRPLL_FLAGS_RESET_SHIFT) +#define WRPLL_FLAGS_INT_FEEDBACK_SHIFT 2 +#define WRPLL_FLAGS_INT_FEEDBACK_MASK BIT(WRPLL_FLAGS_INT_FEEDBACK_SHIFT) +#define WRPLL_FLAGS_EXT_FEEDBACK_SHIFT 3 +#define WRPLL_FLAGS_EXT_FEEDBACK_MASK BIT(WRPLL_FLAGS_EXT_FEEDBACK_SHIFT) + +/** + * struct analogbits_wrpll_cfg - WRPLL configuration values + * @divr: reference divider value (6 bits), as presented to the PLL signals. + * @divf: feedback divider value (9 bits), as presented to the PLL signals. + * @divq: output divider value (3 bits), as presented to the PLL signals. + * @flags: PLL configuration flags. See above for more information. + * @range: PLL loop filter range. See below for more information. + * @_output_rate_cache: cached output rates, swept across DIVQ. + * @_parent_rate: PLL refclk rate for which values are valid + * @_max_r: maximum possible R divider value, given @parent_rate + * @_init_r: initial R divider value to start the search from + * + * @divr, @divq, @divq, @range represent what the PLL expects to see + * on its input signals. Thus @divr and @divf are the actual divisors + * minus one. @divq is a power-of-two divider; for example, 1 = + * divide-by-2 and 6 = divide-by-64. 0 is an invalid @divq value. + * + * When initially passing a struct analogbits_wrpll_cfg record, the + * record should be zero-initialized with the exception of the @flags + * field. The only flag bits that need to be set are either + * WRPLL_FLAGS_INT_FEEDBACK or WRPLL_FLAGS_EXT_FEEDBACK. + * + * Field names beginning with an underscore should be considered + * private to the wrpll-cln28hpc.c code. + */ +struct analogbits_wrpll_cfg { + u8 divr; + u8 divq; + u8 range; + u8 flags; + u16 divf; + u32 _output_rate_cache[DIVQ_VALUES]; + unsigned long _parent_rate; + u8 _max_r; + u8 _init_r; +}; + +/* + * Function prototypes + */ + +int analogbits_wrpll_configure_for_rate(struct analogbits_wrpll_cfg *c, + u32 target_rate, + unsigned long parent_rate); + +unsigned int analogbits_wrpll_calc_max_lock_us(struct analogbits_wrpll_cfg *c); + +unsigned long analogbits_wrpll_calc_output_rate(struct analogbits_wrpll_cfg *c, + unsigned long parent_rate); + +#endif /* __LINUX_CLK_ANALOGBITS_WRPLL_CLN28HPC_H */ diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c new file mode 100644 index 0000000000..e1b5f8e6a9 --- /dev/null +++ b/drivers/clk/sifive/fu540-prci.c @@ -0,0 +1,604 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * + * Copyright (C) 2018 SiFive, Inc. + * Wesley Terpstra + * Paul Walmsley + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * The FU540 PRCI implements clock and reset control for the SiFive + * FU540-C000 chip. This driver assumes that it has sole control + * over all PRCI resources. + * + * This driver is based on the PRCI driver written by Wesley Terpstra. + * + * Refer, commit 999529edf517ed75b56659d456d221b2ee56bb60 of: + * https://github.com/riscv/riscv-linux + * + * References: + * - SiFive FU540-C000 manual v1p0, Chapter 7 "Clocking and Reset" + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "analogbits-wrpll-cln28hpc.h" + +/* + * EXPECTED_CLK_PARENT_COUNT: how many parent clocks this driver expects: + * hfclk and rtcclk + */ +#define EXPECTED_CLK_PARENT_COUNT 2 + +/* + * Register offsets and bitmasks + */ + +/* COREPLLCFG0 */ +#define PRCI_COREPLLCFG0_OFFSET 0x4 +#define PRCI_COREPLLCFG0_DIVR_SHIFT 0 +#define PRCI_COREPLLCFG0_DIVR_MASK (0x3f << PRCI_COREPLLCFG0_DIVR_SHIFT) +#define PRCI_COREPLLCFG0_DIVF_SHIFT 6 +#define PRCI_COREPLLCFG0_DIVF_MASK (0x1ff << PRCI_COREPLLCFG0_DIVF_SHIFT) +#define PRCI_COREPLLCFG0_DIVQ_SHIFT 15 +#define PRCI_COREPLLCFG0_DIVQ_MASK (0x7 << PRCI_COREPLLCFG0_DIVQ_SHIFT) +#define PRCI_COREPLLCFG0_RANGE_SHIFT 18 +#define PRCI_COREPLLCFG0_RANGE_MASK (0x7 << PRCI_COREPLLCFG0_RANGE_SHIFT) +#define PRCI_COREPLLCFG0_BYPASS_SHIFT 24 +#define PRCI_COREPLLCFG0_BYPASS_MASK (0x1 << PRCI_COREPLLCFG0_BYPASS_SHIFT) +#define PRCI_COREPLLCFG0_FSE_SHIFT 25 +#define PRCI_COREPLLCFG0_FSE_MASK (0x1 << PRCI_COREPLLCFG0_FSE_SHIFT) +#define PRCI_COREPLLCFG0_LOCK_SHIFT 31 +#define PRCI_COREPLLCFG0_LOCK_MASK (0x1 << PRCI_COREPLLCFG0_LOCK_SHIFT) + +/* DDRPLLCFG0 */ +#define PRCI_DDRPLLCFG0_OFFSET 0xc +#define PRCI_DDRPLLCFG0_DIVR_SHIFT 0 +#define PRCI_DDRPLLCFG0_DIVR_MASK (0x3f << PRCI_DDRPLLCFG0_DIVR_SHIFT) +#define PRCI_DDRPLLCFG0_DIVF_SHIFT 6 +#define PRCI_DDRPLLCFG0_DIVF_MASK (0x1ff << PRCI_DDRPLLCFG0_DIVF_SHIFT) +#define PRCI_DDRPLLCFG0_DIVQ_SHIFT 15 +#define PRCI_DDRPLLCFG0_DIVQ_MASK (0x7 << PRCI_DDRPLLCFG0_DIVQ_SHIFT) +#define PRCI_DDRPLLCFG0_RANGE_SHIFT 18 +#define PRCI_DDRPLLCFG0_RANGE_MASK (0x7 << PRCI_DDRPLLCFG0_RANGE_SHIFT) +#define PRCI_DDRPLLCFG0_BYPASS_SHIFT 24 +#define PRCI_DDRPLLCFG0_BYPASS_MASK (0x1 << PRCI_DDRPLLCFG0_BYPASS_SHIFT) +#define PRCI_DDRPLLCFG0_FSE_SHIFT 25 +#define PRCI_DDRPLLCFG0_FSE_MASK (0x1 << PRCI_DDRPLLCFG0_FSE_SHIFT) +#define PRCI_DDRPLLCFG0_LOCK_SHIFT 31 +#define PRCI_DDRPLLCFG0_LOCK_MASK (0x1 << PRCI_DDRPLLCFG0_LOCK_SHIFT) + +/* DDRPLLCFG1 */ +#define PRCI_DDRPLLCFG1_OFFSET 0x10 +#define PRCI_DDRPLLCFG1_CKE_SHIFT 24 +#define PRCI_DDRPLLCFG1_CKE_MASK (0x1 << PRCI_DDRPLLCFG1_CKE_SHIFT) + +/* GEMGXLPLLCFG0 */ +#define PRCI_GEMGXLPLLCFG0_OFFSET 0x1c +#define PRCI_GEMGXLPLLCFG0_DIVR_SHIFT 0 +#define PRCI_GEMGXLPLLCFG0_DIVR_MASK \ + (0x3f << PRCI_GEMGXLPLLCFG0_DIVR_SHIFT) +#define PRCI_GEMGXLPLLCFG0_DIVF_SHIFT 6 +#define PRCI_GEMGXLPLLCFG0_DIVF_MASK \ + (0x1ff << PRCI_GEMGXLPLLCFG0_DIVF_SHIFT) +#define PRCI_GEMGXLPLLCFG0_DIVQ_SHIFT 15 +#define PRCI_GEMGXLPLLCFG0_DIVQ_MASK (0x7 << PRCI_GEMGXLPLLCFG0_DIVQ_SHIFT) +#define PRCI_GEMGXLPLLCFG0_RANGE_SHIFT 18 +#define PRCI_GEMGXLPLLCFG0_RANGE_MASK \ + (0x7 << PRCI_GEMGXLPLLCFG0_RANGE_SHIFT) +#define PRCI_GEMGXLPLLCFG0_BYPASS_SHIFT 24 +#define PRCI_GEMGXLPLLCFG0_BYPASS_MASK \ + (0x1 << PRCI_GEMGXLPLLCFG0_BYPASS_SHIFT) +#define PRCI_GEMGXLPLLCFG0_FSE_SHIFT 25 +#define PRCI_GEMGXLPLLCFG0_FSE_MASK \ + (0x1 << PRCI_GEMGXLPLLCFG0_FSE_SHIFT) +#define PRCI_GEMGXLPLLCFG0_LOCK_SHIFT 31 +#define PRCI_GEMGXLPLLCFG0_LOCK_MASK (0x1 << PRCI_GEMGXLPLLCFG0_LOCK_SHIFT) + +/* GEMGXLPLLCFG1 */ +#define PRCI_GEMGXLPLLCFG1_OFFSET 0x20 +#define PRCI_GEMGXLPLLCFG1_CKE_SHIFT 24 +#define PRCI_GEMGXLPLLCFG1_CKE_MASK (0x1 << PRCI_GEMGXLPLLCFG1_CKE_SHIFT) + +/* CORECLKSEL */ +#define PRCI_CORECLKSEL_OFFSET 0x24 +#define PRCI_CORECLKSEL_CORECLKSEL_SHIFT 0 +#define PRCI_CORECLKSEL_CORECLKSEL_MASK \ + (0x1 << PRCI_CORECLKSEL_CORECLKSEL_SHIFT) + +/* DEVICESRESETREG */ +#define PRCI_DEVICESRESETREG_OFFSET 0x28 +#define PRCI_DEVICESRESETREG_DDR_CTRL_RST_N_SHIFT 0 +#define PRCI_DEVICESRESETREG_DDR_CTRL_RST_N_MASK \ + (0x1 << PRCI_DEVICESRESETREG_DDR_CTRL_RST_N_SHIFT) +#define PRCI_DEVICESRESETREG_DDR_AXI_RST_N_SHIFT 1 +#define PRCI_DEVICESRESETREG_DDR_AXI_RST_N_MASK \ + (0x1 << PRCI_DEVICESRESETREG_DDR_AXI_RST_N_SHIFT) +#define PRCI_DEVICESRESETREG_DDR_AHB_RST_N_SHIFT 2 +#define PRCI_DEVICESRESETREG_DDR_AHB_RST_N_MASK \ + (0x1 << PRCI_DEVICESRESETREG_DDR_AHB_RST_N_SHIFT) +#define PRCI_DEVICESRESETREG_DDR_PHY_RST_N_SHIFT 3 +#define PRCI_DEVICESRESETREG_DDR_PHY_RST_N_MASK \ + (0x1 << PRCI_DEVICESRESETREG_DDR_PHY_RST_N_SHIFT) +#define PRCI_DEVICESRESETREG_GEMGXL_RST_N_SHIFT 5 +#define PRCI_DEVICESRESETREG_GEMGXL_RST_N_MASK \ + (0x1 << PRCI_DEVICESRESETREG_GEMGXL_RST_N_SHIFT) + +/* CLKMUXSTATUSREG */ +#define PRCI_CLKMUXSTATUSREG_OFFSET 0x2c +#define PRCI_CLKMUXSTATUSREG_TLCLKSEL_STATUS_SHIFT 1 +#define PRCI_CLKMUXSTATUSREG_TLCLKSEL_STATUS_MASK \ + (0x1 << PRCI_CLKMUXSTATUSREG_TLCLKSEL_STATUS_SHIFT) + +/* + * Private structures + */ + +/** + * struct __prci_data - per-device-instance data + * @va: base virtual address of the PRCI IP block + * @parent: parent clk instance + * + * PRCI per-device instance data + */ +struct __prci_data { + void *base; + struct clk parent; +}; + +/** + * struct __prci_wrpll_data - WRPLL configuration and integration data + * @c: WRPLL current configuration record + * @bypass: fn ptr to code to bypass the WRPLL (if applicable; else NULL) + * @no_bypass: fn ptr to code to not bypass the WRPLL (if applicable; else NULL) + * @cfg0_offs: WRPLL CFG0 register offset (in bytes) from the PRCI base address + * + * @bypass and @no_bypass are used for WRPLL instances that contain a separate + * external glitchless clock mux downstream from the PLL. The WRPLL internal + * bypass mux is not glitchless. + */ +struct __prci_wrpll_data { + struct analogbits_wrpll_cfg c; + void (*bypass)(struct __prci_data *pd); + void (*no_bypass)(struct __prci_data *pd); + u8 cfg0_offs; +}; + +struct __prci_clock; + +struct __prci_clock_ops { + int (*set_rate)(struct __prci_clock *pc, + unsigned long rate, + unsigned long parent_rate); + unsigned long (*round_rate)(struct __prci_clock *pc, + unsigned long rate, + unsigned long *parent_rate); + unsigned long (*recalc_rate)(struct __prci_clock *pc, + unsigned long parent_rate); +}; + +/** + * struct __prci_clock - describes a clock device managed by PRCI + * @name: user-readable clock name string - should match the manual + * @parent_name: parent name for this clock + * @ops: struct clk_ops for the Linux clock framework to use for control + * @hw: Linux-private clock data + * @pwd: WRPLL-specific data, associated with this clock (if not NULL) + * @pd: PRCI-specific data associated with this clock (if not NULL) + * + * PRCI clock data. Used by the PRCI driver to register PRCI-provided + * clocks to the Linux clock infrastructure. + */ +struct __prci_clock { + const char *name; + const char *parent_name; + const struct __prci_clock_ops *ops; + struct __prci_wrpll_data *pwd; + struct __prci_data *pd; +}; + +/* + * Private functions + */ + +/** + * __prci_readl() - read from a PRCI register + * @pd: PRCI context + * @offs: register offset to read from (in bytes, from PRCI base address) + * + * Read the register located at offset @offs from the base virtual + * address of the PRCI register target described by @pd, and return + * the value to the caller. + * + * Context: Any context. + * + * Return: the contents of the register described by @pd and @offs. + */ +static u32 __prci_readl(struct __prci_data *pd, u32 offs) +{ + return readl(pd->base + offs); +} + +static void __prci_writel(u32 v, u32 offs, struct __prci_data *pd) +{ + return writel(v, pd->base + offs); +} + +/* WRPLL-related private functions */ + +/** + * __prci_wrpll_unpack() - unpack WRPLL configuration registers into parameters + * @c: ptr to a struct analogbits_wrpll_cfg record to write config into + * @r: value read from the PRCI PLL configuration register + * + * Given a value @r read from an FU540 PRCI PLL configuration register, + * split it into fields and populate it into the WRPLL configuration record + * pointed to by @c. + * + * The COREPLLCFG0 macros are used below, but the other *PLLCFG0 macros + * have the same register layout. + * + * Context: Any context. + */ +static void __prci_wrpll_unpack(struct analogbits_wrpll_cfg *c, u32 r) +{ + u32 v; + + v = r & PRCI_COREPLLCFG0_DIVR_MASK; + v >>= PRCI_COREPLLCFG0_DIVR_SHIFT; + c->divr = v; + + v = r & PRCI_COREPLLCFG0_DIVF_MASK; + v >>= PRCI_COREPLLCFG0_DIVF_SHIFT; + c->divf = v; + + v = r & PRCI_COREPLLCFG0_DIVQ_MASK; + v >>= PRCI_COREPLLCFG0_DIVQ_SHIFT; + c->divq = v; + + v = r & PRCI_COREPLLCFG0_RANGE_MASK; + v >>= PRCI_COREPLLCFG0_RANGE_SHIFT; + c->range = v; + + c->flags &= (WRPLL_FLAGS_INT_FEEDBACK_MASK | + WRPLL_FLAGS_EXT_FEEDBACK_MASK); + + if (r & PRCI_COREPLLCFG0_FSE_MASK) + c->flags |= WRPLL_FLAGS_INT_FEEDBACK_MASK; + else + c->flags |= WRPLL_FLAGS_EXT_FEEDBACK_MASK; +} + +/** + * __prci_wrpll_pack() - pack PLL configuration parameters into a register value + * @c: pointer to a struct analogbits_wrpll_cfg record containing the PLL's cfg + * + * Using a set of WRPLL configuration values pointed to by @c, + * assemble a PRCI PLL configuration register value, and return it to + * the caller. + * + * Context: Any context. Caller must ensure that the contents of the + * record pointed to by @c do not change during the execution + * of this function. + * + * Returns: a value suitable for writing into a PRCI PLL configuration + * register + */ +static u32 __prci_wrpll_pack(struct analogbits_wrpll_cfg *c) +{ + u32 r = 0; + + r |= c->divr << PRCI_COREPLLCFG0_DIVR_SHIFT; + r |= c->divf << PRCI_COREPLLCFG0_DIVF_SHIFT; + r |= c->divq << PRCI_COREPLLCFG0_DIVQ_SHIFT; + r |= c->range << PRCI_COREPLLCFG0_RANGE_SHIFT; + if (c->flags & WRPLL_FLAGS_INT_FEEDBACK_MASK) + r |= PRCI_COREPLLCFG0_FSE_MASK; + + return r; +} + +/** + * __prci_wrpll_read_cfg() - read the WRPLL configuration from the PRCI + * @pd: PRCI context + * @pwd: PRCI WRPLL metadata + * + * Read the current configuration of the PLL identified by @pwd from + * the PRCI identified by @pd, and store it into the local configuration + * cache in @pwd. + * + * Context: Any context. Caller must prevent the records pointed to by + * @pd and @pwd from changing during execution. + */ +static void __prci_wrpll_read_cfg(struct __prci_data *pd, + struct __prci_wrpll_data *pwd) +{ + __prci_wrpll_unpack(&pwd->c, __prci_readl(pd, pwd->cfg0_offs)); +} + +/** + * __prci_wrpll_write_cfg() - write WRPLL configuration into the PRCI + * @pd: PRCI context + * @pwd: PRCI WRPLL metadata + * @c: WRPLL configuration record to write + * + * Write the WRPLL configuration described by @c into the WRPLL + * configuration register identified by @pwd in the PRCI instance + * described by @c. Make a cached copy of the WRPLL's current + * configuration so it can be used by other code. + * + * Context: Any context. Caller must prevent the records pointed to by + * @pd and @pwd from changing during execution. + */ +static void __prci_wrpll_write_cfg(struct __prci_data *pd, + struct __prci_wrpll_data *pwd, + struct analogbits_wrpll_cfg *c) +{ + __prci_writel(__prci_wrpll_pack(c), pwd->cfg0_offs, pd); + + memcpy(&pwd->c, c, sizeof(struct analogbits_wrpll_cfg)); +} + +/* Core clock mux control */ + +/** + * __prci_coreclksel_use_hfclk() - switch the CORECLK mux to output HFCLK + * @pd: struct __prci_data * for the PRCI containing the CORECLK mux reg + * + * Switch the CORECLK mux to the HFCLK input source; return once complete. + * + * Context: Any context. Caller must prevent concurrent changes to the + * PRCI_CORECLKSEL_OFFSET register. + */ +static void __prci_coreclksel_use_hfclk(struct __prci_data *pd) +{ + u32 r; + + r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); + r |= PRCI_CORECLKSEL_CORECLKSEL_MASK; + __prci_writel(r, PRCI_CORECLKSEL_OFFSET, pd); + + r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); /* barrier */ +} + +/** + * __prci_coreclksel_use_corepll() - switch the CORECLK mux to output COREPLL + * @pd: struct __prci_data * for the PRCI containing the CORECLK mux reg + * + * Switch the CORECLK mux to the PLL output clock; return once complete. + * + * Context: Any context. Caller must prevent concurrent changes to the + * PRCI_CORECLKSEL_OFFSET register. + */ +static void __prci_coreclksel_use_corepll(struct __prci_data *pd) +{ + u32 r; + + r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); + r &= ~PRCI_CORECLKSEL_CORECLKSEL_MASK; + __prci_writel(r, PRCI_CORECLKSEL_OFFSET, pd); + + r = __prci_readl(pd, PRCI_CORECLKSEL_OFFSET); /* barrier */ +} + +static unsigned long sifive_fu540_prci_wrpll_recalc_rate( + struct __prci_clock *pc, + unsigned long parent_rate) +{ + struct __prci_wrpll_data *pwd = pc->pwd; + + return analogbits_wrpll_calc_output_rate(&pwd->c, parent_rate); +} + +static unsigned long sifive_fu540_prci_wrpll_round_rate( + struct __prci_clock *pc, + unsigned long rate, + unsigned long *parent_rate) +{ + struct __prci_wrpll_data *pwd = pc->pwd; + struct analogbits_wrpll_cfg c; + + memcpy(&c, &pwd->c, sizeof(c)); + + analogbits_wrpll_configure_for_rate(&c, rate, *parent_rate); + + return analogbits_wrpll_calc_output_rate(&c, *parent_rate); +} + +static int sifive_fu540_prci_wrpll_set_rate(struct __prci_clock *pc, + unsigned long rate, + unsigned long parent_rate) +{ + struct __prci_wrpll_data *pwd = pc->pwd; + struct __prci_data *pd = pc->pd; + int r; + + r = analogbits_wrpll_configure_for_rate(&pwd->c, rate, parent_rate); + if (r) + return -ERANGE; + + if (pwd->bypass) + pwd->bypass(pd); + + __prci_wrpll_write_cfg(pd, pwd, &pwd->c); + + udelay(analogbits_wrpll_calc_max_lock_us(&pwd->c)); + + if (pwd->no_bypass) + pwd->no_bypass(pd); + + return 0; +} + +static const struct __prci_clock_ops sifive_fu540_prci_wrpll_clk_ops = { + .set_rate = sifive_fu540_prci_wrpll_set_rate, + .round_rate = sifive_fu540_prci_wrpll_round_rate, + .recalc_rate = sifive_fu540_prci_wrpll_recalc_rate, +}; + +static const struct __prci_clock_ops sifive_fu540_prci_wrpll_ro_clk_ops = { + .recalc_rate = sifive_fu540_prci_wrpll_recalc_rate, +}; + +/* TLCLKSEL clock integration */ + +static unsigned long sifive_fu540_prci_tlclksel_recalc_rate( + struct __prci_clock *pc, + unsigned long parent_rate) +{ + struct __prci_data *pd = pc->pd; + u32 v; + u8 div; + + v = __prci_readl(pd, PRCI_CLKMUXSTATUSREG_OFFSET); + v &= PRCI_CLKMUXSTATUSREG_TLCLKSEL_STATUS_MASK; + div = v ? 1 : 2; + + return div_u64(parent_rate, div); +} + +static const struct __prci_clock_ops sifive_fu540_prci_tlclksel_clk_ops = { + .recalc_rate = sifive_fu540_prci_tlclksel_recalc_rate, +}; + +/* + * PRCI integration data for each WRPLL instance + */ + +static struct __prci_wrpll_data __prci_corepll_data = { + .cfg0_offs = PRCI_COREPLLCFG0_OFFSET, + .bypass = __prci_coreclksel_use_hfclk, + .no_bypass = __prci_coreclksel_use_corepll, +}; + +static struct __prci_wrpll_data __prci_ddrpll_data = { + .cfg0_offs = PRCI_DDRPLLCFG0_OFFSET, +}; + +static struct __prci_wrpll_data __prci_gemgxlpll_data = { + .cfg0_offs = PRCI_GEMGXLPLLCFG0_OFFSET, +}; + +/* + * List of clock controls provided by the PRCI + */ + +static struct __prci_clock __prci_init_clocks[] = { + [PRCI_CLK_COREPLL] = { + .name = "corepll", + .parent_name = "hfclk", + .ops = &sifive_fu540_prci_wrpll_clk_ops, + .pwd = &__prci_corepll_data, + }, + [PRCI_CLK_DDRPLL] = { + .name = "ddrpll", + .parent_name = "hfclk", + .ops = &sifive_fu540_prci_wrpll_ro_clk_ops, + .pwd = &__prci_ddrpll_data, + }, + [PRCI_CLK_GEMGXLPLL] = { + .name = "gemgxlpll", + .parent_name = "hfclk", + .ops = &sifive_fu540_prci_wrpll_clk_ops, + .pwd = &__prci_gemgxlpll_data, + }, + [PRCI_CLK_TLCLK] = { + .name = "tlclk", + .parent_name = "corepll", + .ops = &sifive_fu540_prci_tlclksel_clk_ops, + }, +}; + +static ulong sifive_fu540_prci_get_rate(struct clk *clk) +{ + struct __prci_clock *pc; + + if (ARRAY_SIZE(__prci_init_clocks) <= clk->id) + return -ENXIO; + + pc = &__prci_init_clocks[clk->id]; + if (!pc->pd || !pc->ops->recalc_rate) + return -ENXIO; + + return pc->ops->recalc_rate(pc, clk_get_rate(&pc->pd->parent)); +} + +static ulong sifive_fu540_prci_set_rate(struct clk *clk, ulong rate) +{ + int err; + struct __prci_clock *pc; + + if (ARRAY_SIZE(__prci_init_clocks) <= clk->id) + return -ENXIO; + + pc = &__prci_init_clocks[clk->id]; + if (!pc->pd || !pc->ops->set_rate) + return -ENXIO; + + err = pc->ops->set_rate(pc, rate, clk_get_rate(&pc->pd->parent)); + if (err) + return err; + + return rate; +} + +static int sifive_fu540_prci_probe(struct udevice *dev) +{ + int i, err; + struct __prci_clock *pc; + struct __prci_data *pd = dev_get_priv(dev); + + pd->base = (void *)dev_read_addr(dev); + if (IS_ERR(pd->base)) + return PTR_ERR(pd->base); + + err = clk_get_by_index(dev, 0, &pd->parent); + if (err) + return err; + + for (i = 0; i < ARRAY_SIZE(__prci_init_clocks); ++i) { + pc = &__prci_init_clocks[i]; + pc->pd = pd; + if (pc->pwd) + __prci_wrpll_read_cfg(pd, pc->pwd); + } + + return 0; +} + +static struct clk_ops sifive_fu540_prci_ops = { + .set_rate = sifive_fu540_prci_set_rate, + .get_rate = sifive_fu540_prci_get_rate, +}; + +static const struct udevice_id sifive_fu540_prci_ids[] = { + { .compatible = "sifive,fu540-c000-prci0" }, + { .compatible = "sifive,aloeprci0" }, + { } +}; + +U_BOOT_DRIVER(sifive_fu540_prci) = { + .name = "sifive-fu540-prci", + .id = UCLASS_CLK, + .of_match = sifive_fu540_prci_ids, + .probe = sifive_fu540_prci_probe, + .ops = &sifive_fu540_prci_ops, + .priv_auto_alloc_size = sizeof(struct __prci_data), +}; diff --git a/drivers/clk/sifive/wrpll-cln28hpc.c b/drivers/clk/sifive/wrpll-cln28hpc.c new file mode 100644 index 0000000000..d377849693 --- /dev/null +++ b/drivers/clk/sifive/wrpll-cln28hpc.c @@ -0,0 +1,390 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * + * Copyright (C) 2018 SiFive, Inc. + * Wesley Terpstra + * Paul Walmsley + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This library supports configuration parsing and reprogramming of + * the CLN28HPC variant of the Analog Bits Wide Range PLL. The + * intention is for this library to be reusable for any device that + * integrates this PLL; thus the register structure and programming + * details are expected to be provided by a separate IP block driver. + * + * The bulk of this code is primarily useful for clock configurations + * that must operate at arbitrary rates, as opposed to clock configurations + * that are restricted by software or manufacturer guidance to a small, + * pre-determined set of performance points. + * + * References: + * - Analog Bits "Wide Range PLL Datasheet", version 2015.10.01 + * - SiFive FU540-C000 Manual v1p0, Chapter 7 "Clocking and Reset" + */ + +#include +#include +#include +#include + +#include "analogbits-wrpll-cln28hpc.h" + +/* MIN_INPUT_FREQ: minimum input clock frequency, in Hz (Fref_min) */ +#define MIN_INPUT_FREQ 7000000 + +/* MAX_INPUT_FREQ: maximum input clock frequency, in Hz (Fref_max) */ +#define MAX_INPUT_FREQ 600000000 + +/* MIN_POST_DIVIDE_REF_FREQ: minimum post-divider reference frequency, in Hz */ +#define MIN_POST_DIVR_FREQ 7000000 + +/* MAX_POST_DIVIDE_REF_FREQ: maximum post-divider reference frequency, in Hz */ +#define MAX_POST_DIVR_FREQ 200000000 + +/* MIN_VCO_FREQ: minimum VCO frequency, in Hz (Fvco_min) */ +#define MIN_VCO_FREQ 2400000000UL + +/* MAX_VCO_FREQ: maximum VCO frequency, in Hz (Fvco_max) */ +#define MAX_VCO_FREQ 4800000000ULL + +/* MAX_DIVQ_DIVISOR: maximum output divisor. Selected by DIVQ = 6 */ +#define MAX_DIVQ_DIVISOR 64 + +/* MAX_DIVR_DIVISOR: maximum reference divisor. Selected by DIVR = 63 */ +#define MAX_DIVR_DIVISOR 64 + +/* MAX_LOCK_US: maximum PLL lock time, in microseconds (tLOCK_max) */ +#define MAX_LOCK_US 70 + +/* + * ROUND_SHIFT: number of bits to shift to avoid precision loss in the rounding + * algorithm + */ +#define ROUND_SHIFT 20 + +/* + * Private functions + */ + +/** + * __wrpll_calc_filter_range() - determine PLL loop filter bandwidth + * @post_divr_freq: input clock rate after the R divider + * + * Select the value to be presented to the PLL RANGE input signals, based + * on the input clock frequency after the post-R-divider @post_divr_freq. + * This code follows the recommendations in the PLL datasheet for filter + * range selection. + * + * Return: The RANGE value to be presented to the PLL configuration inputs, + * or -1 upon error. + */ +static int __wrpll_calc_filter_range(unsigned long post_divr_freq) +{ + u8 range; + + if (post_divr_freq < MIN_POST_DIVR_FREQ || + post_divr_freq > MAX_POST_DIVR_FREQ) { + WARN(1, "%s: post-divider reference freq out of range: %lu", + __func__, post_divr_freq); + return -1; + } + + if (post_divr_freq < 11000000) + range = 1; + else if (post_divr_freq < 18000000) + range = 2; + else if (post_divr_freq < 30000000) + range = 3; + else if (post_divr_freq < 50000000) + range = 4; + else if (post_divr_freq < 80000000) + range = 5; + else if (post_divr_freq < 130000000) + range = 6; + else + range = 7; + + return range; +} + +/** + * __wrpll_calc_fbdiv() - return feedback fixed divide value + * @c: ptr to a struct analogbits_wrpll_cfg record to read from + * + * The internal feedback path includes a fixed by-two divider; the + * external feedback path does not. Return the appropriate divider + * value (2 or 1) depending on whether internal or external feedback + * is enabled. This code doesn't test for invalid configurations + * (e.g. both or neither of WRPLL_FLAGS_*_FEEDBACK are set); it relies + * on the caller to do so. + * + * Context: Any context. Caller must protect the memory pointed to by + * @c from simultaneous modification. + * + * Return: 2 if internal feedback is enabled or 1 if external feedback + * is enabled. + */ +static u8 __wrpll_calc_fbdiv(struct analogbits_wrpll_cfg *c) +{ + return (c->flags & WRPLL_FLAGS_INT_FEEDBACK_MASK) ? 2 : 1; +} + +/** + * __wrpll_calc_divq() - determine DIVQ based on target PLL output clock rate + * @target_rate: target PLL output clock rate + * @vco_rate: pointer to a u64 to store the computed VCO rate into + * + * Determine a reasonable value for the PLL Q post-divider, based on the + * target output rate @target_rate for the PLL. Along with returning the + * computed Q divider value as the return value, this function stores the + * desired target VCO rate into the variable pointed to by @vco_rate. + * + * Context: Any context. Caller must protect the memory pointed to by + * @vco_rate from simultaneous access or modification. + * + * Return: a positive integer DIVQ value to be programmed into the hardware + * upon success, or 0 upon error (since 0 is an invalid DIVQ value) + */ +static u8 __wrpll_calc_divq(u32 target_rate, u64 *vco_rate) +{ + u64 s; + u8 divq = 0; + + if (!vco_rate) { + WARN_ON(1); + goto wcd_out; + } + + s = div_u64(MAX_VCO_FREQ, target_rate); + if (s <= 1) { + divq = 1; + *vco_rate = MAX_VCO_FREQ; + } else if (s > MAX_DIVQ_DIVISOR) { + divq = ilog2(MAX_DIVQ_DIVISOR); + *vco_rate = MIN_VCO_FREQ; + } else { + divq = ilog2(s); + *vco_rate = target_rate << divq; + } + +wcd_out: + return divq; +} + +/** + * __wrpll_update_parent_rate() - update PLL data when parent rate changes + * @c: ptr to a struct analogbits_wrpll_cfg record to write PLL data to + * @parent_rate: PLL input refclk rate (pre-R-divider) + * + * Pre-compute some data used by the PLL configuration algorithm when + * the PLL's reference clock rate changes. The intention is to avoid + * computation when the parent rate remains constant - expected to be + * the common case. + * + * Returns: 0 upon success or -1 if the reference clock rate is out of range. + */ +static int __wrpll_update_parent_rate(struct analogbits_wrpll_cfg *c, + unsigned long parent_rate) +{ + u8 max_r_for_parent; + + if (parent_rate > MAX_INPUT_FREQ || parent_rate < MIN_POST_DIVR_FREQ) + return -1; + + c->_parent_rate = parent_rate; + max_r_for_parent = div_u64(parent_rate, MIN_POST_DIVR_FREQ); + c->_max_r = min_t(u8, MAX_DIVR_DIVISOR, max_r_for_parent); + + /* Round up */ + c->_init_r = div_u64(parent_rate + MAX_POST_DIVR_FREQ - 1, + MAX_POST_DIVR_FREQ); + + return 0; +} + +/* + * Public functions + */ + +/** + * analogbits_wrpll_configure() - compute PLL configuration for a target rate + * @c: ptr to a struct analogbits_wrpll_cfg record to write into + * @target_rate: target PLL output clock rate (post-Q-divider) + * @parent_rate: PLL input refclk rate (pre-R-divider) + * + * Given a pointer to a PLL context @c, a desired PLL target output + * rate @target_rate, and a reference clock input rate @parent_rate, + * compute the appropriate PLL signal configuration values. PLL + * reprogramming is not glitchless, so the caller should switch any + * downstream logic to a different clock source or clock-gate it + * before presenting these values to the PLL configuration signals. + * + * The caller must pass this function a pre-initialized struct + * analogbits_wrpll_cfg record: either initialized to zero (with the + * exception of the .name and .flags fields) or read from the PLL. + * + * Context: Any context. Caller must protect the memory pointed to by @c + * from simultaneous access or modification. + * + * Return: 0 upon success; anything else upon failure. + */ +int analogbits_wrpll_configure_for_rate(struct analogbits_wrpll_cfg *c, + u32 target_rate, + unsigned long parent_rate) +{ + unsigned long ratio; + u64 target_vco_rate, delta, best_delta, f_pre_div, vco, vco_pre; + u32 best_f, f, post_divr_freq, fbcfg; + u8 fbdiv, divq, best_r, r; + + if (!c) + return -1; + + if (c->flags == 0) { + WARN(1, "%s called with uninitialized PLL config", __func__); + return -1; + } + + fbcfg = WRPLL_FLAGS_INT_FEEDBACK_MASK | WRPLL_FLAGS_EXT_FEEDBACK_MASK; + if ((c->flags & fbcfg) == fbcfg) { + WARN(1, "%s called with invalid PLL config", __func__); + return -1; + } + + if (c->flags == WRPLL_FLAGS_EXT_FEEDBACK_MASK) { + WARN(1, "%s: external feedback mode not currently supported", + __func__); + return -1; + } + + /* Initialize rounding data if it hasn't been initialized already */ + if (parent_rate != c->_parent_rate) { + if (__wrpll_update_parent_rate(c, parent_rate)) { + pr_err("%s: PLL input rate is out of range\n", + __func__); + return -1; + } + } + + c->flags &= ~WRPLL_FLAGS_RESET_MASK; + + /* Put the PLL into bypass if the user requests the parent clock rate */ + if (target_rate == parent_rate) { + c->flags |= WRPLL_FLAGS_BYPASS_MASK; + return 0; + } + c->flags &= ~WRPLL_FLAGS_BYPASS_MASK; + + /* Calculate the Q shift and target VCO rate */ + divq = __wrpll_calc_divq(target_rate, &target_vco_rate); + if (divq == 0) + return -1; + c->divq = divq; + + /* Precalculate the pre-Q divider target ratio */ + ratio = div64_u64((target_vco_rate << ROUND_SHIFT), parent_rate); + + fbdiv = __wrpll_calc_fbdiv(c); + best_r = 0; + best_f = 0; + best_delta = MAX_VCO_FREQ; + + /* + * Consider all values for R which land within + * [MIN_POST_DIVR_FREQ, MAX_POST_DIVR_FREQ]; prefer smaller R + */ + for (r = c->_init_r; r <= c->_max_r; ++r) { + /* What is the best F we can pick in this case? */ + f_pre_div = ratio * r; + f = (f_pre_div + (1 << ROUND_SHIFT)) >> ROUND_SHIFT; + f >>= (fbdiv - 1); + + post_divr_freq = div_u64(parent_rate, r); + vco_pre = fbdiv * post_divr_freq; + vco = vco_pre * f; + + /* Ensure rounding didn't take us out of range */ + if (vco > target_vco_rate) { + --f; + vco = vco_pre * f; + } else if (vco < MIN_VCO_FREQ) { + ++f; + vco = vco_pre * f; + } + + delta = abs(target_rate - vco); + if (delta < best_delta) { + best_delta = delta; + best_r = r; + best_f = f; + } + } + + c->divr = best_r - 1; + c->divf = best_f - 1; + + post_divr_freq = div_u64(parent_rate, best_r); + + /* Pick the best PLL jitter filter */ + c->range = __wrpll_calc_filter_range(post_divr_freq); + + return 0; +} + +/** + * analogbits_wrpll_calc_output_rate() - calculate the PLL's target output rate + * @c: ptr to a struct analogbits_wrpll_cfg record to read from + * @parent_rate: PLL refclk rate + * + * Given a pointer to the PLL's current input configuration @c and the + * PLL's input reference clock rate @parent_rate (before the R + * pre-divider), calculate the PLL's output clock rate (after the Q + * post-divider) + * + * Context: Any context. Caller must protect the memory pointed to by @c + * from simultaneous modification. + * + * Return: the PLL's output clock rate, in Hz. + */ +unsigned long analogbits_wrpll_calc_output_rate(struct analogbits_wrpll_cfg *c, + unsigned long parent_rate) +{ + u8 fbdiv; + u64 n; + + WARN(c->flags & WRPLL_FLAGS_EXT_FEEDBACK_MASK, + "external feedback mode not yet supported"); + + fbdiv = __wrpll_calc_fbdiv(c); + n = parent_rate * fbdiv * (c->divf + 1); + n = div_u64(n, (c->divr + 1)); + n >>= c->divq; + + return n; +} + +/** + * analogbits_wrpll_calc_max_lock_us() - return the time for the PLL to lock + * @c: ptr to a struct analogbits_wrpll_cfg record to read from + * + * Return the minimum amount of time (in microseconds) that the caller + * must wait after reprogramming the PLL to ensure that it is locked + * to the input frequency and stable. This is likely to depend on the DIVR + * value; this is under discussion with the manufacturer. + * + * Return: the minimum amount of time the caller must wait for the PLL + * to lock (in microseconds) + */ +unsigned int analogbits_wrpll_calc_max_lock_us(struct analogbits_wrpll_cfg *c) +{ + return MAX_LOCK_US; +} diff --git a/include/dt-bindings/clk/sifive-fu540-prci.h b/include/dt-bindings/clk/sifive-fu540-prci.h new file mode 100644 index 0000000000..531523ea62 --- /dev/null +++ b/include/dt-bindings/clk/sifive-fu540-prci.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * + * Copyright (C) 2018 SiFive, Inc. + * Wesley Terpstra + * Paul Walmsley + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_CLK_SIFIVE_FU540_PRCI_H +#define __LINUX_CLK_SIFIVE_FU540_PRCI_H + +/* Clock indexes for use by Device Tree data */ + +#define PRCI_CLK_COREPLL 0 +#define PRCI_CLK_DDRPLL 1 +#define PRCI_CLK_GEMGXLPLL 2 +#define PRCI_CLK_TLCLK 3 + +#endif From patchwork Mon Feb 11 05:42: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: 1039638 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="WyRx+VaW"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="CQ1jlcpI"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZbp42xZz9sML for ; Mon, 11 Feb 2019 16:49:10 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 34929C21ED6; Mon, 11 Feb 2019 05:46:06 +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 68AC7C21F27; Mon, 11 Feb 2019 05:44:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9A956C21F38; Mon, 11 Feb 2019 05:42:40 +0000 (UTC) Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lists.denx.de (Postfix) with ESMTPS id 2AF82C22000 for ; Mon, 11 Feb 2019 05:42:35 +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=1549863755; x=1581399755; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=iI80VaFOiLyR6tmyohczeTtS+bJB9rtbhDGptaBQxPc=; b=WyRx+VaWfs8blftNpMUxtWPOMccOKTxoPPj9p1bdXxcFMsoWhTpS9T52 5VJqOz4kWOfQh38xC1N0Z0F9zCeffS7GHC31B/3D6zO/G8VXwPnSu1qXW 3JqEViMWlIpmtriKVK+ZNLUAbwciphJ0R7sncPgBjtNY3Ic3S/smoU8Jw c4zO7JDcjmVDX10Pfhaz7Zw1j5QYVaH7AItvIuYqi+OBgBLO8gOfKZuPh WS1qRsD5g0Hdcwuip5OT8tfV/ZaFqegSytAWNIvbTic9FO6sMaSAt3C/+ YV/dfyPcLR3N7GMFnxtP22TMxsBYCLgDXPgHVGc2ssdoAyidL7DQ+tbGB g==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="100895117" Received: from mail-bn3nam01lp2059.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.59]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:42:33 +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=5oa2B6ZAOZEAXmMW1LHMomswPa6bAYnF2zoqXC5tvHk=; b=CQ1jlcpItGMYrBpvFzFo6l1a8RD7JjzC1/VdpNVik+EgkWtEZn8QSd74nfZ0TVfPGkAzUeCjeJK/1X7XybAJVoIu6uWqFqECAB0PKIIPEFn+ui5WsT0pKTPtcRchF6emRwxOfS8lwfXT6mgspSCVQPdhGn/5n6z6u/FNlHcJv20= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB5903.namprd04.prod.outlook.com (20.179.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Mon, 11 Feb 2019 05:42:30 +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:42:30 +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 09/15] clk: Add fixed-factor clock driver Thread-Index: AQHUwcyTzf1Eml66zEaWWCI9LDyImg== Date: Mon, 11 Feb 2019 05:42:30 +0000 Message-ID: <20190211054030.21393-10-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; MN2PR04MB5903; 6:aelqxx66yzcab8qbcGz1I7J7wzlPayh7q7H0EaU5aYVDd79gRSg0EBSUkhtYYhCjj2B/46L6yU2GhO/7FTpTijmB2nUw1MXQMWNHxN7rMTMGNFRDEDVCP53yrnA9Xk36xGKxD/lFRYeGd2wJEuQcJvG3Fx05+4uQpBaelCe0V+y2ZC/EieS1Fcm1F0/edrJE6r5zz2VCFnOY8+YkXa6DiP5B9TeBz+J5ElzDBS69cEyAPdgZZ64LmQULiwBJWbvxsjl8GVvqofIUizWMaKim13c9Ch0LMTFq7YmPjpweoZtbr4XfYDR9IU0xB4Myr1OMmmP8DUS0WiscPCRnS/Lpmg8hCaIy0sy3k2xA38+sLHO26RTJ88WpSRE+rj9yr6yvYxJep0gM67kLPagZpSuON6opv1xEUwm80bZtwmJcibb+kGbBeMK/4lwsGW5qz2DxQhPSzyrSZX4g+fsTsfm5WA==; 5:RBfpNah1EDS96eSykF/PpCy8rU/GKbXasGEmqhIB6a7LR2UmbgfcbSjEmLmyyJcNsHrA+fAveY/G6Oe1hiv4mDExUwS9zxY80NjDj2Eebw8oQAlDL4OABBz2EJEXfH9QoIsHL5Lrk4A3QFNtJcc43LH4ozI2TY3x6WIvSZYoJbAoZrk1USC1mW7a4bjzxLmUkl0Up6WoDjZqoadsGKdisw==; 7:UUdmOiG1I739sg+9cBX1INZZCWmehKYPxL4Vu1edmdVlBo7qsfoWB6D7fFx1CeEItfP++cpCCp3Uyjb/wY9/03F9O7owSnugHj1qNF1ZBMPT8caheWg6Wkac2al1IMRuarLcdys8+NEmt89rzxYd5A== x-ms-office365-filtering-correlation-id: 71be6618-ebec-4b70-47aa-08d68fe3b655 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:MN2PR04MB5903; x-ms-traffictypediagnostic: MN2PR04MB5903: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(366004)(136003)(396003)(346002)(199004)(189003)(81156014)(54906003)(2616005)(11346002)(26005)(66066001)(386003)(6506007)(44832011)(102836004)(6486002)(476003)(110136005)(486006)(446003)(316002)(50226002)(6436002)(1076003)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(6512007)(71190400001)(71200400001)(305945005)(256004)(105586002)(106356001)(25786009)(97736004)(7736002)(52116002)(76176011)(3846002)(6116002)(7416002)(14454004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5903; 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: /FfuyfoI0o68EBoPyRa2RHlXOsdQ5MZx8YPf/uykYT2yecXPTIS3ZLXaLHPgFGrFC8I+b/zpwVzpFjbt7D1uj58TWc1Ae/80oqyx6MZ7+1mQoW8Tt4qwKujY0fUlY5TcZbfh5xHh1iGkrGoq1NFA1OwrPdUemn5l2aQkVB3m7YJAtm++vNYTWKePWkcrtPiiTNQvEdmk8Yj8Ajx3GWtmjp+a2TkJerVvW9cnqlEyO2R5F0nqMB6zwqVIXPrpsBZyUXxYvAYPrTQAnlxQ1/52pcE8ER5LoqvqTpU8YnD75rqvxTrJttC0rt0+FfYEeay5epi8mntQPW5bA3Vf7BVSafg6QGWL3GIF4q4YfZCbvVwQ0DHrVZ/dWhnUz+mus+wGIH4rHFnr25oyrE5xoKwaXKTcD7k6TGnR0GI0YJtQb9c= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71be6618-ebec-4b70-47aa-08d68fe3b655 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:42:25.0878 (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: MN2PR04MB5903 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v7 09/15] clk: Add fixed-factor clock driver 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" This patch adds fixed-factor clock driver which derives clock rate by dividing (div) and multiplying (mult) fixed factors to a parent clock. Signed-off-by: Atish Patra Signed-off-by: Anup Patel --- arch/sandbox/dts/test.dts | 8 ++++ drivers/clk/Makefile | 4 +- drivers/clk/clk_fixed_factor.c | 72 ++++++++++++++++++++++++++++++++++ test/dm/clk.c | 5 ++- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 drivers/clk/clk_fixed_factor.c diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 1d011ded7c..cb8d686e46 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -203,6 +203,14 @@ #clock-cells = <0>; clock-frequency = <1234>; }; + + clk_fixed_factor: clk-fixed-factor { + compatible = "fixed-factor-clock"; + #clock-cells = <0>; + clock-div = <3>; + clock-mult = <2>; + clocks = <&clk_fixed>; + }; }; clk_sandbox: clk-sbox { diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index de3d60ed05..1d9d725cae 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -4,7 +4,9 @@ # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # -obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o clk_fixed_rate.o +obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o +obj-$(CONFIG_$(SPL_TPL_)CLK) += clk_fixed_rate.o +obj-$(CONFIG_$(SPL_TPL_)CLK) += clk_fixed_factor.o obj-y += imx/ obj-y += tegra/ diff --git a/drivers/clk/clk_fixed_factor.c b/drivers/clk/clk_fixed_factor.c new file mode 100644 index 0000000000..3487c11729 --- /dev/null +++ b/drivers/clk/clk_fixed_factor.c @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * + * Author: Anup Patel + */ + +#include +#include +#include +#include + +struct clk_fixed_factor { + struct clk parent; + unsigned int div; + unsigned int mult; +}; + +#define to_clk_fixed_factor(dev) \ + ((struct clk_fixed_factor *)dev_get_platdata(dev)) + +static ulong clk_fixed_factor_get_rate(struct clk *clk) +{ + uint64_t ret; + struct clk_fixed_factor *ff = to_clk_fixed_factor(clk->dev); + + if (clk->id != 0) + return -EINVAL; + + ret = clk_get_rate(&ff->parent); + if (IS_ERR_VALUE(ret)) + return ret; + + do_div(ret, ff->div); + + return ret * ff->mult; +} + +const struct clk_ops clk_fixed_factor_ops = { + .get_rate = clk_fixed_factor_get_rate, +}; + +static int clk_fixed_factor_ofdata_to_platdata(struct udevice *dev) +{ + int err; + struct clk_fixed_factor *ff = to_clk_fixed_factor(dev); + + err = clk_get_by_index(dev, 0, &ff->parent); + if (err) + return err; + + ff->div = dev_read_u32_default(dev, "clock-div", 1); + ff->mult = dev_read_u32_default(dev, "clock-mult", 1); + + return 0; +} + +static const struct udevice_id clk_fixed_factor_match[] = { + { + .compatible = "fixed-factor-clock", + }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(clk_fixed_factor) = { + .name = "fixed_factor_clock", + .id = UCLASS_CLK, + .of_match = clk_fixed_factor_match, + .ofdata_to_platdata = clk_fixed_factor_ofdata_to_platdata, + .platdata_auto_alloc_size = sizeof(struct clk_fixed_factor), + .ops = &clk_fixed_factor_ops, +}; diff --git a/test/dm/clk.c b/test/dm/clk.c index 898c034e27..112d5cbbc9 100644 --- a/test/dm/clk.c +++ b/test/dm/clk.c @@ -12,12 +12,15 @@ static int dm_test_clk(struct unit_test_state *uts) { - struct udevice *dev_fixed, *dev_clk, *dev_test; + struct udevice *dev_fixed, *dev_fixed_factor, *dev_clk, *dev_test; ulong rate; ut_assertok(uclass_get_device_by_name(UCLASS_CLK, "clk-fixed", &dev_fixed)); + ut_assertok(uclass_get_device_by_name(UCLASS_CLK, "clk-fixed-factor", + &dev_fixed_factor)); + ut_assertok(uclass_get_device_by_name(UCLASS_CLK, "clk-sbox", &dev_clk)); ut_asserteq(0, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_SPI)); From patchwork Mon Feb 11 05:42:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039632 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="dHlywNRv"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="DRnq5MOW"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZXv4Lmyz9sML for ; Mon, 11 Feb 2019 16:46:39 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 34989C21EFD; Mon, 11 Feb 2019 05:43:44 +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 90C05C21F38; Mon, 11 Feb 2019 05:43:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AD898C21F01; Mon, 11 Feb 2019 05:42:51 +0000 (UTC) Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lists.denx.de (Postfix) with ESMTPS id B8D39C2201F for ; Mon, 11 Feb 2019 05:42: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=1549863768; x=1581399768; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=jki6yc4Dgywc+/2UFctRcM6KIGbue7NLrZzh+PGks1I=; b=dHlywNRvir/IT7rcyJxq+Y/hf74+/nBZ5bLRHjhh1pVl3TU1spFkKIim Dr33P0OtcV4WCDULnoKgn5QOpAAQxllPkBwXfms7GwKK+qcznrg31f5hS 4IfgEUY9nGBPJPQFNBZIrQY8Wz3aqQpouI4BKQgKzdzKzudw4xf85vXOA lWScq1mkIj539vOSIKh8cQQturtJ3ZWyDPE1C2ku44wQQhyXSAGrF3WhF VNgfNkk18AW3gAW+bYezHywYOKKQ6/UiwiqkYm9fCNpQu+SqCyh+MmCKC 3njJXPF1FuEG56DkUBNI4pzmM+FrCgnszC/1mK6R4VB0AKTurzZ8Ifzrm w==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="102674570" Received: from mail-bn3nam01lp2058.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.58]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:42: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=FqeSzEs6ykL19UgS2gTj9tz1EZqeYicmQtYCOl+rl+Y=; b=DRnq5MOWZXnLAZy/1fCRxVU3EnxsQw4LUccwVRbCm1FWZfpgAD+TtjxEFFebxtDZqWCFrPNcjg0B8mMDNEtxAlwwXklFJ2mYR87LBE7tEcCUW+OeqAm37xvY0bo5W5gcXkwz8DRYrDgKdWJyrJAs+BCUa4Y1K5VHCcDntqIwR8M= 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:42:41 +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:42:41 +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 10/15] drivers: serial_sifive: Fix baud rate calculation Thread-Index: AQHUwcyaZJEv1+HuUkiy9FmBpiXd8A== Date: Mon, 11 Feb 2019 05:42:41 +0000 Message-ID: <20190211054030.21393-11-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:64h3rsbt3DVDb4qPp+h0ubmIqnPjmwO5JPsP7uxE/tgvbSP5XIB8XudEVcT6JbWB+WSO8fBoQXXCBLdNTTigmXGV+hvsCbXAQIOJgfIWQsACljr902TNqpoklCf18mm1yof+/wdAuw13gsJS40qVlGbDnCDBummI8aHbSQksWIz8kNgcJOChK8d3eTB4FlHQv0cDHAkqTB+ir7Pierw/nF1keMRy/Q3BnAMB+NPY7Md1k1PNo3dpLLZH5dlKvp8I4GPbxFOrQx9TDqMt8An2JSpvOMIb9Zv0hHoQMD7arBKFslsNoqM4Bj65uIqe4QcukGiRH4j1Qo4nHbZfUzBgSw+a3SDbuoEpOfaHgmlRsCsVFJGNYyDIF8dF04cWgt4q9HRHRZb4BUnKL1x5q2+qLWtyW+4gfTkD7ECJONuPC9eXmWCTitYA7ZF+NqUFrP9MKcSXK9Jl0htCGIBwtSFIDw==; 5:Stvg39S7j8wAsfiy+aU9OA8FqULs0Sl2TThy2W2cKu1vIGJVqkoGC4HOdRaPxKfoOZsrDVNMbtmaC6c3kVfCWayHu8c4jGzLOP473RlA9PGYXz9V+ib75BVsxmSWkSZLeB6vl0lFpr1PFqo7zwL/eaK7/dTZuPpvqcDGNXL1iwzZABDw8nuPKwv4vF1z+mJJlqLVw4c+N+eyB5jfz3QQ6Q==; 7:7vkHE6Gn2A55MjF36uqIwWcZtfL5p+N0U7nuo2G5ifFIGEbVwwbVOtsiJxNRLhEgdaaMr96peZUAh+ZMWIPLr8wUENPiiDjck1IyHcLA1ibehCkG0syBs/iudmPpfHYkGeNUTypk4l7HRQc8M1HNGA== x-ms-office365-filtering-correlation-id: 45dbec94-b6ca-47f5-35d5-08d68fe3bcfa 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)(366004)(136003)(396003)(376002)(39860400002)(346002)(189003)(199004)(7416002)(3846002)(6116002)(478600001)(97736004)(72206003)(14454004)(25786009)(76176011)(52116002)(7736002)(2906002)(86362001)(186003)(36756003)(99286004)(476003)(110136005)(446003)(50226002)(6486002)(316002)(102836004)(11346002)(54906003)(81156014)(2616005)(44832011)(386003)(6506007)(486006)(66066001)(26005)(6512007)(305945005)(105586002)(106356001)(14444005)(71190400001)(71200400001)(256004)(8936002)(68736007)(6436002)(4326008)(1076003)(81166006)(53936002)(8676002); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5981; H:MN2PR04MB6061.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: x2VTOOPe74+rTUZd5UIylUZPSg2m8uYQFt/Z7LMeGqx+vFE3MV81wZ61nnE38m0iHxJLRCklPVuQFib2hHN+CLoGL1j8GU+APsigv3Qc5I5wN399oHUXMQSBs0/kQw3vdqB2wRvTRmOV+rJobpRg8+IExsZCedPJJXJ2v4xUTKNkV+2CZDVhdgbMEJhSPqRrB0KvWU5Ef7jrcNWwaiekB6Brlhh93mFM1erGO/7Rq4RmDXhwR4abd8YK2/4pnLmzom6d9Vo9fqGrWDrcTXt4II89TC15kUmn3DTyokKyjPlWCayiq7jVF5C7DAtPXp8zpU2Qza55UQYiv7SePeqvooudBeBtvFnzkFzkmpCrwMRRQBh1qFM5iM4QYgLW5Xc6+GR6mqjyssYXWV+irEfw3kflKgmkfJznc0Lvg8uXs4Q= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45dbec94-b6ca-47f5-35d5-08d68fe3bcfa X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:42:36.4142 (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 10/15] drivers: serial_sifive: Fix baud rate calculation 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 Compute the baud rate multipler with more precision. Signed-off-by: Atish Patra Signed-off-by: Anup Patel Reviewed-by: Alexander Graf Reviewed-by: Lukas Auer --- drivers/serial/serial_sifive.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c index 341728a690..ea4d35d48c 100644 --- a/drivers/serial/serial_sifive.c +++ b/drivers/serial/serial_sifive.c @@ -33,16 +33,40 @@ struct uart_sifive { }; struct sifive_uart_platdata { - unsigned int clock; + unsigned long clock; int saved_input_char; struct uart_sifive *regs; }; +/** + * Find minimum divisor divides in_freq to max_target_hz; + * Based on uart driver n SiFive FSBL. + * + * f_baud = f_in / (div + 1) => div = (f_in / f_baud) - 1 + * The nearest integer solution requires rounding up as to not exceed + * max_target_hz. + * div = ceil(f_in / f_baud) - 1 + * = floor((f_in - 1 + f_baud) / f_baud) - 1 + * This should not overflow as long as (f_in - 1 + f_baud) does not exceed + * 2^32 - 1, which is unlikely since we represent frequencies in kHz. + */ +static inline unsigned int uart_min_clk_divisor(unsigned long in_freq, + unsigned long max_target_hz) +{ + unsigned long quotient = + (in_freq + max_target_hz - 1) / (max_target_hz); + /* Avoid underflow */ + if (quotient == 0) + return 0; + else + return quotient - 1; +} + /* Set up the baud rate in gd struct */ static void _sifive_serial_setbrg(struct uart_sifive *regs, unsigned long clock, unsigned long baud) { - writel((u32)((clock / baud) - 1), ®s->div); + writel((uart_min_clk_divisor(clock, baud)), ®s->div); } static void _sifive_serial_init(struct uart_sifive *regs) From patchwork Mon Feb 11 05:42:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039636 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="DxBROH+a"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="TUbByySB"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZb559K2z9sBZ for ; Mon, 11 Feb 2019 16:48:33 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 658F2C22046; Mon, 11 Feb 2019 05:45:48 +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 C1593C21F58; Mon, 11 Feb 2019 05:44:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 20D49C21F92; Mon, 11 Feb 2019 05:42:58 +0000 (UTC) Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lists.denx.de (Postfix) with ESMTPS id DEEEFC21F77 for ; Mon, 11 Feb 2019 05:42:53 +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=1549863774; x=1581399774; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=AGopGUiXazjgN5ZuY1nzw0BAbdwpOrkv1RV7FfRgwcQ=; b=DxBROH+atW7OKBTTp4brQvj/fwbgKNEXh1Fh02BfR6cgR0SLkgtKEYKG 1EprtCoIALUANkuOvWJ5fVO+xrWh+C53JKL1ZOHEBmpB5kP5ZRtLZuldd /GaFEITRwf9MpxXzVovGNS8/AUIk0XeLsYP1pwAs7MrnHllVco1cQ4Tzw j6Am/DWA9dHr/nv+zq/s7y5VGrSqWRcj2aWK7JX+OrekB3sp2IOoB5KqC SV2wNF/3diYhKZkA8DPCDT9S9Dz7LFnQHEinJP9a15+f2tkB6FbqW/V3h wxSwN/rdWkIiPWfAevOOyLNwU86sN5fNRu7ECO3H+eGj1GK6VAli5QrtX w==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="206029335" Received: from mail-by2nam01lp2058.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.58]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:42:50 +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=u0pk+m+saWEBpumb8AcuizP7KdgAEiXUxCJ16WAWEek=; b=TUbByySBGXd1gVls6aa62SUmoPdU7xDuOccOiwj0Qxr4hMr1pJRpamIEb8NKwYfqlCYv+2heWeduDwHYHtFlhWEZMsweq1g48bk1WQdJfKM9C++AEJ2HTH9LJxcEwn6p/zdbSG5qzhLXrHWlZL5YcpmjHpSxpjLMEfuiMXUpBNQ= 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:42:49 +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:42:49 +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 11/15] drivers: serial_sifive: Skip baudrate config if no input clock Thread-Index: AQHUwcyfP95KxV8qXkqHcRR74fja1w== Date: Mon, 11 Feb 2019 05:42:49 +0000 Message-ID: <20190211054030.21393-12-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:VHlJRQnICwQuSE7+zVQMTocJLUAtX1pV5lqkONVSdF+hM5AZZhTdNihHNWdYpuL/3wDZNQ2UfhjQblGuBWBrTMUYRAN7HLuAnryTOAanOBaLz+NTz6z3yK5HCNcu82OMsSeo4qXXXMrAcGZ5AUucjQyA7GKlqocGnrYm83JA8xyfIouJ/3hd0Bs9cKw9ware8BqKzU7zigtOEj50rNSna35AuMXznEgL0WSP1PSogMnZsxdgoaZMdFZDNE41X5+nMcjutFyV2sEZU0w3E5KPxhrkGlwzZj5hcuiAfus51ZHTWYfghQgcMAvheAhlYPmUJu7yG/peSv6ZbU72eRGGx3kokGylqDF0lJQkxc1Gu+NCooBebjsq5tw7fWnWHBwM2uZuTa+ORSAbRJ/VsFbUBxbQDbWPZzjp49EdVdv4r8Jkp/k//7FczXVC+efNTFW/GHWce8E0NkxrJ1snZi9FlA==; 5:wE7aHB4fUC8cPD+Knnnz22uZbH30ZNxXB98+Ep9FKSqCv+yBWwWp8YCHXV+llawCi1AKgDCK1qT0rUWBrgVOdg4tApauLE8eeEHF5YEhrJ4i7tjZR52+2g/fLFkNaeMzvJeDg+PImxPyU91+H0wu7xRCm5uGHN96tpwE9kr3pD37LhDshNELhM/mx847L/Wp4c/Vc1Sjn1EKqzzhwyw2Bw==; 7:xTKIAC3wthF7uGE57LIEe4CzVs4qt9Sw3nnlkFdNY/x4uYPSc3uUPXcG1Pxt6RRmlvMF3EGR517SzIUnSSGHzadUI0TVTJaB9boOtOQj3w61gqXSIG8F6Xjr7Ln5WT7Lmp6ba9HdRYDGa/F2HUl8YQ== x-ms-office365-filtering-correlation-id: fe155e3b-d110-43d7-d609-08d68fe3c193 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)(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); 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: sK9jffJLqGlEz7hRwKT8/BH5p7yRK/ivKNubPm+hkwyk6zzhXySieJniy7Zhgt8aRJQWeMMjXouZAvFqb5DUGohblZ50ciDbjeinCZjv3b9Gj3P1agsFMxKnqu/J+rnqwrFqN6w/G6PLBPCQ5CFCC1h6uFD79Vbw4L2Qi3tBquPOWShc+S3lWQRLlGs2ER+hgqvErconS4bcwVKx4iBhHQhQZivwm2L1W7x1CdKbr5YlfUUPGVzemM1csFYutpokDbaB0HnLOKKrRt1RNvAsDXIiN8X7amp5DAe5xvgJq9hUiYTJ2qEo737CCPPFOC9fJ7gn8Vj35E0QJ786K7o+2Z4/g5hEk9fuFyoxjwifzgz7rpwcAiyzJdQpGspoxElnXajRT4GM5RpnS8bN4YML+akXNYxCfHUCM7vw81TW8Xw= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe155e3b-d110-43d7-d609-08d68fe3c193 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:42:44.2189 (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 11/15] drivers: serial_sifive: Skip baudrate config if no input clock 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 It is possible that input clock is not available because clk device was not available and 'clock-frequency' DT property is also not available. In this case, instead of failing we should just skip baudrate config by returning zero. Signed-off-by: Atish Patra Signed-off-by: Anup Patel Reviewed-by: Alexander Graf --- drivers/serial/serial_sifive.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c index ea4d35d48c..537bc7a975 100644 --- a/drivers/serial/serial_sifive.c +++ b/drivers/serial/serial_sifive.c @@ -99,27 +99,27 @@ static int _sifive_serial_getc(struct uart_sifive *regs) static int sifive_serial_setbrg(struct udevice *dev, int baudrate) { - int err; + int ret; struct clk clk; struct sifive_uart_platdata *platdata = dev_get_platdata(dev); + u32 clock = 0; - err = clk_get_by_index(dev, 0, &clk); - if (!err) { - err = clk_get_rate(&clk); - if (!IS_ERR_VALUE(err)) - platdata->clock = err; - } else if (err != -ENOENT && err != -ENODEV && err != -ENOSYS) { + ret = clk_get_by_index(dev, 0, &clk); + if (IS_ERR_VALUE(ret)) { debug("SiFive UART failed to get clock\n"); - return err; - } - - if (!platdata->clock) - platdata->clock = dev_read_u32_default(dev, "clock-frequency", 0); - if (!platdata->clock) { - debug("SiFive UART clock not defined\n"); - return -EINVAL; + ret = dev_read_u32(dev, "clock-frequency", &clock); + if (IS_ERR_VALUE(ret)) { + debug("SiFive UART clock not defined\n"); + return 0; + } + } else { + clock = clk_get_rate(&clk); + if (IS_ERR_VALUE(clock)) { + debug("SiFive UART clock get rate failed\n"); + return 0; + } } - + platdata->clock = clock; _sifive_serial_setbrg(platdata->regs, platdata->clock, baudrate); return 0; 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"); From patchwork Mon Feb 11 05:43:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039631 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="V7te3DKB"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="g2kC2BGA"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZW73p0xz9sBZ for ; Mon, 11 Feb 2019 16:45:07 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 422E4C21EE3; Mon, 11 Feb 2019 05:44:29 +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 2B6D8C21E8A; Mon, 11 Feb 2019 05:44:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0DBFFC21FAA; Mon, 11 Feb 2019 05:43:18 +0000 (UTC) Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lists.denx.de (Postfix) with ESMTPS id 2795CC21F53 for ; Mon, 11 Feb 2019 05:43:14 +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=1549863823; x=1581399823; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=7gUybMIIi8xE3XahoPcZEppePSMNLmYnvK9uh+YrWGE=; b=V7te3DKBX6CztztjnqGSP6g6knhTxoL0uutcnuVvZaUNv5qmxV+bFv56 dAINIB93tBmuaZVy5XjFQ3SpjQ+p84rNr0xrIGgkBcIyzKTfz22+2aXrU 9MlMF6mvkwBLzJH0ipLf8fYW9GVLQ4+GqbP9NTWDYvvj9LDx9xZ4hdI7F h2OTKJehNZJBfJLFjjOtCO9clG/P3cpRMEqP5h5YQo+myPwoi9J9xqRta hPABbbLCtnsyf/qfmBExaUdjhWZy+U26p8ybXIdNAxGaxvCEyMmPpMHMI +GDG4ue30He7gfQUHxtIiKNw6xV6B/aGV72tVMprsqcAopKk+JvUyn1Zn g==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="199087463" Received: from mail-by2nam01lp2055.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.55]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:43:39 +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=8YYyD6Dw2mJSOvth8WFUujj1bvrUsN7YleCCeljZoc8=; b=g2kC2BGAin0KS+6cs2rstekg3NS4JjGc67fe6Pc21bOWsTmp2n6hDYWrtwgaGlMgsPjDvMBn/NCLmfSmO6Zlh3MQ/wAaUZjYYn3u0QUNufCVlnHAlMvvjaTW0iXJho5MG9WS7ptewyKPI+nVt5AzB2cqvONK6Eyaja141RKB0EQ= 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:09 +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:09 +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 13/15] riscv: Add SiFive FU540 board support Thread-Index: AQHUwcyrCiZgCQ83lkOlAnJadrZNSQ== Date: Mon, 11 Feb 2019 05:43:09 +0000 Message-ID: <20190211054030.21393-14-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:H6QWIru/Rz+LfTy5tlbSFELmHeeOjK4ezwpTykfpLoqvhy/2xs3JkmP5hZYac3YZNLFVPcrb91H4pgMe27mvr3tOsXF/YaEszG/gU+P5cluhICEJ/l99+LZEzT3sXAn63/IP78U0oWuCyhL+SmDApWwu6YxFNkWjUw/QXSsgwYUhhZv3QyImcH7GXBypZH8dTkrvTLngmoXNlyOWKT6wbf5N6LONSUbDBQp9j22RuoomtOafVmNn+UZ0Q5XwRnEwz5mHaoNOR5YzWGEbsL0Xq8kbfhfbXRpI5ga71Zi9sgkW6QycHo855eiuLlHAeXILGG6jpBiWue9qSNOrDFKdw68scjuU60ONxIuPvfJI6TXB7aR1b4de0bPl2PHlP3Zs9O0Jw5hH62y95GGY44f4cbYSXNhUOcf+O/lElnR0LUuJV9aKg3s1Gmo134hc9P1ro/6HFzbqLs3+syZuptBzlg==; 5:hxS5ZADyORD8v1Ebx74285Ao38w+X9yFA8fk0P8oUSTJ4x9K4PSuxPlQwoPvO/dR5AxhkXzur6c9u3NfGOpCLNbZhFFk6G2njoES8wh8viLNIcBllKTLHEc+8xTx2khzVaoRBYQwrKAS5lMww7YhJ3F8u4dQvVCKiXm+Y7p9CNAjZ/HH35/ZXGbHu7cvhcVPFrNsgXHz0HT7cMMD5c1jCQ==; 7:924UuKkugwVkPOb+Vx2QQhhFVUlFu33VwBqGKTmvzTHx7TKWF7g4uusc6W6CTQcS9QpPzv9RvAinRR77xcOaQ4KDjYUjpK+p3HRHoUo4K2exkJzoP2GWUGeuBY91F2JoUsy9p1DduW6a3ER9eF4R+A== x-ms-office365-filtering-correlation-id: f5371288-225f-41f1-7986-08d68fe3cde6 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)(6029001)(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); 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: ru6MFkyg3k5yiHsqoERgDPBk7BTxQr3oJvdUazK/xYxWuHav3w39yU5o4xE0lJFmcU3J2defVcpvkECRmbtSlf2CBWaHPkGICLPOAKu5+GbBya3SSal4TMWTV5czBAjmkkts64MbfwRgAfTPizJbRK1BCmhXHZnGTPqFw2cgAPGwSSgsJbELmLZmm+ywpwO5jwBDLL6KQrubNIhs4+POXodknPuV4Tp5GJ0b5xF4X1bSlLNRfbnzRPj22SinrKIgwFKVTvleka1Z1eMYkr5slRDNWaf+HJBWM6Nbt/nQ6HF5b6T+FnNJTZ3o96WJEdjez8IxmM/1Hj6wwM/gHRWgrZjtZOHJToaTv/VqEyL7Pxo66VPWGc8sy7bk4boBWH7vt8Of5FC+OqKBqUWvehDfl62qBhvNu/5h0pLDzI/i4oA= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5371288-225f-41f1-7986-08d68fe3cde6 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:43:04.3538 (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 13/15] riscv: Add SiFive FU540 board support 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" This patch adds SiFive FU540 board support. For now, only SiFive serial, SiFive PRCI, and Cadance MACB drivers are only enabled. The SiFive FU540 defconfig by default builds U-Boot for S-Mode because U-Boot on SiFive FU540 will run in S-Mode as payload of BBL or OpenSBI. Signed-off-by: Atish Patra Signed-off-by: Anup Patel Reviewed-by: Alexander Graf Reviewed-by: Lukas Auer Reviewed-by: Bin Meng --- arch/riscv/Kconfig | 4 ++++ board/sifive/fu540/Kconfig | 42 +++++++++++++++++++++++++++++++++ board/sifive/fu540/MAINTAINERS | 9 +++++++ board/sifive/fu540/Makefile | 5 ++++ board/sifive/fu540/fu540.c | 17 ++++++++++++++ configs/sifive_fu540_defconfig | 11 +++++++++ include/configs/sifive-fu540.h | 43 ++++++++++++++++++++++++++++++++++ 7 files changed, 131 insertions(+) create mode 100644 board/sifive/fu540/Kconfig create mode 100644 board/sifive/fu540/MAINTAINERS create mode 100644 board/sifive/fu540/Makefile create mode 100644 board/sifive/fu540/fu540.c create mode 100644 configs/sifive_fu540_defconfig create mode 100644 include/configs/sifive-fu540.h diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 6879047ff7..36512a8995 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -14,11 +14,15 @@ config TARGET_AX25_AE350 config TARGET_QEMU_VIRT bool "Support QEMU Virt Board" +config TARGET_SIFIVE_FU540 + bool "Support SiFive FU540 Board" + endchoice # board-specific options below source "board/AndesTech/ax25-ae350/Kconfig" source "board/emulation/qemu-riscv/Kconfig" +source "board/sifive/fu540/Kconfig" # platform-specific options below source "arch/riscv/cpu/ax25/Kconfig" diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig new file mode 100644 index 0000000000..6be3d88144 --- /dev/null +++ b/board/sifive/fu540/Kconfig @@ -0,0 +1,42 @@ +if TARGET_SIFIVE_FU540 + +config SYS_BOARD + default "fu540" + +config SYS_VENDOR + default "sifive" + +config SYS_CPU + default "generic" + +config SYS_CONFIG_NAME + default "sifive-fu540" + +config SYS_TEXT_BASE + default 0x80000000 if !RISCV_SMODE + default 0x80200000 if RISCV_SMODE + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + select GENERIC_RISCV + imply CMD_DHCP + imply CMD_EXT2 + imply CMD_EXT4 + imply CMD_FAT + imply CMD_FS_GENERIC + imply CMD_NET + imply CMD_PING + imply CLK_SIFIVE + imply CLK_SIFIVE_FU540_PRCI + imply DOS_PARTITION + imply EFI_PARTITION + imply IP_DYN + imply ISO_PARTITION + imply MACB + imply MII + imply NET_RANDOM_ETHADDR + imply PHY_LIB + imply PHY_MSCC + imply SIFIVE_SERIAL + +endif diff --git a/board/sifive/fu540/MAINTAINERS b/board/sifive/fu540/MAINTAINERS new file mode 100644 index 0000000000..702d803ad8 --- /dev/null +++ b/board/sifive/fu540/MAINTAINERS @@ -0,0 +1,9 @@ +SiFive FU540 BOARD +M: Paul Walmsley +M: Palmer Dabbelt +M: Anup Patel +M: Atish Patra +S: Maintained +F: board/sifive/fu540/ +F: include/configs/sifive-fu540.h +F: configs/sifive_fu540_defconfig diff --git a/board/sifive/fu540/Makefile b/board/sifive/fu540/Makefile new file mode 100644 index 0000000000..6e1862c475 --- /dev/null +++ b/board/sifive/fu540/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2019 Western Digital Corporation or its affiliates. + +obj-y += fu540.o diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c new file mode 100644 index 0000000000..5adc4a3d4a --- /dev/null +++ b/board/sifive/fu540/fu540.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + */ + +#include +#include + +int board_init(void) +{ + /* For now nothing to do here. */ + + return 0; +} diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig new file mode 100644 index 0000000000..2f8cca9de0 --- /dev/null +++ b/configs/sifive_fu540_defconfig @@ -0,0 +1,11 @@ +CONFIG_RISCV=y +CONFIG_TARGET_SIFIVE_FU540=y +CONFIG_RISCV_SMODE=y +CONFIG_ARCH_RV64I=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_FIT=y +CONFIG_DISPLAY_CPUINFO=y +CONFIG_DISPLAY_BOARDINFO=y +CONFIG_CMD_MII=y +CONFIG_OF_PRIOR_STAGE=y diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h new file mode 100644 index 0000000000..7007b5f6af --- /dev/null +++ b/include/configs/sifive-fu540.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include + +#define CONFIG_SYS_SDRAM_BASE 0x80000000 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_2M) + +#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_2M) + +#define CONFIG_SYS_MALLOC_LEN SZ_8M + +#define CONFIG_SYS_BOOTM_LEN SZ_16M + +#define CONFIG_STANDALONE_LOAD_ADDR 0x80200000 + +/* Environment options */ +#define CONFIG_ENV_SIZE SZ_4K + +#define BOOT_TARGET_DEVICES(func) \ + func(DHCP, dhcp, na) + +#include + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_high=0xffffffffffffffff\0" \ + "initrd_high=0xffffffffffffffff\0" \ + "kernel_addr_r=0x80600000\0" \ + "fdt_addr_r=0x82200000\0" \ + "scriptaddr=0x82300000\0" \ + "pxefile_addr_r=0x82400000\0" \ + "ramdisk_addr_r=0x82500000\0" \ + BOOTENV + +#endif /* __CONFIG_H */ From patchwork Mon Feb 11 05:43:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039639 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="rqBiCVBA"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="kRbFjH7Y"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZbw6r04z9sMM for ; Mon, 11 Feb 2019 16:49:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9330CC21FA0; Mon, 11 Feb 2019 05:47:22 +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 756EAC2202C; Mon, 11 Feb 2019 05:47:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B8912C22044; Mon, 11 Feb 2019 05:43:35 +0000 (UTC) Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lists.denx.de (Postfix) with ESMTPS id 7964AC21F1D for ; Mon, 11 Feb 2019 05:43:31 +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=1549863849; x=1581399849; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=05WVI8tLOVpQjMic0Kii5lQ0EIt37JO+7fj/O0ldVD8=; b=rqBiCVBASKMMNzvIR53SnGo4XQrrz6Yiwk59+UQ/cjOWPcuj2dx8t6Hd hrXz/bQ7TSP1pfcAgYuRyLMr1UgQUW6nsFUL4PHqMJUoe+xTxmucgQeXn sMS03KA38p3653vVIxrV83Mp/b+Q6oKlSVKbzCrel2bEBlHZR+flD6hJi wo2Wlm//WuntcHZZqQjlbDj29JAChOKTgN9hXZA40aS+8olbLbKVP1NSv QzokWYhfaIq+a2vnvgXPVOzOisNwe8QmJm8aRu/DJJkJPn/lZjEeO/qMq HeInPvvlSpDPoE+LWw4AucomobFasq2/95huWOa5H/59b706bj4053l1U w==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="199087471" Received: from mail-by2nam01lp2051.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.51]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:43:50 +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=05WVI8tLOVpQjMic0Kii5lQ0EIt37JO+7fj/O0ldVD8=; b=kRbFjH7YJBKEVbhyTfA6dzheGBTTTtzlJIeBOt9y129/wRHNeL9glmEHs5Vsa862kq5tLQfY0z090Pi5eyFnZnUTIUX4jonXTCBxNx7wwC0IOEPI9a1cAyyma8dlDHI8dVPFgFiz3sl2CkeCXk685TvaE4Ik5DWUkUYFVmScyKc= 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:17 +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:17 +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 14/15] doc: Add a readme guide for SiFive FU540 Thread-Index: AQHUwcyvW1SCDeRHPUasWVwThwIgaw== Date: Mon, 11 Feb 2019 05:43:17 +0000 Message-ID: <20190211054030.21393-15-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:5Wz3494eytkQxLBN6LPT4yjr41hMliFjFZvZh+TjCQvWygWVMm6l9nHgF28dfQal9L27ix3E3/Fsfc3LbLMAqDS291VBUW7F4OLMOadKy12xnI4zcNe0XwxPLPRsMpJ/0/t1LjlrrbRx8jtQT3VZatzDRbrRjLR6mQJw7icLhUGkI3AqMyn6EpdHMdUC08P2gaot73bHumWxRQjR6/fGii2kOwgXS4PAZZT9sa9vDvcRt8TK3xiEOVy/lQvRFy4NNZUKmYrdEjTozDAYaNKbSMAvX6RfcF+qGt35IQh8lAf4n0K5eaRS0BgLjltZjQmGSMhaQBkzCNHNOQd8KIujWndTBfzKSW+r80lddaWnE0aQrsy5pKvLHr7kYSU73GGAiQc7+nXAH7VrDqsc230LzScEcX7xj6/4iPF15jBbSFAMPwgph2rK1Df2iVCW1z1TO2Yn9/9gAsawD62BAMODGw==; 5:4zfAWBJ6BpJZIQZ3F9JzsGIhTStIzcabMopnGyCT6VO2it1Xe/v354inl6M33BkI5gaFDbJl85S1MXj1/nT7itYX9AMUMhk1S+t7Wih29fSvIcp3D4rOe2FDxfo6VSRH3BS2njJ3wScF+dk3vE/X4MGMyo32GBaCdFCjsldeoMiCGw+O9YgGA6ULbxOYH05M0aDoAU4Gu4CyYzRgani/ZQ==; 7:PYxtAjkCgzQ05isNaHEDalubxH3CJvXRnW+L3IgI8LJ9iDpweYnQcUgOUbWIaw0FFvBV+ZEQLUD7o+5wQYglxfjMVcTQqBR+r4S2ObU0LrngrWzPH4fuG+MKi+OW+bB8Fo5AM1Cyk/o98UCiP6ZTsw== x-ms-office365-filtering-correlation-id: aa9555f1-2579-466b-c8ab-08d68fe3d243 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: x-ms-exchange-purlcount: 2 wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-forefront-prvs: 0945B0CC72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6029001)(346002)(39860400002)(396003)(136003)(366004)(376002)(199004)(189003)(54906003)(2616005)(81156014)(11346002)(66066001)(486006)(26005)(44832011)(6506007)(386003)(476003)(110136005)(6486002)(114624004)(102836004)(316002)(446003)(50226002)(1076003)(6436002)(4326008)(81166006)(8676002)(53936002)(68736007)(8936002)(105586002)(53946003)(6512007)(305945005)(71190400001)(71200400001)(14444005)(256004)(5024004)(6306002)(106356001)(30864003)(25786009)(52116002)(76176011)(7736002)(3846002)(6116002)(7416002)(14454004)(97736004)(478600001)(72206003)(966005)(186003)(2906002)(86362001)(99286004)(36756003); 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: /21iZxHKphzZp2puimf6qehet06xEfv6k1IqlffOSRmJLSRhVAFM4PUjWDkOdO5+8aG5HW6woTWc2764rh3I93mnqsXmdSdVwyGmu3GoaBfRtj/B4rLic/xKFtNACwXSY+DlrcTHWZhaNLUUZcBxqfow9U4cGleIbLC5hYXcmUbfurpWyeWnB6qtG+p+YqtvVWDG5wzoSG1fZaVkTOJJRex+UfTokIdvuKsmw+x98vQZAL1cUw8tJPgj6PVPSYFZviXBpvJpYl3NxvmHr7Ah3Lm7STZub4cIJJK02VdQgwF1Nd+6fB3nqL1ab0Kr1I7CASrRL6bOsHb+il0aXRungBJ3f+nJj/k/CWLBQ6IlFLrO81PcdTfDUslIQDvwGlPfTuPp0qN+LR4cuOflhoyHckflVOgeE46a/qNlHqj3ECw= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa9555f1-2579-466b-c8ab-08d68fe3d243 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:43:12.1165 (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 14/15] doc: Add a readme guide for SiFive FU540 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 The readme guide describes the procedure to build, flash and boot Linux using U-Boot on HiFive Unleashed. It also explains the current state of U-boot support and future action items. Signed-off-by: Atish Patra Signed-off-by: Anup Patel Reviewed-by: Lukas Auer --- doc/README.sifive-fu540 | 303 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 doc/README.sifive-fu540 diff --git a/doc/README.sifive-fu540 b/doc/README.sifive-fu540 new file mode 100644 index 0000000000..fd9f2a8e46 --- /dev/null +++ b/doc/README.sifive-fu540 @@ -0,0 +1,303 @@ +FU540-C000 RISC-V SoC +===================== +The FU540-C000 is the world’s first 4+1 64-bit RISC‑V SoC from SiFive. + +The HiFive Unleashed development platform is based on FU540-C000 and capable +of running Linux. + +Mainline support +================ +The support for following drivers are already enabled: +1. SiFive UART Driver. +2. SiFive PRCI Driver for clock. +3. Cadence MACB ethernet driver for networking support. + +TODO: +1. SPI driver is still missing. So MMC card can't be used in U-Boot as of now. +2. U-Boot expects the serial console device entry to be present under /chosen + DT node. Example: + chosen { + stdout-path = "/soc/serial@10010000:115200"; + }; + + Without a serial console U-Boot will panic. + +Building +======== +1. Add the RISC-V toolchain to your PATH. +2. Setup ARCH & cross compilation enviornment variable. + a. export ARCH=riscv + b. export CROSS_COMPILE= +3. make sifive_fu540_defconfig +4. make + +Flashing +======== +The current U-Boot port is supported in S-mode only and loaded from DRAM. + +A prior stage (M-mode) firmware/bootloader (e.g OpenSBI or BBL) is required to +load the u-boot.bin into memory and provide runtime services. The u-boot.bin +can be given as a payload to the prior stage (M-mode) firmware/bootloader. + +The description of steps required to build the firmware is beyond the scope of +this document. Please refer OpenSBI or BBL documenation. +(Note: OpenSBI git repo is at https://github.com/riscv/opensbi.git) +(Note: BBL git repo is at https://github.com/riscv/riscv-pk.git) + +Once the prior stage firmware/bootloader binary is generated, it should be +copied to the first partition of the sdcard. + +sudo dd if= of=/dev/disk2s1 bs=1024 + +Booting +======= +Once you plugin the sdcard and power up, you should see the U-Boot prompt. + +Sample boot log from HiFive Unleashed board +=========================================== +U-Boot 2019.01-00019-gc7953536-dirty (Jan 22 2019 - 11:05:40 -0800) + +CPU: rv64imafdc +Model: sifive,hifive-unleashed-a00 +DRAM: 8 GiB +In: serial@10010000 +Out: serial@10010000 +Err: serial@10010000 +Net: +Warning: ethernet@10090000 (eth0) using random MAC address - b6:75:4d:48:50:94 +eth0: ethernet@10090000 +Hit any key to stop autoboot: 0 +=> version +U-Boot 2019.01-00019-gc7953536-dirty (Jan 22 2019 - 11:05:40 -0800) + +riscv64-linux-gcc.br_real (Buildroot 2018.11-rc2-00003-ga0787e9) 8.2.0 +GNU ld (GNU Binutils) 2.31.1 +=> +=============================================================================== + +Now you can configure your networking, tftp server and use tftp boot method to +load uImage. + +========================================================================== +=> setenv ethaddr 70:B3:D5:92:F0:C2 +=> setenv ipaddr 10.196.157.189 +=> setenv serverip 10.11.143.218 +=> setenv gatewayip 10.196.156.1 +=> setenv netmask 255.255.252.0 +=> bdinfo +boot_params = 0x0000000000000000 +DRAM bank = 0x0000000000000000 +-> start = 0x0000000080000000 +-> size = 0x0000000200000000 +relocaddr = 0x00000000fff90000 +reloc off = 0x000000007fd90000 +ethaddr = 70:B3:D5:92:F0:C2 +IP addr = 10.196.157.189 +baudrate = 115200 bps +=> tftpboot uImage +ethernet@10090000: PHY present at 0 +ethernet@10090000: Starting autonegotiation... +ethernet@10090000: Autonegotiation complete +ethernet@10090000: link up, 1000Mbps full-duplex (lpa: 0x3800) +Using ethernet@10090000 device +TFTP from server 10.11.143.218; our IP address is 10.196.157.189; sending through gateway 10.196.156.1 +Filename 'uImage'. +Load address: 0x80200000 +Loading: ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ########################################################## + 2.5 MiB/s +done +Bytes transferred = 14939132 (e3f3fc hex) +=> bootm 0x80200000 - 0x82200000 +## Booting kernel from Legacy Image at 80200000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 14939068 Bytes = 14.2 MiB + Load Address: 80200000 + Entry Point: 80200000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 82200000 + Booting using the fdt blob at 0x82200000 + Loading Kernel Image ... OK + Using Device Tree in place at 0000000082200000, end 0000000082205c69 + +Starting kernel ... + +[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 +[ 0.000000] Linux version 5.0.0-rc1-00020-g4b51f736 (atish@jedi-01) (gcc version 7.2.0 (GCC)) #262 SMP Mon Jan 21 17:39:27 PST 2019 +[ 0.000000] initrd not found or empty - disabling initrd +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000ffffffff] +[ 0.000000] Normal [mem 0x0000000100000000-0x000027ffffffffff] +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080200000-0x000000027fffffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000027fffffff] +[ 0.000000] software IO TLB: mapped [mem 0xfbfff000-0xfffff000] (64MB) +[ 0.000000] CPU with hartid=0 has a non-okay status of "masked" +[ 0.000000] CPU with hartid=0 has a non-okay status of "masked" +[ 0.000000] elf_hwcap is 0x112d +[ 0.000000] percpu: Embedded 15 pages/cpu @(____ptrval____) s29720 r0 d31720 u61440 +[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 2067975 +[ 0.000000] Kernel command line: earlyprintk +[ 0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes) +[ 0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes) +[ 0.000000] Sorting __ex_table... +[ 0.000000] Memory: 8178760K/8386560K available (3309K kernel code, 248K rwdata, 872K rodata, 9381K init, 763K bss, 207800K reserved, 0K cma-reserved) +[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU event tracing is enabled. +[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies. +[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4 +[ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0 +[ 0.000000] plic: mapped 53 interrupts to 4 (out of 9) handlers. +[ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1] +[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns +[ 0.000008] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns +[ 0.000221] Console: colour dummy device 80x25 +[ 0.000902] printk: console [tty0] enabled +[ 0.000963] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=10000) +[ 0.001034] pid_max: default: 32768 minimum: 301 +[ 0.001541] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes) +[ 0.001912] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes) +[ 0.003542] rcu: Hierarchical SRCU implementation. +[ 0.004347] smp: Bringing up secondary CPUs ... +[ 1.040259] CPU1: failed to come online +[ 2.080483] CPU2: failed to come online +[ 3.120699] CPU3: failed to come online +[ 3.120765] smp: Brought up 1 node, 1 CPU +[ 3.121923] devtmpfs: initialized +[ 3.124649] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns +[ 3.124727] futex hash table entries: 1024 (order: 4, 65536 bytes) +[ 3.125346] random: get_random_u32 called from bucket_table_alloc+0x72/0x172 with crng_init=0 +[ 3.125578] NET: Registered protocol family 16 +[ 3.126400] sifive-u54-prci 10000000.prci: Registered U54 core clocks +[ 3.126649] sifive-gemgxl-mgmt 100a0000.cadence-gemgxl-mgmt: Registered clock switch 'cadence-gemgxl-mgmt' +[ 3.135572] vgaarb: loaded +[ 3.135858] SCSI subsystem initialized +[ 3.136193] usbcore: registered new interface driver usbfs +[ 3.136266] usbcore: registered new interface driver hub +[ 3.136348] usbcore: registered new device driver usb +[ 3.136446] pps_core: LinuxPPS API ver. 1 registered +[ 3.136484] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti +[ 3.136575] PTP clock support registered +[ 3.137256] clocksource: Switched to clocksource riscv_clocksource +[ 3.142711] NET: Registered protocol family 2 +[ 3.143322] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes) +[ 3.143634] TCP established hash table entries: 65536 (order: 7, 524288 bytes) +[ 3.145799] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes) +[ 3.149121] TCP: Hash tables configured (established 65536 bind 65536) +[ 3.149591] UDP hash table entries: 4096 (order: 5, 131072 bytes) +[ 3.150094] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes) +[ 3.150781] NET: Registered protocol family 1 +[ 3.230693] workingset: timestamp_bits=62 max_order=21 bucket_order=0 +[ 3.241224] io scheduler mq-deadline registered +[ 3.241269] io scheduler kyber registered +[ 3.242143] sifive_gpio 10060000.gpio: SiFive GPIO chip registered 16 GPIOs +[ 3.242357] pwm-sifivem 10020000.pwm: Unable to find controller clock +[ 3.242439] pwm-sifivem 10021000.pwm: Unable to find controller clock +[ 3.243228] xilinx-pcie 2000000000.pci: PCIe Link is DOWN +[ 3.243289] xilinx-pcie 2000000000.pci: host bridge /soc/pci@2000000000 ranges: +[ 3.243360] xilinx-pcie 2000000000.pci: No bus range found for /soc/pci@2000000000, using [bus 00-ff] +[ 3.243447] xilinx-pcie 2000000000.pci: MEM 0x40000000..0x5fffffff -> 0x40000000 +[ 3.243591] xilinx-pcie 2000000000.pci: PCI host bridge to bus 0000:00 +[ 3.243636] pci_bus 0000:00: root bus resource [bus 00-ff] +[ 3.243676] pci_bus 0000:00: root bus resource [mem 0x40000000-0x5fffffff] +[ 3.276547] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled +[ 3.277689] 10010000.serial: ttySIF0 at MMIO 0x10010000 (irq = 39, base_baud = 0) is a SiFive UART v0 +[ 3.786963] printk: console [ttySIF0] enabled +[ 3.791504] 10011000.serial: ttySIF1 at MMIO 0x10011000 (irq = 40, base_baud = 0) is a SiFive UART v0 +[ 3.801251] sifive_spi 10040000.spi: mapped; irq=41, cs=1 +[ 3.806362] m25p80 spi0.0: unrecognized JEDEC id bytes: 9d, 70, 19 +[ 3.812084] m25p80: probe of spi0.0 failed with error -2 +[ 3.817453] sifive_spi 10041000.spi: mapped; irq=42, cs=4 +[ 3.823027] sifive_spi 10050000.spi: mapped; irq=43, cs=1 +[ 3.828604] libphy: Fixed MDIO Bus: probed +[ 3.832623] macb: GEM doesn't support hardware ptp. +[ 3.837196] libphy: MACB_mii_bus: probed +[ 4.041156] Microsemi VSC8541 SyncE 10090000.ethernet-ffffffff:00: attached PHY driver [Microsemi VSC8541 SyncE] (mii_bus:phy_addr=10090000.ethernet-ffffffff:00, irq=POLL) +[ 4.055779] macb 10090000.ethernet eth0: Cadence GEM rev 0x10070109 at 0x10090000 irq 12 (70:b3:d5:92:f0:c2) +[ 4.065780] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver +[ 4.072033] ehci-pci: EHCI PCI platform driver +[ 4.076521] usbcore: registered new interface driver usb-storage +[ 4.082843] softdog: initialized. soft_noboot=0 soft_margin=60 sec soft_panic=0 (nowayout=0) +[ 4.127465] mmc_spi spi2.0: SD/MMC host mmc0, no DMA, no WP, no poweroff +[ 4.133645] usbcore: registered new interface driver usbhid +[ 4.138980] usbhid: USB HID core driver +[ 4.143017] NET: Registered protocol family 17 +[ 4.147885] pwm-sifivem 10020000.pwm: SiFive PWM chip registered 4 PWMs +[ 4.153945] pwm-sifivem 10021000.pwm: SiFive PWM chip registered 4 PWMs +[ 4.186407] Freeing unused kernel memory: 9380K +[ 4.190224] This architecture does not have kernel memory protection. +[ 4.196609] Run /init as init process +Starting logging: OK +Starting mdev... +[ 4.303785] mmc0: host does not support reading read-only switch, assuming write-enable +[ 4.311109] mmc0: new SDHC card on SPI +[ 4.317103] mmcblk0: mmc0:0000 SS08G 7.40 GiB +[ 4.386471] mmcblk0: p1 p2 +sort: /sys/devices/platform/Fixed: No such file or directory +modprobe: can't change directory to '/lib/modules': No such file or directory +Initializing random[ 4.759075] random: dd: uninitialized urandom read (512 bytes read) + number generator... done. +Starting network... +udhcpc (v1.24.2) started +Sending discover... +Sending discover... +[ 7.927510] macb 10090000.ethernet eth0: link up (1000/Full) +Sending discover... +Sending select for 10.196.157.190... +Lease of 10.196.157.190 obtained, lease time 499743 +deleting routers +adding dns 10.86.1.1 +adding dns 10.86.2.1 +/etc/init.d/S50dropbear +Starting dropbear sshd: [ 12.772393] random: dropbear: uninitialized urandom read (32 bytes read) +OK + +Welcome to Buildroot +buildroot login: From patchwork Mon Feb 11 05:43:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1039637 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="VPkKereS"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="Qtywem5+"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43yZb91w7Bz9sML for ; Mon, 11 Feb 2019 16:48:37 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E889FC22074; Mon, 11 Feb 2019 05:46:34 +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 65EA3C21EFD; Mon, 11 Feb 2019 05:46:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 82336C21F9E; Mon, 11 Feb 2019 05:43:43 +0000 (UTC) Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lists.denx.de (Postfix) with ESMTPS id D83C1C21FAA for ; Mon, 11 Feb 2019 05:43:38 +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=1549863818; x=1581399818; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ZnKaYcrFatZySS3KsF+n57/EGEaXHzpQ/msYTkmbL7s=; b=VPkKereSHTvUaOZ3WGPCt7deIP1y6dYCjJm8A5UBGSuAdfsRbZkv6tvx 6z9JIBwE1NgCKkltbSjqFlarJtg7uhgEzt42aM9zNJq74g1bMq72SrTBe vVoOMP7hsfvSNkl5fLGnyYu9kX2BSeDhsoelGEK/DLGJyy3B0Mqf3YZ2R zbNO9oRIaFCDK6wG5j7+0wGlq71Zr6E8cmFZ6RnfbKkHS7pJ9+KH5lpcq J64iT6L5NuNWGWETTdoLGvsZRGGx2cmRPnU+dqe/a32Dhl2MZqCoHeVPG fPG7bfxJ2WjfXrTaJCoYCORdIfdCweOaTUdV/AJ3EWCCiU3ElbfHMaPs0 Q==; X-IronPort-AV: E=Sophos;i="5.58,358,1544457600"; d="scan'208";a="206029361" Received: from mail-by2nam01lp2051.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.51]) by ob1.hgst.iphmx.com with ESMTP; 11 Feb 2019 13:43:25 +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=ZnKaYcrFatZySS3KsF+n57/EGEaXHzpQ/msYTkmbL7s=; b=Qtywem5+Tc8z9tweWJy1Drr/M9M2GJH+6mFWEHeSW7HKOFtfAJExHb/nzOqNuiQB4yz1eNGoxcVJSZN+e7khFlO421MfhuRcQde7EznRecFOxEOAhvwFiRwovha0NemBzSJ5IW20WErlFtSQf/bkSbzSlRC9wmNoOqpAR5PBtuE= 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:24 +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:24 +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 15/15] riscv: Enable CONFIG_SYS_BOOT_RAMDISK_HIGH for using initrd Thread-Index: AQHUwcy0sVIdk/4+1EWzAI3hrJBbbg== Date: Mon, 11 Feb 2019 05:43:24 +0000 Message-ID: <20190211054030.21393-16-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:o7Fw/OomoicS4ylrYPv2D7qrgH/6XQAYYVnojIwRERp/b3JFDdT3MQ3voTDWxnNuHCUUbWGfO8EqiDvXwh3NFxtmlTb/OuMBiqoC/VX78VL/eiiQSh6qYUEZAwKxrDK+MTM+HZpWjR0iIwnHLfnwd8q4G0raETjaY7NsJgqhIPKg5Xou9Tnxd5n4doatDT9ugnGwTn0T308BZKVJ9i8VRBzN36Sq5rV/9oFgmJX2YK8z3oLdAJLefbxLh6GvbGpEvlrWKnw4ZjFbZvMBwlo9aNs4G6lkwCa0bau9ddWJhn588WvKqIVywdbWPGm3luWUmMXD17ILdvJ9ezEWm9Qz9V3Uzni5H/Hgl+1wvPWxQSGFzEyqKMWKrFQgTYupaiWEsnTCG/ll1ZtGS8KpNl/IIvSBvg4wSQyoFvzFtysU1z/Cztv64DmYaC62kgS5Sn0PluH+3zUKurN8Pa6gfuhoNg==; 5:S/hCWr1X2icWjPzKuGQReFvGUmLRvAxFscZve25spqPVFhSqVGNi5KSArPQpkDpWUZQNugVe2HoCIiQo71BAabYt2s9YGxVE1nQFL2filWbN+4gbDmDNQMGuWUOlpik3Ic6ea0kAjvKDy/tnL3OSwmOvMTy6HRRebuktf2Oi8tQfryxSvB4GwaiwKVDzbhLWdelr56DXsAYjRpooMryGdg==; 7:u0tA7Yrcg8cPi2wCP4Cpks5HUiwTl8YMDZK3J8DW0ZIzUsEOMoWL1nvtDCk+LIEd1E+Dp6yw/9mCf670uGNinFuu2/WZdsa18uJ2liK4INTJediA852t2z8734wTuDEEh4l4+BLiLQf7hWoYURdSXw== x-ms-office365-filtering-correlation-id: d27dc0c6-d6c3-4f1b-07a0-08d68fe3d695 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)(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)(4744005)(305945005)(71190400001)(71200400001)(14444005)(256004)(106356001)(25786009)(52116002)(76176011)(7736002)(3846002)(6116002)(7416002)(14454004)(97736004)(478600001)(72206003)(186003)(2906002)(86362001)(99286004)(36756003); 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: P2fdeeIZPuCRGgmzr+CLOg3RrJqocYoxJFK7B/7H+cFQvJce7K0aQUufx6kwlbQTSJD7bRFJZAKKZXuz35t7VCA+0DTPHU3qR5TXQyNxshoUfzeThCGWuIcdS+CNdj584kxXrJzt8XOIKEpDntSwEFIhK17F9g/ztqeXiYYc+GF37uvqX/XYZqyNk+oDT4ytP4mCbJfdcFnpnelXHTsg2WcVkkTmUvkVb+E/AUV/6fK4VT5HTfdY5OPmFft+xIBkZiYMFBeSmLdZHQ6auEYbvOdez0hTYeNUd50nhQAgTPVkR/sHYbmSIi2jWdo3U3SNb7XYR67eX8+6B4yS/4rpD/tXwDGMuso1ip0HZ80V6GvHfVyhnIaewOhcYnzOppBzlVthxAPxyyWE44MvtoZTNnjzkZXQK5LjTkljKIUvd2o= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: d27dc0c6-d6c3-4f1b-07a0-08d68fe3d695 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2019 05:43:19.3939 (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 15/15] riscv: Enable CONFIG_SYS_BOOT_RAMDISK_HIGH for using initrd 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" This patch enables CONFIG_SYS_BOOT_RAMDISK_HIGH for RISC-V because bootm will update initrd location in DTB only if CONFIG_SYS_BOOT_RAMDISK_HIGH is enabled. If we don't enable this option then bootm assumes DTB already has initrd details which is not the case most of the time. Signed-off-by: Atish Patra Signed-off-by: Anup Patel Reviewed-by: Lukas Auer --- arch/riscv/include/asm/config.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/include/asm/config.h b/arch/riscv/include/asm/config.h index 81bc975d2e..156cb94dc0 100644 --- a/arch/riscv/include/asm/config.h +++ b/arch/riscv/include/asm/config.h @@ -8,5 +8,6 @@ #define _ASM_CONFIG_H_ #define CONFIG_LMB +#define CONFIG_SYS_BOOT_RAMDISK_HIGH #endif