Advertisement
Guest User

Untitled

a guest
Nov 13th, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.75 KB | None | 0 0
  1. commit 0376d14a758f9815bdcd05997e38446874b585f3
  2. Author: Arnd Bergmann <arnd@arndb.de>
  3. Date: Wed Nov 11 17:52:58 2020 +0100
  4.  
  5. ptp: rework Kconfig again
  6.  
  7. The use of Kconfig 'imply' and 'IS_REACHABLE()' in the header makes it
  8. rather unpredictable whether PTP is actually usable from anywhere.
  9.  
  10. Rework this by avoiding both and using two extra Kconfig symbols
  11. to define the behavior we actually want:
  12.  
  13. - any driver that is able to use selects 'HAVE_PTP_1588_CLOCK'
  14.  
  15. - if posix timers are disabled, this has no effect and it
  16. is impossible to turn it on
  17.  
  18. - otherwise, the option to enable building PTP support is
  19. visible to users, and this can be set to module or built-in
  20.  
  21. - If any built-in driver selects HAVE_PTP_1588_CLOCK, PTP
  22. support can only be built-in or disabled
  23.  
  24. - if a built-in driver calls PTP interface functions but fails
  25. to select HAVE_PTP_1588_CLOCK or depend on PTP_1588_CLOCK,
  26. and PTP support is a loadable module, we get a link error
  27. instead of having an unusable clock.
  28.  
  29. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  30.  
  31. diff --git a/drivers/net/dsa/mv88e6xxx/Kconfig b/drivers/net/dsa/mv88e6xxx/Kconfig
  32. index 51185e4d7d15..576e59e723c6 100644
  33. --- a/drivers/net/dsa/mv88e6xxx/Kconfig
  34. +++ b/drivers/net/dsa/mv88e6xxx/Kconfig
  35. @@ -13,6 +13,7 @@ config NET_DSA_MV88E6XXX_GLOBAL2
  36. bool "Switch Global 2 Registers support"
  37. default y
  38. depends on NET_DSA_MV88E6XXX
  39. + select HAVE_PTP_1588_CLOCK
  40. help
  41. This registers set at internal SMI address 0x1C provides extended
  42. features like EEPROM interface, trunking, cross-chip setup, etc.
  43. diff --git a/drivers/net/dsa/sja1105/Kconfig b/drivers/net/dsa/sja1105/Kconfig
  44. index 5e83b365f17a..b47a13b70e05 100644
  45. --- a/drivers/net/dsa/sja1105/Kconfig
  46. +++ b/drivers/net/dsa/sja1105/Kconfig
  47. @@ -2,6 +2,7 @@
  48. config NET_DSA_SJA1105
  49. tristate "NXP SJA1105 Ethernet switch family support"
  50. depends on NET_DSA && SPI
  51. + select HAVE_PTP_1588_CLOCK
  52. select NET_DSA_TAG_SJA1105
  53. select PACKING
  54. select CRC32
  55. diff --git a/drivers/net/ethernet/amd/Kconfig b/drivers/net/ethernet/amd/Kconfig
  56. index d0b0609bbe23..591d6b903e6d 100644
  57. --- a/drivers/net/ethernet/amd/Kconfig
  58. +++ b/drivers/net/ethernet/amd/Kconfig
  59. @@ -172,7 +172,7 @@ config AMD_XGBE
  60. select CRC32
  61. select PHYLIB
  62. select AMD_XGBE_HAVE_ECC if X86
  63. - imply PTP_1588_CLOCK
  64. + select HAVE_PTP_1588_CLOCK
  65. help
  66. This driver supports the AMD 10GbE Ethernet device found on an
  67. AMD SoC.
  68. diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
  69. index 7fb42f388d59..020d47ffbfa4 100644
  70. --- a/drivers/net/ethernet/broadcom/Kconfig
  71. +++ b/drivers/net/ethernet/broadcom/Kconfig
  72. @@ -114,7 +114,7 @@ config TIGON3
  73. tristate "Broadcom Tigon3 support"
  74. depends on PCI
  75. select PHYLIB
  76. - imply PTP_1588_CLOCK
  77. + select HAVE_PTP_1588_CLOCK
  78. help
  79. This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
  80.  
  81. @@ -131,7 +131,7 @@ config TIGON3_HWMON
  82. config BNX2X
  83. tristate "Broadcom NetXtremeII 10Gb support"
  84. depends on PCI
  85. - imply PTP_1588_CLOCK
  86. + select HAVE_PTP_1588_CLOCK
  87. select FW_LOADER
  88. select ZLIB_INFLATE
  89. select LIBCRC32C
  90. diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
  91. index 85858163bac5..a8185e6b3a1f 100644
  92. --- a/drivers/net/ethernet/cadence/Kconfig
  93. +++ b/drivers/net/ethernet/cadence/Kconfig
  94. @@ -22,6 +22,7 @@ if NET_VENDOR_CADENCE
  95. config MACB
  96. tristate "Cadence MACB/GEM support"
  97. depends on HAS_DMA && COMMON_CLK
  98. + select HAVE_PTP_1588_CLOCK
  99. select PHYLINK
  100. help
  101. The Cadence MACB ethernet interface is found on many Atmel AT32 and
  102. diff --git a/drivers/net/ethernet/cavium/Kconfig b/drivers/net/ethernet/cavium/Kconfig
  103. index 4875cdae622e..e47ff844454e 100644
  104. --- a/drivers/net/ethernet/cavium/Kconfig
  105. +++ b/drivers/net/ethernet/cavium/Kconfig
  106. @@ -27,7 +27,7 @@ config THUNDER_NIC_PF
  107.  
  108. config THUNDER_NIC_VF
  109. tristate "Thunder Virtual function driver"
  110. - imply CAVIUM_PTP
  111. + select HAVE_PTP_1588_CLOCK
  112. depends on 64BIT && PCI
  113. help
  114. This driver supports Thunder's NIC virtual function
  115. @@ -53,6 +53,7 @@ config THUNDER_NIC_RGX
  116.  
  117. config CAVIUM_PTP
  118. tristate "Cavium PTP coprocessor as PTP clock"
  119. + default THUNDER_NIC_VF
  120. depends on 64BIT && PCI
  121. depends on PTP_1588_CLOCK
  122. help
  123. @@ -66,7 +67,7 @@ config LIQUIDIO
  124. tristate "Cavium LiquidIO support"
  125. depends on 64BIT && PCI
  126. depends on PCI
  127. - imply PTP_1588_CLOCK
  128. + select HAVE_PTP_1588_CLOCK
  129. select FW_LOADER
  130. select LIBCRC32C
  131. select NET_DEVLINK
  132. @@ -91,7 +92,7 @@ config OCTEON_MGMT_ETHERNET
  133. config LIQUIDIO_VF
  134. tristate "Cavium LiquidIO VF support"
  135. depends on 64BIT && PCI_MSI
  136. - imply PTP_1588_CLOCK
  137. + select HAVE_PTP_1588_CLOCK
  138. help
  139. This driver supports Cavium LiquidIO Intelligent Server Adapter
  140. based on CN23XX chips.
  141. diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
  142. index a1d53ddf1593..c8324373b8bc 100644
  143. --- a/drivers/net/ethernet/freescale/Kconfig
  144. +++ b/drivers/net/ethernet/freescale/Kconfig
  145. @@ -26,7 +26,7 @@ config FEC
  146. ARCH_MXC || SOC_IMX28 || COMPILE_TEST)
  147. default ARCH_MXC || SOC_IMX28 if ARM
  148. select PHYLIB
  149. - imply PTP_1588_CLOCK
  150. + select HAVE_PTP_1588_CLOCK
  151. help
  152. Say Y here if you want to use the built-in 10/100 Fast ethernet
  153. controller on some Motorola ColdFire and Freescale i.MX processors.
  154. diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig
  155. index 0fa18b00c49b..e91649dd5feb 100644
  156. --- a/drivers/net/ethernet/freescale/enetc/Kconfig
  157. +++ b/drivers/net/ethernet/freescale/enetc/Kconfig
  158. @@ -3,6 +3,7 @@ config FSL_ENETC
  159. tristate "ENETC PF driver"
  160. depends on PCI && PCI_MSI
  161. select FSL_ENETC_MDIO
  162. + select HAVE_PTP_1588_CLOCK
  163. select PHYLINK
  164. select PCS_LYNX
  165. select DIMLIB
  166. @@ -16,6 +17,7 @@ config FSL_ENETC
  167. config FSL_ENETC_VF
  168. tristate "ENETC VF driver"
  169. depends on PCI && PCI_MSI
  170. + select HAVE_PTP_1588_CLOCK
  171. select PHYLINK
  172. select DIMLIB
  173. help
  174. diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
  175. index 5aa86318ed3e..1d465da07f90 100644
  176. --- a/drivers/net/ethernet/intel/Kconfig
  177. +++ b/drivers/net/ethernet/intel/Kconfig
  178. @@ -59,7 +59,7 @@ config E1000E
  179. tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support"
  180. depends on PCI && (!SPARC32 || BROKEN)
  181. select CRC32
  182. - imply PTP_1588_CLOCK
  183. + select HAVE_PTP_1588_CLOCK
  184. help
  185. This driver supports the PCI-Express Intel(R) PRO/1000 gigabit
  186. ethernet family of adapters. For PCI or PCI-X e1000 adapters,
  187. @@ -87,7 +87,7 @@ config E1000E_HWTS
  188. config IGB
  189. tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support"
  190. depends on PCI
  191. - imply PTP_1588_CLOCK
  192. + select HAVE_PTP_1588_CLOCK
  193. select I2C
  194. select I2C_ALGOBIT
  195. help
  196. @@ -161,7 +161,7 @@ config IXGBE
  197. depends on PCI
  198. select MDIO
  199. select PHYLIB
  200. - imply PTP_1588_CLOCK
  201. + select HAVE_PTP_1588_CLOCK
  202. help
  203. This driver supports Intel(R) 10GbE PCI Express family of
  204. adapters. For more information on how to identify your adapter, go
  205. @@ -239,7 +239,7 @@ config IXGBEVF_IPSEC
  206.  
  207. config I40E
  208. tristate "Intel(R) Ethernet Controller XL710 Family support"
  209. - imply PTP_1588_CLOCK
  210. + select HAVE_PTP_1588_CLOCK
  211. depends on PCI
  212. help
  213. This driver supports Intel(R) Ethernet Controller XL710 Family of
  214. @@ -313,7 +313,7 @@ config FM10K
  215. tristate "Intel(R) FM10000 Ethernet Switch Host Interface Support"
  216. default n
  217. depends on PCI_MSI
  218. - imply PTP_1588_CLOCK
  219. + select HAVE_PTP_1588_CLOCK
  220. help
  221. This driver supports Intel(R) FM10000 Ethernet Switch Host
  222. Interface. For more information on how to identify your adapter,
  223. diff --git a/drivers/net/ethernet/mellanox/mlx4/Kconfig b/drivers/net/ethernet/mellanox/mlx4/Kconfig
  224. index 400e611ba041..5b1d4992daba 100644
  225. --- a/drivers/net/ethernet/mellanox/mlx4/Kconfig
  226. +++ b/drivers/net/ethernet/mellanox/mlx4/Kconfig
  227. @@ -7,7 +7,7 @@ config MLX4_EN
  228. tristate "Mellanox Technologies 1/10/40Gbit Ethernet support"
  229. depends on PCI && NETDEVICES && ETHERNET && INET
  230. select MLX4_CORE
  231. - imply PTP_1588_CLOCK
  232. + select HAVE_PTP_1588_CLOCK
  233. help
  234. This driver supports Mellanox Technologies ConnectX Ethernet
  235. devices.
  236. diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
  237. index 99f1ec3b2575..f94afa1f12cd 100644
  238. --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
  239. +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
  240. @@ -9,7 +9,7 @@ config MLX5_CORE
  241. select NET_DEVLINK
  242. depends on VXLAN || !VXLAN
  243. depends on MLXFW || !MLXFW
  244. - depends on PTP_1588_CLOCK || !PTP_1588_CLOCK
  245. + depends on HAVE_PTP_1588_CLOCK
  246. depends on PCI_HYPERV_INTERFACE || !PCI_HYPERV_INTERFACE
  247. default n
  248. help
  249. diff --git a/drivers/net/ethernet/mellanox/mlxsw/Kconfig b/drivers/net/ethernet/mellanox/mlxsw/Kconfig
  250. index 872e9910bb7c..f5666ed15bb7 100644
  251. --- a/drivers/net/ethernet/mellanox/mlxsw/Kconfig
  252. +++ b/drivers/net/ethernet/mellanox/mlxsw/Kconfig
  253. @@ -83,7 +83,7 @@ config MLXSW_SPECTRUM
  254. select PARMAN
  255. select OBJAGG
  256. select MLXFW
  257. - imply PTP_1588_CLOCK
  258. + select HAVE_PTP_1588_CLOCK
  259. select NET_PTP_CLASSIFY if PTP_1588_CLOCK
  260. default m
  261. help
  262. diff --git a/drivers/net/ethernet/qlogic/Kconfig b/drivers/net/ethernet/qlogic/Kconfig
  263. index 4366c7a8de95..f8737d5e691d 100644
  264. --- a/drivers/net/ethernet/qlogic/Kconfig
  265. +++ b/drivers/net/ethernet/qlogic/Kconfig
  266. @@ -98,7 +98,7 @@ config QED_SRIOV
  267. config QEDE
  268. tristate "QLogic QED 25/40/100Gb Ethernet NIC"
  269. depends on QED
  270. - imply PTP_1588_CLOCK
  271. + select HAVE_PTP_1588_CLOCK
  272. help
  273. This enables the support for Marvell FastLinQ adapters family,
  274. ethernet driver.
  275. diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig
  276. index 5a2a4af31812..ff1f70cbbc0f 100644
  277. --- a/drivers/net/ethernet/renesas/Kconfig
  278. +++ b/drivers/net/ethernet/renesas/Kconfig
  279. @@ -36,7 +36,7 @@ config RAVB
  280. select MII
  281. select MDIO_BITBANG
  282. select PHYLIB
  283. - imply PTP_1588_CLOCK
  284. + select HAVE_PTP_1588_CLOCK
  285. help
  286. Renesas Ethernet AVB device driver.
  287. This driver supports the following SoCs:
  288. diff --git a/drivers/net/ethernet/samsung/Kconfig b/drivers/net/ethernet/samsung/Kconfig
  289. index 0582e110b1c0..a6d404ec4c94 100644
  290. --- a/drivers/net/ethernet/samsung/Kconfig
  291. +++ b/drivers/net/ethernet/samsung/Kconfig
  292. @@ -22,7 +22,7 @@ config SXGBE_ETH
  293. depends on HAS_IOMEM && HAS_DMA
  294. select PHYLIB
  295. select CRC32
  296. - imply PTP_1588_CLOCK
  297. + select HAVE_PTP_1588_CLOCK
  298. help
  299. This is the driver for the SXGBE 10G Ethernet IP block found on
  300. Samsung platforms.
  301. diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig
  302. index 5e37c8313725..37558c4b1ca2 100644
  303. --- a/drivers/net/ethernet/sfc/Kconfig
  304. +++ b/drivers/net/ethernet/sfc/Kconfig
  305. @@ -21,7 +21,7 @@ config SFC
  306. depends on PCI
  307. select MDIO
  308. select CRC32
  309. - imply PTP_1588_CLOCK
  310. + select HAVE_PTP_1588_CLOCK
  311. help
  312. This driver supports 10/40-gigabit Ethernet cards based on
  313. the Solarflare SFC9000-family and SFC9100-family controllers.
  314. diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
  315. index 53f14c5a9e02..9fb96c162933 100644
  316. --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
  317. +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
  318. @@ -7,7 +7,7 @@ config STMMAC_ETH
  319. select PAGE_POOL
  320. select PHYLINK
  321. select CRC32
  322. - imply PTP_1588_CLOCK
  323. + select HAVE_PTP_1588_CLOCK
  324. select RESET_CONTROLLER
  325. help
  326. This is the driver for the Ethernet IPs built around a
  327. diff --git a/drivers/net/ethernet/xscale/Kconfig b/drivers/net/ethernet/xscale/Kconfig
  328. index 7b83a6e5d894..c598fc9821cf 100644
  329. --- a/drivers/net/ethernet/xscale/Kconfig
  330. +++ b/drivers/net/ethernet/xscale/Kconfig
  331. @@ -23,6 +23,7 @@ config IXP4XX_ETH
  332. depends on ARM && ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR
  333. select PHYLIB
  334. select NET_PTP_CLASSIFY
  335. + select HAVE_PTP_1588_CLOCK
  336. help
  337. Say Y here if you want to use built-in Ethernet ports
  338. on IXP4xx processor.
  339. diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
  340. index 942f72d8151d..1a428580d9b5 100644
  341. --- a/drivers/ptp/Kconfig
  342. +++ b/drivers/ptp/Kconfig
  343. @@ -5,9 +5,15 @@
  344.  
  345. menu "PTP clock support"
  346.  
  347. -config PTP_1588_CLOCK
  348. +config HAVE_PTP_1588_CLOCK
  349. + tristate
  350. + help
  351. + Select this symbol from a driver that can use a PTP clock.
  352. +
  353. +config BUILD_PTP_1588_CLOCK
  354. tristate "PTP clock support"
  355. depends on NET && POSIX_TIMERS
  356. + default HAVE_PTP_1588_CLOCK
  357. select PPS
  358. select NET_PTP_CLASSIFY
  359. help
  360. @@ -26,6 +32,14 @@ config PTP_1588_CLOCK
  361. To compile this driver as a module, choose M here: the module
  362. will be called ptp.
  363.  
  364. +config PTP_1588_CLOCK
  365. + tristate
  366. + default y if HAVE_PTP_1588_CLOCK=y && BUILD_PTP_1588_CLOCK=m
  367. + default BUILD_PTP_1588_CLOCK
  368. + help
  369. + If a built-in driver selects HAVE_PTP_1588_CLOCK, the
  370. + framework must also be built-in to allow it to be used.
  371. +
  372. config PTP_1588_CLOCK_DTE
  373. tristate "Broadcom DTE as PTP clock"
  374. depends on PTP_1588_CLOCK
  375. @@ -89,7 +103,7 @@ config PTP_1588_CLOCK_PCH
  376. tristate "Intel PCH EG20T as PTP clock"
  377. depends on X86_32 || COMPILE_TEST
  378. depends on HAS_IOMEM && NET
  379. - imply PTP_1588_CLOCK
  380. + depends on HAVE_PTP_1588_CLOCK
  381. help
  382. This driver adds support for using the PCH EG20T as a PTP
  383. clock. The hardware supports time stamping of PTP packets
  384. diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
  385. index d3e8ba5c7125..e08890056fa3 100644
  386. --- a/include/linux/ptp_clock_kernel.h
  387. +++ b/include/linux/ptp_clock_kernel.h
  388. @@ -173,7 +173,7 @@ struct ptp_clock_event {
  389. };
  390. };
  391.  
  392. -#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
  393. +#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
  394.  
  395. /**
  396. * ptp_clock_register() - register a PTP hardware clock driver
  397.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement