CN108121571A - 一种基于系统硬件模块的独立复位设计与实现 - Google Patents

一种基于系统硬件模块的独立复位设计与实现 Download PDF

Info

Publication number
CN108121571A
CN108121571A CN201711400804.0A CN201711400804A CN108121571A CN 108121571 A CN108121571 A CN 108121571A CN 201711400804 A CN201711400804 A CN 201711400804A CN 108121571 A CN108121571 A CN 108121571A
Authority
CN
China
Prior art keywords
reset
framework
struct
processor
realized
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201711400804.0A
Other languages
English (en)
Inventor
王鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201711400804.0A priority Critical patent/CN108121571A/zh
Publication of CN108121571A publication Critical patent/CN108121571A/zh
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

本发明涉及计算机领域,特别涉及一种基于reset framework实现的reset平台驱动的实现方法,本发明基于新版内核的reset framework实现了片上reset控制器的驱动,遵守设备模型、面向对象设计思想,实现了系统单一硬件模块的独立复位,同时兼顾了系统整体复位的情况。

Description

一种基于系统硬件模块的独立复位设计与实现
技术领域
本发明涉及计算机领域,特别涉及一种基于reset framework实现的reset平台驱动的实现方法。
背景技术
复杂IC内部有很多具有独立功能的硬件模块,例如CPU cores、GPU cores、USB控制器、MMC控制器、等等,出于功耗、稳定性等方面的考虑,有些IC在内部为这些硬件模块设计了复位信号(reset signals),软件可通过寄存器(一般1个bit控制1个硬件)控制这些硬件模块的复位状态。
Linux kernel为了方便设备驱动的编写,抽象出一个简单的软件框架----resetframework,为reset的provider提供统一的reset资源管理手段,并为reset的consumer(各个硬件模块)提供便捷、统一的复位控制API。
reset framework的思路、实现和使用都非常简单、易懂(参考kernel有关的API--include/linux/reset-controller.h、include/linux/reset.h可知),并且其编写严格遵守 Linux kernel的设备模型、驱动框架、分层设计、provider/consumer等设计思想。
传统的硬件复位往往会连带不止一个硬件模块的的复位,而我们遇到的问题可能只是其中某一个硬件模块导致的,这样一来,不相关的硬件模块如果也被复位,势必给系统带来稳定性和功耗等方面的隐患。
另外,这样的操作也显得过于粗放,在软件设计上不够优雅,也不利于后期的维护和其他研发人员的理解。操作不够精细化,往往连带多个硬件模块一起复位,为系统稳定性和功耗带来隐患,软件设计上也不够合理,带来了不必要的研发投入。
因而亟需一种方法和机制来实现系统中各硬件模块的单一复位。
发明内容
本发明是通过如下技术方案实现的,基于reset framework实现的reset平台驱动的实现方法,其特征在于:包括如下内容:1)核心结构体再封装;2)probe函数负责完成硬件初始化,平台资源获取,以及复位控制器的注册工作。
优选的,函数实现的内容进一步包括:申请私有封装的内存;获取平台资源;映射I/O基地址;时钟资源获取及使能;初始化私有封装并将其设置为平台数据;注册初始化好的复位控制器;注册通知链回调函数到restart_handler_list链表,系统复位时调用。
优选的,reset framework可以实现如下内容:提供描述系统中reset资源的方法;consumer设备在自己的dts node中使用关键字声明所需的reset的资源;consumer driver调用API复位自己。
本发明还提供一种计算机存储介质,其上存有计算机程序,该程序被处理器执行以实现所述的方法。
本发明还提供一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序以实现所述的方法。
本发明的有益效果是本发明基于新版内核的reset framework实现了片上reset控制器的驱动,遵守设备模型、面向对象设计思想,实现了系统单一硬件模块的独立复位,同时兼顾了系统整体复位的情况。
具体实施方式
下面对本发明的较佳实施例进行详细阐述。以下实施例仅用于更加清楚地说明本发明的技术方案,而不能以此来限制本发明的保护范围。
本实施一实施例中,Linux下的reset framework提供了如下的机制(基于devicetree):
1)首先,提供描述系统中reset资源的方法,这样consumer可以基于这种描述在自己的dts node中引用所需的reset信号。
2)然后,consumer设备在自己的dts node中使用“resets”、“reset-names”等关键字声明所需的reset的资源,例如(“resets”字段的具体格式由reset provider决定”):
device{
resets=<&rst 20>;
reset-names=″reset″;
};
3)最后,consumer driver在需要的时候,可以调用下面的API复位自己(具体可参考“include/linux/reset.h”):
3-a)只有一个reset信号的话,可以使用最简单的device_reset API
int device_reset(struct device*dev);
3-b)如果需要更为复杂的控制(例如有多个reset信号、需要控制处于reset状态的长度的等),可以使用稍微复杂的API
/*通过reset_control_get或者devm_reset_control_get获得reset句柄*/
struct reset_control*reset_control_get(struct device*dev,const char*id);
void reset_control_put(struct reset_control*rstc);
struct reset_control*devm_reset_control_get(struct device*dev,constchar*id);
/*通过reset_control_reset进行复位,或者通过reset_control_assert使设备处于复位生效状态,通过reset_control_deassert使复位失效*/
int reset_control_reset(struct reset_control*rstc);
int reset_control_assert(struct reset_control*rstc);
int reset_control_deassert(struct reset_control*rstc);
本实施一实施例中,kernel为reset provider提供的API位于“include/linux/reset- controller.h”中:创建并填充reset controller设备(struct reset_controller_dev),并调用相应的接口(reset_controller_register/reset_controller_unregister)注册或者注销之。
reset controller的抽象:
struct reset_controller_dev{
struct reset_control_ops*ops;
struct module*owner;
struct list_head list;
struct device_node*of_node;
int of_reset_n_cells;
int(*of_xlate)(struct reset_controller_dev*rcdev,const struct of_phandle_args*reset_spec);
unsigned int nr_resets;
};
ops提供reset操作的实现,基本上是reset provider的所有工作量。
of_xlate和of_reset_n_cells用于解析consumer device dts node中的“resets=;”节点,如果reset controller比较简单(仅仅是线性的索引),可以不实现,使用resetframework提供的简单版本----of_reset_simple_xlate即可。
nr_resets,该reset controller所控制的reset信号的个数。
其它字段内部使用,provider不需要关心。
struct reset_control_ops也比较单纯,如下:
struct reset_control_ops{
int(*reset)(struct reset_controller_dev*rcdev,unsigned long id);
int(*assert)(struct reset_controller_dev*rcdev,unsigned long id);
int(*deassert)(struct reset_controller_dev*rcdev,unsigned long id);
};
reset可控制设备完成一次完整的复位过程。
assert和deassert分别控制设备reset状态的生效和失效。
本发明实施例中,基于reset framework实现的reset平台驱动实例如下:
1.核心结构体再封装
struct lpc18xx_rgu_data{
struct reset_controller_dev rcdev;
struct clk*clk_delay;
struct clk*clk_reg;
void__iomem*base;
spinlock_t lock;
u32delay_us;
};
其中,rcdev是reset framework定义的片上复位控制器抽象,*clk_delay、*clk_reg、 delay_us是与延时复位相关的定义,base是复位控制器的寄存器基地址。
2.probe函数实现
probe函数负责完成硬件初始化,平台资源获取,以及复位控制器的注册工作,具体说明如下:
rc=devm_kzalloc(&pdev->dev,sizeof(*rc),GFP_KERNEL);申请私有封装的内存
res=platform_get_resource(pdev,IORESOURCE_MEM,0);获取平台资源
rc->base=devm_ioremap_resource(&pdev->dev,res);映射I/O基地址
rc->clk_reg=devm_clk_get(&pdev->dev,″reg″);
rc->clk_delay=devm_clk_get(&pdev->dev,″delay″);
ret=clk_prepare_enable(rc->clk_reg);
ret=clk_prepare_enable(rc->clk_delay);时钟资源获取及使能
rc->rcdev.owner=THIS_MODULE;
rc->rcdev.nr_resets=64;
rc->rcdev.ops=&lpc18xx_rgu_ops;
rc->rcdev.of_node=pdev->dev.of_node;
platform_set_drvdata(pdev,rc);初始化私有封装并将其设置为平台数据
ret=reset_controller_register(&rc->rcdev);注册初始化好的复位控制器
ret=register_restart_handler(&lpc18xx_rgu_restart_nb);注册通知链回调函数到 restart_handler_list链表,系统复位时调用。
术语“计算机系统”包括根据上述实施方式实现系统或执行方法的硬件、软件和数据存储装置。例如,计算机系统可包括中央处理单元(CPU)、输入装置、输出装置和数据存储。优选地,计算机系统具有用于提供视觉输出显示的监视器(例如,商业处理设计)。数据存储可包括RAM、盘驱动器或其它计算机可读介质。计算机系统可包括通过网络连接的多个计算装置,并且能够经过该网络彼此通信。
术语“计算机可读介质”包括(但不限于)可直接由计算机或者计算机系统读取或者访问的任何非临时媒体或介质。所述介质可包括(但不限于)诸如软盘、硬盘存储媒体和磁带的磁存储介质;诸如光盘或者CD-ROM的光学存储介质;诸如存储器的电存储介质,包括RAM、 ROM和闪速存储器;以及以上的混合和组合,诸如磁/光学存储介质。
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。

Claims (5)

1.基于reset framework实现的reset平台驱动的实现方法,其特征在于:包括如下内容:1)核心结构体再封装;2)probe函数负责完成硬件初始化,平台资源获取,以及复位控制器的注册工作。
2.根据权利要求1所述的实现方法,其特征在于:probe函数实现的内容进一步包括:申请私有封装的内存;获取平台资源;映射I/O基地址;时钟资源获取及使能;初始化私有封装并将其设置为平台数据;注册初始化好的复位控制器;注册通知链回调函数到restart_handler_list链表,系统复位时调用。
3.根据权利要求1-2任一项所述的实现方法,其特征在于:reset framework可以实现如下内容:提供描述系统中reset资源的方法;consumer设备在自己的dts node中使用关键字声明所需的reset的资源;consumer driver调用API复位自己。
4.一种计算机存储介质,其上存有计算机程序,该程序被处理器执行以实现权利要求1-3任一项所述的方法。
5.一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序以实现权利要求1-3任一项所述的方法。
CN201711400804.0A 2017-12-21 2017-12-21 一种基于系统硬件模块的独立复位设计与实现 Pending CN108121571A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711400804.0A CN108121571A (zh) 2017-12-21 2017-12-21 一种基于系统硬件模块的独立复位设计与实现

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711400804.0A CN108121571A (zh) 2017-12-21 2017-12-21 一种基于系统硬件模块的独立复位设计与实现

Publications (1)

Publication Number Publication Date
CN108121571A true CN108121571A (zh) 2018-06-05

Family

ID=62231335

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711400804.0A Pending CN108121571A (zh) 2017-12-21 2017-12-21 一种基于系统硬件模块的独立复位设计与实现

Country Status (1)

Country Link
CN (1) CN108121571A (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831350A (zh) * 2018-11-01 2019-05-31 华为技术有限公司 设备信息发送的方法、计算机设备和分布式计算机设备系统
CN110308942A (zh) * 2019-07-05 2019-10-08 武汉斗鱼网络科技有限公司 一种初始化控制器的方法及相关装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101203017A (zh) * 2007-11-28 2008-06-18 中兴通讯股份有限公司 链型远端射频单元业务和通讯可分离复位的方法
CN101297256A (zh) * 2005-10-25 2008-10-29 Nxp股份有限公司 包含复位设施的数据处理装置
US8250351B2 (en) * 2008-12-02 2012-08-21 Arm Limited Synchronization of two independent reset signals
CN205160805U (zh) * 2015-12-03 2016-04-13 首都信息发展股份有限公司 一种无线通信网关

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101297256A (zh) * 2005-10-25 2008-10-29 Nxp股份有限公司 包含复位设施的数据处理装置
CN101203017A (zh) * 2007-11-28 2008-06-18 中兴通讯股份有限公司 链型远端射频单元业务和通讯可分离复位的方法
US8250351B2 (en) * 2008-12-02 2012-08-21 Arm Limited Synchronization of two independent reset signals
CN205160805U (zh) * 2015-12-03 2016-04-13 首都信息发展股份有限公司 一种无线通信网关

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
TIANTAO2012: "emmc 通过reset controller来reset emmc host", 《HTTPS://BLOG.CSDN.NET/TIANTAO2012/ARTICLE/DETAILS/70224394》 *
WOWO: "Linux reset framework", 《HTTP://WWW.WOWOTECH.NET/PM_SUBSYSTEM/RESET_FRAMEWORK.HTML》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831350A (zh) * 2018-11-01 2019-05-31 华为技术有限公司 设备信息发送的方法、计算机设备和分布式计算机设备系统
WO2020088351A1 (zh) * 2018-11-01 2020-05-07 华为技术有限公司 设备信息发送的方法、计算机设备和分布式计算机设备系统
CN110308942A (zh) * 2019-07-05 2019-10-08 武汉斗鱼网络科技有限公司 一种初始化控制器的方法及相关装置
CN110308942B (zh) * 2019-07-05 2021-11-26 武汉斗鱼网络科技有限公司 一种初始化控制器的方法及相关装置

Similar Documents

Publication Publication Date Title
US9460261B2 (en) Computer-implemented verification system for performing a functional verification of an integrated circuit
Dotti et al. On the orientation and magnitude of the black hole spin in galactic nuclei
CN104412224B (zh) 在从低电力状态恢复时处理系统从易失性存储器的重新初始化
Pearson et al. Tidal stream morphology as an indicator of dark matter halo geometry: The case of palomar 5
Yiu The Definitive Guide to ARM® Cortex®-M0 and Cortex-M0+ Processors
Spiliopoulos et al. Introducing DVFS-management in a full-system simulator
WO2014025678A1 (en) Stacked memory device with helper processor
CN206147432U (zh) 一种基于飞腾1500a处理器的台式计算机
Knodel et al. RC3E: provision and management of reconfigurable hardware accelerators in a cloud environment
Knodel et al. Computing framework for dynamic integration of reconfigurable resources in a cloud
CN108121571A (zh) 一种基于系统硬件模块的独立复位设计与实现
Singh et al. A data-constrained model for coronal mass ejections using the graduated cylindrical shell method
CN211956466U (zh) 一种基于飞腾处理器的存储主板
Martins et al. Enabling intelligent unmanned vehicles through XMOS Technology
CN208766658U (zh) 一种服务器系统
Park et al. Developing an ultra-low power RISC-V processor for anomaly detection
Xing Training for'unstable'cnn accelerator: A case study on fpga
Wang et al. Accelerating hybrid and compact neural networks targeting perception and control domains with coarse-grained dataflow reconfiguration
Kaith et al. A technical road map from system verilog to UVM
Wallace et al. Comparison of vendor supplied environmental data collection mechanisms
Valente et al. A Heterogeneous RISC-V Based SoC for Secure Nano-UAV Navigation
US11630935B1 (en) Data traffic injection for simulation of circuit designs
WO2014106780A1 (en) A method and apparatus for scan chain data management
CN203038267U (zh) Pxi控制器和pxi主机
Liu et al. C-Coupler1: A Chinese community coupler for Earth system modelling

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180605

RJ01 Rejection of invention patent application after publication