drivers/net/usb/lan78xx.c:2963:27: sparse: sparse: incorrect type in assignment (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 136057256686de39cc3a07c2e39ef6bc43003ff6
commit: d991bb1c8da842a2a0b9dc83b1005e655783f861 include/linux/compiler-gcc.h: sparse can do constant folding of __builtin_bswap*()
date: 7 months ago
config: i386-randconfig-s002-20211123 (https://download.01.org/0day-ci/archive/20211124/202111240417.62gcvdWw-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout d991bb1c8da842a2a0b9dc83b1005e655783f861
# save the config file to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/net/usb/lan78xx.c:2963:29: sparse: sparse: cast to restricted __be16
>> drivers/net/usb/lan78xx.c:2963:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __wsum [usertype] csum @@ got unsigned short [usertype] @@
drivers/net/usb/lan78xx.c:2963:27: sparse: expected restricted __wsum [usertype] csum
drivers/net/usb/lan78xx.c:2963:27: sparse: got unsigned short [usertype]
vim +2963 drivers/net/usb/lan78xx.c
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2949
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2950 static void lan78xx_rx_csum_offload(struct lan78xx_net *dev,
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2951 struct sk_buff *skb,
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2952 u32 rx_cmd_a, u32 rx_cmd_b)
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2953 {
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2954 /* HW Checksum offload appears to be flawed if used when not stripping
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2955 * VLAN headers. Drop back to S/W checksums under these conditions.
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2956 */
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2957 if (!(dev->net->features & NETIF_F_RXCSUM) ||
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2958 unlikely(rx_cmd_a & RX_CMD_A_ICSM_) ||
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2959 ((rx_cmd_a & RX_CMD_A_FVTG_) &&
9343ac87f2a4e0 Dave Stevenson 2018-06-25 2960 !(dev->net->features & NETIF_F_HW_VLAN_CTAG_RX))) {
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2961 skb->ip_summed = CHECKSUM_NONE;
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2962 } else {
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 @2963 skb->csum = ntohs((u16)(rx_cmd_b >> RX_CMD_B_CSUM_SHIFT_));
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2964 skb->ip_summed = CHECKSUM_COMPLETE;
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2965 }
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2966 }
55d7de9de6c30a Woojung.Huh(a)microchip.com 2015-07-30 2967
:::::: The code at line 2963 was first introduced by commit
:::::: 55d7de9de6c30adce8d675c7ce513e283829c2ff Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver
:::::: TO: Woojung.Huh(a)microchip.com <Woojung.Huh(a)microchip.com>
:::::: CC: David S. Miller <davem(a)davemloft.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: sparse: incorrect type in initializer (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 136057256686de39cc3a07c2e39ef6bc43003ff6
commit: 4c9398822106c366d88c8c68ddf44bd371d39961 PCI: qcom: Add support for configuring BDF to SID mapping for SM8250
date: 12 months ago
config: alpha-randconfig-s032-20211117 (https://download.01.org/0day-ci/archive/20211124/202111240329.0m3Z5QZm-lk...)
compiler: alpha-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 4c9398822106c366d88c8c68ddf44bd371d39961
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [usertype] bdf_be @@ got restricted __be16 [usertype] @@
drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: expected unsigned short [usertype] bdf_be
drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: got restricted __be16 [usertype]
vim +1305 drivers/pci/controller/dwc/pcie-qcom.c
1266
1267 static int qcom_pcie_config_sid_sm8250(struct qcom_pcie *pcie)
1268 {
1269 /* iommu map structure */
1270 struct {
1271 u32 bdf;
1272 u32 phandle;
1273 u32 smmu_sid;
1274 u32 smmu_sid_len;
1275 } *map;
1276 void __iomem *bdf_to_sid_base = pcie->parf + PCIE20_PARF_BDF_TO_SID_TABLE_N;
1277 struct device *dev = pcie->pci->dev;
1278 u8 qcom_pcie_crc8_table[CRC8_TABLE_SIZE];
1279 int i, nr_map, size = 0;
1280 u32 smmu_sid_base;
1281
1282 of_get_property(dev->of_node, "iommu-map", &size);
1283 if (!size)
1284 return 0;
1285
1286 map = kzalloc(size, GFP_KERNEL);
1287 if (!map)
1288 return -ENOMEM;
1289
1290 of_property_read_u32_array(dev->of_node,
1291 "iommu-map", (u32 *)map, size / sizeof(u32));
1292
1293 nr_map = size / (sizeof(*map));
1294
1295 crc8_populate_msb(qcom_pcie_crc8_table, QCOM_PCIE_CRC8_POLYNOMIAL);
1296
1297 /* Registers need to be zero out first */
1298 memset_io(bdf_to_sid_base, 0, CRC8_TABLE_SIZE * sizeof(u32));
1299
1300 /* Extract the SMMU SID base from the first entry of iommu-map */
1301 smmu_sid_base = map[0].smmu_sid;
1302
1303 /* Look for an available entry to hold the mapping */
1304 for (i = 0; i < nr_map; i++) {
> 1305 u16 bdf_be = cpu_to_be16(map[i].bdf);
1306 u32 val;
1307 u8 hash;
1308
1309 hash = crc8(qcom_pcie_crc8_table, (u8 *)&bdf_be, sizeof(bdf_be),
1310 0);
1311
1312 val = readl(bdf_to_sid_base + hash * sizeof(u32));
1313
1314 /* If the register is already populated, look for next available entry */
1315 while (val) {
1316 u8 current_hash = hash++;
1317 u8 next_mask = 0xff;
1318
1319 /* If NEXT field is NULL then update it with next hash */
1320 if (!(val & next_mask)) {
1321 val |= (u32)hash;
1322 writel(val, bdf_to_sid_base + current_hash * sizeof(u32));
1323 }
1324
1325 val = readl(bdf_to_sid_base + hash * sizeof(u32));
1326 }
1327
1328 /* BDF [31:16] | SID [15:8] | NEXT [7:0] */
1329 val = map[i].bdf << 16 | (map[i].smmu_sid - smmu_sid_base) << 8 | 0;
1330 writel(val, bdf_to_sid_base + hash * sizeof(u32));
1331 }
1332
1333 kfree(map);
1334
1335 return 0;
1336 }
1337
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
arch/mips/mm/tlbex.c:2243:3: warning: unannotated fall-through between switch labels
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 136057256686de39cc3a07c2e39ef6bc43003ff6
commit: dee2b702bcf067d7b6b62c18bdd060ff0810a800 kconfig: Add support for -Wimplicit-fallthrough
date: 8 days ago
config: mips-randconfig-r016-20211116 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
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
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout dee2b702bcf067d7b6b62c18bdd060ff0810a800
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> arch/mips/mm/tlbex.c:2243:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case CPU_CAVIUM_OCTEON:
^
arch/mips/mm/tlbex.c:2243:3: note: insert 'break;' to avoid fall-through
case CPU_CAVIUM_OCTEON:
^
break;
arch/mips/mm/tlbex.c:2602:6: warning: no previous prototype for function 'build_tlb_refill_handler' [-Wmissing-prototypes]
void build_tlb_refill_handler(void)
^
arch/mips/mm/tlbex.c:2602:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void build_tlb_refill_handler(void)
^
static
arch/mips/mm/tlbex.c:185:1: warning: unused function 'uasm_l_second_part' [-Wunused-function]
UASM_L_LA(_second_part)
^
arch/mips/include/asm/uasm.h:205:20: note: expanded from macro 'UASM_L_LA'
static inline void uasm_l##lb(struct uasm_label **lab, u32 *addr) \
^
<scratch space>:164:1: note: expanded from here
uasm_l_second_part
^
arch/mips/mm/tlbex.c:197:1: warning: unused function 'uasm_l_r3000_write_probe_fail' [-Wunused-function]
UASM_L_LA(_r3000_write_probe_fail)
^
arch/mips/include/asm/uasm.h:205:20: note: expanded from macro 'UASM_L_LA'
static inline void uasm_l##lb(struct uasm_label **lab, u32 *addr) \
^
<scratch space>:186:1: note: expanded from here
uasm_l_r3000_write_probe_fail
^
4 warnings generated.
vim +2243 arch/mips/mm/tlbex.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 2107
078a55fc824c16 Paul Gortmaker 2013-06-18 2108 static void build_r4000_tlb_load_handler(void)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2109 {
2c0e57eaef3c2b Paul Burton 2016-11-07 2110 u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbl);
e30ec4525d4731 Thiemo Seufer 2008-01-28 2111 struct uasm_label *l = labels;
e30ec4525d4731 Thiemo Seufer 2008-01-28 2112 struct uasm_reloc *r = relocs;
bf28607fbe529e David Daney 2011-07-05 2113 struct work_registers wr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2114
4bcb4ad6634ea1 Paul Burton 2018-08-10 2115 memset(p, 0, handle_tlbl_end - (char *)p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2116 memset(labels, 0, sizeof(labels));
^1da177e4c3f41 Linus Torvalds 2005-04-16 2117 memset(relocs, 0, sizeof(relocs));
^1da177e4c3f41 Linus Torvalds 2005-04-16 2118
^1da177e4c3f41 Linus Torvalds 2005-04-16 2119 if (bcm1250_m3_war()) {
3d45285dd1ff4d Ralf Baechle 2010-03-23 2120 unsigned int segbits = 44;
3d45285dd1ff4d Ralf Baechle 2010-03-23 2121
3d45285dd1ff4d Ralf Baechle 2010-03-23 2122 uasm_i_dmfc0(&p, K0, C0_BADVADDR);
3d45285dd1ff4d Ralf Baechle 2010-03-23 2123 uasm_i_dmfc0(&p, K1, C0_ENTRYHI);
e30ec4525d4731 Thiemo Seufer 2008-01-28 2124 uasm_i_xor(&p, K0, K0, K1);
3be6022c27ace1 David Daney 2010-04-28 2125 uasm_i_dsrl_safe(&p, K1, K0, 62);
3be6022c27ace1 David Daney 2010-04-28 2126 uasm_i_dsrl_safe(&p, K0, K0, 12 + 1);
3be6022c27ace1 David Daney 2010-04-28 2127 uasm_i_dsll_safe(&p, K0, K0, 64 + 12 + 1 - segbits);
3d45285dd1ff4d Ralf Baechle 2010-03-23 2128 uasm_i_or(&p, K0, K0, K1);
e30ec4525d4731 Thiemo Seufer 2008-01-28 2129 uasm_il_bnez(&p, &r, K0, label_leave);
e30ec4525d4731 Thiemo Seufer 2008-01-28 2130 /* No need for uasm_i_nop */
^1da177e4c3f41 Linus Torvalds 2005-04-16 2131 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2132
bf28607fbe529e David Daney 2011-07-05 2133 wr = build_r4000_tlbchange_handler_head(&p, &l, &r);
bf28607fbe529e David Daney 2011-07-05 2134 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl);
8df5beac2aa15b Maciej W. Rozycki 2006-08-23 2135 if (m4kc_tlbp_war())
8df5beac2aa15b Maciej W. Rozycki 2006-08-23 2136 build_tlb_probe_entry(&p);
6dd9344cfc41bc David Daney 2010-02-10 2137
5890f70f15c52d Leonid Yegoshin 2014-07-15 2138 if (cpu_has_rixi && !cpu_has_rixiex) {
6dd9344cfc41bc David Daney 2010-02-10 2139 /*
6dd9344cfc41bc David Daney 2010-02-10 2140 * If the page is not _PAGE_VALID, RI or XI could not
6dd9344cfc41bc David Daney 2010-02-10 2141 * have triggered it. Skip the expensive test..
6dd9344cfc41bc David Daney 2010-02-10 2142 */
cc33ae43797541 David Daney 2010-12-20 2143 if (use_bbit_insns()) {
bf28607fbe529e David Daney 2011-07-05 2144 uasm_il_bbit0(&p, &r, wr.r1, ilog2(_PAGE_VALID),
cc33ae43797541 David Daney 2010-12-20 2145 label_tlbl_goaround1);
cc33ae43797541 David Daney 2010-12-20 2146 } else {
bf28607fbe529e David Daney 2011-07-05 2147 uasm_i_andi(&p, wr.r3, wr.r1, _PAGE_VALID);
bf28607fbe529e David Daney 2011-07-05 2148 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround1);
cc33ae43797541 David Daney 2010-12-20 2149 }
6dd9344cfc41bc David Daney 2010-02-10 2150 uasm_i_nop(&p);
6dd9344cfc41bc David Daney 2010-02-10 2151
f39878cc5b09c7 Paul Burton 2017-06-02 2152 /*
f39878cc5b09c7 Paul Burton 2017-06-02 2153 * Warn if something may race with us & replace the TLB entry
f39878cc5b09c7 Paul Burton 2017-06-02 2154 * before we read it here. Everything with such races should
f39878cc5b09c7 Paul Burton 2017-06-02 2155 * also have dedicated RiXi exception handlers, so this
f39878cc5b09c7 Paul Burton 2017-06-02 2156 * shouldn't be hit.
f39878cc5b09c7 Paul Burton 2017-06-02 2157 */
f39878cc5b09c7 Paul Burton 2017-06-02 2158 WARN(cpu_has_tlbex_tlbp_race(), "Unhandled race in RiXi path");
f39878cc5b09c7 Paul Burton 2017-06-02 2159
6dd9344cfc41bc David Daney 2010-02-10 2160 uasm_i_tlbr(&p);
73acc7df534ff4 Ralf Baechle 2013-06-20 2161
73acc7df534ff4 Ralf Baechle 2013-06-20 2162 switch (current_cpu_type()) {
73acc7df534ff4 Ralf Baechle 2013-06-20 2163 default:
77f3ee59ee7cfe Leonid Yegoshin 2014-11-24 2164 if (cpu_has_mips_r2_exec_hazard) {
73acc7df534ff4 Ralf Baechle 2013-06-20 2165 uasm_i_ehb(&p);
bc431d2153cc29 Gustavo A. R. Silva 2021-07-13 2166 fallthrough;
73acc7df534ff4 Ralf Baechle 2013-06-20 2167
73acc7df534ff4 Ralf Baechle 2013-06-20 2168 case CPU_CAVIUM_OCTEON:
73acc7df534ff4 Ralf Baechle 2013-06-20 2169 case CPU_CAVIUM_OCTEON_PLUS:
73acc7df534ff4 Ralf Baechle 2013-06-20 2170 case CPU_CAVIUM_OCTEON2:
73acc7df534ff4 Ralf Baechle 2013-06-20 2171 break;
73acc7df534ff4 Ralf Baechle 2013-06-20 2172 }
73acc7df534ff4 Ralf Baechle 2013-06-20 2173 }
73acc7df534ff4 Ralf Baechle 2013-06-20 2174
6dd9344cfc41bc David Daney 2010-02-10 2175 /* Examine entrylo 0 or 1 based on ptr. */
cc33ae43797541 David Daney 2010-12-20 2176 if (use_bbit_insns()) {
bf28607fbe529e David Daney 2011-07-05 2177 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
cc33ae43797541 David Daney 2010-12-20 2178 } else {
bf28607fbe529e David Daney 2011-07-05 2179 uasm_i_andi(&p, wr.r3, wr.r2, sizeof(pte_t));
bf28607fbe529e David Daney 2011-07-05 2180 uasm_i_beqz(&p, wr.r3, 8);
cc33ae43797541 David Daney 2010-12-20 2181 }
bf28607fbe529e David Daney 2011-07-05 2182 /* load it in the delay slot*/
bf28607fbe529e David Daney 2011-07-05 2183 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO0);
bf28607fbe529e David Daney 2011-07-05 2184 /* load it if ptr is odd */
bf28607fbe529e David Daney 2011-07-05 2185 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO1);
6dd9344cfc41bc David Daney 2010-02-10 2186 /*
bf28607fbe529e David Daney 2011-07-05 2187 * If the entryLo (now in wr.r3) is valid (bit 1), RI or
6dd9344cfc41bc David Daney 2010-02-10 2188 * XI must have triggered it.
6dd9344cfc41bc David Daney 2010-02-10 2189 */
cc33ae43797541 David Daney 2010-12-20 2190 if (use_bbit_insns()) {
bf28607fbe529e David Daney 2011-07-05 2191 uasm_il_bbit1(&p, &r, wr.r3, 1, label_nopage_tlbl);
bf28607fbe529e David Daney 2011-07-05 2192 uasm_i_nop(&p);
cc33ae43797541 David Daney 2010-12-20 2193 uasm_l_tlbl_goaround1(&l, p);
cc33ae43797541 David Daney 2010-12-20 2194 } else {
bf28607fbe529e David Daney 2011-07-05 2195 uasm_i_andi(&p, wr.r3, wr.r3, 2);
bf28607fbe529e David Daney 2011-07-05 2196 uasm_il_bnez(&p, &r, wr.r3, label_nopage_tlbl);
bf28607fbe529e David Daney 2011-07-05 2197 uasm_i_nop(&p);
6dd9344cfc41bc David Daney 2010-02-10 2198 }
bf28607fbe529e David Daney 2011-07-05 2199 uasm_l_tlbl_goaround1(&l, p);
cc33ae43797541 David Daney 2010-12-20 2200 }
bbeeffec6f14a0 Paul Burton 2016-04-19 2201 build_make_valid(&p, &r, wr.r1, wr.r2, wr.r3);
bf28607fbe529e David Daney 2011-07-05 2202 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2203
aa1762f49c81a1 David Daney 2012-10-17 2204 #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
fd062c847a8cea David Daney 2009-05-27 2205 /*
fd062c847a8cea David Daney 2009-05-27 2206 * This is the entry point when build_r4000_tlbchange_handler_head
fd062c847a8cea David Daney 2009-05-27 2207 * spots a huge page.
fd062c847a8cea David Daney 2009-05-27 2208 */
fd062c847a8cea David Daney 2009-05-27 2209 uasm_l_tlb_huge_update(&l, p);
bf28607fbe529e David Daney 2011-07-05 2210 iPTE_LW(&p, wr.r1, wr.r2);
bf28607fbe529e David Daney 2011-07-05 2211 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl);
fd062c847a8cea David Daney 2009-05-27 2212 build_tlb_probe_entry(&p);
6dd9344cfc41bc David Daney 2010-02-10 2213
5890f70f15c52d Leonid Yegoshin 2014-07-15 2214 if (cpu_has_rixi && !cpu_has_rixiex) {
6dd9344cfc41bc David Daney 2010-02-10 2215 /*
6dd9344cfc41bc David Daney 2010-02-10 2216 * If the page is not _PAGE_VALID, RI or XI could not
6dd9344cfc41bc David Daney 2010-02-10 2217 * have triggered it. Skip the expensive test..
6dd9344cfc41bc David Daney 2010-02-10 2218 */
cc33ae43797541 David Daney 2010-12-20 2219 if (use_bbit_insns()) {
bf28607fbe529e David Daney 2011-07-05 2220 uasm_il_bbit0(&p, &r, wr.r1, ilog2(_PAGE_VALID),
cc33ae43797541 David Daney 2010-12-20 2221 label_tlbl_goaround2);
cc33ae43797541 David Daney 2010-12-20 2222 } else {
bf28607fbe529e David Daney 2011-07-05 2223 uasm_i_andi(&p, wr.r3, wr.r1, _PAGE_VALID);
bf28607fbe529e David Daney 2011-07-05 2224 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2);
cc33ae43797541 David Daney 2010-12-20 2225 }
6dd9344cfc41bc David Daney 2010-02-10 2226 uasm_i_nop(&p);
6dd9344cfc41bc David Daney 2010-02-10 2227
f39878cc5b09c7 Paul Burton 2017-06-02 2228 /*
f39878cc5b09c7 Paul Burton 2017-06-02 2229 * Warn if something may race with us & replace the TLB entry
f39878cc5b09c7 Paul Burton 2017-06-02 2230 * before we read it here. Everything with such races should
f39878cc5b09c7 Paul Burton 2017-06-02 2231 * also have dedicated RiXi exception handlers, so this
f39878cc5b09c7 Paul Burton 2017-06-02 2232 * shouldn't be hit.
f39878cc5b09c7 Paul Burton 2017-06-02 2233 */
f39878cc5b09c7 Paul Burton 2017-06-02 2234 WARN(cpu_has_tlbex_tlbp_race(), "Unhandled race in RiXi path");
f39878cc5b09c7 Paul Burton 2017-06-02 2235
6dd9344cfc41bc David Daney 2010-02-10 2236 uasm_i_tlbr(&p);
73acc7df534ff4 Ralf Baechle 2013-06-20 2237
73acc7df534ff4 Ralf Baechle 2013-06-20 2238 switch (current_cpu_type()) {
73acc7df534ff4 Ralf Baechle 2013-06-20 2239 default:
77f3ee59ee7cfe Leonid Yegoshin 2014-11-24 2240 if (cpu_has_mips_r2_exec_hazard) {
73acc7df534ff4 Ralf Baechle 2013-06-20 2241 uasm_i_ehb(&p);
73acc7df534ff4 Ralf Baechle 2013-06-20 2242
73acc7df534ff4 Ralf Baechle 2013-06-20 @2243 case CPU_CAVIUM_OCTEON:
73acc7df534ff4 Ralf Baechle 2013-06-20 2244 case CPU_CAVIUM_OCTEON_PLUS:
73acc7df534ff4 Ralf Baechle 2013-06-20 2245 case CPU_CAVIUM_OCTEON2:
73acc7df534ff4 Ralf Baechle 2013-06-20 2246 break;
73acc7df534ff4 Ralf Baechle 2013-06-20 2247 }
73acc7df534ff4 Ralf Baechle 2013-06-20 2248 }
73acc7df534ff4 Ralf Baechle 2013-06-20 2249
6dd9344cfc41bc David Daney 2010-02-10 2250 /* Examine entrylo 0 or 1 based on ptr. */
cc33ae43797541 David Daney 2010-12-20 2251 if (use_bbit_insns()) {
bf28607fbe529e David Daney 2011-07-05 2252 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
cc33ae43797541 David Daney 2010-12-20 2253 } else {
bf28607fbe529e David Daney 2011-07-05 2254 uasm_i_andi(&p, wr.r3, wr.r2, sizeof(pte_t));
bf28607fbe529e David Daney 2011-07-05 2255 uasm_i_beqz(&p, wr.r3, 8);
cc33ae43797541 David Daney 2010-12-20 2256 }
bf28607fbe529e David Daney 2011-07-05 2257 /* load it in the delay slot*/
bf28607fbe529e David Daney 2011-07-05 2258 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO0);
bf28607fbe529e David Daney 2011-07-05 2259 /* load it if ptr is odd */
bf28607fbe529e David Daney 2011-07-05 2260 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO1);
6dd9344cfc41bc David Daney 2010-02-10 2261 /*
bf28607fbe529e David Daney 2011-07-05 2262 * If the entryLo (now in wr.r3) is valid (bit 1), RI or
6dd9344cfc41bc David Daney 2010-02-10 2263 * XI must have triggered it.
6dd9344cfc41bc David Daney 2010-02-10 2264 */
cc33ae43797541 David Daney 2010-12-20 2265 if (use_bbit_insns()) {
bf28607fbe529e David Daney 2011-07-05 2266 uasm_il_bbit0(&p, &r, wr.r3, 1, label_tlbl_goaround2);
cc33ae43797541 David Daney 2010-12-20 2267 } else {
bf28607fbe529e David Daney 2011-07-05 2268 uasm_i_andi(&p, wr.r3, wr.r3, 2);
bf28607fbe529e David Daney 2011-07-05 2269 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2);
cc33ae43797541 David Daney 2010-12-20 2270 }
0f4ccbc835036c David Daney 2011-09-16 2271 if (PM_DEFAULT_MASK == 0)
0f4ccbc835036c David Daney 2011-09-16 2272 uasm_i_nop(&p);
6dd9344cfc41bc David Daney 2010-02-10 2273 /*
6dd9344cfc41bc David Daney 2010-02-10 2274 * We clobbered C0_PAGEMASK, restore it. On the other branch
6dd9344cfc41bc David Daney 2010-02-10 2275 * it is restored in build_huge_tlb_write_entry.
6dd9344cfc41bc David Daney 2010-02-10 2276 */
bf28607fbe529e David Daney 2011-07-05 2277 build_restore_pagemask(&p, &r, wr.r3, label_nopage_tlbl, 0);
6dd9344cfc41bc David Daney 2010-02-10 2278
6dd9344cfc41bc David Daney 2010-02-10 2279 uasm_l_tlbl_goaround2(&l, p);
6dd9344cfc41bc David Daney 2010-02-10 2280 }
bf28607fbe529e David Daney 2011-07-05 2281 uasm_i_ori(&p, wr.r1, wr.r1, (_PAGE_ACCESSED | _PAGE_VALID));
0115f6cbf26663 Huacai Chen 2017-03-16 2282 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2, 1);
fd062c847a8cea David Daney 2009-05-27 2283 #endif
fd062c847a8cea David Daney 2009-05-27 2284
e30ec4525d4731 Thiemo Seufer 2008-01-28 2285 uasm_l_nopage_tlbl(&l, p);
e02e07e3127d8a Huacai Chen 2019-01-15 2286 if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS))
e02e07e3127d8a Huacai Chen 2019-01-15 2287 uasm_i_sync(&p, 0);
bf28607fbe529e David Daney 2011-07-05 2288 build_restore_work_registers(&p);
2a0b24f56c2492 Steven J. Hill 2013-03-25 2289 #ifdef CONFIG_CPU_MICROMIPS
2a0b24f56c2492 Steven J. Hill 2013-03-25 2290 if ((unsigned long)tlb_do_page_fault_0 & 1) {
2a0b24f56c2492 Steven J. Hill 2013-03-25 2291 uasm_i_lui(&p, K0, uasm_rel_hi((long)tlb_do_page_fault_0));
2a0b24f56c2492 Steven J. Hill 2013-03-25 2292 uasm_i_addiu(&p, K0, K0, uasm_rel_lo((long)tlb_do_page_fault_0));
2a0b24f56c2492 Steven J. Hill 2013-03-25 2293 uasm_i_jr(&p, K0);
2a0b24f56c2492 Steven J. Hill 2013-03-25 2294 } else
2a0b24f56c2492 Steven J. Hill 2013-03-25 2295 #endif
e30ec4525d4731 Thiemo Seufer 2008-01-28 2296 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff);
e30ec4525d4731 Thiemo Seufer 2008-01-28 2297 uasm_i_nop(&p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2298
4bcb4ad6634ea1 Paul Burton 2018-08-10 2299 if (p >= (u32 *)handle_tlbl_end)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2300 panic("TLB load handler fastpath space exceeded");
^1da177e4c3f41 Linus Torvalds 2005-04-16 2301
e30ec4525d4731 Thiemo Seufer 2008-01-28 2302 uasm_resolve_relocs(relocs, labels);
e30ec4525d4731 Thiemo Seufer 2008-01-28 2303 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n",
4bcb4ad6634ea1 Paul Burton 2018-08-10 2304 (unsigned int)(p - (u32 *)handle_tlbl));
^1da177e4c3f41 Linus Torvalds 2005-04-16 2305
4bcb4ad6634ea1 Paul Burton 2018-08-10 2306 dump_handler("r4000_tlb_load", handle_tlbl, handle_tlbl_end);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2307 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2308
:::::: The code at line 2243 was first introduced by commit
:::::: 73acc7df534ff458a81435178dab3ea037ed6d78 MIPS: Fix TLBR-use hazards for R2 cores in the TLB reload handlers
:::::: TO: Ralf Baechle <ralf(a)linux-mips.org>
:::::: CC: Ralf Baechle <ralf(a)linux-mips.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
[android-common:android-4.14-stable 18166/25403] htmldocs: Documentation/block/inline-encryption.rst:119: ERROR: Unexpected indentation.
by kernel test robot
Hi Satya,
FYI, the error/warning still remains.
tree: https://android.googlesource.com/kernel/common android-4.14-stable
head: df8b534e51541e55a1b1f0009ebcbb6a49f34b18
commit: ec0b569b5cc89391d9d6c90d2f76dc0a4db03e57 [18166/25403] BACKPORT: FROMLIST: block: blk-crypto for Inline Encryption
reproduce: make htmldocs
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
Documentation/block/inline-encryption.rst:119: ERROR: Unexpected indentation.
vim +119 Documentation/block/inline-encryption.rst
116
117 **Case 1:** blk-crypto is given a bio with only an encryption context that hasn't
118 been programmed into any keyslot in any KSM (for e.g. a bio from the FS).
> 119 In this case, blk-crypto will program the encryption context into the KSM of the
120 request queue the bio is being submitted to (and if this KSM does not exist,
121 then it will program it into blk-crypto's internal KSM for crypto API
122 fallback). The KSM that this encryption context was programmed into is stored
123 as the ``processing_ksm`` in the bio's ``bi_crypt_context``.
124
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
[hch-misc:dax-block-cleanup 18/29] fs/ext4/inode.c:3784:24: error: implicit declaration of function 'dax_zero_range'; did you mean 'iomap_zero_range'?
by kernel test robot
tree: git://git.infradead.org/users/hch/misc.git dax-block-cleanup
head: 66907b1fedc7f04eadf903bb484c55901b96298c
commit: c33e2c44d0f96e5849d131ad472e7ed58bd6f23b [18/29] fsdax: decouple zeroing from the iomap buffered I/O code
config: ia64-buildonly-randconfig-r002-20211123 (https://download.01.org/0day-ci/archive/20211124/202111240110.kx7cgC4E-lk...)
compiler: ia64-linux-gcc (GCC) 11.2.0
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
git remote add hch-misc git://git.infradead.org/users/hch/misc.git
git fetch --no-tags hch-misc dax-block-cleanup
git checkout c33e2c44d0f96e5849d131ad472e7ed58bd6f23b
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/ia64/include/asm/pgtable.h:153,
from include/linux/pgtable.h:6,
from arch/ia64/include/asm/uaccess.h:40,
from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from fs/ext4/inode.c:22:
arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
arch/ia64/include/asm/mmu_context.h:127:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
127 | unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
| ^~~~~~~
fs/ext4/inode.c: In function 'ext4_block_zero_page_range':
>> fs/ext4/inode.c:3784:24: error: implicit declaration of function 'dax_zero_range'; did you mean 'iomap_zero_range'? [-Werror=implicit-function-declaration]
3784 | return dax_zero_range(inode, from, length, NULL,
| ^~~~~~~~~~~~~~
| iomap_zero_range
cc1: some warnings being treated as errors
--
In file included from arch/ia64/include/asm/pgtable.h:153,
from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from fs/xfs/kmem.h:11,
from fs/xfs/xfs_linux.h:24,
from fs/xfs/xfs.h:22,
from fs/xfs/xfs_iomap.c:7:
arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
arch/ia64/include/asm/mmu_context.h:127:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
127 | unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
| ^~~~~~~
fs/xfs/xfs_iomap.c: In function 'xfs_zero_range':
>> fs/xfs/xfs_iomap.c:1325:24: error: implicit declaration of function 'dax_zero_range'; did you mean 'xfs_zero_range'? [-Werror=implicit-function-declaration]
1325 | return dax_zero_range(inode, pos, len, did_zero,
| ^~~~~~~~~~~~~~
| xfs_zero_range
fs/xfs/xfs_iomap.c: In function 'xfs_truncate_page':
>> fs/xfs/xfs_iomap.c:1340:24: error: implicit declaration of function 'dax_truncate_page'; did you mean 'xfs_truncate_page'? [-Werror=implicit-function-declaration]
1340 | return dax_truncate_page(inode, pos, did_zero,
| ^~~~~~~~~~~~~~~~~
| xfs_truncate_page
cc1: some warnings being treated as errors
vim +3784 fs/ext4/inode.c
3760
3761 /*
3762 * ext4_block_zero_page_range() zeros out a mapping of length 'length'
3763 * starting from file offset 'from'. The range to be zero'd must
3764 * be contained with in one block. If the specified range exceeds
3765 * the end of the block it will be shortened to end of the block
3766 * that corresponds to 'from'
3767 */
3768 static int ext4_block_zero_page_range(handle_t *handle,
3769 struct address_space *mapping, loff_t from, loff_t length)
3770 {
3771 struct inode *inode = mapping->host;
3772 unsigned offset = from & (PAGE_SIZE-1);
3773 unsigned blocksize = inode->i_sb->s_blocksize;
3774 unsigned max = blocksize - (offset & (blocksize - 1));
3775
3776 /*
3777 * correct length if it does not fall between
3778 * 'from' and the end of the block
3779 */
3780 if (length > max || length < 0)
3781 length = max;
3782
3783 if (IS_DAX(inode)) {
> 3784 return dax_zero_range(inode, from, length, NULL,
3785 &ext4_iomap_ops);
3786 }
3787 return __ext4_block_zero_page_range(handle, mapping, from, length);
3788 }
3789
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
drivers/rtc/rtc-mxc.c:315:19: warning: cast to smaller integer type 'enum imx_rtc_type' from 'const void *'
by kernel test robot
Hi Alexandre,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 136057256686de39cc3a07c2e39ef6bc43003ff6
commit: 0020868f2a7037e87d6b3b196526de2fb885830d rtc: mxc{,_v2}: enable COMPILE_TEST
date: 12 months ago
config: arm64-randconfig-r005-20210928 (https://download.01.org/0day-ci/archive/20211124/202111240100.Ko1qnhsz-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 0020868f2a7037e87d6b3b196526de2fb885830d
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/rtc/rtc-mxc.c:315:19: warning: cast to smaller integer type 'enum imx_rtc_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
pdata->devtype = (enum imx_rtc_type)of_device_get_match_data(&pdev->dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
vim +315 drivers/rtc/rtc-mxc.c
fdc9f0eace99b2 Anson Huang 2020-03-16 302
5a167f4543e45d Greg Kroah-Hartman 2012-12-21 303 static int mxc_rtc_probe(struct platform_device *pdev)
d00ed3cf6e5431 Daniel Mack 2009-09-22 304 {
d00ed3cf6e5431 Daniel Mack 2009-09-22 305 struct rtc_device *rtc;
d00ed3cf6e5431 Daniel Mack 2009-09-22 306 struct rtc_plat_data *pdata = NULL;
d00ed3cf6e5431 Daniel Mack 2009-09-22 307 u32 reg;
c783a29efcbc90 Vladimir Zapolskiy 2010-04-06 308 unsigned long rate;
c783a29efcbc90 Vladimir Zapolskiy 2010-04-06 309 int ret;
d00ed3cf6e5431 Daniel Mack 2009-09-22 310
c783a29efcbc90 Vladimir Zapolskiy 2010-04-06 311 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
d00ed3cf6e5431 Daniel Mack 2009-09-22 312 if (!pdata)
d00ed3cf6e5431 Daniel Mack 2009-09-22 313 return -ENOMEM;
d00ed3cf6e5431 Daniel Mack 2009-09-22 314
ba7aa63000f26c Alexandre Belloni 2020-11-17 @315 pdata->devtype = (enum imx_rtc_type)of_device_get_match_data(&pdev->dev);
bb1d34a20d537e Shawn Guo 2012-09-15 316
cf37fa79a76170 Anson Huang 2019-04-01 317 pdata->ioaddr = devm_platform_ioremap_resource(pdev, 0);
7c1d69ee11b898 Julia Lawall 2013-09-11 318 if (IS_ERR(pdata->ioaddr))
7c1d69ee11b898 Julia Lawall 2013-09-11 319 return PTR_ERR(pdata->ioaddr);
d00ed3cf6e5431 Daniel Mack 2009-09-22 320
ebc2ec4ecf1893 Alexandre Belloni 2019-04-16 321 rtc = devm_rtc_allocate_device(&pdev->dev);
ebc2ec4ecf1893 Alexandre Belloni 2019-04-16 322 if (IS_ERR(rtc))
ebc2ec4ecf1893 Alexandre Belloni 2019-04-16 323 return PTR_ERR(rtc);
ebc2ec4ecf1893 Alexandre Belloni 2019-04-16 324
ebc2ec4ecf1893 Alexandre Belloni 2019-04-16 325 pdata->rtc = rtc;
ebc2ec4ecf1893 Alexandre Belloni 2019-04-16 326 rtc->ops = &mxc_rtc_ops;
83888df4b882d1 Alexandre Belloni 2019-04-16 327 if (is_imx1_rtc(pdata)) {
83888df4b882d1 Alexandre Belloni 2019-04-16 328 struct rtc_time tm;
83888df4b882d1 Alexandre Belloni 2019-04-16 329
83888df4b882d1 Alexandre Belloni 2019-04-16 330 /* 9bit days + hours minutes seconds */
83888df4b882d1 Alexandre Belloni 2019-04-16 331 rtc->range_max = (1 << 9) * 86400 - 1;
83888df4b882d1 Alexandre Belloni 2019-04-16 332
83888df4b882d1 Alexandre Belloni 2019-04-16 333 /*
83888df4b882d1 Alexandre Belloni 2019-04-16 334 * Set the start date as beginning of the current year. This can
83888df4b882d1 Alexandre Belloni 2019-04-16 335 * be overridden using device tree.
83888df4b882d1 Alexandre Belloni 2019-04-16 336 */
83888df4b882d1 Alexandre Belloni 2019-04-16 337 rtc_time64_to_tm(ktime_get_real_seconds(), &tm);
83888df4b882d1 Alexandre Belloni 2019-04-16 338 rtc->start_secs = mktime64(tm.tm_year, 1, 1, 0, 0, 0);
83888df4b882d1 Alexandre Belloni 2019-04-16 339 rtc->set_start_time = true;
83888df4b882d1 Alexandre Belloni 2019-04-16 340 } else {
83888df4b882d1 Alexandre Belloni 2019-04-16 341 /* 16bit days + hours minutes seconds */
83888df4b882d1 Alexandre Belloni 2019-04-16 342 rtc->range_max = (1 << 16) * 86400ULL - 1;
83888df4b882d1 Alexandre Belloni 2019-04-16 343 }
ebc2ec4ecf1893 Alexandre Belloni 2019-04-16 344
8f5fe77828e16e Philippe Reynes 2015-07-26 345 pdata->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
8f5fe77828e16e Philippe Reynes 2015-07-26 346 if (IS_ERR(pdata->clk_ipg)) {
8f5fe77828e16e Philippe Reynes 2015-07-26 347 dev_err(&pdev->dev, "unable to get ipg clock!\n");
8f5fe77828e16e Philippe Reynes 2015-07-26 348 return PTR_ERR(pdata->clk_ipg);
49908e739e23e2 Alexander Beregalov 2010-03-05 349 }
d00ed3cf6e5431 Daniel Mack 2009-09-22 350
8f5fe77828e16e Philippe Reynes 2015-07-26 351 ret = clk_prepare_enable(pdata->clk_ipg);
1b3d2243d049e0 Fabio Estevam 2014-01-23 352 if (ret)
1b3d2243d049e0 Fabio Estevam 2014-01-23 353 return ret;
1b3d2243d049e0 Fabio Estevam 2014-01-23 354
8f5fe77828e16e Philippe Reynes 2015-07-26 355 pdata->clk_ref = devm_clk_get(&pdev->dev, "ref");
8f5fe77828e16e Philippe Reynes 2015-07-26 356 if (IS_ERR(pdata->clk_ref)) {
fdc9f0eace99b2 Anson Huang 2020-03-16 357 clk_disable_unprepare(pdata->clk_ipg);
8f5fe77828e16e Philippe Reynes 2015-07-26 358 dev_err(&pdev->dev, "unable to get ref clock!\n");
fdc9f0eace99b2 Anson Huang 2020-03-16 359 return PTR_ERR(pdata->clk_ref);
8f5fe77828e16e Philippe Reynes 2015-07-26 360 }
8f5fe77828e16e Philippe Reynes 2015-07-26 361
8f5fe77828e16e Philippe Reynes 2015-07-26 362 ret = clk_prepare_enable(pdata->clk_ref);
fdc9f0eace99b2 Anson Huang 2020-03-16 363 if (ret) {
fdc9f0eace99b2 Anson Huang 2020-03-16 364 clk_disable_unprepare(pdata->clk_ipg);
fdc9f0eace99b2 Anson Huang 2020-03-16 365 return ret;
fdc9f0eace99b2 Anson Huang 2020-03-16 366 }
fdc9f0eace99b2 Anson Huang 2020-03-16 367
fdc9f0eace99b2 Anson Huang 2020-03-16 368 ret = devm_add_action_or_reset(&pdev->dev, mxc_rtc_action, pdata);
8f5fe77828e16e Philippe Reynes 2015-07-26 369 if (ret)
fdc9f0eace99b2 Anson Huang 2020-03-16 370 return ret;
8f5fe77828e16e Philippe Reynes 2015-07-26 371
8f5fe77828e16e Philippe Reynes 2015-07-26 372 rate = clk_get_rate(pdata->clk_ref);
d00ed3cf6e5431 Daniel Mack 2009-09-22 373
d00ed3cf6e5431 Daniel Mack 2009-09-22 374 if (rate == 32768)
d00ed3cf6e5431 Daniel Mack 2009-09-22 375 reg = RTC_INPUT_CLK_32768HZ;
d00ed3cf6e5431 Daniel Mack 2009-09-22 376 else if (rate == 32000)
d00ed3cf6e5431 Daniel Mack 2009-09-22 377 reg = RTC_INPUT_CLK_32000HZ;
d00ed3cf6e5431 Daniel Mack 2009-09-22 378 else if (rate == 38400)
d00ed3cf6e5431 Daniel Mack 2009-09-22 379 reg = RTC_INPUT_CLK_38400HZ;
d00ed3cf6e5431 Daniel Mack 2009-09-22 380 else {
c783a29efcbc90 Vladimir Zapolskiy 2010-04-06 381 dev_err(&pdev->dev, "rtc clock is not valid (%lu)\n", rate);
fdc9f0eace99b2 Anson Huang 2020-03-16 382 return -EINVAL;
d00ed3cf6e5431 Daniel Mack 2009-09-22 383 }
d00ed3cf6e5431 Daniel Mack 2009-09-22 384
d00ed3cf6e5431 Daniel Mack 2009-09-22 385 reg |= RTC_ENABLE_BIT;
d00ed3cf6e5431 Daniel Mack 2009-09-22 386 writew(reg, (pdata->ioaddr + RTC_RTCCTL));
d00ed3cf6e5431 Daniel Mack 2009-09-22 387 if (((readw(pdata->ioaddr + RTC_RTCCTL)) & RTC_ENABLE_BIT) == 0) {
d00ed3cf6e5431 Daniel Mack 2009-09-22 388 dev_err(&pdev->dev, "hardware module can't be enabled!\n");
fdc9f0eace99b2 Anson Huang 2020-03-16 389 return -EIO;
d00ed3cf6e5431 Daniel Mack 2009-09-22 390 }
d00ed3cf6e5431 Daniel Mack 2009-09-22 391
d00ed3cf6e5431 Daniel Mack 2009-09-22 392 platform_set_drvdata(pdev, pdata);
d00ed3cf6e5431 Daniel Mack 2009-09-22 393
d00ed3cf6e5431 Daniel Mack 2009-09-22 394 /* Configure and enable the RTC */
d00ed3cf6e5431 Daniel Mack 2009-09-22 395 pdata->irq = platform_get_irq(pdev, 0);
d00ed3cf6e5431 Daniel Mack 2009-09-22 396
d00ed3cf6e5431 Daniel Mack 2009-09-22 397 if (pdata->irq >= 0 &&
c783a29efcbc90 Vladimir Zapolskiy 2010-04-06 398 devm_request_irq(&pdev->dev, pdata->irq, mxc_rtc_interrupt,
c783a29efcbc90 Vladimir Zapolskiy 2010-04-06 399 IRQF_SHARED, pdev->name, pdev) < 0) {
d00ed3cf6e5431 Daniel Mack 2009-09-22 400 dev_warn(&pdev->dev, "interrupt not available.\n");
d00ed3cf6e5431 Daniel Mack 2009-09-22 401 pdata->irq = -1;
d00ed3cf6e5431 Daniel Mack 2009-09-22 402 }
d00ed3cf6e5431 Daniel Mack 2009-09-22 403
bc0e731fc2893f Anson Huang 2019-04-11 404 if (pdata->irq >= 0) {
c92182ee0b5a33 Yauhen Kharuzhy 2012-01-10 405 device_init_wakeup(&pdev->dev, 1);
bc0e731fc2893f Anson Huang 2019-04-11 406 ret = dev_pm_set_wake_irq(&pdev->dev, pdata->irq);
bc0e731fc2893f Anson Huang 2019-04-11 407 if (ret)
bc0e731fc2893f Anson Huang 2019-04-11 408 dev_err(&pdev->dev, "failed to enable irq wake\n");
bc0e731fc2893f Anson Huang 2019-04-11 409 }
c92182ee0b5a33 Yauhen Kharuzhy 2012-01-10 410
fdcfd854333be5 Bartosz Golaszewski 2020-11-09 411 ret = devm_rtc_register_device(rtc);
d00ed3cf6e5431 Daniel Mack 2009-09-22 412
d00ed3cf6e5431 Daniel Mack 2009-09-22 413 return ret;
d00ed3cf6e5431 Daniel Mack 2009-09-22 414 }
d00ed3cf6e5431 Daniel Mack 2009-09-22 415
:::::: The code at line 315 was first introduced by commit
:::::: ba7aa63000f26c5a2c87d5a716601499a02a3156 rtc: mxc: use of_device_get_match_data
:::::: TO: Alexandre Belloni <alexandre.belloni(a)bootlin.com>
:::::: CC: Alexandre Belloni <alexandre.belloni(a)bootlin.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
[freescale-fslc:pr/497 8447/15263] drivers/net/imx-shmem-net.c:1175:9: error: implicit declaration of function 'imx_scu_irq_unregister_notifier'; did you mean 'netlink_unregister_notifier'?
by kernel test robot
Hi Nitin,
FYI, the error/warning still remains.
tree: https://github.com/Freescale/linux-fslc pr/497
head: c5fbcc5588fcc56cc4c1fc9b9788ef051414225f
commit: 1730a5e196055cef89fe50dd63852ebc32cce135 [8447/15263] MLK-25346: net: add imx-shmem-net driver
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20211124/202111240157.0HXf1B8O-lk...)
compiler: arceb-elf-gcc (GCC) 11.2.0
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://github.com/Freescale/linux-fslc/commit/1730a5e196055cef89fe50dd63...
git remote add freescale-fslc https://github.com/Freescale/linux-fslc
git fetch --no-tags freescale-fslc pr/497
git checkout 1730a5e196055cef89fe50dd63852ebc32cce135
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/net/imx-shmem-net.c: In function 'mu_enable_reset_irq':
drivers/net/imx-shmem-net.c:993:13: warning: unused variable 'sciErr' [-Wunused-variable]
993 | int sciErr;
| ^~~~~~
drivers/net/imx-shmem-net.c: In function 'imx_shm_net_probe':
>> drivers/net/imx-shmem-net.c:1175:9: error: implicit declaration of function 'imx_scu_irq_unregister_notifier'; did you mean 'netlink_unregister_notifier'? [-Werror=implicit-function-declaration]
1175 | imx_scu_irq_unregister_notifier(&in->pnotifier);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| netlink_unregister_notifier
At top level:
drivers/net/imx-shmem-net.c:887:12: warning: 'imx_shm_partition_notify' defined but not used [-Wunused-function]
887 | static int imx_shm_partition_notify(struct notifier_block *nb,
| ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +1175 drivers/net/imx-shmem-net.c
1032
1033 static int imx_shm_net_probe(struct platform_device *pdev)
1034 {
1035 struct net_device *ndev = NULL;
1036 struct imx_shm_net *in;
1037 resource_size_t shmaddr;
1038 resource_size_t shmlen;
1039 char *device_name;
1040 void *shm = NULL;
1041 u32 ivpos;
1042 int ret;
1043
1044 /* check if 1st probe or another attempt after EAGAIN */
1045 if (pdev->dev.driver_data) {
1046 dev_dbg(&pdev->dev, "Retrying connection...\n");
1047 in = netdev_priv(platform_get_drvdata(pdev));
1048 goto retry;
1049 }
1050
1051 if (of_property_read_bool(pdev->dev.of_node, "rxfirst")) {
1052 ivpos = 1;
1053 dev_info(&pdev->dev, "queue position is RX first\n");
1054 } else {
1055 ivpos = 0;
1056 dev_info(&pdev->dev, "queue position is TX first\n");
1057 }
1058
1059 /* get shared coherent memory for buffers */
1060 if (of_reserved_mem_device_init(&pdev->dev)) {
1061 dev_err(&pdev->dev,
1062 "dev doesn't have specific DMA pool.\n");
1063 return -ENOMEM;
1064 }
1065 shmlen = IMX_SHM_NET_DMA_SIZE;
1066 shm = dma_alloc_coherent(&pdev->dev, IMX_SHM_NET_DMA_SIZE,
1067 &shmaddr, GFP_KERNEL);
1068 if (!shm || !shmaddr)
1069 return -ENOMEM;
1070
1071 dev_info(&pdev->dev, "allocated %d bytes in coherent mem @ 0x%x\n",
1072 (uint)shmlen, (uint)shmaddr);
1073
1074 device_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s[%s]", DRV_NAME,
1075 dev_name(&pdev->dev));
1076 if (!device_name) {
1077 ret = -ENOMEM;
1078 goto err_free_dma;
1079 }
1080
1081 ndev = alloc_etherdev(sizeof(*in));
1082 if (!ndev) {
1083 ret = -ENOMEM;
1084 goto err_free_dma;
1085 }
1086 dev_info(&pdev->dev, "allocated ethernet device %s\n", ndev->name);
1087
1088 platform_set_drvdata(pdev, ndev);
1089 SET_NETDEV_DEV(ndev, &pdev->dev);
1090
1091 /* get struct 'imx_shm_net' stored as private data in ndev */
1092 in = netdev_priv(ndev);
1093
1094 list_add(&in->isn_node, &imx_shm_net_head);
1095
1096 in->shm = shm;
1097 in->shmaddr = shmaddr;
1098 in->shmlen = shmlen;
1099 in->pdev = pdev;
1100 in->regs.ivpos = ivpos;
1101 in->regs.rstate = IMX_SHM_NET_STATE_RESET;
1102 in->remote_message = IMX_SHM_NET_STATE_RESET;
1103 spin_lock_init(&in->tx_free_lock);
1104 spin_lock_init(&in->tx_clean_lock);
1105 mutex_init(&in->state_lock);
1106
1107 /* enable peer's reset notification */
1108 ret = mu_enable_reset_irq(ndev);
1109 if (ret)
1110 goto err_free;
1111
1112 ret = imx_shm_net_calc_qsize(ndev);
1113 if (ret)
1114 goto err_reset_irq;
1115
1116 in->state_wq = alloc_ordered_workqueue(device_name, 0);
1117 if (!in->state_wq) {
1118 ret = -ENOMEM;
1119 goto err_reset_irq;
1120 }
1121
1122 INIT_WORK(&in->state_work, imx_shm_net_state_change);
1123
1124 eth_random_addr(ndev->dev_addr);
1125 ndev->netdev_ops = &imx_shm_net_ops;
1126 ndev->ethtool_ops = &imx_shm_net_ethtool_ops;
1127 ndev->mtu = min_t(u32, IMX_SHM_NET_MTU_DEF, in->qsize / 16);
1128 ndev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG;
1129 ndev->features = ndev->hw_features;
1130
1131 netif_carrier_off(ndev);
1132 netif_napi_add(ndev, &in->napi, imx_shm_net_poll, NAPI_POLL_WEIGHT);
1133
1134 ret = register_netdev(ndev);
1135 if (ret)
1136 goto err_wq;
1137
1138 /* initialize Mailbox for RX/TX */
1139 ret = imx_shm_xtr_channel_init(in);
1140 if (ret) {
1141 dev_err(&in->pdev->dev, "unable to initialize Mailbox.\n");
1142 /* MU may not be ready yet, need to try later on */
1143 ret = -EPROBE_DEFER;
1144 goto err_unregister;
1145 }
1146 dev_info(&in->pdev->dev,
1147 "Mailbox is ready for cross core communication!\n");
1148
1149 retry:
1150 /* notify reset */
1151 mutex_lock(&in->state_lock);
1152 in->regs.lstate = IMX_SHM_NET_STATE_RESET;
1153 in->message_state = MESS_STATE_NEW;
1154 mutex_unlock(&in->state_lock);
1155
1156 /* only device with queue position TXfirst sends the first message */
1157 if (!ivpos) {
1158 ret = mbox_send_message(in->tx_ch, &in->regs.lstate);
1159 if (ret < 0)
1160 dev_err(&pdev->dev, "%s first message error=%d!\n",
1161 __func__, ret);
1162
1163 dev_dbg(&pdev->dev, "%s sent first message\n", __func__);
1164 }
1165
1166 return 0;
1167
1168 err_unregister:
1169 unregister_netdev(ndev);
1170
1171 err_wq:
1172 destroy_workqueue(in->state_wq);
1173
1174 err_reset_irq:
> 1175 imx_scu_irq_unregister_notifier(&in->pnotifier);
1176
1177 err_free:
1178 list_del(&in->isn_node);
1179 free_netdev(ndev);
1180
1181 err_free_dma:
1182 dma_free_coherent(&pdev->dev, shmlen, shm, shmaddr);
1183
1184 return ret;
1185 }
1186
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
[hch-misc:dax-block-cleanup 18/29] fs/ext2/inode.c:1301:25: error: implicit declaration of function 'dax_zero_range'; did you mean 'iomap_zero_range'?
by kernel test robot
tree: git://git.infradead.org/users/hch/misc.git dax-block-cleanup
head: 66907b1fedc7f04eadf903bb484c55901b96298c
commit: c33e2c44d0f96e5849d131ad472e7ed58bd6f23b [18/29] fsdax: decouple zeroing from the iomap buffered I/O code
config: arc-randconfig-r043-20211123 (https://download.01.org/0day-ci/archive/20211124/202111240133.GdLCa9zq-lk...)
compiler: arc-elf-gcc (GCC) 11.2.0
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
git remote add hch-misc git://git.infradead.org/users/hch/misc.git
git fetch --no-tags hch-misc dax-block-cleanup
git checkout c33e2c44d0f96e5849d131ad472e7ed58bd6f23b
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
fs/ext2/inode.c: In function 'ext2_setsize':
>> fs/ext2/inode.c:1301:25: error: implicit declaration of function 'dax_zero_range'; did you mean 'iomap_zero_range'? [-Werror=implicit-function-declaration]
1301 | error = dax_zero_range(inode, newsize,
| ^~~~~~~~~~~~~~
| iomap_zero_range
cc1: some warnings being treated as errors
--
fs/ext4/inode.c: In function 'ext4_block_zero_page_range':
>> fs/ext4/inode.c:3784:24: error: implicit declaration of function 'dax_zero_range'; did you mean 'iomap_zero_range'? [-Werror=implicit-function-declaration]
3784 | return dax_zero_range(inode, from, length, NULL,
| ^~~~~~~~~~~~~~
| iomap_zero_range
cc1: some warnings being treated as errors
vim +1301 fs/ext2/inode.c
1285
1286 static int ext2_setsize(struct inode *inode, loff_t newsize)
1287 {
1288 int error;
1289
1290 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1291 S_ISLNK(inode->i_mode)))
1292 return -EINVAL;
1293 if (ext2_inode_is_fast_symlink(inode))
1294 return -EINVAL;
1295 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
1296 return -EPERM;
1297
1298 inode_dio_wait(inode);
1299
1300 if (IS_DAX(inode)) {
> 1301 error = dax_zero_range(inode, newsize,
1302 PAGE_ALIGN(newsize) - newsize, NULL,
1303 &ext2_iomap_ops);
1304 } else if (test_opt(inode->i_sb, NOBH))
1305 error = nobh_truncate_page(inode->i_mapping,
1306 newsize, ext2_get_block);
1307 else
1308 error = block_truncate_page(inode->i_mapping,
1309 newsize, ext2_get_block);
1310 if (error)
1311 return error;
1312
1313 filemap_invalidate_lock(inode->i_mapping);
1314 truncate_setsize(inode, newsize);
1315 __ext2_truncate_blocks(inode, newsize);
1316 filemap_invalidate_unlock(inode->i_mapping);
1317
1318 inode->i_mtime = inode->i_ctime = current_time(inode);
1319 if (inode_needs_sync(inode)) {
1320 sync_mapping_buffers(inode->i_mapping);
1321 sync_inode_metadata(inode, 1);
1322 } else {
1323 mark_inode_dirty(inode);
1324 }
1325
1326 return 0;
1327 }
1328
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
Re: [PATCH v2] i2c: tegra: Add ACPI support
by kernel test robot
Hi Akhil,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tegra/for-next]
[also build test ERROR on v5.16-rc2 next-20211123]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Akhil-R/i2c-tegra-Add-ACPI-suppo...
base: https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
config: riscv-buildonly-randconfig-r005-20211123 (https://download.01.org/0day-ci/archive/20211124/202111240017.bYyZ7knz-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 49e3838145dff1ec91c2e67a2cb562775c8d2a08)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/dec174be801f41a9e42f4381c59c2357c...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Akhil-R/i2c-tegra-Add-ACPI-support/20211123-151636
git checkout dec174be801f41a9e42f4381c59c2357c25e40fb
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/i2c/busses/i2c-tegra.c:13:
In file included from include/linux/dmaengine.h:12:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/i2c/busses/i2c-tegra.c:13:
In file included from include/linux/dmaengine.h:12:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/i2c/busses/i2c-tegra.c:13:
In file included from include/linux/dmaengine.h:12:
In file included from include/linux/scatterlist.h:9:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:1024:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^
>> drivers/i2c/busses/i2c-tegra.c:623:16: error: implicit declaration of function 'acpi_has_method' [-Werror,-Wimplicit-function-declaration]
if (handle && acpi_has_method(handle, "_RST"))
^
drivers/i2c/busses/i2c-tegra.c:623:16: note: did you mean 'acpi_has_watchdog'?
include/linux/acpi.h:1321:20: note: 'acpi_has_watchdog' declared here
static inline bool acpi_has_watchdog(void) { return false; }
^
7 warnings and 1 error generated.
vim +/acpi_has_method +623 drivers/i2c/busses/i2c-tegra.c
608
609 static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
610 {
611 u32 val, clk_divisor, clk_multiplier, tsu_thd, tlow, thigh, non_hs_mode;
612 acpi_handle handle = ACPI_HANDLE(i2c_dev->dev);
613 int err;
614
615 /*
616 * The reset shouldn't ever fail in practice. The failure will be a
617 * sign of a severe problem that needs to be resolved. Still we don't
618 * want to fail the initialization completely because this may break
619 * kernel boot up since voltage regulators use I2C. Hence, we will
620 * emit a noisy warning on error, which won't stay unnoticed and
621 * won't hose machine entirely.
622 */
> 623 if (handle && acpi_has_method(handle, "_RST"))
624 err = (acpi_evaluate_object(handle, "_RST", NULL, NULL));
625 else
626 err = reset_control_reset(i2c_dev->rst);
627
628 WARN_ON_ONCE(err);
629
630 if (i2c_dev->is_dvc)
631 tegra_dvc_init(i2c_dev);
632
633 val = I2C_CNFG_NEW_MASTER_FSM | I2C_CNFG_PACKET_MODE_EN |
634 FIELD_PREP(I2C_CNFG_DEBOUNCE_CNT, 2);
635
636 if (i2c_dev->hw->has_multi_master_mode)
637 val |= I2C_CNFG_MULTI_MASTER_MODE;
638
639 i2c_writel(i2c_dev, val, I2C_CNFG);
640 i2c_writel(i2c_dev, 0, I2C_INT_MASK);
641
642 if (i2c_dev->is_vi)
643 tegra_i2c_vi_init(i2c_dev);
644
645 switch (i2c_dev->bus_clk_rate) {
646 case I2C_MAX_STANDARD_MODE_FREQ + 1 ... I2C_MAX_FAST_MODE_PLUS_FREQ:
647 default:
648 tlow = i2c_dev->hw->tlow_fast_fastplus_mode;
649 thigh = i2c_dev->hw->thigh_fast_fastplus_mode;
650 tsu_thd = i2c_dev->hw->setup_hold_time_fast_fast_plus_mode;
651
652 if (i2c_dev->bus_clk_rate > I2C_MAX_FAST_MODE_FREQ)
653 non_hs_mode = i2c_dev->hw->clk_divisor_fast_plus_mode;
654 else
655 non_hs_mode = i2c_dev->hw->clk_divisor_fast_mode;
656 break;
657
658 case 0 ... I2C_MAX_STANDARD_MODE_FREQ:
659 tlow = i2c_dev->hw->tlow_std_mode;
660 thigh = i2c_dev->hw->thigh_std_mode;
661 tsu_thd = i2c_dev->hw->setup_hold_time_std_mode;
662 non_hs_mode = i2c_dev->hw->clk_divisor_std_mode;
663 break;
664 }
665
666 /* make sure clock divisor programmed correctly */
667 clk_divisor = FIELD_PREP(I2C_CLK_DIVISOR_HSMODE,
668 i2c_dev->hw->clk_divisor_hs_mode) |
669 FIELD_PREP(I2C_CLK_DIVISOR_STD_FAST_MODE, non_hs_mode);
670 i2c_writel(i2c_dev, clk_divisor, I2C_CLK_DIVISOR);
671
672 if (i2c_dev->hw->has_interface_timing_reg) {
673 val = FIELD_PREP(I2C_INTERFACE_TIMING_THIGH, thigh) |
674 FIELD_PREP(I2C_INTERFACE_TIMING_TLOW, tlow);
675 i2c_writel(i2c_dev, val, I2C_INTERFACE_TIMING_0);
676 }
677
678 /*
679 * Configure setup and hold times only when tsu_thd is non-zero.
680 * Otherwise, preserve the chip default values.
681 */
682 if (i2c_dev->hw->has_interface_timing_reg && tsu_thd)
683 i2c_writel(i2c_dev, tsu_thd, I2C_INTERFACE_TIMING_1);
684
685 clk_multiplier = (tlow + thigh + 2) * (non_hs_mode + 1);
686
687 err = clk_set_rate(i2c_dev->div_clk,
688 i2c_dev->bus_clk_rate * clk_multiplier);
689 if (err) {
690 dev_err(i2c_dev->dev, "failed to set div-clk rate: %d\n", err);
691 return err;
692 }
693
694 if (!i2c_dev->is_dvc && !i2c_dev->is_vi) {
695 u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG);
696
697 sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL;
698 i2c_writel(i2c_dev, sl_cfg, I2C_SL_CNFG);
699 i2c_writel(i2c_dev, 0xfc, I2C_SL_ADDR1);
700 i2c_writel(i2c_dev, 0x00, I2C_SL_ADDR2);
701 }
702
703 err = tegra_i2c_flush_fifos(i2c_dev);
704 if (err)
705 return err;
706
707 if (i2c_dev->multimaster_mode && i2c_dev->hw->has_slcg_override_reg)
708 i2c_writel(i2c_dev, I2C_MST_CORE_CLKEN_OVR, I2C_CLKEN_OVERRIDE);
709
710 err = tegra_i2c_wait_for_config_load(i2c_dev);
711 if (err)
712 return err;
713
714 return 0;
715 }
716
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months