[linux kernel] RX8025 docking system clock under kernel

Publisher:Susan苏Latest update time:2022-07-13 Source: csdnKeywords:linux  kernel Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

System version: Ubuntu18.04-64


Compiler version: gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)


uboot version: 2018.07-linux4sam_6.0


Board model: at91sama5d3x-xplained


MCU model: sama5d36


RTC model: RX8025T


[Datasheet] RX8025T clock chip interpretation


There are some differences between RX8025T and RX8025SA, mainly in the shift of the time register;


It is a design of Epson, EPSON. This information is very helpful for the kernel to find the corresponding driver.


1. Start the board to view the kernel startup information


The system clock rtc, as can be seen from the printed information, uses the rtc register inside the cpu, rather than the external RX8025 chip, as rtc0 for the system to read and call;


qt1070 1-001b: ID 206 not supported

at91_rtc fffffeb0.rtc: registered as rtc0

at91_rtc fffffeb0.rtc: AT91 Real Time Clock driver.

i2c /dev entries driver


The system calls /dev/rtc0, which is a soft link, is equivalent to calling the rtc register inside at91, which is not what we want.


2. If you don't know which file is the function that calls the internal rtc, there is a very simple method. Go to the rtc folder and see which file is compiled into a .o file.


cd drivers/rtc


ls *.o


The file linux-at91-linux-4.19-at91driversrtcrtc-at91rm9200.c has a corresponding .o;


Open the Makefile

It can be seen that the compilation is selected through the macro CONFIG_RTC_DRV_AT91RM9200;


3. Make this macro ineffective, modify the default configuration file, and perform cropping


arch/arm/configs/sama5_defconfig


CONFIG_RTC_DRV_AT91RM9200=y


to:


# CONFIG_RTC_DRV_AT91RM9200 is not set


4. Enter the graphical configuration interface and select EPSON's 8025 chip selection


make menuconfig


Device Drivers —>


[*] Real Time Clock --->

insert image description here

insert image description here

You can see that the routines given on the official website are for Epson RX-8025SA/NB. If the chip you are using happens to be RX-8025SA, you can use it directly. The chip of RX-8025T needs to be modified, otherwise the time will always be wrong. You will find that it will be messed up after a few hours after calibration.


Save and exit, compile directly, and the 8025 driver will be debugged.


The driver file is in drivers/rtc/rtc-8025.c.

insert image description here

Test it by calling the function in the file system

insert image description here

Read time hwclock -r


Set time hwclock -w


You can also add some print information in the driver to view the corresponding register data.

insert image description here

insert image description here

The difference between the two chips lies mainly in the read data of the register;


The following modifications have been made to the register read operation:

insert image description here

Keywords:linux  kernel Reference address:[linux kernel] RX8025 docking system clock under kernel

Previous article:[Linux driver] Module loading RTX8025 driver
Next article:[linux kernel] Control IO port timing output during kernel startup

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号