phy: realtek: usb2: support for RTL9607C USB2 PHY
Subsystems (2)
v5 cover phy: realtek: usb2: support for RTL9607C USB2 PHY
This patch series for Realtek USB2 PHY driver adds support for RTL9607C USB2 PHY.
RTL9607C is a big endian MIPS CPU which is quite far from RTD series SoCs supported by realtek usb2 phy driver, but the phy initilization is found to be very indentical in most areas.
Most of the code was based on the Realtek's usb driver from the GPL tarball in [1] and adjusted to fit into the realtek usb2 phy driver code format.
The patch series was split into smaller patches that add/change something in the driver that are not exactly related to RTL9607C and that also helps for easier review. That also means, patch 5 depends on all the prior patches that come before it.
USB2 PHY on RTL9607C is primarly used for its internal OHCI/EHCI controllers.
[1] - https://github.com/jameywine/GPL-for-GP3000/blob/main/linux-5.10.x/arch/mips/rtl9607c/usb.c
---
Changelog in v5:
Mostly addressing LLM review
- Patch 1
- changed int to u32 type for new_reg_req and vstatus_busy data fields.
- changed comments in rtk_phy_read/write from PHY_NEW_REG_REQ to phy_reg->new_reg_req.
- Patch 2
- explained readl/writel native endianess issue in more detail.
- explained why vstatus register doesn't need byte swapping.
- Patch 4
- moved reset_control_deassert to rtk_phy_init function to keep it outside of for loop.
- changed msleep(5) to usleep_range(5000, 6000).
- explained why reset_control_assert is not needed.
- Patch 5
- explained readl/writel native endianess issue here as well.
- explained why FORCE_DISCONNECT_REG doesn't need byte swapping.
- Link to v4: https://lore.kernel.org/linux-phy/[email protected]/
Changelog in v4:
- Patch 2
- moved the le variations of read/write functions to Patch 5 where it is actually used because otherwise, it results in unused errors when only Patch 2 is applied.
- updated the commit message to to point the reason for le32 wrappers around readl/writel.
- Patch 3
- added "Reviewed by Krzysztof Kozlowski"
- Patch 5
- updated the commit message to include the addition of little endian read/write functions from Patch 2.
- Link to v3: https://lore.kernel.org/linux-phy/[email protected]/
Changelog in v3:
- Patch 2
- renamed phy read and functions to "rtk_usb2phy" to not collide with networking API functions
- fixed the sparse warnings by creating intermidiate "tmp" variable and then pass it to writel
- sligtly adjusted commit message to instead use "default read" not "default phy_read"
- Patch 4
- added the check for reset_control_deassert() just in case
- changed mdelay(5) to msleep(5)
- changed dev_err and return combo with one dev_err_probe for phy_rst
- Patch 5
- changed mdelay(10) under force_host_disconnect to msleep(10)
- removed struct fields with false like force_host_disconnect and more in rtl9607_phy_cfg
- Patch 6
- updated the #endif commend to now include MACH_REALTEK_RTL to reflect if on top
- Link to v2: https://lore.kernel.org/linux-phy/[email protected]/
Changelog in v2:
- Patch 3
- removed the line about OHCI/EHCI controllers from description.
- set the resets to false for RTD SoC devices and changed the
commit message to reflect that.
- Link to v1: https://lore.kernel.org/linux-phy/[email protected]/
Rustam Adilov (6):
phy: realtek: usb2: introduce vstatus/new_reg_req variables to driver
data
phy: realtek: usb2: introduce read and write functions to driver data
dt-bindings: phy: realtek,usb2phy.yaml: extend for resets and RTL9607C
support
phy: realtek: usb2: introduce reset controller struct
phy: realtek: usb2: add support for RTL9607C USB2 PHY
phy: realtek: Make configs available for MACH_REALTEK_RTL
.../bindings/phy/realtek,usb2phy.yaml | 25 ++- drivers/phy/realtek/Kconfig | 4 +- drivers/phy/realtek/phy-rtk-usb2.c | 191 ++++++++++++++++-- 3 files changed, 195 insertions(+), 25 deletions(-)
Signature · 1 line
2.53.0
PATCH v5 1/6 phy: realtek: usb2: introduce vstatus/new_reg_req variables to driver data
In RTL9607C SoC, the vstatus register is located at a certain offset from the base and so introduce the vstatus_offset to handle it.
Busy bit of the vstatus and new_reg_req bit are also different and so introduce these variables to the driver data as well.
Add these variables to the pre-existing phy cfg structs for RTD SoCs and assign them the default values.
--- drivers/phy/realtek/phy-rtk-usb2.c | 67 +++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 15 deletions(-)
drivers/phy/realtek/phy-rtk-usb2.c +52 -15
@@ -64,6 +64,9 @@ struct phy_reg {void __iomem *reg_wrap_vstatus;void __iomem *reg_gusb2phyacc0;int vstatus_index; +int vstatus_offset; +u32 vstatus_busy; +u32 new_reg_req; };struct phy_data {
@@ -96,6 +99,9 @@ struct phy_cfg {bool do_toggle_driving;bool use_default_parameter;bool is_double_sensitivity_mode; +int vstatus_offset; +u32 vstatus_busy; +u32 new_reg_req; };struct phy_parameter {
@@ -162,21 +168,21 @@ static char rtk_phy_read(struct phy_reg *phy_reg, char addr) addr -=OFFEST_PHY_READ ;/* polling until VBusy == 0 */ - ret =utmi_wait_register (reg_gusb2phyacc0,PHY_VSTS_BUSY ,0 ); + ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return (char )ret; -/* VCtrl = low nibble of addr, and set PHY_NEW_REG_REQ */ - val =PHY_NEW_REG_REQ | (GET_LOW_NIBBLE (addr) <<PHY_VCTRL_SHIFT ); +/* VCtrl = low nibble of addr, and set phy_reg->new_reg_req */ + val = phy_reg->new_reg_req | (GET_LOW_NIBBLE (addr) <<PHY_VCTRL_SHIFT );writel (val, reg_gusb2phyacc0); - ret =utmi_wait_register (reg_gusb2phyacc0,PHY_VSTS_BUSY ,0 ); + ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return (char )ret; -/* VCtrl = high nibble of addr, and set PHY_NEW_REG_REQ */ - val =PHY_NEW_REG_REQ | (GET_HIGH_NIBBLE (addr) <<PHY_VCTRL_SHIFT ); +/* VCtrl = high nibble of addr, and set phy_reg->new_reg_req */ + val = phy_reg->new_reg_req | (GET_HIGH_NIBBLE (addr) <<PHY_VCTRL_SHIFT );writel (val, reg_gusb2phyacc0); - ret =utmi_wait_register (reg_gusb2phyacc0,PHY_VSTS_BUSY ,0 ); + ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return (char )ret;
@@ -194,25 +200,25 @@ static int rtk_phy_write(struct phy_reg *phy_reg, char addr, char data)int ret =0 ;/* write data to VStatusOut2 (data output to phy) */ -writel ((u32 )data << shift_bits, reg_wrap_vstatus); +writel ((u32 )data << shift_bits, reg_wrap_vstatus + phy_reg->vstatus_offset); - ret =utmi_wait_register (reg_gusb2phyacc0,PHY_VSTS_BUSY ,0 ); + ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return ret; -/* VCtrl = low nibble of addr, set PHY_NEW_REG_REQ */ - val =PHY_NEW_REG_REQ | (GET_LOW_NIBBLE (addr) <<PHY_VCTRL_SHIFT ); +/* VCtrl = low nibble of addr, set phy_reg->new_reg_req */ + val = phy_reg->new_reg_req | (GET_LOW_NIBBLE (addr) <<PHY_VCTRL_SHIFT );writel (val, reg_gusb2phyacc0); - ret =utmi_wait_register (reg_gusb2phyacc0,PHY_VSTS_BUSY ,0 ); + ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return ret; -/* VCtrl = high nibble of addr, set PHY_NEW_REG_REQ */ - val =PHY_NEW_REG_REQ | (GET_HIGH_NIBBLE (addr) <<PHY_VCTRL_SHIFT ); +/* VCtrl = high nibble of addr, set phy_reg->new_reg_req */ + val = phy_reg->new_reg_req | (GET_HIGH_NIBBLE (addr) <<PHY_VCTRL_SHIFT );writel (val, reg_gusb2phyacc0); - ret =utmi_wait_register (reg_gusb2phyacc0,PHY_VSTS_BUSY ,0 ); + ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return ret;
@@ -957,6 +963,7 @@ static int get_phy_data_by_efuse(struct rtk_phy *rtk_phy,static int parse_phy_data (struct rtk_phy *rtk_phy) { +struct phy_cfg *phy_cfg = rtk_phy->phy_cfg;struct device *dev = rtk_phy->dev;struct device_node *np = dev->of_node;struct phy_parameter *phy_parameter;
@@ -974,6 +981,9 @@ static int parse_phy_data(struct rtk_phy *rtk_phy) phy_parameter->phy_reg.reg_wrap_vstatus =of_iomap (np,0 ); phy_parameter->phy_reg.reg_gusb2phyacc0 =of_iomap (np,1 ) + index; phy_parameter->phy_reg.vstatus_index = index; + phy_parameter->phy_reg.vstatus_offset = phy_cfg->vstatus_offset; + phy_parameter->phy_reg.vstatus_busy = phy_cfg->vstatus_busy; + phy_parameter->phy_reg.new_reg_req = phy_cfg->new_reg_req;if (of_property_read_bool (np,"realtek,inverse-hstx-sync-clock" )) phy_parameter->inverse_hstx_sync_clock = true;
@@ -1085,6 +1095,9 @@ static const struct phy_cfg rtd1295_phy_cfg = { .driving_updated_for_dev_dis = 0xf, .use_default_parameter = false, .is_double_sensitivity_mode = false, + .vstatus_offset = 0, + .vstatus_busy = PHY_VSTS_BUSY, + .new_reg_req = PHY_NEW_REG_REQ, };static const struct phy_cfg rtd1395_phy_cfg = {
@@ -1109,6 +1122,9 @@ static const struct phy_cfg rtd1395_phy_cfg = { .driving_updated_for_dev_dis = 0xf, .use_default_parameter = false, .is_double_sensitivity_mode = false, + .vstatus_offset = 0, + .vstatus_busy = PHY_VSTS_BUSY, + .new_reg_req = PHY_NEW_REG_REQ, };static const struct phy_cfg rtd1395_phy_cfg_2port = {
@@ -1133,6 +1149,9 @@ static const struct phy_cfg rtd1395_phy_cfg_2port = { .driving_updated_for_dev_dis = 0xf, .use_default_parameter = false, .is_double_sensitivity_mode = false, + .vstatus_offset = 0, + .vstatus_busy = PHY_VSTS_BUSY, + .new_reg_req = PHY_NEW_REG_REQ, };static const struct phy_cfg rtd1619_phy_cfg = {
@@ -1155,6 +1174,9 @@ static const struct phy_cfg rtd1619_phy_cfg = { .driving_updated_for_dev_dis = 0xf, .use_default_parameter = false, .is_double_sensitivity_mode = false, + .vstatus_offset = 0, + .vstatus_busy = PHY_VSTS_BUSY, + .new_reg_req = PHY_NEW_REG_REQ, };static const struct phy_cfg rtd1319_phy_cfg = {
@@ -1181,6 +1203,9 @@ static const struct phy_cfg rtd1319_phy_cfg = { .driving_updated_for_dev_dis = 0xf, .use_default_parameter = false, .is_double_sensitivity_mode = true, + .vstatus_offset = 0, + .vstatus_busy = PHY_VSTS_BUSY, + .new_reg_req = PHY_NEW_REG_REQ, };static const struct phy_cfg rtd1312c_phy_cfg = {
@@ -1206,6 +1231,9 @@ static const struct phy_cfg rtd1312c_phy_cfg = { .driving_updated_for_dev_dis = 0xf, .use_default_parameter = false, .is_double_sensitivity_mode = true, + .vstatus_offset = 0, + .vstatus_busy = PHY_VSTS_BUSY, + .new_reg_req = PHY_NEW_REG_REQ, };static const struct phy_cfg rtd1619b_phy_cfg = {
@@ -1231,6 +1259,9 @@ static const struct phy_cfg rtd1619b_phy_cfg = { .driving_updated_for_dev_dis = 0x8, .use_default_parameter = false, .is_double_sensitivity_mode = true, + .vstatus_offset = 0, + .vstatus_busy = PHY_VSTS_BUSY, + .new_reg_req = PHY_NEW_REG_REQ, };static const struct phy_cfg rtd1319d_phy_cfg = {
@@ -1256,6 +1287,9 @@ static const struct phy_cfg rtd1319d_phy_cfg = { .driving_updated_for_dev_dis = 0x8, .use_default_parameter = false, .is_double_sensitivity_mode = true, + .vstatus_offset = 0, + .vstatus_busy = PHY_VSTS_BUSY, + .new_reg_req = PHY_NEW_REG_REQ, };static const struct phy_cfg rtd1315e_phy_cfg = {
@@ -1282,6 +1316,9 @@ static const struct phy_cfg rtd1315e_phy_cfg = { .driving_updated_for_dev_dis = 0x8, .use_default_parameter = false, .is_double_sensitivity_mode = true, + .vstatus_offset = 0, + .vstatus_busy = PHY_VSTS_BUSY, + .new_reg_req = PHY_NEW_REG_REQ, };static const struct of_device_id usbphy_rtk_dt_match[] = {
Signature · 1 line
2.53.0
PATCH v5 2/6 phy: realtek: usb2: introduce read and write functions to driver data
In reply to Rustam AdilovRTL9607C is a big endian SoC but has little endian USB host controller and thus, reads and writes to the reg_gusb2phyacc0 should go through le32_to_cpu and cpu_to_le32 functions respectively. This doesn't apply to vstatus register though as it is in the different register region compared to USB host controller region.
The reason is readl/writel functions, despite the supposed little endian byte swap, still operate with native endian and this is because RTL9607C is MIPS and here readl/writel are native unless SWAP_IO_SPACE is enabled. Enabling SWAP_IO_SPACE results in boot hangs so that is not an option. And so wrapping them around le32 makes a proper byte swap from big endian to little endian.
To handle this situation, introduce read and write functions to the driver data and create a default variation of read and write function for the current RTD SoCs.
Adjust all instances of utmi_wait_register function to now include the read function as one of its arguments.
Assign the existing phy configuration for RTD SoCs to the default read and write functions.
--- drivers/phy/realtek/phy-rtk-usb2.c | 63 ++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 13 deletions(-)
drivers/phy/realtek/phy-rtk-usb2.c +50 -13
@@ -67,6 +67,9 @@ struct phy_reg {int vstatus_offset;u32 vstatus_busy;u32 new_reg_req; + +u32 (*read)(void__iomem *reg); +void (*write)(u32 val,void __iomem *reg); };struct phy_data {
@@ -102,6 +105,9 @@ struct phy_cfg {int vstatus_offset;u32 vstatus_busy;u32 new_reg_req; + +u32 (*read)(void__iomem *reg); +void (*write)(u32 val,void __iomem *reg); };struct phy_parameter {
@@ -128,6 +134,16 @@ struct rtk_phy {struct dentry *debug_dir; }; +static u32 rtk_usb2phy_read (void __iomem *reg) +{ +return readl (reg); +} + +static void rtk_usb2phy_write (u32 val,void __iomem *reg) +{ +writel (val, reg); +} +/* mapping 0xE0 to 0 ... 0xE7 to 7, 0xF0 to 8 ,,, 0xF7 to 15 */ static inline int page_addr_to_array_index (u8 addr) {
@@ -144,12 +160,13 @@ static inline u8 array_index_to_page_addr(int index)#define PHY_IO_TIMEOUT_USEC (50000)#define PHY_IO_DELAY_US (100) -static inline int utmi_wait_register (void __iomem *reg,u32 mask,u32 result) +static inline int utmi_wait_register (u32 (*read)(void __iomem *reg),void __iomem *reg,u32 mask, +u32 result) {int ret;unsigned int val; - ret =read_poll_timeout (readl, val, ((val & mask) == result), + ret =read_poll_timeout (read, val, ((val & mask) == result),PHY_IO_DELAY_US ,PHY_IO_TIMEOUT_USEC , false, reg);if (ret) {pr_err ("%s can't program USB phy\n" , __func__);
@@ -168,25 +185,25 @@ static char rtk_phy_read(struct phy_reg *phy_reg, char addr) addr -=OFFEST_PHY_READ ;/* polling until VBusy == 0 */ - ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 ); + ret =utmi_wait_register (phy_reg->read, reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return (char )ret;/* VCtrl = low nibble of addr, and set phy_reg->new_reg_req */ val = phy_reg->new_reg_req | (GET_LOW_NIBBLE (addr) <<PHY_VCTRL_SHIFT ); -writel (val, reg_gusb2phyacc0); - ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 ); + phy_reg->write (val, reg_gusb2phyacc0); + ret =utmi_wait_register (phy_reg->read, reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return (char )ret;/* VCtrl = high nibble of addr, and set phy_reg->new_reg_req */ val = phy_reg->new_reg_req | (GET_HIGH_NIBBLE (addr) <<PHY_VCTRL_SHIFT ); -writel (val, reg_gusb2phyacc0); - ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 ); + phy_reg->write (val, reg_gusb2phyacc0); + ret =utmi_wait_register (phy_reg->read, reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return (char )ret; - val =readl (reg_gusb2phyacc0); + val = phy_reg->read (reg_gusb2phyacc0);return (char )(val &PHY_REG_DATA_MASK ); }
@@ -202,23 +219,23 @@ static int rtk_phy_write(struct phy_reg *phy_reg, char addr, char data)/* write data to VStatusOut2 (data output to phy) */ writel ((u32 )data << shift_bits, reg_wrap_vstatus + phy_reg->vstatus_offset); - ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 ); + ret =utmi_wait_register (phy_reg->read, reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return ret;/* VCtrl = low nibble of addr, set phy_reg->new_reg_req */ val = phy_reg->new_reg_req | (GET_LOW_NIBBLE (addr) <<PHY_VCTRL_SHIFT ); -writel (val, reg_gusb2phyacc0); - ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 ); + phy_reg->write (val, reg_gusb2phyacc0); + ret =utmi_wait_register (phy_reg->read, reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return ret;/* VCtrl = high nibble of addr, set phy_reg->new_reg_req */ val = phy_reg->new_reg_req | (GET_HIGH_NIBBLE (addr) <<PHY_VCTRL_SHIFT ); -writel (val, reg_gusb2phyacc0); - ret =utmi_wait_register (reg_gusb2phyacc0, phy_reg->vstatus_busy,0 ); + phy_reg->write (val, reg_gusb2phyacc0); + ret =utmi_wait_register (phy_reg->read, reg_gusb2phyacc0, phy_reg->vstatus_busy,0 );if (ret)return ret;
@@ -984,6 +1001,8 @@ static int parse_phy_data(struct rtk_phy *rtk_phy) phy_parameter->phy_reg.vstatus_offset = phy_cfg->vstatus_offset; phy_parameter->phy_reg.vstatus_busy = phy_cfg->vstatus_busy; phy_parameter->phy_reg.new_reg_req = phy_cfg->new_reg_req; + phy_parameter->phy_reg.read = phy_cfg->read; + phy_parameter->phy_reg.write = phy_cfg->write;if (of_property_read_bool (np,"realtek,inverse-hstx-sync-clock" )) phy_parameter->inverse_hstx_sync_clock = true;
@@ -1098,6 +1117,8 @@ static const struct phy_cfg rtd1295_phy_cfg = { .vstatus_offset = 0, .vstatus_busy = PHY_VSTS_BUSY, .new_reg_req = PHY_NEW_REG_REQ, + .read = rtk_usb2phy_read, + .write = rtk_usb2phy_write, };static const struct phy_cfg rtd1395_phy_cfg = {
@@ -1125,6 +1146,8 @@ static const struct phy_cfg rtd1395_phy_cfg = { .vstatus_offset = 0, .vstatus_busy = PHY_VSTS_BUSY, .new_reg_req = PHY_NEW_REG_REQ, + .read = rtk_usb2phy_read, + .write = rtk_usb2phy_write, };static const struct phy_cfg rtd1395_phy_cfg_2port = {
@@ -1152,6 +1175,8 @@ static const struct phy_cfg rtd1395_phy_cfg_2port = { .vstatus_offset = 0, .vstatus_busy = PHY_VSTS_BUSY, .new_reg_req = PHY_NEW_REG_REQ, + .read = rtk_usb2phy_read, + .write = rtk_usb2phy_write, };static const struct phy_cfg rtd1619_phy_cfg = {
@@ -1177,6 +1202,8 @@ static const struct phy_cfg rtd1619_phy_cfg = { .vstatus_offset = 0, .vstatus_busy = PHY_VSTS_BUSY, .new_reg_req = PHY_NEW_REG_REQ, + .read = rtk_usb2phy_read, + .write = rtk_usb2phy_write, };static const struct phy_cfg rtd1319_phy_cfg = {
@@ -1206,6 +1233,8 @@ static const struct phy_cfg rtd1319_phy_cfg = { .vstatus_offset = 0, .vstatus_busy = PHY_VSTS_BUSY, .new_reg_req = PHY_NEW_REG_REQ, + .read = rtk_usb2phy_read, + .write = rtk_usb2phy_write, };static const struct phy_cfg rtd1312c_phy_cfg = {
@@ -1234,6 +1263,8 @@ static const struct phy_cfg rtd1312c_phy_cfg = { .vstatus_offset = 0, .vstatus_busy = PHY_VSTS_BUSY, .new_reg_req = PHY_NEW_REG_REQ, + .read = rtk_usb2phy_read, + .write = rtk_usb2phy_write, };static const struct phy_cfg rtd1619b_phy_cfg = {
@@ -1262,6 +1293,8 @@ static const struct phy_cfg rtd1619b_phy_cfg = { .vstatus_offset = 0, .vstatus_busy = PHY_VSTS_BUSY, .new_reg_req = PHY_NEW_REG_REQ, + .read = rtk_usb2phy_read, + .write = rtk_usb2phy_write, };static const struct phy_cfg rtd1319d_phy_cfg = {
@@ -1290,6 +1323,8 @@ static const struct phy_cfg rtd1319d_phy_cfg = { .vstatus_offset = 0, .vstatus_busy = PHY_VSTS_BUSY, .new_reg_req = PHY_NEW_REG_REQ, + .read = rtk_usb2phy_read, + .write = rtk_usb2phy_write, };static const struct phy_cfg rtd1315e_phy_cfg = {
@@ -1319,6 +1354,8 @@ static const struct phy_cfg rtd1315e_phy_cfg = { .vstatus_offset = 0, .vstatus_busy = PHY_VSTS_BUSY, .new_reg_req = PHY_NEW_REG_REQ, + .read = rtk_usb2phy_read, + .write = rtk_usb2phy_write, };static const struct of_device_id usbphy_rtk_dt_match[] = {
Signature · 1 line
2.53.0
PATCH v5 3/6 dt-bindings: phy: realtek,usb2phy.yaml: extend for resets and RTL9607C support
In reply to Rustam AdilovAdd the "realtek,rtl9607-usb2phy" compatible for USB2 PHY on the RTL9607C SoC series.
Add a resets property to properties to describe the usb2phy reset line.
In RTL9607C, USB2 PHY reset line is from "IP Enable controller" which is multipurpose and handle activating various SoC peripherals.
It is unclear whether RTD SoCs have something similar to that so set the resets to false for these devices.
RTL9607C requires the "resets" to be specified so add the corresponding if check for the "realtek,rtl9607-usb2phy" compatible.
--- .../bindings/phy/realtek,usb2phy.yaml | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/phy/realtek,usb2phy.yaml +24 -1
@@ -11,7 +11,8 @@ maintainers: - Stanley Chang <[email protected]> description: | - Realtek USB 2.0 PHY support the digital home center (DHC) RTD series SoCs. + Realtek USB 2.0 PHY support the digital home center (DHC) RTD and + RTL9607C series SoCs. The USB 2.0 PHY driver is designed to support the XHCI controller. The SoCs support multiple XHCI controllers. One PHY device node maps to one XHCI controller.
@@ -57,6 +58,12 @@ description: | XHCI controller#1 -- usb2phy -- phy#0 XHCI controller#2 -- usb2phy -- phy#0 + RTL9607C SoCs USB + The USB architecture includes OHCI and EHCI controllers. + Both of them map to one USB2.0 PHY. + OHCI controller#0 -- usb2phy -- phy#0 + EHCI controller#0 -- usb2phy -- phy#0 + properties: compatible: enum:
@@ -69,6 +76,7 @@ properties: - realtek,rtd1395-usb2phy-2port - realtek,rtd1619-usb2phy - realtek,rtd1619b-usb2phy + - realtek,rtl9607-usb2phy reg: items:
@@ -130,6 +138,9 @@ properties: minimum: -8 maximum: 8 + resets: + maxItems: 1 + required: - compatible - reg
@@ -157,6 +168,18 @@ allOf: then: properties: realtek,driving-level-compensate: false + - if: + properties: + compatible: + contains: + enum: + - realtek,rtl9607-usb2phy + then: + required: + - resets + else: + properties: + resets: false additionalProperties: false
Signature · 1 line
2.53.0
Re: [PATCH v5 3/6] dt-bindings: phy: realtek,usb2phy.yaml: extend for resets and RTL9607C support
Quoted 5 lines · Rustam Adilov
Add the "realtek,rtl9607-usb2phy" compatible for USB2 PHY on the RTL9607C SoC series.
Add a resets property to properties to describe the usb2phy reset line.
Quoted 8 lines
In RTL9607C, USB2 PHY reset line is from "IP Enable controller" which is multipurpose and handle activating various SoC peripherals.
It is unclear whether RTD SoCs have something similar to that so set the resets to false for these devices.
RTL9607C requires the "resets" to be specified so add the corresponding if check for the "realtek,rtl9607-usb2phy" compatible.
<form letter>
This is a friendly reminder during the review process.
It looks like you received a tag and forgot to add it.
If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.
Please read:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577
If a tag was not added on purpose, please state in the patch changelog or cover letter why and what changed.
</form letter>
Pay attention to the last part. Intentional dropping tag is the same as "not adding".
Best regards,
Krzysztof
PATCH v5 4/6 phy: realtek: usb2: introduce reset controller struct
In reply to Rustam AdilovIn RTL9607C, there is so called "IP Enable Controller" which resemble reset controller with reset lines and is used for various things like USB, PCIE, GMAC and such.
Introduce the reset_control struct to this driver to handle deasserting usb2 phy reset line.
Make use of the function devm_reset_control_array_get_optional_exclusive() function to get the reset controller and since existing RTD SoCs don't specify the resets we can have a cleaner code.
Since the vendor usb driver developed by Realtek doesn't assert the reset line (or in their case clear the register bit), we can reasonably assume reset_control_assert is not needed here.
--- drivers/phy/realtek/phy-rtk-usb2.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/phy/realtek/phy-rtk-usb2.c +16 -0
@@ -17,6 +17,7 @@#include <linux/sys_soc.h> #include <linux/mfd/syscon.h> #include <linux/phy/phy.h> +#include <linux/reset.h> #include <linux/usb.h> /* GUSB2PHYACCn register */
@@ -130,6 +131,7 @@ struct rtk_phy {struct phy_cfg *phy_cfg;int num_phy;struct phy_parameter *phy_parameter; +struct reset_control *phy_rst;struct dentry *debug_dir; };
@@ -676,6 +678,15 @@ static int rtk_phy_init(struct phy *phy)if (!rtk_phy)return -EINVAL ; +if (rtk_phy->phy_rst) { + ret =reset_control_deassert (rtk_phy->phy_rst); + +if (ret) +return ret; + +usleep_range (5000 ,6000 ); + } +for (i =0 ; i < rtk_phy->num_phy; i++) ret =do_rtk_phy_init (rtk_phy, i);
@@ -1059,6 +1070,11 @@ static int rtk_usb2phy_probe(struct platform_device *pdev) rtk_phy->num_phy = phy_cfg->num_phy; + rtk_phy->phy_rst =devm_reset_control_array_get_optional_exclusive (dev); +if (IS_ERR (rtk_phy->phy_rst)) +return dev_err_probe (dev,PTR_ERR (rtk_phy->phy_rst), +"usb2 phy resets are not working\n" ); + ret =parse_phy_data (rtk_phy);if (ret) goto err;
Signature · 1 line
2.53.0
PATCH v5 5/6 phy: realtek: usb2: add support for RTL9607C USB2 PHY
In reply to Rustam AdilovAdd support for the usb2 phy of RTL9607C series based SoCs. Add the macros and phy config struct for rtl9607.
RTL9607C requires to clear a "force host disconnect" bit in the specific register (which is at an offset from reg_wrap_vstatus) before proceeding with phy parameter writes. Since it belongs into the vstatus register region, it doesn't need bytes swapping.
Add the bool variable to the driver data struct and hide this whole procedure under the if statement that checks this new variable.
Add the appropriate little endian read and write functions for rtl9607 and assign them to its phy config struct.
As mentioned earlier, the readl/writel are native endian on MIPS arch if SWAP_IO_SPACE is not enabled. Since enabling SWAP_IO_SPACE results in boot hang on RTL9607C machine, wrapping le32 around readl/writel should be a good compromise, but swab32 could be also work.
--- drivers/phy/realtek/phy-rtk-usb2.c | 57 ++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+)
drivers/phy/realtek/phy-rtk-usb2.c +57 -0
@@ -26,6 +26,12 @@#define PHY_VCTRL_SHIFT 8#define PHY_REG_DATA_MASK 0xff +#define PHY_9607_VSTS_BUSY BIT(17) +#define PHY_9607_NEW_REG_REQ BIT(13) + +#define PHY_9607_FORCE_DISCONNECT_REG 0x10 +#define PHY_9607_FORCE_DISCONNECT_BIT BIT(5) +#define GET_LOW_NIBBLE (addr) ((addr) & 0x0f)#define GET_HIGH_NIBBLE (addr) (((addr) & 0xf0) >> 4)
@@ -109,6 +115,7 @@ struct phy_cfg {u32 (*read)(void__iomem *reg);void (*write)(u32 val,void __iomem *reg); +bool force_host_disconnect; };struct phy_parameter {
@@ -146,6 +153,18 @@ static void rtk_usb2phy_write(u32 val, void __iomem *reg)writel (val, reg); } +static u32 rtk_usb2phy_read_le (void __iomem *reg) +{ +return le32_to_cpu (readl (reg)); +} + +static void rtk_usb2phy_write_le (u32 val,void __iomem *reg) +{ +u32 tmp =cpu_to_le32 (val); + +writel (tmp, reg); +} +/* mapping 0xE0 to 0 ... 0xE7 to 7, 0xF0 to 8 ,,, 0xF7 to 15 */ static inline int page_addr_to_array_index (u8 addr) {
@@ -600,6 +619,16 @@ static int do_rtk_phy_init(struct rtk_phy *rtk_phy, int index) goto do_toggle; } +if (phy_cfg->force_host_disconnect) { +/* disable force-host-disconnect */ +u32 temp =readl (phy_reg->reg_wrap_vstatus +PHY_9607_FORCE_DISCONNECT_REG ); + + temp &= ~PHY_9607_FORCE_DISCONNECT_BIT ; +writel (temp, phy_reg->reg_wrap_vstatus +PHY_9607_FORCE_DISCONNECT_REG ); + +msleep (10 ); + } +/* Set page 0 */ phy_data_page = phy_cfg->page0;rtk_phy_set_page (phy_reg,0 );
@@ -1374,6 +1403,33 @@ static const struct phy_cfg rtd1315e_phy_cfg = { .write = rtk_usb2phy_write, }; +static const struct phy_cfg rtl9607_phy_cfg = { + .page0_size =MAX_USB_PHY_PAGE0_DATA_SIZE , + .page0 = { [0 ] = {0xe0 ,0x95 }, + [4 ] = {0xe4 ,0x6a }, + [12 ] = {0xf3 ,0x31 }, }, + .page1_size =MAX_USB_PHY_PAGE1_DATA_SIZE , + .page1 = { [0 ] = {0xe0 ,0x26 }, }, + .page2_size =MAX_USB_PHY_PAGE2_DATA_SIZE , + .page2 = { [7 ] = {0xe7 ,0x33 }, }, + .num_phy =1 , + .check_efuse_version =CHECK_EFUSE_V2 , + .efuse_dc_driving_rate =EFUS_USB_DC_CAL_RATE , + .dc_driving_mask =0x1f , + .efuse_dc_disconnect_rate =EFUS_USB_DC_DIS_RATE , + .dc_disconnect_mask =0xf , + .usb_dc_disconnect_at_page0 = true, + .do_toggle = true, + .driving_updated_for_dev_dis =0x8 , + .is_double_sensitivity_mode = true, + .vstatus_offset =0xc , + .vstatus_busy =PHY_9607_VSTS_BUSY , + .new_reg_req =PHY_9607_NEW_REG_REQ , + .read = rtk_usb2phy_read_le, + .write = rtk_usb2phy_write_le, + .force_host_disconnect = true, +}; +static const struct of_device_id usbphy_rtk_dt_match[] = { { .compatible ="realtek,rtd1295-usb2phy" , .data = &rtd1295_phy_cfg }, { .compatible ="realtek,rtd1312c-usb2phy" , .data = &rtd1312c_phy_cfg },
@@ -1384,6 +1440,7 @@ static const struct of_device_id usbphy_rtk_dt_match[] = { { .compatible = "realtek,rtd1395-usb2phy-2port", .data = &rtd1395_phy_cfg_2port }, { .compatible = "realtek,rtd1619-usb2phy", .data = &rtd1619_phy_cfg }, { .compatible = "realtek,rtd1619b-usb2phy", .data = &rtd1619b_phy_cfg }, + { .compatible = "realtek,rtl9607-usb2phy", .data = &rtl9607_phy_cfg }, {}, };MODULE_DEVICE_TABLE (of, usbphy_rtk_dt_match);
Signature · 1 line
2.53.0
Re: [PATCH v5 5/6] phy: realtek: usb2: add support for RTL9607C USB2 PHY
drivers/phy/realtek/phy-rtk-usb2.c static void rtk_usb2phy_write(u32 val, void __iomem *reg) · line 158
Quoted 7 lines · Rustam Adilov
drivers/phy/realtek/phy-rtk-usb2.c +3
-0@@ -146,6 +153,18 @@ static void rtk_usb2phy_write(u32 val, void __iomem *reg)writel (val, reg); } +static u32 rtk_usb2phy_read_le (void __iomem *reg) +{ +return le32_to_cpu (readl (reg));
"make C=1" warning:drivers/phy/realtek/phy-rtk-usb2.c:158:16: warning: cast to restricted __le32
drivers/phy/realtek/phy-rtk-usb2.c static void rtk_usb2phy_write(u32 val, void __iomem *reg) · line 163
Quoted 5 lines
drivers/phy/realtek/phy-rtk-usb2.c +5
-0+} + +static void rtk_usb2phy_write_le (u32 val,void __iomem *reg) +{ +u32 tmp =cpu_to_le32 (val);
"make C=1" warning:drivers/phy/realtek/phy-rtk-usb2.c:163:19: warning: incorrect type in initializer (different base types)drivers/phy/realtek/phy-rtk-usb2.c:163:19: expected unsigned int [usertype] tmpdrivers/phy/realtek/phy-rtk-usb2.c:163:19: got restricted __le32 [usertype]
Quoted 7 lines
drivers/phy/realtek/phy-rtk-usb2.c +4
-0+ +writel (tmp, reg); +} +/* mapping 0xE0 to 0 ... 0xE7 to 7, 0xF0 to 8 ,,, 0xF7 to 15 */ static inline int page_addr_to_array_index (u8 addr) {
Re: [PATCH v5 5/6] phy: realtek: usb2: add support for RTL9607C USB2 PHY
In reply to Rustam AdilovQuoted 19 lines · Rustam Adilov
Add support for the usb2 phy of RTL9607C series based SoCs. Add the macros and phy config struct for rtl9607.
RTL9607C requires to clear a "force host disconnect" bit in the specific register (which is at an offset from
reg_wrap_vstatus) before proceeding with phy parameter writes. Since it belongs into the vstatus register region, it doesn't need bytes swapping.Add the bool variable to the driver data struct and hide this whole procedure under the if statement that checks this new variable.
Add the appropriate little endian read and write functions for rtl9607 and assign them to its phy config struct.
As mentioned earlier, the readl/writel are native endian on MIPS arch if
SWAP_IO_SPACEis not enabled. Since enablingSWAP_IO_SPACEresults in boot hang on RTL9607C machine, wrapping le32 around readl/writel should be a good compromise, but swab32 could be also work.
Quoted 4 lines
Co-developed-by Michael Zavertkin <[email protected]>Signed-off-by Michael Zavertkin <[email protected]>Signed-off-by Rustam Adilov <[email protected]>---
Have you considered ioread32() instead of wrapping le32 around readl()?
Re: [PATCH v5 5/6] phy: realtek: usb2: add support for RTL9607C USB2 PHY
Quoted 20 lines · Vladimir Oltean
Quoted 19 lines · Rustam Adilov
Add support for the usb2 phy of RTL9607C series based SoCs. Add the macros and phy config struct for rtl9607.
RTL9607C requires to clear a "force host disconnect" bit in the specific register (which is at an offset from
reg_wrap_vstatus) before proceeding with phy parameter writes. Since it belongs into the vstatus register region, it doesn't need bytes swapping.Add the bool variable to the driver data struct and hide this whole procedure under the if statement that checks this new variable.
Add the appropriate little endian read and write functions for rtl9607 and assign them to its phy config struct.
As mentioned earlier, the readl/writel are native endian on MIPS arch if
SWAP_IO_SPACEis not enabled. Since enablingSWAP_IO_SPACEresults in boot hang on RTL9607C machine, wrapping le32 around readl/writel should be a good compromise, but swab32 could be also work.
Quoted 6 lines
Quoted 4 lines
Co-developed-by Michael Zavertkin <[email protected]>Signed-off-by Michael Zavertkin <[email protected]>Signed-off-by Rustam Adilov <[email protected]>---
Have you considered
ioread32()instead of wrapping le32 aroundreadl()?
I think you meant ioread32be() and yes i have considered it. If this is what it takes to get rid of le32 warning you mentioned from an earlier email then so be it.
Re: [PATCH v5 5/6] phy: realtek: usb2: add support for RTL9607C USB2 PHY
Quoted 26 lines · Rustam Adilov
Quoted 25 lines · Vladimir Oltean
Quoted 23 lines · Rustam Adilov
Add support for the usb2 phy of RTL9607C series based SoCs. Add the macros and phy config struct for rtl9607.
RTL9607C requires to clear a "force host disconnect" bit in the specific register (which is at an offset from
reg_wrap_vstatus) before proceeding with phy parameter writes. Since it belongs into the vstatus register region, it doesn't need bytes swapping.Add the bool variable to the driver data struct and hide this whole procedure under the if statement that checks this new variable.
Add the appropriate little endian read and write functions for rtl9607 and assign them to its phy config struct.
As mentioned earlier, the readl/writel are native endian on MIPS arch if
SWAP_IO_SPACEis not enabled. Since enablingSWAP_IO_SPACEresults in boot hang on RTL9607C machine, wrapping le32 around readl/writel should be a good compromise, but swab32 could be also work.Co-developed-by Michael Zavertkin <[email protected]>Signed-off-by Michael Zavertkin <[email protected]>Signed-off-by Rustam Adilov <[email protected]>---
Quoted 5 lines
Quoted 1 line
Have you considered
ioread32()instead of wrapping le32 aroundreadl()?I think you meant
ioread32be()and yes i have considered it. If this is what it takes to get rid of le32 warning you mentioned from an earlier email then so be it.
No, I meant ioread32(). When I read Documentation/driver-api/device-io.rst, it says ioread32() is for a little endian peripheral and ioread32be() for big endian peripherals. You have a little endian peripheral (relevant) and a big endian CPU (not relevant) so I don't see why ioread32() wouldn't be the correct accessor to use.
PATCH v5 6/6 phy: realtek: Make configs available for MACH_REALTEK_RTL
In reply to Rustam AdilovAdd the MACH_REALTEK_RTL to the if statement to make the config options available for Realtek RTL SoCs as well.
--- drivers/phy/realtek/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/realtek/Kconfig +2 -2
@@ -3,7 +3,7 @@ # Phy drivers for Realtek platforms # -if ARCH_REALTEK || COMPILE_TEST +if ARCH_REALTEK || MACH_REALTEK_RTL || COMPILE_TEST config PHY_RTK_RTD_USB2PHY tristate "Realtek RTD USB2 PHY Transceiver Driver"
@@ -29,4 +29,4 @@ config PHY_RTK_RTD_USB3PHY DWC3 USB IP. This driver will do the PHY initialization of the parameters. -endif # ARCH_REALTEK || COMPILE_TEST +endif # ARCH_REALTEK || MACH_REALTEK_RTL || COMPILE_TEST
Signature · 1 line
2.53.0
Quoted 37 lines · Rustam Adilov
This patch series for Realtek USB2 PHY driver adds support for RTL9607C USB2 PHY.
RTL9607C is a big endian MIPS CPU which is quite far from RTD series SoCs supported by realtek usb2 phy driver, but the phy initilization is found to be very indentical in most areas.
Most of the code was based on the Realtek's usb driver from the GPL tarball in [1] and adjusted to fit into the realtek usb2 phy driver code format.
The patch series was split into smaller patches that add/change something in the driver that are not exactly related to RTL9607C and that also helps for easier review. That also means, patch 5 depends on all the prior patches that come before it.
USB2 PHY on RTL9607C is primarly used for its internal OHCI/EHCI controllers.
[1] - https://github.com/jameywine/GPL-for-GP3000/blob/main/linux-5.10.x/arch/mips/rtl9607c/usb.c
---
Changelog in v5:
Mostly addressing LLM review
- Patch 1
- changed int to u32 type fornew_reg_reqandvstatus_busydata fields.
- changed comments in rtk_phy_read/write fromPHY_NEW_REG_REQtophy_reg->new_reg_req.
- Patch 2
- explained readl/writel native endianess issue in more detail.
- explained why vstatus register doesn't need byte swapping.
- Patch 4
- movedreset_control_deasserttortk_phy_initfunction to keep it outside of for loop.
- changed msleep(5) tousleep_range(5000, 6000).
- explained whyreset_control_assertis not needed.
- Patch 5
- explained readl/writel native endianess issue here as well.
- explained whyFORCE_DISCONNECT_REGdoesn't need byte swapping.
- Link to v4: https://lore.kernel.org/linux-phy/[email protected]/
Quoted 7 lines
Changelog in v4:
- Patch 2
- moved the le variations of read/write functions to Patch 5 where it is actually used because otherwise, it results in unused errors when only Patch 2 is applied.
- updated the commit message to to point the reason for le32 wrappers around readl/writel.
- Patch 3
- added "Reviewed by Krzysztof Kozlowski"
Where?
Best regards,
Krzysztof
Quoted 46 lines · Krzysztof Kozlowski
Quoted 37 lines · Rustam Adilov
This patch series for Realtek USB2 PHY driver adds support for RTL9607C USB2 PHY.
RTL9607C is a big endian MIPS CPU which is quite far from RTD series SoCs supported by realtek usb2 phy driver, but the phy initilization is found to be very indentical in most areas.
Most of the code was based on the Realtek's usb driver from the GPL tarball in [1] and adjusted to fit into the realtek usb2 phy driver code format.
The patch series was split into smaller patches that add/change something in the driver that are not exactly related to RTL9607C and that also helps for easier review. That also means, patch 5 depends on all the prior patches that come before it.
USB2 PHY on RTL9607C is primarly used for its internal OHCI/EHCI controllers.
[1] - https://github.com/jameywine/GPL-for-GP3000/blob/main/linux-5.10.x/arch/mips/rtl9607c/usb.c
---
Changelog in v5:
Mostly addressing LLM review
- Patch 1
- changed int to u32 type fornew_reg_reqandvstatus_busydata fields.
- changed comments in rtk_phy_read/write fromPHY_NEW_REG_REQtophy_reg->new_reg_req.
- Patch 2
- explained readl/writel native endianess issue in more detail.
- explained why vstatus register doesn't need byte swapping.
- Patch 4
- movedreset_control_deasserttortk_phy_initfunction to keep it outside of for loop.
- changed msleep(5) tousleep_range(5000, 6000).
- explained whyreset_control_assertis not needed.
- Patch 5
- explained readl/writel native endianess issue here as well.
- explained whyFORCE_DISCONNECT_REGdoesn't need byte swapping.
- Link to v4: https://lore.kernel.org/linux-phy/[email protected]/Quoted 7 lines
Changelog in v4:
- Patch 2
- moved the le variations of read/write functions to Patch 5 where it is actually used because otherwise, it results in unused errors when only Patch 2 is applied.
- updated the commit message to to point the reason for le32 wrappers around readl/writel.
- Patch 3
- added "Reviewed by Krzysztof Kozlowski"
Quoted 1 line
Where?
Oi, it must have been lost in transmission because i added the tag manually to .patch after format-patch command instead of adding it to commit message. So it disappeared in v5.
Sorry about that. Unintentional blunder on my part.
Quoted 2 lines
Best regards,
Krzysztof
Thanks,
Rustam
Quoted 15 lines · Rustam Adilov
This patch series for Realtek USB2 PHY driver adds support for RTL9607C USB2 PHY.
RTL9607C is a big endian MIPS CPU which is quite far from RTD series SoCs supported by realtek usb2 phy driver, but the phy initilization is found to be very indentical in most areas.
Most of the code was based on the Realtek's usb driver from the GPL tarball in [1] and adjusted to fit into the realtek usb2 phy driver code format.
The patch series was split into smaller patches that add/change something in the driver that are not exactly related to RTL9607C and that also helps for easier review. That also means, patch 5 depends on all the prior patches that come before it.
Quoted 5 lines
USB2 PHY on RTL9607C is primarly used for its internal OHCI/EHCI controllers.
[1] - https://github.com/jameywine/GPL-for-GP3000/blob/main/linux-5.10.x/arch/mips/rtl9607c/usb.c
---
Could you go through Patchwork and reply inline to the issues found, stating whether you are or are not going to resolve them?
https://patchwork.kernel.org/project/linux-phy/list/?series=1083475
Quoted 18 lines · Vladimir Oltean
Quoted 17 lines · Rustam Adilov
This patch series for Realtek USB2 PHY driver adds support for RTL9607C USB2 PHY.
RTL9607C is a big endian MIPS CPU which is quite far from RTD series SoCs supported by realtek usb2 phy driver, but the phy initilization is found to be very indentical in most areas.
Most of the code was based on the Realtek's usb driver from the GPL tarball in [1] and adjusted to fit into the realtek usb2 phy driver code format.
The patch series was split into smaller patches that add/change something in the driver that are not exactly related to RTL9607C and that also helps for easier review. That also means, patch 5 depends on all the prior patches that come before it.
USB2 PHY on RTL9607C is primarly used for its internal OHCI/EHCI controllers.
Quoted 7 lines
Quoted 3 lines
[1] - https://github.com/jameywine/GPL-for-GP3000/blob/main/linux-5.10.x/arch/mips/rtl9607c/usb.c
---
Could you go through Patchwork and reply inline to the issues found, stating whether you are or are not going to resolve them?
https://patchwork.kernel.org/project/linux-phy/list/?series=1083475
Yeah, sure thing. However i do expect a good bit of refactoring of this patch series once we get SWAP_IO_SPACE working. It just turned out that some of the realtek drivers from various subsystems use readl/ioread32 for native endian (which is big endian for rtl9607c and others under MACH_REALTEK_RTL) and enabling SWAP_IO_SPACE makes them function in little endian which breaks those things. So that's what we are dealing with at this moment.
Quoted 1 line
All of the WARNING: line length of XX exceeds 80 columns
I can resolve them just fine.
Review
Quoted 3 lines
WARNING: msleep < 20ms can sleep for up to 20ms; see function description of
msleep(). #88: FILE:drivers/phy/realtek/phy-rtk-usb2.c:629:(quoted diff) +1
-0+ msleep(10);
I can resolve it by changing it to usleep_range like i did with reset controller one.
Quoted 4 lines
../drivers/phy/realtek/phy-rtk-usb2.c:158:16: warning: cast to restricted__le32../drivers/phy/realtek/phy-rtk-usb2.c:163:19: warning: incorrect type in initializer (different base types)../drivers/phy/realtek/phy-rtk-usb2.c:163:19: expected unsigned int [usertype] tmp../drivers/phy/realtek/phy-rtk-usb2.c:163:19: got restricted__le32[usertype]
That should be fixed by using ioread32be.
Quoted 1 line
1 maintainers not CCed: [email protected]
When i run scripts/get_maintainer.pl, it doesn't print it out at all but I can include it.
Quoted 2 lines
Detected inline keyword in C files
+static inline int utmi_wait_register(u32 (*read)(void__iomem*reg), void__iomem*reg, u32 mask,
Even though it was not introduced by this patch series, i think it is relevant as i am directly modifying its property to include read function to it. Something along like "While we are here, remove inline from utmi_wait_register"
I believe that is every issue from Checks list apart from Sashiko reviews.
Best,
Rustam