From patchwork Tue Aug 29 06:48:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 806979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xhK3y6076z9ryr for ; Tue, 29 Aug 2017 16:49:02 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="HZFrPr8x"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xhK3y4pmjzDqgj for ; Tue, 29 Aug 2017 16:49:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="HZFrPr8x"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pg0-x24a.google.com (mail-pg0-x24a.google.com [IPv6:2607:f8b0:400e:c05::24a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xhK3f596TzDqJs for ; Tue, 29 Aug 2017 16:48:46 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="HZFrPr8x"; dkim-atps=neutral Received: by mail-pg0-x24a.google.com with SMTP id r133so7183490pgr.0 for ; Mon, 28 Aug 2017 23:48:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:message-id:subject:from:to:cc; bh=T2jZWcoxCLsM4bHCb+6wt6cXbCNJT4maVdBMoXqv2AI=; b=HZFrPr8xYSYa6FwRKYLQUPsqfYOTwoBzbt0XG5/zAV+b3fFbP7RsV9AJID+wvV6HqD PyQF176LjmVvnE3f5nra6SG4AazSYjlchGSUNhnJshh/u/I6Wt/P4jurzQ9YKqKD/WT0 3aDFQhBIwKxFWO7JzGk8CXBNeK+qicDSDvAUhuF6viD4m7yDX5cpGHYGCTjnKc9F2/2S ke50m02lWCN4PDHbofP5zcU66ujS7+UnqP5h0/nEfqrtZgag0MVPCGimVA5uDWtUm2eE /36yuBi+/YcIoStb4RkVhKfM6lnGu/g+wjX1Zu5dTJs8cvtYnxk/58u4U6z9Ri7thIWC 3Dmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=T2jZWcoxCLsM4bHCb+6wt6cXbCNJT4maVdBMoXqv2AI=; b=jsybYp0Bd4LEQzJNhv4DL7ldVxa6dXZpJ42qVKwjTIB4oTwUGQUacc72XinayaMCwk WAwsbgmYDjKwxI95/8IT5qRs/zzAfSEUm7X8m8qe8UOl+S86nErzGnbHvCICtvPQYAgI TcgisQ7N4SqXeImVaY1Dm9PiTs0BCsRB0v5Pq/ebmxf6fAd6xZRDZ/auazbfbEZgYzp+ 4Fk/1UV/9+6eEC2qGauV2s/1g/66ii1gX9QxAbGYwY9L1XnCBQUt0g/4OBn9NFPw8E+T fEZ4tps0ESi1i9e0dI7K5kUzeArH6EjFQFlJ/ZPGzE+TlafNaq6GkYKPhC/JKne6thep KA4A== X-Gm-Message-State: AHYfb5jloXYqOvdakslGIv7R0INTVftoW5tQTx5e5Ir3F47vDWBC09Ah bHSN+qmnU6TtMabTrerwab8mvtnfIpp9nJjtF7rw3m5EbulkbV4989381AQCnb2e7vCwLLE16j6 K3e4hgEyn4OsrNJqgp2dsTVdY3B6NVCtYMbFe16ua1+CTkIs= X-Google-Smtp-Source: ADKCNb5y6s1rnCx62swcbrR7HyHERw+v26+N01cK9DFu+/ZtgCwiAPiN/d5C+NCFaOHyYnXqT4jeNzs= MIME-Version: 1.0 X-Received: by 10.99.112.20 with SMTP id l20mr2112627pgc.18.1503989324218; Mon, 28 Aug 2017 23:48:44 -0700 (PDT) Date: Mon, 28 Aug 2017 23:48:40 -0700 Message-Id: <20170829064840.3808-1-wak@google.com> X-Mailer: git-send-email 2.13.1 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org Subject: [Skiboot] [PATCH] flash: Support adding the no-erase property to flash X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Currently, flash devices like mbox-flash ignore erase commands. This means that issuing an erase from userspace, through the mtd device, and back returns a successful operation that does nothing. Unfortunately this makes userspace tools unhappy. Linux MTD devices support the MTD_NO_ERASE flag which conveys that writes do not require erases on the underlying flash devices. We should set this property on all of our devices which do not require erases to be performed. NOTE: This still requires a linux kernel component to set the MTD_NO_ERASE flag from the device tree property. Signed-off-by: William A. Kennington III Reviewed-by: Suraj Jitindar Singh --- core/flash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/flash.c b/core/flash.c index 53e6eba08..9e230174f 100644 --- a/core/flash.c +++ b/core/flash.c @@ -31,6 +31,7 @@ struct flash { struct list_node list; bool busy; + bool no_erase; struct blocklevel_device *bl; uint64_t size; uint32_t block_size; @@ -199,6 +200,8 @@ static struct dt_node *flash_add_dt_node(struct flash *flash, int id) dt_add_property_u64(flash_node, "reg", flash->size); dt_add_property_cells(flash_node, "ibm,flash-block-size", flash->block_size); + if (flash->no_erase) + dt_add_property(flash_node, "no-erase", NULL, 0); /* we fix to 32-bits */ dt_add_property_cells(flash_node, "#address-cells", 1); @@ -281,6 +284,7 @@ int flash_register(struct blocklevel_device *bl) flash->busy = false; flash->bl = bl; + flash->no_erase = !(bl->flags & WRITE_NEED_ERASE); flash->size = size; flash->block_size = block_size; flash->id = num_flashes();