Po Xu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/27416 )
Change subject: mediatek: Share GPIO code among similar SOCs ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/27416/6/src/soc/mediatek/common/gpi... File src/soc/mediatek/common/gpio.c:
https://review.coreboot.org/c/coreboot/+/27416/6/src/soc/mediatek/common/gpi... PS6, Line 53: write32(reg, 1L << bit);
Why don't we have to use 'clrsetbits_le32()' to avoid clearing other bits?
Will not,
reg = &mtk_gpio->dir[pos].rst; or reg = &mtk_gpio->dir[pos].set;
For example, you want to set the direction, which has a base register, a set register, a rst register, The set register writes 1, the corresponding bit of the base register becomes 1, the set register writes 0, and the corresponding base register bit remains unchanged; The rst register writes 1, the corresponding bit of the base register becomes 0, the rst register writes 1, and the corresponding base register bit remains unchanged. Of course, you can also write the base register directly, but you can't use the write function directly. you can call clrsetbits_le32().