From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web08.29143.1652710283672709312 for ; Mon, 16 May 2022 07:11:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AczRca/9; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A48E461484 for ; Mon, 16 May 2022 14:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19A1AC385AA for ; Mon, 16 May 2022 14:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652710282; bh=Sol4rjoHQyiT7772TJcZksqAa+ZnP26cznbGfRVto8g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AczRca/9CMU1l/ZYfadb2HZx/G6uN5Z/PKFTug/VmZxsUfFEnvdELfqj+N5X08LOG 9q1xJWB9aM9qBU4lyjxXG9nS61+fDGt99CLxdSsVLshbhGCQhmd7d3jzU1+CuIZ51p Lk87rdFWTLViL+OfUC8awpn/6H8foTdKWCTjGVCL/Hp18K7lrcGSm/gaP3d1+5WIi1 y/Wy75WWX9+H4gCmfJKiSXNZoiZUDlb1sRB/7dopm6uYDTSNqKMQlUEoE5PJhESUsW LZk/Mvgkvkt2XjLw59hUMpuwqtErI0CgsmTXaqt6MN1Q976Oxi0y1ztZp2l/mQH88T UJqqAnXXiTGwA== Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-f18e6ff0f6so5859713fac.11 for ; Mon, 16 May 2022 07:11:22 -0700 (PDT) X-Gm-Message-State: AOAM531RmNbzoMFXSluTMY3muMWDLsFFgFmhwTIJCer1NeOtoB8qZxiZ AZU6py75f++CaFY6yxtXNz5D/q8sXOd5plG66h0= X-Google-Smtp-Source: ABdhPJzdOtY/JunAf3N9uAZ/6WoRczt979q8jg4zXsVeRt7OvPng7u4xYz0+cquLv9+Xq2fRBfbvudbfC9rKmRPNlSc= X-Received: by 2002:a05:6870:eaa5:b0:da:b3f:2b45 with SMTP id s37-20020a056870eaa500b000da0b3f2b45mr15457937oap.228.1652710281238; Mon, 16 May 2022 07:11:21 -0700 (PDT) MIME-Version: 1.0 References: <20220510082518.12346-1-masahisa.kojima@linaro.org> In-Reply-To: <20220510082518.12346-1-masahisa.kojima@linaro.org> From: "Ard Biesheuvel" Date: Mon, 16 May 2022 16:11:10 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH edk2-platforms 1/1] Silicon/SynQuacer/Fip006Dxe: Support 4-bytes address for erase and write To: Masahisa Kojima Cc: edk2-devel-groups-io , Ard Biesheuvel , Leif Lindholm , Kazuhiko Sakamoto Content-Type: text/plain; charset="UTF-8" On Tue, 10 May 2022 at 10:25, Masahisa Kojima wrote: > > From: Kazuhiko Sakamoto > > Support 4-bytes address for erase and write, so that we can > access whole region of SPI-NOR Flash(64MiB) implemented on the > Developerbox. > > This commit also fixes the wrong macro name. SPINOR_OP_SE and > SPINOR_OP_SE_4B is the commoand for 64KB block erase, > it must be SPINOR_OP_BE and SPINOR_OP_BE_4B. > > Signed-off-by: Masahisa Kojima Reviewed-by: Ard Biesheuvel Pushed as df5e094ef347..03d1c51272c0 Thanks, > --- > Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h | 4 ++-- > Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c | 13 +++++-------- > 2 files changed, 7 insertions(+), 10 deletions(-) > > diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h > index bade5706e6ae..3cb86ab588e0 100644 > --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h > +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h > @@ -313,7 +313,7 @@ NorFlashReadID ( > #define SPINOR_OP_BE_4K_PMC 0xd7 // Erase 4KiB block on PMC chips > #define SPINOR_OP_BE_32K 0x52 // Erase 32KiB block > #define SPINOR_OP_CHIP_ERASE 0xc7 // Erase whole flash chip > -#define SPINOR_OP_SE 0xd8 // Sector erase (usually 64KiB) > +#define SPINOR_OP_BE 0xd8 // Block erase (usually 64KiB) > #define SPINOR_OP_RDID 0x9f // Read JEDEC ID > #define SPINOR_OP_RDSFDP 0x5a // Read SFDP > #define SPINOR_OP_RDCR 0x35 // Read configuration register > @@ -329,7 +329,7 @@ NorFlashReadID ( > #define SPINOR_OP_PP_1_4_4_4B 0x3e // Quad page program > #define SPINOR_OP_BE_4K_4B 0x21 // Erase 4KiB block > #define SPINOR_OP_BE_32K_4B 0x5c // Erase 32KiB block > -#define SPINOR_OP_SE_4B 0xdc // Sector erase (usually 64KiB) > +#define SPINOR_OP_BE_4B 0xdc // Block erase (usually 64KiB) > #define SPINOR_OP_RD_ARRAY 0xe8 // Read array > #define SPINOR_OP_RD_NVCFG 0xb5 // Read non-volatile config register > #define SPINOR_OP_RD_VCR 0x85 // Read VCR register > diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c > index 8cdaa0eeb83f..b2ca0033ac13 100644 > --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c > +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c > @@ -51,12 +51,10 @@ STATIC CONST CSDC_DEFINITION mN25qCSDCDefTable[] = { > { SPINOR_OP_READ_4B, TRUE, TRUE, FALSE, FALSE, CS_CFG_MBM_SINGLE, > CSDC_TRP_SINGLE }, > // Write Operations > - { SPINOR_OP_PP, TRUE, FALSE, FALSE, TRUE, CS_CFG_MBM_SINGLE, > - CSDC_TRP_SINGLE }, > - { SPINOR_OP_PP_1_1_4, TRUE, FALSE, FALSE, TRUE, CS_CFG_MBM_QUAD, > + { SPINOR_OP_PP_4B, TRUE, TRUE, FALSE, TRUE, CS_CFG_MBM_SINGLE, > CSDC_TRP_SINGLE }, > // Erase Operations > - { SPINOR_OP_SE, FALSE, FALSE, FALSE, TRUE, CS_CFG_MBM_SINGLE, > + { SPINOR_OP_BE_4B, FALSE, FALSE, FALSE, TRUE, CS_CFG_MBM_SINGLE, > CSDC_TRP_SINGLE }, > }; > > @@ -446,9 +444,8 @@ NorFlashEraseSingleBlock ( > BlockAddress -= Instance->RegionBaseAddress; > BlockAddress += Instance->OffsetLba * Instance->BlockSize; > > - NorFlashSetHostCSDC (Instance, TRUE, mFip006NullCmdSeq); > - MmioWrite32 (Instance->DeviceBaseAddress, > - SwapBytes32 (BlockAddress & 0x00FFFFFF) | SPINOR_OP_SE); > + NorFlashSetHostCommand (Instance, SPINOR_OP_BE_4B); > + MmioWrite32 (Instance->DeviceBaseAddress, SwapBytes32 (BlockAddress)); > NorFlashWaitProgramErase (Instance); > NorFlashSetHostCSDC (Instance, TRUE, mFip006NullCmdSeq); > > @@ -515,7 +512,7 @@ NorFlashWriteSingleWord ( > if (EFI_ERROR (NorFlashEnableWrite (Instance))) { > return EFI_DEVICE_ERROR; > } > - NorFlashSetHostCommand (Instance, SPINOR_OP_PP); > + NorFlashSetHostCommand (Instance, SPINOR_OP_PP_4B); > MmioWrite32 (WordAddress, WriteData); > NorFlashWaitProgramErase (Instance); > > -- > 2.17.1 >