[{"id":1767989,"web_url":"http://patchwork.ozlabs.org/comment/1767989/","msgid":"<CAOMZO5Bq84Pdj0AmDbJcRJoJVyjZ6OQTGhaji0M1d47yBZgURg@mail.gmail.com>","list_archive_url":null,"date":"2017-09-13T16:02:59","subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","submitter":{"id":6978,"url":"http://patchwork.ozlabs.org/api/people/6978/","name":"Fabio Estevam","email":"festevam@gmail.com"},"content":"Hi Lukasz,\n\nOn Wed, Sep 13, 2017 at 6:39 AM, Lukasz Majewski <lukma@denx.de> wrote:\n\n>  #ifdef CONFIG_SPI_FLASH_BAR\n> +/*\n> + * This \"cleanup\" is necessary in a situation when one was accessing\n> + * spi flash memory > 16 MiB by using Bank Address Register's BA24 bit.\n> + *\n> + * After it the BA24 bit shall be cleared to allow access to correct\n> + * memory region after SW reset (by calling \"reset\" command).\n> + *\n> + * Otherwise, the BA24 bit may be left set and then after reset, the\n> + * ROM would seek for SPL from 0x1000000, not 0x0.\n> + */\n> +static int cleanup_bar(struct spi_flash *flash)\n> +{\n> +       u8 cmd, bank_sel = 0;\n> +\n> +       if (flash->bank_curr == 0)\n> +               return 0;\n> +       cmd = flash->bank_write_cmd;\n> +\n> +       return spi_flash_write_common(flash, &cmd, 1, &bank_sel, 1);\n> +}\n> +\n\nWhat about defining an empty stub for this function when\nCONFIG_SPI_FLASH_BAR is not defined?\n\n>  static int write_bar(struct spi_flash *flash, u32 offset)\n>  {\n>         u8 cmd, bank_sel;\n> @@ -339,6 +360,10 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)\n>                 len -= erase_size;\n>         }\n>\n> +#ifdef CONFIG_SPI_FLASH_BAR\n> +       ret = cleanup_bar(flash);\n> +#endif\n\nThen you don't need to add the ifdefs when calling cleanup_bar().","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=\"ighbjSAy\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xsmn05rc3z9sNV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 02:08:52 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 8350CC22073; Wed, 13 Sep 2017 16:07:14 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id AC53CC224F6;\n\tWed, 13 Sep 2017 16:05:38 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid C3C75C22407; Wed, 13 Sep 2017 16:03:15 +0000 (UTC)","from mail-io0-f196.google.com (mail-io0-f196.google.com\n\t[209.85.223.196])\n\tby lists.denx.de (Postfix) with ESMTPS id 7764DC22261\n\tfor <u-boot@lists.denx.de>; Wed, 13 Sep 2017 16:03:01 +0000 (UTC)","by mail-io0-f196.google.com with SMTP id n69so628913ioi.3\n\tfor <u-boot@lists.denx.de>; Wed, 13 Sep 2017 09:03:01 -0700 (PDT)","by 10.157.14.246 with HTTP; Wed, 13 Sep 2017 09:02:59 -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=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=ks87Tdu3/PYkhAc8u7spfL/xRDWNYYL890vrywH/U5M=;\n\tb=ighbjSAypX+mQNnAHkp3pcdLCQx60jCtBC5XADY9JeOIZLhvLqEA2RiUUVROjUbIB8\n\tVPK0sY8DICajAJWZlLpvZiyzt2cxaWmBMdXQc2WpzESpDRlPORaJQY4ush1QAkLllL3g\n\t/AtEa5yrXz34sP1li19JiByCqyDucHSaa8AHnZSx9zQ8CXk9IrxolCa+CFOuhF97/A4j\n\t/GtOvwOfg+PJh4LQDI7nqkIHGhoSXtYdpHyKuoQ4X54lUXhnE89k4psuSf1T+pGsNrTW\n\tBMO3A8qTMKHDsKzHXKL2JrrgsaaBu/ZFHREBrNPeEGHoIkOsXkVoNlX4GnN24bQnhlZ+\n\tOOBw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=ks87Tdu3/PYkhAc8u7spfL/xRDWNYYL890vrywH/U5M=;\n\tb=Hatb3LLagEAEKR2OqaWNnqe8UqfkeO4ZjTQXaEMbAwzXw3TlCibaOwaLV+CEL8aV86\n\thaQdfvz9VxAAKiBPFjPqAQmbFIUOwCCgjJ5fxZWF8q+YirszayIpSfjhtDUk3NhnAieL\n\tyN4f/dg0uEvSSpeLTRhmpXG5XvgntvVViYUb8m1q+R2z14zlCjjKzDfZymY1BAYgIdPe\n\tT3pjmwuFIQKJSzX9ifK3syahH5PMy08NA/cH/6XZfqCaNw60h+RDI4DXFaQtWsVmgLwQ\n\tm3mAATRs9al6whs+YfHyRgwPgIiAHmABfUjMHws+mzWLQiXXIduYd5Rn8tggI9Z91r58\n\t16Iw==","X-Gm-Message-State":"AHPjjUjUbzZfZvJ07gaDVFU6Ojd7aVxYKqQLoYjCVxgORqIIztukQ69E\n\tPomrv/zuXVoQ9hY881+6xxw4CL2J1KlD/45YqMI=","X-Google-Smtp-Source":"AOwi7QAkNaR1SKBMP40DaTBUAviNSeXLTUA4PMZDNPfen5ujUF2tMvdWyEHTsArgBH/8ZjNOdPSWu/4Kub60dMkDVHg=","X-Received":"by 10.202.57.65 with SMTP id g62mr6242558oia.176.1505318579911; \n\tWed, 13 Sep 2017 09:02:59 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1505295574-14294-1-git-send-email-lukma@denx.de>","References":"<1505295574-14294-1-git-send-email-lukma@denx.de>","From":"Fabio Estevam <festevam@gmail.com>","Date":"Wed, 13 Sep 2017 13:02:59 -0300","Message-ID":"<CAOMZO5Bq84Pdj0AmDbJcRJoJVyjZ6OQTGhaji0M1d47yBZgURg@mail.gmail.com>","To":"Lukasz Majewski <lukma@denx.de>","Cc":"Fabio Estevam <fabio.estevam@nxp.com>, U-Boot-Denx <u-boot@lists.denx.de>,\n\tJagan Teki <jagan@openedev.com>","Subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","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>","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>"}},{"id":1767993,"web_url":"http://patchwork.ozlabs.org/comment/1767993/","msgid":"<53e3b2aa-86a3-6a89-0624-7d345f564f4f@denx.de>","list_archive_url":null,"date":"2017-09-13T16:06:58","subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","submitter":{"id":70701,"url":"http://patchwork.ozlabs.org/api/people/70701/","name":"Lukasz Majewski","email":"lukma@denx.de"},"content":"Hi Fabio,\n\n> Hi Lukasz,\n> \n> On Wed, Sep 13, 2017 at 6:39 AM, Lukasz Majewski <lukma@denx.de> wrote:\n> \n>>   #ifdef CONFIG_SPI_FLASH_BAR\n>> +/*\n>> + * This \"cleanup\" is necessary in a situation when one was accessing\n>> + * spi flash memory > 16 MiB by using Bank Address Register's BA24 bit.\n>> + *\n>> + * After it the BA24 bit shall be cleared to allow access to correct\n>> + * memory region after SW reset (by calling \"reset\" command).\n>> + *\n>> + * Otherwise, the BA24 bit may be left set and then after reset, the\n>> + * ROM would seek for SPL from 0x1000000, not 0x0.\n>> + */\n>> +static int cleanup_bar(struct spi_flash *flash)\n>> +{\n>> +       u8 cmd, bank_sel = 0;\n>> +\n>> +       if (flash->bank_curr == 0)\n>> +               return 0;\n>> +       cmd = flash->bank_write_cmd;\n>> +\n>> +       return spi_flash_write_common(flash, &cmd, 1, &bank_sel, 1);\n>> +}\n>> +\n> \n> What about defining an empty stub for this function when\n> CONFIG_SPI_FLASH_BAR is not defined?\n> \n>>   static int write_bar(struct spi_flash *flash, u32 offset)\n>>   {\n>>          u8 cmd, bank_sel;\n>> @@ -339,6 +360,10 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)\n>>                  len -= erase_size;\n>>          }\n>>\n>> +#ifdef CONFIG_SPI_FLASH_BAR\n>> +       ret = cleanup_bar(flash);\n>> +#endif\n> \n> Then you don't need to add the ifdefs when calling cleanup_bar().\n\nI took the approach already used in this file, so I would prefer to \nleave it is in this patch (to be in sync with the rest).\n\n>","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>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xsmnj2j1Hz9sNV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 02:09:29 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 1D4EBC21DE9; Wed, 13 Sep 2017 16:07:57 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 1CCB7C221EC;\n\tWed, 13 Sep 2017 16:07:55 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid C33B9C2241C; Wed, 13 Sep 2017 16:07:04 +0000 (UTC)","from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10])\n\tby lists.denx.de (Postfix) with ESMTPS id 209A6C22037\n\tfor <u-boot@lists.denx.de>; Wed, 13 Sep 2017 16:07:01 +0000 (UTC)","from frontend03.mail.m-online.net (unknown [192.168.6.182])\n\tby mail-out.m-online.net (Postfix) with ESMTP id 3xsmkr1Xc6z1qvNS;\n\tWed, 13 Sep 2017 18:07:00 +0200 (CEST)","from localhost (dynscan3.mnet-online.de [192.168.6.84])\n\tby mail.m-online.net (Postfix) with ESMTP id 3xsmkr171Cz1qqks;\n\tWed, 13 Sep 2017 18:07:00 +0200 (CEST)","from mail.mnet-online.de ([192.168.8.182])\n\tby localhost (dynscan3.mail.m-online.net [192.168.6.84]) (amavisd-new,\n\tport 10024)\n\twith ESMTP id N9fxEZ5SHVZq; Wed, 13 Sep 2017 18:06:59 +0200 (CEST)","from [192.168.2.222] (89-64-27-66.dynamic.chello.pl [89.64.27.66])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby mail.mnet-online.de (Postfix) with ESMTPSA;\n\tWed, 13 Sep 2017 18:06:59 +0200 (CEST)"],"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=RCVD_IN_DNSWL_LOW,\n\tRCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","X-Virus-Scanned":"amavisd-new at mnet-online.de","X-Auth-Info":"p/wbRXuH/0ZCAGWn5quh6fqHDNY1DSUyLmRv0U1+cMg=","To":"Fabio Estevam <festevam@gmail.com>","References":"<1505295574-14294-1-git-send-email-lukma@denx.de>\n\t<CAOMZO5Bq84Pdj0AmDbJcRJoJVyjZ6OQTGhaji0M1d47yBZgURg@mail.gmail.com>","From":"=?utf-8?q?=C5=81ukasz_Majewski?= <lukma@denx.de>","Organization":"DENX","Message-ID":"<53e3b2aa-86a3-6a89-0624-7d345f564f4f@denx.de>","Date":"Wed, 13 Sep 2017 18:06:58 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<CAOMZO5Bq84Pdj0AmDbJcRJoJVyjZ6OQTGhaji0M1d47yBZgURg@mail.gmail.com>","Content-Language":"en-US","Cc":"Fabio Estevam <fabio.estevam@nxp.com>, U-Boot-Denx <u-boot@lists.denx.de>,\n\tJagan Teki <jagan@openedev.com>","Subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","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>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1774088,"web_url":"http://patchwork.ozlabs.org/comment/1774088/","msgid":"<559bac8b-ef3c-5929-8a91-0ddd5cce79e1@denx.de>","list_archive_url":null,"date":"2017-09-23T22:40:22","subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","submitter":{"id":70701,"url":"http://patchwork.ozlabs.org/api/people/70701/","name":"Lukasz Majewski","email":"lukma@denx.de"},"content":"Hi Fabio, Jagan,\n\n> Hi Lukasz,\n> \n> On Wed, Sep 13, 2017 at 6:39 AM, Lukasz Majewski <lukma@denx.de> wrote:\n> \n>>   #ifdef CONFIG_SPI_FLASH_BAR\n>> +/*\n>> + * This \"cleanup\" is necessary in a situation when one was accessing\n>> + * spi flash memory > 16 MiB by using Bank Address Register's BA24 bit.\n>> + *\n>> + * After it the BA24 bit shall be cleared to allow access to correct\n>> + * memory region after SW reset (by calling \"reset\" command).\n>> + *\n>> + * Otherwise, the BA24 bit may be left set and then after reset, the\n>> + * ROM would seek for SPL from 0x1000000, not 0x0.\n>> + */\n>> +static int cleanup_bar(struct spi_flash *flash)\n>> +{\n>> +       u8 cmd, bank_sel = 0;\n>> +\n>> +       if (flash->bank_curr == 0)\n>> +               return 0;\n>> +       cmd = flash->bank_write_cmd;\n>> +\n>> +       return spi_flash_write_common(flash, &cmd, 1, &bank_sel, 1);\n>> +}\n>> +\n> \n> What about defining an empty stub for this function when\n> CONFIG_SPI_FLASH_BAR is not defined?\n> \n>>   static int write_bar(struct spi_flash *flash, u32 offset)\n>>   {\n>>          u8 cmd, bank_sel;\n>> @@ -339,6 +360,10 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)\n>>                  len -= erase_size;\n>>          }\n>>\n>> +#ifdef CONFIG_SPI_FLASH_BAR\n>> +       ret = cleanup_bar(flash);\n>> +#endif\n> \n> Then you don't need to add the ifdefs when calling cleanup_bar().\n> \n\nJagan, could you look into this patch?\n\nI would prefer to keep the coding style similar to the one already \npresent in this file.","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>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y050b6hGQz9t49\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 24 Sep 2017 08:40:46 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 2D5A6C22058; Sat, 23 Sep 2017 22:40:29 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 648A2C21DC8;\n\tSat, 23 Sep 2017 22:40:27 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 01E2DC21DC8; Sat, 23 Sep 2017 22:40:25 +0000 (UTC)","from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9])\n\tby lists.denx.de (Postfix) with ESMTPS id A5800C21C57\n\tfor <u-boot@lists.denx.de>; Sat, 23 Sep 2017 22:40:25 +0000 (UTC)","from frontend01.mail.m-online.net (unknown [192.168.8.182])\n\tby mail-out.m-online.net (Postfix) with ESMTP id 3y05085mwpz1qqkg;\n\tSun, 24 Sep 2017 00:40:24 +0200 (CEST)","from localhost (dynscan1.mnet-online.de [192.168.6.70])\n\tby mail.m-online.net (Postfix) with ESMTP id 3y05085MdZz1qqkG;\n\tSun, 24 Sep 2017 00:40:24 +0200 (CEST)","from mail.mnet-online.de ([192.168.8.182])\n\tby localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new,\n\tport 10024)\n\twith ESMTP id s8Sc8M_FdKSy; Sun, 24 Sep 2017 00:40:23 +0200 (CEST)","from [192.168.2.222] (89-64-27-66.dynamic.chello.pl [89.64.27.66])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby mail.mnet-online.de (Postfix) with ESMTPSA;\n\tSun, 24 Sep 2017 00:40:23 +0200 (CEST)"],"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=RCVD_IN_DNSWL_LOW,\n\tRCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","X-Virus-Scanned":"amavisd-new at mnet-online.de","X-Auth-Info":"MihALRSFYT2lK+lpGkV7URaTSWbzB2RXXkPEjb+kOlc=","To":"Jagan Teki <jagan@openedev.com>","References":"<1505295574-14294-1-git-send-email-lukma@denx.de>\n\t<CAOMZO5Bq84Pdj0AmDbJcRJoJVyjZ6OQTGhaji0M1d47yBZgURg@mail.gmail.com>","From":"=?utf-8?q?=C5=81ukasz_Majewski?= <lukma@denx.de>","Organization":"DENX","Message-ID":"<559bac8b-ef3c-5929-8a91-0ddd5cce79e1@denx.de>","Date":"Sun, 24 Sep 2017 00:40:22 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<CAOMZO5Bq84Pdj0AmDbJcRJoJVyjZ6OQTGhaji0M1d47yBZgURg@mail.gmail.com>","Content-Language":"en-US","Cc":"Fabio Estevam <fabio.estevam@nxp.com>, U-Boot-Denx <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","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>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1774620,"web_url":"http://patchwork.ozlabs.org/comment/1774620/","msgid":"<CAD6G_RRgOw_z=Sw_c32UYyScoAK55V1cL0B3ygF=1ApKSRm=UA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-25T10:09:26","subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","submitter":{"id":20045,"url":"http://patchwork.ozlabs.org/api/people/20045/","name":"Jagan Teki","email":"jagannadh.teki@gmail.com"},"content":"On Wed, Sep 13, 2017 at 3:09 PM, Lukasz Majewski <lukma@denx.de> wrote:\n> The content of Bank Address Register (BAR) is volatile. It is cleared\n> after power cycle or reset command (RESET F0h).\n>\n> Some memories (like e.g. s25fl256s) use it to access memory larger than\n> 0x1000000 (16 MiB).\n>\n> The problem shows up when one:\n>\n> 1. Reads/writes/erases memory > 16 MiB\n> 2. Calls \"reset\" u-boot command (which is not causing BAR to be cleared)\n>\n> In the above scenario, the SoC ROM sends 0x000000 address to read SPL.\n> Unfortunately, the BA24 bit is still set and hence it receives content\n> from 0x1000000 memory address.\n> As a result the SoC aborts and we hang. Only power cycle can take the\n> SoC out of this state.\n>\n> How to reproduce/test:\n>\n> sf probe; sf erase 0x1200000 0x800000; reset\n> sf probe; sf erase 0x1200000 0x800000; sf write 0x11000000 0x1200000 0x800000; reset\n> sf probe; sf read 0x11000000 0x1200000 0x800000; reset\n>\n> Signed-off-by: Lukasz Majewski <lukma@denx.de>\n> ---\n>  drivers/mtd/spi/spi_flash.c | 33 +++++++++++++++++++++++++++++++++\n>  1 file changed, 33 insertions(+)\n>\n> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c\n> index 34f6888..d19d64a 100644\n> --- a/drivers/mtd/spi/spi_flash.c\n> +++ b/drivers/mtd/spi/spi_flash.c\n> @@ -113,6 +113,27 @@ static int write_cr(struct spi_flash *flash, u8 wc)\n>  #endif\n>\n>  #ifdef CONFIG_SPI_FLASH_BAR\n> +/*\n> + * This \"cleanup\" is necessary in a situation when one was accessing\n> + * spi flash memory > 16 MiB by using Bank Address Register's BA24 bit.\n> + *\n> + * After it the BA24 bit shall be cleared to allow access to correct\n> + * memory region after SW reset (by calling \"reset\" command).\n> + *\n> + * Otherwise, the BA24 bit may be left set and then after reset, the\n> + * ROM would seek for SPL from 0x1000000, not 0x0.\n\nThis need to change, SPL will look 16 MiB * bank_sel\n\n> + */\n> +static int cleanup_bar(struct spi_flash *flash)\n\nwhat about clear_bar?\n\nthanks!","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=\"DxgDJm3X\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y10J35JF6z9tXF\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 20:12:19 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 77729C220CC; Mon, 25 Sep 2017 10:10:50 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 0B31FC22147;\n\tMon, 25 Sep 2017 10:10:48 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid D2699C221D0; Mon, 25 Sep 2017 10:09:27 +0000 (UTC)","from mail-wr0-f196.google.com (mail-wr0-f196.google.com\n\t[209.85.128.196])\n\tby lists.denx.de (Postfix) with ESMTPS id 6300EC221A9\n\tfor <u-boot@lists.denx.de>; Mon, 25 Sep 2017 10:09:27 +0000 (UTC)","by mail-wr0-f196.google.com with SMTP id g50so1698778wra.3\n\tfor <u-boot@lists.denx.de>; Mon, 25 Sep 2017 03:09:27 -0700 (PDT)","by 10.25.26.139 with HTTP; Mon, 25 Sep 2017 03:09:26 -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=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=Svzfs4fsnA9Fk480ItcIzkM3DA5NJqLmI08VaxP2llI=;\n\tb=DxgDJm3XeqyntQPSbjXFl+Rdz5HrvN+m0Qc9PLkB3VLIt+aCAwflrz+tb54go6Ui4U\n\tyaFwCvsp7+YraFbmqdlqAOT5QTlZjY9Pw6ST6Q14/4XhyZ0mniOqGU/aHPuQV5H+v+lD\n\taBSa5Jp2mnX/taS3jyHpuUSIIOaTHoetUE1115hP1EXT/yZ9SRF1iZM38OkF2FDnfpcS\n\t3H4WEmrINAVpVxxRuGZNe/SxqdSc1yzKJVUhyehKLC5sINOJiuCrYprIufcbcvKIAafz\n\tTHuzPm8zPy6QIAFMJgskG2dcYB1W55Y1MGTbTVeoB2++u5Di91K2jPMIVSbnVwxokFAE\n\tdyrw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=Svzfs4fsnA9Fk480ItcIzkM3DA5NJqLmI08VaxP2llI=;\n\tb=WzTNiDFs5Q3/lBZ5Cf2+7jl1lUMO59X0Fi9EzftcouKQJiLg/SoN2h75CwbeKMNohE\n\tj0vfjCCMzgV9uAMsX1EdNG0ZB9CM1AiDX2iOUwbyfuVGoBxjsqLHC3XTShbDyMWig/dG\n\ts20100cjw3IQgtld8ep6GhMJY4gribXHtsSFcELYnp1c/zE8NSXAjuoW3aFjl9q8Y9qR\n\tO2uvs8KAhd2CBdyGuvvcamjlj8RB/FYnV1bwIp+L6XJ3F4roRGBxxpC9caoRIfDoaaZn\n\tY4vTAYSH6UUNHVL4FzqS3Mzm75VGV0szBDwwf5uiYs45SAa9+srT0ZPfBurGHsA6jTtY\n\t9FLQ==","X-Gm-Message-State":"AHPjjUhO0EcGEeOvZmEIDd4+aSLaP0IVefh2rSmOARquWUADwpoCjW51\n\tAdddrBWcVuZyvYPzQN8vRGgNzUXJXe2LhQ8Ff10=","X-Google-Smtp-Source":"AOwi7QBQPBb8z9XSI0HkoHEDWkNeCbirk8T0YpjN/ehPfUXTu2JkD0yiV6mw9jpHTj32aumYYIvaBtcya4Ka85MT/y0=","X-Received":"by 10.46.3.1 with SMTP id 1mr2528255ljd.147.1506334166862;\n\tMon, 25 Sep 2017 03:09:26 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1505295574-14294-1-git-send-email-lukma@denx.de>","References":"<1505295574-14294-1-git-send-email-lukma@denx.de>","From":"Jagan Teki <jagannadh.teki@gmail.com>","Date":"Mon, 25 Sep 2017 15:39:26 +0530","Message-ID":"<CAD6G_RRgOw_z=Sw_c32UYyScoAK55V1cL0B3ygF=1ApKSRm=UA@mail.gmail.com>","To":"Lukasz Majewski <lukma@denx.de>","Cc":"Fabio Estevam <fabio.estevam@nxp.com>,\n\t\"u-boot@lists.denx.de\" <u-boot@lists.denx.de>,\n\tJagan Teki <jagan@openedev.com>","Subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","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>","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>"}},{"id":1774629,"web_url":"http://patchwork.ozlabs.org/comment/1774629/","msgid":"<3500ca82-b856-6fd6-6dbb-72f02b25a48e@denx.de>","list_archive_url":null,"date":"2017-09-25T10:23:18","subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","submitter":{"id":70701,"url":"http://patchwork.ozlabs.org/api/people/70701/","name":"Lukasz Majewski","email":"lukma@denx.de"},"content":"Hi Jagan,\n\n> On Wed, Sep 13, 2017 at 3:09 PM, Lukasz Majewski <lukma@denx.de> wrote:\n>> The content of Bank Address Register (BAR) is volatile. It is cleared\n>> after power cycle or reset command (RESET F0h).\n>>\n>> Some memories (like e.g. s25fl256s) use it to access memory larger than\n>> 0x1000000 (16 MiB).\n>>\n>> The problem shows up when one:\n>>\n>> 1. Reads/writes/erases memory > 16 MiB\n>> 2. Calls \"reset\" u-boot command (which is not causing BAR to be cleared)\n>>\n>> In the above scenario, the SoC ROM sends 0x000000 address to read SPL.\n>> Unfortunately, the BA24 bit is still set and hence it receives content\n>> from 0x1000000 memory address.\n>> As a result the SoC aborts and we hang. Only power cycle can take the\n>> SoC out of this state.\n>>\n>> How to reproduce/test:\n>>\n>> sf probe; sf erase 0x1200000 0x800000; reset\n>> sf probe; sf erase 0x1200000 0x800000; sf write 0x11000000 0x1200000 0x800000; reset\n>> sf probe; sf read 0x11000000 0x1200000 0x800000; reset\n>>\n>> Signed-off-by: Lukasz Majewski <lukma@denx.de>\n>> ---\n>>   drivers/mtd/spi/spi_flash.c | 33 +++++++++++++++++++++++++++++++++\n>>   1 file changed, 33 insertions(+)\n>>\n>> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c\n>> index 34f6888..d19d64a 100644\n>> --- a/drivers/mtd/spi/spi_flash.c\n>> +++ b/drivers/mtd/spi/spi_flash.c\n>> @@ -113,6 +113,27 @@ static int write_cr(struct spi_flash *flash, u8 wc)\n>>   #endif\n>>\n>>   #ifdef CONFIG_SPI_FLASH_BAR\n>> +/*\n>> + * This \"cleanup\" is necessary in a situation when one was accessing\n>> + * spi flash memory > 16 MiB by using Bank Address Register's BA24 bit.\n>> + *\n>> + * After it the BA24 bit shall be cleared to allow access to correct\n>> + * memory region after SW reset (by calling \"reset\" command).\n>> + *\n>> + * Otherwise, the BA24 bit may be left set and then after reset, the\n>> + * ROM would seek for SPL from 0x1000000, not 0x0.\n> \n> This need to change, SPL will look 16 MiB * bank_sel\n\nOk. I will update the description.\n\n> \n>> + */\n>> +static int cleanup_bar(struct spi_flash *flash)\n> \n> what about clear_bar?\n\nOk. I will change the name.\n\n> \n> thanks!\n>","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>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y10Y200Y7z9tX3\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 20:23:33 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid BA86AC21DA6; Mon, 25 Sep 2017 10:23:25 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 0A0DEC2207F;\n\tMon, 25 Sep 2017 10:23:23 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 04889C2207F; Mon, 25 Sep 2017 10:23:21 +0000 (UTC)","from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9])\n\tby lists.denx.de (Postfix) with ESMTPS id 8A8E4C21DA6\n\tfor <u-boot@lists.denx.de>; Mon, 25 Sep 2017 10:23:21 +0000 (UTC)","from frontend01.mail.m-online.net (unknown [192.168.8.182])\n\tby mail-out.m-online.net (Postfix) with ESMTP id 3y10Xm6HXJz1qskc;\n\tMon, 25 Sep 2017 12:23:20 +0200 (CEST)","from localhost (dynscan1.mnet-online.de [192.168.6.70])\n\tby mail.m-online.net (Postfix) with ESMTP id 3y10Xm5ljlz1qqkM;\n\tMon, 25 Sep 2017 12:23:20 +0200 (CEST)","from mail.mnet-online.de ([192.168.8.182])\n\tby localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new,\n\tport 10024)\n\twith ESMTP id UmfF2atZiyYu; Mon, 25 Sep 2017 12:23:19 +0200 (CEST)","from [192.168.2.222] (89-64-27-66.dynamic.chello.pl [89.64.27.66])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby mail.mnet-online.de (Postfix) with ESMTPSA;\n\tMon, 25 Sep 2017 12:23:19 +0200 (CEST)"],"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=RCVD_IN_DNSWL_LOW,\n\tRCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","X-Virus-Scanned":"amavisd-new at mnet-online.de","X-Auth-Info":"ySvPvHi6gKOtIJo+7YFKskXpde5GnZVZGDQ9A4ZCotY=","To":"Jagan Teki <jagannadh.teki@gmail.com>","References":"<1505295574-14294-1-git-send-email-lukma@denx.de>\n\t<CAD6G_RRgOw_z=Sw_c32UYyScoAK55V1cL0B3ygF=1ApKSRm=UA@mail.gmail.com>","From":"=?utf-8?q?=C5=81ukasz_Majewski?= <lukma@denx.de>","Organization":"DENX","Message-ID":"<3500ca82-b856-6fd6-6dbb-72f02b25a48e@denx.de>","Date":"Mon, 25 Sep 2017 12:23:18 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<CAD6G_RRgOw_z=Sw_c32UYyScoAK55V1cL0B3ygF=1ApKSRm=UA@mail.gmail.com>","Content-Language":"en-US","Cc":"Fabio Estevam <fabio.estevam@nxp.com>,\n\t\"u-boot@lists.denx.de\" <u-boot@lists.denx.de>,\n\tJagan Teki <jagan@openedev.com>","Subject":"Re: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit\n\tafter read/write/erase operation","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>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]