[{"id":1760202,"web_url":"http://patchwork.ozlabs.org/comment/1760202/","msgid":"<CAD6G_RSh5qt0TZCXDM0RqNvSZjfqcwnOMubpYfCqW6DfvxqF7g@mail.gmail.com>","list_archive_url":null,"date":"2017-08-30T14:24:13","subject":"Re: [U-Boot] [PATCH v3] spi: fsl_qspi: Add controller busy check\n\tbefore new spi operation","submitter":{"id":20045,"url":"http://patchwork.ozlabs.org/api/people/20045/","name":"Jagan Teki","email":"jagannadh.teki@gmail.com"},"content":"On Wed, Aug 30, 2017 at 2:00 PM, Suresh Gupta <suresh.gupta@nxp.com> wrote:\n> It is recommended to check either controller is free to take\n> new spi action. The IP_ACC and AHB_ACC bits indicates that\n> the controller is busy in IP or AHB mode respectively.\n> And the BUSY bit indicates that controller is currently\n> busy handling a transaction to an external flash device\n>\n> Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>\n> ---\n> Chnages in v3:\n>  - replace printf to debug\n>  - return whatever return from wait_for_bit, before it was -EBUSY\n>\n> Changes in v2:\n>\n>  - Add wait_for_bit instead of while\n>  - move the busy check code to fsl_qspi_claim_bus form qspi_xfer\n>\n>\n>  drivers/spi/fsl_qspi.c | 28 +++++++++++++++++++++++++++-\n>  drivers/spi/fsl_qspi.h |  4 ++++\n>  2 files changed, 31 insertions(+), 1 deletion(-)\n>\n> diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c\n> index 1dfa89a..8f0f29e 100644\n> --- a/drivers/spi/fsl_qspi.c\n> +++ b/drivers/spi/fsl_qspi.c\n> @@ -14,6 +14,7 @@\n>  #include <dm.h>\n>  #include <errno.h>\n>  #include <watchdog.h>\n> +#include <wait_bit.h>\n>  #include \"fsl_qspi.h\"\n>\n>  DECLARE_GLOBAL_DATA_PTR;\n> @@ -991,7 +992,7 @@ static int fsl_qspi_probe(struct udevice *bus)\n>         struct fsl_qspi_platdata *plat = dev_get_platdata(bus);\n>         struct fsl_qspi_priv *priv = dev_get_priv(bus);\n>         struct dm_spi_bus *dm_spi_bus;\n> -       int i;\n> +       int i, ret;\n>\n>         dm_spi_bus = bus->uclass_priv;\n>\n> @@ -1011,6 +1012,18 @@ static int fsl_qspi_probe(struct udevice *bus)\n>         priv->flash_num = plat->flash_num;\n>         priv->num_chipselect = plat->num_chipselect;\n>\n> +       /* make sure controller is not busy anywhere */\n> +       ret = wait_for_bit(__func__, &priv->regs->sr,\n> +                          QSPI_SR_BUSY_MASK |\n> +                          QSPI_SR_AHB_ACC_MASK |\n> +                          QSPI_SR_IP_ACC_MASK,\n> +                          false, 1000, false);\n\n100ms not enough?\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=\"ZX3BoIvP\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xj7745m2tz9s7f\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 00:24:31 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 15F08C228FB; Wed, 30 Aug 2017 14:24:20 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 69301C228D8;\n\tWed, 30 Aug 2017 14:24:17 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 9EF80C228B6; Wed, 30 Aug 2017 14:24:15 +0000 (UTC)","from mail-lf0-f67.google.com (mail-lf0-f67.google.com\n\t[209.85.215.67])\n\tby lists.denx.de (Postfix) with ESMTPS id E6A43C228A2\n\tfor <u-boot@lists.denx.de>; Wed, 30 Aug 2017 14:24:14 +0000 (UTC)","by mail-lf0-f67.google.com with SMTP id g77so4004824lfg.4\n\tfor <u-boot@lists.denx.de>; Wed, 30 Aug 2017 07:24:14 -0700 (PDT)","by 10.25.222.200 with HTTP; Wed, 30 Aug 2017 07:24: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_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_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=zjI7hAss7Fk/jQaQ8Nh6ezmwaJUWDw473sN4fnV+e8E=;\n\tb=ZX3BoIvPIHd99m8DD5XS2cBXUzO3xbEWGpPeamZqsQ+5i8/dSD1h1AqgEp8kfUSbEz\n\ta5Q96gWE1cBE6jzuFgN6Om8igIy4PGWBDpp7UkmD2IyWQx6vlSv5gLcOFFQ8z7aYBLiI\n\t1zYDy7/g/z2teWP/aMw6SB9P2NHFEhhJjuS+Gof9FNyjc7jzxM19QbuHoBUf1IpvW3a3\n\tQe0+zjXk2yP0o7lLjLi162Vzp0pR/APmKWFWp9U5IY02/3egAkNxg7mPHlW5XfXjoiLr\n\txAftrcKJmXKqFDdthEORxCGhzjcVlI5OUnrdAUw6KAd5ozFxIA1n+/btgI00rwAVmR83\n\tLebw==","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=zjI7hAss7Fk/jQaQ8Nh6ezmwaJUWDw473sN4fnV+e8E=;\n\tb=A6ZPN0CLEMOIdpR7lefzwD901uPRSuAKI7OB+VKkgYMTGyLLbAmIf35HHvPMULmPew\n\tc4waCzExmPE8NxrLwB7/CxbjHV7zX8JgAR71qq9lJcu5asAndXUkutNkRDHXbGJ5Nzw4\n\tYO58cc7paBSPXl62YHJkWlylCqjvQB3jimyCW6UDONsli5SaKi/iRNA9evA6wz735e1e\n\t4xKdH+sbncSryTk+BuS5CepAe1gdPxC//JGBeCKl4v7rSjCKHHSFOjXcx6Zt/2AyQUK2\n\t5eHkNZEzQLbo8POjY74zif4hmhGXrwGSf5hpq7aa6HPFdnusgSN9YdSI7Dp7KhJlgEAu\n\tfeEw==","X-Gm-Message-State":"AHPjjUjz3863YWQltdYyGfgMXZYYvMlpSt5ig8aebm+sQWWXkuXX23sz\n\txcCfgWz+4W5wGiPLtrk6j5RzUjdbFw==","X-Received":"by 10.25.40.78 with SMTP id o75mr776487lfo.127.1504103054338;\n\tWed, 30 Aug 2017 07:24:14 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1504081806-16877-1-git-send-email-suresh.gupta@nxp.com>","References":"<1504081806-16877-1-git-send-email-suresh.gupta@nxp.com>","From":"Jagan Teki <jagannadh.teki@gmail.com>","Date":"Wed, 30 Aug 2017 19:54:13 +0530","Message-ID":"<CAD6G_RSh5qt0TZCXDM0RqNvSZjfqcwnOMubpYfCqW6DfvxqF7g@mail.gmail.com>","To":"Suresh Gupta <suresh.gupta@nxp.com>","Cc":"\"u-boot@lists.denx.de\" <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH v3] spi: fsl_qspi: Add controller busy check\n\tbefore new spi 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":1760209,"web_url":"http://patchwork.ozlabs.org/comment/1760209/","msgid":"<DB5PR04MB1350A1CE00CE0C49536F148E809C0@DB5PR04MB1350.eurprd04.prod.outlook.com>","list_archive_url":null,"date":"2017-08-30T14:31:10","subject":"Re: [U-Boot] [PATCH v3] spi: fsl_qspi: Add controller busy check\n\tbefore new spi operation","submitter":{"id":70239,"url":"http://patchwork.ozlabs.org/api/people/70239/","name":"Suresh Gupta","email":"suresh.gupta@nxp.com"},"content":"> -----Original Message-----\r\n> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]\r\n> Sent: Wednesday, August 30, 2017 7:54 PM\r\n> To: Suresh Gupta <suresh.gupta@nxp.com>\r\n> Cc: u-boot@lists.denx.de; York Sun <york.sun@nxp.com>\r\n> Subject: Re: [PATCH v3] spi: fsl_qspi: Add controller busy check before new spi\r\n> operation\r\n> \r\n> On Wed, Aug 30, 2017 at 2:00 PM, Suresh Gupta <suresh.gupta@nxp.com>\r\n> wrote:\r\n> > It is recommended to check either controller is free to take new spi\r\n> > action. The IP_ACC and AHB_ACC bits indicates that the controller is\r\n> > busy in IP or AHB mode respectively.\r\n> > And the BUSY bit indicates that controller is currently busy handling\r\n> > a transaction to an external flash device\r\n> >\r\n> > Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>\r\n> > ---\r\n> > Chnages in v3:\r\n> >  - replace printf to debug\r\n> >  - return whatever return from wait_for_bit, before it was -EBUSY\r\n> >\r\n> > Changes in v2:\r\n> >\r\n> >  - Add wait_for_bit instead of while\r\n> >  - move the busy check code to fsl_qspi_claim_bus form qspi_xfer\r\n> >\r\n> >\r\n> >  drivers/spi/fsl_qspi.c | 28 +++++++++++++++++++++++++++-\r\n> > drivers/spi/fsl_qspi.h |  4 ++++\r\n> >  2 files changed, 31 insertions(+), 1 deletion(-)\r\n> >\r\n> > diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c index\r\n> > 1dfa89a..8f0f29e 100644\r\n> > --- a/drivers/spi/fsl_qspi.c\r\n> > +++ b/drivers/spi/fsl_qspi.c\r\n> > @@ -14,6 +14,7 @@\r\n> >  #include <dm.h>\r\n> >  #include <errno.h>\r\n> >  #include <watchdog.h>\r\n> > +#include <wait_bit.h>\r\n> >  #include \"fsl_qspi.h\"\r\n> >\r\n> >  DECLARE_GLOBAL_DATA_PTR;\r\n> > @@ -991,7 +992,7 @@ static int fsl_qspi_probe(struct udevice *bus)\r\n> >         struct fsl_qspi_platdata *plat = dev_get_platdata(bus);\r\n> >         struct fsl_qspi_priv *priv = dev_get_priv(bus);\r\n> >         struct dm_spi_bus *dm_spi_bus;\r\n> > -       int i;\r\n> > +       int i, ret;\r\n> >\r\n> >         dm_spi_bus = bus->uclass_priv;\r\n> >\r\n> > @@ -1011,6 +1012,18 @@ static int fsl_qspi_probe(struct udevice *bus)\r\n> >         priv->flash_num = plat->flash_num;\r\n> >         priv->num_chipselect = plat->num_chipselect;\r\n> >\r\n> > +       /* make sure controller is not busy anywhere */\r\n> > +       ret = wait_for_bit(__func__, &priv->regs->sr,\r\n> > +                          QSPI_SR_BUSY_MASK |\r\n> > +                          QSPI_SR_AHB_ACC_MASK |\r\n> > +                          QSPI_SR_IP_ACC_MASK,\r\n> > +                          false, 1000, false);\r\n> \r\n> 100ms not enough?\r\nIt should be, Will send new patch\r\n\r\n\r\n> \r\n> thanks!\r\n> --\r\n> Jagan Teki\r\n> Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream\r\n> Maintainer Hyderabad, India.","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\" (1024-bit key;\n\tunprotected) header.d=nxp.com header.i=@nxp.com header.b=\"H0Au/lmq\";\n\tdkim-atps=neutral","spf=none (sender IP is )\n\tsmtp.mailfrom=suresh.gupta@nxp.com; "],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xj7Gw2wCLz9s8J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 00:31:20 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid A6978C21EA9; Wed, 30 Aug 2017 14:31:17 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 44B92C21EA9;\n\tWed, 30 Aug 2017 14:31:15 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid B83B8C21E4D; Wed, 30 Aug 2017 14:31:13 +0000 (UTC)","from EUR01-HE1-obe.outbound.protection.outlook.com\n\t(mail-he1eur01on0040.outbound.protection.outlook.com [104.47.0.40])\n\tby lists.denx.de (Postfix) with ESMTPS id D43CDC21EA9\n\tfor <u-boot@lists.denx.de>; Wed, 30 Aug 2017 14:31:12 +0000 (UTC)","from DB5PR04MB1350.eurprd04.prod.outlook.com (10.162.220.156) by\n\tDB5PR04MB1381.eurprd04.prod.outlook.com (10.162.221.15) with\n\tMicrosoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id\n\t15.1.1385.9; Wed, 30 Aug 2017 14:31:11 +0000","from DB5PR04MB1350.eurprd04.prod.outlook.com\n\t([fe80::7175:9fbf:f392:a88f]) by\n\tDB5PR04MB1350.eurprd04.prod.outlook.com\n\t([fe80::7175:9fbf:f392:a88f%13]) with mapi id 15.01.1385.014;\n\tWed, 30 Aug 2017 14:31:11 +0000"],"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=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,T_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version;\n\tbh=WfLPP9k2f2lumx3YPgnF0JWRSED0Lb0Mt+lLuXBb/9k=;\n\tb=H0Au/lmqF06xNap7cZolytlrU/Duid6wmzKTpnMaTrXmvMxQ7Yj9xqnQm8y0+pQeOl0EX9f1BHQaaXTdmZkMKD8CLsIU6ouPK2WPI6oqDOmr/tM4hA/WxVRXBRU1Kz0KDrESubvSCK9dRXivn36jvLR0Wptkm6K2K8g8Om+Rm1g=","From":"Suresh Gupta <suresh.gupta@nxp.com>","To":"Jagan Teki <jagannadh.teki@gmail.com>","Thread-Topic":"[PATCH v3] spi: fsl_qspi: Add controller busy check before new\n\tspi operation","Thread-Index":"AQHTIWocUCtWtDx92EKstr3M0O9YWKKc9HmAgAABDIA=","Date":"Wed, 30 Aug 2017 14:31:10 +0000","Message-ID":"<DB5PR04MB1350A1CE00CE0C49536F148E809C0@DB5PR04MB1350.eurprd04.prod.outlook.com>","References":"<1504081806-16877-1-git-send-email-suresh.gupta@nxp.com>\n\t<CAD6G_RSh5qt0TZCXDM0RqNvSZjfqcwnOMubpYfCqW6DfvxqF7g@mail.gmail.com>","In-Reply-To":"<CAD6G_RSh5qt0TZCXDM0RqNvSZjfqcwnOMubpYfCqW6DfvxqF7g@mail.gmail.com>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","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\" (1024-bit key;\n\tunprotected) header.d=nxp.com header.i=@nxp.com header.b=\"H0Au/lmq\";\n\tdkim-atps=neutral","spf=none (sender IP is )\n\tsmtp.mailfrom=suresh.gupta@nxp.com; "],"x-originating-ip":"[192.88.169.1]","x-ms-publictraffictype":"Email","x-microsoft-exchange-diagnostics":"1; DB5PR04MB1381;\n\t6:0r6bJMdDcSu6A82ua3D5XdE8AcPQd7kl69KTogNs+4l0MWuUeBBRlHL6BjHQHH9r7TasF8Hv/ePXdaUfYZsSLDrnIt7j/yVVlBoC+wuDmMc4EOuuVKL5G1U8vSfEaDuaBl8/8kV/hVr+3ukvWrJwpd5cGaolaJfW037an1/QsNgkBx+V9lHuQtAZIXMs8N6JhpzmdxsG/kXXc9HJLAMy9v8VuVNwMeDPp9s154oKFWxA4+m6Axqm7t0yYsFr3CuStNmrLtSelsc9DcuklI7XXhAl/HBZc6/Y+ElRTAQyI0GPdDD6MmRAswJQ0ZrNepsIHmfsB/X2JzdpuIfuoIjRng==;\n\t5:LxpmTkY/iaJyU6FtbBdBeQWoNdZxa5BedEncybmz6LlsMQeKyKpP5PETDFOLdzdMdy5kx6vzLqROlcc8ogiu0BtyBah8/YYOx5NwxNg4/x3kimtn6xgFPgcaXiNkIr9vQa0tHXr2oSTZKV9ZZmB/Pw==;\n\t24:AFcJaUkfavnMQNmp6GuXgpFFKEC06GQlSsSEolRo7fIeOUBCmuvSD3SjQcsDzpNn4r2BkQRYIVYl1VDGO/5hT7u6w2e0SzWmzWtNRj9RJ9A=;\n\t7:DnrUT2AgbpQhCznJCpzTAT0yvxhQuZg+hEaUK960KfYbA9kpn4HsewKCeS+SA/MJntZ6ieADbPQ0eHYKPNxu6fwByPFfTDH/dc9b/3ZHZ83zgAWvRd2vWyUi1H760wrgUmKvg+G9b76+jaOdWKwozhYsT0ceGZSvuFWh++CUyW++MGPk5NWdyPL0Iv0GAVaeeNLgTwBhcZbB/4mRdPFt6OvlxzBbGxKtjBsFAEJovNw=","x-ms-exchange-antispam-srfa-diagnostics":"SSOS;SSOR;","x-forefront-antispam-report":"SFV:SKI; SCL:-1; SFV:NSPM;\n\tSFS:(10009020)(6009001)(39860400002)(13464003)(24454002)(189002)(199003)(377454003)(575784001)(81156014)(6506006)(189998001)(101416001)(4326008)(551934003)(50986999)(53546010)(33656002)(76176999)(54356999)(74316002)(53936002)(102836003)(6246003)(3846002)(39060400002)(3280700002)(105586002)(2906002)(106356001)(5250100002)(66066001)(110136004)(6116002)(99286003)(25786009)(55016002)(68736007)(6436002)(54906002)(478600001)(8936002)(9686003)(8676002)(2900100001)(7736002)(81166006)(305945005)(229853002)(97736004)(7696004)(6916009)(14454004)(2950100002)(86362001)(5660300001)(15974865002)(3660700001)(2004002);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR04MB1381;\n\tH:DB5PR04MB1350.eurprd04.prod.outlook.com; FPR:; SPF:None;\n\tPTR:InfoNoRecords; MX:1; A:1; LANG:en; ","x-ms-office365-filtering-correlation-id":"959a7265-9e10-4008-d30b-08d4efb3c2b6","x-ms-office365-filtering-ht":"Tenant","x-microsoft-antispam":"UriScan:; BCL:0; PCL:0;\n\tRULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);\n\tSRVR:DB5PR04MB1381; ","x-ms-traffictypediagnostic":"DB5PR04MB1381:","x-exchange-antispam-report-test":"UriScan:(185117386973197)(788757137089)(16074681357397); ","x-microsoft-antispam-prvs":"<DB5PR04MB13818D0521F6E8D3C88F532A809C0@DB5PR04MB1381.eurprd04.prod.outlook.com>","x-exchange-antispam-report-cfa-test":"BCL:0; PCL:0;\n\tRULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(100000703101)(100105400095)(6055026)(6041248)(20161123555025)(20161123558100)(20161123562025)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);\n\tSRVR:DB5PR04MB1381; BCL:0; PCL:0;\n\tRULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);\n\tSRVR:DB5PR04MB1381; ","x-forefront-prvs":"041517DFAB","received-spf":"None (protection.outlook.com: nxp.com does not designate\n\tpermitted sender hosts)","spamdiagnosticoutput":"1:99","spamdiagnosticmetadata":"NSPM","MIME-Version":"1.0","X-OriginatorOrg":"nxp.com","X-MS-Exchange-CrossTenant-originalarrivaltime":"30 Aug 2017 14:31:11.0090\n\t(UTC)","X-MS-Exchange-CrossTenant-fromentityheader":"Hosted","X-MS-Exchange-CrossTenant-id":"686ea1d3-bc2b-4c6f-a92c-d99c5c301635","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"DB5PR04MB1381","Cc":"\"u-boot@lists.denx.de\" <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH v3] spi: fsl_qspi: Add controller busy check\n\tbefore new spi 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":1760211,"web_url":"http://patchwork.ozlabs.org/comment/1760211/","msgid":"<CAD6G_RR_vHdmwhygbKJYQSEqn=vYWQHQgMFY6QJvsgr-Y1J3KQ@mail.gmail.com>","list_archive_url":null,"date":"2017-08-30T14:32:35","subject":"Re: [U-Boot] [PATCH v3] spi: fsl_qspi: Add controller busy check\n\tbefore new spi operation","submitter":{"id":20045,"url":"http://patchwork.ozlabs.org/api/people/20045/","name":"Jagan Teki","email":"jagannadh.teki@gmail.com"},"content":"On Wed, Aug 30, 2017 at 8:01 PM, Suresh Gupta <suresh.gupta@nxp.com> wrote:\n>\n>\n>> -----Original Message-----\n>> From: Jagan Teki [mailto:jagannadh.teki@gmail.com]\n>> Sent: Wednesday, August 30, 2017 7:54 PM\n>> To: Suresh Gupta <suresh.gupta@nxp.com>\n>> Cc: u-boot@lists.denx.de; York Sun <york.sun@nxp.com>\n>> Subject: Re: [PATCH v3] spi: fsl_qspi: Add controller busy check before new spi\n>> operation\n>>\n>> On Wed, Aug 30, 2017 at 2:00 PM, Suresh Gupta <suresh.gupta@nxp.com>\n>> wrote:\n>> > It is recommended to check either controller is free to take new spi\n>> > action. The IP_ACC and AHB_ACC bits indicates that the controller is\n>> > busy in IP or AHB mode respectively.\n>> > And the BUSY bit indicates that controller is currently busy handling\n>> > a transaction to an external flash device\n>> >\n>> > Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>\n>> > ---\n>> > Chnages in v3:\n>> >  - replace printf to debug\n>> >  - return whatever return from wait_for_bit, before it was -EBUSY\n>> >\n>> > Changes in v2:\n>> >\n>> >  - Add wait_for_bit instead of while\n>> >  - move the busy check code to fsl_qspi_claim_bus form qspi_xfer\n>> >\n>> >\n>> >  drivers/spi/fsl_qspi.c | 28 +++++++++++++++++++++++++++-\n>> > drivers/spi/fsl_qspi.h |  4 ++++\n>> >  2 files changed, 31 insertions(+), 1 deletion(-)\n>> >\n>> > diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c index\n>> > 1dfa89a..8f0f29e 100644\n>> > --- a/drivers/spi/fsl_qspi.c\n>> > +++ b/drivers/spi/fsl_qspi.c\n>> > @@ -14,6 +14,7 @@\n>> >  #include <dm.h>\n>> >  #include <errno.h>\n>> >  #include <watchdog.h>\n>> > +#include <wait_bit.h>\n>> >  #include \"fsl_qspi.h\"\n>> >\n>> >  DECLARE_GLOBAL_DATA_PTR;\n>> > @@ -991,7 +992,7 @@ static int fsl_qspi_probe(struct udevice *bus)\n>> >         struct fsl_qspi_platdata *plat = dev_get_platdata(bus);\n>> >         struct fsl_qspi_priv *priv = dev_get_priv(bus);\n>> >         struct dm_spi_bus *dm_spi_bus;\n>> > -       int i;\n>> > +       int i, ret;\n>> >\n>> >         dm_spi_bus = bus->uclass_priv;\n>> >\n>> > @@ -1011,6 +1012,18 @@ static int fsl_qspi_probe(struct udevice *bus)\n>> >         priv->flash_num = plat->flash_num;\n>> >         priv->num_chipselect = plat->num_chipselect;\n>> >\n>> > +       /* make sure controller is not busy anywhere */\n>> > +       ret = wait_for_bit(__func__, &priv->regs->sr,\n>> > +                          QSPI_SR_BUSY_MASK |\n>> > +                          QSPI_SR_AHB_ACC_MASK |\n>> > +                          QSPI_SR_IP_ACC_MASK,\n>> > +                          false, 1000, false);\n>>\n>> 100ms not enough?\n> It should be, Will send new patch\n\nIt's fine, if you're OK I will change it while applying.\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=\"nVbPiYJF\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xj7Jb0YFwz9s8P\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 00:32:47 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid BBF60C21EA9; Wed, 30 Aug 2017 14:32:40 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 555D7C22850;\n\tWed, 30 Aug 2017 14:32:38 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 42147C22821; Wed, 30 Aug 2017 14:32:37 +0000 (UTC)","from mail-lf0-f66.google.com (mail-lf0-f66.google.com\n\t[209.85.215.66])\n\tby lists.denx.de (Postfix) with ESMTPS id DF195C21EA9\n\tfor <u-boot@lists.denx.de>; Wed, 30 Aug 2017 14:32:36 +0000 (UTC)","by mail-lf0-f66.google.com with SMTP id z12so2559803lfd.5\n\tfor <u-boot@lists.denx.de>; Wed, 30 Aug 2017 07:32:36 -0700 (PDT)","by 10.25.222.200 with HTTP; Wed, 30 Aug 2017 07:32:35 -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_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_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=5nGLouhoRQBNHqDOioyIkR5f+YngJMPWbpU4FsOiGww=;\n\tb=nVbPiYJF9lR3w4Oe6u8TcpM03oCwv4l2eN4GY6m4TMX3nCIr1sQNwlW5d8Wp4rartN\n\tVpRZbN6bfqAxM+D//4x0yuxgAYvURN7HzCEGetvMUytSvLmQ9fOfw5ohlCyv+khNAip+\n\tFuBkefl4ILh4UIK41NAMByvRrXDcrMOCE2FN1ErQ8oD1wVp9xnjkDGDq1xQypMZaq1c4\n\tYVmTfdFE3wgbnmiwuEcLZqsrGvPsFttWIndMQKNi9KnGh3D5cl59FML6zi+9Fo+6LNvi\n\tVeIAKDHLEYn7bR7EMiGkP0E7tp/OxV2cvOWUgENcXXGCVmUBe8bMMR5E04u/x42jjA8O\n\t3nNg==","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=5nGLouhoRQBNHqDOioyIkR5f+YngJMPWbpU4FsOiGww=;\n\tb=rRXWgfL4Z3IuOrNU/bLUtmRftR1ksXl6w0FLjnQ1WAW+MGxgGW34fE6NbxHyvd/LSq\n\tKJFWXoQibAouJvMksk/od9FCIaEEGsg9UHoPOgODa+4rxbGIh2nGCBOO2hRfWz4lTUD2\n\tPAJu1pVc4QbGlBk9Mv8oBwMJPO9wxghQYiv/FHoW1dEGQgiHYrl+6nqL2OFn4Hqdaj5O\n\tOpyMGOuXMpR1ur/ZHqSRBI67pH2Qod9mcFU0DgmkFJOzYLFs3VCYjUTqpyljAo1jXfyo\n\tyLHPc82NabgCcRs3hbbjUwmZ7mtLACDao0pCYf80z+c9YZZSVkJTGL/dkk7XAj4Tl5YA\n\txblA==","X-Gm-Message-State":"AHYfb5ifgYLdBG2oI3vjIiPzlIAIENyifG+eZw/SCjf9pGHiwM/YsH8H\n\t8hYqZhkeZ6NRqWT883U8ufLdBJGBUQ==","X-Received":"by 10.46.69.7 with SMTP id s7mr885376lja.36.1504103556311;\n\tWed, 30 Aug 2017 07:32:36 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<DB5PR04MB1350A1CE00CE0C49536F148E809C0@DB5PR04MB1350.eurprd04.prod.outlook.com>","References":"<1504081806-16877-1-git-send-email-suresh.gupta@nxp.com>\n\t<CAD6G_RSh5qt0TZCXDM0RqNvSZjfqcwnOMubpYfCqW6DfvxqF7g@mail.gmail.com>\n\t<DB5PR04MB1350A1CE00CE0C49536F148E809C0@DB5PR04MB1350.eurprd04.prod.outlook.com>","From":"Jagan Teki <jagannadh.teki@gmail.com>","Date":"Wed, 30 Aug 2017 20:02:35 +0530","Message-ID":"<CAD6G_RR_vHdmwhygbKJYQSEqn=vYWQHQgMFY6QJvsgr-Y1J3KQ@mail.gmail.com>","To":"Suresh Gupta <suresh.gupta@nxp.com>","Cc":"\"u-boot@lists.denx.de\" <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH v3] spi: fsl_qspi: Add controller busy check\n\tbefore new spi 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>"}}]