mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-14 18:38:55 +00:00
308 lines
28 KiB
HTML
308 lines
28 KiB
HTML
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn" data-whc_version="26.0">
|
||
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="description" content="SPI NAND 移植工作需要 SoC 端 SPI 模块的驱动能力以及对 SPI NAND 模块的正确配置。 本节以 Fudan Micro 的 FM25S01A 以及 Foresee 的 F35SQA002G 为例,详细说明 SPI NAND 器件的移植流程。SPI NAND 在 U-Boot 和 Kernel 中的实现逻辑类似,文件路径和内容基本一致,本文以 Kernel ..."/><meta name="DC.rights.owner" content="(C) 版权 2025"/><meta name="copyright" content="(C) 版权 2025"/><meta name="generator" content="DITA-OT"/><meta name="DC.type" content="concept"/><meta name="DC.creator" content="yan.wang"/><meta name="DC.date.created" content="2024-01-17"/><meta name="DC.date.modified" content="2024-12-18"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="spi_nand_transplant_guide"/><meta name="DC.language" content="zh-CN"/><title>SPI NAND 移植</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/spinand/spi-nand-transplant-guide.dita"/><meta name="wh-out-relpath" content="topics/sdk/spinand/spi-nand-transplant-guide.html"/>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/commons.css?buildId=2023110923"/>
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/topic.css?buildId=2023110923"/>
|
||
|
||
<script src="../../../webhelp/app/options/properties.js?buildId=20250121171154"></script>
|
||
<script src="../../../webhelp/app/localization/strings.js?buildId=2023110923"></script>
|
||
<script src="../../../webhelp/app/search/index/keywords.js?buildId=20250121171154"></script>
|
||
<script defer="defer" src="../../../webhelp/app/commons.js?buildId=2023110923"></script>
|
||
<script defer="defer" src="../../../webhelp/app/topic.js?buildId=2023110923"></script>
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-styles-web.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/notes.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-common.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-images.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/footnote.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-web-watermark.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/topic-body-list.css?buildId=2023110923"/></head>
|
||
|
||
<body id="spi_nand_transplant_guide" class="wh_topic_page frmBody">
|
||
<a href="#wh_topic_body" class="sr-only sr-only-focusable">
|
||
跳转到主要内容
|
||
</a>
|
||
|
||
|
||
|
||
|
||
<header class="navbar navbar-default wh_header">
|
||
<div class="container-fluid">
|
||
<div class="wh_header_flex_container navbar-nav navbar-expand-md navbar-dark">
|
||
<div class="wh_logo_and_publication_title_container">
|
||
<div class="wh_logo_and_publication_title">
|
||
|
||
<a href="http://www.artinchip.com" class=" wh_logo d-none d-sm-block "><img src="../../../company-logo-white.png" alt="RTOS SDK 使用指南SDK 指南文件"/></a>
|
||
<div class=" wh_publication_title "><a href="../../../index.html"><span class="booktitle"><span class="ph mainbooktitle">RTOS SDK 使用指南</span><span class="ph booktitlealt">SDK 指南文件</span></span></a></div>
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="wh_top_menu_and_indexterms_link collapse navbar-collapse" id="wh_top_menu_and_indexterms_link">
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
|
||
|
||
|
||
<div class=" wh_search_input navbar-form wh_topic_page_search search " role="form">
|
||
|
||
|
||
|
||
<form id="searchForm" method="get" role="search" action="../../../search.html"><div><input type="search" placeholder="搜索 " class="wh_search_textfield" id="textToSearch" name="searchQuery" aria-label="搜索查询" required="required"/><button type="submit" class="wh_search_button" aria-label="搜索"><span class="search_input_text">搜索</span></button></div></form>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<div class="container-fluid" id="wh_topic_container">
|
||
<div class="row">
|
||
|
||
<nav class="wh_tools d-print-none navbar-expand-md" aria-label="Tools">
|
||
|
||
<div data-tooltip-position="bottom" class=" wh_breadcrumb "></div>
|
||
|
||
|
||
|
||
<div class="wh_right_tools">
|
||
<button class="wh_hide_highlight" aria-label="切换搜索突出显示" title="切换搜索突出显示"></button>
|
||
<button class="webhelp_expand_collapse_sections" data-next-state="collapsed" aria-label="折叠截面" title="折叠截面"></button>
|
||
|
||
|
||
|
||
|
||
<div class=" wh_print_link print d-none d-md-inline-block "><button onClick="window.print()" title="打印此页" aria-label="打印此页"></button></div>
|
||
|
||
|
||
</div>
|
||
|
||
</nav>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="wh_content_area">
|
||
<div class="row">
|
||
|
||
|
||
<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12" id="wh_topic_body">
|
||
|
||
<button id="wh_close_topic_toc_button" class="close-toc-button d-none" aria-label="Toggle topic table of content" aria-controls="wh_topic_toc" aria-expanded="true">
|
||
<span class="close-toc-icon-container">
|
||
<span class="close-toc-icon"></span>
|
||
</span>
|
||
</button>
|
||
|
||
<div class=" wh_topic_content body "><main role="main"><article class="- topic/topic concept/concept topic concept" role="article" aria-labelledby="ariaid-title1"><span class="edit-link" style="font-size:12px; opacity:0.6; text-align:right; vertical-align:middle"><a target="_blank" href="http://172.16.35.88/tasks/jdssno1uvvbf2mltu9kb9v3if05d5gopuakboe8hlud18rma/edit/F:/aicdita/aicdita-cn/topics/sdk/spinand/spi-nand-transplant-guide.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">SPI NAND 移植</h1><div class="date inPage">18 Dec 2024</div><div style="color: gray;">
|
||
Read time: 4 minute(s)
|
||
</div><div class="- topic/body concept/conbody body conbody"><p class="- topic/p p" data-ofbid="d161548e23__20250121171616">SPI NAND 移植工作需要 SoC 端 SPI 模块的驱动能力以及对 SPI NAND 模块的正确配置。</p><p class="- topic/p p" data-ofbid="d161548e25__20250121171616">本节以 <code class="+ topic/ph pr-d/codeph ph codeph">Fudan Micro</code> 的 <code class="+ topic/ph pr-d/codeph ph codeph">FM25S01A</code> 以及 <code class="+ topic/ph pr-d/codeph ph codeph">Foresee</code>
|
||
的 <code class="+ topic/ph pr-d/codeph ph codeph">F35SQA002G</code> 为例,详细说明 SPI NAND 器件的移植流程。SPI NAND 在 U-Boot 和 Kernel
|
||
中的实现逻辑类似,文件路径和内容基本一致,本文以 Kernel 中的移植为例。配置过程中,涉及下列重要参数:</p><div class="- topic/p p" data-ofbid="d161548e39__20250121171616">
|
||
<ul class="- topic/ul ul" id="spi_nand_transplant_guide__ul_vrq_nqy_c1c" data-ofbid="spi_nand_transplant_guide__ul_vrq_nqy_c1c"><li class="- topic/li li" data-ofbid="d161548e42__20250121171616">
|
||
<p class="- topic/p p" data-ofbid="d161548e44__20250121171616"><span class="+ topic/keyword pr-d/parmname keyword parmname">MID</span>、<span class="+ topic/keyword pr-d/parmname keyword parmname">DID</span> 和
|
||
<span class="+ topic/keyword pr-d/parmname keyword parmname">NAND_MEMORG</span> ,具体配置信息以数据手册为准 。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d161548e55__20250121171616">
|
||
<p class="- topic/p p" data-ofbid="d161548e57__20250121171616"><span class="+ topic/keyword pr-d/parmname keyword parmname">READ_FROM_CACHE</span> 中的 <span class="+ topic/keyword pr-d/parmname keyword parmname">dummy 长度</span>。</p>
|
||
<p class="- topic/p p" data-ofbid="d161548e65__20250121171616">一般情况下设为 1,部分情况下为 2,具体以数据手册为准。</p>
|
||
</li></ul>
|
||
<div class="- topic/note note note note_note" id="spi_nand_transplant_guide__note_izt_lqy_c1c" data-ofbid="spi_nand_transplant_guide__note_izt_lqy_c1c"><span class="note__title">注:</span>
|
||
<p class="- topic/p p" data-ofbid="d161548e71__20250121171616">其他参数不配置或者配置不正确均不影响使用,但可能会对性能或者部分特殊操作产生影响,详细描述可查看 <a xml:lang="zh-CN" lang="zh-CN" class="- topic/xref xref" href="spi-nand_table.html">配置 xxx_spinand_table</a>。</p>
|
||
</div>
|
||
</div><section class="- topic/section section" id="spi_nand_transplant_guide__section_zd3_pqy_c1c" data-ofbid="spi_nand_transplant_guide__section_zd3_pqy_c1c"><h2 class="- topic/title title sectiontitle">准备文件</h2>
|
||
|
||
<ol class="- topic/ol ol simple" id="spi_nand_transplant_guide__ul_brs_tyh_bdc" data-ofbid="spi_nand_transplant_guide__ul_brs_tyh_bdc"><li class="- topic/li li" data-ofbid="d161548e85__20250121171616">
|
||
<p class="- topic/p p" data-ofbid="d161548e87__20250121171616">在 <span class="+ topic/ph sw-d/filepath ph filepath">source/linux-5.10/drivers/mtd/nand/spi</span>
|
||
目录下创建带相应公司标识的文件,如 <span class="+ topic/ph sw-d/filepath ph filepath">fmsh.c</span> 或
|
||
<span class="+ topic/ph sw-d/filepath ph filepath">foresee.c</span>。如果该公司的文件已经存在,则略过此步,直接添加新器件支持即可。</p>
|
||
<p class="- topic/p p" data-ofbid="d161548e99__20250121171616">一般情况下,同一个公司的 SPI NAND 的操作接口类似,创建一个文件可方便管理公司的接口配置。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d161548e102__20250121171616">在 <span class="+ topic/ph sw-d/filepath ph filepath">Makefile</span>
|
||
中添加该文件的编译:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="spi_nand_transplant_guide__codeblock_hyj_tfb_ndc" data-ofbid="spi_nand_transplant_guide__codeblock_hyj_tfb_ndc">spinand-objs := core.o fmsh.o foresee.o …</pre></li><li class="- topic/li li" data-ofbid="d161548e109__20250121171616">
|
||
<div class="- topic/p p" data-ofbid="d161548e111__20250121171616">在 <span class="+ topic/ph sw-d/filepath ph filepath">bsp/peripheral/spinand/inc/spinand.h</span>
|
||
中声明如下:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="spi_nand_transplant_guide__codeblock_ksy_wy1_ndc" data-ofbid="spi_nand_transplant_guide__codeblock_ksy_wy1_ndc"><strong class="hl-keyword">extern</strong> <strong class="hl-keyword">const</strong> <strong class="hl-keyword">struct</strong> spinand_manufacturer foresee_spinand_manufacturer;</pre></div>
|
||
</li></ol>
|
||
</section><section class="- topic/section section" id="spi_nand_transplant_guide__section_eqq_nqy_c1c" data-ofbid="spi_nand_transplant_guide__section_eqq_nqy_c1c"><h2 class="- topic/title title sectiontitle">添加驱动索引</h2>
|
||
|
||
<div class="- topic/p p" data-ofbid="d161548e125__20250121171616">通过两级列表,设置内核支持的 SPI NAND 设备和驱动的关联。<ol class="- topic/ol ol" id="spi_nand_transplant_guide__ul_fqq_nqy_c1c" data-ofbid="spi_nand_transplant_guide__ul_fqq_nqy_c1c"><li class="- topic/li li" data-ofbid="d161548e128__20250121171616">
|
||
<div class="- topic/p p" data-ofbid="d161548e130__20250121171616">检查 <span class="+ topic/ph sw-d/filepath ph filepath">source/linux-5.10/drivers/mtd/nand/spi/core.c</span> 中的
|
||
<span class="+ topic/ph sw-d/filepath ph filepath">spinand_manufacturers</span>
|
||
信息,查看新设备的厂商是否在列表之中:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="spi_nand_transplant_guide__codeblock_kxd_5qy_c1c" data-ofbid="spi_nand_transplant_guide__codeblock_kxd_5qy_c1c"><strong class="hl-keyword">static</strong> <strong class="hl-keyword">const</strong> <strong class="hl-keyword">struct</strong> spinand_manufacturer *spinand_manufacturers[] = {
|
||
&gigadevice_spinand_manufacturer,
|
||
&macronix_spinand_manufacturer,
|
||
&micron_spinand_manufacturer,
|
||
&paragon_spinand_manufacturer,
|
||
&toshiba_spinand_manufacturer,
|
||
&winbond_spinand_manufacturer,
|
||
&fmsh_spinand_manufacturer,
|
||
&foresee_spinand_manufacturer,
|
||
};</pre></div>
|
||
</li><li class="- topic/li li" data-ofbid="d161548e141__20250121171616">
|
||
<div class="- topic/p p" data-ofbid="d161548e143__20250121171616">检查具体的设备厂商文件,具体的型号是否在列表之中,以 Fudan Micro
|
||
为例:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="spi_nand_transplant_guide__codeblock_g3x_5qy_c1c" data-ofbid="spi_nand_transplant_guide__codeblock_g3x_5qy_c1c"><strong class="hl-keyword">static</strong> <strong class="hl-keyword">const</strong> <strong class="hl-keyword">struct</strong> spinand_info fmsh_spinand_table[] = {
|
||
SPINAND_INFO(<span class="hl-string">"FM25S01A"</span>,
|
||
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, <span class="hl-number">0xE4</span>),
|
||
NAND_MEMORG(<span class="hl-number">1</span>, <span class="hl-number">2048</span>, <span class="hl-number">64</span>, <span class="hl-number">64</span>, <span class="hl-number">1024</span>, <span class="hl-number">20</span>, <span class="hl-number">1</span>, <span class="hl-number">1</span>, <span class="hl-number">1</span>),
|
||
NAND_ECCREQ(<span class="hl-number">1</span>, <span class="hl-number">512</span>),
|
||
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||
&write_cache_variants,
|
||
&update_cache_variants),
|
||
SPINAND_HAS_QE_BIT,
|
||
SPINAND_ECCINFO(&fm25s01_ooblayout,
|
||
fm25s01_ecc_get_status)),
|
||
};</pre></div>
|
||
</li></ol></div>
|
||
</section><section class="- topic/section section" id="spi_nand_transplant_guide__section_unc_nkb_ndc" data-ofbid="spi_nand_transplant_guide__section_unc_nkb_ndc"><h2 class="- topic/title title sectiontitle">配置 MID 和 DID</h2>
|
||
|
||
<div class="- topic/p p" data-ofbid="d161548e154__20250121171616"><code class="+ topic/ph pr-d/codeph ph codeph">spinand_manufacturer</code> 数据结构为第一级索引,用来描述厂商的系列器件信息。SPI NAND
|
||
的接口和操作命令基本统一,一般无需特殊处理。驱动上为了更好的兼容性,预留了部分接口方便配置使用。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="spi_nand_transplant_guide__codeblock_xrx_vqy_c1c" data-ofbid="spi_nand_transplant_guide__codeblock_xrx_vqy_c1c"><strong class="hl-keyword">const</strong> <strong class="hl-keyword">struct</strong> spinand_manufacturer winbond_spinand_manufacturer = {
|
||
.id = SPINAND_MFR_FMSH, <em class="hl-comment">//厂家的 ID,即 MID</em>
|
||
.name = <span class="hl-string">"FudanMicro"</span>, <em class="hl-comment">//厂家名字标识</em>
|
||
.chips = fmsh_spinand_table, <em class="hl-comment">//本驱动支持的器件</em>
|
||
.nchips = ARRAY_SIZE(fmsh_spinand_table), <em class="hl-comment">// 支持的器件的个数</em>
|
||
.ops = &fmsh_spinand_manuf_ops, <em class="hl-comment">// 本公司的器件 私有操作接口</em>
|
||
};
|
||
|
||
<strong class="hl-keyword">struct</strong> spinand_manufacturer_ops {
|
||
<strong class="hl-keyword">int</strong> (*init)(<strong class="hl-keyword">struct</strong> spinand_device *spinand); <em class="hl-comment">//初始化接口,如果没有特殊操作,可以为空</em>
|
||
<strong class="hl-keyword">void</strong> (*cleanup)(<strong class="hl-keyword">struct</strong> spinand_device *spinand); <em class="hl-comment">//清理接口,如果没有特殊操作,可以为空</em>
|
||
};</pre></div>
|
||
<p class="- topic/p p" data-ofbid="d161548e161__20250121171616"><code class="+ topic/ph pr-d/codeph ph codeph">FudanMicro</code> 和 <code class="+ topic/ph pr-d/codeph ph codeph">Foresee</code> 未设置特殊的初始化接口,因此均预留为空。</p>
|
||
<div class="- topic/p p" data-ofbid="d161548e169__20250121171616">
|
||
<ul class="- topic/ul ul" id="spi_nand_transplant_guide__ul_lqq_nqy_c1c" data-ofbid="spi_nand_transplant_guide__ul_lqq_nqy_c1c"><li class="- topic/li li" data-ofbid="d161548e172__20250121171616">
|
||
<p class="- topic/p p" data-ofbid="d161548e174__20250121171616">Manufacture ID (MID):厂商的唯一标识, 一般在数据手册文档中搜 Manufacture ID 或者 MID 即可获得。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d161548e177__20250121171616">
|
||
<p class="- topic/p p" data-ofbid="d161548e179__20250121171616">Device ID (DID):器件的唯一标识,一般在数据手册文档中搜 Device ID 或者 DID 即可获得。</p>
|
||
</li></ul>
|
||
</div>
|
||
<div class="- topic/p p" data-ofbid="d161548e184__20250121171616">
|
||
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="spi_nand_transplant_guide__codeblock_jyl_1ry_c1c" data-ofbid="spi_nand_transplant_guide__codeblock_jyl_1ry_c1c">#<span class="hl-directive">define</span> SPINAND_MFR_FMSH <span class="hl-number">0xA1</span>
|
||
#<span class="hl-directive">define</span> SPINAND_MFR_FORESEE <span class="hl-number">0xCD</span></pre>
|
||
</div>
|
||
<div class="- topic/p p" data-ofbid="d161548e191__20250121171616">
|
||
<figure class="- topic/fig fig fignone" id="spi_nand_transplant_guide__fig_prb_mjb_ndc" data-ofbid="spi_nand_transplant_guide__fig_prb_mjb_ndc"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="spi_nand_transplant_guide__image_mqq_nqy_c1c" src="../../../images/spinand/mid-did.png" width="480" alt="mid-did"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label">图<span class="fig--title-label-number"> 1</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">MID 和 DID 搜索结果示例</span></figcaption></figure>
|
||
</div>
|
||
</section><section class="- topic/section section" id="spi_nand_transplant_guide__section_xjp_qkb_ndc" data-ofbid="spi_nand_transplant_guide__section_xjp_qkb_ndc"><h2 class="- topic/title title sectiontitle">配置 <code class="+ topic/ph pr-d/codeph ph codeph">SPINAND_INFO</code>
|
||
</h2>
|
||
|
||
<p class="- topic/p p" data-ofbid="d161548e209__20250121171616">SPI NAND 的接口和操作命令基本统一,一般无需特殊处理。驱动上为了更好的兼容性,预留了部分接口方便配置使用,参数主要由 SPINAND_INFO 描述。</p>
|
||
<div class="- topic/p p" data-ofbid="d161548e212__20250121171616">SPI_INFO
|
||
描述如下:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="spi_nand_transplant_guide__codeblock_rzn_zkb_ndc" data-ofbid="spi_nand_transplant_guide__codeblock_rzn_zkb_ndc">#<span class="hl-directive">define</span> SPINAND_INFO(__model, __id, __memorg, __eccreq, __op_variants, \
|
||
__flags, ...)
|
||
{
|
||
.model = __model, <em class="hl-comment">// 对应器件型号,描述字符,不进行具体匹配</em>
|
||
.devid = __id, <em class="hl-comment">// 对应器件 DID(DeviceID),是该器件的唯一标识</em>
|
||
.memorg = __memorg, <em class="hl-comment">// 器件存储结构</em>
|
||
.eccreq = __eccreq, <em class="hl-comment">// 请求 ECC 的参数</em>
|
||
.op_variants = __op_variants, <em class="hl-comment">// 读写函数操作集合地址</em>
|
||
.flags = __flags, <em class="hl-comment">// 功能标识</em>
|
||
__VA_ARGS__
|
||
}</pre></div>
|
||
<p class="- topic/p p" data-ofbid="d161548e217__20250121171616"><span class="+ topic/ph sw-d/filepath ph filepath">xxx_spinand_table</span> 数据结构为第二级索引,描述厂商的系列器件信息,是 SPI NAND 驱动的核心。关于
|
||
<span class="+ topic/ph sw-d/filepath ph filepath">xxx_spinand_table</span> 的详细说明,可查看 <a class="- topic/xref xref" href="spi-nand_table.html">配置 xxx_spinand_table</a>。</p>
|
||
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="spi_nand_transplant_guide__codeblock_ccr_dry_c1c" data-ofbid="spi_nand_transplant_guide__codeblock_ccr_dry_c1c"><strong class="hl-keyword">static</strong> <strong class="hl-keyword">const</strong> <strong class="hl-keyword">struct</strong> spinand_info foresee_spinand_table[] = {
|
||
SPINAND_INFO(<span class="hl-string">"F35SQA002G"</span>,
|
||
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, <span class="hl-number">0x72</span>),
|
||
NAND_MEMORG(<span class="hl-number">1</span>, <span class="hl-number">2048</span>, <span class="hl-number">64</span>, <span class="hl-number">64</span>, <span class="hl-number">2048</span>, <span class="hl-number">40</span>, <span class="hl-number">1</span>, <span class="hl-number">1</span>, <span class="hl-number">1</span>),
|
||
NAND_ECCREQ(<span class="hl-number">1</span>, <span class="hl-number">528</span>),
|
||
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||
&write_cache_variants,
|
||
&update_cache_variants),
|
||
SPINAND_HAS_QE_BIT,
|
||
SPINAND_ECCINFO(&f35sqa_ooblayout,
|
||
f35sqa_ecc_get_status)),
|
||
};</pre>
|
||
</section><section class="- topic/section section" id="spi_nand_transplant_guide__section_odw_vkb_ndc" data-ofbid="spi_nand_transplant_guide__section_odw_vkb_ndc"><h2 class="- topic/title title sectiontitle">配置 <code class="+ topic/ph pr-d/codeph ph codeph">NAND_MEMORG</code></h2>
|
||
|
||
<div class="- topic/p p" data-ofbid="d161548e239__20250121171616">芯片存储结构 <code class="+ topic/ph pr-d/codeph ph codeph">memorg</code> 通过 NAND_MEMORG 结构描述。一般情况下,器件数据手册会在开头描述
|
||
<code class="+ topic/ph pr-d/codeph ph codeph">memorg</code> 信息。<code class="+ topic/ph pr-d/codeph ph codeph">NAND_MEMORG</code>
|
||
的参数示例描述如下:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="spi_nand_transplant_guide__codeblock_pwq_3ry_c1c" data-ofbid="spi_nand_transplant_guide__codeblock_pwq_3ry_c1c">#<span class="hl-directive">define</span> NAND_MEMORG(bpc, ps, os, ppe, epl, mbb, ppl, lpt, nt)
|
||
{
|
||
.bits_per_cell = (bpc), <em class="hl-comment">// Cell 是 NAND 的最小单元,一般只能存储 1bit,少有其他值得</em>
|
||
.pagesize = (ps), <em class="hl-comment">// 页大小,大部分的器件的页通过(N + Mbytes)的方式描述,N 为页大小,M 为 oob</em>
|
||
.oobsize = (os), <em class="hl-comment">//界外大小,一般用于存放 ECC 校验数据或其它数据,和 pagesize 共同描述</em>
|
||
.pages_per_eraseblock = (ppe), <em class="hl-comment">// 一个擦除块有多少个页</em>
|
||
.eraseblocks_per_lun = (epl), <em class="hl-comment">// 一个 lun(die)有多少个擦除块,1Gb/(64 x 2048 x 8) = 1024</em>
|
||
.max_bad_eraseblocks_per_lun = (mbb), <em class="hl-comment">//器件出厂的最大坏块数,一般在数据手册中通过 bad blocks 查找到</em>
|
||
.planes_per_lun = (ppl), <em class="hl-comment">//一般设置为 1,单 die</em>
|
||
.luns_per_target = (lpt), <em class="hl-comment">//一般设置为 1</em>
|
||
.ntargets = (nt), <em class="hl-comment">//一般设置为 1</em>
|
||
}</pre></div>
|
||
<div class="- topic/note note note note_note" id="spi_nand_transplant_guide__note_spf_nlb_ndc" data-ofbid="spi_nand_transplant_guide__note_spf_nlb_ndc"><span class="note__title">注:</span> 关于详细的配置描述和示例,可查看<a class="- topic/xref xref" href="spi-nand_table.html">配置 xxx_spinand_table</a>。</div>
|
||
</section></div></article></main></div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<nav role="navigation" id="wh_topic_toc" aria-label="On this page" class="col-lg-2 d-none d-lg-block navbar d-print-none">
|
||
<div id="wh_topic_toc_content">
|
||
|
||
<div class=" wh_topic_toc "><div class="wh_topic_label">在本页上</div><ul><li class="section-item"><div class="section-title"><a href="#spi_nand_transplant_guide__section_zd3_pqy_c1c" data-tocid="spi_nand_transplant_guide__section_zd3_pqy_c1c">准备文件</a></div></li><li class="section-item"><div class="section-title"><a href="#spi_nand_transplant_guide__section_eqq_nqy_c1c" data-tocid="spi_nand_transplant_guide__section_eqq_nqy_c1c">添加驱动索引</a></div></li><li class="section-item"><div class="section-title"><a href="#spi_nand_transplant_guide__section_unc_nkb_ndc" data-tocid="spi_nand_transplant_guide__section_unc_nkb_ndc">配置 MID 和 DID</a></div></li><li class="section-item"><div class="section-title"><a href="#spi_nand_transplant_guide__section_xjp_qkb_ndc" data-tocid="spi_nand_transplant_guide__section_xjp_qkb_ndc">配置 <code class="+ topic/ph pr-d/codeph ph codeph">SPINAND_INFO</code>
|
||
</a></div></li><li class="section-item"><div class="section-title"><a href="#spi_nand_transplant_guide__section_odw_vkb_ndc" data-tocid="spi_nand_transplant_guide__section_odw_vkb_ndc">配置 <code class="+ topic/ph pr-d/codeph ph codeph">NAND_MEMORG</code></a></div></li></ul></div>
|
||
|
||
</div>
|
||
</nav>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
<footer class="navbar navbar-default wh_footer">
|
||
<div class=" footer-container mx-auto ">
|
||
<title>footer def</title>
|
||
<style><!--
|
||
|
||
.p1 {
|
||
font-family: FangZhengShuSong, Times, serif;
|
||
}
|
||
.p2 {
|
||
font-family: Arial, Helvetica, sans-serif;
|
||
}
|
||
.p3 {
|
||
font-family: "Lucida Console", "Courier New", monospace;
|
||
}
|
||
|
||
--></style>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="webhelp.fragment.footer">
|
||
<p class="p1">Copyright © 2019-2024 广东匠芯创科技有限公司. All rights reserved.</p>
|
||
</div><div>
|
||
<div class="generation_time">
|
||
Update Time: 2025-01-21
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
<div id="go2top" class="d-print-none">
|
||
<span class="oxy-icon oxy-icon-up"></span>
|
||
</div>
|
||
|
||
<div id="modal_img_large" class="modal">
|
||
<span class="close oxy-icon oxy-icon-remove"></span>
|
||
<div id="modal_img_container"></div>
|
||
<div id="caption"></div>
|
||
</div>
|
||
|
||
|
||
<script src="${pd}/publishing/publishing-styles-AIC-template/js/custom.js" defer="defer"></script>
|
||
|
||
|
||
</body>
|
||
</html> |