1
1
// SPDX-License-Identifier: GPL-2.0
2
2
/*
3
- * Core functions for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
3
+ * Core functions for following TI PMICs:
4
+ * - LP8764
5
+ * - TPS65224
6
+ * - TPS652G1
7
+ * - TPS6593
8
+ * - TPS6594
4
9
*
5
10
* Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
6
11
*/
@@ -414,6 +419,61 @@ static const unsigned int tps65224_irq_reg[] = {
414
419
TPS6594_REG_INT_FSM_ERR ,
415
420
};
416
421
422
+ /* TPS652G1 Resources */
423
+
424
+ static const struct mfd_cell tps652g1_common_cells [] = {
425
+ MFD_CELL_RES ("tps6594-pfsm" , tps65224_pfsm_resources ),
426
+ MFD_CELL_RES ("tps6594-pinctrl" , tps65224_pinctrl_resources ),
427
+ MFD_CELL_NAME ("tps6594-regulator" ),
428
+ };
429
+
430
+ static const struct regmap_irq tps652g1_irqs [] = {
431
+ /* INT_GPIO register */
432
+ REGMAP_IRQ_REG (TPS65224_IRQ_GPIO1 , 2 , TPS65224_BIT_GPIO1_INT ),
433
+ REGMAP_IRQ_REG (TPS65224_IRQ_GPIO2 , 2 , TPS65224_BIT_GPIO2_INT ),
434
+ REGMAP_IRQ_REG (TPS65224_IRQ_GPIO3 , 2 , TPS65224_BIT_GPIO3_INT ),
435
+ REGMAP_IRQ_REG (TPS65224_IRQ_GPIO4 , 2 , TPS65224_BIT_GPIO4_INT ),
436
+ REGMAP_IRQ_REG (TPS65224_IRQ_GPIO5 , 2 , TPS65224_BIT_GPIO5_INT ),
437
+ REGMAP_IRQ_REG (TPS65224_IRQ_GPIO6 , 2 , TPS65224_BIT_GPIO6_INT ),
438
+
439
+ /* INT_STARTUP register */
440
+ REGMAP_IRQ_REG (TPS65224_IRQ_VSENSE , 3 , TPS65224_BIT_VSENSE_INT ),
441
+ REGMAP_IRQ_REG (TPS65224_IRQ_ENABLE , 3 , TPS6594_BIT_ENABLE_INT ),
442
+ REGMAP_IRQ_REG (TPS65224_IRQ_PB_SHORT , 3 , TPS65224_BIT_PB_SHORT_INT ),
443
+ REGMAP_IRQ_REG (TPS65224_IRQ_FSD , 3 , TPS6594_BIT_FSD_INT ),
444
+ REGMAP_IRQ_REG (TPS65224_IRQ_SOFT_REBOOT , 3 , TPS6594_BIT_SOFT_REBOOT_INT ),
445
+
446
+ /* INT_MISC register */
447
+ REGMAP_IRQ_REG (TPS65224_IRQ_BIST_PASS , 4 , TPS6594_BIT_BIST_PASS_INT ),
448
+ REGMAP_IRQ_REG (TPS65224_IRQ_EXT_CLK , 4 , TPS6594_BIT_EXT_CLK_INT ),
449
+ REGMAP_IRQ_REG (TPS65224_IRQ_REG_UNLOCK , 4 , TPS65224_BIT_REG_UNLOCK_INT ),
450
+ REGMAP_IRQ_REG (TPS65224_IRQ_TWARN , 4 , TPS6594_BIT_TWARN_INT ),
451
+ REGMAP_IRQ_REG (TPS65224_IRQ_PB_LONG , 4 , TPS65224_BIT_PB_LONG_INT ),
452
+ REGMAP_IRQ_REG (TPS65224_IRQ_PB_FALL , 4 , TPS65224_BIT_PB_FALL_INT ),
453
+ REGMAP_IRQ_REG (TPS65224_IRQ_PB_RISE , 4 , TPS65224_BIT_PB_RISE_INT ),
454
+ REGMAP_IRQ_REG (TPS65224_IRQ_ADC_CONV_READY , 4 , TPS65224_BIT_ADC_CONV_READY_INT ),
455
+
456
+ /* INT_MODERATE_ERR register */
457
+ REGMAP_IRQ_REG (TPS65224_IRQ_TSD_ORD , 5 , TPS6594_BIT_TSD_ORD_INT ),
458
+ REGMAP_IRQ_REG (TPS65224_IRQ_BIST_FAIL , 5 , TPS6594_BIT_BIST_FAIL_INT ),
459
+ REGMAP_IRQ_REG (TPS65224_IRQ_REG_CRC_ERR , 5 , TPS6594_BIT_REG_CRC_ERR_INT ),
460
+ REGMAP_IRQ_REG (TPS65224_IRQ_RECOV_CNT , 5 , TPS6594_BIT_RECOV_CNT_INT ),
461
+
462
+ /* INT_SEVERE_ERR register */
463
+ REGMAP_IRQ_REG (TPS65224_IRQ_TSD_IMM , 6 , TPS6594_BIT_TSD_IMM_INT ),
464
+ REGMAP_IRQ_REG (TPS65224_IRQ_VCCA_OVP , 6 , TPS6594_BIT_VCCA_OVP_INT ),
465
+ REGMAP_IRQ_REG (TPS65224_IRQ_PFSM_ERR , 6 , TPS6594_BIT_PFSM_ERR_INT ),
466
+ REGMAP_IRQ_REG (TPS65224_IRQ_BG_XMON , 6 , TPS65224_BIT_BG_XMON_INT ),
467
+
468
+ /* INT_FSM_ERR register */
469
+ REGMAP_IRQ_REG (TPS65224_IRQ_IMM_SHUTDOWN , 7 , TPS6594_BIT_IMM_SHUTDOWN_INT ),
470
+ REGMAP_IRQ_REG (TPS65224_IRQ_ORD_SHUTDOWN , 7 , TPS6594_BIT_ORD_SHUTDOWN_INT ),
471
+ REGMAP_IRQ_REG (TPS65224_IRQ_MCU_PWR_ERR , 7 , TPS6594_BIT_MCU_PWR_ERR_INT ),
472
+ REGMAP_IRQ_REG (TPS65224_IRQ_SOC_PWR_ERR , 7 , TPS6594_BIT_SOC_PWR_ERR_INT ),
473
+ REGMAP_IRQ_REG (TPS65224_IRQ_COMM_ERR , 7 , TPS6594_BIT_COMM_ERR_INT ),
474
+ REGMAP_IRQ_REG (TPS65224_IRQ_I2C2_ERR , 7 , TPS65224_BIT_I2C2_ERR_INT ),
475
+ };
476
+
417
477
static inline unsigned int tps6594_get_irq_reg (struct regmap_irq_chip_data * data ,
418
478
unsigned int base , int index )
419
479
{
@@ -443,7 +503,7 @@ static int tps6594_handle_post_irq(void *irq_drv_data)
443
503
* a new interrupt.
444
504
*/
445
505
if (tps -> use_crc ) {
446
- if (tps -> chip_id == TPS65224 ) {
506
+ if (tps -> chip_id == TPS65224 || tps -> chip_id == TPS652G1 ) {
447
507
regmap_reg = TPS6594_REG_INT_FSM_ERR ;
448
508
mask_val = TPS6594_BIT_COMM_ERR_INT ;
449
509
} else {
@@ -481,6 +541,18 @@ static struct regmap_irq_chip tps65224_irq_chip = {
481
541
.handle_post_irq = tps6594_handle_post_irq ,
482
542
};
483
543
544
+ static struct regmap_irq_chip tps652g1_irq_chip = {
545
+ .ack_base = TPS6594_REG_INT_BUCK ,
546
+ .ack_invert = 1 ,
547
+ .clear_ack = 1 ,
548
+ .init_ack_masked = 1 ,
549
+ .num_regs = ARRAY_SIZE (tps65224_irq_reg ),
550
+ .irqs = tps652g1_irqs ,
551
+ .num_irqs = ARRAY_SIZE (tps652g1_irqs ),
552
+ .get_irq_reg = tps65224_get_irq_reg ,
553
+ .handle_post_irq = tps6594_handle_post_irq ,
554
+ };
555
+
484
556
static const struct regmap_range tps6594_volatile_ranges [] = {
485
557
regmap_reg_range (TPS6594_REG_INT_TOP , TPS6594_REG_STAT_READBACK_ERR ),
486
558
regmap_reg_range (TPS6594_REG_RTC_STATUS , TPS6594_REG_RTC_STATUS ),
@@ -507,7 +579,7 @@ static int tps6594_check_crc_mode(struct tps6594 *tps, bool primary_pmic)
507
579
int ret ;
508
580
unsigned int regmap_reg , mask_val ;
509
581
510
- if (tps -> chip_id == TPS65224 ) {
582
+ if (tps -> chip_id == TPS65224 || tps -> chip_id == TPS652G1 ) {
511
583
regmap_reg = TPS6594_REG_CONFIG_2 ;
512
584
mask_val = TPS65224_BIT_I2C1_SPI_CRC_EN ;
513
585
} else {
@@ -537,7 +609,7 @@ static int tps6594_set_crc_feature(struct tps6594 *tps)
537
609
int ret ;
538
610
unsigned int regmap_reg , mask_val ;
539
611
540
- if (tps -> chip_id == TPS65224 ) {
612
+ if (tps -> chip_id == TPS65224 || tps -> chip_id == TPS652G1 ) {
541
613
regmap_reg = TPS6594_REG_CONFIG_2 ;
542
614
mask_val = TPS65224_BIT_I2C1_SPI_CRC_EN ;
543
615
} else {
@@ -628,6 +700,10 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
628
700
irq_chip = & tps65224_irq_chip ;
629
701
n_cells = ARRAY_SIZE (tps65224_common_cells );
630
702
cells = tps65224_common_cells ;
703
+ } else if (tps -> chip_id == TPS652G1 ) {
704
+ irq_chip = & tps652g1_irq_chip ;
705
+ n_cells = ARRAY_SIZE (tps652g1_common_cells );
706
+ cells = tps652g1_common_cells ;
631
707
} else {
632
708
irq_chip = & tps6594_irq_chip ;
633
709
n_cells = ARRAY_SIZE (tps6594_common_cells );
@@ -651,8 +727,8 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
651
727
if (ret )
652
728
return dev_err_probe (dev , ret , "Failed to add common child devices\n" );
653
729
654
- /* No RTC for LP8764 and TPS65224 */
655
- if (tps -> chip_id != LP8764 && tps -> chip_id != TPS65224 ) {
730
+ /* No RTC for LP8764, TPS65224 and TPS652G1 */
731
+ if (tps -> chip_id != LP8764 && tps -> chip_id != TPS65224 && tps -> chip_id != TPS652G1 ) {
656
732
ret = devm_mfd_add_devices (dev , PLATFORM_DEVID_AUTO , tps6594_rtc_cells ,
657
733
ARRAY_SIZE (tps6594_rtc_cells ), NULL , 0 ,
658
734
regmap_irq_get_domain (tps -> irq_data ));
0 commit comments