Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ptp: ptp_clockmatrix: return -EBUSY if phase pull-in is in progress

Also removes PEROUT_ENABLE_OUTPUT_MASK

Signed-off-by: Min Li <min.li.xe@renesas.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Link: https://lore.kernel.org/r/1652712427-14703-2-git-send-email-min.li.xe@renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Min Li and committed by
Jakub Kicinski
7c7dcd66 bec67592

+2 -32
+2 -30
drivers/ptp/ptp_clockmatrix.c
··· 1352 1352 return idtcm_write(idtcm, (u16)base, OUT_CTRL_1, &val, sizeof(val)); 1353 1353 } 1354 1354 1355 - static int idtcm_output_mask_enable(struct idtcm_channel *channel, 1356 - bool enable) 1357 - { 1358 - u16 mask; 1359 - int err; 1360 - u8 outn; 1361 - 1362 - mask = channel->output_mask; 1363 - outn = 0; 1364 - 1365 - while (mask) { 1366 - if (mask & 0x1) { 1367 - err = idtcm_output_enable(channel, enable, outn); 1368 - if (err) 1369 - return err; 1370 - } 1371 - 1372 - mask >>= 0x1; 1373 - outn++; 1374 - } 1375 - 1376 - return 0; 1377 - } 1378 - 1379 1355 static int idtcm_perout_enable(struct idtcm_channel *channel, 1380 1356 struct ptp_perout_request *perout, 1381 1357 bool enable) 1382 1358 { 1383 1359 struct idtcm *idtcm = channel->idtcm; 1384 - unsigned int flags = perout->flags; 1385 1360 struct timespec64 ts = {0, 0}; 1386 1361 int err; 1387 1362 1388 - if (flags == PEROUT_ENABLE_OUTPUT_MASK) 1389 - err = idtcm_output_mask_enable(channel, enable); 1390 - else 1391 - err = idtcm_output_enable(channel, enable, perout->index); 1363 + err = idtcm_output_enable(channel, enable, perout->index); 1392 1364 1393 1365 if (err) { 1394 1366 dev_err(idtcm->dev, "Unable to set output enable"); ··· 1864 1892 int err; 1865 1893 1866 1894 if (channel->phase_pull_in == true) 1867 - return 0; 1895 + return -EBUSY; 1868 1896 1869 1897 mutex_lock(idtcm->lock); 1870 1898
-2
drivers/ptp/ptp_clockmatrix.h
··· 54 54 #define LOCK_TIMEOUT_MS (2000) 55 55 #define LOCK_POLL_INTERVAL_MS (10) 56 56 57 - #define PEROUT_ENABLE_OUTPUT_MASK (0xdeadbeef) 58 - 59 57 #define IDTCM_MAX_WRITE_COUNT (512) 60 58 61 59 #define PHASE_PULL_IN_MAX_PPB (144000)