phy: rockchip: add usbdp combo phy driver
Subsystems (3)
PATCH 1/1 phy: rockchip: add usbdp combo phy driver
This adds a new USBDP combo PHY with Samsung IP block driver. The driver has been taken from Kernel driver and adopted for using in barebox.
Signed-off-by Alexander Shiyan <[email protected]>
--- drivers/phy/rockchip/Kconfig | 8 + drivers/phy/rockchip/Makefile | 1 + drivers/phy/rockchip/phy-rockchip-usbdp.c | 1222 +++++++++++++++++++++ include/linux/bitfield.h | 26 + 4 files changed, 1257 insertions(+) create mode 100644 drivers/phy/rockchip/phy-rockchip-usbdp.c
drivers/phy/rockchip/Kconfig +8 -0
@@ -18,3 +18,11 @@ config PHY_ROCKCHIP_SNPS_PCIE3 depends on ARCH_ROCKCHIP || COMPILE_TEST help Enable this to support the Rockchip snps PCIe3 PHY. + +config PHY_ROCKCHIP_USBDP + bool "Rockchip USBDP COMBO PHY Driver" + depends on ARCH_ROCKCHIP + select TYPEC + help + Enable this to support the Rockchip USB3.0/DP combo PHY with + Samsung IP block. This is required for USB3 support on RK3588.
drivers/phy/rockchip/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY) += phy-rockchip-naneng-combphy.o obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3) += phy-rockchip-snps-pcie3.o +obj-$(CONFIG_PHY_ROCKCHIP_USBDP) += phy-rockchip-usbdp.o
drivers/phy/rockchip/phy-rockchip-usbdp.c new file +1222 -0
1,222 lines not on this page · raw message
include/linux/bitfield.h +26 -0
@@ -90,6 +90,32 @@ ((typeof (_mask))(_val) <<__bf_shf (_mask)) & (_mask); \ }) +#define __BF_CHECK_POW2 (n) BUILD_BUG_ON_ZERO(((n) & ((n) - 1)) != 0) + +/** +* FIELD_PREP_CONST() - prepare a constant bitfield element +* @_mask: shifted mask defining the field's length and position +* @_val: value to put in the field +* +* FIELD_PREP_CONST() masks and shifts up the value. The result should +* be combined with other fields of the bitfield using logical OR. +* +* Unlike FIELD_PREP() this is a constant expression and can therefore +* be used in initializers. Error checking is less comfortable for this +* version, and non-constant masks cannot be used. +*/ +#define FIELD_PREP_CONST (_mask, _val) \ + ( \ +/* mask must be non-zero */ \ +BUILD_BUG_ON_ZERO ((_mask) ==0 ) + \ +/* check if value fits */ \ +BUILD_BUG_ON_ZERO (~((_mask) >>__bf_shf (_mask)) & (_val)) + \ +/* check if mask is contiguous */ \ +__BF_CHECK_POW2 ((_mask) + (1ULL <<__bf_shf (_mask))) + \ +/* and create the value */ \ + (((typeof (_mask))(_val) <<__bf_shf (_mask)) & (_mask)) \ + ) +/** * FIELD_GET() - extract a bitfield element * @_mask: shifted mask defining the field's length and position
Signature · 1 line
2.38.2
Sascha Hauer
AppliedQuoted 5 lines · Alexander Shiyan
This adds a new USBDP combo PHY with Samsung IP block driver. The driver has been taken from Kernel driver and adopted for using in barebox.
Applied, thanks!
[1/1] phy: rockchip: add usbdp combo phy driver
https://git.pengutronix.de/cgit/barebox/commit/?id=31a93f07fffa (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>