From patchwork Fri Apr 7 23:11:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Kennington X-Patchwork-Id: 748531 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w0Jtv59cLz9s7t for ; Sat, 8 Apr 2017 11:36:07 +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="Xecm+X2B"; 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 3w0Jtv48xQzDqKT for ; Sat, 8 Apr 2017 11:36:07 +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="Xecm+X2B"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pg0-x249.google.com (mail-pg0-x249.google.com [IPv6:2607:f8b0:400e:c05::249]) (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 3w0Fhx5SVmzDqJ0 for ; Sat, 8 Apr 2017 09:12:17 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Xecm+X2B"; dkim-atps=neutral Received: by mail-pg0-x249.google.com with SMTP id o123so4751985pga.1 for ; Fri, 07 Apr 2017 16:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=Hluhc3o7LYwkm7JPAEUZSuzLKV/A6A3qVsbh6tRCLEc=; b=Xecm+X2B6KnxWMY2z0yJ87oEYxiVXFPHcwNpXDrWFamOLTMfMVo6BQW0H3sXLsWc3l frPYSA3EMBH0Nek5GuOaDb5Av669dMPaZ6eUhVKbEweJfrGvvbktf57w+asXv06qC3s4 A8SLx/RW4fXwbOjMARgo6+HIcemFYB9VomwveqD8q7OoQ5gPAHa8o6wjVuMjbOhHoKaA 18QIL6l9fi83ZdZfTfKyYpmwxreN14tqGkYeVg6wz3yEFa+7rMqmaEr7lqtUErqZCqh8 1ykOo0xwKgq4PulHC5lEGqb8k7v5qDuBvI4/+hs6To/jn/fgAbjfVCaU0oUbsJDxcnMn EPwg== 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:in-reply-to:message-id :references:subject:from:to:cc; bh=Hluhc3o7LYwkm7JPAEUZSuzLKV/A6A3qVsbh6tRCLEc=; b=DtC6KJ68rY7qI7vxUDlj/2idLhqfPZX+drLOQ8UAUhvcp5v6EByaZld7W4I8D01HxG g+qe+w7vRgEaxP/si375nMOT/MWr1vMIPmrvj4iALadQ6wDapk1HKkENuaz6GcbNkoMX MMs88AzBXaalrj5RyjUPxruP7lbF+S9G4mxynFbRq0KOFVkKO//foWer08jXTAqrIP2+ asUG80rhhXlq9doIFi41ZNBqrlkLia1Lb21i0mGcG+M6GCRfBNxBC6iwPhh4dn4Jrzfk o6vBVJUHdbX46jqxQgNEiIX2caoGZt1LpGkQE5pFv34Vd6foSkHbus7XxZ/zlnPW69nH teNw== X-Gm-Message-State: AFeK/H2/Kio8gzHE3CDgI5izIaMV9BPCWc5zE+2YO5SnGSSSKLkArRXFvDQUxQm2pEdj/tD6WLViVhiASO96lDDASFuRJW5z1MQKAi+1McL5JZ1q9GVgGIi2RYeEJEQ/nvP+YJwReisQ38vphaNI2XFyClbb95r/2rzqqPbb9udemy9e758= MIME-Version: 1.0 X-Received: by 10.98.215.74 with SMTP id v10mr12274184pfl.5.1491606736120; Fri, 07 Apr 2017 16:12:16 -0700 (PDT) Date: Fri, 7 Apr 2017 16:11:47 -0700 In-Reply-To: <20170407231147.6476-1-wak@google.com> Message-Id: <20170407231147.6476-3-wak@google.com> References: <20170407231147.6476-1-wak@google.com> X-Mailer: git-send-email 2.12.2 From: "William A. Kennington III" To: skiboot@lists.ozlabs.org X-Mailman-Approved-At: Sat, 08 Apr 2017 11:35:42 +1000 Subject: [Skiboot] [PATCH 2/2] flash: Add dt entries for flash that doesn't need erase 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" Signed-off-by: William A. Kennington III Change-Id: Iee4cfb809fe00bdaae24dd4a068a3fd395c9a7d1 --- core/flash.c | 16 ++++++++++------ libflash/blocklevel.c | 2 ++ libflash/blocklevel.h | 1 + libflash/mbox-flash.c | 4 ++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/core/flash.c b/core/flash.c index 10cf8b4d..39954ed3 100644 --- a/core/flash.c +++ b/core/flash.c @@ -29,12 +29,13 @@ #include struct flash { - struct list_node list; - bool busy; - struct blocklevel_device *bl; - uint64_t size; - uint32_t block_size; - int id; + struct list_node list; + bool busy; + bool no_erase; + struct blocklevel_device *bl; + uint64_t size; + uint32_t block_size; + int id; }; static LIST_HEAD(flashes); @@ -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); @@ -279,6 +282,7 @@ int flash_register(struct blocklevel_device *bl) } flash->busy = false; + flash->no_erase = !(bl_info.flags & WRITE_NEED_ERASE); flash->bl = bl; flash->size = bl_info.size; flash->block_size = bl_info.erase_granule; diff --git a/libflash/blocklevel.c b/libflash/blocklevel.c index 6272f8fd..5ca71c51 100644 --- a/libflash/blocklevel.c +++ b/libflash/blocklevel.c @@ -233,6 +233,8 @@ int blocklevel_get_info(struct blocklevel_device *bl, struct blocklevel_info *bl if (rc) return rc; + bl_info->flags = bl->flags; + rc = bl->get_info(bl, bl_info); /* Check the validity of what we are being told */ diff --git a/libflash/blocklevel.h b/libflash/blocklevel.h index 7e4a7e8d..92e5e4a5 100644 --- a/libflash/blocklevel.h +++ b/libflash/blocklevel.h @@ -38,6 +38,7 @@ struct blocklevel_info { const char *name; uint64_t size; uint32_t erase_granule; + enum blocklevel_flags flags; }; /* diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c index 75e03005..5305f82b 100644 --- a/libflash/mbox-flash.c +++ b/libflash/mbox-flash.c @@ -438,6 +438,9 @@ static int mbox_flash_erase(struct blocklevel_device *bl __unused, * actually write all 0xFF here. I'll leave that as an extersise * for the future. */ + /* NOTE: When implementing this function for mbox v2, remember to + * change bl->flags = WRITE_NEED_ERASE in mbox_flash_init + */ return 0; } @@ -542,6 +545,7 @@ int mbox_flash_init(struct blocklevel_device **bl) } mbox_flash->bl.keep_alive = 0; + mbox_flash->bl.flags = 0; /* We don't need erases to write */ mbox_flash->bl.read = &mbox_flash_read; mbox_flash->bl.write = &mbox_flash_write; mbox_flash->bl.erase = &mbox_flash_erase;