rtc: ds1337: Add driver model support
Subsystems (2)
PATCH v3 1/27 rtc: ds1337: Add driver model support
From: Biwen Li <[email protected]>
Add support of driver model of ds1337
---
Change in v3:
- fix checkpatch warning
Change in v2:
- none
drivers/rtc/ds1337.c | 128 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+)
drivers/rtc/ds1337.c +128 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2001-2008 +* Copyright 2020 NXP * Wolfgang Denk, DENX Software Engineering, wd at denx.de. * Keith Outwater, keith_outwater at mvis.com` */
@@ -12,6 +13,7 @@#include <common.h> #include <command.h> +#include <dm.h> #include <rtc.h> #include <i2c.h>
@@ -60,6 +62,7 @@#define RTC_STAT_BIT_OSF 0x80/* Oscillator stop flag */ +#if !CONFIG_IS_ENABLED (DM_RTC )static uchar rtc_read (uchar reg);static void rtc_write (uchar reg,uchar val);
@@ -188,3 +191,128 @@ static void rtc_write (uchar reg, uchar val) {i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR , reg, val); } +#else +static uchar rtc_read (struct udevice *dev,uchar reg) +{ +return dm_i2c_reg_read (dev, reg); +} + +static void rtc_write (struct udevice *dev,uchar reg,uchar val) +{ +dm_i2c_reg_write (dev, reg, val); +} + +static int ds1337_rtc_get (struct udevice *dev,struct rtc_time *tmp) +{ +int rel =0 ; +uchar sec, min, hour, mday, wday, mon_cent, year, control, status; + + control =rtc_read (dev,RTC_CTL_REG_ADDR ); + status =rtc_read (dev,RTC_STAT_REG_ADDR ); + sec =rtc_read (dev,RTC_SEC_REG_ADDR ); + min =rtc_read (dev,RTC_MIN_REG_ADDR ); + hour =rtc_read (dev,RTC_HR_REG_ADDR ); + wday =rtc_read (dev,RTC_DAY_REG_ADDR ); + mday =rtc_read (dev,RTC_DATE_REG_ADDR ); + mon_cent =rtc_read (dev,RTC_MON_REG_ADDR ); + year =rtc_read (dev,RTC_YR_REG_ADDR ); + +/* No century bit, assume year 2000 */ +#ifdef CONFIG_RTC_DS1388 + mon_cent |=0x80 ; +#endif + +debug ("Get RTC year: %02x mon/cent: %02x mday: %02x wday: %02x\n" , + year, mon_cent, mday, wday); +debug ("hr: %02x min: %02x sec: %02x control: %02x status: %02x\n" , + hour, min, sec, control, status); + +if (status &RTC_STAT_BIT_OSF ) { +printf ("### Warning: RTC oscillator has stopped\n" ); +/* clear the OSF flag */ +rtc_write (dev,RTC_STAT_REG_ADDR , +rtc_read (dev,RTC_STAT_REG_ADDR ) & ~RTC_STAT_BIT_OSF ); + rel =-1 ; + } + + tmp->tm_sec =bcd2bin (sec &0x7F ); + tmp->tm_min =bcd2bin (min &0x7F ); + tmp->tm_hour =bcd2bin (hour &0x3F ); + tmp->tm_mday =bcd2bin (mday &0x3F ); + tmp->tm_mon =bcd2bin (mon_cent &0x1F ); + tmp->tm_year =bcd2bin (year) + ((mon_cent &0x80 ) ?2000 :1900 ); + tmp->tm_wday =bcd2bin ((wday -1 ) &0x07 ); + tmp->tm_yday =0 ; + tmp->tm_isdst =0 ; + +debug ("Get DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n" , + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + +return rel; +} + +static int ds1337_rtc_set (struct udevice *dev,const struct rtc_time *tmp) +{ +uchar century; + +debug ("Set DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n" , + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + +rtc_write (dev,RTC_YR_REG_ADDR ,bin2bcd (tmp->tm_year %100 )); + + century = (tmp->tm_year >=2000 ) ?0x80 :0 ; +rtc_write (dev,RTC_MON_REG_ADDR ,bin2bcd (tmp->tm_mon) | century); + +rtc_write (dev,RTC_DAY_REG_ADDR ,bin2bcd (tmp->tm_wday +1 )); +rtc_write (dev,RTC_DATE_REG_ADDR ,bin2bcd (tmp->tm_mday)); +rtc_write (dev,RTC_HR_REG_ADDR ,bin2bcd (tmp->tm_hour)); +rtc_write (dev,RTC_MIN_REG_ADDR ,bin2bcd (tmp->tm_min)); +rtc_write (dev,RTC_SEC_REG_ADDR ,bin2bcd (tmp->tm_sec)); + +return 0 ; +} + +#ifdef CONFIG_RTC_DS1337_NOOSC +#define RTC_DS1337_RESET_VAL \ + (RTC_CTL_BIT_INTCN | RTC_CTL_BIT_RS1 | RTC_CTL_BIT_RS2) +#else +#define RTC_DS1337_RESET_VAL (RTC_CTL_BIT_RS1 | RTC_CTL_BIT_RS2) +#endif +static int ds1337_rtc_reset (struct udevice *dev) +{ +#ifdef CONFIG_RTC_DS1337 +rtc_write (dev,RTC_CTL_REG_ADDR ,RTC_DS1337_RESET_VAL ); +#elif definedCONFIG_RTC_DS1388 +rtc_write (dev,RTC_CTL_REG_ADDR ,0x0 );/* hw default */ +#endif +#ifdef CONFIG_RTC_DS1339_TCR_VAL +rtc_write (dev,RTC_TC_REG_ADDR ,CONFIG_RTC_DS1339_TCR_VAL ); +#endif +#ifdef CONFIG_RTC_DS1388_TCR_VAL +rtc_write (dev,RTC_TC_REG_ADDR ,CONFIG_RTC_DS1388_TCR_VAL ); +#endif +return 0 ; +} + +static const struct rtc_ops ds1337_rtc_ops = { + .get = ds1337_rtc_get, + .set = ds1337_rtc_set, + .reset = ds1337_rtc_reset, +}; + +static const struct udevice_id ds1337_rtc_ids[] = { + { .compatible ="ds1337" }, + { .compatible ="ds1338" }, + { .compatible ="ds1338" }, + { } +}; + +U_BOOT_DRIVER (rtc_ds1337) = { + .name ="rtc-ds1337" , + .id =UCLASS_RTC , + .of_match = ds1337_rtc_ids, + .ops = &ds1337_rtc_ops, +}; +#endif
Signature · 1 line
2.17.1
PATCH v3 2/27 rtc: pt7c4338: Add driver model support
From: Biwen Li <[email protected]>
Add support of driver model of pt7c4338
---
Change in v3:
- fix checkpatch warning
Change in v2:
- none
drivers/rtc/pt7c4338.c | 100 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+)
drivers/rtc/pt7c4338.c +100 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2010 Freescale Semiconductor, Inc. +* Copyright 2020 NXP * * Author: Priyanka Jain <[email protected]> */
@@ -19,6 +20,7 @@#include <common.h> #include <command.h> +#include <dm.h> #include <rtc.h> #include <i2c.h>
@@ -46,6 +48,7 @@#define RTC_PT7C4338_RESET_VAL \ (RTC_CTL_STAT_BIT_RS0 | RTC_CTL_STAT_BIT_RS1 | RTC_CTL_STAT_BIT_OUT) +#if !CONFIG_IS_ENABLED (DM_RTC )/****** Helper functions ****************************************/ static u8 rtc_read (u8 reg) {
@@ -125,3 +128,100 @@ void rtc_reset(void)rtc_write (RTC_SEC_REG_ADDR ,0x00 );/* clearing Clock Halt */ rtc_write (RTC_CTL_STAT_REG_ADDR ,RTC_PT7C4338_RESET_VAL ); } +#else +static u8 rtc_read (struct udevice *dev,u8 reg) +{ +return dm_i2c_reg_read (dev, reg); +} + +static void rtc_write (struct udevice *dev,u8 reg,u8 val) +{ +dm_i2c_reg_write (dev, reg, val); +} + +static int pt7c4338_rtc_get (struct udevice *dev,struct rtc_time *tmp) +{ +int ret =0 ; +u8 sec, min, hour, mday, wday, mon, year, ctl_stat; + + ctl_stat =rtc_read (dev,RTC_CTL_STAT_REG_ADDR ); + sec =rtc_read (dev,RTC_SEC_REG_ADDR ); + min =rtc_read (dev,RTC_MIN_REG_ADDR ); + hour =rtc_read (dev,RTC_HR_REG_ADDR ); + wday =rtc_read (dev,RTC_DAY_REG_ADDR ); + mday =rtc_read (dev,RTC_DATE_REG_ADDR ); + mon =rtc_read (dev,RTC_MON_REG_ADDR ); + year =rtc_read (dev,RTC_YR_REG_ADDR ); +debug ("Get RTC year: %02x mon: %02x mday: %02x wday: %02x\n" , + year, mon, mday, wday); +debug ("hr: %02x min: %02x sec: %02x control_status: %02x\n" , + hour, min, sec, ctl_stat); + +if (ctl_stat &RTC_CTL_STAT_BIT_OSF ) { +printf ("### Warning: RTC oscillator has stopped\n" ); +/* clear the OSF flag */ +rtc_write (dev,RTC_CTL_STAT_REG_ADDR , +rtc_read (dev, +RTC_CTL_STAT_REG_ADDR ) + & ~RTC_CTL_STAT_BIT_OSF ); + ret =-1 ; + } + + tmp->tm_sec =bcd2bin (sec &0x7F ); + tmp->tm_min =bcd2bin (min &0x7F ); + tmp->tm_hour =bcd2bin (hour &0x3F ); + tmp->tm_mday =bcd2bin (mday &0x3F ); + tmp->tm_mon =bcd2bin (mon &0x1F ); + tmp->tm_year =bcd2bin (year) +2000 ; + tmp->tm_wday =bcd2bin ((wday -1 ) &0x07 ); + tmp->tm_yday =0 ; + tmp->tm_isdst =0 ; +debug ("Get DATE: %4d-%02d-%02d [wday=%d] TIME: %2d:%02d:%02d\n" , + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + +return ret; +} + +static int pt7c4338_rtc_set (struct udevice *dev,const struct rtc_time *tmp) +{ +debug ("Set DATE: %4d-%02d-%02d [wday=%d] TIME: %2d:%02d:%02d\n" , + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + +rtc_write (dev,RTC_YR_REG_ADDR ,bin2bcd (tmp->tm_year %100 )); +rtc_write (dev,RTC_MON_REG_ADDR ,bin2bcd (tmp->tm_mon)); +rtc_write (dev,RTC_DAY_REG_ADDR ,bin2bcd (tmp->tm_wday +1 )); +rtc_write (dev,RTC_DATE_REG_ADDR ,bin2bcd (tmp->tm_mday)); +rtc_write (dev,RTC_HR_REG_ADDR ,bin2bcd (tmp->tm_hour)); +rtc_write (dev,RTC_MIN_REG_ADDR ,bin2bcd (tmp->tm_min)); +rtc_write (dev,RTC_SEC_REG_ADDR ,bin2bcd (tmp->tm_sec)); + +return 0 ; +} + +static int pt7c4338_rtc_reset (struct udevice *dev) +{ +rtc_write (dev,RTC_SEC_REG_ADDR ,0x00 );/* clearing Clock Halt */ +rtc_write (dev,RTC_CTL_STAT_REG_ADDR ,RTC_PT7C4338_RESET_VAL ); +return 0 ; +} + +static const struct rtc_ops pt7c4338_rtc_ops = { + .get = pt7c4338_rtc_get, + .set = pt7c4338_rtc_set, + .reset = pt7c4338_rtc_reset, +}; + +static const struct udevice_id pt7c4338_rtc_ids[] = { + { .compatible ="pericom,pt7c4338" }, + { } +}; + +U_BOOT_DRIVER (rtc_pt7c4338) = { + .name ="rtc-pt7c4338" , + .id =UCLASS_RTC , + .of_match = pt7c4338_rtc_ids, + .ops = &pt7c4338_rtc_ops, +}; +#endif
Signature · 1 line
2.17.1
PATCH v3 3/27 powerpc: create dts component of i2c to build up an SoC
In reply to Biwen LiFrom: Biwen Li <[email protected]>
Provide a common i2c components that we can utilize to build up the various device tree.
---
Change in v3:
- none
Change in v2:
- none
arch/powerpc/dts/pq3-i2c-0.dtsi | 15 +++++++++++++++ arch/powerpc/dts/pq3-i2c-1.dtsi | 15 +++++++++++++++ arch/powerpc/dts/qoriq-i2c-0.dtsi | 25 +++++++++++++++++++++++++ arch/powerpc/dts/qoriq-i2c-1.dtsi | 25 +++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 arch/powerpc/dts/pq3-i2c-0.dtsi create mode 100644 arch/powerpc/dts/pq3-i2c-1.dtsi create mode 100644 arch/powerpc/dts/qoriq-i2c-0.dtsi create mode 100644 arch/powerpc/dts/qoriq-i2c-1.dtsi
arch/powerpc/dts/pq3-i2c-0.dtsi new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * PQ3 I2C Device Tree stub + * + * Copyright 2020 NXP + */ +i2c at 3000 { + #address-cells = <1>; + #size-cells = <0>; + cell-index = <0>; + compatible = "fsl-i2c"; + u-boot,dm-pre-reloc; + reg = <0x3000 0x100>; + interrupts = <43 2 0 0>; +};
arch/powerpc/dts/pq3-i2c-1.dtsi new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * PQ3 I2C Device Tree stub + * + * Copyright 2020 NXP + */ +i2c at 3100 { + #address-cells = <1>; + #size-cells = <0>; + cell-index = <1>; + compatible = "fsl-i2c"; + u-boot,dm-pre-reloc; + reg = <0x3100 0x100>; + interrupts = <43 2 0 0>; +};
arch/powerpc/dts/qoriq-i2c-0.dtsi new file +25 -0
@@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * QorIQ I2C Device Tree stub + * + * Copyright 2020 NXP + */ +i2c0: i2c at 118000 { + #address-cells = <1>; + #size-cells = <0>; + cell-index = <0>; + compatible = "fsl-i2c"; + u-boot,dm-pre-reloc; + reg = <0x118000 0x100>; + interrupts = <38 2 0 0>; +}; + +i2c1: i2c at 118100 { + #address-cells = <1>; + #size-cells = <0>; + cell-index = <1>; + compatible = "fsl-i2c"; + u-boot,dm-pre-reloc; + reg = <0x118100 0x100>; + interrupts = <38 2 0 0>; +};
arch/powerpc/dts/qoriq-i2c-1.dtsi new file +25 -0
@@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * QorIQ I2C Device Tree stub + * + * Copyright 2020 NXP + */ +i2c2: i2c at 119000 { + #address-cells = <1>; + #size-cells = <0>; + cell-index = <2>; + compatible = "fsl-i2c"; + u-boot,dm-pre-reloc; + reg = <0x119000 0x100>; + interrupts = <39 2 0 0>; +}; + +i2c3: i2c at 119100 { + #address-cells = <1>; + #size-cells = <0>; + cell-index = <3>; + compatible = "fsl-i2c"; + u-boot,dm-pre-reloc; + reg = <0x119100 0x100>; + interrupts = <39 2 0 0>; +};
Signature · 1 line
2.17.1
PATCH v3 4/27 dm: powerpc: P5040DS: add i2c DM support
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This supports i2c DM for board P5040DS
---
Change in v3:
- none
Change in v2:
- none
arch/powerpc/dts/p5040.dtsi | 5 ++++- include/configs/corenet_ds.h | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-)
arch/powerpc/dts/p5040.dtsi +4 -1
@@ -3,7 +3,7 @@ * P5040 Silicon/SoC Device Tree Source (pre include) * * Copyright 2012 - 2015 Freescale Semiconductor Inc. - * Copyright 2019 NXP + * Copyright 2019-2020 NXP */ /dts-v1/;
@@ -85,6 +85,9 @@ reg = <0x114000 0x1000>; clock-frequency = <0>; }; + + /include/ "qoriq-i2c-0.dtsi" + /include/ "qoriq-i2c-1.dtsi" }; pcie at ffe200000 {
include/configs/corenet_ds.h +7 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2009-2012 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ /*
@@ -276,14 +277,19 @@#define CONFIG_SYS_NS16550_COM4 (CONFIG_SYS_CCSRBAR+0x11D600)/* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SPEED 400000#define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C_OFFSET 0x118000#define CONFIG_SYS_FSL_I2C2_SPEED 400000#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_OFFSET 0x118100 +#else +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif +#define CONFIG_SYS_I2C_FSL /* * RapidIO
Signature · 1 line
2.17.1
PATCH v3 5/27 configs: P5040DS: enable DM_I2C
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enable DM_I2C in P5040DS defconfigs,
except P5040DS SECURE_BOOT defconfigs
---
Change in v3:
- none
Change in v2:
- none
configs/P5040DS_NAND_defconfig | 1 + configs/P5040DS_SDCARD_defconfig | 1 + configs/P5040DS_SPIFLASH_defconfig | 1 + configs/P5040DS_defconfig | 1 + 4 files changed, 4 insertions(+)
configs/P5040DS_NAND_defconfig +1 -0
@@ -62,3 +62,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P5040DS_SDCARD_defconfig +1 -0
@@ -60,3 +60,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P5040DS_SPIFLASH_defconfig +1 -0
@@ -61,3 +61,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P5040DS_defconfig +1 -0
@@ -59,3 +59,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
Signature · 1 line
2.17.1
PATCH v3 6/27 dm: powerpc: P1020: add i2c DM support
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This supports i2c DM for SoC P1020
---
Change in v3:
- none
Change in v2:
- none
arch/powerpc/dts/p1020-post.dtsi | 2 ++ board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 24 ++++++++++++++++++++- include/configs/P1022DS.h | 4 +++- include/configs/p1_p2_rdb_pc.h | 9 +++++++- 4 files changed, 36 insertions(+), 3 deletions(-)
arch/powerpc/dts/p1020-post.dtsi +2 -0
@@ -44,6 +44,8 @@ clock-frequency = <0>; }; + /include/ "pq3-i2c-0.dtsi" + /include/ "pq3-i2c-1.dtsi" }; /* PCIe controller base address 0x9000 */
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +23 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2010-2011, 2013 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ #include <common.h>
@@ -227,6 +228,7 @@ int checkboard(void)struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE );ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);u8 in, out, io_config, val; +int bus_num =CONFIG_SYS_SPD_BUS_NUM ; printf("Board: %s CPLD: V%d.%d PCBA: V%d.0\n", CONFIG_BOARDNAME, in_8(&cpld_data->cpld_rev_major) & 0x0F,
@@ -234,7 +236,26 @@ int checkboard(void) in_8(&cpld_data->pcba_rev) & 0x0F);/* Initialize i2c early for rom_loc and flash bank information */ -i2c_set_bus_num (CONFIG_SYS_SPD_BUS_NUM ); +#if defined(CONFIG_DM_I2C ) +struct udevice *dev; +int ret; + + ret =i2c_get_chip_for_busnum (bus_num,CONFIG_SYS_I2C_PCA9557_ADDR , +1 , &dev); +if (ret) { +printf ("%s: Cannot find udev for a bus %d\n" , __func__, + bus_num); +return -ENXIO ; + } + +if (dm_i2c_read (dev,0 , &in,1 ) <0 || +dm_i2c_read (dev,1 , &out,1 ) <0 || +dm_i2c_read (dev,3 , &io_config,1 ) <0 ) { +printf ("Error reading i2c boot information!\n" ); +return 0 ;/* Don't want to hang() on this error */ + } +#else /* Non DM I2C support - will be removed */ +i2c_set_bus_num (bus_num); if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 || i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 ||
@@ -242,6 +263,7 @@ int checkboard(void)printf ("Error reading i2c boot information!\n" ); return 0; /* Don't want to hang() on this error */ } +#endif val = (in & io_config) | (out & (~io_config));
include/configs/P1022DS.h +3 -1
@@ -359,8 +359,8 @@#endif /* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SPEED 400000#define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C_OFFSET 0x3000
@@ -368,6 +368,8 @@#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_OFFSET 0x3100#define CONFIG_SYS_I2C_NOPROBES {{0, 0x29}} +#endif +#define CONFIG_SYS_I2C_FSL /* * I2C2 EEPROM
include/configs/p1_p2_rdb_pc.h +8 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2010-2011 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ /*
@@ -537,8 +538,8 @@#define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_CCSRBAR+0x4600)/* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SPEED 400000#define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C_OFFSET 0x3000
@@ -546,6 +547,12 @@#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_OFFSET 0x3100#define CONFIG_SYS_I2C_NOPROBES { {0, 0x29} } +#else +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif + +#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_I2C_EEPROM_ADDR 0x52#define CONFIG_SYS_SPD_BUS_NUM 1/* For rom_loc and flash bank */
Signature · 1 line
2.17.1
PATCH v3 7/27 configs: P1020RDB: enable DM_I2C and DM_RTC
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enables DM_I2C and DM_RTC in P1020RDB defconfigs
---
Change in v3:
- none
Change in v2:
- none
configs/P1020RDB-PC_36BIT_NAND_defconfig | 2 ++ configs/P1020RDB-PC_36BIT_SDCARD_defconfig | 2 ++ configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig | 2 ++ configs/P1020RDB-PC_36BIT_defconfig | 2 ++ configs/P1020RDB-PC_NAND_defconfig | 2 ++ configs/P1020RDB-PC_SDCARD_defconfig | 2 ++ configs/P1020RDB-PC_SPIFLASH_defconfig | 2 ++ configs/P1020RDB-PC_defconfig | 2 ++ configs/P1020RDB-PD_NAND_defconfig | 2 ++ configs/P1020RDB-PD_SDCARD_defconfig | 2 ++ configs/P1020RDB-PD_SPIFLASH_defconfig | 2 ++ configs/P1020RDB-PD_defconfig | 2 ++ 12 files changed, 24 insertions(+)
configs/P1020RDB-PC_36BIT_NAND_defconfig +2 -0
@@ -82,3 +82,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PC_36BIT_SDCARD_defconfig +2 -0
@@ -77,3 +77,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig +2 -0
@@ -79,3 +79,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PC_36BIT_defconfig +2 -0
@@ -66,3 +66,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PC_NAND_defconfig +2 -0
@@ -81,3 +81,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PC_SDCARD_defconfig +2 -0
@@ -76,3 +76,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PC_SPIFLASH_defconfig +2 -0
@@ -78,3 +78,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PC_defconfig +2 -0
@@ -65,3 +65,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PD_NAND_defconfig +2 -0
@@ -85,3 +85,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PD_SDCARD_defconfig +2 -0
@@ -80,3 +80,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PD_SPIFLASH_defconfig +2 -0
@@ -82,3 +82,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1020RDB-PD_defconfig +2 -0
@@ -69,3 +69,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
Signature · 1 line
2.17.1
PATCH v3 8/27 dts: powerpc: P2020RDB: add i2c node
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This adds i2c node for board P2020RDB
---
Change in v3:
- none
Change in v2:
- none
arch/powerpc/dts/p2020-post.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/dts/p2020-post.dtsi +3 -0
@@ -37,6 +37,9 @@ /* Filled in by U-Boot */ clock-frequency = <0>; }; + + /include/ "pq3-i2c-0.dtsi" + /include/ "pq3-i2c-1.dtsi" }; /* PCIe controller base address 0x8000 */
Signature · 1 line
2.17.1
PATCH v3 9/27 configs: P2020RDB: enable DM_I2C and DM_RTC
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enables DM_I2C and DM_RTC in P2020RDB defconfigs
---
Change in v3:
- none
Change in v2:
- none
configs/P2020RDB-PC_36BIT_NAND_defconfig | 2 ++ configs/P2020RDB-PC_36BIT_SDCARD_defconfig | 2 ++ configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig | 2 ++ configs/P2020RDB-PC_36BIT_defconfig | 2 ++ configs/P2020RDB-PC_NAND_defconfig | 2 ++ configs/P2020RDB-PC_SDCARD_defconfig | 2 ++ configs/P2020RDB-PC_SPIFLASH_defconfig | 2 ++ configs/P2020RDB-PC_defconfig | 2 ++ 8 files changed, 16 insertions(+)
configs/P2020RDB-PC_36BIT_NAND_defconfig +2 -0
@@ -87,3 +87,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P2020RDB-PC_36BIT_SDCARD_defconfig +2 -0
@@ -82,3 +82,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig +2 -0
@@ -84,3 +84,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P2020RDB-PC_36BIT_defconfig +2 -0
@@ -71,3 +71,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P2020RDB-PC_NAND_defconfig +2 -0
@@ -86,3 +86,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P2020RDB-PC_SDCARD_defconfig +2 -0
@@ -81,3 +81,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P2020RDB-PC_SPIFLASH_defconfig +2 -0
@@ -83,3 +83,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P2020RDB-PC_defconfig +2 -0
@@ -70,3 +70,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
Signature · 1 line
2.17.1
PATCH v3 10/27 dm: powerpc: P2041RDB: add i2c DM support
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This supports i2c DM for board P2041RDB
---
Change in v3:
- none
Change in v2:
- none
arch/powerpc/dts/p2041.dtsi | 5 ++++- include/configs/P2041RDB.h | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
arch/powerpc/dts/p2041.dtsi +4 -1
@@ -3,7 +3,7 @@ * P2041 Silicon/SoC Device Tree Source (pre include) * * Copyright 2011 - 2015 Freescale Semiconductor Inc. - * Copyright 2019 NXP + * Copyright 2019-2020 NXP */ /dts-v1/;
@@ -86,6 +86,9 @@ reg = <0x114000 0x1000>; clock-frequency = <0>; }; + + /include/ "qoriq-i2c-0.dtsi" + /include/ "qoriq-i2c-1.dtsi" }; pcie at ffe200000 {
include/configs/P2041RDB.h +8 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2011-2012 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ /*
@@ -267,14 +268,20 @@ unsigned long get_board_sys_clk(unsigned long dummy);#define CONFIG_SYS_NS16550_COM4 (CONFIG_SYS_CCSRBAR+0x11D600)/* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SPEED 400000#define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C_OFFSET 0x118000#define CONFIG_SYS_FSL_I2C2_SPEED 400000#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_OFFSET 0x118100 +#else +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif +#define CONFIG_SYS_I2C_FSL +/* * RapidIO
Signature · 1 line
2.17.1
PATCH v3 11/27 config: P2041RDB: enable DM_I2C
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enables DM_I2C in P2041RDB defconfig, except P2041RDB SRIO_PCIE_BOOT and SECURE_BOOT defconfigs
---
Change in v3:
- none
Change in v2:
- none
configs/P2041RDB_NAND_defconfig | 1 + configs/P2041RDB_SDCARD_defconfig | 1 + configs/P2041RDB_SPIFLASH_defconfig | 1 + configs/P2041RDB_defconfig | 1 + 4 files changed, 4 insertions(+)
configs/P2041RDB_NAND_defconfig +1 -0
@@ -61,3 +61,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P2041RDB_SDCARD_defconfig +1 -0
@@ -60,3 +60,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P2041RDB_SPIFLASH_defconfig +1 -0
@@ -61,3 +61,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P2041RDB_defconfig +1 -0
@@ -59,3 +59,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
Signature · 1 line
2.17.1
PATCH v3 12/27 powerpc: dts: P3041: add i2c node
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This adds i2c node for SoC P3041
---
Change in v3:
- none
Change in v2:
- none
arch/powerpc/dts/p3041.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/dts/p3041.dtsi +3 -1
@@ -3,7 +3,7 @@ * P3041 Silicon/SoC Device Tree Source (pre include) * * Copyright 2010 - 2015 Freescale Semiconductor Inc. - * Copyright 2019 NXP + * Copyright 2019-2020 NXP */ /dts-v1/;
@@ -86,6 +86,8 @@ reg = <0x114000 0x1000>; clock-frequency = <0>; }; + /include/ "qoriq-i2c-0.dtsi" + /include/ "qoriq-i2c-1.dtsi" }; pcie at ffe200000 {
Signature · 1 line
2.17.1
PATCH v3 13/27 configs: P3041DS: enable DM_I2C
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enables DM_I2C in P3041DS defconfigs, except P3041DS SECURE_BOOT and SRIO_PCIE_BOOT defconfig
---
Change in v3:
- none
Change in v2:
- none
configs/P3041DS_NAND_defconfig | 1 + configs/P3041DS_SDCARD_defconfig | 1 + configs/P3041DS_SPIFLASH_defconfig | 1 + configs/P3041DS_defconfig | 1 + 4 files changed, 4 insertions(+)
configs/P3041DS_NAND_defconfig +1 -0
@@ -61,3 +61,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P3041DS_SDCARD_defconfig +1 -0
@@ -60,3 +60,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P3041DS_SPIFLASH_defconfig +1 -0
@@ -61,3 +61,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P3041DS_defconfig +1 -0
@@ -59,3 +59,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
Signature · 1 line
2.17.1
PATCH v3 14/27 powerpc: dts: P4080: add i2c node
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This adds i2c node for SoC P4080
---
Change in v3:
- none
Change in v2:
- none
arch/powerpc/dts/p4080.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/dts/p4080.dtsi +3 -1
@@ -3,7 +3,7 @@ * P4080/P4040 Silicon/SoC Device Tree Source (pre include) * * Copyright 2011 - 2015 Freescale Semiconductor Inc. - * Copyright 2019 NXP + * Copyright 2019-2020 NXP */ /dts-v1/;
@@ -97,6 +97,8 @@ reg = <0x211000 0x1000>; phy_type = "ulpi"; }; + /include/ "qoriq-i2c-0.dtsi" + /include/ "qoriq-i2c-1.dtsi" }; pcie at ffe200000 {
Signature · 1 line
2.17.1
PATCH v3 15/27 configs: P4080DS: enable DM_I2C
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enables DM_I2C in P4080DS defconfigs, except P4080DS SRIO_PCIE_BOOT and SECURE_BOOT defconfigs
---
Change in v3:
- none
Change in v2:
- none
configs/P4080DS_SDCARD_defconfig | 1 + configs/P4080DS_SPIFLASH_defconfig | 1 + configs/P4080DS_defconfig | 1 + 3 files changed, 3 insertions(+)
configs/P4080DS_SDCARD_defconfig +1 -0
@@ -59,3 +59,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P4080DS_SPIFLASH_defconfig +1 -0
@@ -60,3 +60,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/P4080DS_defconfig +1 -0
@@ -58,3 +58,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
Signature · 1 line
2.17.1
PATCH v3 16/27 dm: powerpc: T1023/T1024: add i2c DM support
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This supports i2c DM for SoC T1023/T1024
---
Change in v3:
- fix checkpatch warning
Change in v2:
- none
arch/powerpc/dts/t102x.dtsi | 4 +- board/freescale/t102xqds/t102xqds.c | 95 ++++++++++++++++++++++++++++- board/freescale/t102xqds/t102xqds.h | 3 +- board/freescale/t102xrdb/t102xrdb.c | 71 +++++++++++++++++++-- include/configs/T102xQDS.h | 10 ++- include/configs/T102xRDB.h | 8 ++- 6 files changed, 181 insertions(+), 10 deletions(-)
arch/powerpc/dts/t102x.dtsi +3 -1
@@ -3,7 +3,7 @@ * T102X Silicon/SoC Device Tree Source (pre include) * * Copyright 2013 Freescale Semiconductor Inc. - * Copyright 2019 NXP + * Copyright 2019-2020 NXP */ /dts-v1/;
@@ -75,6 +75,8 @@ reg = <0x114000 0x1000>; clock-frequency = <0>; }; + /include/ "qoriq-i2c-0.dtsi" + /include/ "qoriq-i2c-1.dtsi" }; pcie at ffe240000 {
board/freescale/t102xqds/t102xqds.c +93 -2
129 lines not on this page · raw message
board/freescale/t102xqds/t102xqds.h +2 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ #ifndef __T102x_QDS_H__
@@ -8,6 +9,6 @@void fdt_fixup_board_enet (void *blob);void pci_of_setup (void *blob,bd_t *bd); -int select_i2c_ch_pca9547 (u8 ch); +int select_i2c_ch_pca9547 (u8 ch,int bus_num);#endif
board/freescale/t102xrdb/t102xrdb.c +67 -4
108 lines not on this page · raw message
include/configs/T102xQDS.h +9 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ /*
@@ -437,14 +438,20 @@ unsigned long get_board_ddr_clk(void);#endif /* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL /* Use FSL common I2C driver */ #define CONFIG_SYS_FSL_I2C_SPEED 50000/* I2C speed in Hz */ #define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_SPEED 50000/* I2C speed in Hz */ #define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C_OFFSET 0x118000#define CONFIG_SYS_FSL_I2C2_OFFSET 0x118100 +#else +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif + +#define CONFIG_SYS_I2C_FSL /* Use FSL common I2C driver */ #define I2C_MUX_PCA_ADDR 0x77#define I2C_MUX_PCA_ADDR_PRI 0x77/* Primary Mux*/
@@ -460,6 +467,7 @@ unsigned long get_board_ddr_clk(void);/* LDI/DVI Encoder for display */ #define CONFIG_SYS_I2C_LDI_ADDR 0x38#define CONFIG_SYS_I2C_DVI_ADDR 0x75 +#define CONFIG_SYS_I2C_DVI_BUS_NUM 0/* * RTC configuration
include/configs/T102xRDB.h +7 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ /*
@@ -434,15 +435,20 @@ unsigned long get_board_ddr_clk(void);#endif /* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL /* Use FSL common I2C driver */ #define CONFIG_SYS_FSL_I2C_SPEED 50000/* I2C speed in Hz */ #define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_SPEED 50000/* I2C speed in Hz */ #define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C_OFFSET 0x118000#define CONFIG_SYS_FSL_I2C2_OFFSET 0x118100 +#else +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif +#define CONFIG_SYS_I2C_FSL /* Use FSL common I2C driver */ #define I2C_PCA6408_BUS_NUM 1#define I2C_PCA6408_ADDR 0x20
Signature · 1 line
2.17.1
PATCH v3 17/27 configs: T1024RDB: enable DM_I2C and DM_RTC
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enables DM_I2C and DM_RTC in T1024RDB defconfigs, except T1024RDB SECURE_BOOT defconfig
---
Change in v3:
- none
Change in v2:
- none
configs/T1024RDB_NAND_defconfig | 2 ++ configs/T1024RDB_SDCARD_defconfig | 2 ++ configs/T1024RDB_SPIFLASH_defconfig | 2 ++ configs/T1024RDB_defconfig | 2 ++ 4 files changed, 8 insertions(+)
configs/T1024RDB_NAND_defconfig +2 -0
@@ -81,3 +81,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/T1024RDB_SDCARD_defconfig +2 -0
@@ -78,3 +78,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/T1024RDB_SPIFLASH_defconfig +2 -0
@@ -81,3 +81,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/T1024RDB_defconfig +2 -0
@@ -66,3 +66,5 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
Signature · 1 line
2.17.1
PATCH v3 18/27 dm: ppc: p1010: add i2c DM support
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This supports i2c DM for SoC P1010
---
Change in v3:
- fix checkpatch warning
Change in v2:
- none
board/freescale/p1010rdb/p1010rdb.c | 156 +++++++++++++++++++++++++++- include/configs/P1010RDB.h | 8 +- 2 files changed, 162 insertions(+), 2 deletions(-)
board/freescale/p1010rdb/p1010rdb.c +155 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2010-2011 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ #include <common.h>
@@ -136,6 +137,125 @@ int config_board_mux(int ctrl_type)ccsr_gur_t __iomem *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);u8 tmp; +#ifdef CONFIG_DM_I2C +struct udevice *dev; +int ret; +#if defined(CONFIG_TARGET_P1010RDB_PA ) +struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE ); + + ret =i2c_get_chip_for_busnum (I2C_PCA9557_BUS_NUM , +I2C_PCA9557_ADDR1 ,1 , &dev); +if (ret) { +printf ("%s: Cannot find udev for a bus %d\n" , + __func__,I2C_PCA9557_BUS_NUM ); +return ret; + } +switch (ctrl_type) { +case MUX_TYPE_IFC : + tmp =0xf0 ; +dm_i2c_write (dev,3 , &tmp,1 ); + tmp =0x01 ; +dm_i2c_write (dev,1 , &tmp,1 ); + sd_ifc_mux =MUX_TYPE_IFC ; +clrbits_be32 (&gur->pmuxcr,PMUXCR1_IFC_MASK ); +break ; +case MUX_TYPE_SDHC : + tmp =0xf0 ; +dm_i2c_write (dev,3 , &tmp,1 ); + tmp =0x05 ; +dm_i2c_write (dev,1 , &tmp,1 ); + sd_ifc_mux =MUX_TYPE_SDHC ; +clrsetbits_be32 (&gur->pmuxcr,PMUXCR1_SDHC_MASK , +PMUXCR1_SDHC_ENABLE ); +break ; +case MUX_TYPE_SPIFLASH : +out_8 (&cpld_data->spi_cs0_sel,MUX_CPLD_SPICS0_FLASH ); +break ; +case MUX_TYPE_TDM : +out_8 (&cpld_data->tdm_can_sel,MUX_CPLD_TDM ); +out_8 (&cpld_data->spi_cs0_sel,MUX_CPLD_SPICS0_SLIC ); +break ; +case MUX_TYPE_CAN : +out_8 (&cpld_data->tdm_can_sel,MUX_CPLD_CAN_UART ); +break ; +default : +break ; + } +#elif defined(CONFIG_TARGET_P1010RDB_PB ) + ret =i2c_get_chip_for_busnum (I2C_PCA9557_BUS_NUM , +I2C_PCA9557_ADDR2 ,1 , &dev); +if (ret) { +printf ("%s: Cannot find udev for a bus %d\n" , + __func__,I2C_PCA9557_BUS_NUM ); +return ret; + } +switch (ctrl_type) { +case MUX_TYPE_IFC : +dm_i2c_read (dev,0 , &tmp,1 ); +clrbits_8 (&tmp,0x04 ); +dm_i2c_write (dev,1 , &tmp,1 ); +dm_i2c_read (dev,3 , &tmp,1 ); +clrbits_8 (&tmp,0x04 ); +dm_i2c_write (dev,3 , &tmp,1 ); + sd_ifc_mux =MUX_TYPE_IFC ; +clrbits_be32 (&gur->pmuxcr,PMUXCR1_IFC_MASK ); +break ; +case MUX_TYPE_SDHC : +dm_i2c_read (dev,0 , &tmp,1 ); +setbits_8 (&tmp,0x04 ); +dm_i2c_write (dev,1 , &tmp,1 ); +dm_i2c_read (dev,3 , &tmp,1 ); +clrbits_8 (&tmp,0x04 ); +dm_i2c_write (dev,3 , &tmp,1 ); + sd_ifc_mux =MUX_TYPE_SDHC ; +clrsetbits_be32 (&gur->pmuxcr,PMUXCR1_SDHC_MASK , +PMUXCR1_SDHC_ENABLE ); +break ; +case MUX_TYPE_SPIFLASH : +dm_i2c_read (dev,0 , &tmp,1 ); +clrbits_8 (&tmp,0x80 ); +dm_i2c_write (dev,1 , &tmp,1 ); +dm_i2c_read (dev,3 , &tmp,1 ); +clrbits_8 (&tmp,0x80 ); +dm_i2c_write (dev,3 , &tmp,1 ); +break ; +case MUX_TYPE_TDM : +dm_i2c_read (dev,0 , &tmp,1 ); +setbits_8 (&tmp,0x82 ); +dm_i2c_write (dev,1 , &tmp,1 ); +dm_i2c_read (dev,3 , &tmp,1 ); +clrbits_8 (&tmp,0x82 ); +dm_i2c_write (dev,3 , &tmp,1 ); +break ; +case MUX_TYPE_CAN : +dm_i2c_read (dev,0 , &tmp,1 ); +clrbits_8 (&tmp,0x02 ); +dm_i2c_write (dev,1 , &tmp,1 ); +dm_i2c_read (dev,3 , &tmp,1 ); +clrbits_8 (&tmp,0x02 ); +dm_i2c_write (dev,3 , &tmp,1 ); +break ; +case MUX_TYPE_CS0_NOR : +dm_i2c_read (dev,0 , &tmp,1 ); +clrbits_8 (&tmp,0x08 ); +dm_i2c_write (dev,1 , &tmp,1 ); +dm_i2c_read (dev,3 , &tmp,1 ); +clrbits_8 (&tmp,0x08 ); +dm_i2c_write (dev,3 , &tmp,1 ); +break ; +case MUX_TYPE_CS0_NAND : +dm_i2c_read (dev,0 , &tmp,1 ); +setbits_8 (&tmp,0x08 ); +dm_i2c_write (dev,1 , &tmp,1 ); +dm_i2c_read (dev,3 , &tmp,1 ); +clrbits_8 (&tmp,0x08 ); +dm_i2c_write (dev,3 , &tmp,1 ); +break ; +default : +break ; + } +#endif +#else #if defined(CONFIG_TARGET_P1010RDB_PA )struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE );
@@ -242,6 +362,7 @@ int config_board_mux(int ctrl_type)break ; }i2c_set_bus_num (orig_bus); +#endif #endif return 0 ; }
@@ -250,9 +371,23 @@ int config_board_mux(int ctrl_type)int i2c_pca9557_read (int type) {u8 val; +int bus_num =I2C_PCA9557_BUS_NUM ; -i2c_set_bus_num (I2C_PCA9557_BUS_NUM ); +#ifdef CONFIG_DM_I2C +struct udevice *dev; +int ret; + + ret =i2c_get_chip_for_busnum (bus_num,I2C_PCA9557_ADDR2 ,1 , &dev); +if (ret) { +printf ("%s: Cannot find udev for a bus %d\n" , + __func__, bus_num); +return ret; + } +dm_i2c_read (dev,0 , &val,1 ); +#else +i2c_set_bus_num (bus_num);i2c_read (I2C_PCA9557_ADDR2 ,0 ,1 , &val,1 ); +#endif switch (type) {case I2C_READ_BANK :
@@ -280,11 +415,26 @@ int checkboard(void)printf ("Board: %sRDB-PA, " , cpu->name);#elif defined(CONFIG_TARGET_P1010RDB_PB )printf ("Board: %sRDB-PB, " , cpu->name); +#ifdef CONFIG_DM_I2C +struct udevice *dev; +int ret; + + ret =i2c_get_chip_for_busnum (I2C_PCA9557_BUS_NUM ,I2C_PCA9557_ADDR2 , +1 , &dev); +if (ret) { +printf ("%s: Cannot find udev for a bus %d\n" , __func__, +I2C_PCA9557_BUS_NUM ); +return ret; + } + val =0x0 ;/* no polarity inversion */ +dm_i2c_write (dev,2 , &val,1 ); +#else i2c_set_bus_num (I2C_PCA9557_BUS_NUM );i2c_init (CONFIG_SYS_FSL_I2C_SPEED ,CONFIG_SYS_FSL_I2C_SLAVE ); val =0x0 ;/* no polarity inversion */ i2c_write (I2C_PCA9557_ADDR2 ,2 ,1 , &val,1 );#endif +#endif #ifdef CONFIG_SDCARD /* switch to IFC to read info from CPLD */
@@ -308,7 +458,11 @@ int checkboard(void)case 0xe :puts ("SDHC\n" ); val =0x60 ;/* set pca9557 pin input/output */ +#ifdef CONFIG_DM_I2C +dm_i2c_write (dev,3 , &val,1 ); +#else i2c_write (I2C_PCA9557_ADDR2 ,3 ,1 , &val,1 ); +#endif break ;case 0x5 :config_board_mux (MUX_TYPE_IFC );
include/configs/P1010RDB.h +7 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2010-2011 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ /*
@@ -522,17 +523,22 @@ extern unsigned long get_sdram_size(void);#define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_CCSRBAR+0x4600)/* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SPEED 400000#define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C_OFFSET 0x3000#define CONFIG_SYS_FSL_I2C2_SPEED 400000#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_OFFSET 0x3100 +#else +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif #define I2C_PCA9557_ADDR1 0x18#define I2C_PCA9557_ADDR2 0x19#define I2C_PCA9557_BUS_NUM 0 +#define CONFIG_SYS_I2C_FSL /* I2C EEPROM */ #if defined(CONFIG_TARGET_P1010RDB_PB )
Signature · 1 line
2.17.1
PATCH v3 19/27 configs: P1010: Enable DM_I2C and DM_RTC
In reply to Biwen LiFrom: Biwen Li <[email protected]>
Enable DM_I2C and DM_RTC in P1010RDB defconfigs,
except P1010RDB SECBOOT defconfigs.
---
Change in v3:
- none
Change in v2:
- none
configs/P1010RDB-PA_36BIT_NAND_defconfig | 2 ++ configs/P1010RDB-PA_36BIT_NOR_defconfig | 2 ++ configs/P1010RDB-PA_36BIT_SDCARD_defconfig | 2 ++ configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig | 2 ++ configs/P1010RDB-PA_NAND_defconfig | 2 ++ configs/P1010RDB-PA_NOR_defconfig | 2 ++ configs/P1010RDB-PA_SDCARD_defconfig | 2 ++ configs/P1010RDB-PA_SPIFLASH_defconfig | 2 ++ configs/P1010RDB-PB_36BIT_NAND_defconfig | 2 ++ configs/P1010RDB-PB_36BIT_NOR_defconfig | 2 ++ configs/P1010RDB-PB_36BIT_SDCARD_defconfig | 2 ++ configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig | 2 ++ configs/P1010RDB-PB_NAND_defconfig | 2 ++ configs/P1010RDB-PB_NOR_defconfig | 2 ++ configs/P1010RDB-PB_SDCARD_defconfig | 2 ++ configs/P1010RDB-PB_SPIFLASH_defconfig | 2 ++ 16 files changed, 32 insertions(+)
configs/P1010RDB-PA_36BIT_NAND_defconfig +2 -0
@@ -77,3 +77,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PA_36BIT_NOR_defconfig +2 -0
@@ -58,3 +58,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PA_36BIT_SDCARD_defconfig +2 -0
@@ -71,3 +71,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig +2 -0
@@ -73,3 +73,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PA_NAND_defconfig +2 -0
@@ -76,3 +76,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PA_NOR_defconfig +2 -0
@@ -57,3 +57,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PA_SDCARD_defconfig +2 -0
@@ -70,3 +70,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PA_SPIFLASH_defconfig +2 -0
@@ -72,3 +72,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PB_36BIT_NAND_defconfig +2 -0
@@ -77,3 +77,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PB_36BIT_NOR_defconfig +2 -0
@@ -58,3 +58,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PB_36BIT_SDCARD_defconfig +2 -0
@@ -71,3 +71,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig +2 -0
@@ -73,3 +73,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PB_NAND_defconfig +2 -0
@@ -76,3 +76,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PB_NOR_defconfig +2 -0
@@ -57,3 +57,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PB_SDCARD_defconfig +2 -0
@@ -70,3 +70,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/P1010RDB-PB_SPIFLASH_defconfig +2 -0
@@ -72,3 +72,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y CONFIG_OF_LIBFDT=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
Signature · 1 line
2.17.1
PATCH v3 20/27 dm: ppc: MPC8548CDS: add i2c DM support
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This supports i2c DM for board MPC8548CDS
---
Change in v3:
- none
Change in v2:
- none
board/freescale/common/sys_eeprom.c | 3 ++- include/configs/MPC8548CDS.h | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-)
board/freescale/common/sys_eeprom.c +2 -1
@@ -589,6 +589,7 @@ unsigned int get_cpu_board_revision(void)u8 major;/* 0x04 Board revision, major */ u8 minor;/* 0x05 Board revision, minor */ } be; +int ret;#ifndef CONFIG_DM_I2C i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, CONFIG_SYS_I2C_EEPROM_ADDR_LEN,
@@ -603,7 +604,7 @@ unsigned int get_cpu_board_revision(void)#else ret =i2c_get_chip_for_busnum (0 ,CONFIG_SYS_I2C_EEPROM_ADDR ,CONFIG_SYS_I2C_EEPROM_ADDR_LEN , - &dev) + &dev);#endif if (!ret)dm_i2c_read (dev,0 , (void *)&be,sizeof (be));
include/configs/MPC8548CDS.h +8 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2004, 2007, 2010-2011 Freescale Semiconductor. +* Copyright 2020 NXP */ /*
@@ -304,12 +305,18 @@ extern unsigned long get_clock_freq(void);/* * I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SPEED 400000#define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C_OFFSET 0x3000#define CONFIG_SYS_I2C_NOPROBES { {0, 0x69} } +#else +#define CONFIG_SYS_SPD_BUS_NUM 0 +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif +#define CONFIG_SYS_I2C_FSL /* EEPROM */ #define CONFIG_ID_EEPROM
Signature · 1 line
2.17.1
PATCH v3 21/27 configs: MPC8548CDS: enable DM_I2C
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enables DM_I2C in MPC8548CDS defconfigs
---
Change in v3:
- none
Change in v2:
- none
configs/MPC8548CDS_36BIT_defconfig | 1 + configs/MPC8548CDS_defconfig | 1 + configs/MPC8548CDS_legacy_defconfig | 1 + 3 files changed, 3 insertions(+)
configs/MPC8548CDS_36BIT_defconfig +1 -0
@@ -45,3 +45,4 @@ CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_FSL=y CONFIG_CONS_INDEX=2 CONFIG_SYS_NS16550=y +CONFIG_DM_I2C=y
configs/MPC8548CDS_defconfig +1 -0
@@ -44,3 +44,4 @@ CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_FSL=y CONFIG_CONS_INDEX=2 CONFIG_SYS_NS16550=y +CONFIG_DM_I2C=y
configs/MPC8548CDS_legacy_defconfig +1 -0
@@ -44,3 +44,4 @@ CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_FSL=y CONFIG_CONS_INDEX=2 CONFIG_SYS_NS16550=y +CONFIG_DM_I2C=y
Signature · 1 line
2.17.1
PATCH v3 22/27 dm: ppc: T4240: add i2c DM support
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This supports i2c DM for SoC T4240
---
Change in v3:
- fix checkpatch warning
Change in v2:
- none
arch/powerpc/dts/t4240.dtsi | 5 +- board/freescale/common/vsc3316_3308.c | 258 +++++++++++++++++++++++++- board/freescale/t4qds/t4240qds.c | 45 ++++- include/configs/T4240QDS.h | 13 ++ include/configs/T4240RDB.h | 9 +- 5 files changed, 320 insertions(+), 10 deletions(-)
arch/powerpc/dts/t4240.dtsi +4 -1
@@ -3,7 +3,7 @@ * T4240 Silicon/SoC Device Tree Source (pre include) * * Copyright 2013 Freescale Semiconductor Inc. - * Copyright 2019 NXP + * Copyright 2019-2020 NXP */ /dts-v1/;
@@ -125,6 +125,9 @@ reg = <0x114000 0x1000>; clock-frequency = <0>; }; + + /include/ "qoriq-i2c-0.dtsi" + /include/ "qoriq-i2c-1.dtsi" }; pcie at ffe240000 {
board/freescale/common/vsc3316_3308.c +256 -2
314 lines not on this page · raw message
board/freescale/t4qds/t4240qds.c +39 -6
98 lines not on this page · raw message
include/configs/T4240QDS.h +13 -0
@@ -280,6 +280,19 @@ unsigned long get_board_ddr_clk(void);#endif /* I2C */ +#ifndef CONFIG_DM_I2C +#define CONFIG_SYS_I2C +#else +#undef CONFIG_SYS_I2C +#undef CONFIG_SYS_FSL_I2C2_OFFSET +#undef CONFIG_SYS_FSL_I2C2_SLAVE +#undef CONFIG_SYS_FSL_I2C2_SPEED +#undef CONFIG_SYS_FSL_I2C_SLAVE +#undef CONFIG_SYS_FSL_I2C_SPEED +#undef CONFIG_SYS_FSL_I2C_OFFSET +#endif + +#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SPEED 100000/* I2C speed */ #define CONFIG_SYS_FSL_I2C2_SPEED 100000/* I2C2 speed */ #define I2C_MUX_PCA_ADDR_PRI 0x77/* I2C bus multiplexer,primary */
include/configs/T4240RDB.h +8 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ /*
@@ -159,12 +160,18 @@#define CONFIG_SYS_NS16550_COM4 (CONFIG_SYS_CCSRBAR+0x11D600)/* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C_OFFSET 0x118000#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_OFFSET 0x118100 +#else +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif + +#define CONFIG_SYS_I2C_FSL /* * General PCI
Signature · 1 line
2.17.1
PATCH v3 23/27 configs: T4240RDB: enable DM_I2C
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enable DM_I2C in T4240RDB defconfigs
---
Change in v3:
- none
Change in v2:
- none
configs/T4240RDB_SDCARD_defconfig | 1 + configs/T4240RDB_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/T4240RDB_SDCARD_defconfig +1 -0
@@ -71,3 +71,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/T4240RDB_defconfig +1 -0
@@ -59,3 +59,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
Signature · 1 line
2.17.1
PATCH v3 24/27 dm: powerpc: T2080/T2081: add i2c DM support
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This supports i2c DM for SoC T2080/T2081
---
Change in v3:
- none
Change in v2:
- none
arch/powerpc/dts/t2080.dtsi | 4 +++- board/freescale/t208xqds/t208xqds.c | 19 ++++++++++++++++--- include/configs/T208xQDS.h | 7 ++++++- include/configs/T208xRDB.h | 10 +++++++++- 4 files changed, 34 insertions(+), 6 deletions(-)
arch/powerpc/dts/t2080.dtsi +3 -1
@@ -3,7 +3,7 @@ * T2080/T2081 Silicon/SoC Device Tree Source (pre include) * * Copyright 2013 Freescale Semiconductor Inc. - * Copyright 2018 NXP + * Copyright 2018,2020 NXP */ /dts-v1/;
@@ -96,6 +96,8 @@ sata-number = <2>; sata-fpdma = <0>; }; + /include/ "qoriq-i2c-0.dtsi" + /include/ "qoriq-i2c-1.dtsi" }; pcie at ffe240000 {
board/freescale/t208xqds/t208xqds.c +16 -3
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2009-2013 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ #include <common.h>
@@ -75,11 +76,23 @@ int checkboard(void)return 0 ; } -int select_i2c_ch_pca9547 (u8 ch) +int select_i2c_ch_pca9547 (u8 ch,int bus_num) {int ret; +#ifdef CONFIG_DM_I2C +struct udevice *dev; + + ret =i2c_get_chip_for_busnum (bus_num,I2C_MUX_PCA_ADDR_PRI ,1 , &dev); +if (ret) { +printf ("%s: Cannot find udev for a bus %d\n" , __func__, + bus_num); +return ret; + } + ret =dm_i2c_write (dev,0 , &ch,1 ); +#else ret =i2c_write (I2C_MUX_PCA_ADDR_PRI ,0 ,1 , &ch,1 ); +#endif if (ret) {puts ("PCA: failed to select proper channel\n" );return ret;
@@ -90,7 +103,7 @@ int select_i2c_ch_pca9547(u8 ch)int i2c_multiplexer_select_vid_channel (u8 channel) { -return select_i2c_ch_pca9547 (channel); +return select_i2c_ch_pca9547 (channel,0 ); }int brd_mux_lane_to_slot (void )
@@ -368,7 +381,7 @@ int board_early_init_r(void)printf ("Warning: Adjusting core voltage failed.\n" );brd_mux_lane_to_slot (); -select_i2c_ch_pca9547 (I2C_MUX_CH_DEFAULT ); +select_i2c_ch_pca9547 (I2C_MUX_CH_DEFAULT ,0 );return 0 ; }
include/configs/T208xQDS.h +6 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2011-2013 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ /*
@@ -385,8 +386,8 @@ unsigned long get_board_ddr_clk(void);/* * I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C3_SLAVE 0x7F
@@ -399,6 +400,10 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_SYS_FSL_I2C2_SPEED 100000#define CONFIG_SYS_FSL_I2C3_SPEED 100000#define CONFIG_SYS_FSL_I2C4_SPEED 100000 +#endif + +#define CONFIG_SYS_I2C_FSL +#define I2C_MUX_PCA_ADDR_PRI 0x77/* I2C bus multiplexer,primary */ #define I2C_MUX_PCA_ADDR_SEC1 0x75/* I2C bus multiplexer,secondary 1 */ #define I2C_MUX_PCA_ADDR_SEC2 0x76/* I2C bus multiplexer,secondary 2 */
include/configs/T208xRDB.h +9 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ /*
@@ -333,8 +334,8 @@ unsigned long get_board_ddr_clk(void);/* * I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL #define CONFIG_SYS_FSL_I2C_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F#define CONFIG_SYS_FSL_I2C3_SLAVE 0x7F
@@ -347,6 +348,13 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_SYS_FSL_I2C2_SPEED 100000#define CONFIG_SYS_FSL_I2C3_SPEED 100000#define CONFIG_SYS_FSL_I2C4_SPEED 100000 +#else +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif + +#define CONFIG_SYS_I2C_FSL +#define I2C_MUX_PCA_ADDR_PRI 0x77/* I2C bus multiplexer,primary */ #define I2C_MUX_PCA_ADDR_SEC1 0x75/* I2C bus multiplexer,secondary 1 */ #define I2C_MUX_PCA_ADDR_SEC2 0x76/* I2C bus multiplexer,secondary 2 */
Signature · 1 line
2.17.1
PATCH v3 25/27 configs: T2080: enable DM_I2C
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enables DM_I2C in T2080 defconfigs
---
Change in v3:
- none
Change in v2:
- none
configs/T2080QDS_NAND_defconfig | 1 + configs/T2080QDS_SDCARD_defconfig | 1 + configs/T2080QDS_SECURE_BOOT_defconfig | 1 + configs/T2080QDS_SPIFLASH_defconfig | 1 + configs/T2080QDS_SRIO_PCIE_BOOT_defconfig | 1 + configs/T2080QDS_defconfig | 1 + configs/T2080RDB_NAND_defconfig | 1 + configs/T2080RDB_SDCARD_defconfig | 1 + configs/T2080RDB_SPIFLASH_defconfig | 1 + configs/T2080RDB_defconfig | 1 + 10 files changed, 10 insertions(+)
configs/T2080QDS_NAND_defconfig +1 -0
@@ -80,3 +80,4 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_I2C=y
configs/T2080QDS_SDCARD_defconfig +1 -0
@@ -77,3 +77,4 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_I2C=y
configs/T2080QDS_SECURE_BOOT_defconfig +1 -0
@@ -67,3 +67,4 @@ CONFIG_USB_STORAGE=y CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y +CONFIG_DM_I2C=y
configs/T2080QDS_SPIFLASH_defconfig +1 -0
@@ -80,3 +80,4 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_I2C=y
configs/T2080QDS_SRIO_PCIE_BOOT_defconfig +1 -0
@@ -57,3 +57,4 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_I2C=y
configs/T2080QDS_defconfig +1 -0
@@ -65,3 +65,4 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_I2C=y
configs/T2080RDB_NAND_defconfig +1 -0
@@ -79,3 +79,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/T2080RDB_SDCARD_defconfig +1 -0
@@ -76,3 +76,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/T2080RDB_SPIFLASH_defconfig +1 -0
@@ -79,3 +79,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
configs/T2080RDB_defconfig +1 -0
@@ -63,3 +63,4 @@ CONFIG_SPI=y CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y +CONFIG_DM_I2C=y
Signature · 1 line
2.17.1
PATCH v3 26/27 dm: powerpc: T1040/T1042: add i2c DM support
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This supports i2c DM for SoC T1040/T1042
---
Change in v3:
- fix checkpatch warning
Change in v2:
- none
arch/powerpc/dts/t104x.dtsi | 4 +++- board/freescale/t1040qds/diu.c | 5 +++-- board/freescale/t1040qds/t1040qds.c | 18 ++++++++++++++++-- board/freescale/t1040qds/t1040qds.h | 3 ++- include/configs/T1040QDS.h | 7 +++++++ include/configs/T104xRDB.h | 10 +++++++++- 6 files changed, 40 insertions(+), 7 deletions(-)
arch/powerpc/dts/t104x.dtsi +3 -1
@@ -3,7 +3,7 @@ * T104X Silicon/SoC Device Tree Source (pre include) * * Copyright 2013 Freescale Semiconductor Inc. - * Copyright 2019 NXP + * Copyright 2019-2020 NXP */ /dts-v1/;
@@ -85,6 +85,8 @@ reg = <0x114000 0x1000>; clock-frequency = <0>; }; + /include/ "qoriq-i2c-0.dtsi" + /include/ "qoriq-i2c-1.dtsi" }; pcie at ffe240000 {
board/freescale/t1040qds/diu.c +3 -2
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2014 Freescale Semiconductor, Inc. +* Copyright 2020 NXP * Author: Priyanka Jain <[email protected]> */
@@ -48,7 +49,7 @@ void diu_set_pixel_clock(unsigned int pixclock)/* Program HDMI encoder */ /* Switch channel to DIU */ -select_i2c_ch_pca9547 (I2C_MUX_CH_DIU ); +select_i2c_ch_pca9547 (I2C_MUX_CH_DIU ,0 );/* Set dispaly encoder */ ret =diu_set_dvi_encoder (temp);
@@ -58,7 +59,7 @@ void diu_set_pixel_clock(unsigned int pixclock) }/* Switch channel to default */ -select_i2c_ch_pca9547 (I2C_MUX_CH_DEFAULT ); +select_i2c_ch_pca9547 (I2C_MUX_CH_DEFAULT ,0 );/* Program pixel clock */ out_be32((unsigned *)CONFIG_SYS_FSL_SCFG_PIXCLK_ADDR,
board/freescale/t1040qds/t1040qds.c +16 -2
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2013 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ #include <common.h>
@@ -79,11 +80,24 @@ int checkboard(void)return 0 ; } -int select_i2c_ch_pca9547 (u8 ch) +int select_i2c_ch_pca9547 (u8 ch,int bus_num) {int ret; +#ifdef CONFIG_DM_I2C +struct udevice *dev; + + ret =i2c_get_chip_for_busnum (bus_num,I2C_MUX_PCA_ADDR_PRI ,1 , &dev); +if (ret) { +printf ("%s: Cannot find udev for a bus %d\n" , __func__, + bus_num); +return ret; + } + + ret =dm_i2c_write (dev,0 , &ch,1 ); +#else ret =i2c_write (I2C_MUX_PCA_ADDR_PRI ,0 ,1 , &ch,1 ); +#endif if (ret) {puts ("PCA: failed to select proper channel\n" );return ret;
@@ -154,7 +168,7 @@ int board_early_init_r(void)MAS3_SX |MAS3_SW |MAS3_SR ,MAS2_I |MAS2_G , 0, flash_esel, BOOKE_PAGESZ_256M, 1);#endif -select_i2c_ch_pca9547 (I2C_MUX_CH_DEFAULT ); +select_i2c_ch_pca9547 (I2C_MUX_CH_DEFAULT ,0 );return 0 ; }
board/freescale/t1040qds/t1040qds.h +2 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2013 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ #ifndef __T1040_QDS_H__
@@ -8,6 +9,6 @@void fdt_fixup_board_enet (void *blob);void pci_of_setup (void *blob,bd_t *bd); -int select_i2c_ch_pca9547 (u8 ch); +int select_i2c_ch_pca9547 (u8 ch,int bus_bum);#endif
include/configs/T1040QDS.h +7 -0
@@ -1,5 +1,6 @@/* * Copyright 2013-2014 Freescale Semiconductor, Inc. +* Copyright 2020 NXP * * See file CREDITS for list of people who contributed to this * project.
@@ -360,6 +361,8 @@ unsigned long get_board_ddr_clk(void);#endif /* I2C */ + +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C #define CONFIG_SYS_I2C_FSL /* Use FSL common I2C driver */ #define CONFIG_SYS_FSL_I2C_SPEED 50000/* I2C speed in Hz */
@@ -374,6 +377,9 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_SYS_FSL_I2C2_OFFSET 0x118100#define CONFIG_SYS_FSL_I2C3_OFFSET 0x119000#define CONFIG_SYS_FSL_I2C4_OFFSET 0x119100 +#endif + +#define CONFIG_SYS_I2C_FSL /* Use FSL common I2C driver */ #define I2C_MUX_PCA_ADDR 0x77#define I2C_MUX_PCA_ADDR_PRI 0x77/* Primary Mux*/
@@ -385,6 +391,7 @@ unsigned long get_board_ddr_clk(void);/* LDI/DVI Encoder for display */ #define CONFIG_SYS_I2C_LDI_ADDR 0x38#define CONFIG_SYS_I2C_DVI_ADDR 0x75 +#define CONFIG_SYS_I2C_DVI_BUS_NUM 0/* * RTC configuration
include/configs/T104xRDB.h +9 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright 2014 Freescale Semiconductor, Inc. +* Copyright 2020 NXP */ #ifndef __CONFIG_H
@@ -27,6 +28,7 @@#define CONFIG_SPL_SKIP_RELOCATE #define CONFIG_SPL_COMMON_INIT_DDR #define CONFIG_SYS_CCSR_DO_NOT_RELOCATE +#undef CONFIG_DM_I2C#endif #define RESET_VECTOR_OFFSET 0x27FFC#define BOOT_PAGE_OFFSET 0x27000
@@ -459,8 +461,8 @@ $(SRCTREE)/board/freescale/t104xrdb/t1042d4_sd_rcw.cfg#endif /* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_FSL /* Use FSL common I2C driver */ #define CONFIG_SYS_FSL_I2C_SPEED 400000/* I2C speed in Hz */ #define CONFIG_SYS_FSL_I2C2_SPEED 400000#define CONFIG_SYS_FSL_I2C3_SPEED 400000
@@ -473,7 +475,12 @@ $(SRCTREE)/board/freescale/t104xrdb/t1042d4_sd_rcw.cfg#define CONFIG_SYS_FSL_I2C2_OFFSET 0x118100#define CONFIG_SYS_FSL_I2C3_OFFSET 0x119000#define CONFIG_SYS_FSL_I2C4_OFFSET 0x119100 +#else +#define CONFIG_I2C_SET_DEFAULT_BUS_NUM +#define CONFIG_I2C_DEFAULT_BUS_NUMBER 0 +#endif +#define CONFIG_SYS_I2C_FSL /* Use FSL common I2C driver */ /* I2C bus multiplexer */ #define I2C_MUX_PCA_ADDR 0x70#define I2C_MUX_CH_DEFAULT 0x8
@@ -484,6 +491,7 @@ $(SRCTREE)/board/freescale/t104xrdb/t1042d4_sd_rcw.cfg/* LDI/DVI Encoder for display */ #define CONFIG_SYS_I2C_LDI_ADDR 0x38#define CONFIG_SYS_I2C_DVI_ADDR 0x75 +#define CONFIG_SYS_I2C_DVI_BUS_NUM 0/* * RTC configuration
Signature · 1 line
2.17.1
PATCH v3 27/27 configs: T1042D4RDB: enable DM_I2C and DM_RTC
In reply to Biwen LiFrom: Biwen Li <[email protected]>
This enables DM_I2C and DM_RTC in T1042D4RDB defconfigs, except T1042D4RDB SECURE_BOOT defconfig
---
Change in v3:
- none
Change in v2:
- none
configs/T1042D4RDB_NAND_defconfig | 2 ++ configs/T1042D4RDB_SDCARD_defconfig | 2 ++ configs/T1042D4RDB_SPIFLASH_defconfig | 2 ++ configs/T1042D4RDB_defconfig | 2 ++ 4 files changed, 8 insertions(+)
configs/T1042D4RDB_NAND_defconfig +2 -0
@@ -82,3 +82,5 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_VIDEO=y CONFIG_CFB_CONSOLE_ANSI=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/T1042D4RDB_SDCARD_defconfig +2 -0
@@ -79,3 +79,5 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_VIDEO=y CONFIG_CFB_CONSOLE_ANSI=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/T1042D4RDB_SPIFLASH_defconfig +2 -0
@@ -82,3 +82,5 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_VIDEO=y CONFIG_CFB_CONSOLE_ANSI=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
configs/T1042D4RDB_defconfig +2 -0
@@ -67,3 +67,5 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_VIDEO=y CONFIG_CFB_CONSOLE_ANSI=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y
Signature · 1 line
2.17.1
PATCH v3 1/27 rtc: ds1337: Add driver model support
In reply to Biwen LiQuoted 15 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Biwen Li
Sent: Friday, May 1, 2020 5:34 PM
To: Jagdish Gediya <[email protected]>; Priyanka Jain <[email protected]>; hs at denx.de; jagan at amarulasolutions.com; aford173 at gmail.com; Alison Wang <[email protected]>; jh80.chung at samsung.com; Pramod Kumar <[email protected]>; Rajesh Bhagat <[email protected]>; Ruchika Gupta <[email protected]>; olteanv at gmail.com
Cc: Xiaobo Xie <[email protected]>; Jiafei Pan <[email protected]>; u- boot at lists.denx.de; Z.q. Hou <[email protected]>; Biwen Li <[email protected]>
Subject: [v3 01/27] rtc: ds1337: Add driver model support
Quoted 7 lines
From: Biwen Li <[email protected]>
Add support of driver model of ds1337
Signed-off-by Biwen Li <[email protected]>Reviewed-by Priyanka Jain <[email protected]>---
Series applied on u-boot-mpc85xx
Thanks
Priyanka