Hi Chunfeng, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 041fae9c105ae342a4245cf1e0dc56a23fbb9d3c commit: 84513eccd67804c02a0c42017bc7eaa4ad112478 phy: mediatek: fix build warning of FIELD_PREP() date: 3 months ago config: hexagon-randconfig-r045-20221215 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 98b13979fb05f3ed288a900deb843e7b27589e58) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=84513eccd67804c02a0c42017bc7eaa4ad112478 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 84513eccd67804c02a0c42017bc7eaa4ad112478 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/phy/mediatek/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c:207:2: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask_), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask_)))' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare] mtk_phy_update_field(base + MIPITX_DSI_PLL_TOP, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/phy/mediatek/phy-mtk-io.h:43:34: note: expanded from macro 'mtk_phy_update_field' mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP' __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK' BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ~~~~~~~~~~~~~~~~~^~~~~ include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value' (cond) ? \ ^~~~ >> drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c:207:2: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask_), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask_)))' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare] mtk_phy_update_field(base + MIPITX_DSI_PLL_TOP, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/phy/mediatek/phy-mtk-io.h:43:34: note: expanded from macro 'mtk_phy_update_field' mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP' __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK' BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ~~~~~~^~~~~~~~~~~ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ >> drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c:207:2: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask_), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask_)))' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare] mtk_phy_update_field(base + MIPITX_DSI_PLL_TOP, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/phy/mediatek/phy-mtk-io.h:43:34: note: expanded from macro 'mtk_phy_update_field' mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP' __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK' BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ~~~~~~^~~~~~~~~~~ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ 3 warnings generated. -- >> drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c:83:2: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask_), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask_)))' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare] mtk_phy_update_field(base + MIPITX_PLL_CON1, RG_DSI_PLL_POSDIV, txdiv0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/phy/mediatek/phy-mtk-io.h:43:34: note: expanded from macro 'mtk_phy_update_field' mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP' __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK' BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ~~~~~~~~~~~~~~~~~^~~~~ include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value' (cond) ? \ ^~~~ >> drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c:83:2: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask_), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask_)))' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare] mtk_phy_update_field(base + MIPITX_PLL_CON1, RG_DSI_PLL_POSDIV, txdiv0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/phy/mediatek/phy-mtk-io.h:43:34: note: expanded from macro 'mtk_phy_update_field' mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP' __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK' BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ~~~~~~^~~~~~~~~~~ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ >> drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c:83:2: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask_), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask_)))' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare] mtk_phy_update_field(base + MIPITX_PLL_CON1, RG_DSI_PLL_POSDIV, txdiv0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/phy/mediatek/phy-mtk-io.h:43:34: note: expanded from macro 'mtk_phy_update_field' mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP' __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK' BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ~~~~~~^~~~~~~~~~~ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c:149:2: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask_), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask_)))' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare] mtk_phy_update_field(base + MIPITX_VOLTAGE_SEL, RG_DSI_HSTX_LDO_REF_SEL, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/phy/mediatek/phy-mtk-io.h:43:34: note: expanded from macro 'mtk_phy_update_field' mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP' __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK' BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ~~~~~~~~~~~~~~~~~^~~~~ include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value' (cond) ? \ ^~~~ drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c:149:2: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask_), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask_)))' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare] mtk_phy_update_field(base + MIPITX_VOLTAGE_SEL, RG_DSI_HSTX_LDO_REF_SEL, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/phy/mediatek/phy-mtk-io.h:43:34: note: expanded from macro 'mtk_phy_update_field' mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP' __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK' BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ~~~~~~^~~~~~~~~~~ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c:149:2: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask_), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask_)))' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare] mtk_phy_update_field(base + MIPITX_VOLTAGE_SEL, RG_DSI_HSTX_LDO_REF_SEL, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/phy/mediatek/phy-mtk-io.h:43:34: note: expanded from macro 'mtk_phy_update_field' mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ ^~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP' __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK' BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ~~~~~~^~~~~~~~~~~ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ 6 warnings generated. vim +207 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 121 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 122 static int mtk_mipi_tx_pll_prepare(struct clk_hw *hw) 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 123 { 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 124 struct mtk_mipi_tx *mipi_tx = mtk_mipi_tx_from_clk_hw(hw); bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 125 void __iomem *base = mipi_tx->regs; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 126 u8 txdiv, txdiv0, txdiv1; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 127 u64 pcw; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 128 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 129 dev_dbg(mipi_tx->dev, "prepare: %u Hz\n", mipi_tx->data_rate); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 130 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 131 if (mipi_tx->data_rate >= 500000000) { 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 132 txdiv = 1; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 133 txdiv0 = 0; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 134 txdiv1 = 0; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 135 } else if (mipi_tx->data_rate >= 250000000) { 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 136 txdiv = 2; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 137 txdiv0 = 1; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 138 txdiv1 = 0; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 139 } else if (mipi_tx->data_rate >= 125000000) { 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 140 txdiv = 4; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 141 txdiv0 = 2; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 142 txdiv1 = 0; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 143 } else if (mipi_tx->data_rate > 62000000) { 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 144 txdiv = 8; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 145 txdiv0 = 2; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 146 txdiv1 = 1; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 147 } else if (mipi_tx->data_rate >= 50000000) { 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 148 txdiv = 16; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 149 txdiv0 = 2; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 150 txdiv1 = 2; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 151 } else { 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 152 return -EINVAL; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 153 } 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 154 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 155 mtk_phy_update_bits(base + MIPITX_DSI_BG_CON, bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 156 RG_DSI_VOUT_MSK | RG_DSI_BG_CKEN | bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 157 RG_DSI_BG_CORE_EN, 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 158 FIELD_PREP(RG_DSI_V02_SEL, 4) | 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 159 FIELD_PREP(RG_DSI_V032_SEL, 4) | 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 160 FIELD_PREP(RG_DSI_V04_SEL, 4) | 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 161 FIELD_PREP(RG_DSI_V072_SEL, 4) | 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 162 FIELD_PREP(RG_DSI_V10_SEL, 4) | 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 163 FIELD_PREP(RG_DSI_V12_SEL, 4) | 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 164 RG_DSI_BG_CKEN | RG_DSI_BG_CORE_EN); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 165 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 166 usleep_range(30, 100); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 167 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 168 mtk_phy_update_bits(base + MIPITX_DSI_TOP_CON, 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 169 RG_DSI_LNT_IMP_CAL_CODE | RG_DSI_LNT_HS_BIAS_EN, 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 170 FIELD_PREP(RG_DSI_LNT_IMP_CAL_CODE, 8) | 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 171 RG_DSI_LNT_HS_BIAS_EN); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 172 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 173 mtk_phy_set_bits(base + MIPITX_DSI_CON, 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 174 RG_DSI_CKG_LDOOUT_EN | RG_DSI_LDOCORE_EN); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 175 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 176 mtk_phy_update_bits(base + MIPITX_DSI_PLL_PWR, bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 177 RG_DSI_MPPLL_SDM_PWR_ON | RG_DSI_MPPLL_SDM_ISO_EN, 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 178 RG_DSI_MPPLL_SDM_PWR_ON); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 179 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 180 mtk_phy_clear_bits(base + MIPITX_DSI_PLL_CON0, RG_DSI_MPPLL_PLL_EN); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 181 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 182 mtk_phy_update_bits(base + MIPITX_DSI_PLL_CON0, 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 183 RG_DSI_MPPLL_TXDIV0 | RG_DSI_MPPLL_TXDIV1 | 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 184 RG_DSI_MPPLL_PREDIV, 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 185 FIELD_PREP(RG_DSI_MPPLL_TXDIV0, txdiv0) | 993aa53ed076a9 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 186 FIELD_PREP(RG_DSI_MPPLL_TXDIV1, txdiv1)); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 187 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 188 /* 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 189 * PLL PCW config 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 190 * PCW bit 24~30 = integer part of pcw 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 191 * PCW bit 0~23 = fractional part of pcw 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 192 * pcw = data_Rate*4*txdiv/(Ref_clk*2); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 193 * Post DIV =4, so need data_Rate*4 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 194 * Ref_clk is 26MHz 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 195 */ bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 196 pcw = div_u64(((u64)mipi_tx->data_rate * 2 * txdiv) << 24, 26000000); bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 197 writel(pcw, base + MIPITX_DSI_PLL_CON2); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 198 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 199 mtk_phy_set_bits(base + MIPITX_DSI_PLL_CON1, RG_DSI_MPPLL_SDM_FRA_EN); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 200 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 201 mtk_phy_set_bits(base + MIPITX_DSI_PLL_CON0, RG_DSI_MPPLL_PLL_EN); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 202 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 203 usleep_range(20, 100); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 204 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 205 mtk_phy_clear_bits(base + MIPITX_DSI_PLL_CON1, RG_DSI_MPPLL_SDM_SSC_EN); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 206 bd4ba730ff2898 drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c Chunfeng Yun 2022-09-20 @207 mtk_phy_update_field(base + MIPITX_DSI_PLL_TOP, 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 208 RG_DSI_MPPLL_PRESERVE, 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 209 mipi_tx->driver_data->mppll_preserve); 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 210 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 211 return 0; 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 212 } 78e01a8d0f4662 drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c Jitao Shi 2019-08-07 213 :::::: The code at line 207 was first introduced by commit :::::: bd4ba730ff28985c0ecb49da1c6f18488666aa4f phy: mediatek: mipi: mt8173: use common helper to access registers :::::: TO: Chunfeng Yun :::::: CC: Vinod Koul -- 0-DAY CI Kernel Test Service https://01.org/lkp