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

bcma: add bcma_core_pci_fixcfg()

This code is based on code from pcicore_fixcfg() in brcmsmac. This
patch is part of the move of pci specific code from brcmsmac to bcma.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Hauke Mehrtens and committed by
John W. Linville
ec00f373 29f6b3d8

+24
+19
drivers/bcma/driver_pci.c
··· 168 168 tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN); 169 169 } 170 170 171 + static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) 172 + { 173 + struct bcma_device *core = pc->core; 174 + u16 val16, core_index; 175 + uint regoff; 176 + 177 + regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); 178 + core_index = (u16)core->core_index; 179 + 180 + val16 = pcicore_read16(pc, regoff); 181 + if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) 182 + != core_index) { 183 + val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | 184 + (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); 185 + pcicore_write16(pc, regoff, val16); 186 + } 187 + } 188 + 171 189 /************************************************** 172 190 * Init. 173 191 **************************************************/ 174 192 175 193 static void __devinit bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) 176 194 { 195 + bcma_core_pci_fixcfg(pc); 177 196 bcma_pcicore_serdes_workaround(pc); 178 197 } 179 198
+5
include/linux/bcma/bcma_driver_pci.h
··· 87 87 #define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ 88 88 #define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */ 89 89 #define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */ 90 + #define BCMA_CORE_PCI_SPROM_PI_OFFSET 0 /* first word */ 91 + #define BCMA_CORE_PCI_SPROM_PI_MASK 0xf000 /* bit 15:12 */ 92 + #define BCMA_CORE_PCI_SPROM_PI_SHIFT 12 /* bit 15:12 */ 90 93 91 94 /* SBtoPCIx */ 92 95 #define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000 ··· 205 202 }; 206 203 207 204 /* Register access */ 205 + #define pcicore_read16(pc, offset) bcma_read16((pc)->core, offset) 208 206 #define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) 207 + #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) 209 208 #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 210 209 211 210 extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc);