Lines Matching full:id

101 #define _TAMP_CR1_ITAMP(id)		BIT((id) - INT_TAMP1 + U(16))  argument
102 #define _TAMP_CR1_ETAMP(id) BIT((id) - EXT_TAMP1) argument
105 #define _TAMP_CR2_ETAMPTRG(id) BIT((id) - EXT_TAMP1 + U(24)) argument
109 #define _TAMP_CR2_ETAMPMSK(id) BIT((id) - EXT_TAMP1 + U(16)) argument
110 #define _TAMP_CR2_ETAMPNOER(id) BIT((id) - EXT_TAMP1) argument
114 #define _TAMP_CR3_ITAMPNOER(id) BIT((id) - INT_TAMP1) argument
133 #define _TAMP_ATCR1_ETAMPAM(id) BIT((id) - EXT_TAMP1) argument
134 #define _TAMP_ATCR1_ATOSEL_MASK(id) \ argument
136 typeof(id) _id = (id); \
141 #define _TAMP_ATCR1_ATOSEL(id, od) \ argument
142 SHIFT_U32((od) - OUT_TAMP1, ((id) - EXT_TAMP1) * 2 + 8)
145 #define _TAMP_ATCR2_ATOSEL_MASK(id) \ argument
147 typeof(id) _id = (id); \
152 #define _TAMP_ATCR2_ATOSEL(id, od) \ argument
153 SHIFT_U32((od) - OUT_TAMP1, ((id) - EXT_TAMP1) * 3 + 8)
161 #define _TAMP_IER_ITAMP(id) BIT((id) - INT_TAMP1 + U(16)) argument
162 #define _TAMP_IER_ETAMP(id) BIT((id) - EXT_TAMP1) argument
167 #define _TAMP_SR_ITAMP(id) BIT((id) - INT_TAMP1 + U(16)) argument
168 #define _TAMP_SR_ETAMP(id) BIT((id) - EXT_TAMP1) argument
171 #define _TAMP_SCR_ITAMP(id) BIT((id) - INT_TAMP1 + U(16)) argument
172 #define _TAMP_SCR_ETAMP(id) BIT((id) - EXT_TAMP1) argument
209 #define _TAMP_HWCFGR1_ITAMP(id) BIT((id) - INT_TAMP1 + 16U) argument
317 * @id: Identifier of the tamper
324 uint32_t id; member
334 * @id: Identifier of the tamper
340 uint32_t id; member
343 uint32_t (*func)(int id);
468 { .id = INT_TAMP1 }, { .id = INT_TAMP2 }, { .id = INT_TAMP3 },
469 { .id = INT_TAMP4 }, { .id = INT_TAMP5 }, { .id = INT_TAMP6 },
470 { .id = INT_TAMP7 }, { .id = INT_TAMP8 }, { .id = INT_TAMP9 },
471 { .id = INT_TAMP10 }, { .id = INT_TAMP11 },
472 { .id = INT_TAMP12 }, { .id = INT_TAMP13 },
476 { .id = EXT_TAMP1 }, { .id = EXT_TAMP2 }, { .id = EXT_TAMP3 },
477 { .id = EXT_TAMP4 }, { .id = EXT_TAMP5 }, { .id = EXT_TAMP6 },
478 { .id = EXT_TAMP7 }, { .id = EXT_TAMP8 },
483 .id = EXT_TAMP1, .bank = GPIO_BANK('C'), .pin = 13,
487 .id = EXT_TAMP1, .bank = GPIO_BANK('F'), .pin = 10,
491 .id = EXT_TAMP2, .bank = GPIO_BANK('A'), .pin = 6,
495 .id = EXT_TAMP2, .bank = GPIO_BANK('I'), .pin = 1,
499 .id = EXT_TAMP3, .bank = GPIO_BANK('C'), .pin = 0,
503 .id = EXT_TAMP3, .bank = GPIO_BANK('I'), .pin = 2,
507 .id = EXT_TAMP4, .bank = GPIO_BANK('G'), .pin = 8,
511 .id = EXT_TAMP4, .bank = GPIO_BANK('I'), .pin = 3,
528 { .id = INT_TAMP1 }, { .id = INT_TAMP2 }, { .id = INT_TAMP3 },
529 { .id = INT_TAMP4 }, { .id = INT_TAMP5 }, { .id = INT_TAMP8 },
533 { .id = EXT_TAMP1 }, { .id = EXT_TAMP2 }, { .id = EXT_TAMP3 },
538 .id = EXT_TAMP1, .bank = GPIO_BANK('C'), .pin = 13,
542 .id = EXT_TAMP2, .bank = GPIO_BANK('I'), .pin = 8,
546 .id = EXT_TAMP3, .bank = GPIO_BANK('C'), .pin = 1,
550 .id = OUT_TAMP2, .bank = GPIO_BANK('C'), .pin = 13,
554 .id = OUT_TAMP3, .bank = GPIO_BANK('C'), .pin = 13,
558 .id = OUT_TAMP3, .bank = GPIO_BANK('I'), .pin = 8,
585 { .id = INT_TAMP1 }, { .id = INT_TAMP2 }, { .id = INT_TAMP3 },
586 { .id = INT_TAMP4 }, { .id = INT_TAMP5 }, { .id = INT_TAMP6 },
587 { .id = INT_TAMP7 }, { .id = INT_TAMP8 }, { .id = INT_TAMP9 },
588 { .id = INT_TAMP10 }, { .id = INT_TAMP11 }, { .id = INT_TAMP12 },
589 { .id = INT_TAMP13 }, { .id = INT_TAMP14 }, { .id = INT_TAMP15 },
590 { .id = INT_TAMP16 },
594 { .id = EXT_TAMP1 }, { .id = EXT_TAMP2 }, { .id = EXT_TAMP3 },
595 { .id = EXT_TAMP4 }, { .id = EXT_TAMP5 }, { .id = EXT_TAMP6 },
596 { .id = EXT_TAMP7 },
601 .id = EXT_TAMP1, .bank = GPIO_BANK('I'), .pin = 8,
605 .id = EXT_TAMP1, .bank = GPIO_BANK('C'), .pin = 4,
630 { .id = INT_TAMP1 }, { .id = INT_TAMP2 }, { .id = INT_TAMP3 },
631 { .id = INT_TAMP4 }, { .id = INT_TAMP5 }, { .id = INT_TAMP6 },
632 { .id = INT_TAMP7 }, { .id = INT_TAMP8 }, { .id = INT_TAMP9 },
633 { .id = INT_TAMP10 }, { .id = INT_TAMP11 },
634 { .id = INT_TAMP12 }, { .id = INT_TAMP14 },
635 { .id = INT_TAMP15 },
640 { .id = EXT_TAMP1 }, { .id = EXT_TAMP2 }, { .id = EXT_TAMP3 },
641 { .id = EXT_TAMP4 }, { .id = EXT_TAMP5 }, { .id = EXT_TAMP6 },
642 { .id = EXT_TAMP7 }, { .id = EXT_TAMP8 },
646 { .id = EXT_TAMP1 }, { .id = EXT_TAMP2 }, { .id = EXT_TAMP3 },
647 { .id = EXT_TAMP4 }, { .id = EXT_TAMP5 }, { .id = EXT_TAMP6 },
648 { .id = EXT_TAMP7 },
654 .id = EXT_TAMP1, .bank = GPIO_BANK('I'), .pin = 8,
658 .id = EXT_TAMP1, .bank = GPIO_BANK('C'), .pin = 4,
662 .id = EXT_TAMP3, .bank = GPIO_BANK('C'), .pin = 3,
666 .id = EXT_TAMP3, .bank = GPIO_BANK('Z'), .pin = 2,
670 .id = EXT_TAMP5, .bank = GPIO_BANK('F'), .pin = 6,
674 .id = EXT_TAMP5, .bank = GPIO_BANK('Z'), .pin = 4,
1020 static TEE_Result is_int_tamp_id_valid(enum stm32_tamp_id id) in is_int_tamp_id_valid() argument
1022 if (id - INT_TAMP1 >= _TAMP_HWCFGR1_ITAMP_MAX_ID) in is_int_tamp_id_valid()
1025 if (!(stm32_tamp_dev->hwconf1 & _TAMP_HWCFGR1_ITAMP(id))) in is_int_tamp_id_valid()
1031 static bool is_ext_tamp_id_valid(enum stm32_tamp_id id) in is_ext_tamp_id_valid() argument
1033 return id - EXT_TAMP1 <= in is_ext_tamp_id_valid()
1065 int id = int_tamp.id; in stm32_tamp_it_handler() local
1067 if (int_it & _TAMP_SR_ITAMP(id)) { in stm32_tamp_it_handler()
1070 int_it &= ~_TAMP_SR_ITAMP(id); in stm32_tamp_it_handler()
1073 ret = int_tamp.func(id); in stm32_tamp_it_handler()
1077 _TAMP_SCR_ITAMP(id)); in stm32_tamp_it_handler()
1090 int id = ext_tamp.id; in stm32_tamp_it_handler() local
1092 if (ext_it & _TAMP_SR_ETAMP(id)) { in stm32_tamp_it_handler()
1095 ext_it &= ~_TAMP_SR_ETAMP(id); in stm32_tamp_it_handler()
1098 ret = ext_tamp.func(id); in stm32_tamp_it_handler()
1102 _TAMP_SCR_ETAMP(id)); in stm32_tamp_it_handler()
1119 enum stm32_tamp_id id = INVALID_TAMP; in stm32_tamp_set_int_config() local
1126 id = tamp_int->id; in stm32_tamp_set_int_config()
1128 res = is_int_tamp_id_valid(id); in stm32_tamp_set_int_config()
1139 *cr1 &= ~_TAMP_CR1_ITAMP(id); in stm32_tamp_set_int_config()
1140 *ier &= ~_TAMP_IER_ITAMP(id); in stm32_tamp_set_int_config()
1142 *cr3 &= ~_TAMP_CR3_ITAMPNOER(id); in stm32_tamp_set_int_config()
1144 FMSG("INT_TAMP%d disabled", id - INT_TAMP1 + 1); in stm32_tamp_set_int_config()
1148 *cr1 |= _TAMP_CR1_ITAMP(id); in stm32_tamp_set_int_config()
1149 *ier |= _TAMP_IER_ITAMP(id); in stm32_tamp_set_int_config()
1153 *cr3 |= _TAMP_CR3_ITAMPNOER(id); in stm32_tamp_set_int_config()
1155 *cr3 &= ~_TAMP_CR3_ITAMPNOER(id); in stm32_tamp_set_int_config()
1159 itamper_name[id - INT_TAMP1], in stm32_tamp_set_int_config()
1171 enum stm32_tamp_id id = INVALID_TAMP; in stm32_tamp_set_ext_config() local
1177 id = tamp_ext->id; in stm32_tamp_set_ext_config()
1180 if (!is_ext_tamp_id_valid(id)) in stm32_tamp_set_ext_config()
1188 *cr1 &= ~_TAMP_CR1_ETAMP(id); in stm32_tamp_set_ext_config()
1189 *cr2 &= ~_TAMP_CR2_ETAMPMSK(id); in stm32_tamp_set_ext_config()
1190 *cr2 &= ~_TAMP_CR2_ETAMPTRG(id); in stm32_tamp_set_ext_config()
1191 *cr2 &= ~_TAMP_CR2_ETAMPNOER(id); in stm32_tamp_set_ext_config()
1192 *ier &= ~_TAMP_IER_ETAMP(id); in stm32_tamp_set_ext_config()
1194 FMSG("EXT_TAMP%d disabled", id - EXT_TAMP1 + 1); in stm32_tamp_set_ext_config()
1198 *cr1 |= _TAMP_CR1_ETAMP(id); in stm32_tamp_set_ext_config()
1201 *cr2 |= _TAMP_CR2_ETAMPTRG(id); in stm32_tamp_set_ext_config()
1203 *cr2 &= ~_TAMP_CR2_ETAMPTRG(id); in stm32_tamp_set_ext_config()
1206 *atcr1 |= _TAMP_ATCR1_ETAMPAM(id); in stm32_tamp_set_ext_config()
1212 ~_TAMP_ATCR2_ATOSEL_MASK(id)) | in stm32_tamp_set_ext_config()
1213 _TAMP_ATCR2_ATOSEL(id, in stm32_tamp_set_ext_config()
1217 ~_TAMP_ATCR1_ATOSEL_MASK(id)) | in stm32_tamp_set_ext_config()
1218 _TAMP_ATCR1_ATOSEL(id, in stm32_tamp_set_ext_config()
1222 *atcr1 &= ~_TAMP_ATCR1_ETAMPAM(id); in stm32_tamp_set_ext_config()
1226 *cr2 |= _TAMP_CR2_ETAMPNOER(id); in stm32_tamp_set_ext_config()
1228 *cr2 &= ~_TAMP_CR2_ETAMPNOER(id); in stm32_tamp_set_ext_config()
1230 if (id < _TAMP_CR2_ETAMPMSK_MAX_ID) { in stm32_tamp_set_ext_config()
1237 * ETAMP(id) event generates a trigger event. This in stm32_tamp_set_ext_config()
1238 * ETAMP(id) is masked and internally cleared by in stm32_tamp_set_ext_config()
1242 *ier &= ~_TAMP_IER_ETAMP(id); in stm32_tamp_set_ext_config()
1243 *cr2 |= _TAMP_CR2_ETAMPMSK(id); in stm32_tamp_set_ext_config()
1247 * ETAMP(id) event generates a trigger event and in stm32_tamp_set_ext_config()
1248 * TAMP(id) must be cleared by software to allow in stm32_tamp_set_ext_config()
1251 *ier |= _TAMP_IER_ETAMP(id); in stm32_tamp_set_ext_config()
1252 *cr2 &= ~_TAMP_CR2_ETAMPMSK(id); in stm32_tamp_set_ext_config()
1256 *ier |= _TAMP_IER_ETAMP(id); in stm32_tamp_set_ext_config()
1260 id - EXT_TAMP1 + 1, in stm32_tamp_set_ext_config()
1396 * Mask a tamper event detection for a given @id
1397 * If ETAMP(id) event generates a trigger event, this ETAMP(id) is masked and
1400 static TEE_Result __maybe_unused stm32_tamp_set_mask(enum stm32_tamp_id id) in stm32_tamp_set_mask() argument
1405 if (id < EXT_TAMP1 || id > (EXT_TAMP1 + _TAMP_CR2_ETAMPMSK_MAX_ID)) in stm32_tamp_set_mask()
1409 if (io_read32(base + _TAMP_SR) & _TAMP_SR_ETAMP(id)) in stm32_tamp_set_mask()
1413 io_clrbits32(base + _TAMP_IER, _TAMP_IER_ETAMP(id)); in stm32_tamp_set_mask()
1415 io_setbits32(base + _TAMP_CR2, _TAMP_CR2_ETAMPMSK(id)); in stm32_tamp_set_mask()
1421 * Unmask a tamper event detection for a given @id
1422 * ETAMP(id) event now generates a trigger event and ETAMP(id) must be cleared
1425 static TEE_Result __maybe_unused stm32_tamp_unset_mask(enum stm32_tamp_id id) in stm32_tamp_unset_mask() argument
1430 if (id < EXT_TAMP1 || id > (EXT_TAMP1 + _TAMP_CR2_ETAMPMSK_MAX_ID)) in stm32_tamp_unset_mask()
1434 io_clrbits32(base + _TAMP_CR2, _TAMP_CR2_ETAMPMSK(id)); in stm32_tamp_unset_mask()
1436 io_setbits32(base + _TAMP_IER, _TAMP_IER_ETAMP(id)); in stm32_tamp_unset_mask()
1468 uint32_t (*cb)(int id)) in stm32_tamp_configure_int() argument
1481 uint32_t (*cb)(int id)) in stm32_tamp_configure_ext() argument
1483 enum stm32_tamp_id id = tamp->id; in stm32_tamp_configure_ext() local
1485 if (mode & TAMP_EVT_MASK && !is_ext_tamp_id_valid(id)) in stm32_tamp_configure_ext()
1501 * @id: tamper ID
1525 * if @id is not a valid tamper ID,
1527 * if TAMP_EVT_MASK @mode is set for an unsupported @id.
1535 static TEE_Result stm32_tamp_activate_tamp(enum stm32_tamp_id id, uint32_t mode, in stm32_tamp_activate_tamp() argument
1536 uint32_t (*cb)(int id)) in stm32_tamp_activate_tamp() argument
1551 if (stm32_tamp_dev->pdata.compat->int_tamp[i].id == id) { in stm32_tamp_activate_tamp()
1559 if (stm32_tamp_dev->pdata.compat->ext_tamp[i].id == id) { in stm32_tamp_activate_tamp()
1565 EMSG("Did not find existing tamper for ID:%d", id); in stm32_tamp_activate_tamp()
1619 static void stm32_tamp_configure_pin(uint32_t id, struct gpio *gpio, bool out, in stm32_tamp_configure_pin() argument
1632 if (id == compat->pin_map[i].id && in stm32_tamp_configure_pin()
1649 enum stm32_tamp_id id = INVALID_TAMP; in stm32_tamp_configure_pin_from_dt() local
1685 id = ext_tamp_id + EXT_TAMP1 - 1; in stm32_tamp_configure_pin_from_dt()
1689 if (pdata->compat->ext_tamp[i].id == id) { in stm32_tamp_configure_pin_from_dt()
1706 if (out_id - OUT_TAMP1 != id - EXT_TAMP1) in stm32_tamp_configure_pin_from_dt()
1715 stm32_tamp_configure_pin(id, gpio_ext, false, pdata); in stm32_tamp_configure_pin_from_dt()
1839 static uint32_t stm32_tamp_itamper_action(int id) in stm32_tamp_itamper_action() argument
1843 if (id >= 0 && ((size_t)id < ARRAY_SIZE(itamper_name))) in stm32_tamp_itamper_action()
1844 tamp_name = itamper_name[id]; in stm32_tamp_itamper_action()
1846 MSG("Internal tamper event %u (%s) occurred", id - INT_TAMP1 + 1, in stm32_tamp_itamper_action()
1853 static uint32_t stm32_tamp_etamper_action(int id __maybe_unused) in stm32_tamp_etamper_action()
1855 MSG("External tamper %u occurs", id - EXT_TAMP1 + 1); in stm32_tamp_etamper_action()
1915 cuint = fdt_getprop(fdt, subnode, "st,tamp-id", &lenp); in stm32_configure_tamp()