Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: usb: Migrate to BIT and BITMASK macros

Using BIT and BITMASK macros makes it much easier to read and make
modifications. Also reordered some constants to be in numerical order.

Signed-off-by: Justin Chen <justinpopo6@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/1665005418-15807-4-git-send-email-justinpopo6@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Justin Chen and committed by
Vinod Koul
7e81153d f7fc5b70

+74 -74
+34 -34
drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c
··· 18 18 #define PIARBCTL_CAM 0x00 19 19 #define PIARBCTL_SPLITTER 0x04 20 20 #define PIARBCTL_MISC 0x08 21 - #define PIARBCTL_MISC_SECURE_MASK 0x80000000 22 - #define PIARBCTL_MISC_USB_SELECT_MASK 0x40000000 23 - #define PIARBCTL_MISC_USB_4G_SDRAM_MASK 0x20000000 24 - #define PIARBCTL_MISC_USB_PRIORITY_MASK 0x000f0000 25 - #define PIARBCTL_MISC_USB_MEM_PAGE_MASK 0x0000f000 26 - #define PIARBCTL_MISC_CAM1_MEM_PAGE_MASK 0x00000f00 27 - #define PIARBCTL_MISC_CAM0_MEM_PAGE_MASK 0x000000f0 28 - #define PIARBCTL_MISC_SATA_PRIORITY_MASK 0x0000000f 21 + #define PIARBCTL_MISC_SATA_PRIORITY_MASK GENMASK(3, 0) 22 + #define PIARBCTL_MISC_CAM0_MEM_PAGE_MASK GENMASK(7, 4) 23 + #define PIARBCTL_MISC_CAM1_MEM_PAGE_MASK GENMASK(11, 8) 24 + #define PIARBCTL_MISC_USB_MEM_PAGE_MASK GENMASK(15, 12) 25 + #define PIARBCTL_MISC_USB_PRIORITY_MASK GENMASK(19, 16) 26 + #define PIARBCTL_MISC_USB_4G_SDRAM_MASK BIT(29) 27 + #define PIARBCTL_MISC_USB_SELECT_MASK BIT(30) 28 + #define PIARBCTL_MISC_SECURE_MASK BIT(31) 29 29 30 30 #define PIARBCTL_MISC_USB_ONLY_MASK \ 31 31 (PIARBCTL_MISC_USB_SELECT_MASK | \ ··· 35 35 36 36 /* Register definitions for the USB CTRL block */ 37 37 #define USB_CTRL_SETUP 0x00 38 - #define USB_CTRL_SETUP_STRAP_IPP_SEL_MASK 0x02000000 39 - #define USB_CTRL_SETUP_SCB2_EN_MASK 0x00008000 40 - #define USB_CTRL_SETUP_tca_drv_sel_MASK 0x01000000 41 - #define USB_CTRL_SETUP_SCB1_EN_MASK 0x00004000 42 - #define USB_CTRL_SETUP_SOFT_SHUTDOWN_MASK 0x00000200 43 - #define USB_CTRL_SETUP_IPP_MASK 0x00000020 44 - #define USB_CTRL_SETUP_IOC_MASK 0x00000010 38 + #define USB_CTRL_SETUP_IOC_MASK BIT(4) 39 + #define USB_CTRL_SETUP_IPP_MASK BIT(5) 40 + #define USB_CTRL_SETUP_SOFT_SHUTDOWN_MASK BIT(9) 41 + #define USB_CTRL_SETUP_SCB1_EN_MASK BIT(14) 42 + #define USB_CTRL_SETUP_SCB2_EN_MASK BIT(15) 43 + #define USB_CTRL_SETUP_tca_drv_sel_MASK BIT(24) 44 + #define USB_CTRL_SETUP_STRAP_IPP_SEL_MASK BIT(25) 45 45 #define USB_CTRL_USB_PM 0x04 46 - #define USB_CTRL_USB_PM_USB_PWRDN_MASK 0x80000000 47 - #define USB_CTRL_USB_PM_SOFT_RESET_MASK 0x40000000 48 - #define USB_CTRL_USB_PM_BDC_SOFT_RESETB_MASK 0x00800000 49 - #define USB_CTRL_USB_PM_XHC_SOFT_RESETB_MASK 0x00400000 50 - #define USB_CTRL_USB_PM_XHC_PME_EN_MASK 0x00000010 51 - #define USB_CTRL_USB_PM_XHC_S2_CLK_SWITCH_EN_MASK 0x00000008 46 + #define USB_CTRL_USB_PM_XHC_S2_CLK_SWITCH_EN_MASK BIT(3) 47 + #define USB_CTRL_USB_PM_XHC_PME_EN_MASK BIT(4) 48 + #define USB_CTRL_USB_PM_XHC_SOFT_RESETB_MASK BIT(22) 49 + #define USB_CTRL_USB_PM_BDC_SOFT_RESETB_MASK BIT(23) 50 + #define USB_CTRL_USB_PM_SOFT_RESET_MASK BIT(30) 51 + #define USB_CTRL_USB_PM_USB_PWRDN_MASK BIT(31) 52 52 #define USB_CTRL_USB_PM_STATUS 0x08 53 53 #define USB_CTRL_USB_DEVICE_CTL1 0x10 54 - #define USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK 0x00000003 54 + #define USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK GENMASK(1, 0) 55 55 #define USB_CTRL_TEST_PORT_CTL 0x30 56 - #define USB_CTRL_TEST_PORT_CTL_TPOUT_SEL_MASK 0x000000ff 56 + #define USB_CTRL_TEST_PORT_CTL_TPOUT_SEL_MASK GENMASK(7, 0) 57 57 #define USB_CTRL_TEST_PORT_CTL_TPOUT_SEL_PME_GEN_MASK 0x0000002e 58 58 #define USB_CTRL_TP_DIAG1 0x34 59 - #define USB_CTLR_TP_DIAG1_wake_MASK 0x00000002 59 + #define USB_CTLR_TP_DIAG1_wake_MASK BIT(1) 60 60 #define USB_CTRL_CTLR_CSHCR 0x50 61 - #define USB_CTRL_CTLR_CSHCR_ctl_pme_en_MASK 0x00040000 61 + #define USB_CTRL_CTLR_CSHCR_ctl_pme_en_MASK BIT(18) 62 62 63 63 /* Register definitions for the USB_PHY block in 7211b0 */ 64 64 #define USB_PHY_PLL_CTL 0x00 65 - #define USB_PHY_PLL_CTL_PLL_RESETB_MASK 0x40000000 65 + #define USB_PHY_PLL_CTL_PLL_RESETB_MASK BIT(30) 66 66 #define USB_PHY_PLL_LDO_CTL 0x08 67 - #define USB_PHY_PLL_LDO_CTL_AFE_CORERDY_MASK 0x00000004 68 - #define USB_PHY_PLL_LDO_CTL_AFE_LDO_PWRDWNB_MASK 0x00000002 69 - #define USB_PHY_PLL_LDO_CTL_AFE_BG_PWRDWNB_MASK 0x00000001 67 + #define USB_PHY_PLL_LDO_CTL_AFE_BG_PWRDWNB_MASK BIT(0) 68 + #define USB_PHY_PLL_LDO_CTL_AFE_LDO_PWRDWNB_MASK BIT(1) 69 + #define USB_PHY_PLL_LDO_CTL_AFE_CORERDY_MASK BIT(2) 70 70 #define USB_PHY_UTMI_CTL_1 0x04 71 - #define USB_PHY_UTMI_CTL_1_POWER_UP_FSM_EN_MASK 0x00000800 72 - #define USB_PHY_UTMI_CTL_1_PHY_MODE_MASK 0x0000000c 71 + #define USB_PHY_UTMI_CTL_1_PHY_MODE_MASK GENMASK(3, 2) 73 72 #define USB_PHY_UTMI_CTL_1_PHY_MODE_SHIFT 2 73 + #define USB_PHY_UTMI_CTL_1_POWER_UP_FSM_EN_MASK BIT(11) 74 74 #define USB_PHY_IDDQ 0x1c 75 - #define USB_PHY_IDDQ_phy_iddq_MASK 0x00000001 75 + #define USB_PHY_IDDQ_phy_iddq_MASK BIT(0) 76 76 #define USB_PHY_STATUS 0x20 77 - #define USB_PHY_STATUS_pll_lock_MASK 0x00000001 77 + #define USB_PHY_STATUS_pll_lock_MASK BIT(0) 78 78 79 79 /* Register definitions for the MDIO registers in the DWC2 block of 80 80 * the 7211b0. ··· 86 86 87 87 /* Register definitions for the BDC EC block in 7211b0 */ 88 88 #define BDC_EC_AXIRDA 0x0c 89 - #define BDC_EC_AXIRDA_RTS_MASK 0xf0000000 89 + #define BDC_EC_AXIRDA_RTS_MASK GENMASK(31, 28) 90 90 #define BDC_EC_AXIRDA_RTS_SHIFT 28 91 91 92 92
+40 -40
drivers/phy/broadcom/phy-brcm-usb-init.c
··· 21 21 22 22 /* Register definitions for the USB CTRL block */ 23 23 #define USB_CTRL_SETUP 0x00 24 - #define USB_CTRL_SETUP_IOC_MASK 0x00000010 25 - #define USB_CTRL_SETUP_IPP_MASK 0x00000020 26 - #define USB_CTRL_SETUP_BABO_MASK 0x00000001 27 - #define USB_CTRL_SETUP_FNHW_MASK 0x00000002 28 - #define USB_CTRL_SETUP_FNBO_MASK 0x00000004 29 - #define USB_CTRL_SETUP_WABO_MASK 0x00000008 30 - #define USB_CTRL_SETUP_SCB_CLIENT_SWAP_MASK 0x00002000 /* option */ 31 - #define USB_CTRL_SETUP_SCB1_EN_MASK 0x00004000 /* option */ 32 - #define USB_CTRL_SETUP_SCB2_EN_MASK 0x00008000 /* option */ 33 - #define USB_CTRL_SETUP_SS_EHCI64BIT_EN_MASK 0X00020000 /* option */ 34 - #define USB_CTRL_SETUP_SS_EHCI64BIT_EN_VAR_MASK 0x00010000 /* option */ 35 - #define USB_CTRL_SETUP_STRAP_IPP_SEL_MASK 0x02000000 /* option */ 36 - #define USB_CTRL_SETUP_CC_DRD_MODE_ENABLE_MASK 0x04000000 /* option */ 37 - #define USB_CTRL_SETUP_STRAP_CC_DRD_MODE_ENABLE_SEL_MASK 0x08000000 /* opt */ 38 - #define USB_CTRL_SETUP_OC3_DISABLE_MASK 0xc0000000 /* option */ 24 + #define USB_CTRL_SETUP_BABO_MASK BIT(0) 25 + #define USB_CTRL_SETUP_FNHW_MASK BIT(1) 26 + #define USB_CTRL_SETUP_FNBO_MASK BIT(2) 27 + #define USB_CTRL_SETUP_WABO_MASK BIT(3) 28 + #define USB_CTRL_SETUP_IOC_MASK BIT(4) 29 + #define USB_CTRL_SETUP_IPP_MASK BIT(5) 30 + #define USB_CTRL_SETUP_SCB_CLIENT_SWAP_MASK BIT(13) /* option */ 31 + #define USB_CTRL_SETUP_SCB1_EN_MASK BIT(14) /* option */ 32 + #define USB_CTRL_SETUP_SCB2_EN_MASK BIT(15) /* option */ 33 + #define USB_CTRL_SETUP_SS_EHCI64BIT_EN_MASK BIT(17) /* option */ 34 + #define USB_CTRL_SETUP_SS_EHCI64BIT_EN_VAR_MASK BIT(16) /* option */ 35 + #define USB_CTRL_SETUP_STRAP_IPP_SEL_MASK BIT(25) /* option */ 36 + #define USB_CTRL_SETUP_CC_DRD_MODE_ENABLE_MASK BIT(26) /* option */ 37 + #define USB_CTRL_SETUP_STRAP_CC_DRD_MODE_ENABLE_SEL_MASK BIT(27) /* opt */ 38 + #define USB_CTRL_SETUP_OC3_DISABLE_MASK GENMASK(31, 30) /* option */ 39 39 #define USB_CTRL_PLL_CTL 0x04 40 - #define USB_CTRL_PLL_CTL_PLL_SUSPEND_EN_MASK 0x08000000 41 - #define USB_CTRL_PLL_CTL_PLL_RESETB_MASK 0x40000000 42 - #define USB_CTRL_PLL_CTL_PLL_IDDQ_PWRDN_MASK 0x80000000 /* option */ 40 + #define USB_CTRL_PLL_CTL_PLL_SUSPEND_EN_MASK BIT(27) 41 + #define USB_CTRL_PLL_CTL_PLL_RESETB_MASK BIT(30) 42 + #define USB_CTRL_PLL_CTL_PLL_IDDQ_PWRDN_MASK BIT(31) /* option */ 43 43 #define USB_CTRL_EBRIDGE 0x0c 44 - #define USB_CTRL_EBRIDGE_ESTOP_SCB_REQ_MASK 0x00020000 /* option */ 45 - #define USB_CTRL_EBRIDGE_EBR_SCB_SIZE_MASK 0x00000f80 /* option */ 44 + #define USB_CTRL_EBRIDGE_EBR_SCB_SIZE_MASK GENMASK(11, 7) /* option */ 45 + #define USB_CTRL_EBRIDGE_ESTOP_SCB_REQ_MASK BIT(17) /* option */ 46 46 #define USB_CTRL_OBRIDGE 0x10 47 - #define USB_CTRL_OBRIDGE_LS_KEEP_ALIVE_MASK 0x08000000 47 + #define USB_CTRL_OBRIDGE_LS_KEEP_ALIVE_MASK BIT(27) 48 48 #define USB_CTRL_MDIO 0x14 49 49 #define USB_CTRL_MDIO2 0x18 50 50 #define USB_CTRL_UTMI_CTL_1 0x2c 51 - #define USB_CTRL_UTMI_CTL_1_POWER_UP_FSM_EN_MASK 0x00000800 52 - #define USB_CTRL_UTMI_CTL_1_POWER_UP_FSM_EN_P1_MASK 0x08000000 51 + #define USB_CTRL_UTMI_CTL_1_POWER_UP_FSM_EN_MASK BIT(11) 52 + #define USB_CTRL_UTMI_CTL_1_POWER_UP_FSM_EN_P1_MASK BIT(27) 53 53 #define USB_CTRL_USB_PM 0x34 54 - #define USB_CTRL_USB_PM_BDC_SOFT_RESETB_MASK 0x00800000 /* option */ 55 - #define USB_CTRL_USB_PM_XHC_SOFT_RESETB_MASK 0x00400000 /* option */ 56 - #define USB_CTRL_USB_PM_XHC_SOFT_RESETB_VAR_MASK 0x40000000 /* option */ 57 - #define USB_CTRL_USB_PM_USB_PWRDN_MASK 0x80000000 /* option */ 58 - #define USB_CTRL_USB_PM_SOFT_RESET_MASK 0x40000000 /* option */ 59 - #define USB_CTRL_USB_PM_USB20_HC_RESETB_MASK 0x30000000 /* option */ 60 - #define USB_CTRL_USB_PM_USB20_HC_RESETB_VAR_MASK 0x00300000 /* option */ 61 - #define USB_CTRL_USB_PM_RMTWKUP_EN_MASK 0x00000001 54 + #define USB_CTRL_USB_PM_RMTWKUP_EN_MASK BIT(0) 55 + #define USB_CTRL_USB_PM_USB20_HC_RESETB_VAR_MASK GENMASK(21, 20) /* option */ 56 + #define USB_CTRL_USB_PM_XHC_SOFT_RESETB_MASK BIT(22) /* option */ 57 + #define USB_CTRL_USB_PM_BDC_SOFT_RESETB_MASK BIT(23) /* option */ 58 + #define USB_CTRL_USB_PM_USB20_HC_RESETB_MASK GENMASK(29, 28) /* option */ 59 + #define USB_CTRL_USB_PM_XHC_SOFT_RESETB_VAR_MASK BIT(30) /* option */ 60 + #define USB_CTRL_USB_PM_SOFT_RESET_MASK BIT(30) /* option */ 61 + #define USB_CTRL_USB_PM_USB_PWRDN_MASK BIT(31) /* option */ 62 62 #define USB_CTRL_USB_PM_STATUS 0x38 63 63 #define USB_CTRL_USB30_CTL1 0x60 64 - #define USB_CTRL_USB30_CTL1_PHY3_PLL_SEQ_START_MASK 0x00000010 65 - #define USB_CTRL_USB30_CTL1_PHY3_RESETB_MASK 0x00010000 66 - #define USB_CTRL_USB30_CTL1_XHC_SOFT_RESETB_MASK 0x00020000 /* option */ 67 - #define USB_CTRL_USB30_CTL1_USB3_IOC_MASK 0x10000000 /* option */ 68 - #define USB_CTRL_USB30_CTL1_USB3_IPP_MASK 0x20000000 /* option */ 64 + #define USB_CTRL_USB30_CTL1_PHY3_PLL_SEQ_START_MASK BIT(4) 65 + #define USB_CTRL_USB30_CTL1_PHY3_RESETB_MASK BIT(16) 66 + #define USB_CTRL_USB30_CTL1_XHC_SOFT_RESETB_MASK BIT(17) /* option */ 67 + #define USB_CTRL_USB30_CTL1_USB3_IOC_MASK BIT(28) /* option */ 68 + #define USB_CTRL_USB30_CTL1_USB3_IPP_MASK BIT(29) /* option */ 69 69 #define USB_CTRL_USB30_PCTL 0x70 70 - #define USB_CTRL_USB30_PCTL_PHY3_SOFT_RESETB_MASK 0x00000002 71 - #define USB_CTRL_USB30_PCTL_PHY3_IDDQ_OVERRIDE_MASK 0x00008000 72 - #define USB_CTRL_USB30_PCTL_PHY3_SOFT_RESETB_P1_MASK 0x00020000 70 + #define USB_CTRL_USB30_PCTL_PHY3_SOFT_RESETB_MASK BIT(1) 71 + #define USB_CTRL_USB30_PCTL_PHY3_IDDQ_OVERRIDE_MASK BIT(15) 72 + #define USB_CTRL_USB30_PCTL_PHY3_SOFT_RESETB_P1_MASK BIT(17) 73 73 #define USB_CTRL_USB_DEVICE_CTL1 0x90 74 - #define USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK 0x00000003 /* option */ 74 + #define USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK GENMASK(1, 0) /* option */ 75 75 76 76 /* Register definitions for the XHCI EC block */ 77 77 #define USB_XHCI_EC_IRAADR 0x658