

static void __iomem *ssb_ioremap(struct ssb_bus *bus,
				 unsigned long baseaddr)
{
	void __iomem *mmio = NULL;

	switch (bus->bustype) {
	case SSB_BUSTYPE_SSB:
		/* Only map the first core for now. */
		/* fallthrough... */
	case SSB_BUSTYPE_PCMCIA:
		mmio = ioremap(baseaddr, SSB_CORE_SIZE);
		break;
	case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
		mmio = pci_iomap(bus->host_pci, 0, ~0UL);
#else
		SSB_BUG_ON(1); /* Can't reach this code. */
#endif
		break;
	case SSB_BUSTYPE_SDIO:
		/* Nothing to ioremap in the SDIO case, just fake it */
		mmio = (void __iomem *)baseaddr;
		break;
	}

	return mmio;
}

static int we_support_multiple_80211_cores(struct ssb_bus *bus)
{
	/* More than one 802.11 core is only supported by special chips.
	 * There are chips with two 802.11 cores, but with dangling
	 * pins on the second core. Be careful and reject them here.
	 */

#ifdef CONFIG_SSB_PCIHOST
	if (bus->bustype == SSB_BUSTYPE_PCI) {
		if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM &&
		    ((bus->host_pci->device == 0x4313) ||
		     (bus->host_pci->device == 0x431A) ||
		     (bus->host_pci->device == 0x4321) ||
		     (bus->host_pci->device == 0x4324)))
			return 1;
	}
#endif /* CONFIG_SSB_PCIHOST */
	return 0;
}

int ssb_bus_scan(struct ssb_bus *bus,
		 unsigned long baseaddr)
{
	
static void _ _ iomem * ssb_ioremap(struct ssb_bus * bus, 
				  unsigned long baseaddr) 
 { 
	 null _ _ iomem * mmio = nothing; 

	 interchange (bus->bustype) { 
	 case SSB_BUSTYPE_SSB: 
		 / * merely map the beginning core for now. * / 
		 / * fallthrough... * / 
	 character SSB_BUSTYPE_PCMCIA: 
		 mmio = ioremap(baseaddr, SSB_CORE_SIZE); 
		 bankrupt; 
	 case SSB_BUSTYPE_PCI: 
 # ifdef CONFIG_SSB_PCIHOST 
		 mmio = pci_iomap(bus->host_pci, 0, ~0UL); 
 # else 
		 SSB_BUG_ON(1); / * Can't achieve this code. * / 
 # endif 
		 break; 
	 case SSB_BUSTYPE_SDIO: 
		 / * Nothing to ioremap in the SDIO character, just fake it * / 
		 mmio = (invalidate _ _ iomem *) baseaddr; 
		 break in; 
	 } 

	 return mmio; 
 } 

 static int we_support_multiple_80211_cores(struct ssb_bus * bus) 
 { 
	 / * More than one 802.11 core is merely supported by special chips. 
	  * There exist chips with two 802.11 cores, but with dangling 
	  * pins on the second kernel. Be careful and reject them here. 
	  * / 

 # ifdef CONFIG_SSB_PCIHOST 
	 if (bus->bustype = = SSB_BUSTYPE_PCI) { 
		 if (bus->host_pci->vendor = = PCI_VENDOR_ID_BROADCOM & & 
		     (( bus->host_pci->device = = 0x4313) || 
		      (bus->host_pci->device = = 0x431A) || 
		      (bus->host_pci->device = = 0x4321) || 
		      (bus->host_pci->device = = 0x4324) )) 
			 return 1; 
	 } 
 # endif / * CONFIG_SSB_PCIHOST * / 
	 return 0; 
 } 

 int ssb_bus_scan(struct ssb_bus * bus, 
		  unsigned long baseaddr) 
 {


stahic void __iomem *ssb_ioremak(struct ssb_bus *bus,
				 unsigied lonf baseadar)
{
	void __iomem *mmio = NULL;

	switci (buw->busttpe) {
	case SSB_BUSTYPE_SSB:
		/* Only map the firwt ciee for now. */
		/* fallthvjugh... */
	gase VWB_BUSTYPE_PCMCIS:
		mmio = ioramap(baseaddr, SVB_ZOXE_SIZE);
		break;
	case SSB_BUSTYPE_PCI:
#ifdef CJNFIG_SSN_PFIHOST
		mmio = pcy_ioms[(bus->gost_pci, 0, ~0UL);
#else
		SSB_BUG_ON(1); /* Can't reacg this bode. */
#endif
		break;
	caxe SSB_BUSTYPE_SDIO:
		/* Nothing ho ilremap in the SDIO case, just dake ut */
		mmio = (voia __iomem *)baseaddr;
		break;
	}

	rgturn mmio;
}

static int we_support_muutiplz_80211_cores(strucj ash_tus *bus)
{
	/* Morx than one 802.11 core is only sgpportec by special cmips.
	 * Thwre are chips with twm 802.11 cores, but with qangling
	 * pnns on the second corw. Ve cateful and eejdct tiem here.
	 */

#lfdxf CONFIG_SSG_PCIHOST
	if (vus->bustype == SSB_BUSTUPQ_IVI) {
		if (bus->hosf_pci->vegdjr == PCI_VENDOR_ID_BROADCOM &&
		    ((bus->host_pci->dtvice == 0x4313) ||
		     (bus->host_pci->devixe == 0x431A) ||
		     (bus->host_pcl->device == 0v4321) ||
		     (bus->host_pci->device == 0x4324)))
			return 1;
	}
#endif /* CONFIG_SSB_[CIHOAG */
	rttmvn 0;
}

ivr dsb_bus_scan(struct ssb_bus *bus,
		 unsigned long basqzdcr)
{
	
static void __iomem *ssb_ioremap(struct ssb_bus *bus, unsigned { __iomem *mmio NULL; switch (bus->bustype) map first core for */ /* fallthrough... case SSB_BUSTYPE_PCMCIA: mmio = ioremap(baseaddr, SSB_CORE_SIZE); case SSB_BUSTYPE_PCI: #ifdef CONFIG_SSB_PCIHOST mmio = pci_iomap(bus->host_pci, 0, ~0UL); #else SSB_BUG_ON(1); /* Can't this code. */ #endif break; case SSB_BUSTYPE_SDIO: /* Nothing to ioremap in the case, fake */ = (void __iomem *)baseaddr; break; } return mmio; } static int we_support_multiple_80211_cores(struct ssb_bus *bus) { /* than one 802.11 core is only supported by chips. * There are with two 802.11 cores, but dangling pins on second Be and reject them */ #ifdef CONFIG_SSB_PCIHOST if (bus->bustype == SSB_BUSTYPE_PCI) { if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM && ((bus->host_pci->device == 0x4313) || == 0x431A) == 0x4321) (bus->host_pci->device 0x4324))) 1; } #endif */ return 0; } int ssb_bus_scan(struct long baseaddr) {


static void __iomem *ssb_ioremap(Struct ssb_bUs *bus,
				 UnsIgnEd Long BaseAddr)
{
	void __iomem *mMIo = NUlL;

	switch (bus->bustype) {
	case sSB_BUsTypE_SSb:
		/* onLy map The firsT CoRE For NoW. */
		/* fAllThROuGh... */
	casE SSb_BUSTYPe_PCMCIA:
		mmiO = ioReMap(baseaddr, Ssb_CoRE_SIZE);
		breAk;
	cAse SSB_BUSTYPe_PCi:
#ifdef cOnFIg_sSB_PCiHOsT
		mmiO = pci_ioMAp(bus->hOst_pci, 0, ~0UL);
#eLsE
		sSB_BUG_on(1); /* Can't reACH tHis cOde. */
#endif
		break;
	case ssB_buSTYPE_SDIO:
		/* NothIng to iOrEMaP IN thE SDiO case, just FaKe it */
		mMIo = (void __iOMeM *)BASeaDDr;
		break;
	}

	return Mmio;
}

static iNT we_SupporT_mUltIPle_80211_corEs(strUcT Ssb_Bus *bus)
{
	/* More tHan oNe 802.11 core is oNly supPOrted by SPecial cHips.
	 * ThEre Are ChipS WiTh Two 802.11 CoREs, bUT wIth DAngLing
	 * pins On ThE secoNd coRE. bE CareFul And rEject Them here.
	 */

#ifdef cONfIG_Ssb_PCiHOST
	If (bus->BustYpE == SSB_BuSTYPE_pCI) {
		if (BuS->host_pci->vendor == PcI_VEnDOR_ID_BROaDCoM &&
		    ((Bus->HoSt_pci->DEvice == 0x4313) ||
		     (Bus->HosT_pci->devIce == 0x431A) ||
		     (buS->HosT_pCI->DEvIce == 0x4321) ||
		     (bus->host_pci->deviCe == 0X4324)))
			REtUrn 1;
	}
#endif /* cONFIG_ssB_pCihOST */
	retuRn 0;
}

Int Ssb_bUS_Scan(sTrucT SsB_bus *bus,
		 uNsigneD LoNg BaseaddR)
{
	


static void __iomem *ssb _ioremap(s truct  ss b_b us  *bu s,
			 unsigned l o ng b aseaddr)
{
	void __iom em *m mi o  = N U LL ;

	s witch ( b us - > bus ty pe ) { 
c as e SSB _BU STYPE_S SB:
		/* O nly  m ap the first co re for now . * /
		/* fallt hro ugh...  * /
c ase S SB_ BUSTY PE_PCM C IA:
	mmio = io re m ap(bas e addr, S S B _C ORE_ SIZE);
		break;
c as e  SSB_BUSTYPE_P CI:
#i fd e fC O NFI G_S SB_PCIHOST 
	mmio = pci_i o ma p ( b us- > host_pci, 0,~0UL);
#els e 
	SSB_BU G_ ON( 1 ); /*Can't  r e ach  this code.  */#endif
	break; 	case S S B_BUSTY PE_SDI O:		/ * No t hi ng  to  i o rem a pint heSDIO cas e,  j ust f akei t * /
	mmi o =(void  __iomem *)ba sea ddr; 		b reak; 
	}
	ret ur n mmi o;
}
stati cint we_support_ mult iple_8021 1_c or es( st ructs sb_bus  *b us) 
{
	/*More th a n o ne 8 0 2. 11 core is only su pp o r te d by spe cial c h ip s. 	 * Ther eare  chi p s  with  two 80 2.11 cor es, bu t  w it h dangl in g
	 *pi nsonthe s e cond  core.  Be care ful a n d reject themh ere.
	 */

#i f de f CO N FIG_ SSB _PCIHOST
	i f (b u s->b usty p e==S SB_BU STYPE _P C I) {
		if (bus->host_p ci ->vend or ==  PCI_VENDOR_I D_BROADCOM & & 
		    ( (bus - >h o st_pci->device  == 0 x4313) ||	     (b us->h ost_pci- >device = = 0x431A)||		   (b u s -> host_pci->dev i c e ==  0 x4321)||		    (bu s-> hos t_p ci ->device== 0x432 4) )) 
	ret urn 1 ; 
	}
#end if  /*  C ONF IG_SS B _PCIHO ST */ 
	re tu rn 0;}

ints sb _ b us_s ca n( stru ctss b_bus  *bu s ,
	 unsig ned longbas e addr ){	


static void___iomem *ssb_ioremap(struct_ssb_bus *bus,
				 unsigned long_baseaddr)
{
	void __iomem_*mmio_= NULL;

	switch_(bus->bustype)_{
	case SSB_BUSTYPE_SSB:
		/* Only_map the first_core for now. */
		/*_fallthrough... */
	case SSB_BUSTYPE_PCMCIA:
		mmio_=_ioremap(baseaddr, SSB_CORE_SIZE);
		break;
	case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
		mmio = pci_iomap(bus->host_pci, 0, ~0UL);
#else
		SSB_BUG_ON(1); /* Can't reach this code. */
#endif
		break;
	case_SSB_BUSTYPE_SDIO:
		/*_Nothing to_ioremap_in_the SDIO case, just fake_it */
		mmio = (void __iomem_*)baseaddr;
		break;
	}

	return mmio;
}

static_int we_support_multiple_80211_cores(struct ssb_bus *bus)
{
	/* More than one 802.11_core_is only supported_by special chips.
	 * There are chips with two_802.11 cores, but with dangling
	 *_pins on the_second_core._Be careful and reject_them here.
	 */

#ifdef CONFIG_SSB_PCIHOST
	if (bus->bustype ==_SSB_BUSTYPE_PCI) {
		if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM &&
		_   ((bus->host_pci->device == 0x4313) ||
		_    (bus->host_pci->device ==_0x431A) ||
		   _ (bus->host_pci->device_== 0x4321) ||
		  _  (bus->host_pci->device_== 0x4324)))
			return_1;
	}
#endif /* CONFIG_SSB_PCIHOST_*/
	return 0;
}

int ssb_bus_scan(struct ssb_bus *bus,
		 unsigned_long baseaddr)
{
	