From patchwork Mon Feb 25 08:13:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1047611 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="cfeGjdwa"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="EjjGNup/"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 447F8g6BSVz9s9T for ; Mon, 25 Feb 2019 19:14:11 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 5DC26C21D83; Mon, 25 Feb 2019 08:14:10 +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.7 required=5.0 tests=BAD_ENC_HEADER, KHOP_BIG_TO_CC, RCVD_IN_DNSWL_LOW, 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 5F40CC21C2F; Mon, 25 Feb 2019 08:14:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C1E20C21C27; Mon, 25 Feb 2019 08:14:05 +0000 (UTC) Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lists.denx.de (Postfix) with ESMTPS id E6FA3C21BE5 for ; Mon, 25 Feb 2019 08:14:04 +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=1551082445; x=1582618445; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=grd432SpVGuqdfQR0XY0QOVUszbRlSIwD82tyaA5JcQ=; b=cfeGjdwa0u7sQZuQ8JvzbaqeTu8Yi4IC/FbtTPIx7cUAFsMB7KNa5azV Y4ZzMEXLi1Qxj1GUZjXKuklU1gLlkUJERRck9fIEqvIjU4b4nOh30FSiB zDFqFT3Gl7WMvnabocIsU7Bv0ycEYZ0tFEtZOFJ8S7ZgbRMp9mi6Fcp7d hbtl+0eIpM9p8I5FMfLiIIoBN3Yu5f/9BMN6cNsbm0peVy3EiZg+kTheT Rt7+23oE9oU1FIWoHB79/0Xqw3/Iyn5P/5cxsMT5h9GgGm0UJZ6UxOG91 e8bqsTDBYD0910LJJJs6rTeVozy7KpxMTCrgl5WMuY77R9/9WHVgls4bt A==; X-IronPort-AV: E=Sophos;i="5.58,410,1544457600"; d="scan'208";a="207327750" Received: from mail-sn1nam04lp2054.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([104.47.44.54]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2019 16:13: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=2J8A10j8NwgfqV8v+F9BO8ghWhJWsiGbFvurAY+GdJY=; b=EjjGNup/GHHGDsvTC8utGYajjGK+PUlgLivgHCQwuOk+9BGbB9/S9Js1WNfimJZOUdDAeAXRtcwBdscjV2UCfk+vtaLSzuqd9J42PLM85Oa/W6BYutWHIIXd8yDMDVOYOSwlJHZ2Gy+w8KGk0yZwJqGax4mpGBcul9kaTKvlQOc= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.246.15) by MN2PR04MB5789.namprd04.prod.outlook.com (20.179.20.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.15; Mon, 25 Feb 2019 08:13:58 +0000 Received: from MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::d197:7b59:7e0d:e819]) by MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::d197:7b59:7e0d:e819%3]) with mapi id 15.20.1643.019; Mon, 25 Feb 2019 08:13:58 +0000 From: Anup Patel To: Rick Chen , Bin Meng , Joe Hershberger , Michal Simek , Michal Simek , Lukas Auer , Masahiro Yamada , Simon Glass Thread-Topic: [PATCH v10 00/15] SiFive FU540 Support Thread-Index: AQHUzOIOzMPpSsWH30OsUb7sCWWQ5Q== Date: Mon, 25 Feb 2019 08:13:58 +0000 Message-ID: <20190225081334.23256-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: TYAPR01CA0069.jpnprd01.prod.outlook.com (2603:1096:404:2b::33) To MN2PR04MB6061.namprd04.prod.outlook.com (2603:10b6:208:d8::15) 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-ms-office365-filtering-correlation-id: ff17186a-ec92-4e13-df28-08d69af93133 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600110)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MN2PR04MB5789; x-ms-traffictypediagnostic: MN2PR04MB5789: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MN2PR04MB5789; 23:WQ1KB80n6o26Ykf1sleGsjh7+EH+6bFFTqbH28S?= =?iso-8859-1?q?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scz0nsCCyiszFeO5eXa7795?= =?iso-8859-1?q?nddcUniwPY+6N7yOpb4u0r23usxQcDxy6VkoouvvEC4RGbCsbAt?= =?iso-8859-1?q?rpSiaWEUnN+4j82TEhyk/5syN+F9HQYuzjRfVVdwX+OwbxL6c7X?= =?iso-8859-1?q?pxtalYMu6bzoBgTKeG2XtDXgckDzd6BvbWp51yP7hsXgqQRPEfz?= =?iso-8859-1?q?wk3KpGm31aBmUyz9mojyndap37hmDdapiUapNgFmXWL5FmVwlxs?= =?iso-8859-1?q?3PyQT4vEv+yfVzrNwKzbXATN+hENasPFHXTeoeClUNB4beerYTk?= =?iso-8859-1?q?lpVPNNQqS+Qgb8uGFAwyfSVbRPsY/rbQAUJ8eYwk8yqJDiPMjHc?= =?iso-8859-1?q?2jcQOgINFLYztMhxdCpen+oZ6j4yRMzfNsiA4fr8tnCIGO0JHqR?= =?iso-8859-1?q?esoqj6gG+3wqKk+NJMexdirARqsmojH+WHCWTqS2SR1?= x-microsoft-antispam-prvs: x-forefront-prvs: 095972DF2F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6029001)(376002)(346002)(396003)(366004)(39860400002)(136003)(189003)(199004)(66066001)(6512007)(186003)(53936002)(7736002)(305945005)(44832011)(478600001)(106356001)(26005)(486006)(2616005)(476003)(105586002)(7416002)(5660300002)(14454004)(6506007)(386003)(72206003)(8676002)(86362001)(54906003)(110136005)(81156014)(71190400001)(316002)(102836004)(6346003)(71200400001)(81166006)(1076003)(36756003)(25786009)(99286004)(97736004)(52116002)(50226002)(2906002)(8936002)(6486002)(6436002)(4326008)(68736007)(14444005)(256004)(6116002)(3846002); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB5789; H:MN2PR04MB6061.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: zqn5M1fmkgHKGC/X7cQ5qdH1+JqDmFYxpR2YpXXSY9NuYNERap2Q2xWHOheOWaH0Y3tUKD59/gSkRuZiT16ysVpLZlNShExMIZFIlR9UX6pQAjliNbea0QZX4xbFzayKRjrY2MQCVdEn9TJBNIz8Q/mIffKZSm7bsbSYAYoMl3ALZVUpTKHYmdnD3CN4CfYnjlcXWyGlcF4RHyJ3GTSWJYJC0twJI+HT2+dN3vF7atJakRjZNUZ2DbaeXD5XIn6IlG+xIMa++jAUDm3Nt4sWDIylpTiHB4DKS/r2g4bs0PWioRNKfJNXX0ObWAWIC6/1Mqx3tECh0Gm+eMERuW6ebZOK3hHvY14dBdTdXtsNsT2iMiB7vQM9/B6LRwnYtJXlCV0hpI4E7QtUei31EQHUDpWkdLDterG+eXPfRJ27tZs= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff17186a-ec92-4e13-df28-08d69af93133 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Feb 2019 08:13:53.8229 (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: MN2PR04MB5789 Cc: Palmer Dabbelt , Alexander Graf , U-Boot Mailing List Subject: [U-Boot] [PATCH v10 00/15] SiFive FU540 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 patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot. The patches are based upon latest U-Boot source tree (git://git.denx.de/u-boot.git) at v2019.04-rc2 commit id f14de0014c56093feecf42ca38b8ae5b3878f176 All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU sifive_u machine. Changes since v9: - Bring back "#if" in clk_fixed_factor_ofdata_to_platdata() of PATCH9 because without it we have build failure using Travis Changes since v8: - Added bindings document for fixed-factor-clock adapted from Linux sources in PATCH9 Changes since v7: - Rebased patches to latest U-Boot source tree - Rename "ret" to "rate" in clk_fixed_factor_get_rate() of PATCH9 Changes since v6: - Rebased patches to latest U-Boot source tree - Droped PATCH1 and PATCH2. Instead added a PATCH to select CREATE_ARCH_SYMLINK for RISC-V - Few typo fixes in SiFive FU540 readme Changes since v5: - Added PATCH16 to fix INITRD passing to Linux using bootm for U-Boot RISC-V Changes since v4: - Removed #ifndef from macb_enable_clk() in PATCH7 - Updated test/dm/clk.c in PATCH10 to test fixed factor clock using sandbox Changes since v3: - Added patch to un-ignore arch/riscv/include/asm/arch - Added patch to fix mrproper make target to only remove arch/*/include/asm/arch paths which are symlinks - Added patch to have place-holder asm/arch/clk.h for RISC-V - Removed "#ifndef CONFIG_RISCV" from macb clk API patch Changes since v2: - Fixed typo in PATCH3 comments - Removed "#if" from clk_fixed_factor_ofdata_to_platdata() in PATCH7 - Added PATCH12 for SiFive FU540 README guide Changes since v1: - Re-ordered SoB in patches with multiple SoB - Simplified board_get_usable_ram_top() added by PATCH3 Anup Patel (10): riscv: Enable create symlink using kconfig riscv: Rename cpu/qemu to cpu/generic riscv: Add asm/dma-mapping.h for DMA mappings riscv: Add place-holder asm/arch/clk.h for driver compilation riscv: generic: Ensure that U-Boot runs within 4GB for 64bit systems net: macb: Fix clk API usage for RISC-V systems clk: Add SiFive FU540 PRCI clock driver clk: Add fixed-factor clock driver riscv: Add SiFive FU540 board support riscv: Enable CONFIG_SYS_BOOT_RAMDISK_HIGH for using initrd Atish Patra (5): net: macb: Fix GEM hardware detection drivers: serial_sifive: Fix baud rate calculation drivers: serial_sifive: Skip baudrate config if no input clock cpu: Bind timer driver for boot hart doc: Add a readme guide for SiFive FU540 arch/Kconfig | 1 + arch/riscv/Kconfig | 6 +- 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/generic/dram.c | 37 ++ arch/riscv/cpu/qemu/dram.c | 17 - arch/riscv/include/asm/arch-generic/clk.h | 14 + arch/riscv/include/asm/config.h | 1 + arch/riscv/include/asm/dma-mapping.h | 38 ++ arch/sandbox/dts/test.dts | 8 + board/emulation/qemu-riscv/Kconfig | 4 +- .../qemu-riscv => sifive/fu540}/Kconfig | 36 +- board/sifive/fu540/MAINTAINERS | 9 + board/sifive/fu540/Makefile | 5 + board/sifive/fu540/fu540.c | 17 + configs/sifive_fu540_defconfig | 11 + doc/README.sifive-fu540 | 303 +++++++++ .../clock/fixed-factor-clock.txt | 24 + drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 5 +- drivers/clk/clk_fixed_factor.c | 74 +++ 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 +++++++++++ drivers/cpu/riscv_cpu.c | 7 +- drivers/net/macb.c | 11 +- drivers/serial/serial_sifive.c | 60 +- include/configs/sifive-fu540.h | 43 ++ include/dt-bindings/clk/sifive-fu540-prci.h | 29 + test/dm/clk.c | 5 +- 33 files changed, 1821 insertions(+), 66 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%) create mode 100644 arch/riscv/cpu/generic/dram.c delete mode 100644 arch/riscv/cpu/qemu/dram.c create mode 100644 arch/riscv/include/asm/arch-generic/clk.h create mode 100644 arch/riscv/include/asm/dma-mapping.h copy board/{emulation/qemu-riscv => sifive/fu540}/Kconfig (57%) 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 doc/README.sifive-fu540 create mode 100644 doc/device-tree-bindings/clock/fixed-factor-clock.txt create mode 100644 drivers/clk/clk_fixed_factor.c 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/configs/sifive-fu540.h create mode 100644 include/dt-bindings/clk/sifive-fu540-prci.h