Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ef1a57d authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by John W. Linville
Browse files

brcmsmac: use chip and package id constants from bcma



This patch depends on addin the chip IDs to bcma done in this commit in
my pending patch series for bcma.
Author: Hauke Mehrtens <hauke@hauke-m.de>
Date:   Sun Jun 3 18:17:57 2012 +0200

    bcma: add constants for chip ids

Acked-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 780b9c46
Loading
Loading
Loading
Loading
+0 −10
Original line number Original line Diff line number Diff line
@@ -88,16 +88,6 @@
#define	CLKD_OTP		0x000f0000
#define	CLKD_OTP		0x000f0000
#define	CLKD_OTP_SHIFT		16
#define	CLKD_OTP_SHIFT		16


/* Package IDs */
#define	BCM4717_PKG_ID		9	/* 4717 package id */
#define	BCM4718_PKG_ID		10	/* 4718 package id */
#define BCM43224_FAB_SMIC	0xa	/* the chip is manufactured by SMIC */

/* these are router chips */
#define	BCM4716_CHIP_ID		0x4716	/* 4716 chipcommon chipid */
#define	BCM47162_CHIP_ID	47162	/* 47162 chipcommon chipid */
#define	BCM4748_CHIP_ID		0x4748	/* 4716 chipcommon chipid (OTP, RBBU) */

/* dynamic clock control defines */
/* dynamic clock control defines */
#define	LPOMINFREQ		25000	/* low power oscillator min */
#define	LPOMINFREQ		25000	/* low power oscillator min */
#define	LPOMAXFREQ		43000	/* low power oscillator max */
#define	LPOMAXFREQ		43000	/* low power oscillator max */
+6 −6
Original line number Original line Diff line number Diff line
@@ -2126,8 +2126,8 @@ void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode)
{
{
	struct bcma_device *core = wlc_hw->d11core;
	struct bcma_device *core = wlc_hw->d11core;


	if ((ai_get_chip_id(wlc_hw->sih) == BCM43224_CHIP_ID) ||
	if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43224) ||
	    (ai_get_chip_id(wlc_hw->sih) == BCM43225_CHIP_ID)) {
	    (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) {
		if (spurmode == WL_SPURAVOID_ON2) {	/* 126Mhz */
		if (spurmode == WL_SPURAVOID_ON2) {	/* 126Mhz */
			bcma_write16(core, D11REGOFFS(tsf_clk_frac_l), 0x2082);
			bcma_write16(core, D11REGOFFS(tsf_clk_frac_l), 0x2082);
			bcma_write16(core, D11REGOFFS(tsf_clk_frac_h), 0x8);
			bcma_write16(core, D11REGOFFS(tsf_clk_frac_h), 0x8);
@@ -2791,7 +2791,7 @@ void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on)
	tmp = 0;
	tmp = 0;


	if (on) {
	if (on) {
		if ((ai_get_chip_id(wlc_hw->sih) == BCM4313_CHIP_ID)) {
		if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) {
			bcma_set32(core, D11REGOFFS(clk_ctl_st),
			bcma_set32(core, D11REGOFFS(clk_ctl_st),
				   CCS_ERSRC_REQ_HT |
				   CCS_ERSRC_REQ_HT |
				   CCS_ERSRC_REQ_D11PLL |
				   CCS_ERSRC_REQ_D11PLL |
@@ -4528,7 +4528,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,
	else
	else
		wlc_hw->_nbands = 1;
		wlc_hw->_nbands = 1;


	if ((ai_get_chip_id(wlc_hw->sih) == BCM43225_CHIP_ID))
	if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225))
		wlc_hw->_nbands = 1;
		wlc_hw->_nbands = 1;


	/* BMAC_NOTE: remove init of pub values when brcms_c_attach()
	/* BMAC_NOTE: remove init of pub values when brcms_c_attach()
@@ -5036,7 +5036,7 @@ static void brcms_b_hw_up(struct brcms_hardware *wlc_hw)
	wlc_hw->wlc->pub->hw_up = true;
	wlc_hw->wlc->pub->hw_up = true;


	if ((wlc_hw->boardflags & BFL_FEM)
	if ((wlc_hw->boardflags & BFL_FEM)
	    && (ai_get_chip_id(wlc_hw->sih) == BCM4313_CHIP_ID)) {
	    && (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) {
		if (!
		if (!
		    (wlc_hw->boardrev >= 0x1250
		    (wlc_hw->boardrev >= 0x1250
		     && (wlc_hw->boardflags & BFL_FEM_BT)))
		     && (wlc_hw->boardflags & BFL_FEM_BT)))
@@ -5130,7 +5130,7 @@ int brcms_c_up(struct brcms_c_info *wlc)
	}
	}


	if ((wlc->pub->boardflags & BFL_FEM)
	if ((wlc->pub->boardflags & BFL_FEM)
	    && (ai_get_chip_id(wlc->hw->sih) == BCM4313_CHIP_ID)) {
	    && (ai_get_chip_id(wlc->hw->sih) == BCMA_CHIP_ID_BCM4313)) {
		if (wlc->pub->boardrev >= 0x1250
		if (wlc->pub->boardrev >= 0x1250
		    && (wlc->pub->boardflags & BFL_FEM_BT))
		    && (wlc->pub->boardflags & BFL_FEM_BT))
			brcms_b_mhf(wlc->hw, MHF5, MHF5_4313_GPIOCTRL,
			brcms_b_mhf(wlc->hw, MHF5, MHF5_4313_GPIOCTRL,
+5 −5
Original line number Original line Diff line number Diff line
@@ -837,7 +837,7 @@ wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset,
	pi->tbl_data_hi = tblDataHi;
	pi->tbl_data_hi = tblDataHi;
	pi->tbl_data_lo = tblDataLo;
	pi->tbl_data_lo = tblDataLo;


	if (pi->sh->chip == BCM43224_CHIP_ID &&
	if (pi->sh->chip == BCMA_CHIP_ID_BCM43224 &&
	    pi->sh->chiprev == 1) {
	    pi->sh->chiprev == 1) {
		pi->tbl_addr = tblAddr;
		pi->tbl_addr = tblAddr;
		pi->tbl_save_id = tbl_id;
		pi->tbl_save_id = tbl_id;
@@ -847,7 +847,7 @@ wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset,


void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val)
void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val)
{
{
	if ((pi->sh->chip == BCM43224_CHIP_ID) &&
	if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) &&
	    (pi->sh->chiprev == 1) &&
	    (pi->sh->chiprev == 1) &&
	    (pi->tbl_save_id == NPHY_TBL_ID_ANTSWCTRLLUT)) {
	    (pi->tbl_save_id == NPHY_TBL_ID_ANTSWCTRLLUT)) {
		read_phy_reg(pi, pi->tbl_data_lo);
		read_phy_reg(pi, pi->tbl_data_lo);
@@ -881,7 +881,7 @@ wlc_phy_write_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,


	for (idx = 0; idx < ptbl_info->tbl_len; idx++) {
	for (idx = 0; idx < ptbl_info->tbl_len; idx++) {


		if ((pi->sh->chip == BCM43224_CHIP_ID) &&
		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) &&
		    (pi->sh->chiprev == 1) &&
		    (pi->sh->chiprev == 1) &&
		    (tbl_id == NPHY_TBL_ID_ANTSWCTRLLUT)) {
		    (tbl_id == NPHY_TBL_ID_ANTSWCTRLLUT)) {
			read_phy_reg(pi, tblDataLo);
			read_phy_reg(pi, tblDataLo);
@@ -918,7 +918,7 @@ wlc_phy_read_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,


	for (idx = 0; idx < ptbl_info->tbl_len; idx++) {
	for (idx = 0; idx < ptbl_info->tbl_len; idx++) {


		if ((pi->sh->chip == BCM43224_CHIP_ID) &&
		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) &&
		    (pi->sh->chiprev == 1)) {
		    (pi->sh->chiprev == 1)) {
			(void)read_phy_reg(pi, tblDataLo);
			(void)read_phy_reg(pi, tblDataLo);


@@ -2894,7 +2894,7 @@ const u8 *wlc_phy_get_ofdm_rate_lookup(void)


void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode)
void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode)
{
{
	if ((pi->sh->chip == BCM4313_CHIP_ID) &&
	if ((pi->sh->chip == BCMA_CHIP_ID_BCM4313) &&
	    (pi->sh->boardflags & BFL_FEM)) {
	    (pi->sh->boardflags & BFL_FEM)) {
		if (mode) {
		if (mode) {
			u16 txant = 0;
			u16 txant = 0;
+10 −10
Original line number Original line Diff line number Diff line
@@ -19309,8 +19309,8 @@ void wlc_phy_init_nphy(struct brcms_phy *pi)
		pi->measure_hold |= PHY_HOLD_FOR_NOT_ASSOC;
		pi->measure_hold |= PHY_HOLD_FOR_NOT_ASSOC;
	if ((ISNPHY(pi)) && (NREV_GE(pi->pubpi.phy_rev, 5)) &&
	if ((ISNPHY(pi)) && (NREV_GE(pi->pubpi.phy_rev, 5)) &&
	    ((pi->sh->chippkg == BCM4717_PKG_ID) ||
	    ((pi->sh->chippkg == BCMA_PKG_ID_BCM4717) ||
	     (pi->sh->chippkg == BCM4718_PKG_ID))) {
	     (pi->sh->chippkg == BCMA_PKG_ID_BCM4718))) {
		if ((pi->sh->boardflags & BFL_EXTLNA) &&
		if ((pi->sh->boardflags & BFL_EXTLNA) &&
		    (CHSPEC_IS2G(pi->radio_chanspec)))
		    (CHSPEC_IS2G(pi->radio_chanspec)))
			ai_cc_reg(pi->sh->sih,
			ai_cc_reg(pi->sh->sih,
@@ -20751,11 +20751,11 @@ wlc_phy_chanspec_radio2056_setup(struct brcms_phy *pi,
				cascbias = 0x20;
				cascbias = 0x20;
				if ((pi->sh->chip ==
				if ((pi->sh->chip ==
				     BCM43224_CHIP_ID)
				     BCMA_CHIP_ID_BCM43224)
				    || (pi->sh->chip ==
				    || (pi->sh->chip ==
					BCM43225_CHIP_ID)) {
					BCMA_CHIP_ID_BCM43225)) {
					if (pi->sh->chippkg ==
					if (pi->sh->chippkg ==
					    BCM43224_FAB_SMIC) {
					    BCMA_PKG_ID_BCM43224_FAB_SMIC) {
						bias = 0x2a;
						bias = 0x2a;
						cascbias = 0x38;
						cascbias = 0x38;
					}
					}
@@ -20863,9 +20863,9 @@ wlc_phy_chanspec_radio2056_setup(struct brcms_phy *pi,
			cascbias = 0x30;
			cascbias = 0x30;
			if ((pi->sh->chip == BCM43224_CHIP_ID) ||
			if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) ||
			    (pi->sh->chip == BCM43225_CHIP_ID)) {
			    (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) {
				if (pi->sh->chippkg == BCM43224_FAB_SMIC)
				if (pi->sh->chippkg == BCMA_PKG_ID_BCM43224_FAB_SMIC)
					cascbias = 0x35;
					cascbias = 0x35;
			}
			}
@@ -21193,8 +21193,8 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
		bcma_pmu_spuravoid_pllupdate(&sii->icbus->drv_cc, spuravoid);
		bcma_pmu_spuravoid_pllupdate(&sii->icbus->drv_cc, spuravoid);
		wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true);
		wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true);
		if ((pi->sh->chip == BCM43224_CHIP_ID) ||
		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) ||
		    (pi->sh->chip == BCM43225_CHIP_ID)) {
		    (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) {
			if (spuravoid == 1) {
			if (spuravoid == 1) {
				bcma_write16(pi->d11core,
				bcma_write16(pi->d11core,
					     D11REGOFFS(tsf_clk_frac_l),
					     D11REGOFFS(tsf_clk_frac_l),
+6 −6
Original line number Original line Diff line number Diff line
@@ -103,9 +103,9 @@ u16 si_pmu_fast_pwrup_delay(struct si_pub *sih)
	uint delay = PMU_MAX_TRANSITION_DLY;
	uint delay = PMU_MAX_TRANSITION_DLY;


	switch (ai_get_chip_id(sih)) {
	switch (ai_get_chip_id(sih)) {
	case BCM43224_CHIP_ID:
	case BCMA_CHIP_ID_BCM43224:
	case BCM43225_CHIP_ID:
	case BCMA_CHIP_ID_BCM43225:
	case BCM4313_CHIP_ID:
	case BCMA_CHIP_ID_BCM4313:
		delay = 3700;
		delay = 3700;
		break;
		break;
	default:
	default:
@@ -156,9 +156,9 @@ u32 si_pmu_alp_clock(struct si_pub *sih)
		return clock;
		return clock;


	switch (ai_get_chip_id(sih)) {
	switch (ai_get_chip_id(sih)) {
	case BCM43224_CHIP_ID:
	case BCMA_CHIP_ID_BCM43224:
	case BCM43225_CHIP_ID:
	case BCMA_CHIP_ID_BCM43225:
	case BCM4313_CHIP_ID:
	case BCMA_CHIP_ID_BCM4313:
		/* always 20Mhz */
		/* always 20Mhz */
		clock = 20000 * 1000;
		clock = 20000 * 1000;
		break;
		break;