From patchwork Thu Jan 23 20:15:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagar Shrikant Kadam X-Patchwork-Id: 1228548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=selector1 header.b=B+xAWcD3; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 483YTS6lKhz9sPK for ; Fri, 24 Jan 2020 07:16:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7107A817BE; Thu, 23 Jan 2020 21:16:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.b="B+xAWcD3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B359C817BE; Thu, 23 Jan 2020 21:16:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2061e.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8a::61e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 61682817AA for ; Thu, 23 Jan 2020 21:16:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sagar.kadam@sifive.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBOtJJhhwVJUPOGrslPhSDLSuF8SN3eaAUccOuNQUuvjVGEqjlKR+VaBS0V4eZGBQ4tUNCKVX3cbFen47GGthAmHImFBw7BzitEi82zY4BhnZq0Tz/Mx7NTljlQIInGL7g1rOTzKhQEtEG1F+eunQKIWoHIR01gJImr0MfnrusSGvSevBPKXceO+eTtGYTdAGy6iq9TJW12VTYwgTfpBRCyz6VYjGoo7uhHbptj/BcED1b3exsVZyO1HY2gnu5XEqH+X24Y0mnWmVUhhC/I4iFKWw7QAJCD6DBeQ+a4VBgJkgnAYU4EvWWUW/DncZNBTKPptr5GFBYv0y0J679NzBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mZ+y6WaqMnMu2T3lli+T+LLVPPqfxJKkZ/F7rZ6KNPo=; b=RFpSpy/DllNkjp2GQTdWqLj0pVOhdcgw+If24LsdlktjjT66d3J0d+HngyOalrgudjTrNpP2kU2apGIG4h1gI2UEL+F3V8/geXKGU+U1rS6I1PDdJwLP6X1r0HcmyPqlTgevPy4qahm+Gw0VXiul6jKF9PfAZk9iOdWTWU1U4HcJbB3V0Lv6QA6B7JDhg0H8H40en+UFdoXqYO0aez6WxON8IWDpVqQtZK7ZLFm26hBpAAbGyzc0cRyyYKtKrPiTHKskPHz7RniU1wbClf/jt7Hr+fnTt9VzXLmmuZSrikLLyRfPGkfeajB4kv2BfS24gwWR0Skxcs4tg5pZBRIdAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sifive.com; dmarc=pass action=none header.from=sifive.com; dkim=pass header.d=sifive.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mZ+y6WaqMnMu2T3lli+T+LLVPPqfxJKkZ/F7rZ6KNPo=; b=B+xAWcD3ZWCSbt4woN58QNyCBtbAOnr/nYOeupWh0V/zU9/8lar48hu0epQBOdf9M2oK5BVA4CDrrhYD8f5xZ00uvodG/zj5nVA4hmQORi2Ja0XzecZZ7wRKvNKiRNIU5kJOC8S2xepBqgI82OOKit+f9RN/pNCXIJC7hXB6E/A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sagar.kadam@sifive.com; Received: from DM6PR13MB2442.namprd13.prod.outlook.com (20.176.101.153) by DM6PR13MB2988.namprd13.prod.outlook.com (20.176.127.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.15; Thu, 23 Jan 2020 20:16:41 +0000 Received: from DM6PR13MB2442.namprd13.prod.outlook.com ([fe80::20cf:e8b3:b1e:c8b0]) by DM6PR13MB2442.namprd13.prod.outlook.com ([fe80::20cf:e8b3:b1e:c8b0%7]) with mapi id 15.20.2665.017; Thu, 23 Jan 2020 20:16:41 +0000 From: Sagar Shrikant Kadam To: u-boot@lists.denx.de Subject: [U-Boot Patch v1 0/7] Fix currently available support for flash on HiFive Unleashed Date: Thu, 23 Jan 2020 12:15:59 -0800 Message-Id: <1579810566-11675-1-git-send-email-sagar.kadam@sifive.com> X-Mailer: git-send-email 2.7.4 X-ClientProxiedBy: BYAPR06CA0001.namprd06.prod.outlook.com (2603:10b6:a03:d4::14) To DM6PR13MB2442.namprd13.prod.outlook.com (2603:10b6:5:cb::25) MIME-Version: 1.0 Received: from gamma07.internal.sifive.com (64.62.193.194) by BYAPR06CA0001.namprd06.prod.outlook.com (2603:10b6:a03:d4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2644.20 via Frontend Transport; Thu, 23 Jan 2020 20:16:40 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [64.62.193.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 284d3f0c-047f-477f-761e-08d7a04128b7 X-MS-TrafficTypeDiagnostic: DM6PR13MB2988: X-LD-Processed: 22f88e9d-ae0d-4ed9-b984-cdc9be1529f1,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1148; X-Forefront-PRVS: 029174C036 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6029001)(396003)(376002)(346002)(39840400004)(366004)(136003)(189003)(199004)(6916009)(4326008)(7696005)(6486002)(6666004)(66556008)(316002)(86362001)(2906002)(186003)(66946007)(5660300002)(8936002)(81166006)(16526019)(2616005)(81156014)(26005)(66476007)(8676002)(956004)(478600001)(107886003)(36756003)(966005)(52116002)(131093003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR13MB2988; H:DM6PR13MB2442.namprd13.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: sifive.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jMaA9n9ydocCQn0mO5vfiGNVAcOdqyu4MPHNWnJ2R84zmdNL9NNxp20CAZZyuI2RocB/yjbPb4e7ZYsCAPWgPn4eWrcu4EQI0elR2RxXpKUOxED7EFrdL8C2seFVKPBaADKSDv/3vKqsiLrHJjneBGnbGWbIIOkgwQv0i4atGDXqrAZyxIJFZAysPQwA1ZBFSVKfXDJzPJ+9K3N8KbpjhhRrPe5/JO1MAYbbtwxRFZigK9h5q7p02IoQt3ByGiN+t2cZVdOeGXKs0SWakB1wpFVIqrpmD3IIsZwSf7SXUQNHwTGbqveFlnLy8Ou2sG1sQJD/Yg9veMA93CB+bdGTkhrEhGo00jTxLNgxqL24pUwD9vTXyCqrkMttagWMR9xGgXJo5birFPf3GKvVnoJfJ7znR2gyE1vbmxQjfYfMxLX8MAnEwkW0v4DHmU7mMBKmIKe469xWgqUvjJ4e1zgOwQZvdEj70HsqZOdmj2JCwMSoo3Kqo+anzUJ8V4HqJ4t/oV5HTbwD5Qorw7LPzWWqUTKeKFpuRLCqMNuR6gOY6WY= X-MS-Exchange-AntiSpam-MessageData: fucozhwWnCtl21zR/27Hp5OLZ9B8KRgRvna6e5R25dgUruGOdhD7hVNmUjTo+vpwYz9ZyF7+n1oPiEJHHuaMxI6IkWPLaZMBxe7ryYEjJQ95QXS3hULr8eHvRzDkhvPtB+KctRv6Q2moWnxbtmfZ+g== X-OriginatorOrg: sifive.com X-MS-Exchange-CrossTenant-Network-Message-Id: 284d3f0c-047f-477f-761e-08d7a04128b7 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2020 20:16:41.4533 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 22f88e9d-ae0d-4ed9-b984-cdc9be1529f1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: X6w1vP01NmezM2HyLcySmHrNY5F7Bn1SgBZVfo2URXrFDH1uS4fmeyATX+l8zdgpubSBX3vBDJ/ls7+9k6ZyTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB2988 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: atish.patra@wdc.com, ick@andestech.com Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean Currently device ID for flash mounted on HiFive Unleashed is added to U-Boot. Also there are few patches to go mainline (Thanks to Jagan Tekki and Bin Meng). This series addresses few issues discussed there: Patch 1: Includes hifive-unleashed-a00-u-boot.dts for building DTB Patch 2: Prints fdt base address which can be used for debugging purpose. Patch 3,4: Number of chip select's for the spi nodes and adds method to claim and release the bus Earlier it was observed that sf probe 0:2/4/6/8 etc.. used to detect the flash device even though it is only connected to chip select 0, with these patches flash is now probed only CS0. Patch 5,7: A workaround is added to make flash device accessible in single bit mode & is tagged with TODO. Patch 6: Introduce spi_nor_fixups method similar to linux to fix wrongly read parameters from SFDP. This series is based on commit 052170c6a043 ("configs: Resync with savedefconfig") with two below mentioned patches from [1] [U-Boot,v2,4/5] riscv: dts: hifive-unleashed-a00: Add -u-boot.dtsi [U-Boot,v2,5/5] sifive: fu540: Enable spi-nor flash support [1] https://patchwork.ozlabs.org/patch/1177979/ The above series is available for testing here[2] [2] https://github.com/sagsifive/u-boot/tree/dev/sagark/test_spi-nor ================Log for reference===================== => bdinfo boot_params = 0x0000000000000000 DRAM bank = 0x0000000000000000 -> start = 0x0000000080000000 -> size = 0x0000000200000000 relocaddr = 0x00000000fff8c000 reloc off = 0x000000007fd8c000 fdt_blob = 0x00000000ff768530 ->FDT base address ethaddr = 70:b3:d5:92:f2:c8 IP addr = baudrate = 115200 bps => fdt addr 0x00000000ff768530 => fdt print /aliases aliases { serial0 = "/soc/serial@10010000"; serial1 = "/soc/serial@10011000"; ethernet0 = "/soc/ethernet@10090000"; spi0 = "/soc/spi@10040000"; -> Alias nodes from patch1 spi2 = "/soc/spi@10050000"; }; =>---------------------------------------------------------------- Full flash memory erase/write/read/validate => sf probe 0:0 SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB => mw 0x80600000 0x12348765 0x800000 => sf erase 0x0 0x2000000 SF: 33554432 bytes @ 0x0 Erased: OK => sf write 0x80600000 0x0 0x2000000 device 0 whole chip SF: 33554432 bytes @ 0x0 Written: OK => sf read 0x82600000 0x0 0x2000000 device 0 whole chip SF: 33554432 bytes @ 0x0 Read: OK => cmp.b 0x80600000 0x82600000 0x2000000 Total of 33554432 byte(s) were the same =>---------------------------------------------------------------- Flash detection only at valid Chip select => sf probe 0:0 SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB => sf probe 0:1 Invalid cs number = 1 Failed to initialize SPI flash at 0:1 (error -22) => sf probe 0:2 Invalid cs number = 2 Failed to initialize SPI flash at 0:2 (error -22) => sf probe 0:4 Invalid cs number = 4 Failed to initialize SPI flash at 0:4 (error -22) => sf probe 0:8 Invalid cs number = 8 Failed to initialize SPI flash at 0:8 (error -22) =>---------------------------------------------------------------- Sagar Shrikant Kadam (7): riscv: dts: include -u-boot for dtb bdinfo: fu540: print fdt descriptor base for debug fu540: dtsi: spi: add num-cs info to dt spi: fu540: add claim and release method to spi-sifive.c spi: fu540: fix: use spi xfer bitlen for spi transfer nor: add post bfpt fix handler for is25wp256 device fu540: spi-nor: modify the flash read and program opcodes arch/riscv/dts/fu540-c000.dtsi | 3 ++ arch/riscv/dts/hifive-unleashed-a00.dts | 1 + board/sifive/fu540/Kconfig | 1 + cmd/bdinfo.c | 1 + drivers/mtd/spi/sf_internal.h | 16 +++++++ drivers/mtd/spi/spi-nor-core.c | 76 ++++++++++++++++++++++++++++++++- drivers/mtd/spi/spi-nor-ids.c | 7 ++- drivers/spi/spi-sifive.c | 55 +++++++++++++++++++++--- include/linux/mtd/spi-nor.h | 1 + 9 files changed, 153 insertions(+), 8 deletions(-)