355 lines
43 KiB
HTML
355 lines
43 KiB
HTML
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn" data-whc_version="27.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.relation" content="../../../topics/sdk/spinand/spi-nand-user-guide.html"/><meta name="DC.relation" content="../../../topics/sdk/spinand/spi-nand_config.html"/><meta name="DC.relation" content="../../../topics/sdk/spinand/spi-nand_table.html"/><meta name="DC.relation" content="../../../topics/sdk/spinand/spi-nand_table.html"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.creator" content="yan.wang"/><meta name="DC.date.modified" content="2024-01-15"/><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><!-- Generated with build number 2024112209. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content="spi_nand_transplant_guide-d4445e4267"/><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=2024112209"/>
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/topic.css?buildId=2024112209"/>
|
||
|
||
<script src="../../../webhelp/app/options/properties.js?buildId=20250123154945"></script>
|
||
<script src="../../../webhelp/app/localization/strings.js?buildId=2024112209"></script>
|
||
<script src="../../../webhelp/app/search/index/keywords.js?buildId=20250123154945"></script>
|
||
<script defer="defer" src="../../../webhelp/app/commons.js?buildId=2024112209"></script>
|
||
<script defer="defer" src="../../../webhelp/app/topic.js?buildId=2024112209"></script>
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-styles-web.css?buildId=2024112209"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/notes.css?buildId=2024112209"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-common.css?buildId=2024112209"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-images.css?buildId=2024112209"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/footnote.css?buildId=2024112209"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-web-watermark.css?buildId=2024112209"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/topic-body-list.css?buildId=2024112209"/></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=" Linux SDK 使用指南 SDK 指南文件 "/></a>
|
||
<div class=" wh_publication_title "><a href="../../../index.html"><span class="booktitle"> <span class="ph mainbooktitle">Linux 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 "><ol class="d-print-none"><li><span class="home"><a href="../../../index.html"><span>主页</span></a></span></li><li><div class="topicref" data-id="id"><div class="title"><a href="../../../topics/sdk/chapter-advanced-app.html">高级应用</a><div class="wh-tooltip"><p class="shortdesc">系统、存储、多媒体、接口、安全等模块的详细配置和设计说明。</p></div></div></div></li><li><div class="topicref" data-id="chapter-memory"><div class="title"><a href="../../../topics/chapter-title/chapter-memory-sdk.html">存储</a><div class="wh-tooltip"><p class="shortdesc">SDMC、SPI NAND、SPI NOR 等存储模块的介绍和使用说明。</p></div></div></div></li><li><div class="topicref" data-id="spi_nand_user_guide"><div class="title"><a href="../../../topics/sdk/spinand/spi-nand-user-guide.html">SPI NAND 使用指南</a></div></div></li><li class="active"><div class="topicref" data-id="spi_nand_transplant_guide"><div class="title"><a href="../../../topics/sdk/spinand/spi-nand-transplant-guide.html">SPI NAND 移植</a></div></div></li></ol></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_navigation_links "><span id="topic_navigation_links" class="navheader">
|
||
|
||
<span class="navprev"><a class="- topic/link link" href="../../../topics/sdk/spinand/spi-nand_config.html" title="SPI NAND 配置" aria-label="上一主题: SPI NAND 配置" rel="prev"></a></span>
|
||
<span class="navnext"><a class="- topic/link link" href="../../../topics/sdk/spinand/spi-nand_table.html" title="配置 xxx_spinand_table" aria-label="下一主题: 配置 xxx_spinand_table" rel="next"></a></span> </span></div>
|
||
|
||
|
||
|
||
<div class=" wh_print_link print d-none d-md-inline-block "><button onClick="window.print()" title="打印此页" aria-label="打印此页"></button></div>
|
||
|
||
<button type="button" id="wh_toc_button" class="custom-toggler navbar-toggler collapsed wh_toggle_button navbar-light" aria-expanded="false" aria-label="Toggle publishing table of content" aria-controls="wh_publication_toc">
|
||
<span class="navbar-toggler-icon"></span>
|
||
</button>
|
||
</div>
|
||
|
||
</nav>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="wh_content_area">
|
||
<div class="row">
|
||
|
||
<nav id="wh_publication_toc" class="col-lg-3 col-md-3 col-sm-12 d-md-block d-none d-print-none" aria-label="Table of Contents Container">
|
||
<div id="wh_publication_toc_content">
|
||
|
||
<div class=" wh_publication_toc " data-tooltip-position="right"><span class="expand-button-action-labels"><span id="button-expand-action" role="button" aria-label="Expand"></span><span id="button-collapse-action" role="button" aria-label="Collapse"></span><span id="button-pending-action" role="button" aria-label="Pending"></span></span><ul role="tree" aria-label="Table of Contents"><li role="treeitem"><div data-tocid="revinfo_linux-d4445e1079" class="topicref" data-id="revinfo_linux" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/revinfo/revinfo_linux.html" id="revinfo_linux-d4445e1079-link">修订记录</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d4445e1096" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d4445e1096-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/env/sdk-compile.html" id="id-d4445e1096-link">SDK 编译</a><div class="wh-tooltip"><p class="shortdesc">介绍不同编译环境下 SDK 的详细编译流程。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="tocId-d4445e1240" class="topicref" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action tocId-d4445e1240-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/advanced/lb_usage_commands.html" id="tocId-d4445e1240-link">使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_rcx_czh_pzb-d4445e1360" class="topicref" data-id="concept_rcx_czh_pzb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_rcx_czh_pzb-d4445e1360-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/chapter-app.html" id="concept_rcx_czh_pzb-d4445e1360-link">应用场景</a><div class="wh-tooltip"><p class="shortdesc">描述了 SDK 在不同应用场景中的配置和使用,包括系统更新、OTA、安全方案等。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d4445e1678" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d4445e1678-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/peripheral/peripheral-intro.html" id="id-d4445e1678-link">外设移植</a><div class="wh-tooltip"><p class="shortdesc"><span class="ph">触摸屏、显示器、WIFI 模块、按键</span>等外设的介绍和使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d4445e1964" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d4445e1964-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/bringup/chapter-bringup.html" id="id-d4445e1964-link">BringUp</a><div class="wh-tooltip"><p class="shortdesc">在硬件上电后快速初始化系统,为操作系统的启动准备好必要的硬件环境。</p></div></div></div></li><li role="treeitem" aria-expanded="true"><div data-tocid="id-d4445e2153" class="topicref" data-id="id" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action id-d4445e2153-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/chapter-advanced-app.html" id="id-d4445e2153-link">高级应用</a><div class="wh-tooltip"><p class="shortdesc">系统、存储、多媒体、接口、安全等模块的详细配置和设计说明。</p></div></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem" aria-expanded="false"><div data-tocid="uBoot-d4445e2170" class="topicref" data-id="uBoot" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action uBoot-d4445e2170-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/boot/uboot-module.html" id="uBoot-d4445e2170-link">U-Boot</a><div class="wh-tooltip"><p class="shortdesc">启动支持的基本功能以及运行时的基本硬件环境。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_mtx_tk3_pzb-d4445e3028" class="topicref" data-id="concept_mtx_tk3_pzb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_mtx_tk3_pzb-d4445e3028-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/linux/chapter_linux.html" id="concept_mtx_tk3_pzb-d4445e3028-link">Linux</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="chapter-system-d4445e3198" class="topicref" data-id="chapter-system" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action chapter-system-d4445e3198-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-system.html" id="chapter-system-d4445e3198-link">系统</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="true"><div data-tocid="chapter-memory-d4445e4054" class="topicref" data-id="chapter-memory" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action chapter-memory-d4445e4054-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-memory-sdk.html" id="chapter-memory-d4445e4054-link">存储</a><div class="wh-tooltip"><p class="shortdesc">SDMC、SPI NAND、SPI NOR 等存储模块的介绍和使用说明。</p></div></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem" aria-expanded="false"><div data-tocid="id-d4445e4071" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d4445e4071-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/sdmc/sdmc-user-guide.html" id="id-d4445e4071-link">SDMC 使用指南</a></div></div></li><li role="treeitem" aria-expanded="true"><div data-tocid="spi_nand_user_guide-d4445e4239" class="topicref" data-id="spi_nand_user_guide" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action spi_nand_user_guide-d4445e4239-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/spinand/spi-nand-user-guide.html" id="spi_nand_user_guide-d4445e4239-link">SPI NAND 使用指南</a></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem"><div data-tocid="spi_nand_configuration-d4445e4253" class="topicref" data-id="spi_nand_configuration" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/spinand/spi-nand_config.html" id="spi_nand_configuration-d4445e4253-link">SPI NAND 配置</a></div></div></li><li role="treeitem" aria-expanded="true" class="active"><div data-tocid="spi_nand_transplant_guide-d4445e4267" class="topicref" data-id="spi_nand_transplant_guide" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action spi_nand_transplant_guide-d4445e4267-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/spinand/spi-nand-transplant-guide.html" id="spi_nand_transplant_guide-d4445e4267-link">SPI NAND 移植</a></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem"><div data-tocid="spi_nand_table-d4445e4281" class="topicref" data-id="spi_nand_table" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/spinand/spi-nand_table.html" id="spi_nand_table-d4445e4281-link">配置 <code class="ph codeph">xxx_spinand_table</code></a></div></div></li></ul></li></ul></li><li role="treeitem" aria-expanded="false"><div data-tocid="spi_nor_user_guide-d4445e4297" class="topicref" data-id="spi_nor_user_guide" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action spi_nor_user_guide-d4445e4297-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/spinor/spinor_user_guide.html" id="spi_nor_user_guide-d4445e4297-link">SPI NOR 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_n3v_ttw_bzb-d4445e4354" class="topicref" data-id="concept_n3v_ttw_bzb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_n3v_ttw_bzb-d4445e4354-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/file-system/file-system-user-guide.html" id="concept_n3v_ttw_bzb-d4445e4354-link">文件系统使用指南</a></div></div></li></ul></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_mcc_32s_nbc-d4445e4438" class="topicref" data-id="concept_mcc_32s_nbc" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_mcc_32s_nbc-d4445e4438-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-multi-media-sdk.html" id="concept_mcc_32s_nbc-d4445e4438-link">多媒体</a><div class="wh-tooltip"><p class="shortdesc">GE、VE、Display、DVP、MPP、MPP 播放器等多媒体模块的介绍和使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_nww_hzh_pzb-d4445e5947" class="topicref" data-id="concept_nww_hzh_pzb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_nww_hzh_pzb-d4445e5947-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-interface-sdk.html" id="concept_nww_hzh_pzb-d4445e5947-link">接口</a><div class="wh-tooltip"><p class="shortdesc">CAN、CIR、GPAI、GPIO、I2C、PSADC、PWM 等接口模块的介绍和使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="chapter-safety-d4445e7944" class="topicref" data-id="chapter-safety" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action chapter-safety-d4445e7944-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-safety-sdk.html" id="chapter-safety-d4445e7944-link">安全</a><div class="wh-tooltip"><p class="shortdesc">SPI ENC、CE、eFuse 等安全模块的介绍和使用说明。</p></div></div></div></li></ul></li></ul></div>
|
||
|
||
</div>
|
||
</nav>
|
||
|
||
|
||
<div class="col-lg-7 col-md-9 col-sm-12" id="wh_topic_body">
|
||
<button id="wh_close_publication_toc_button" class="close-toc-button d-none" aria-label="Toggle publishing table of content" aria-controls="wh_publication_toc" aria-expanded="true">
|
||
<span class="close-toc-icon-container">
|
||
<span class="close-toc-icon"></span>
|
||
</span>
|
||
</button>
|
||
<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" title="Edit this document" 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">15 Jan 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="d180650e33__20250123155219">SPI NAND 移植工作需要 SoC 端 SPI 模块的驱动能力以及对 SPI NAND 模块的正确配置。</p>
|
||
<p class="- topic/p p" data-ofbid="d180650e36__20250123155219">本节以 <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="d180650e51__20250123155219">
|
||
<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="d180650e55__20250123155219">
|
||
<p class="- topic/p p" data-ofbid="d180650e57__20250123155219"><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="d180650e69__20250123155219">
|
||
<p class="- topic/p p" data-ofbid="d180650e71__20250123155219"><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="d180650e79__20250123155219">一般情况下设为 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> <div class="note__body">
|
||
<p class="- topic/p p" data-ofbid="d180650e86__20250123155219">其他参数不配置或者配置不正确均不影响使用,但可能会对性能或者部分特殊操作产生影响,详细描述可查看 <a xml:lang="zh-CN" lang="zh-CN" class="- topic/xref xref" href="spi-nand_table.html">配置 xxx_spinand_table</a>。</p>
|
||
</div></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="d180650e102__20250123155219">
|
||
<p class="- topic/p p" data-ofbid="d180650e104__20250123155219">在 <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="d180650e116__20250123155219">一般情况下,同一个公司的 SPI NAND 的操作接口类似,创建一个文件可方便管理公司的接口配置。</p>
|
||
</li>
|
||
<li class="- topic/li li" data-ofbid="d180650e120__20250123155219">在 <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"><code>spinand-objs := core.o fmsh.o foresee.o …</code></pre></li>
|
||
<li class="- topic/li li" data-ofbid="d180650e128__20250123155219">
|
||
<div class="- topic/p p" data-ofbid="d180650e130__20250123155219">在 <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"><code><strong class="hl-keyword">extern</strong> <strong class="hl-keyword">const</strong> <strong class="hl-keyword">struct</strong> spinand_manufacturer foresee_spinand_manufacturer;</code></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="d180650e146__20250123155219">通过两级列表,设置内核支持的 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="d180650e150__20250123155219">
|
||
<div class="- topic/p p" data-ofbid="d180650e152__20250123155219">检查 <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"><code><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,
|
||
};</code></pre></div>
|
||
</li>
|
||
<li class="- topic/li li" data-ofbid="d180650e164__20250123155219">
|
||
<div class="- topic/p p" data-ofbid="d180650e166__20250123155219">检查具体的设备厂商文件,具体的型号是否在列表之中,以 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"><code><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)),
|
||
};</code></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="d180650e180__20250123155219"><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"><code><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>
|
||
};</code></pre></div>
|
||
<p class="- topic/p p" data-ofbid="d180650e187__20250123155219"><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="d180650e195__20250123155219">
|
||
<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="d180650e199__20250123155219">
|
||
<p class="- topic/p p" data-ofbid="d180650e201__20250123155219">Manufacture ID (MID):厂商的唯一标识, 一般在数据手册文档中搜 Manufacture ID 或者 MID 即可获得。</p>
|
||
</li>
|
||
<li class="- topic/li li" data-ofbid="d180650e205__20250123155219">
|
||
<p class="- topic/p p" data-ofbid="d180650e207__20250123155219">Device ID (DID):器件的唯一标识,一般在数据手册文档中搜 Device ID 或者 DID 即可获得。</p>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="- topic/p p" data-ofbid="d180650e213__20250123155219">
|
||
<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"><code>#<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></code></pre>
|
||
</div>
|
||
<div class="- topic/p p" data-ofbid="d180650e220__20250123155219">
|
||
<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="d180650e244__20250123155219">SPI NAND 的接口和操作命令基本统一,一般无需特殊处理。驱动上为了更好的兼容性,预留了部分接口方便配置使用,参数主要由 SPINAND_INFO 描述。</p>
|
||
<div class="- topic/p p" data-ofbid="d180650e247__20250123155219">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"><code>#<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__
|
||
}</code></pre></div>
|
||
<p class="- topic/p p" data-ofbid="d180650e252__20250123155219"><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"><code><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)),
|
||
};</code></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="d180650e275__20250123155219">芯片存储结构 <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"><code>#<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>
|
||
}</code></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> <div class="note__body">关于详细的配置描述和示例,可查看<a class="- topic/xref xref" href="spi-nand_table.html">配置 xxx_spinand_table</a>。</div></div>
|
||
</section>
|
||
</div>
|
||
</article></main></div>
|
||
|
||
<div class=" wh_child_links d-print-none "><nav aria-label="Child Links" role="navigation" class="- topic/related-links related-links"><ul class="ullinks"><li class="- topic/link link ulchildlink"><strong><a href="../../../topics/sdk/spinand/spi-nand_table.html">配置 xxx_spinand_table</a></strong></li></ul></nav></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-23
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
<button id="go2top" class="d-print-none" title="返回顶部">
|
||
<span class="oxy-icon oxy-icon-up"></span>
|
||
</button>
|
||
|
||
<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> |