{"id":812977,"url":"http://patchwork.ozlabs.org/api/patches/812977/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170912170908.29862-1-marek.vasut+renesas@gmail.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170912170908.29862-1-marek.vasut+renesas@gmail.com>","list_archive_url":null,"date":"2017-09-12T17:09:08","name":"[U-Boot] mtd: cfi: Zap cfi_flash_base in DM case","commit_ref":"1ec0a37e1cf2add5680b8d7305922c8210c3e2ed","pull_url":null,"state":"accepted","archived":false,"hash":"2d6e789dddf3022dc46d535ffb30197ba725cdec","submitter":{"id":1124,"url":"http://patchwork.ozlabs.org/api/people/1124/?format=json","name":"Marek Vasut","email":"marek.vasut@gmail.com"},"delegate":{"id":1696,"url":"http://patchwork.ozlabs.org/api/users/1696/?format=json","username":"stroese","first_name":"Stefan","last_name":"Roese","email":"sr@denx.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170912170908.29862-1-marek.vasut+renesas@gmail.com/mbox/","series":[{"id":2746,"url":"http://patchwork.ozlabs.org/api/series/2746/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=2746","date":"2017-09-12T17:09:08","name":"[U-Boot] mtd: cfi: Zap cfi_flash_base in DM case","version":1,"mbox":"http://patchwork.ozlabs.org/series/2746/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812977/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812977/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"qyYbhuG9\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xsBCT5JyKz9s82\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 03:11:17 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 61465C220E5; Tue, 12 Sep 2017 17:09:45 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id B5E75C22053;\n\tTue, 12 Sep 2017 17:09:42 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 546C3C21E39; Tue, 12 Sep 2017 17:09:19 +0000 (UTC)","from mail-wr0-f194.google.com (mail-wr0-f194.google.com\n\t[209.85.128.194])\n\tby lists.denx.de (Postfix) with ESMTPS id CE6E0C21FE8\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 17:09:14 +0000 (UTC)","by mail-wr0-f194.google.com with SMTP id u48so6536834wrf.4\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 10:09:14 -0700 (PDT)","from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz.\n\t[86.49.107.50]) by smtp.gmail.com with ESMTPSA id\n\tk11sm8594839wrc.90.2017.09.12.10.09.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 12 Sep 2017 10:09:13 -0700 (PDT)"],"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=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=KPePJ1hoSdkxsuCyUyYX9TPKzulrukpdDqv8EHdnjHM=;\n\tb=qyYbhuG9aALTO1WEYkLViyPMfcMu9tlxlL2olnYLQlYXGbRkpLY8vF1dvpTEPT0w1b\n\tbzN2gYfprHTrHV2+vIDT4izre76zrnMTZBaylio8ND3ZSNOk5R0lu9nwaLhNSabL5L5S\n\t5fix57Hv/17ochWDQ0UjQ0BWRZXw3B31Qtd+HQ54Zj5eNUOp/DNJmGGpgO08WuJML05b\n\t04NYO8+bU7I+UQi00vibnNofye7n2dUo//QLxkj8IYpVxqMuIe8atBDYB6iSzi3YddXn\n\tiIzPD6LdUjXO3Dq7OouaMZ+x5kiDBk8pesiuc75tPy//Ir0Zf8vrcEW+FM6p1kTxt7TB\n\tfdQw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=KPePJ1hoSdkxsuCyUyYX9TPKzulrukpdDqv8EHdnjHM=;\n\tb=Nmb9h6AP7QnpIH3Q4iKhBuZm0onbtHxZR7yP00l76r0ceVyr2I6squ+pUc4garkQGg\n\tOaR3htrgavAYhezeHkYE03EnosMEv8RbS0j0G1OUJ5VYh8GKo5UWTInP6Q5yZiViIqdb\n\tmhbZioQlFK6f1PyZ95xmKXHycDhOX0FjnaGkljEBwi91qg95vBr/Yubb2EVTprbi2slO\n\tRjb46/ncdLhgQz8SRxDqVlSzJNt84YAN3EgSuzR55QlZRTaGnssfNxouLGBoUU4heyDm\n\tcTviHzOW34QzGB1Cxrjxay2P7J/9rcgdWuJ3cvQ/yJIkFx0mu6MgBGD9FAv8XTfqCNwl\n\tBT9Q==","X-Gm-Message-State":"AHPjjUiQJQiAQG9aufijZKRx6uPYIFR+98DtiZ6j/njzlHS4SR9UjbUU\n\tzGvQhkykoLL7IZy7fEU=","X-Google-Smtp-Source":"ADKCNb7Qu4wAEi989O9bFqnJdesmk3ZgsQK48+Mr2FZjSNo+24VMblhilAOXGCuXH87xcaBc8hfWSw==","X-Received":"by 10.223.134.25 with SMTP id 25mr13081883wrv.186.1505236154314; \n\tTue, 12 Sep 2017 10:09:14 -0700 (PDT)","From":"Marek Vasut <marek.vasut@gmail.com>","X-Google-Original-From":"Marek Vasut <marek.vasut+renesas@gmail.com>","To":"u-boot@lists.denx.de","Date":"Tue, 12 Sep 2017 19:09:08 +0200","Message-Id":"<20170912170908.29862-1-marek.vasut+renesas@gmail.com>","X-Mailer":"git-send-email 2.11.0","Cc":"Marek Vasut <marek.vasut+renesas@gmail.com>","Subject":"[U-Boot] [PATCH] mtd: cfi: Zap cfi_flash_base in DM case","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"Embed the flash base into struct flash_info instead of having ad-hoc\nstatic array in the code. This does not only remove static variable,\nbut also allows CFI-like controllers, ie. HyperFlash ones, to use most\nof the CFI flash code by populating the flash_info with matching base\naddress.\n\nSigned-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>\n---\n drivers/mtd/cfi_flash.c | 10 +++++-----\n include/flash.h         |  4 ++++\n 2 files changed, 9 insertions(+), 5 deletions(-)","diff":"diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c\nindex f3bb72788a..df04a425e2 100644\n--- a/drivers/mtd/cfi_flash.c\n+++ b/drivers/mtd/cfi_flash.c\n@@ -111,11 +111,9 @@ static void cfi_flash_init_dm(void)\n \t}\n }\n \n-static phys_addr_t cfi_flash_base[CFI_MAX_FLASH_BANKS];\n-\n phys_addr_t cfi_flash_bank_addr(int i)\n {\n-\treturn cfi_flash_base[i];\n+\treturn flash_info[i].base;\n }\n #else\n __weak phys_addr_t cfi_flash_bank_addr(int i)\n@@ -2458,10 +2456,12 @@ static int cfi_flash_probe(struct udevice *dev)\n \twhile (idx < len) {\n \t\taddr = fdt_translate_address((void *)blob,\n \t\t\t\t\t     node, cell + idx);\n-\t\tcfi_flash_base[cfi_flash_num_flash_banks++] = addr;\n+\t\tflash_info[cfi_flash_num_flash_banks].dev = dev;\n+\t\tflash_info[cfi_flash_num_flash_banks].base = addr;\n+\t\tcfi_flash_num_flash_banks++;\n \t\tidx += addrc + sizec;\n \t}\n-\tgd->bd->bi_flashstart = cfi_flash_base[0];\n+\tgd->bd->bi_flashstart = flash_info[0].base;\n \n \treturn 0;\n }\ndiff --git a/include/flash.h b/include/flash.h\nindex f53fe91349..0eedb1efa8 100644\n--- a/include/flash.h\n+++ b/include/flash.h\n@@ -47,6 +47,10 @@ typedef struct {\n #ifdef CONFIG_MTD\n \tstruct mtd_info *mtd;\n #endif\n+#ifdef CONFIG_CFI_FLASH\t\t\t/* DM-specific parts */\n+\tstruct udevice *dev;\n+\tphys_addr_t base;\n+#endif\n } flash_info_t;\n \n extern flash_info_t flash_info[]; /* info for FLASH chips\t*/\n","prefixes":["U-Boot"]}