- From: Gavin Schenk <g.schenk@eckelmann.de>
- Date: Tue, 26 Mar 2019 12:31:50 +0100
- Subject: [PATCH] eag-mx25/board: pcf2127 fixup OSF
- ---
- arch/arm/boards/eag-mx25/board.c | 46 ++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 46 insertions(+)
- diff --git a/arch/arm/boards/eag-mx25/board.c b/arch/arm/boards/eag-mx25/board.c
- index f581454c1a8f..b2ef66a80649 100644
- --- a/arch/arm/boards/eag-mx25/board.c
- +++ b/arch/arm/boards/eag-mx25/board.c
- @@ -11,6 +11,7 @@
- #include <mach/imxfb.h>
- #include <mach/devices-imx25.h>
- #include <gpio.h>
- +#include <i2c/i2c.h>
- static int imx25_eag_pmic_init(void)
- {
- @@ -27,6 +28,51 @@ static int imx25_eag_pmic_init(void)
- }
- late_initcall(imx25_eag_pmic_init);
- +static int imx25_eag_handle_pcf2127_osf(void)
- +{
- + int ret=0;
- + struct i2c_adapter *adapter = NULL;
- + struct i2c_client client;
- + u8 buf[0x1f];
- + u8 value;
- +
- + adapter = i2c_get_adapter(0);
- + if (!adapter) {
- + return -ENODEV;
- + }
- +
- + client.adapter = adapter;
- + client.addr = 0x51;
- +
- + ret = i2c_read_reg(&client, 0x1b, &buf[0], 0x1f);
- + if (ret != 0x1f)
- + return 1;
- +
- + // If OSF is not set we are done
- + if( !(buf[0x3] & 0x80) )
- + return 0;
- +
- + printf("pcf2127 OSF bit is set\n");
- +
- + // Year 1980, RTC must be set by user
- + if( buf[0xa] == 0x80 ){
- + printf("RTC must be set by user in linux\n");
- + return 2;
- + }
- +
- + // We hope the time is accurate and reset OSF bit
- + value = buf[0x3];
- + value &=~0x80;
- + ret = i2c_write_reg(&client,0x3,&value,1);
- + if ( ret != 1 ){
- + return 3;
- + }
- +
- + printf("pcf2127 OSF bit fixed successfully\n");
- + return 0;
- +}
- +late_initcall(imx25_eag_handle_pcf2127_osf);
- +
- static const iomux_v3_cfg_t imx25_eag_ci4000_lcdc_pins[] = {
- MX25_PAD_LD0__LD0,
- MX25_PAD_LD1__LD1,
[PATCH] eag-mx25/board: pcf2127 fixup OSF
Posted by Anonymous on Tue 26th Mar 2019 11:33
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.