
8 May
2024
8 May
'24
3:35 a.m.
On 5/4/24 5:03 PM, Minda Chen wrote:
[...]
+static void cdns_mode_init(struct cdns_starfive *data, enum usb_dr_mode mode) +{
- regmap_update_bits(data->stg_syscon, data->stg_usb_mode,
USB_MISC_CFG_MASK,
USB_SUSPENDM_BYPS | USB_PLL_EN | USB_REFCLK_MODE);
- switch (mode) {
- case USB_DR_MODE_HOST:
regmap_update_bits(data->stg_syscon,
data->stg_usb_mode,
USB_STRAP_MASK,
USB_STRAP_HOST);
regmap_update_bits(data->stg_syscon,
data->stg_usb_mode,
USB_SUSPENDM_MASK,
USB_SUSPENDM_HOST);
Can you deduplicate thse regmap_update_bits at the end of this function ? Set a variable to USB_STRAP_HOST and another to USB_SUSPENDM_HOST here, set the same variables to USB_STRAP_DEVICE/0 below, and then call regmap_update_bits() with these variables at the end of this function once.
break;
- case USB_DR_MODE_PERIPHERAL:
regmap_update_bits(data->stg_syscon, data->stg_usb_mode,
USB_STRAP_MASK, USB_STRAP_DEVICE);
regmap_update_bits(data->stg_syscon, data->stg_usb_mode,
USB_SUSPENDM_MASK, 0);
break;
- default:
break;
- }
+}
[...]