Adding the Sparx5 Serdes driver
Subsystems (6)
Steen Hegelund
maintainerv7 cover Adding the Sparx5 Serdes driver
Adding the Sparx5 Serdes driver
This series of patches provides the serdes driver for the Microchip Sparx5 ethernet switch.
The serdes driver supports the 10G and 25G serdes instances available in the Sparx5.
The Sparx5 serdes support several interface modes with several speeds and also allows the client to change the mode and the speed according to changing in the environment such as changing cables from DAC to fiber.
The serdes driver is to be used by the Sparx5 switchdev driver that will follow in subsequent series.
History:
--------
v6 -> v7:
This series changes the way the IO targets are provided to the driver. Now only one IO range is available in the DT, and the driver has a table to map its targets (as their order is still not sequential), thus reducing the DT needed information and binding requirements.
The register access macros have been converted to functions.
- Bindings:
- reg prop: minItems set to 1
- reg-names prop: removed
- Driver
- Use one IO range and map targets via this.
- Change register access macros to use functions.
- Provided a new header files with reg access functions.
- Device tree
- Provide only one IO range
v5 -> v6:
Series error: This had the same content as v5
v4 -> v5:
- Bindings:
- Removed .yaml from compatible string
- reg prop: removed description and added minItems
- reg-names prop: removed description and added const name list and minItems
- #phy-cells prop: removed description and added maxItems
- Configuration interface
- Removed include of linux/phy.h
- Added include of linux/types.h
- Driver
- Added include of linux/phy.h
v3 -> v4:
- Add a reg-names item to the binding description
- Add a clocks item to the binding description
- Removed the clock parameter from the configuration interface
- Use the clock dt node to get the coreclock, and using that when doing the actual serdes configuration
- Added a clocks entry with a system clock reference to the serdes node in the device tree
v2 -> v3:
- Sorted the Kconfig sourced folders
- Sorted the Makefile included folders
- Changed the configuration interface documentation to use kernel style
v1 -> v2: Fixed kernel test robot warnings
- Made these structures static:
- media_presets_25g
- mode_presets_25g
- media_presets_10g
- mode_presets_10g
- Removed these duplicate initializations:
- sparx5_sd25g28_params.cfg_rx_reserve_15_8
- sparx5_sd25g28_params.cfg_pi_en
- sparx5_sd25g28_params.cfg_cdrck_en
- sparx5_sd10g28_params.cfg_cdrck_en
Lars Povlsen (2):
dt-bindings: phy: Add sparx5-serdes bindings
arm64: dts: sparx5: Add Sparx5 serdes driver node
Steen Hegelund (2):
phy: Add ethernet serdes configuration option
phy: Add Sparx5 ethernet serdes PHY driver
.../bindings/phy/microchip,sparx5-serdes.yaml | 100 + arch/arm64/boot/dts/microchip/sparx5.dtsi | 8 + drivers/phy/Kconfig | 3 +- drivers/phy/Makefile | 1 + drivers/phy/microchip/Kconfig | 12 + drivers/phy/microchip/Makefile | 6 + drivers/phy/microchip/sparx5_serdes.c | 2434 +++++++++++++++ drivers/phy/microchip/sparx5_serdes.h | 129 + drivers/phy/microchip/sparx5_serdes_regs.h | 2695 +++++++++++++++++ include/linux/phy/phy-ethernet-serdes.h | 30 + include/linux/phy/phy.h | 4 + 11 files changed, 5421 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/phy/microchip,sparx5-serdes.yaml create mode 100644 drivers/phy/microchip/Kconfig create mode 100644 drivers/phy/microchip/Makefile create mode 100644 drivers/phy/microchip/sparx5_serdes.c create mode 100644 drivers/phy/microchip/sparx5_serdes.h create mode 100644 drivers/phy/microchip/sparx5_serdes_regs.h create mode 100644 include/linux/phy/phy-ethernet-serdes.h
Signature · 1 line
2.29.2
Steen Hegelund
maintainerPATCH v7 1/4 dt-bindings: phy: Add sparx5-serdes bindings
Document the Sparx5 ethernet serdes phy driver bindings.
--- .../bindings/phy/microchip,sparx5-serdes.yaml | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/microchip,sparx5-serdes.yaml
Documentation/devicetree/bindings/phy/microchip,sparx5-serdes.yaml new file +100 -0
@@ -0,0 +1,100 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/microchip,sparx5-serdes.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip Sparx5 Serdes controller + +maintainers: + - Steen Hegelund <[email protected]> + +description: | + The Sparx5 SERDES interfaces share the same basic functionality, but + support different operating modes and line rates. + + The following list lists the SERDES features: + + * RX Adaptive Decision Feedback Equalizer (DFE) + * Programmable continuous time linear equalizer (CTLE) + * Rx variable gain control + * Rx built-in fault detector (loss-of-lock/loss-of-signal) + * Adjustable tx de-emphasis (FFE) + * Tx output amplitude control + * Supports rx eye monitor + * Multiple loopback modes + * Prbs generator and checker + * Polarity inversion control + + SERDES6G: + + The SERDES6G is a high-speed SERDES interface, which can operate at + the following data rates: + + * 100 Mbps (100BASE-FX) + * 1.25 Gbps (SGMII/1000BASE-X/1000BASE-KX) + * 3.125 Gbps (2.5GBASE-X/2.5GBASE-KX) + * 5.15625 Gbps (5GBASE-KR/5G-USXGMII) + + SERDES10G + + The SERDES10G is a high-speed SERDES interface, which can operate at + the following data rates: + + * 100 Mbps (100BASE-FX) + * 1.25 Gbps (SGMII/1000BASE-X/1000BASE-KX) + * 3.125 Gbps (2.5GBASE-X/2.5GBASE-KX) + * 5 Gbps (QSGMII/USGMII) + * 5.15625 Gbps (5GBASE-KR/5G-USXGMII) + * 10 Gbps (10G-USGMII) + * 10.3125 Gbps (10GBASE-R/10GBASE-KR/USXGMII) + + SERDES25G + + The SERDES25G is a high-speed SERDES interface, which can operate at + the following data rates: + + * 1.25 Gbps (SGMII/1000BASE-X/1000BASE-KX) + * 3.125 Gbps (2.5GBASE-X/2.5GBASE-KX) + * 5 Gbps (QSGMII/USGMII) + * 5.15625 Gbps (5GBASE-KR/5G-USXGMII) + * 10 Gbps (10G-USGMII) + * 10.3125 Gbps (10GBASE-R/10GBASE-KR/USXGMII) + * 25.78125 Gbps (25GBASE-KR/25GBASE-CR/25GBASE-SR/25GBASE-LR/25GBASE-ER) + +properties: + $nodename: + pattern: "^serdes@[0-9a-f]+$" + + compatible: + const: microchip,sparx5-serdes + + reg: + minItems: 1 + + '#phy-cells': + const: 1 + description: | + - The main serdes input port + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - '#phy-cells' + - clocks + +additionalProperties: false + +examples: + - | + serdes: serdes@10808000 { + compatible = "microchip,sparx5-serdes"; + #phy-cells = <1>; + clocks = <&sys_clk>; + reg = <0x10808000 0x5d0000>; + }; + +...
Signature · 1 line
2.29.2
Steen Hegelund
maintainerPATCH v7 2/4 phy: Add ethernet serdes configuration option
In reply to Steen HegelundProvide a new ethernet phy configuration structure, that allow PHYs used for ethernet to be configured with speed, media type and clock information.
--- include/linux/phy/phy-ethernet-serdes.h | 30 +++++++++++++++++++++++++ include/linux/phy/phy.h | 4 ++++ 2 files changed, 34 insertions(+) create mode 100644 include/linux/phy/phy-ethernet-serdes.h
include/linux/phy/phy-ethernet-serdes.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ +/* +* Microchip Sparx5 Ethernet SerDes driver +* +* Copyright (c) 2020 Microschip Inc +*/ +#ifndef __PHY_ETHERNET_SERDES_H_ +#define __PHY_ETHERNET_SERDES_H_ + +#include <linux/types.h> + +enum ethernet_media_type { +ETH_MEDIA_DEFAULT , +ETH_MEDIA_SR , +ETH_MEDIA_DAC , +}; + +/** +* struct phy_configure_opts_eth_serdes - Ethernet SerDes This structure is used +* to represent the configuration state of a Ethernet Serdes PHY. +* @speed: Speed of the serdes interface in Mbps +* @media_type: Specifies which media the serdes will be using +*/ +struct phy_configure_opts_eth_serdes { +u32 speed; +enum ethernet_media_type media_type; +}; + +#endif +
include/linux/phy/phy.h +4 -0
@@ -18,6 +18,7 @@#include <linux/phy/phy-dp.h> #include <linux/phy/phy-mipi-dphy.h> +#include <linux/phy/phy-ethernet-serdes.h> struct phy ;
@@ -49,11 +50,14 @@ enum phy_mode {* * @mipi_dphy: Configuration set applicable for phys supporting * the MIPI_DPHY phy mode. +* @eth_serdes: Configuration set applicable for phys supporting +* the ethernet serdes. * @dp: Configuration set applicable for phys supporting * the DisplayPort protocol. */ union phy_configure_opts {struct phy_configure_opts_mipi_dphy mipi_dphy; +struct phy_configure_opts_eth_serdes eth_serdes;struct phy_configure_opts_dp dp; };
Signature · 1 line
2.29.2
Steen Hegelund
maintainerPATCH v7 3/4 phy: Add Sparx5 ethernet serdes PHY driver
In reply to Steen HegelundAdd the Microchip Sparx5 ethernet serdes PHY driver for the 6G, 10G and 25G interfaces available in the Sparx5 SoC.
--- drivers/phy/Kconfig | 3 +- drivers/phy/Makefile | 1 + drivers/phy/microchip/Kconfig | 12 + drivers/phy/microchip/Makefile | 6 + drivers/phy/microchip/sparx5_serdes.c | 2434 ++++++++++++++++++ drivers/phy/microchip/sparx5_serdes.h | 129 + drivers/phy/microchip/sparx5_serdes_regs.h | 2695 ++++++++++++++++++++ 7 files changed, 5279 insertions(+), 1 deletion(-) create mode 100644 drivers/phy/microchip/Kconfig create mode 100644 drivers/phy/microchip/Makefile create mode 100644 drivers/phy/microchip/sparx5_serdes.c create mode 100644 drivers/phy/microchip/sparx5_serdes.h create mode 100644 drivers/phy/microchip/sparx5_serdes_regs.h
drivers/phy/Kconfig +2 -1
@@ -66,9 +66,11 @@ source "drivers/phy/broadcom/Kconfig" source "drivers/phy/cadence/Kconfig" source "drivers/phy/freescale/Kconfig" source "drivers/phy/hisilicon/Kconfig" +source "drivers/phy/intel/Kconfig" source "drivers/phy/lantiq/Kconfig" source "drivers/phy/marvell/Kconfig" source "drivers/phy/mediatek/Kconfig" +source "drivers/phy/microchip/Kconfig" source "drivers/phy/motorola/Kconfig" source "drivers/phy/mscc/Kconfig" source "drivers/phy/qualcomm/Kconfig"
@@ -80,7 +82,6 @@ source "drivers/phy/socionext/Kconfig" source "drivers/phy/st/Kconfig" source "drivers/phy/tegra/Kconfig" source "drivers/phy/ti/Kconfig" -source "drivers/phy/intel/Kconfig" source "drivers/phy/xilinx/Kconfig" endmenu
drivers/phy/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-y += allwinner/ \ lantiq/ \ marvell/ \ mediatek/ \ + microchip/ \ motorola/ \ mscc/ \ qualcomm/ \
drivers/phy/microchip/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Phy drivers for Microchip devices +# + +config PHY_SPARX5_SERDES + tristate "Microchip Sparx5 SerDes PHY driver" + select GENERIC_PHY + depends on OF + depends on HAS_IOMEM + help + Enable this for support of the 10G/25G SerDes on Microchip Sparx5.
drivers/phy/microchip/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Makefile for the Microchip phy drivers. +# + +obj-$(CONFIG_PHY_SPARX5_SERDES) := sparx5_serdes.o
drivers/phy/microchip/sparx5_serdes.c new file +2434 -0
2,434 lines not on this page · raw message
drivers/phy/microchip/sparx5_serdes.h new file +129 -0
129 lines not on this page · raw message
drivers/phy/microchip/sparx5_serdes_regs.h new file +2695 -0
394 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.29.2
Part of the diff is not shown here. View the raw message.
kernel test robot
build botRe: [PATCH v7 3/4] phy: Add Sparx5 ethernet serdes PHY driver
I love your patch! Perhaps something to improve:
Hi Steen,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.10-rc6 next-20201201] [cannot apply to phy/next]
[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/Steen-Hegelund/Adding-the-Sparx5-Serdes-driver/20201202-211116 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 9.3.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/0day-ci/linux/commit/f9670130c2b0d7ccd38a459e66d8da36b8edb7e0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Steen-Hegelund/Adding-the-Sparx5-Serdes-driver/20201202-211116 git checkout f9670130c2b0d7ccd38a459e66d8da36b8edb7e0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/phy/microchip/sparx5_serdes.c:2236:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046660608' to '276856832' [-Woverflow]
2236 | { TARGET_SD_CMU, 0x610808000 }, /* sd_cmu_0 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2237:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046693376' to '276889600' [-Woverflow]
2237 | { TARGET_SD_CMU + 1, 0x610810000 }, /* sd_cmu_1 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2238:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046726144' to '276922368' [-Woverflow]
2238 | { TARGET_SD_CMU + 2, 0x610818000 }, /* sd_cmu_2 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2239:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046758912' to '276955136' [-Woverflow]
2239 | { TARGET_SD_CMU + 3, 0x610820000 }, /* sd_cmu_3 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2240:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046791680' to '276987904' [-Woverflow]
2240 | { TARGET_SD_CMU + 4, 0x610828000 }, /* sd_cmu_4 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2241:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046824448' to '277020672' [-Woverflow]
2241 | { TARGET_SD_CMU + 5, 0x610830000 }, /* sd_cmu_5 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2242:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046857216' to '277053440' [-Woverflow]
2242 | { TARGET_SD_CMU + 6, 0x610838000 }, /* sd_cmu_6 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2243:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046889984' to '277086208' [-Woverflow]
2243 | { TARGET_SD_CMU + 7, 0x610840000 }, /* sd_cmu_7 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2244:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046922752' to '277118976' [-Woverflow]
2244 | { TARGET_SD_CMU + 8, 0x610848000 }, /* sd_cmu_8 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2245:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046955520' to '277151744' [-Woverflow]
2245 | { TARGET_SD_CMU_CFG, 0x610850000 }, /* sd_cmu_cfg_0 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2246:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26046988288' to '277184512' [-Woverflow]
2246 | { TARGET_SD_CMU_CFG + 1, 0x610858000 }, /* sd_cmu_cfg_1 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2247:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047021056' to '277217280' [-Woverflow]
2247 | { TARGET_SD_CMU_CFG + 2, 0x610860000 }, /* sd_cmu_cfg_2 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2248:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047053824' to '277250048' [-Woverflow]
2248 | { TARGET_SD_CMU_CFG + 3, 0x610868000 }, /* sd_cmu_cfg_3 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2249:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047086592' to '277282816' [-Woverflow]
2249 | { TARGET_SD_CMU_CFG + 4, 0x610870000 }, /* sd_cmu_cfg_4 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2250:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047119360' to '277315584' [-Woverflow]
2250 | { TARGET_SD_CMU_CFG + 5, 0x610878000 }, /* sd_cmu_cfg_5 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2251:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047152128' to '277348352' [-Woverflow]
2251 | { TARGET_SD_CMU_CFG + 6, 0x610880000 }, /* sd_cmu_cfg_6 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2252:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047184896' to '277381120' [-Woverflow]
2252 | { TARGET_SD_CMU_CFG + 7, 0x610888000 }, /* sd_cmu_cfg_7 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2253:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047217664' to '277413888' [-Woverflow]
2253 | { TARGET_SD_CMU_CFG + 8, 0x610890000 }, /* sd_cmu_cfg_8 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2254:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047250432' to '277446656' [-Woverflow]
2254 | { TARGET_SD6G_LANE, 0x610898000 }, /* sd6g_lane_0 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2255:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047283200' to '277479424' [-Woverflow]
2255 | { TARGET_SD6G_LANE + 1, 0x6108a0000 }, /* sd6g_lane_1 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2256:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047315968' to '277512192' [-Woverflow]
2256 | { TARGET_SD6G_LANE + 2, 0x6108a8000 }, /* sd6g_lane_2 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2257:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047348736' to '277544960' [-Woverflow]
2257 | { TARGET_SD6G_LANE + 3, 0x6108b0000 }, /* sd6g_lane_3 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2258:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047381504' to '277577728' [-Woverflow]
2258 | { TARGET_SD6G_LANE + 4, 0x6108b8000 }, /* sd6g_lane_4 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2259:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047414272' to '277610496' [-Woverflow]
2259 | { TARGET_SD6G_LANE + 5, 0x6108c0000 }, /* sd6g_lane_5 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2260:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047447040' to '277643264' [-Woverflow]
2260 | { TARGET_SD6G_LANE + 6, 0x6108c8000 }, /* sd6g_lane_6 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2261:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047479808' to '277676032' [-Woverflow]
2261 | { TARGET_SD6G_LANE + 7, 0x6108d0000 }, /* sd6g_lane_7 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2262:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047512576' to '277708800' [-Woverflow]
2262 | { TARGET_SD6G_LANE + 8, 0x6108d8000 }, /* sd6g_lane_8 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2263:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047545344' to '277741568' [-Woverflow]
2263 | { TARGET_SD6G_LANE + 9, 0x6108e0000 }, /* sd6g_lane_9 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2264:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047578112' to '277774336' [-Woverflow]
2264 | { TARGET_SD6G_LANE + 10, 0x6108e8000 }, /* sd6g_lane_10 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2265:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047610880' to '277807104' [-Woverflow]
2265 | { TARGET_SD6G_LANE + 11, 0x6108f0000 }, /* sd6g_lane_11 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2266:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047643648' to '277839872' [-Woverflow]
2266 | { TARGET_SD6G_LANE + 12, 0x6108f8000 }, /* sd6g_lane_12 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2267:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047676416' to '277872640' [-Woverflow]
2267 | { TARGET_SD10G_LANE, 0x610900000 }, /* sd10g_lane_0 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2268:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047709184' to '277905408' [-Woverflow]
2268 | { TARGET_SD10G_LANE + 1, 0x610908000 }, /* sd10g_lane_1 */
| ^~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2269:28: warning: unsigned conversion from 'long long int' to 'unsigned int' changes value from '26047741952' to '277938176' [-Woverflow]
2269 | { TARGET_SD10G_LANE + 2, 0x610910000 }, /* sd10g_lane_2 */vim +2236 drivers/phy/microchip/sparx5_serdes.c
2234
2235 static struct sparx5_serdes_io_resource sparx5_serdes_iomap[] = {
> 2236 { TARGET_SD_CMU, 0x610808000 }, /* sd_cmu_0 */
2237 { TARGET_SD_CMU + 1, 0x610810000 }, /* sd_cmu_1 */
2238 { TARGET_SD_CMU + 2, 0x610818000 }, /* sd_cmu_2 */
2239 { TARGET_SD_CMU + 3, 0x610820000 }, /* sd_cmu_3 */
2240 { TARGET_SD_CMU + 4, 0x610828000 }, /* sd_cmu_4 */
2241 { TARGET_SD_CMU + 5, 0x610830000 }, /* sd_cmu_5 */
2242 { TARGET_SD_CMU + 6, 0x610838000 }, /* sd_cmu_6 */
2243 { TARGET_SD_CMU + 7, 0x610840000 }, /* sd_cmu_7 */
2244 { TARGET_SD_CMU + 8, 0x610848000 }, /* sd_cmu_8 */
2245 { TARGET_SD_CMU_CFG, 0x610850000 }, /* sd_cmu_cfg_0 */
2246 { TARGET_SD_CMU_CFG + 1, 0x610858000 }, /* sd_cmu_cfg_1 */
2247 { TARGET_SD_CMU_CFG + 2, 0x610860000 }, /* sd_cmu_cfg_2 */
2248 { TARGET_SD_CMU_CFG + 3, 0x610868000 }, /* sd_cmu_cfg_3 */
2249 { TARGET_SD_CMU_CFG + 4, 0x610870000 }, /* sd_cmu_cfg_4 */
2250 { TARGET_SD_CMU_CFG + 5, 0x610878000 }, /* sd_cmu_cfg_5 */
2251 { TARGET_SD_CMU_CFG + 6, 0x610880000 }, /* sd_cmu_cfg_6 */
2252 { TARGET_SD_CMU_CFG + 7, 0x610888000 }, /* sd_cmu_cfg_7 */
2253 { TARGET_SD_CMU_CFG + 8, 0x610890000 }, /* sd_cmu_cfg_8 */
2254 { TARGET_SD6G_LANE, 0x610898000 }, /* sd6g_lane_0 */
2255 { TARGET_SD6G_LANE + 1, 0x6108a0000 }, /* sd6g_lane_1 */
2256 { TARGET_SD6G_LANE + 2, 0x6108a8000 }, /* sd6g_lane_2 */
2257 { TARGET_SD6G_LANE + 3, 0x6108b0000 }, /* sd6g_lane_3 */
2258 { TARGET_SD6G_LANE + 4, 0x6108b8000 }, /* sd6g_lane_4 */
2259 { TARGET_SD6G_LANE + 5, 0x6108c0000 }, /* sd6g_lane_5 */
2260 { TARGET_SD6G_LANE + 6, 0x6108c8000 }, /* sd6g_lane_6 */
2261 { TARGET_SD6G_LANE + 7, 0x6108d0000 }, /* sd6g_lane_7 */
2262 { TARGET_SD6G_LANE + 8, 0x6108d8000 }, /* sd6g_lane_8 */
2263 { TARGET_SD6G_LANE + 9, 0x6108e0000 }, /* sd6g_lane_9 */
2264 { TARGET_SD6G_LANE + 10, 0x6108e8000 }, /* sd6g_lane_10 */
2265 { TARGET_SD6G_LANE + 11, 0x6108f0000 }, /* sd6g_lane_11 */
2266 { TARGET_SD6G_LANE + 12, 0x6108f8000 }, /* sd6g_lane_12 */
2267 { TARGET_SD10G_LANE, 0x610900000 }, /* sd10g_lane_0 */
2268 { TARGET_SD10G_LANE + 1, 0x610908000 }, /* sd10g_lane_1 */
2269 { TARGET_SD10G_LANE + 2, 0x610910000 }, /* sd10g_lane_2 */
2270 { TARGET_SD10G_LANE + 3, 0x610918000 }, /* sd10g_lane_3 */
2271 { TARGET_SD_LANE, 0x6109a8000 }, /* sd_lane_0 */
2272 { TARGET_SD_LANE + 1, 0x6109b0000 }, /* sd_lane_1 */
2273 { TARGET_SD_LANE + 2, 0x6109b8000 }, /* sd_lane_2 */
2274 { TARGET_SD_LANE + 3, 0x6109c0000 }, /* sd_lane_3 */
2275 { TARGET_SD_LANE + 4, 0x6109c8000 }, /* sd_lane_4 */
2276 { TARGET_SD_LANE + 5, 0x6109d0000 }, /* sd_lane_5 */
2277 { TARGET_SD_LANE + 6, 0x6109d8000 }, /* sd_lane_6 */
2278 { TARGET_SD_LANE + 7, 0x6109e0000 }, /* sd_lane_7 */
2279 { TARGET_SD_LANE + 8, 0x6109e8000 }, /* sd_lane_8 */
2280 { TARGET_SD_LANE + 9, 0x6109f0000 }, /* sd_lane_9 */
2281 { TARGET_SD_LANE + 10, 0x6109f8000 }, /* sd_lane_10 */
2282 { TARGET_SD_LANE + 11, 0x610a00000 }, /* sd_lane_11 */
2283 { TARGET_SD_LANE + 12, 0x610a08000 }, /* sd_lane_12 */
2284 { TARGET_SD_LANE + 13, 0x610a10000 }, /* sd_lane_13 */
2285 { TARGET_SD_LANE + 14, 0x610a18000 }, /* sd_lane_14 */
2286 { TARGET_SD_LANE + 15, 0x610a20000 }, /* sd_lane_15 */
2287 { TARGET_SD_LANE + 16, 0x610a28000 }, /* sd_lane_16 */
2288 { TARGET_SD_CMU + 9, 0x610c08000 }, /* sd_cmu_9 */
2289 { TARGET_SD_CMU + 10, 0x610c10000 }, /* sd_cmu_10 */
2290 { TARGET_SD_CMU + 11, 0x610c18000 }, /* sd_cmu_11 */
2291 { TARGET_SD_CMU + 12, 0x610c20000 }, /* sd_cmu_12 */
2292 { TARGET_SD_CMU + 13, 0x610c28000 }, /* sd_cmu_13 */
2293 { TARGET_SD_CMU_CFG + 9, 0x610c30000 }, /* sd_cmu_cfg_9 */
2294 { TARGET_SD_CMU_CFG + 10, 0x610c38000 }, /* sd_cmu_cfg_10 */
2295 { TARGET_SD_CMU_CFG + 11, 0x610c40000 }, /* sd_cmu_cfg_11 */
2296 { TARGET_SD_CMU_CFG + 12, 0x610c48000 }, /* sd_cmu_cfg_12 */
2297 { TARGET_SD_CMU_CFG + 13, 0x610c50000 }, /* sd_cmu_cfg_13 */
2298 { TARGET_SD10G_LANE + 4, 0x610c58000 }, /* sd10g_lane_4 */
2299 { TARGET_SD10G_LANE + 5, 0x610c60000 }, /* sd10g_lane_5 */
2300 { TARGET_SD10G_LANE + 6, 0x610c68000 }, /* sd10g_lane_6 */
2301 { TARGET_SD10G_LANE + 7, 0x610c70000 }, /* sd10g_lane_7 */
2302 { TARGET_SD10G_LANE + 8, 0x610c78000 }, /* sd10g_lane_8 */
2303 { TARGET_SD10G_LANE + 9, 0x610c80000 }, /* sd10g_lane_9 */
2304 { TARGET_SD10G_LANE + 10, 0x610c88000 }, /* sd10g_lane_10 */
2305 { TARGET_SD10G_LANE + 11, 0x610c90000 }, /* sd10g_lane_11 */
2306 { TARGET_SD25G_LANE, 0x610c98000 }, /* sd25g_lane_0 */
2307 { TARGET_SD25G_LANE + 1, 0x610ca0000 }, /* sd25g_lane_1 */
2308 { TARGET_SD25G_LANE + 2, 0x610ca8000 }, /* sd25g_lane_2 */
2309 { TARGET_SD25G_LANE + 3, 0x610cb0000 }, /* sd25g_lane_3 */
2310 { TARGET_SD25G_LANE + 4, 0x610cb8000 }, /* sd25g_lane_4 */
2311 { TARGET_SD25G_LANE + 5, 0x610cc0000 }, /* sd25g_lane_5 */
2312 { TARGET_SD25G_LANE + 6, 0x610cc8000 }, /* sd25g_lane_6 */
2313 { TARGET_SD25G_LANE + 7, 0x610cd0000 }, /* sd25g_lane_7 */
2314 { TARGET_SD_LANE + 17, 0x610d58000 }, /* sd_lane_17 */
2315 { TARGET_SD_LANE + 18, 0x610d60000 }, /* sd_lane_18 */
2316 { TARGET_SD_LANE + 19, 0x610d68000 }, /* sd_lane_19 */
2317 { TARGET_SD_LANE + 20, 0x610d70000 }, /* sd_lane_20 */
2318 { TARGET_SD_LANE + 21, 0x610d78000 }, /* sd_lane_21 */
2319 { TARGET_SD_LANE + 22, 0x610d80000 }, /* sd_lane_22 */
2320 { TARGET_SD_LANE + 23, 0x610d88000 }, /* sd_lane_23 */
2321 { TARGET_SD_LANE + 24, 0x610d90000 }, /* sd_lane_24 */
2322 { TARGET_SD_LANE_25G, 0x610d98000 }, /* sd_lane_25g_25 */ 2323 { TARGET_SD_LANE_25G + 1, 0x610da0000 }, /* sd_lane_25g_26 */
2324 { TARGET_SD_LANE_25G + 2, 0x610da8000 }, /* sd_lane_25g_27 */
2325 { TARGET_SD_LANE_25G + 3, 0x610db0000 }, /* sd_lane_25g_28 */
2326 { TARGET_SD_LANE_25G + 4, 0x610db8000 }, /* sd_lane_25g_29 */
2327 { TARGET_SD_LANE_25G + 5, 0x610dc0000 }, /* sd_lane_25g_30 */
2328 { TARGET_SD_LANE_25G + 6, 0x610dc8000 }, /* sd_lane_25g_31 */
2329 { TARGET_SD_LANE_25G + 7, 0x610dd0000 }, /* sd_lane_25g_32 */
2330 };
2331
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH v7 3/4] phy: Add Sparx5 ethernet serdes PHY driver
In reply to Steen HegelundI love your patch! Perhaps something to improve:
Hi Steen,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.10-rc6 next-20201201] [cannot apply to phy/next]
[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/Steen-Hegelund/Adding-the-Sparx5-Serdes-driver/20201202-211116 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: riscv-randconfig-r016-20201202 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 2671fccf0381769276ca8246ec0499adcb9b0355)
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/f9670130c2b0d7ccd38a459e66d8da36b8edb7e0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Steen-Hegelund/Adding-the-Sparx5-Serdes-driver/20201202-211116 git checkout f9670130c2b0d7ccd38a459e66d8da36b8edb7e0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/phy/microchip/sparx5_serdes.c:2393:54: warning: variable 'idx' is uninitialized when used here [-Wuninitialized]
iores = platform_get_resource(pdev, IORESOURCE_MEM, idx);
^~~
drivers/phy/microchip/sparx5_serdes.c:2367:9: note: initialize the variable 'idx' to silence this warning
int idx;
^
= 01 warning generated.
vim +/idx +2393 drivers/phy/microchip/sparx5_serdes.c
2357
2358 static int sparx5_serdes_probe(struct platform_device *pdev)
2359 {
2360 struct device_node *np = pdev->dev.of_node;
2361 struct sparx5_serdes_private *priv;
2362 struct phy_provider *provider;
2363 struct resource *iores;
2364 void __iomem *iomem;
2365 unsigned long clock;
2366 struct clk *clk;
2367 int idx;
2368 int err;
2369
2370 if (!np && !pdev->dev.platform_data)
2371 return -ENODEV;
2372
2373 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
2374 if (!priv)
2375 return -ENOMEM;
2376
2377 platform_set_drvdata(pdev, priv);
2378 priv->dev = &pdev->dev;
2379
2380 /* Get coreclock */
2381 clk = devm_clk_get(priv->dev, NULL);
2382 if (IS_ERR(clk)) {
2383 dev_err(priv->dev, "Failed to get coreclock\n");
2384 return PTR_ERR(clk);
2385 }
2386 clock = clk_get_rate(clk);
2387 if (clock == 0) {
2388 dev_err(priv->dev, "Invalid coreclock %lu\n", clock);
2389 return -EINVAL;
2390 }
2391 priv->coreclock = clock;
2392
> 2393 iores = platform_get_resource(pdev, IORESOURCE_MEM, idx);
2394 iomem = devm_ioremap(priv->dev, iores->start, iores->end - iores->start + 1);
2395 if (IS_ERR(iomem)) {
2396 dev_err(priv->dev, "Unable to get serdes registers: %s\n",
2397 iores->name);
2398 return PTR_ERR(iomem);
2399 }
2400 for (idx = 0; idx < ARRAY_SIZE(sparx5_serdes_iomap); idx++) {
2401 struct sparx5_serdes_io_resource *iomap = &sparx5_serdes_iomap[idx];
2402
2403 priv->regs[iomap->id] = iomem + iomap->phys - iores->start;
2404 }
2405 for (idx = 0; idx < SPX5_SERDES_MAX; idx++) {
2406 err = sparx5_phy_create(priv, idx, &priv->phys[idx]);
2407 if (err)
2408 return err;
2409 }
2410
2411 provider = devm_of_phy_provider_register(priv->dev, sparx5_serdes_xlate);
2412
2413 return PTR_ERR_OR_ZERO(provider);
2414 }
2415
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Steen Hegelund
maintainerPATCH v7 4/4 arm64: dts: sparx5: Add Sparx5 serdes driver node
In reply to Steen HegelundAdd Sparx5 serdes driver node, and enable it generally for all reference boards.
--- arch/arm64/boot/dts/microchip/sparx5.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/microchip/sparx5.dtsi +8 -0
@@ -287,5 +287,13 @@ tmon0: tmon@610508110 { #thermal-sensor-cells = <0>; clocks = <&ahb_clk>; }; + + serdes: serdes@10808000 { + compatible = "microchip,sparx5-serdes"; + #phy-cells = <1>; + clocks = <&sys_clk>; + reg = <0x6 0x10808000 0x5d0000>; + }; + }; };
Signature · 1 line
2.29.2
Hi Steen,
Quoted 103 lines · Steen Hegelund
Adding the Sparx5 Serdes driver
This series of patches provides the serdes driver for the Microchip Sparx5 ethernet switch.
The serdes driver supports the 10G and 25G serdes instances available in the Sparx5.
The Sparx5 serdes support several interface modes with several speeds and also allows the client to change the mode and the speed according to changing in the environment such as changing cables from DAC to fiber.
The serdes driver is to be used by the Sparx5 switchdev driver that will follow in subsequent series.
History:
--------
v6 -> v7:
This series changes the way the IO targets are provided to the driver. Now only one IO range is available in the DT, and the driver has a table to map its targets (as their order is still not sequential), thus reducing the DT needed information and binding requirements.
The register access macros have been converted to functions.- Bindings:
- reg prop: minItems set to 1
- reg-names prop: removed
- Driver
- Use one IO range and map targets via this.
- Change register access macros to use functions.
- Provided a new header files with reg access functions.
- Device tree
- Provide only one IO rangev5 -> v6:
Series error: This had the same content as v5v4 -> v5:
- Bindings:
- Removed .yaml from compatible string
- reg prop: removed description and added minItems
- reg-names prop: removed description and added const name list and minItems
- #phy-cells prop: removed description and added maxItems
- Configuration interface
- Removed include oflinux/phy.h
- Added include oflinux/types.h
- Driver
- Added include oflinux/phy.hv3 -> v4:
- Add a reg-names item to the binding description
- Add a clocks item to the binding description
- Removed the clock parameter from the configuration interface
- Use the clock dt node to get the coreclock, and using that when doing the actual serdes configuration
- Added a clocks entry with a system clock reference to the serdes node in the device treev2 -> v3:
- Sorted theKconfigsourced folders
- Sorted theMakefileincluded folders
- Changed the configuration interface documentation to use kernel stylev1 -> v2: Fixed kernel test robot warnings
- Made these structures static:
-media_presets_25g
-mode_presets_25g
-media_presets_10g
-mode_presets_10g
- Removed these duplicate initializations:
- sparx5_sd25g28_params.cfg_rx_reserve_15_8
- sparx5_sd25g28_params.cfg_pi_en
- sparx5_sd25g28_params.cfg_cdrck_en
- sparx5_sd10g28_params.cfg_cdrck_enLars Povlsen (2):
dt-bindings: phy: Add sparx5-serdes bindings
arm64: dts: sparx5: Add Sparx5 serdes driver nodeSteen Hegelund (2):
phy: Add ethernet serdes configuration option
phy: Add Sparx5 ethernet serdes PHY driver.../bindings/phy/microchip,sparx5-serdes.yaml | 100 + arch/arm64/boot/dts/microchip/sparx5.dtsi | 8 + drivers/phy/Kconfig | 3 +- drivers/phy/Makefile | 1 + drivers/phy/microchip/Kconfig | 12 + drivers/phy/microchip/Makefile | 6 + drivers/phy/microchip/sparx5_serdes.c | 2434 +++++++++++++++ drivers/phy/microchip/sparx5_serdes.h | 129 + drivers/phy/microchip/sparx5_serdes_regs.h | 2695 +++++++++++++++++ include/linux/phy/phy-ethernet-serdes.h | 30 + include/linux/phy/phy.h | 4 + 11 files changed, 5421 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/phy/microchip,sparx5-serdes.yaml create mode 100644 drivers/phy/microchip/Kconfig create mode 100644 drivers/phy/microchip/Makefile create mode 100644 drivers/phy/microchip/sparx5_serdes.c create mode 100644 drivers/phy/microchip/sparx5_serdes.h create mode 100644 drivers/phy/microchip/sparx5_serdes_regs.h create mode 100644 include/linux/phy/phy-ethernet-serdes.h
Quoted 2 lines
--
2.29.2
I think this series is interesting enough that you can at least cc the networking mailing list when sending these? Did that for you now.
Steen Hegelund
maintainerQuoted 7 lines · Vladimir Oltean
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Hi Steen,
Quoted 2 lines · Steen Hegelund
Adding the Sparx5 Serdes driver
...
Quoted 5 lines
Quoted 2 lines
--
2.29.2I think this series is interesting enough that you can at least cc the networking mailing list when sending these? Did that for you now.
Thanks Vladimir. I will do that going forward.
BR
Steen
---------------------------------------
Steen Hegelund
[email protected]