Skip to content

Commit 1f807e0

Browse files
jamesequinlanpopcornmix
authored andcommitted
PCI: brcmstb: Do not assume that reg field starts at LSB
When setting a register field it was assumed that the field started at the lsb of the register. Although the masks do indeed start at the lsb, and this will probably not change, it is prudent to use a method that makes no assumption about the mask's placement in the register. The uXXp_replace_bits() calls are used since they are already prevalent in this driver. Signed-off-by: Jim Quinlan <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Florian Fainelli <[email protected]>
1 parent 57bc100 commit 1f807e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,10 @@ static void brcm_pcie_set_gen(struct brcm_pcie *pcie, int gen)
610610
u16 lnkctl2 = readw(pcie->base + BRCM_PCIE_CAP_REGS + PCI_EXP_LNKCTL2);
611611
u32 lnkcap = readl(pcie->base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
612612

613-
lnkcap = (lnkcap & ~PCI_EXP_LNKCAP_SLS) | gen;
613+
u32p_replace_bits(&lnkcap, gen, PCI_EXP_LNKCAP_SLS);
614614
writel(lnkcap, pcie->base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
615615

616-
lnkctl2 = (lnkctl2 & ~0xf) | gen;
616+
u16p_replace_bits(&lnkctl2, gen, PCI_EXP_LNKCTL2_TLS);
617617
writew(lnkctl2, pcie->base + BRCM_PCIE_CAP_REGS + PCI_EXP_LNKCTL2);
618618
}
619619

0 commit comments

Comments
 (0)